@leaflink/stash 44.0.0-beta.3 → 44.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/ActionsDropdown.js +10 -10
  2. package/dist/ActionsDropdown.js.map +1 -1
  3. package/dist/AddressSelect.js +2 -2
  4. package/dist/AppNavigationItem.js +8 -8
  5. package/dist/AppNavigationItem.js.map +1 -1
  6. package/dist/ButtonGroup.js +2 -2
  7. package/dist/ButtonGroup.js.map +1 -1
  8. package/dist/CurrencyInput.js +2 -2
  9. package/dist/DataViewFilters.js +2 -2
  10. package/dist/DataViewSortButton.js +10 -10
  11. package/dist/DataViewSortButton.js.map +1 -1
  12. package/dist/DatePicker.js +4 -4
  13. package/dist/DatePicker.js.map +1 -1
  14. package/dist/DescriptionListTerm.js +1 -1
  15. package/dist/DescriptionListTerm.js.map +1 -1
  16. package/dist/Divider.js +3 -3
  17. package/dist/Divider.js.map +1 -1
  18. package/dist/Field.js +2 -2
  19. package/dist/{Field.vue_vue_type_script_setup_true_lang-42cf79d4.js → Field.vue_vue_type_script_setup_true_lang-4483019d.js} +2 -2
  20. package/dist/{Field.vue_vue_type_script_setup_true_lang-42cf79d4.js.map → Field.vue_vue_type_script_setup_true_lang-4483019d.js.map} +1 -1
  21. package/dist/FileUpload.js +22 -22
  22. package/dist/FileUpload.js.map +1 -1
  23. package/dist/FilterSelect.js +2 -2
  24. package/dist/Filters.js +8 -8
  25. package/dist/Filters.js.map +1 -1
  26. package/dist/IconLabel.js +10 -10
  27. package/dist/IconLabel.js.map +1 -1
  28. package/dist/Image.js +1 -1
  29. package/dist/Image.js.map +1 -1
  30. package/dist/InlineEdit.js +2 -2
  31. package/dist/Input.js +4 -4
  32. package/dist/Input.js.map +1 -1
  33. package/dist/InputOptions.js +10 -10
  34. package/dist/InputOptions.js.map +1 -1
  35. package/dist/Label.js +1 -1
  36. package/dist/{Label.vue_vue_type_script_setup_true_lang-c5589919.js → Label.vue_vue_type_script_setup_true_lang-2de35913.js} +6 -6
  37. package/dist/{Label.vue_vue_type_script_setup_true_lang-c5589919.js.map → Label.vue_vue_type_script_setup_true_lang-2de35913.js.map} +1 -1
  38. package/dist/ListView.js +43 -43
  39. package/dist/ListView.js.map +1 -1
  40. package/dist/ObfuscateText.js +4 -4
  41. package/dist/ObfuscateText.js.map +1 -1
  42. package/dist/RadioGroup.js +113 -113
  43. package/dist/RadioGroup.js.map +1 -1
  44. package/dist/RadioNew.js +4 -4
  45. package/dist/SearchBar.js +2 -2
  46. package/dist/Select.js +5 -5
  47. package/dist/Select.js.map +1 -1
  48. package/dist/SelectStatus.js +2 -2
  49. package/dist/TableHeaderCell.js +2 -2
  50. package/dist/TableHeaderCell.js.map +1 -1
  51. package/dist/Textarea.js +2 -2
  52. package/dist/components.css +1 -1
  53. package/package.json +1 -1
