{"version":3,"sources":["webpack:///./src/app/components/src/app/components/NewTask.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA8HA;EACA;AACA","file":"app/7-73a473bc.css","sourcesContent":["<template>\n  <div class=\"dwp-border-t dwp-border-gray-200 dwp-mx-10 dwp-cursor-pointer dwp-mb-4\" v-if=\"!edit\">\n    <div class=\"dwp-flex dwp-py-4 dwp-items-center dwp-space-x-1\" @click=\"edit = true\">\n      <PlusIcon class=\"dwp-text-primary dwp-w-5 dwp-h-5\" />\n      <div class=\"dwp-text-gray-500 wpl-flex-1\">Add task</div>\n    </div>\n  </div>\n\n  <div class=\"dwp-space-y-4 dwp-mb-4\" v-else>\n    <div class=\"dwp-mx-6 dwp-rounded dwp-shadow-xl dwp-leading-none\">\n      <TaskTemplate class=\"dwp-shadow-xs dwp-bg-white dwp-px-4 dwp-py-5 dwp-rounded bwp-mb-4\">\n        <template #checkbox>\n          <Checkbox class=\"dwp-block dwp-leading-normal\" />\n        </template>\n\n        <template #title>\n          <input\n            type=\"text\"\n            @keydown.enter=\"add\"\n            @keydown.esc=\"cancel\"\n            ref=\"title\"\n            class=\"dwp-outline-none dwp-text-gray-700 dwp-placeholder-gray-500 dwp-leading-none dwp-w-full\"\n            placeholder=\"New Task\"\n            v-model=\"form.title\"\n          />\n        </template>\n\n        <template #content>\n          <Editor\n            ref=\"content\"\n            class=\"dwp-outline-none dwp-text-gray-600 dwp-text-sm dwp-leading-normal\"\n            placeholder=\"Notes\"\n            @keydown.esc=\"cancel\"\n            :content.sync=\"form.notes\"\n          />\n        </template>\n      </TaskTemplate>\n    </div>\n    <div class=\"dwp-mx-10\" v-if=\"edit\">\n      <VButton @click.native=\"add\">Add Task</VButton>\n      <VButton type=\"plain\" @click.native=\"cancel\">Cancel</VButton>\n    </div>\n  </div>\n</template>\n\n<script>\nimport VButton from \"./ui/VButton.vue\";\nimport TextInput from \"./ui/TextInput.vue\";\nimport { PlusIcon } from \"vue-feather-icons\";\nimport { call, get } from \"vuex-pathify\";\nimport Checkbox from \"./Checkbox.vue\";\nimport Editor from \"./shared/Editor.vue\";\nimport TaskTemplate from \"./templates/TaskTemplate.vue\";\n\nimport { CircleIcon } from \"vue-feather-icons\";\n\nimport currentList from \"@/mixins/current-list\";\n\nexport default {\n  mixins: [currentList],\n\n  components: {\n    VButton,\n    TextInput,\n    Checkbox,\n    Editor,\n    TaskTemplate,\n    PlusIcon,\n  },\n\n  data() {\n    return {\n      edit: false,\n      form: {\n        title: \"\",\n        notes: \"\",\n      },\n    };\n  },\n\n  computed: {\n    disabled() {\n      return !this.form.title || this.form.title == \"<p></p>\";\n    },\n  },\n\n  watch: {\n    edit(val) {\n      if (val) {\n        this.$emit(\"edit\");\n        this.$nextTick(() => {\n          this.$refs.title.focus();\n        });\n      }\n    },\n  },\n\n  methods: {\n    ...call(\"tasks/*\"),\n    async add(e) {\n      if (this.disabled) {\n        this.$refs.title.focus();\n        e.preventDefault();\n        return;\n      }\n      console.log(this);\n      this.addTask({\n        data: {\n          list_id: this.currentListId,\n          title: this.form.title,\n          notes: this.form.notes,\n        },\n      });\n      this.form.title = \"\";\n      this.form.notes = \"\";\n    },\n    cancel() {\n      this.edit = false;\n      this.form.title = \"\";\n      this.form.notes = \"\";\n    },\n  },\n};\n</script>\n\n<style>\n.dwp-open-transitions {\n  transition: box-shadow 0.2 ease, padding 0.2 ease;\n}\n</style>\n"],"sourceRoot":""}