@@ -2,7 +2,7 @@ import { defineComponent as a, inject as o, openBlock as i, createElementBlock a
2
2
  import { D as l } from "./DescriptionList.keys-c906ce05.js";
3
3
  const p = ["data-variant"], w = {
4
4
  key: 0,
5
- class: "hidden md:inline"
5
+ class: "hidden md:tw-inline"
6
6
  }, k = /* @__PURE__ */ a({
7
7
  __name: "DescriptionListTerm",
8
8
  setup(_) {
@@ -1 +1 @@
1
- {"version":3,"file":"DescriptionListTerm.js","sources":["../src/components/DescriptionListTerm/DescriptionListTerm.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { inject } from 'vue';\n\n import { DESCRIPTION_LIST_INJECTION } from '../DescriptionList/DescriptionList.keys';\n\n const descriptionListInjectedValues = inject(DESCRIPTION_LIST_INJECTION.key);\n if (!descriptionListInjectedValues) {\n throw new Error('DescriptionListDetail must be used within a DescriptionList component.');\n }\n const { variant } = descriptionListInjectedValues;\n</script>\n\n<template>\n <dt\n class=\"stash-description-list-term tw-text-medium tw-text-ice-900\"\n :class=\"{\n 'md:tw-w-2/5 md:tw-max-w-[10.5rem]': variant === 'columns',\n 'tw-mr-1.5': variant === 'inline',\n 'tw-pb-1.5': variant === 'stacked',\n 'tw-pb-1.5 md:tw-pb-0': variant !== 'stacked',\n }\"\n data-test=\"stash-description-list-term\"\n :data-variant=\"variant\"\n >\n <!-- @slot Default slot, for rendering a term -->\n <slot></slot><span v-if=\"variant === 'inline'\" class=\"hidden md:inline\">:</span>\n </dt>\n</template>\n"],"names":["descriptionListInjectedValues","inject","DESCRIPTION_LIST_INJECTION","variant"],"mappings":";;;;;;;;AAKQ,UAAAA,IAAgCC,EAAOC,EAA2B,GAAG;AAC3E,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,wEAAwE;AAEpF,UAAA,EAAE,SAAAG,EAAY,IAAAH;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"DescriptionListTerm.js","sources":["../src/components/DescriptionListTerm/DescriptionListTerm.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { inject } from 'vue';\n\n import { DESCRIPTION_LIST_INJECTION } from '../DescriptionList/DescriptionList.keys';\n\n const descriptionListInjectedValues = inject(DESCRIPTION_LIST_INJECTION.key);\n if (!descriptionListInjectedValues) {\n throw new Error('DescriptionListDetail must be used within a DescriptionList component.');\n }\n const { variant } = descriptionListInjectedValues;\n</script>\n\n<template>\n <dt\n class=\"stash-description-list-term tw-text-medium tw-text-ice-900\"\n :class=\"{\n 'md:tw-w-2/5 md:tw-max-w-[10.5rem]': variant === 'columns',\n 'tw-mr-1.5': variant === 'inline',\n 'tw-pb-1.5': variant === 'stacked',\n 'tw-pb-1.5 md:tw-pb-0': variant !== 'stacked',\n }\"\n data-test=\"stash-description-list-term\"\n :data-variant=\"variant\"\n >\n <!-- @slot Default slot, for rendering a term -->\n <slot></slot><span v-if=\"variant === 'inline'\" class=\"hidden md:tw-inline\">:</span>\n </dt>\n</template>\n"],"names":["descriptionListInjectedValues","inject","DESCRIPTION_LIST_INJECTION","variant"],"mappings":";;;;;;;;AAKQ,UAAAA,IAAgCC,EAAOC,EAA2B,GAAG;AAC3E,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,wEAAwE;AAEpF,UAAA,EAAE,SAAAG,EAAY,IAAAH;;;;;;;;;;;;;;;;"}
package/dist/Divider.js CHANGED
@@ -1,4 +1,4 @@
1
- import { openBlock as s, createElementBlock as r, normalizeClass as t, renderSlot as o } from "vue";
1
+ import { openBlock as s, createElementBlock as t, normalizeClass as r, renderSlot as o } from "vue";
2
2
  import { _ as a } from "./_plugin-vue_export-helper-dad06003.js";
3
3
  const l = "_separator_1k1sz_2", n = {
4
4
  separator: l
@@ -6,8 +6,8 @@ const l = "_separator_1k1sz_2", n = {
6
6
  name: "ll-divider"
7
7
  };
8
8
  function p(e, i, _, f, m, u) {
9
- return s(), r("div", {
10
- class: t(["flex align-middle text-center text-uppercase", e.$style.separator]),
9
+ return s(), t("div", {
10
+ class: r(["align-middle text-uppercase tw-flex tw-text-center", e.$style.separator]),
11
11
  role: "separator"
12
12
  }, [
13
13
  o(e.$slots, "default")
@@ -1 +1 @@
1
- {"version":3,"file":"Divider.js","sources":["../src/components/Divider/Divider.vue"],"sourcesContent":["<script>\n export default {\n name: 'll-divider',\n };\n</script>\n\n<template>\n <div class=\"flex align-middle text-center text-uppercase\" :class=\"$style.separator\" role=\"separator\">\n <slot></slot>\n </div>\n</template>\n\n<style module>\n .separator::before,\n .separator::after {\n border-bottom: 1px solid var(--color-ice-200);\n content: '';\n flex: 1;\n }\n\n .separator:not(:empty)::before {\n margin-right: var(--ll-space-2);\n }\n\n .separator:not(:empty)::after {\n margin-left: var(--ll-space-2);\n }\n</style>\n"],"names":["_sfc_main","_createElementBlock","_normalizeClass","_ctx","_renderSlot"],"mappings":";;;;GACOA,IAAU;AAAA,EACb,MAAM;;;cAKRC,EAEM,OAAA;AAAA,IAFD,OAAMC,EAAA,CAAA,gDAAuDC,EAAA,OAAO,SAAS,CAAA;AAAA,IAAE,MAAK;AAAA;IACvFC,EAAaD,EAAA,QAAA,SAAA;AAAA;;;;;"}
1
+ {"version":3,"file":"Divider.js","sources":["../src/components/Divider/Divider.vue"],"sourcesContent":["<script>\n export default {\n name: 'll-divider',\n };\n</script>\n\n<template>\n <div class=\"align-middle text-uppercase tw-flex tw-text-center\" :class=\"$style.separator\" role=\"separator\">\n <slot></slot>\n </div>\n</template>\n\n<style module>\n .separator::before,\n .separator::after {\n border-bottom: 1px solid var(--color-ice-200);\n content: '';\n flex: 1;\n }\n\n .separator:not(:empty)::before {\n margin-right: var(--ll-space-2);\n }\n\n .separator:not(:empty)::after {\n margin-left: var(--ll-space-2);\n }\n</style>\n"],"names":["_sfc_main","_createElementBlock","_normalizeClass","_ctx","_renderSlot"],"mappings":";;;;GACOA,IAAU;AAAA,EACb,MAAM;;;cAKRC,EAEM,OAAA;AAAA,IAFD,OAAMC,EAAA,CAAA,sDAA6DC,EAAA,OAAO,SAAS,CAAA;AAAA,IAAE,MAAK;AAAA;IAC7FC,EAAaD,EAAA,QAAA,SAAA;AAAA;;;;;"}
package/dist/Field.js CHANGED
@@ -1,7 +1,7 @@
1
- import { _ as o } from "./Field.vue_vue_type_script_setup_true_lang-42cf79d4.js";
1
+ import { _ as o } from "./Field.vue_vue_type_script_setup_true_lang-4483019d.js";
2
2
  import "vue";
3
3
  import "lodash-es/uniqueId";
4
- import "./Label.vue_vue_type_script_setup_true_lang-c5589919.js";
4
+ import "./Label.vue_vue_type_script_setup_true_lang-2de35913.js";
5
5
  import "./locale.js";
6
6
  import "lodash-es/get";
7
7
  export {
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as x, useAttrs as k, useSlots as T, computed as a, openBlock as l, createBlock as m, resolveDynamicComponent as B, mergeProps as O, unref as f, withCtx as v, normalizeClass as R, createTextVNode as q, toDisplayString as p, createCommentVNode as s, createElementBlock as o, renderSlot as c } from "vue";
2
2
  import h from "lodash-es/uniqueId";
3
- import { _ as E } from "./Label.vue_vue_type_script_setup_true_lang-c5589919.js";
3
+ import { _ as E } from "./Label.vue_vue_type_script_setup_true_lang-2de35913.js";
4
4
  const L = ["aria-labelledby"], S = ["id"], C = {
5
5
  key: 4,
6
6
  class: "tw-mt-1 tw-block tw-whitespace-pre-line tw-text-xs",
@@ -93,4 +93,4 @@ const L = ["aria-labelledby"], S = ["id"], C = {
93
93
  export {
94
94
  z as _
95
95
  };
96
- //# sourceMappingURL=Field.vue_vue_type_script_setup_true_lang-42cf79d4.js.map
96
+ //# sourceMappingURL=Field.vue_vue_type_script_setup_true_lang-4483019d.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Field.vue_vue_type_script_setup_true_lang-42cf79d4.js","sources":["../src/components/Field/Field.vue"],"sourcesContent":["<script lang=\"ts\">\n export default {\n inheritAttrs: false,\n };\n</script>\n\n<script setup lang=\"ts\">\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, useAttrs, useSlots } from 'vue';\n\n import Label from '../Label/Label.vue';\n\n export interface FieldProps {\n /**\n * Adds spacing under the field that is consistent whether or not hint/error text is displayed.\n */\n addBottomSpace?: boolean;\n\n /**\n * Error text to display. Replaces `hintText` (if provided) & adds error styling.\n */\n errorText?: string;\n\n /**\n * Displays text below the input; hidden when the isReadOnly prop is truthy.\n */\n hintText?: string;\n\n /**\n * ID for the Label and Input; must be unique\n */\n id?: string;\n\n /**\n * ID for the error text element; useful for aria-errormessage\n */\n errorId?: string;\n\n /**\n * Whether it's a readonly field.\n */\n isReadOnly?: boolean;\n\n /**\n * Whether the field is required.\n */\n isRequired?: boolean;\n\n /**\n * Label to render above the input.\n */\n label?: string;\n\n /**\n * Show \"(optional)\" to the right of the label text\n */\n showOptionalInLabel?: boolean;\n\n /**\n * Indicates wheter the field is a fieldset or not\n */\n fieldset?: boolean;\n }\n\n const props = withDefaults(defineProps<FieldProps>(), {\n addBottomSpace: false,\n errorText: undefined,\n hintText: undefined,\n id: undefined,\n errorId: undefined,\n isRequired: false,\n label: undefined,\n showOptionalInLabel: false,\n fieldset: false,\n });\n const attrs = useAttrs();\n const slots = useSlots();\n const fieldId = computed(() => props.id || uniqueId('field-'));\n const fieldErrorId = computed(() => props.errorId || uniqueId('field-error-'));\n const labelId = computed(() => uniqueId('field-label-'));\n const hasError = computed(() => !!props.errorText);\n const wrapperElement = computed(() => (props.fieldset ? 'fieldset' : 'div'));\n\n // Any attributes that are unique to form elements, you want to exclude from\n // being bound from the root element.\n const rootAttrs = computed(() => {\n const { placeholder, ...otherAttrs } = attrs;\n\n return otherAttrs;\n });\n</script>\n\n<template>\n <component\n v-bind=\"rootAttrs\"\n :is=\"wrapperElement\"\n :class=\"[\n { 'tw-p-0': props.fieldset },\n { 'tw-mb-9': props.addBottomSpace && !props.errorText && !props.hintText && !slots.hint },\n { 'tw-mb-4': props.addBottomSpace && (props.errorText || props.hintText || slots.hint) },\n ]\"\n >\n <Label\n v-if=\"props.label\"\n :id=\"labelId\"\n :class=\"{ 'tw-mb-1.5': !!props.isReadOnly }\"\n :for=\"fieldId\"\n :has-error=\"hasError\"\n :is-required=\"isRequired\"\n :show-optional=\"props.showOptionalInLabel\"\n :legend=\"props.fieldset\"\n >\n {{ props.label }}\n </Label>\n\n <!-- @slot for the form field; the Label can also be rendered here instead of using the label prop -->\n <template v-if=\"props.isReadOnly\">\n <div :aria-labelledby=\"labelId\">\n <slot\n :field-id=\"fieldId\"\n :field-error-id=\"fieldErrorId\"\n :has-error=\"hasError\"\n :is-required=\"isRequired\"\n :label-id=\"labelId\"\n :show-optional-in-label=\"props.showOptionalInLabel\"\n ></slot>\n </div>\n </template>\n <template v-else>\n <slot\n :field-id=\"fieldId\"\n :field-error-id=\"fieldErrorId\"\n :has-error=\"hasError\"\n :is-required=\"isRequired\"\n :label-id=\"labelId\"\n :show-optional-in-label=\"props.showOptionalInLabel\"\n ></slot>\n </template>\n\n <span\n v-if=\"props.errorText\"\n :id=\"fieldErrorId\"\n class=\"tw-mt-1 tw-block tw-whitespace-pre-line tw-text-xs tw-text-red-500\"\n data-test=\"field-error\"\n >\n {{ props.errorText }}\n </span>\n\n <span v-else-if=\"props.hintText\" class=\"tw-mt-1 tw-block tw-whitespace-pre-line tw-text-xs\" data-test=\"field-hint\">\n <span v-if=\"!props.isReadOnly\">{{ props.hintText }}</span>\n </span>\n\n <div v-else-if=\"slots.hint\" class=\"tw-mt-1 tw-whitespace-pre-line tw-text-xs\" data-test=\"field-hint\">\n <!-- @slot for displaying hint text below the field -->\n <slot v-if=\"!props.isReadOnly\" name=\"hint\"></slot>\n </div>\n </component>\n</template>\n"],"names":["attrs","useAttrs","slots","useSlots","fieldId","computed","props","uniqueId","fieldErrorId","labelId","hasError","wrapperElement","rootAttrs","placeholder","otherAttrs"],"mappings":";;;;;;;;;;;OACiB;AAAA,EACb,cAAc;AAChB;;;;;;;;;;;;;;;;iBAwEMA,IAAQC,KACRC,IAAQC,KACRC,IAAUC,EAAS,MAAMC,EAAM,MAAMC,EAAS,QAAQ,CAAC,GACvDC,IAAeH,EAAS,MAAMC,EAAM,WAAWC,EAAS,cAAc,CAAC,GACvEE,IAAUJ,EAAS,MAAME,EAAS,cAAc,CAAC,GACjDG,IAAWL,EAAS,MAAM,CAAC,CAACC,EAAM,SAAS,GAC3CK,IAAiBN,EAAS,MAAOC,EAAM,WAAW,aAAa,KAAM,GAIrEM,IAAYP,EAAS,MAAM;AAC/B,YAAM,EAAE,aAAAQ,GAAa,GAAGC,EAAA,IAAed;AAEhC,aAAAc;AAAA,IAAA,CACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Field.vue_vue_type_script_setup_true_lang-4483019d.js","sources":["../src/components/Field/Field.vue"],"sourcesContent":["<script lang=\"ts\">\n export default {\n inheritAttrs: false,\n };\n</script>\n\n<script setup lang=\"ts\">\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, useAttrs, useSlots } from 'vue';\n\n import Label from '../Label/Label.vue';\n\n export interface FieldProps {\n /**\n * Adds spacing under the field that is consistent whether or not hint/error text is displayed.\n */\n addBottomSpace?: boolean;\n\n /**\n * Error text to display. Replaces `hintText` (if provided) & adds error styling.\n */\n errorText?: string;\n\n /**\n * Displays text below the input; hidden when the isReadOnly prop is truthy.\n */\n hintText?: string;\n\n /**\n * ID for the Label and Input; must be unique\n */\n id?: string;\n\n /**\n * ID for the error text element; useful for aria-errormessage\n */\n errorId?: string;\n\n /**\n * Whether it's a readonly field.\n */\n isReadOnly?: boolean;\n\n /**\n * Whether the field is required.\n */\n isRequired?: boolean;\n\n /**\n * Label to render above the input.\n */\n label?: string;\n\n /**\n * Show \"(optional)\" to the right of the label text\n */\n showOptionalInLabel?: boolean;\n\n /**\n * Indicates wheter the field is a fieldset or not\n */\n fieldset?: boolean;\n }\n\n const props = withDefaults(defineProps<FieldProps>(), {\n addBottomSpace: false,\n errorText: undefined,\n hintText: undefined,\n id: undefined,\n errorId: undefined,\n isRequired: false,\n label: undefined,\n showOptionalInLabel: false,\n fieldset: false,\n });\n const attrs = useAttrs();\n const slots = useSlots();\n const fieldId = computed(() => props.id || uniqueId('field-'));\n const fieldErrorId = computed(() => props.errorId || uniqueId('field-error-'));\n const labelId = computed(() => uniqueId('field-label-'));\n const hasError = computed(() => !!props.errorText);\n const wrapperElement = computed(() => (props.fieldset ? 'fieldset' : 'div'));\n\n // Any attributes that are unique to form elements, you want to exclude from\n // being bound from the root element.\n const rootAttrs = computed(() => {\n const { placeholder, ...otherAttrs } = attrs;\n\n return otherAttrs;\n });\n</script>\n\n<template>\n <component\n v-bind=\"rootAttrs\"\n :is=\"wrapperElement\"\n :class=\"[\n { 'tw-p-0': props.fieldset },\n { 'tw-mb-9': props.addBottomSpace && !props.errorText && !props.hintText && !slots.hint },\n { 'tw-mb-4': props.addBottomSpace && (props.errorText || props.hintText || slots.hint) },\n ]\"\n >\n <Label\n v-if=\"props.label\"\n :id=\"labelId\"\n :class=\"{ 'tw-mb-1.5': !!props.isReadOnly }\"\n :for=\"fieldId\"\n :has-error=\"hasError\"\n :is-required=\"isRequired\"\n :show-optional=\"props.showOptionalInLabel\"\n :legend=\"props.fieldset\"\n >\n {{ props.label }}\n </Label>\n\n <!-- @slot for the form field; the Label can also be rendered here instead of using the label prop -->\n <template v-if=\"props.isReadOnly\">\n <div :aria-labelledby=\"labelId\">\n <slot\n :field-id=\"fieldId\"\n :field-error-id=\"fieldErrorId\"\n :has-error=\"hasError\"\n :is-required=\"isRequired\"\n :label-id=\"labelId\"\n :show-optional-in-label=\"props.showOptionalInLabel\"\n ></slot>\n </div>\n </template>\n <template v-else>\n <slot\n :field-id=\"fieldId\"\n :field-error-id=\"fieldErrorId\"\n :has-error=\"hasError\"\n :is-required=\"isRequired\"\n :label-id=\"labelId\"\n :show-optional-in-label=\"props.showOptionalInLabel\"\n ></slot>\n </template>\n\n <span\n v-if=\"props.errorText\"\n :id=\"fieldErrorId\"\n class=\"tw-mt-1 tw-block tw-whitespace-pre-line tw-text-xs tw-text-red-500\"\n data-test=\"field-error\"\n >\n {{ props.errorText }}\n </span>\n\n <span v-else-if=\"props.hintText\" class=\"tw-mt-1 tw-block tw-whitespace-pre-line tw-text-xs\" data-test=\"field-hint\">\n <span v-if=\"!props.isReadOnly\">{{ props.hintText }}</span>\n </span>\n\n <div v-else-if=\"slots.hint\" class=\"tw-mt-1 tw-whitespace-pre-line tw-text-xs\" data-test=\"field-hint\">\n <!-- @slot for displaying hint text below the field -->\n <slot v-if=\"!props.isReadOnly\" name=\"hint\"></slot>\n </div>\n </component>\n</template>\n"],"names":["attrs","useAttrs","slots","useSlots","fieldId","computed","props","uniqueId","fieldErrorId","labelId","hasError","wrapperElement","rootAttrs","placeholder","otherAttrs"],"mappings":";;;;;;;;;;;OACiB;AAAA,EACb,cAAc;AAChB;;;;;;;;;;;;;;;;iBAwEMA,IAAQC,KACRC,IAAQC,KACRC,IAAUC,EAAS,MAAMC,EAAM,MAAMC,EAAS,QAAQ,CAAC,GACvDC,IAAeH,EAAS,MAAMC,EAAM,WAAWC,EAAS,cAAc,CAAC,GACvEE,IAAUJ,EAAS,MAAME,EAAS,cAAc,CAAC,GACjDG,IAAWL,EAAS,MAAM,CAAC,CAACC,EAAM,SAAS,GAC3CK,IAAiBN,EAAS,MAAOC,EAAM,WAAW,aAAa,KAAM,GAIrEM,IAAYP,EAAS,MAAM;AAC/B,YAAM,EAAE,aAAAQ,GAAa,GAAGC,EAAA,IAAed;AAEhC,aAAAc;AAAA,IAAA,CACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,8 +1,8 @@
1
- import { I as x } from "./index-79ce320f.js";
1
+ import { I } from "./index-79ce320f.js";
2
2
  import { t as u } from "./locale.js";
3
- import F from "./Button.js";
4
- import O from "./Icon.js";
5
- import { resolveComponent as g, openBlock as r, createElementBlock as o, normalizeClass as d, createVNode as h, withModifiers as c, withCtx as T, createTextVNode as y, toDisplayString as p, createElementVNode as f, Fragment as v, createBlock as C, createCommentVNode as S, renderSlot as _, renderList as w, withDirectives as U, mergeProps as M, vShow as N } from "vue";
3
+ import x from "./Button.js";
4
+ import F from "./Icon.js";
5
+ import { resolveComponent as g, openBlock as r, createElementBlock as o, normalizeClass as d, createVNode as h, withModifiers as c, withCtx as T, createTextVNode as y, toDisplayString as p, createElementVNode as f, Fragment as v, createBlock as O, createCommentVNode as S, renderSlot as w, renderList as C, withDirectives as U, mergeProps as M, vShow as N } from "vue";
6
6
  import { _ as P } from "./_plugin-vue_export-helper-dad06003.js";
7
7
  import "lodash-es/get";
8
8
  import "./Button.vue_used_vue_type_style_index_0_lang.module-b2ee90e6.js";
@@ -52,15 +52,15 @@ const A = "_button_oi2f6_201", L = {
52
52
  MIME_TYPES: ["application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
53
53
  ILLUSTRATION: "csv"
54
54
  }
55
- }), b = Object.freeze({
55
+ }), _ = Object.freeze({
56
56
  Dense: "dense",
57
57
  Standard: "standard"
58
58
  }), k = {
59
59
  name: "ll-file-upload",
60
60
  components: {
61
- "ll-icon": O,
62
- "ll-button": F,
63
- InlineSvg: x
61
+ "ll-icon": F,
62
+ "ll-button": x,
63
+ InlineSvg: I
64
64
  },
65
65
  inject: ["stashOptions"],
66
66
  inheritAttrs: !1,
@@ -97,13 +97,13 @@ const A = "_button_oi2f6_201", L = {
97
97
  size: {
98
98
  type: String,
99
99
  default: "standard",
100
- validator: (e) => Object.values(b).includes(e)
100
+ validator: (e) => Object.values(_).includes(e)
101
101
  }
102
102
  },
103
103
  emits: ["file-select", "file-delete", "file-error"],
104
104
  setup() {
105
105
  return {
106
- Sizes: b
106
+ Sizes: _
107
107
  };
108
108
  },
109
109
  data() {
@@ -215,12 +215,12 @@ const A = "_button_oi2f6_201", L = {
215
215
  return e.concat(t);
216
216
  }
217
217
  }
218
- }, z = ["data-test"], R = { key: 0 }, j = { class: "text-ice-900" }, X = {
218
+ }, z = ["data-test"], R = { key: 0 }, j = { class: "tw-text-ice-900" }, X = {
219
219
  key: 0,
220
- class: "text-center text-small text-ice-700 tw-mt-6"
220
+ class: "text-small tw-mt-6 tw-text-center tw-text-ice-700"
221
221
  }, Y = ["accept", "multiple"];
222
222
  function B(e, t, i, a, n, l) {
223
- const m = g("ll-button"), D = g("InlineSvg"), I = g("ll-icon");
223
+ const m = g("ll-button"), b = g("InlineSvg"), D = g("ll-icon");
224
224
  return r(), o("div", {
225
225
  class: d(e.$attrs.class),
226
226
  "data-test": e.$attrs["data-test"]
@@ -239,18 +239,18 @@ function B(e, t, i, a, n, l) {
239
239
  }, 8, ["disabled", "onClick"])
240
240
  ])) : (r(), o("div", {
241
241
  key: 1,
242
- class: d(["rounded tw-p-6", [e.$style["file-dropbox"], n.isDraggingOver && e.$style["is-dragging"], i.disabled && e.$style["is-disabled"]]]),
242
+ class: d(["tw-rounded tw-p-6", [e.$style["file-dropbox"], n.isDraggingOver && e.$style["is-dragging"], i.disabled && e.$style["is-disabled"]]]),
243
243
  onDragover: t[0] || (t[0] = c((...s) => l.handleDragEnter && l.handleDragEnter(...s), ["prevent"])),
244
244
  onDrop: t[1] || (t[1] = c((...s) => l.handleDropFile && l.handleDropFile(...s), ["prevent"])),
245
245
  onDragleave: t[2] || (t[2] = c((...s) => l.handleDragLeave && l.handleDragLeave(...s), ["prevent"]))
246
246
  }, [
247
247
  f("div", {
248
- class: d(["flex text-center flex-column align-center align-middle", [{ "items-center md:flex-row": i.size === a.Sizes.Dense }]])
248
+ class: d(["tw-flex-column align-center align-middle tw-flex tw-text-center", [{ "md:flex-row tw-items-center": i.size === a.Sizes.Dense }]])
249
249
  }, [
250
- i.files.length ? (r(!0), o(v, { key: 1 }, w(i.files, (s) => (r(), o("div", {
250
+ i.files.length ? (r(!0), o(v, { key: 1 }, C(i.files, (s) => (r(), o("div", {
251
251
  key: s.name
252
252
  }, [
253
- h(I, { name: "file" }),
253
+ h(D, { name: "file" }),
254
254
  f("span", null, p(s.name), 1),
255
255
  h(m, {
256
256
  class: d([e.$style["remove-button"], e.$style.button]),
@@ -262,7 +262,7 @@ function B(e, t, i, a, n, l) {
262
262
  _: 2
263
263
  }, 1032, ["class", "onClick"])
264
264
  ]))), 128)) : (r(), o(v, { key: 0 }, [
265
- i.size !== a.Sizes.Dense ? (r(), C(D, {
265
+ i.size !== a.Sizes.Dense ? (r(), O(b, {
266
266
  key: 0,
267
267
  src: l.illustrationPath,
268
268
  name: "file",
@@ -271,7 +271,7 @@ function B(e, t, i, a, n, l) {
271
271
  }, null, 8, ["src"])) : S("", !0),
272
272
  f("span", j, p(n.fileUploadDragDropFileHereText), 1),
273
273
  f("span", {
274
- class: d(i.size === a.Sizes.Dense ? "md:ml-1 md:mr-2 md:my-0 my-1 text-ice-900" : "tw-mt-1.5 my-1")
274
+ class: d(i.size === a.Sizes.Dense ? "md:ml-1 md:mr-2 md:my-0 my-1 tw-text-ice-900" : "tw-mt-1.5 my-1")
275
275
  }, p(n.fileUploadOrText), 3),
276
276
  h(m, {
277
277
  class: d(["tw-mt-1.5", e.$style["file-select-button"]]),
@@ -281,7 +281,7 @@ function B(e, t, i, a, n, l) {
281
281
  onClick: c(l.openFileDialog, ["stop", "prevent"])
282
282
  }, {
283
283
  default: T(() => [
284
- _(e.$slots, "submitText", {}, () => [
284
+ w(e.$slots, "submitText", {}, () => [
285
285
  y(p(n.fileUploadUploadFileText), 1)
286
286
  ])
287
287
  ]),
@@ -290,7 +290,7 @@ function B(e, t, i, a, n, l) {
290
290
  ], 64))
291
291
  ], 2),
292
292
  e.$slots.hint && !i.files.length ? (r(), o("div", X, [
293
- _(e.$slots, "hint")
293
+ w(e.$slots, "hint")
294
294
  ])) : S("", !0)
295
295
  ], 34)),
296
296
  U(f("input", M(l.inputAttrs, {
@@ -309,7 +309,7 @@ const V = {
309
309
  }, le = /* @__PURE__ */ P(k, [["render", B], ["__cssModules", V]]);
310
310
  export {
311
311
  E as FILE_TYPES,
312
- b as Sizes,
312
+ _ as Sizes,
313
313
  le as default
314
314
  };
315
315
  //# sourceMappingURL=FileUpload.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileUpload.js","sources":["../src/components/FileUpload/FileUpload.vue"],"sourcesContent":["<script>\n import InlineSvg from 'vue-inline-svg';\n\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n\n export const FILE_TYPES = Object.freeze({\n CSV: {\n ACCEPTS: ['text/csv'],\n EXTENSION: ['csv'],\n MIME_TYPES: ['text/csv', 'application/octet-stream', 'application/vnd.ms-excel'],\n ILLUSTRATION: 'csv',\n },\n PDF: {\n ACCEPTS: ['application/pdf'],\n EXTENSION: ['pdf'],\n MIME_TYPES: ['application/pdf'],\n ILLUSTRATION: 'pdf',\n },\n PNG: {\n ACCEPTS: ['image/png'],\n EXTENSION: ['png'],\n MIME_TYPES: ['image/png'],\n ILLUSTRATION: 'image',\n },\n JPEG: {\n ACCEPTS: ['image/jpeg'],\n EXTENSION: ['jpg', 'jpeg'],\n MIME_TYPES: ['image/jpeg'],\n ILLUSTRATION: 'image',\n },\n DOC: {\n ACCEPTS: ['application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],\n EXTENSION: ['doc', 'docx'],\n MIME_TYPES: ['application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],\n ILLUSTRATION: 'document',\n },\n XLS: {\n ACCEPTS: ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],\n EXTENSION: ['xls', 'xlsx'],\n MIME_TYPES: ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],\n ILLUSTRATION: 'csv',\n },\n });\n\n // TODO: convert to enum (typescript)\n export const Sizes = Object.freeze({\n Dense: 'dense',\n Standard: 'standard',\n });\n\n export default {\n name: 'll-file-upload',\n\n components: {\n 'll-icon': Icon,\n 'll-button': Button,\n InlineSvg,\n },\n\n inject: ['stashOptions'],\n\n inheritAttrs: false,\n\n props: {\n files: {\n type: Array,\n default: () => [],\n },\n\n /**\n * The file types accepted by the input\n */\n fileTypes: {\n type: Array,\n default: () => Object.keys(FILE_TYPES),\n },\n\n /**\n * Shows only an upload button\n */\n buttonOnly: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Disables the upload button\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * When using the drag and drop feature, hide the icon\n * and display everything on one line.\n */\n size: {\n type: String,\n default: 'standard',\n validator: (value) => Object.values(Sizes).includes(value),\n },\n },\n\n emits: ['file-select', 'file-delete', 'file-error'],\n\n setup() {\n return {\n Sizes,\n };\n },\n\n data() {\n return {\n isDraggingOver: false,\n removeText: t('ll.fileUpload.remove'),\n fileUploadUploadFileText: t('ll.fileUpload.uploadFile'),\n fileUploadDragDropFileHereText: t('ll.fileUpload.dragDropFileHere'),\n fileUploadOrText: t('ll.fileUpload.or'),\n };\n },\n\n computed: {\n inputAttrs() {\n const attrs = { ...this.$attrs };\n\n delete attrs['data-test'];\n delete attrs.class;\n delete attrs.type;\n delete attrs.accept;\n\n return attrs;\n },\n\n /**\n * @returns {Array} A list of accepted file types\n */\n acceptedMimeTypes() {\n return this.fileTypes.map((fileType) => this.fileMeta[fileType].MIME_TYPES).reduce(this.flattenArray);\n },\n\n /**\n * @returns {Array} A list of accepted file types\n */\n acceptedFileExtensions() {\n return this.fileTypes.map((fileType) => this.fileMeta[fileType].EXTENSION).reduce(this.flattenArray);\n },\n\n fileMeta() {\n return FILE_TYPES;\n },\n\n illustrationPath() {\n return `${this.stashOptions?.staticPath}/illustrations/FileUpload/${\n FILE_TYPES[this.fileTypes[0]].ILLUSTRATION\n }.svg`;\n },\n },\n\n methods: {\n openFileDialog() {\n if (this.$refs.fileUpload) {\n this.$refs.fileUpload.value = '';\n this.$refs.fileUpload.click();\n }\n },\n\n /**\n * Sets file(s) to selected file(s) from dialogue\n * @param {Object} event - file select event that contains file(s)\n * @returns {Array} An array of files\n */\n handleFileInput(event) {\n const files = [...event.target.files];\n\n this.$emit('file-select', { event, files });\n },\n\n handleDragEnter() {\n this.isDraggingOver = true;\n },\n\n handleDragLeave() {\n this.isDraggingOver = false;\n },\n\n /**\n * Sets file to dropped file if it is proper file type\n * @param {Object} event - file select event that contains file\n */\n async handleDropFile(event) {\n if (this.disabled) {\n return;\n }\n\n const files = [...event.dataTransfer.files];\n\n this.isDraggingOver = false;\n\n if (this.acceptedMimeTypes.length) {\n try {\n const mimeTypePromises = await Promise.all(files.map((file) => this.readMimeType(file)));\n const allCorrectMimeTypes = mimeTypePromises.every((mimeType) => this.acceptedMimeTypes.includes(mimeType));\n\n if (!allCorrectMimeTypes) {\n throw new Error('One or more files contains an unacceptable mime type.');\n }\n\n const allCorrectFileExtensions = files.every((file) => {\n const extension = file.name.split('.').pop();\n\n return this.acceptedFileExtensions.includes(extension);\n });\n\n if (!allCorrectFileExtensions) {\n throw new Error('One or more files contains an unacceptable extension.');\n }\n\n this.$emit('file-select', { event, files });\n } catch (error) {\n this.handleFileError(error);\n }\n } else {\n this.$emit('file-select', { event, files });\n }\n },\n\n handleFileError(error) {\n const message = this.t('ll.fileUpload.errors.incorrectFileType', {\n fileTypes: this.acceptedFileExtensions.join(', '),\n });\n\n if (this.$attrs['file-error']) {\n this.$emit('file-error', message);\n } else {\n this.$notify.warning(message);\n }\n\n throw error;\n },\n\n handleFileDelete(file) {\n this.$emit('file-delete', file);\n },\n\n /**\n * Check for the mime type on the uploaded File object\n * Otherwise load the file and attempt to read it\n * @param file The Uploaded File object\n */\n readMimeType(file) {\n return new Promise((resolve, reject) => {\n if (file.type) {\n return resolve(file.type);\n } else if (window.FileReader) {\n const fileReader = new FileReader();\n\n fileReader.onload = () => {\n const mimeType = fileReader.result.match(/[^:]\\w+\\/[\\w-+\\d.]+(?=;|,)/)\n ? fileReader.result.match(/[^:]\\w+\\/[\\w-+\\d.]+(?=;|,)/)[0]\n : '';\n\n resolve(mimeType);\n };\n\n fileReader.readAsDataURL(file);\n } else {\n reject(new Error('Failed to read file.'));\n }\n });\n },\n\n flattenArray(a, b) {\n return a.concat(b);\n },\n },\n };\n</script>\n\n<template>\n <div :class=\"$attrs.class\" :data-test=\"$attrs['data-test']\">\n <div v-if=\"buttonOnly\">\n <ll-button secondary type=\"button\" :disabled=\"disabled || null\" @click.stop.prevent=\"openFileDialog\">\n {{ fileUploadUploadFileText }}\n </ll-button>\n </div>\n <div\n v-else\n class=\"rounded tw-p-6\"\n :class=\"[$style['file-dropbox'], isDraggingOver && $style['is-dragging'], disabled && $style['is-disabled']]\"\n @dragover.prevent=\"handleDragEnter\"\n @drop.prevent=\"handleDropFile\"\n @dragleave.prevent=\"handleDragLeave\"\n >\n <div\n class=\"flex text-center flex-column align-center align-middle\"\n :class=\"[{ 'items-center md:flex-row': size === Sizes.Dense }]\"\n >\n <template v-if=\"!files.length\">\n <InlineSvg v-if=\"size !== Sizes.Dense\" :src=\"illustrationPath\" name=\"file\" width=\"84\" height=\"96\" />\n <span class=\"text-ice-900\">\n {{ fileUploadDragDropFileHereText }}\n </span>\n <span :class=\"size === Sizes.Dense ? 'md:ml-1 md:mr-2 md:my-0 my-1 text-ice-900' : 'tw-mt-1.5 my-1'\">\n {{ fileUploadOrText }}\n </span>\n <ll-button\n class=\"tw-mt-1.5\"\n secondary\n type=\"button\"\n :class=\"$style['file-select-button']\"\n :disabled=\"disabled\"\n @click.stop.prevent=\"openFileDialog\"\n >\n <!-- @slot for custom submit text -->\n <slot name=\"submitText\">{{ fileUploadUploadFileText }}</slot>\n </ll-button>\n </template>\n <template v-else>\n <div v-for=\"file in files\" :key=\"file.name\">\n <ll-icon name=\"file\" />\n <span>{{ file.name }}</span>\n <ll-button\n :class=\"[$style['remove-button'], $style['button']]\"\n @click.stop.prevent=\"handleFileDelete(file)\"\n >\n {{ removeText }}\n </ll-button>\n </div>\n </template>\n </div>\n <div v-if=\"$slots.hint && !files.length\" class=\"text-center text-small text-ice-700 tw-mt-6\">\n <!-- @slot for displaying helpful text and/or links -->\n <slot name=\"hint\"></slot>\n </div>\n </div>\n <input\n v-show=\"false\"\n v-bind=\"inputAttrs\"\n ref=\"fileUpload\"\n type=\"file\"\n :accept=\"fileTypes.map((fileType) => fileMeta[fileType].ACCEPTS).reduce(flattenArray)\"\n :multiple=\"$attrs['multiple']\"\n @change=\"handleFileInput($event)\"\n />\n </div>\n</template>\n\n<style lang=\"scss\" module>\n .file-dropbox {\n background: var(--color-ice-200);\n background-image: url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='4' ry='4' stroke='%23C5C9D4FF' stroke-width='1' stroke-dasharray='5 %2c 5' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e\");\n background-repeat: no-repeat;\n border: border('thin');\n border-color: transparent;\n }\n\n .is-dragging {\n background-image: none;\n border-color: var(--color-ice-500);\n\n & > * {\n pointer-events: none;\n }\n }\n\n .is-disabled {\n cursor: no-drop;\n }\n\n // Constrain the upload icon for drag/drop to the required size\n .upload-icon {\n height: 98px;\n width: 84px;\n }\n\n .remove-button.button {\n background: transparent;\n border: none;\n color: var(--color-red-500);\n\n &:hover {\n background: transparent;\n border: none;\n }\n }\n</style>\n"],"names":["FILE_TYPES","Sizes","_sfc_main","Icon","Button","InlineSvg","value","t","attrs","fileType","_a","event","files","file","mimeType","extension","error","message","resolve","reject","fileReader","a","b","_hoisted_3","_createElementBlock","_normalizeClass","_ctx","$props","_hoisted_2","_createVNode","_component_ll_button","$options","$data","args","_createElementVNode","$setup","_Fragment","_renderList","_component_ll_icon","_toDisplayString","_withModifiers","$event","_createBlock","_component_InlineSvg","_renderSlot","_openBlock","_hoisted_4","_mergeProps","_cache"],"mappings":";;;;;;;;;;;;;;;;;GAOeA,IAAa,OAAO,OAAO;AAAA,EACtC,KAAK;AAAA,IACH,SAAS,CAAC,UAAU;AAAA,IACpB,WAAW,CAAC,KAAK;AAAA,IACjB,YAAY,CAAC,YAAY,4BAA4B,0BAA0B;AAAA,IAC/E,cAAc;AAAA,EACf;AAAA,EACD,KAAK;AAAA,IACH,SAAS,CAAC,iBAAiB;AAAA,IAC3B,WAAW,CAAC,KAAK;AAAA,IACjB,YAAY,CAAC,iBAAiB;AAAA,IAC9B,cAAc;AAAA,EACf;AAAA,EACD,KAAK;AAAA,IACH,SAAS,CAAC,WAAW;AAAA,IACrB,WAAW,CAAC,KAAK;AAAA,IACjB,YAAY,CAAC,WAAW;AAAA,IACxB,cAAc;AAAA,EACf;AAAA,EACD,MAAM;AAAA,IACJ,SAAS,CAAC,YAAY;AAAA,IACtB,WAAW,CAAC,OAAO,MAAM;AAAA,IACzB,YAAY,CAAC,YAAY;AAAA,IACzB,cAAc;AAAA,EACf;AAAA,EACD,KAAK;AAAA,IACH,SAAS,CAAC,sBAAsB,yEAAyE;AAAA,IACzG,WAAW,CAAC,OAAO,MAAM;AAAA,IACzB,YAAY,CAAC,sBAAsB,yEAAyE;AAAA,IAC5G,cAAc;AAAA,EACf;AAAA,EACD,KAAK;AAAA,IACH,SAAS,CAAC,4BAA4B,mEAAmE;AAAA,IACzG,WAAW,CAAC,OAAO,MAAM;A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B9CN,EAAA,OAAO,QAAS,CAAAC,EAAA,MAAM,UAAjCkB,KAAArB,EAGM,OAHNsB,GAGM;AAAA,QADJF,EAAyBlB,EAAA,QAAA,MAAA;AAAA;;MAG7BQ,EAQE,SARFa,EAQEhB,EANkB,YAAA;AAAA,MAClB,KAAI;AAAA,MACJ,MAAK;AAAA,MACJ,QAAQJ,EAAA,UAAU,KAAKlB,MAAasB,EAAQ,SAACtB,CAAQ,EAAE,OAAO,EAAE,OAAOsB,EAAY,YAAA;AAAA,MACnF,UAAUL,EAAM,OAAA;AAAA,MAChB,UAAMsB,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAP,MAAEV,EAAe,gBAACU,CAAM;AAAA;UANvB,EAAK;AAAA;;;;;;"}
1
+ {"version":3,"file":"FileUpload.js","sources":["../src/components/FileUpload/FileUpload.vue"],"sourcesContent":["<script>\n import InlineSvg from 'vue-inline-svg';\n\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n\n export const FILE_TYPES = Object.freeze({\n CSV: {\n ACCEPTS: ['text/csv'],\n EXTENSION: ['csv'],\n MIME_TYPES: ['text/csv', 'application/octet-stream', 'application/vnd.ms-excel'],\n ILLUSTRATION: 'csv',\n },\n PDF: {\n ACCEPTS: ['application/pdf'],\n EXTENSION: ['pdf'],\n MIME_TYPES: ['application/pdf'],\n ILLUSTRATION: 'pdf',\n },\n PNG: {\n ACCEPTS: ['image/png'],\n EXTENSION: ['png'],\n MIME_TYPES: ['image/png'],\n ILLUSTRATION: 'image',\n },\n JPEG: {\n ACCEPTS: ['image/jpeg'],\n EXTENSION: ['jpg', 'jpeg'],\n MIME_TYPES: ['image/jpeg'],\n ILLUSTRATION: 'image',\n },\n DOC: {\n ACCEPTS: ['application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],\n EXTENSION: ['doc', 'docx'],\n MIME_TYPES: ['application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],\n ILLUSTRATION: 'document',\n },\n XLS: {\n ACCEPTS: ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],\n EXTENSION: ['xls', 'xlsx'],\n MIME_TYPES: ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],\n ILLUSTRATION: 'csv',\n },\n });\n\n // TODO: convert to enum (typescript)\n export const Sizes = Object.freeze({\n Dense: 'dense',\n Standard: 'standard',\n });\n\n export default {\n name: 'll-file-upload',\n\n components: {\n 'll-icon': Icon,\n 'll-button': Button,\n InlineSvg,\n },\n\n inject: ['stashOptions'],\n\n inheritAttrs: false,\n\n props: {\n files: {\n type: Array,\n default: () => [],\n },\n\n /**\n * The file types accepted by the input\n */\n fileTypes: {\n type: Array,\n default: () => Object.keys(FILE_TYPES),\n },\n\n /**\n * Shows only an upload button\n */\n buttonOnly: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Disables the upload button\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * When using the drag and drop feature, hide the icon\n * and display everything on one line.\n */\n size: {\n type: String,\n default: 'standard',\n validator: (value) => Object.values(Sizes).includes(value),\n },\n },\n\n emits: ['file-select', 'file-delete', 'file-error'],\n\n setup() {\n return {\n Sizes,\n };\n },\n\n data() {\n return {\n isDraggingOver: false,\n removeText: t('ll.fileUpload.remove'),\n fileUploadUploadFileText: t('ll.fileUpload.uploadFile'),\n fileUploadDragDropFileHereText: t('ll.fileUpload.dragDropFileHere'),\n fileUploadOrText: t('ll.fileUpload.or'),\n };\n },\n\n computed: {\n inputAttrs() {\n const attrs = { ...this.$attrs };\n\n delete attrs['data-test'];\n delete attrs.class;\n delete attrs.type;\n delete attrs.accept;\n\n return attrs;\n },\n\n /**\n * @returns {Array} A list of accepted file types\n */\n acceptedMimeTypes() {\n return this.fileTypes.map((fileType) => this.fileMeta[fileType].MIME_TYPES).reduce(this.flattenArray);\n },\n\n /**\n * @returns {Array} A list of accepted file types\n */\n acceptedFileExtensions() {\n return this.fileTypes.map((fileType) => this.fileMeta[fileType].EXTENSION).reduce(this.flattenArray);\n },\n\n fileMeta() {\n return FILE_TYPES;\n },\n\n illustrationPath() {\n return `${this.stashOptions?.staticPath}/illustrations/FileUpload/${\n FILE_TYPES[this.fileTypes[0]].ILLUSTRATION\n }.svg`;\n },\n },\n\n methods: {\n openFileDialog() {\n if (this.$refs.fileUpload) {\n this.$refs.fileUpload.value = '';\n this.$refs.fileUpload.click();\n }\n },\n\n /**\n * Sets file(s) to selected file(s) from dialogue\n * @param {Object} event - file select event that contains file(s)\n * @returns {Array} An array of files\n */\n handleFileInput(event) {\n const files = [...event.target.files];\n\n this.$emit('file-select', { event, files });\n },\n\n handleDragEnter() {\n this.isDraggingOver = true;\n },\n\n handleDragLeave() {\n this.isDraggingOver = false;\n },\n\n /**\n * Sets file to dropped file if it is proper file type\n * @param {Object} event - file select event that contains file\n */\n async handleDropFile(event) {\n if (this.disabled) {\n return;\n }\n\n const files = [...event.dataTransfer.files];\n\n this.isDraggingOver = false;\n\n if (this.acceptedMimeTypes.length) {\n try {\n const mimeTypePromises = await Promise.all(files.map((file) => this.readMimeType(file)));\n const allCorrectMimeTypes = mimeTypePromises.every((mimeType) => this.acceptedMimeTypes.includes(mimeType));\n\n if (!allCorrectMimeTypes) {\n throw new Error('One or more files contains an unacceptable mime type.');\n }\n\n const allCorrectFileExtensions = files.every((file) => {\n const extension = file.name.split('.').pop();\n\n return this.acceptedFileExtensions.includes(extension);\n });\n\n if (!allCorrectFileExtensions) {\n throw new Error('One or more files contains an unacceptable extension.');\n }\n\n this.$emit('file-select', { event, files });\n } catch (error) {\n this.handleFileError(error);\n }\n } else {\n this.$emit('file-select', { event, files });\n }\n },\n\n handleFileError(error) {\n const message = this.t('ll.fileUpload.errors.incorrectFileType', {\n fileTypes: this.acceptedFileExtensions.join(', '),\n });\n\n if (this.$attrs['file-error']) {\n this.$emit('file-error', message);\n } else {\n this.$notify.warning(message);\n }\n\n throw error;\n },\n\n handleFileDelete(file) {\n this.$emit('file-delete', file);\n },\n\n /**\n * Check for the mime type on the uploaded File object\n * Otherwise load the file and attempt to read it\n * @param file The Uploaded File object\n */\n readMimeType(file) {\n return new Promise((resolve, reject) => {\n if (file.type) {\n return resolve(file.type);\n } else if (window.FileReader) {\n const fileReader = new FileReader();\n\n fileReader.onload = () => {\n const mimeType = fileReader.result.match(/[^:]\\w+\\/[\\w-+\\d.]+(?=;|,)/)\n ? fileReader.result.match(/[^:]\\w+\\/[\\w-+\\d.]+(?=;|,)/)[0]\n : '';\n\n resolve(mimeType);\n };\n\n fileReader.readAsDataURL(file);\n } else {\n reject(new Error('Failed to read file.'));\n }\n });\n },\n\n flattenArray(a, b) {\n return a.concat(b);\n },\n },\n };\n</script>\n\n<template>\n <div :class=\"$attrs.class\" :data-test=\"$attrs['data-test']\">\n <div v-if=\"buttonOnly\">\n <ll-button secondary type=\"button\" :disabled=\"disabled || null\" @click.stop.prevent=\"openFileDialog\">\n {{ fileUploadUploadFileText }}\n </ll-button>\n </div>\n <div\n v-else\n class=\"tw-rounded tw-p-6\"\n :class=\"[$style['file-dropbox'], isDraggingOver && $style['is-dragging'], disabled && $style['is-disabled']]\"\n @dragover.prevent=\"handleDragEnter\"\n @drop.prevent=\"handleDropFile\"\n @dragleave.prevent=\"handleDragLeave\"\n >\n <div\n class=\"tw-flex-column align-center align-middle tw-flex tw-text-center\"\n :class=\"[{ 'md:flex-row tw-items-center': size === Sizes.Dense }]\"\n >\n <template v-if=\"!files.length\">\n <InlineSvg v-if=\"size !== Sizes.Dense\" :src=\"illustrationPath\" name=\"file\" width=\"84\" height=\"96\" />\n <span class=\"tw-text-ice-900\">\n {{ fileUploadDragDropFileHereText }}\n </span>\n <span :class=\"size === Sizes.Dense ? 'md:ml-1 md:mr-2 md:my-0 my-1 tw-text-ice-900' : 'tw-mt-1.5 my-1'\">\n {{ fileUploadOrText }}\n </span>\n <ll-button\n class=\"tw-mt-1.5\"\n secondary\n type=\"button\"\n :class=\"$style['file-select-button']\"\n :disabled=\"disabled\"\n @click.stop.prevent=\"openFileDialog\"\n >\n <!-- @slot for custom submit text -->\n <slot name=\"submitText\">{{ fileUploadUploadFileText }}</slot>\n </ll-button>\n </template>\n <template v-else>\n <div v-for=\"file in files\" :key=\"file.name\">\n <ll-icon name=\"file\" />\n <span>{{ file.name }}</span>\n <ll-button\n :class=\"[$style['remove-button'], $style['button']]\"\n @click.stop.prevent=\"handleFileDelete(file)\"\n >\n {{ removeText }}\n </ll-button>\n </div>\n </template>\n </div>\n <div v-if=\"$slots.hint && !files.length\" class=\"text-small tw-mt-6 tw-text-center tw-text-ice-700\">\n <!-- @slot for displaying helpful text and/or links -->\n <slot name=\"hint\"></slot>\n </div>\n </div>\n <input\n v-show=\"false\"\n v-bind=\"inputAttrs\"\n ref=\"fileUpload\"\n type=\"file\"\n :accept=\"fileTypes.map((fileType) => fileMeta[fileType].ACCEPTS).reduce(flattenArray)\"\n :multiple=\"$attrs['multiple']\"\n @change=\"handleFileInput($event)\"\n />\n </div>\n</template>\n\n<style lang=\"scss\" module>\n .file-dropbox {\n background: var(--color-ice-200);\n background-image: url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='4' ry='4' stroke='%23C5C9D4FF' stroke-width='1' stroke-dasharray='5 %2c 5' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e\");\n background-repeat: no-repeat;\n border: border('thin');\n border-color: transparent;\n }\n\n .is-dragging {\n background-image: none;\n border-color: var(--color-ice-500);\n\n & > * {\n pointer-events: none;\n }\n }\n\n .is-disabled {\n cursor: no-drop;\n }\n\n // Constrain the upload icon for drag/drop to the required size\n .upload-icon {\n height: 98px;\n width: 84px;\n }\n\n .remove-button.button {\n background: transparent;\n border: none;\n color: var(--color-red-500);\n\n &:hover {\n background: transparent;\n border: none;\n }\n }\n</style>\n"],"names":["FILE_TYPES","Sizes","_sfc_main","Icon","Button","InlineSvg","value","t","attrs","fileType","_a","event","files","file","mimeType","extension","error","message","resolve","reject","fileReader","a","b","_hoisted_3","_createElementBlock","_normalizeClass","_ctx","$props","_hoisted_2","_createVNode","_component_ll_button","$options","$data","args","_createElementVNode","$setup","_Fragment","_renderList","_component_ll_icon","_toDisplayString","_withModifiers","$event","_createBlock","_component_InlineSvg","_renderSlot","_openBlock","_hoisted_4","_mergeProps","_cache"],"mappings":";;;;;;;;;;;;;;;;;GAOeA,IAAa,OAAO,OAAO;AAAA,EACtC,KAAK;AAAA,IACH,SAAS,CAAC,UAAU;AAAA,IACpB,WAAW,CAAC,KAAK;AAAA,IACjB,YAAY,CAAC,YAAY,4BAA4B,0BAA0B;AAAA,IAC/E,cAAc;AAAA,EACf;AAAA,EACD,KAAK;AAAA,IACH,SAAS,CAAC,iBAAiB;AAAA,IAC3B,WAAW,CAAC,KAAK;AAAA,IACjB,YAAY,CAAC,iBAAiB;AAAA,IAC9B,cAAc;AAAA,EACf;AAAA,EACD,KAAK;AAAA,IACH,SAAS,CAAC,WAAW;AAAA,IACrB,WAAW,CAAC,KAAK;AAAA,IACjB,YAAY,CAAC,WAAW;AAAA,IACxB,cAAc;AAAA,EACf;AAAA,EACD,MAAM;AAAA,IACJ,SAAS,CAAC,YAAY;AAAA,IACtB,WAAW,CAAC,OAAO,MAAM;AAAA,IACzB,YAAY,CAAC,YAAY;AAAA,IACzB,cAAc;AAAA,EACf;AAAA,EACD,KAAK;AAAA,IACH,SAAS,CAAC,sBAAsB,yEAAyE;AAAA,IACzG,WAAW,CAAC,OAAO,MAAM;AAAA,IACzB,YAAY,CAAC,sBAAsB,yEAAyE;AAAA,IAC5G,cAAc;AAAA,EACf;AAAA,EACD,KAAK;AAAA,IACH,SAAS,CAAC,4BAA4B,mEAAmE;AAAA,IACzG,WAAW,CAAC,OAAO,MAAM;AAAA,IACzB,YAAY,CAAC,4BAA4B,mEAAmE;AAAA,IAC5G,cAAc;AAAA,EACf;AACH,CAAC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,GAGM;AAAA,QADJF,EAAyBlB,EAAA,QAAA,MAAA;AAAA;;MAG7BQ,EAQE,SARFa,EAQEhB,EANkB,YAAA;AAAA,MAClB,KAAI;AAAA,MACJ,MAAK;AAAA,MACJ,QAAQJ,EAAA,UAAU,KAAKlB,MAAasB,EAAQ,SAACtB,CAAQ,EAAE,OAAO,EAAE,OAAOsB,EAAY,YAAA;AAAA,MACnF,UAAUL,EAAM,OAAA;AAAA,MAChB,UAAMsB,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAP,MAAEV,EAAe,gBAACU,CAAM;AAAA;UANvB,EAAK;AAAA;;;;;;"}
@@ -1,10 +1,10 @@
1
1
  import { defineComponent as S, computed as p, openBlock as r, createBlock as $, withCtx as u, createElementVNode as s, createElementBlock as d, withDirectives as f, vModelCheckbox as v, createVNode as _, withKeys as h, createTextVNode as b, toDisplayString as x, unref as C, createCommentVNode as K, Fragment as A, renderList as B } from "vue";
2
2
  import { t as E } from "./locale.js";
3
- import { _ as N } from "./Field.vue_vue_type_script_setup_true_lang-42cf79d4.js";
3
+ import { _ as N } from "./Field.vue_vue_type_script_setup_true_lang-4483019d.js";
4
4
  import y from "./FilterChip.js";
5
5
  import "lodash-es/get";
6
6
  import "lodash-es/uniqueId";
7
- import "./Label.vue_vue_type_script_setup_true_lang-c5589919.js";
7
+ import "./Label.vue_vue_type_script_setup_true_lang-2de35913.js";
8
8
  import "./Chip.js";
9
9
  import "./utils/colorScheme.js";
10
10
  import "./Icon.js";
package/dist/Filters.js CHANGED
@@ -1,10 +1,10 @@
1
- import w from "lodash-es/cloneDeep";
1
+ import G from "lodash-es/cloneDeep";
2
2
  import z from "lodash-es/merge";
3
3
  import { toRefs as W, ref as S, nextTick as Y, resolveComponent as y, openBlock as c, createElementBlock as V, Fragment as j, renderList as q, normalizeClass as L, createBlock as f, mergeProps as g, resolveDynamicComponent as k, createSlots as J, withCtx as b, normalizeProps as O, guardReactiveProps as R, createElementVNode as v, createCommentVNode as U, createVNode as D, createTextVNode as A, toDisplayString as M } from "vue";
4
4
  import K from "./useValidation.js";
5
5
  import { LLLV_CHANGE_TRIGGERS as N } from "./constants.js";
6
6
  import { t as H } from "./locale.js";
7
- import { persistentStorage as G } from "./storage.js";
7
+ import { persistentStorage as w } from "./storage.js";
8
8
  import Q from "./Button.js";
9
9
  import X from "./Checkbox.js";
10
10
  import Z from "./DatePicker.js";
@@ -38,8 +38,8 @@ import "./index-79ce320f.js";
38
38
  import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
39
39
  import "lodash-es/isNil";
40
40
  import "./utils/i18n.js";
41
- import "./Field.vue_vue_type_script_setup_true_lang-42cf79d4.js";
42
- import "./Label.vue_vue_type_script_setup_true_lang-c5589919.js";
41
+ import "./Field.vue_vue_type_script_setup_true_lang-4483019d.js";
42
+ import "./Label.vue_vue_type_script_setup_true_lang-2de35913.js";
43
43
  import "lodash-es/isEmpty";
44
44
  import "lodash-es/isEqual";
45
45
  import "./useSearch.js";
@@ -226,14 +226,14 @@ const ie = {
226
226
  * @returns {any}
227
227
  */
228
228
  getPersistentFilterValues() {
229
- return G.get("filter-values");
229
+ return w.get("filter-values");
230
230
  },
231
231
  /**
232
232
  * Clone new filterValues to remove reactivity, and save them to localStorage.
233
233
  * @param {object} newValues - the filterValues to be persisted in localStorage
234
234
  */
235
235
  persistFilterValues(l) {
236
- G.set("filter-values", w(l));
236
+ w.set("filter-values", G(l));
237
237
  }
238
238
  }
239
239
  }, se = { class: "ll-grid ll-grid-cols-4 md:ll-grid-cols-12" }, re = ["data-test"], ae = ["innerHTML"], ne = ["innerHTML"];
@@ -246,7 +246,7 @@ function ce(l, r, o, i, t, s) {
246
246
  return c(), V(j, null, [
247
247
  e.hidden ? U("", !0) : (c(), V("div", {
248
248
  key: `${a} ${t.forceRenderCount}`,
249
- class: L(["field-wrapper col-span-4 md:col-span-3", { "hidden-sm-only": !e.type, "flex align-bottom": e.type === "ll-checkbox" }]),
249
+ class: L(["field-wrapper col-span-4 md:col-span-3", { "hidden-sm-only": !e.type, "align-bottom tw-flex": e.type === "ll-checkbox" }]),
250
250
  "data-test": `filter|${e.fieldToFilter}`
251
251
  }, [
252
252
  e.type === "ll-select" ? (c(), f(p, g({ key: 0 }, e.attributes, {
@@ -313,7 +313,7 @@ function ce(l, r, o, i, t, s) {
313
313
  ], 64);
314
314
  }), 256)),
315
315
  v("div", {
316
- class: L(["flex align-right align-bottom button-grid col-span-4 md:col-span-12", l.$style["filter-button-group"]])
316
+ class: L(["align-right align-bottom button-grid col-span-4 md:col-span-12 tw-flex", l.$style["filter-button-group"]])
317
317
  }, [
318
318
  D(h, {
319
319
  secondary: "",
@@ -1 +1 @@
1
- {"version":3,"file":"Filters.js","sources":["../src/components/Filters/Filters.vue"],"sourcesContent":["<script>\n import cloneDeep from 'lodash-es/cloneDeep';\n import merge from 'lodash-es/merge';\n import { nextTick, ref, toRefs } from 'vue';\n\n import useValidation from '../../composables/useValidation/useValidation';\n import { LLLV_CHANGE_TRIGGERS } from '../../constants';\n import { t } from '../../locale';\n import { persistentStorage } from '../../storage';\n import Button from '../Button/Button.vue';\n import Checkbox from '../Checkbox/Checkbox.vue';\n import DatePicker from '../DatePicker/DatePicker.vue';\n import Input from '../Input/Input.vue';\n import InputOptions from '../InputOptions/InputOptions.vue';\n import Radio from '../Radio/Radio.vue';\n import Select from '../Select/Select.vue';\n\n export default {\n name: 'll-filters',\n\n components: {\n 'll-button': Button,\n 'll-checkbox': Checkbox,\n 'll-input': Input,\n 'll-input-options': InputOptions,\n 'll-radio': Radio,\n 'll-select': Select,\n DatePicker,\n },\n\n props: {\n /**\n * Whether to disable the Apply button\n */\n disableApply: Boolean,\n /**\n * Whether to disable the Clear button\n */\n disableClear: Boolean,\n /**\n * Whether to disable the sticky filters\n * If disabled, a default pre-selected value(s) can be added to\n * the filter component's attributes\n */\n disablePersistency: Boolean,\n /**\n * Filters schema\n */\n schema: {\n type: Array,\n default: () => [],\n },\n /**\n * Validation schema function that returns an object\n */\n validationSchema: {\n type: Function,\n default: () => () => undefined,\n },\n },\n\n emits: ['change', 'submit', 'reset'],\n\n setup(props) {\n const { validationSchema: getValidationSchema } = toRefs(props);\n const validationSchema = getValidationSchema.value();\n const validationValues = ref({});\n\n // Without ref, `this.validation` will always evaluate to its initial value of `undefined` due to lack of reactivity.\n const validation = ref();\n\n function initValidation() {\n if (validationSchema?.toString() !== '[object Object]') {\n return;\n }\n\n validationValues.value = Object.keys(validationSchema).reduce((values, fieldName) => {\n values[fieldName] = undefined;\n\n return values;\n }, {});\n\n const validationRules = Object.entries(validationSchema).reduce((rules, [fieldName, fieldRules]) => {\n rules[fieldName] = fieldRules.map((fieldRule) => {\n return fieldRule(validationValues);\n });\n\n return rules;\n }, {});\n\n validation.value = useValidation({ rules: validationRules, values: validationValues });\n validation.value.validate();\n }\n\n return {\n validation,\n validationValues,\n initValidation,\n };\n },\n\n data() {\n return {\n applyText: t('ll.apply'),\n clearText: t('ll.clear'),\n filters: {},\n filterValues: {},\n forceRenderCount: 0,\n };\n },\n\n watch: {\n filterValues: {\n /**\n * Maps filters to a partcular object structure:\n * @param {IFilterSchemaItem} newFilterValues all selected filters\n * @returns {IFilter}\n */\n handler: function (newFilterValues) {\n const filters = Object.keys(newFilterValues).reduce((acc, i) => {\n const schema = this.schema[i];\n\n if (!schema || !schema.fieldToFilter) {\n return acc;\n }\n\n const item = newFilterValues[i];\n\n // Ignore empty string or undefined/null filter values\n if (item === '' || item == null) {\n return acc;\n }\n\n const trackBy = schema.attributes.trackBy || 'id';\n const isObject = typeof item === 'object';\n const isCustomFilterComponent = typeof schema.type === 'object';\n // TODO: remove handling of schema.attributes.multiple when we remove the vue-multiselect version of Select\n const isMultiple =\n (isCustomFilterComponent && schema.attributes.multiple) ||\n (!isCustomFilterComponent &&\n schema.type.includes('ll-select') &&\n (schema.attributes.multiple || !schema.attributes.single));\n const filterBy = isMultiple\n ? // local storage might have item stored as an object from the old Select\n (Array.isArray(item) ? item : [item]).map((v) => v[trackBy])\n : isObject\n ? [item[trackBy]]\n : [item];\n\n const groupedWith = schema.groupedWith;\n\n if (groupedWith) {\n filterBy[0] = {\n index: groupedWith,\n value: newFilterValues[groupedWith],\n };\n filterBy.push({\n index: Number(i),\n value: newFilterValues[i],\n });\n }\n\n filterBy.length &&\n (acc[schema.fieldToFilter] = {\n // don't add to `filters` if no filterBy\n filterBy,\n filterType: schema.type, // Informs the applied filter count\n isMultiple,\n ...('fn' in schema && { customFilter: schema.fn }),\n });\n\n return acc;\n }, {});\n\n this.filters = filters;\n this.$emit('change', filters);\n },\n\n deep: true,\n immediate: true,\n },\n\n filters() {\n if (this.validation) {\n this.updateValidationValues();\n }\n },\n },\n\n async created() {\n // initFilterValues updates the filterValues so using await nextTick() forces the code\n // after it to wait until nextTick is done, at which point the filterValues will\n // be done initializing. Otherwise, applyFilters sometimes applies the wrong\n // filters because filterValues is not done updating.\n this.initFilterValues();\n await nextTick();\n this.initValidation();\n this.applyFilters({ trigger: LLLV_CHANGE_TRIGGERS.LOAD });\n },\n\n methods: {\n initFilterValues() {\n if (this.disablePersistency) {\n this.filterValues = this.getDefaultFilterValues();\n\n return;\n }\n\n this.filterValues = this.getPersistentFilterValues() || this.getDefaultFilterValues();\n },\n\n /**\n * Apply the selected filters and save them to localStorage.\n * ListView calls this method using a ref to Filters.\n * The trigger option is used in ListView.\n * @param {object} [options] - optional parameters\n * @param {string} [options.trigger] - the action that triggered this function call\n */\n async applyFilters({ trigger = LLLV_CHANGE_TRIGGERS.APPLY } = {}) {\n if (this.validation) {\n await this.validation.validate();\n\n if (this.validation.hasErrors) {\n return;\n }\n }\n\n if (!this.disablePersistency) {\n this.persistFilterValues(this.filterValues);\n }\n\n this.$emit('submit', { trigger });\n },\n\n resetFilters() {\n this.filterValues = this.getDefaultFilterValues();\n\n this.forceRenderCount++;\n\n if (!this.disablePersistency) {\n this.persistFilterValues(this.filterValues);\n }\n\n // Emit after filters are updated\n this.$nextTick(() => {\n this.$emit('reset');\n });\n },\n\n /**\n * Returns pre-defined filter values to become the default values\n */\n getDefaultFilterValues() {\n return this.schema.reduce((acc, item, filterIndex) => {\n if (item.type === 'll-checkbox') {\n acc[filterIndex] = item.attributes.checked || false;\n } else if (Object.prototype.hasOwnProperty.call(item.attributes, 'modelValue')) {\n acc[filterIndex] = item.attributes.modelValue;\n }\n\n return acc;\n }, {});\n },\n\n /**\n * Intended for external use, when filter values need to be set for the user\n */\n setFilterValues(newValues) {\n this.filterValues = merge({}, this.filterValues, newValues);\n this.forceRenderCount++;\n },\n\n updateValidationValues() {\n const validatable = Object.keys(this.validationSchema());\n\n this.schema.forEach((fieldSchema, filterIndex) => {\n const fieldToFilter = fieldSchema.fieldToFilter;\n const validate = validatable.includes(fieldToFilter);\n\n if (validate) {\n const filter = this.filters[fieldToFilter];\n\n /**\n * Get all validatable fields.\n * Use parsed value of filters that are set,\n * otherwise fall back to `filterValue` value if not set.\n */\n const filterValue = filter\n ? filter.isMultiple\n ? filter.filterBy\n : filter.filterBy[0]\n : this.filterValues[filterIndex];\n\n this.validationValues[fieldToFilter] = filterValue;\n }\n });\n },\n\n /**\n * Change handler for filter fields\n */\n onChange(filter, filterValues, filterIndex) {\n if (filter.on?.change) {\n // Maps to `on.change` handlers in the filter schema.\n filter.on.change(filterValues, filterIndex);\n }\n },\n\n /**\n * Select input event handler for filter fields\n */\n onSelectInput(newValue, filter, filterIndex) {\n if (newValue === undefined) {\n delete this.filterValues[filterIndex]; // prevent undefined filterValues which cause an empty result list\n } else {\n this.filterValues[filterIndex] = newValue;\n }\n\n this.onChange(filter, this.filterValues, filterIndex);\n },\n\n /**\n * Get filter values from local storage.\n * @returns {any}\n */\n getPersistentFilterValues() {\n return persistentStorage.get('filter-values');\n },\n\n /**\n * Clone new filterValues to remove reactivity, and save them to localStorage.\n * @param {object} newValues - the filterValues to be persisted in localStorage\n */\n persistFilterValues(newValues) {\n persistentStorage.set('filter-values', cloneDeep(newValues));\n },\n },\n };\n</script>\n\n<template>\n <div class=\"ll-grid ll-grid-cols-4 md:ll-grid-cols-12\">\n <template v-for=\"(filter, filterIndex) in schema\">\n <div\n v-if=\"!filter.hidden\"\n :key=\"`${filterIndex} ${forceRenderCount}`\"\n class=\"field-wrapper col-span-4 md:col-span-3\"\n :class=\"{ 'hidden-sm-only': !filter.type, 'flex align-bottom': filter.type === 'll-checkbox' }\"\n :data-test=\"`filter|${filter.fieldToFilter}`\"\n >\n <!-- Filter component -->\n <ll-select\n v-if=\"filter.type === 'll-select'\"\n v-bind=\"filter.attributes\"\n :error=\"validation?.fields[filter.fieldToFilter] && validation?.getError(filter.fieldToFilter)\"\n :label=\"filter.label\"\n :model-value=\"filterValues[filterIndex]\"\n @update:model-value=\"(newValue) => onSelectInput(newValue, filter, filterIndex)\"\n />\n <ll-checkbox\n v-else-if=\"filter.type === 'll-checkbox'\"\n v-model:checked=\"filterValues[filterIndex]\"\n v-bind=\"filter.attributes\"\n :error-text=\"validation?.fields[filter.fieldToFilter] && validation?.getError(filter.fieldToFilter)\"\n :label=\"filter.label\"\n @update:checked=\"onChange(filter, filterValues, filterIndex)\"\n />\n <ll-radio\n v-else-if=\"filter.type === 'll-radio'\"\n v-model:checked=\"filterValues[filterIndex]\"\n v-bind=\"filter.attributes\"\n :error-text=\"validation?.fields[filter.fieldToFilter] && validation?.getError(filter.fieldToFilter)\"\n :label=\"filter.label\"\n @update:checked=\"onChange(filter, filterValues, filterIndex)\"\n />\n <component\n v-bind=\"filter.attributes\"\n :is=\"filter.type\"\n v-else-if=\"filter.type\"\n v-model=\"filterValues[filterIndex]\"\n :error-text=\"validation?.fields[filter.fieldToFilter] && validation?.getError(filter.fieldToFilter)\"\n :label=\"filter.label\"\n @update:model-value=\"onChange(filter, filterValues, filterIndex)\"\n >\n <template v-if=\"filter.slots && filter.slots.selected\" #selected=\"{ option }\">\n <component :is=\"filter.slots.selected\" v-bind=\"option.props\" />\n </template>\n <template v-if=\"filter.slots && filter.slots.option\" #option=\"{ option }\">\n <component :is=\"filter.slots.option\" v-bind=\"option.props\" />\n </template>\n <template v-if=\"filter.slots && filter.slots.prepend\" #prepend>\n <span v-html=\"filter.slots.prepend\"></span>\n </template>\n <template v-if=\"filter.slots && filter.slots.append\" #append>\n <span v-html=\"filter.slots.append\"></span>\n </template>\n </component>\n </div>\n </template>\n <div\n class=\"flex align-right align-bottom button-grid col-span-4 md:col-span-12\"\n :class=\"$style['filter-button-group']\"\n >\n <ll-button secondary data-test=\"button|reset-filters\" :disabled=\"disableClear\" @click=\"resetFilters\">\n {{ clearText }}\n </ll-button>\n <ll-button\n primary\n data-test=\"button|apply-filters\"\n :disabled=\"disableApply || validation?.hasErrors\"\n @click=\"applyFilters\"\n >\n {{ applyText }}\n </ll-button>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\" module>\n .filter-button-group {\n @include breakpoint('sm-only') {\n display: flex;\n flex-direction: column-reverse;\n }\n\n button {\n @include breakpoint('sm-only') {\n width: 100% !important;\n }\n\n &:nth-child(2) {\n @include breakpoint('sm-only') {\n margin-bottom: space(2);\n }\n }\n }\n }\n</style>\n"],"names":["_sfc_main","Button","Checkbox","Input","InputOptions","Radio","Select","DatePicker","props","getValidationSchema","toRefs","validationSchema","validationValues","ref","validation","initValidation","values","fieldName","validationRules","rules","fieldRules","fieldRule","useValidation","t","newFilterValues","filters","acc","schema","item","trackBy","isObject","isCustomFilterComponent","isMultiple","filterBy","v","groupedWith","nextTick","LLLV_CHANGE_TRIGGERS","trigger","filterIndex","newValues","merge","validatable","fieldSchema","fieldToFilter","filter","filterValue","filterValues","_a","newValue","persistentStorage","cloneDeep","_hoisted_1","_openBlock","_createElementBlock","_Fragment","_renderList","$props","$data","_normalizeClass","_createBlock","_component_ll_select","_mergeProps","$setup","_b","$options","_component_ll_checkbox","$event","_c","_d","_component_ll_radio","_e","_f","_resolveDynamicComponent","_g","_h","_withCtx","option","_normalizeProps","_guardReactiveProps","_createElementVNode","_ctx","_createVNode","_component_ll_button"],"mappings":";;;;;;;;;;;;;;;;;;;;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5B,EAAO,MAAM,MAAM,GAAAiC,EAAAC,EAAUF,EAAO,KAAK,CAAA,GAAA,MAAA,EAAA;AAAA;;;YAE3ChC,EAAO,SAASA,EAAO,MAAM;oBAAU;AAAA,oBACrD,MAA2C;AAAA,gBAA3CmC,EAA2C,QAAA;AAAA,kBAArC,WAAQnC,EAAO,MAAM;AAAA;;;;YAEbA,EAAO,SAASA,EAAO,MAAM;oBAAS;AAAA,oBACpD,MAA0C;AAAA,gBAA1CmC,EAA0C,QAAA;AAAA,kBAApC,WAAQnC,EAAO,MAAM;AAAA;;;;;;;;IAKnCmC,EAeM,OAAA;AAAA,MAdJ,OAAKrB,EAAA,CAAC,uEACEsB,EAAM,OAAA,qBAAA,CAAA,CAAA;AAAA;MAEdC,EAEYC,GAAA;AAAA,QAFD,WAAA;AAAA,QAAU,aAAU;AAAA,QAAwB,UAAU1B,EAAY;AAAA,QAAG,SAAOQ,EAAY;AAAA;mBACjG,MAAe;AAAA,cAAZP,EAAS,SAAA,GAAA,CAAA;AAAA;;;MAEdwB,EAOYC,GAAA;AAAA,QANV,SAAA;AAAA,QACA,aAAU;AAAA,QACT,UAAU1B,EAAA,kBAAgBT,IAAAe,EAAA,eAAA,gBAAAf,EAAY;AAAA,QACtC,SAAOiB,EAAY;AAAA;mBAEpB,MAAe;AAAA,cAAZP,EAAS,SAAA,GAAA,CAAA;AAAA;;;;;;;;;"}
1
+ {"version":3,"file":"Filters.js","sources":["../src/components/Filters/Filters.vue"],"sourcesContent":["<script>\n import cloneDeep from 'lodash-es/cloneDeep';\n import merge from 'lodash-es/merge';\n import { nextTick, ref, toRefs } from 'vue';\n\n import useValidation from '../../composables/useValidation/useValidation';\n import { LLLV_CHANGE_TRIGGERS } from '../../constants';\n import { t } from '../../locale';\n import { persistentStorage } from '../../storage';\n import Button from '../Button/Button.vue';\n import Checkbox from '../Checkbox/Checkbox.vue';\n import DatePicker from '../DatePicker/DatePicker.vue';\n import Input from '../Input/Input.vue';\n import InputOptions from '../InputOptions/InputOptions.vue';\n import Radio from '../Radio/Radio.vue';\n import Select from '../Select/Select.vue';\n\n export default {\n name: 'll-filters',\n\n components: {\n 'll-button': Button,\n 'll-checkbox': Checkbox,\n 'll-input': Input,\n 'll-input-options': InputOptions,\n 'll-radio': Radio,\n 'll-select': Select,\n DatePicker,\n },\n\n props: {\n /**\n * Whether to disable the Apply button\n */\n disableApply: Boolean,\n /**\n * Whether to disable the Clear button\n */\n disableClear: Boolean,\n /**\n * Whether to disable the sticky filters\n * If disabled, a default pre-selected value(s) can be added to\n * the filter component's attributes\n */\n disablePersistency: Boolean,\n /**\n * Filters schema\n */\n schema: {\n type: Array,\n default: () => [],\n },\n /**\n * Validation schema function that returns an object\n */\n validationSchema: {\n type: Function,\n default: () => () => undefined,\n },\n },\n\n emits: ['change', 'submit', 'reset'],\n\n setup(props) {\n const { validationSchema: getValidationSchema } = toRefs(props);\n const validationSchema = getValidationSchema.value();\n const validationValues = ref({});\n\n // Without ref, `this.validation` will always evaluate to its initial value of `undefined` due to lack of reactivity.\n const validation = ref();\n\n function initValidation() {\n if (validationSchema?.toString() !== '[object Object]') {\n return;\n }\n\n validationValues.value = Object.keys(validationSchema).reduce((values, fieldName) => {\n values[fieldName] = undefined;\n\n return values;\n }, {});\n\n const validationRules = Object.entries(validationSchema).reduce((rules, [fieldName, fieldRules]) => {\n rules[fieldName] = fieldRules.map((fieldRule) => {\n return fieldRule(validationValues);\n });\n\n return rules;\n }, {});\n\n validation.value = useValidation({ rules: validationRules, values: validationValues });\n validation.value.validate();\n }\n\n return {\n validation,\n validationValues,\n initValidation,\n };\n },\n\n data() {\n return {\n applyText: t('ll.apply'),\n clearText: t('ll.clear'),\n filters: {},\n filterValues: {},\n forceRenderCount: 0,\n };\n },\n\n watch: {\n filterValues: {\n /**\n * Maps filters to a partcular object structure:\n * @param {IFilterSchemaItem} newFilterValues all selected filters\n * @returns {IFilter}\n */\n handler: function (newFilterValues) {\n const filters = Object.keys(newFilterValues).reduce((acc, i) => {\n const schema = this.schema[i];\n\n if (!schema || !schema.fieldToFilter) {\n return acc;\n }\n\n const item = newFilterValues[i];\n\n // Ignore empty string or undefined/null filter values\n if (item === '' || item == null) {\n return acc;\n }\n\n const trackBy = schema.attributes.trackBy || 'id';\n const isObject = typeof item === 'object';\n const isCustomFilterComponent = typeof schema.type === 'object';\n // TODO: remove handling of schema.attributes.multiple when we remove the vue-multiselect version of Select\n const isMultiple =\n (isCustomFilterComponent && schema.attributes.multiple) ||\n (!isCustomFilterComponent &&\n schema.type.includes('ll-select') &&\n (schema.attributes.multiple || !schema.attributes.single));\n const filterBy = isMultiple\n ? // local storage might have item stored as an object from the old Select\n (Array.isArray(item) ? item : [item]).map((v) => v[trackBy])\n : isObject\n ? [item[trackBy]]\n : [item];\n\n const groupedWith = schema.groupedWith;\n\n if (groupedWith) {\n filterBy[0] = {\n index: groupedWith,\n value: newFilterValues[groupedWith],\n };\n filterBy.push({\n index: Number(i),\n value: newFilterValues[i],\n });\n }\n\n filterBy.length &&\n (acc[schema.fieldToFilter] = {\n // don't add to `filters` if no filterBy\n filterBy,\n filterType: schema.type, // Informs the applied filter count\n isMultiple,\n ...('fn' in schema && { customFilter: schema.fn }),\n });\n\n return acc;\n }, {});\n\n this.filters = filters;\n this.$emit('change', filters);\n },\n\n deep: true,\n immediate: true,\n },\n\n filters() {\n if (this.validation) {\n this.updateValidationValues();\n }\n },\n },\n\n async created() {\n // initFilterValues updates the filterValues so using await nextTick() forces the code\n // after it to wait until nextTick is done, at which point the filterValues will\n // be done initializing. Otherwise, applyFilters sometimes applies the wrong\n // filters because filterValues is not done updating.\n this.initFilterValues();\n await nextTick();\n this.initValidation();\n this.applyFilters({ trigger: LLLV_CHANGE_TRIGGERS.LOAD });\n },\n\n methods: {\n initFilterValues() {\n if (this.disablePersistency) {\n this.filterValues = this.getDefaultFilterValues();\n\n return;\n }\n\n this.filterValues = this.getPersistentFilterValues() || this.getDefaultFilterValues();\n },\n\n /**\n * Apply the selected filters and save them to localStorage.\n * ListView calls this method using a ref to Filters.\n * The trigger option is used in ListView.\n * @param {object} [options] - optional parameters\n * @param {string} [options.trigger] - the action that triggered this function call\n */\n async applyFilters({ trigger = LLLV_CHANGE_TRIGGERS.APPLY } = {}) {\n if (this.validation) {\n await this.validation.validate();\n\n if (this.validation.hasErrors) {\n return;\n }\n }\n\n if (!this.disablePersistency) {\n this.persistFilterValues(this.filterValues);\n }\n\n this.$emit('submit', { trigger });\n },\n\n resetFilters() {\n this.filterValues = this.getDefaultFilterValues();\n\n this.forceRenderCount++;\n\n if (!this.disablePersistency) {\n this.persistFilterValues(this.filterValues);\n }\n\n // Emit after filters are updated\n this.$nextTick(() => {\n this.$emit('reset');\n });\n },\n\n /**\n * Returns pre-defined filter values to become the default values\n */\n getDefaultFilterValues() {\n return this.schema.reduce((acc, item, filterIndex) => {\n if (item.type === 'll-checkbox') {\n acc[filterIndex] = item.attributes.checked || false;\n } else if (Object.prototype.hasOwnProperty.call(item.attributes, 'modelValue')) {\n acc[filterIndex] = item.attributes.modelValue;\n }\n\n return acc;\n }, {});\n },\n\n /**\n * Intended for external use, when filter values need to be set for the user\n */\n setFilterValues(newValues) {\n this.filterValues = merge({}, this.filterValues, newValues);\n this.forceRenderCount++;\n },\n\n updateValidationValues() {\n const validatable = Object.keys(this.validationSchema());\n\n this.schema.forEach((fieldSchema, filterIndex) => {\n const fieldToFilter = fieldSchema.fieldToFilter;\n const validate = validatable.includes(fieldToFilter);\n\n if (validate) {\n const filter = this.filters[fieldToFilter];\n\n /**\n * Get all validatable fields.\n * Use parsed value of filters that are set,\n * otherwise fall back to `filterValue` value if not set.\n */\n const filterValue = filter\n ? filter.isMultiple\n ? filter.filterBy\n : filter.filterBy[0]\n : this.filterValues[filterIndex];\n\n this.validationValues[fieldToFilter] = filterValue;\n }\n });\n },\n\n /**\n * Change handler for filter fields\n */\n onChange(filter, filterValues, filterIndex) {\n if (filter.on?.change) {\n // Maps to `on.change` handlers in the filter schema.\n filter.on.change(filterValues, filterIndex);\n }\n },\n\n /**\n * Select input event handler for filter fields\n */\n onSelectInput(newValue, filter, filterIndex) {\n if (newValue === undefined) {\n delete this.filterValues[filterIndex]; // prevent undefined filterValues which cause an empty result list\n } else {\n this.filterValues[filterIndex] = newValue;\n }\n\n this.onChange(filter, this.filterValues, filterIndex);\n },\n\n /**\n * Get filter values from local storage.\n * @returns {any}\n */\n getPersistentFilterValues() {\n return persistentStorage.get('filter-values');\n },\n\n /**\n * Clone new filterValues to remove reactivity, and save them to localStorage.\n * @param {object} newValues - the filterValues to be persisted in localStorage\n */\n persistFilterValues(newValues) {\n persistentStorage.set('filter-values', cloneDeep(newValues));\n },\n },\n };\n</script>\n\n<template>\n <div class=\"ll-grid ll-grid-cols-4 md:ll-grid-cols-12\">\n <template v-for=\"(filter, filterIndex) in schema\">\n <div\n v-if=\"!filter.hidden\"\n :key=\"`${filterIndex} ${forceRenderCount}`\"\n class=\"field-wrapper col-span-4 md:col-span-3\"\n :class=\"{ 'hidden-sm-only': !filter.type, 'align-bottom tw-flex': filter.type === 'll-checkbox' }\"\n :data-test=\"`filter|${filter.fieldToFilter}`\"\n >\n <!-- Filter component -->\n <ll-select\n v-if=\"filter.type === 'll-select'\"\n v-bind=\"filter.attributes\"\n :error=\"validation?.fields[filter.fieldToFilter] && validation?.getError(filter.fieldToFilter)\"\n :label=\"filter.label\"\n :model-value=\"filterValues[filterIndex]\"\n @update:model-value=\"(newValue) => onSelectInput(newValue, filter, filterIndex)\"\n />\n <ll-checkbox\n v-else-if=\"filter.type === 'll-checkbox'\"\n v-model:checked=\"filterValues[filterIndex]\"\n v-bind=\"filter.attributes\"\n :error-text=\"validation?.fields[filter.fieldToFilter] && validation?.getError(filter.fieldToFilter)\"\n :label=\"filter.label\"\n @update:checked=\"onChange(filter, filterValues, filterIndex)\"\n />\n <ll-radio\n v-else-if=\"filter.type === 'll-radio'\"\n v-model:checked=\"filterValues[filterIndex]\"\n v-bind=\"filter.attributes\"\n :error-text=\"validation?.fields[filter.fieldToFilter] && validation?.getError(filter.fieldToFilter)\"\n :label=\"filter.label\"\n @update:checked=\"onChange(filter, filterValues, filterIndex)\"\n />\n <component\n v-bind=\"filter.attributes\"\n :is=\"filter.type\"\n v-else-if=\"filter.type\"\n v-model=\"filterValues[filterIndex]\"\n :error-text=\"validation?.fields[filter.fieldToFilter] && validation?.getError(filter.fieldToFilter)\"\n :label=\"filter.label\"\n @update:model-value=\"onChange(filter, filterValues, filterIndex)\"\n >\n <template v-if=\"filter.slots && filter.slots.selected\" #selected=\"{ option }\">\n <component :is=\"filter.slots.selected\" v-bind=\"option.props\" />\n </template>\n <template v-if=\"filter.slots && filter.slots.option\" #option=\"{ option }\">\n <component :is=\"filter.slots.option\" v-bind=\"option.props\" />\n </template>\n <template v-if=\"filter.slots && filter.slots.prepend\" #prepend>\n <span v-html=\"filter.slots.prepend\"></span>\n </template>\n <template v-if=\"filter.slots && filter.slots.append\" #append>\n <span v-html=\"filter.slots.append\"></span>\n </template>\n </component>\n </div>\n </template>\n <div\n class=\"align-right align-bottom button-grid col-span-4 md:col-span-12 tw-flex\"\n :class=\"$style['filter-button-group']\"\n >\n <ll-button secondary data-test=\"button|reset-filters\" :disabled=\"disableClear\" @click=\"resetFilters\">\n {{ clearText }}\n </ll-button>\n <ll-button\n primary\n data-test=\"button|apply-filters\"\n :disabled=\"disableApply || validation?.hasErrors\"\n @click=\"applyFilters\"\n >\n {{ applyText }}\n </ll-button>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\" module>\n .filter-button-group {\n @include breakpoint('sm-only') {\n display: flex;\n flex-direction: column-reverse;\n }\n\n button {\n @include breakpoint('sm-only') {\n width: 100% !important;\n }\n\n &:nth-child(2) {\n @include breakpoint('sm-only') {\n margin-bottom: space(2);\n }\n }\n }\n }\n</style>\n"],"names":["_sfc_main","Button","Checkbox","Input","InputOptions","Radio","Select","DatePicker","props","getValidationSchema","toRefs","validationSchema","validationValues","ref","validation","initValidation","values","fieldName","validationRules","rules","fieldRules","fieldRule","useValidation","t","newFilterValues","filters","acc","schema","item","trackBy","isObject","isCustomFilterComponent","isMultiple","filterBy","v","groupedWith","nextTick","LLLV_CHANGE_TRIGGERS","trigger","filterIndex","newValues","merge","validatable","fieldSchema","fieldToFilter","filter","filterValue","filterValues","_a","newValue","persistentStorage","cloneDeep","_hoisted_1","_openBlock","_createElementBlock","_Fragment","_renderList","$props","$data","_normalizeClass","_createBlock","_component_ll_select","_mergeProps","$setup","_b","$options","_component_ll_checkbox","$event","_c","_d","_component_ll_radio","_e","_f","_resolveDynamicComponent","_g","_h","_withCtx","option","_normalizeProps","_guardReactiveProps","_createElementVNode","_ctx","_createVNode","_component_ll_button"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiBOA,KAAU;AAAA,EACb,MAAM;AAAA,EAEN,YAAY;AAAA,IACV,aAAaC;AAAA,IACb,eAAeC;AAAA,IACf,YAAYC;AAAA,IACZ,oBAAoBC;AAAA,IACpB,YAAYC;AAAA,IACZ,aAAaC;AAAA,IACb,YAAAC;AAAA,EACD;AAAA,EAED,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,cAAc;AAAA;AAAA;AAAA;AAAA,IAId,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMd,oBAAoB;AAAA;AAAA;AAAA;AAAA,IAIpB,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,SAAS,MAAM,CAAE;AAAA,IAClB;AAAA;AAAA;AAAA;AAAA,IAID,kBAAkB;AAAA,MAChB,MAAM;AAAA,MACN,SAAS,MAAM,MAAA;AAAA;AAAA,IAChB;AAAA,EACF;AAAA,EAED,OAAO,CAAC,UAAU,UAAU,OAAO;AAAA,EAEnC,MAAMC,GAAO;AACX,UAAM,EAAE,kBAAkBC,EAAoB,IAAIC,EAAOF,CAAK,GACxDG,IAAmBF,EAAoB,SACvCG,IAAmBC,EAAI,CAAA,CAAE,GAGzBC,IAAaD;AAEnB,aAASE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AAY;AAAA;mBAEpB,MAAe;AAAA,cAAZP,EAAS,SAAA,GAAA,CAAA;AAAA;;;;;;;;;"}
package/dist/IconLabel.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { defineComponent as a, computed as o, openBlock as c, createBlock as i, resolveDynamicComponent as u, mergeProps as f, withCtx as d, createVNode as m, normalizeClass as r, createElementVNode as p, renderSlot as _ } from "vue";
2
- import v from "./Icon.js";
3
- import { _ as h } from "./_plugin-vue_export-helper-dad06003.js";
2
+ import w from "./Icon.js";
3
+ import { _ as v } from "./_plugin-vue_export-helper-dad06003.js";
4
4
  import "lodash-es/uniqueId";
5
5
  import "./index-79ce320f.js";
6
6
  import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
7
- const k = /* @__PURE__ */ a({
7
+ const h = /* @__PURE__ */ a({
8
8
  name: "ll-icon-label",
9
9
  __name: "IconLabel",
10
10
  props: {
@@ -22,17 +22,17 @@ const k = /* @__PURE__ */ a({
22
22
  href: e.href
23
23
  } : {});
24
24
  return (t, b) => (c(), i(u(s.value), f(l.value, {
25
- class: ["flex", { "flex-column items-center": e.stacked }]
25
+ class: ["tw-flex", { "tw-flex-column tw-items-center": e.stacked }]
26
26
  }), {
27
27
  default: d(() => [
28
- m(v, {
28
+ m(w, {
29
29
  name: e.icon,
30
30
  size: "dense",
31
31
  class: r([t.$style.icon, { [`text-${t.color}`]: !!t.color }])
32
32
  }, null, 8, ["name", "class"]),
33
33
  p("div", {
34
34
  class: r({
35
- "flex-1 tw-ml-1.5": !e.stacked,
35
+ "tw-ml-1.5 tw-flex-1": !e.stacked,
36
36
  "text-xs tw-mt-1.5 tw-leading-3": e.stacked,
37
37
  "tw-truncate": t.truncate
38
38
  })
@@ -43,11 +43,11 @@ const k = /* @__PURE__ */ a({
43
43
  _: 3
44
44
  }, 16, ["class"]));
45
45
  }
46
- }), y = "_icon_gr3q2_2", w = {
47
- icon: y
46
+ }), k = "_icon_gr3q2_2", y = {
47
+ icon: k
48
48
  }, x = {
49
- $style: w
50
- }, L = /* @__PURE__ */ h(k, [["__cssModules", x]]);
49
+ $style: y
50
+ }, L = /* @__PURE__ */ v(h, [["__cssModules", x]]);
51
51
  export {
52
52
  L as default
53
53
  };
@@ -1 +1 @@
1
- {"version":3,"file":"IconLabel.js","sources":["../src/components/IconLabel/IconLabel.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed } from 'vue';\n\n import { StashCommonColor } from '../../../types/colors';\n import { IconName } from '../Icon/Icon.types';\n import Icon from '../Icon/Icon.vue';\n\n export interface IconLabelProps {\n /**\n * Name of the icon to use. All design system icons are supported.\n */\n icon: IconName;\n\n /**\n * Color to apply to the icon. Common Stash colors are supported (default, 100 & 700 shades).\n */\n color?: StashCommonColor;\n\n /**\n * Valid hyperlink.\n */\n href?: string;\n\n /**\n * Valid vue-router route.\n */\n to?: string | object;\n\n /**\n * If true, renders the label below the icon instead of to the right\n */\n stacked?: boolean;\n\n /**\n * If true, truncates overflowing text with an ellipsis when it's unable to wrap\n */\n truncate?: boolean;\n }\n\n const props = withDefaults(defineProps<IconLabelProps>(), {\n color: undefined,\n href: undefined,\n to: undefined,\n stacked: false,\n truncate: false,\n });\n\n defineOptions({\n name: 'll-icon-label',\n });\n\n const is = computed(() => {\n if (props.to) {\n return 'router-link';\n }\n\n if (props.href) {\n return 'a';\n }\n\n return 'div';\n });\n\n const attributes = computed(() => {\n if (props.to) {\n return {\n to: props.to,\n };\n }\n\n if (props.href) {\n return {\n href: props.href,\n };\n }\n\n return {};\n });\n</script>\n\n<template>\n <component :is=\"is\" v-bind=\"attributes\" class=\"flex\" :class=\"{ 'flex-column items-center': props.stacked }\">\n <Icon :name=\"props.icon\" size=\"dense\" :class=\"[$style.icon, { [`text-${color}`]: !!color }]\" />\n\n <div\n :class=\"{\n 'flex-1 tw-ml-1.5': !props.stacked,\n 'text-xs tw-mt-1.5 tw-leading-3': props.stacked,\n 'tw-truncate': truncate,\n }\"\n >\n <!-- @slot Label text -->\n <slot></slot>\n </div>\n </component>\n</template>\n\n<style module>\n .icon {\n margin-top: -1px;\n }\n</style>\n"],"names":["is","computed","props","attributes"],"mappings":";;;;;;;;;;;;;;;;;;iBAmDQA,IAAKC,EAAS,MACdC,EAAM,KACD,gBAGLA,EAAM,OACD,MAGF,KACR,GAEKC,IAAaF,EAAS,MACtBC,EAAM,KACD;AAAA,MACL,IAAIA,EAAM;AAAA,IAAA,IAIVA,EAAM,OACD;AAAA,MACL,MAAMA,EAAM;AAAA,IAAA,IAIT,EACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"IconLabel.js","sources":["../src/components/IconLabel/IconLabel.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed } from 'vue';\n\n import { StashCommonColor } from '../../../types/colors';\n import { IconName } from '../Icon/Icon.types';\n import Icon from '../Icon/Icon.vue';\n\n export interface IconLabelProps {\n /**\n * Name of the icon to use. All design system icons are supported.\n */\n icon: IconName;\n\n /**\n * Color to apply to the icon. Common Stash colors are supported (default, 100 & 700 shades).\n */\n color?: StashCommonColor;\n\n /**\n * Valid hyperlink.\n */\n href?: string;\n\n /**\n * Valid vue-router route.\n */\n to?: string | object;\n\n /**\n * If true, renders the label below the icon instead of to the right\n */\n stacked?: boolean;\n\n /**\n * If true, truncates overflowing text with an ellipsis when it's unable to wrap\n */\n truncate?: boolean;\n }\n\n const props = withDefaults(defineProps<IconLabelProps>(), {\n color: undefined,\n href: undefined,\n to: undefined,\n stacked: false,\n truncate: false,\n });\n\n defineOptions({\n name: 'll-icon-label',\n });\n\n const is = computed(() => {\n if (props.to) {\n return 'router-link';\n }\n\n if (props.href) {\n return 'a';\n }\n\n return 'div';\n });\n\n const attributes = computed(() => {\n if (props.to) {\n return {\n to: props.to,\n };\n }\n\n if (props.href) {\n return {\n href: props.href,\n };\n }\n\n return {};\n });\n</script>\n\n<template>\n <component :is=\"is\" v-bind=\"attributes\" class=\"tw-flex\" :class=\"{ 'tw-flex-column tw-items-center': props.stacked }\">\n <Icon :name=\"props.icon\" size=\"dense\" :class=\"[$style.icon, { [`text-${color}`]: !!color }]\" />\n\n <div\n :class=\"{\n 'tw-ml-1.5 tw-flex-1': !props.stacked,\n 'text-xs tw-mt-1.5 tw-leading-3': props.stacked,\n 'tw-truncate': truncate,\n }\"\n >\n <!-- @slot Label text -->\n <slot></slot>\n </div>\n </component>\n</template>\n\n<style module>\n .icon {\n margin-top: -1px;\n }\n</style>\n"],"names":["is","computed","props","attributes"],"mappings":";;;;;;;;;;;;;;;;;;iBAmDQA,IAAKC,EAAS,MACdC,EAAM,KACD,gBAGLA,EAAM,OACD,MAGF,KACR,GAEKC,IAAaF,EAAS,MACtBC,EAAM,KACD;AAAA,MACL,IAAIA,EAAM;AAAA,IAAA,IAIVA,EAAM,OACD;AAAA,MACL,MAAMA,EAAM;AAAA,IAAA,IAIT,EACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/Image.js CHANGED
@@ -186,7 +186,7 @@ const ut = /* @__PURE__ */ x({
186
186
  key: h.value,
187
187
  "data-test": "stash-image",
188
188
  class: {
189
- rounded: t.radius === "rounded"
189
+ "tw-rounded": t.radius === "rounded"
190
190
  /* Rounded */
191
191
  },
192
192
  src: h.value