@volverjs/ui-vue 0.0.10-beta.23 → 0.0.10-beta.25

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 (90) hide show
  1. package/dist/components/VvAccordion/VvAccordion.es.js +119 -79
  2. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  3. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +18 -4
  4. package/dist/components/VvAccordion/index.d.ts +4 -8
  5. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +282 -124
  6. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  7. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +34 -7
  8. package/dist/components/VvAccordionGroup/index.d.ts +4 -1
  9. package/dist/components/VvAction/VvAction.vue.d.ts +1 -1
  10. package/dist/components/VvAlert/VvAlert.vue.d.ts +1 -1
  11. package/dist/components/VvButton/VvButton.es.js +92 -98
  12. package/dist/components/VvButton/VvButton.umd.js +1 -1
  13. package/dist/components/VvButton/VvButton.vue.d.ts +7 -7
  14. package/dist/components/VvButton/index.d.ts +11 -11
  15. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +7 -13
  16. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  17. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +3 -3
  18. package/dist/components/VvCheckbox/VvCheckbox.es.js +81 -87
  19. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  20. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +6 -6
  21. package/dist/components/VvCheckbox/index.d.ts +2 -2
  22. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +15 -29
  23. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  24. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +5 -5
  25. package/dist/components/VvCombobox/VvCombobox.es.js +13 -16
  26. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  27. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +11 -11
  28. package/dist/components/VvCombobox/index.d.ts +1 -1
  29. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +5 -5
  30. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +1 -1
  31. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +1 -1
  32. package/dist/components/VvDropdown/index.d.ts +1 -1
  33. package/dist/components/VvInputFile/VvInputFile.es.js +183 -168
  34. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  35. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +16 -9
  36. package/dist/components/VvInputFile/index.d.ts +12 -3
  37. package/dist/components/VvInputText/VvInputClearAction.d.ts +1 -1
  38. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  39. package/dist/components/VvInputText/VvInputText.vue.d.ts +6 -6
  40. package/dist/components/VvProgress/VvProgress.vue.d.ts +1 -1
  41. package/dist/components/VvRadio/VvRadio.es.js +64 -70
  42. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  43. package/dist/components/VvRadio/VvRadio.vue.d.ts +6 -6
  44. package/dist/components/VvRadio/index.d.ts +6 -6
  45. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +15 -29
  46. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  47. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +5 -5
  48. package/dist/components/VvSelect/VvSelect.vue.d.ts +8 -8
  49. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +5 -5
  50. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +3 -3
  51. package/dist/components/VvTooltip/index.d.ts +1 -1
  52. package/dist/components/index.es.js +494 -328
  53. package/dist/components/index.umd.js +1 -1
  54. package/dist/composables/alert/useInjectAlert.d.ts +1 -6
  55. package/dist/composables/group/useInjectedGroupState.d.ts +4 -5
  56. package/dist/composables/group/useProvideGroupState.d.ts +3 -3
  57. package/dist/constants.d.ts +6 -10
  58. package/dist/icons.es.js +3 -3
  59. package/dist/icons.umd.js +1 -1
  60. package/dist/index.es.js +3 -2
  61. package/dist/index.umd.js +1 -1
  62. package/dist/props/index.d.ts +1 -1
  63. package/dist/resolvers/unplugin.es.js +3 -2
  64. package/dist/resolvers/unplugin.umd.js +1 -1
  65. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +58 -15
  66. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +381 -107
  67. package/dist/types/group.d.ts +37 -15
  68. package/package.json +37 -36
  69. package/src/assets/icons/detailed.json +1 -1
  70. package/src/assets/icons/normal.json +1 -1
  71. package/src/assets/icons/simple.json +1 -1
  72. package/src/components/VvAccordion/VvAccordion.vue +119 -56
  73. package/src/components/VvAccordion/index.ts +8 -23
  74. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +164 -42
  75. package/src/components/VvAccordionGroup/index.ts +4 -1
  76. package/src/components/VvButton/index.ts +7 -12
  77. package/src/components/VvButtonGroup/VvButtonGroup.vue +1 -2
  78. package/src/components/VvCheckbox/index.ts +2 -2
  79. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +1 -2
  80. package/src/components/VvInputFile/VvInputFile.vue +71 -47
  81. package/src/components/VvInputFile/index.ts +5 -4
  82. package/src/components/VvRadio/index.ts +5 -5
  83. package/src/components/VvRadioGroup/VvRadioGroup.vue +1 -2
  84. package/src/composables/group/useInjectedGroupState.ts +20 -16
  85. package/src/composables/group/useProvideGroupState.ts +10 -15
  86. package/src/constants.ts +19 -14
  87. package/src/stories/AccordionGroup/AccordionGroup.settings.ts +2 -2
  88. package/src/stories/AccordionGroup/AccordionGroup.test.ts +16 -10
  89. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.ts +1 -1
  90. package/src/types/group.ts +22 -14
@@ -1,7 +1,8 @@
1
- import { inject, computed, unref, defineComponent, mergeDefaults, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, resolveDynamicComponent, withCtx, renderSlot, createTextVNode, toDisplayString, toRef, useAttrs, useSlots, createElementBlock, Fragment, isRef, h, onBeforeUnmount, normalizeClass, withModifiers, createElementVNode, normalizeProps, renderList, createVNode, guardReactiveProps, createSlots } from "vue";
1
+ import { inject, computed, unref, defineComponent, mergeDefaults, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, resolveDynamicComponent, withCtx, renderSlot, createTextVNode, toDisplayString, toRef, useAttrs, useSlots, createElementBlock, Fragment, isRef, h, onBeforeUnmount, normalizeClass, withModifiers, createElementVNode, normalizeProps, createVNode, guardReactiveProps, createSlots } from "vue";
2
2
  import { useVModel } from "@vueuse/core";
3
3
  import { iconExists, Icon, addIcon } from "@iconify/vue";
4
4
  import { uid } from "uid";
5
+ import Sortable from "vuedraggable";
5
6
  const ACTION_ICONS = {
6
7
  showPassword: "eye-on",
7
8
  hidePassword: "eye-off",
@@ -67,7 +68,9 @@ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
67
68
  return AnchorTarget2;
68
69
  })(AnchorTarget || {});
69
70
  const INJECTION_KEY_VOLVER = Symbol.for("volver");
70
- const INJECTION_KEY_BUTTON_GROUP = Symbol.for("buttonGroup");
71
+ const INJECTION_KEY_BUTTON_GROUP = Symbol.for(
72
+ "buttonGroup"
73
+ );
71
74
  const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for(
72
75
  "dropdownTrigger"
73
76
  );
@@ -638,100 +641,15 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
638
641
  };
639
642
  }
640
643
  });
641
- function equals(obj1, obj2, field) {
642
- if (field) {
643
- return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
644
- }
645
- return deepEquals(obj1, obj2);
646
- }
647
- function deepEquals(a, b) {
648
- if (a === b)
649
- return true;
650
- if (a && b && typeof a == "object" && typeof b == "object") {
651
- const arrA = Array.isArray(a);
652
- const arrB = Array.isArray(b);
653
- let i, length, key;
654
- if (arrA && arrB) {
655
- length = a.length;
656
- if (length != b.length)
657
- return false;
658
- for (i = length; i-- !== 0; )
659
- if (!deepEquals(a[i], b[i]))
660
- return false;
661
- return true;
662
- }
663
- if (arrA != arrB)
664
- return false;
665
- const dateA = a instanceof Date, dateB = b instanceof Date;
666
- if (dateA != dateB)
667
- return false;
668
- if (dateA && dateB)
669
- return a.getTime() == b.getTime();
670
- const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
671
- if (regexpA != regexpB)
672
- return false;
673
- if (regexpA && regexpB)
674
- return a.toString() == b.toString();
675
- const keys = Object.keys(a);
676
- length = keys.length;
677
- if (length !== Object.keys(b).length)
678
- return false;
679
- for (i = length; i-- !== 0; )
680
- if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
681
- return false;
682
- for (i = length; i-- !== 0; ) {
683
- key = keys[i];
684
- if (!deepEquals(a[key], b[key]))
685
- return false;
686
- }
687
- return true;
688
- }
689
- return a !== a && b !== b;
690
- }
691
- function resolveFieldData(data, field) {
692
- if (data && Object.keys(data).length && field) {
693
- if (field.indexOf(".") === -1) {
694
- return data[field];
695
- } else {
696
- const fields = field.split(".");
697
- let value = data;
698
- for (let i = 0, len = fields.length; i < len; ++i) {
699
- if (data == null) {
700
- return null;
701
- }
702
- value = value[fields[i]];
703
- }
704
- return value;
705
- }
706
- } else {
707
- return null;
708
- }
709
- }
710
- function contains(value, list) {
711
- if (value != null && list && list.length) {
712
- for (const val of list) {
713
- if (equals(value, val)) {
714
- return true;
715
- }
716
- }
717
- }
718
- return false;
719
- }
720
- function isEmpty(value) {
721
- return ((value2) => value2 === null || value2 === void 0 || value2 === "" || Array.isArray(value2) && value2.length === 0 || !(value2 instanceof Date) && typeof value2 === "object" && Object.keys(value2).length === 0)(unref(value));
722
- }
723
- function isString(value) {
724
- return typeof value === "string" || value instanceof String;
725
- }
726
644
  function useInjectedGroupState(groupKey) {
727
645
  const group = inject(groupKey, void 0);
728
- const isInGroup = computed(() => !isEmpty(group));
646
+ const isInGroup = computed(() => group !== void 0);
729
647
  function getGroupOrLocalRef(propName, props, emit) {
730
- if (group == null ? void 0 : group.value) {
731
- const groupPropValue = unref(group.value)[propName];
648
+ const groupPropValue = group == null ? void 0 : group[propName];
649
+ if (groupPropValue) {
732
650
  return computed({
733
651
  get() {
734
- return groupPropValue == null ? void 0 : groupPropValue.value;
652
+ return groupPropValue.value;
735
653
  },
736
654
  set(value) {
737
655
  groupPropValue.value = value;
@@ -744,8 +662,9 @@ function useInjectedGroupState(groupKey) {
744
662
  return propRef.value;
745
663
  },
746
664
  set(value) {
747
- if (emit)
665
+ if (emit) {
748
666
  emit(`update:${propName}`, value);
667
+ }
749
668
  }
750
669
  });
751
670
  }
@@ -809,14 +728,11 @@ function useGroupProps(props, emit) {
809
728
  const { id, iconPosition, icon, label, pressed } = toRefs(props);
810
729
  const modelValue = getGroupOrLocalRef("modelValue", props, emit);
811
730
  const toggle = getGroupOrLocalRef("toggle", props);
812
- const unselectable = getGroupOrLocalRef(
813
- "unselectable",
814
- props
815
- );
816
- const multiple = computed(() => (group == null ? void 0 : group.value.multiple.value) ?? false);
731
+ const unselectable = getGroupOrLocalRef("unselectable", props);
732
+ const multiple = computed(() => (group == null ? void 0 : group.multiple.value) ?? false);
817
733
  const modifiers = computed(() => {
818
734
  let localModifiers = props.modifiers;
819
- let groupModifiers = group == null ? void 0 : group.value.modifiers.value;
735
+ let groupModifiers = group == null ? void 0 : group.modifiers.value;
820
736
  const toReturn = /* @__PURE__ */ new Set();
821
737
  if (localModifiers) {
822
738
  if (!Array.isArray(localModifiers)) {
@@ -833,10 +749,7 @@ function useGroupProps(props, emit) {
833
749
  return Array.from(toReturn);
834
750
  });
835
751
  const disabled = computed(
836
- () => {
837
- var _a;
838
- return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
839
- }
752
+ () => Boolean(props.disabled || (group == null ? void 0 : group.disabled.value))
840
753
  );
841
754
  return {
842
755
  // group props
@@ -857,6 +770,88 @@ function useGroupProps(props, emit) {
857
770
  };
858
771
  }
859
772
  const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || uid()));
773
+ function equals(obj1, obj2, field) {
774
+ if (field) {
775
+ return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
776
+ }
777
+ return deepEquals(obj1, obj2);
778
+ }
779
+ function deepEquals(a, b) {
780
+ if (a === b)
781
+ return true;
782
+ if (a && b && typeof a == "object" && typeof b == "object") {
783
+ const arrA = Array.isArray(a);
784
+ const arrB = Array.isArray(b);
785
+ let i, length, key;
786
+ if (arrA && arrB) {
787
+ length = a.length;
788
+ if (length != b.length)
789
+ return false;
790
+ for (i = length; i-- !== 0; )
791
+ if (!deepEquals(a[i], b[i]))
792
+ return false;
793
+ return true;
794
+ }
795
+ if (arrA != arrB)
796
+ return false;
797
+ const dateA = a instanceof Date, dateB = b instanceof Date;
798
+ if (dateA != dateB)
799
+ return false;
800
+ if (dateA && dateB)
801
+ return a.getTime() == b.getTime();
802
+ const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
803
+ if (regexpA != regexpB)
804
+ return false;
805
+ if (regexpA && regexpB)
806
+ return a.toString() == b.toString();
807
+ const keys = Object.keys(a);
808
+ length = keys.length;
809
+ if (length !== Object.keys(b).length)
810
+ return false;
811
+ for (i = length; i-- !== 0; )
812
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
813
+ return false;
814
+ for (i = length; i-- !== 0; ) {
815
+ key = keys[i];
816
+ if (!deepEquals(a[key], b[key]))
817
+ return false;
818
+ }
819
+ return true;
820
+ }
821
+ return a !== a && b !== b;
822
+ }
823
+ function resolveFieldData(data, field) {
824
+ if (data && Object.keys(data).length && field) {
825
+ if (field.indexOf(".") === -1) {
826
+ return data[field];
827
+ } else {
828
+ const fields = field.split(".");
829
+ let value = data;
830
+ for (let i = 0, len = fields.length; i < len; ++i) {
831
+ if (data == null) {
832
+ return null;
833
+ }
834
+ value = value[fields[i]];
835
+ }
836
+ return value;
837
+ }
838
+ } else {
839
+ return null;
840
+ }
841
+ }
842
+ function contains(value, list) {
843
+ if (value != null && list && list.length) {
844
+ for (const val of list) {
845
+ if (equals(value, val)) {
846
+ return true;
847
+ }
848
+ }
849
+ }
850
+ return false;
851
+ }
852
+ function isString(value) {
853
+ return typeof value === "string" || value instanceof String;
854
+ }
860
855
  function useComponentIcon(icon, iconPosition) {
861
856
  const hasIcon = computed(() => {
862
857
  if (typeof (icon == null ? void 0 : icon.value) === "string") {
@@ -1179,8 +1174,7 @@ const VvInputFileProps = {
1179
1174
  * Input value
1180
1175
  */
1181
1176
  modelValue: {
1182
- type: Object,
1183
- required: true
1177
+ type: Object
1184
1178
  },
1185
1179
  /**
1186
1180
  * Whether to show progress bar
@@ -1224,6 +1218,10 @@ const VvInputFileProps = {
1224
1218
  * Show drop area
1225
1219
  */
1226
1220
  dropArea: { type: Boolean, default: false },
1221
+ /**
1222
+ * Enable sorting
1223
+ */
1224
+ sortable: { type: Boolean, default: false },
1227
1225
  /**
1228
1226
  * Label for add button
1229
1227
  */
@@ -1336,12 +1334,11 @@ const _hoisted_3 = ["src", "alt"];
1336
1334
  const _hoisted_4 = { class: "vv-input-file__wrapper" };
1337
1335
  const _hoisted_5 = ["id", "readonly", "placeholder", "aria-describedby", "aria-invalid", "aria-errormessage", "multiple", "accept", "capture", "name"];
1338
1336
  const _hoisted_6 = ["value"];
1339
- const _hoisted_7 = { class: "vv-input-file__list" };
1340
- const _hoisted_8 = ["onClick"];
1341
- const _hoisted_9 = ["title", "onClick"];
1342
- const _hoisted_10 = { class: "vv-input-file__item-name" };
1343
- const _hoisted_11 = { class: "vv-input-file__item-info" };
1344
- const _hoisted_12 = ["title", "onClick"];
1337
+ const _hoisted_7 = ["onClick"];
1338
+ const _hoisted_8 = ["title", "onClick"];
1339
+ const _hoisted_9 = { class: "vv-input-file__item-name" };
1340
+ const _hoisted_10 = { class: "vv-input-file__item-info" };
1341
+ const _hoisted_11 = ["title", "onClick"];
1345
1342
  const __default__ = {
1346
1343
  name: "VvInputFile"
1347
1344
  };
@@ -1390,12 +1387,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1390
1387
  hintSlotScope
1391
1388
  } = HintSlotFactory(propsDefaults, slots);
1392
1389
  const localModelValue = useVModel(props, "modelValue", emit);
1393
- const files = computed(() => {
1394
- var _a;
1395
- if (!localModelValue.value || !Array.isArray(localModelValue.value) && !((_a = localModelValue.value) == null ? void 0 : _a.name)) {
1396
- return [];
1390
+ const files = computed({
1391
+ get: () => {
1392
+ var _a;
1393
+ if (!localModelValue.value || !Array.isArray(localModelValue.value) && !((_a = localModelValue.value) == null ? void 0 : _a.name)) {
1394
+ return [];
1395
+ }
1396
+ return Array.isArray(localModelValue.value) ? localModelValue.value : [localModelValue.value];
1397
+ },
1398
+ set: (value) => {
1399
+ if (isMultiple.value) {
1400
+ localModelValue.value = value;
1401
+ return;
1402
+ }
1403
+ localModelValue.value = value == null ? void 0 : value[0];
1397
1404
  }
1398
- return Array.isArray(localModelValue.value) ? localModelValue.value : [localModelValue.value];
1399
1405
  });
1400
1406
  const hasMax = computed(() => {
1401
1407
  return typeof props.max === "string" ? parseInt(props.max) : props.max;
@@ -1549,6 +1555,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1549
1555
  }
1550
1556
  return props.iconReplace;
1551
1557
  });
1558
+ const onSortEnd = ({ newIndex }) => {
1559
+ if (newIndex !== null) {
1560
+ selectedFileIndex.value = newIndex;
1561
+ }
1562
+ };
1552
1563
  return (_ctx, _cache) => {
1553
1564
  return openBlock(), createElementBlock(
1554
1565
  "div",
@@ -1635,60 +1646,64 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1635
1646
  /* FULL_PROPS */
1636
1647
  )) : createCommentVNode("v-if", true)
1637
1648
  ]),
1638
- createElementVNode("ul", _hoisted_7, [
1639
- (openBlock(true), createElementBlock(
1640
- Fragment,
1641
- null,
1642
- renderList(files.value, (file, index) => {
1643
- return openBlock(), createElementBlock("li", {
1644
- key: index,
1645
- class: normalizeClass(["vv-input-file__item", {
1646
- active: index === selectedFileIndex.value && hasDropArea.value && files.value.length > 1
1647
- }]),
1648
- onClick: withModifiers(($event) => onClickSelectFile(index), ["stop"])
1649
+ createVNode(unref(Sortable), {
1650
+ modelValue: files.value,
1651
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => files.value = $event),
1652
+ tag: "ul",
1653
+ class: "vv-input-file__list",
1654
+ "item-key": "name",
1655
+ move: () => _ctx.sortable,
1656
+ onEnd: onSortEnd
1657
+ }, {
1658
+ item: withCtx(({ element: file, index }) => [
1659
+ createElementVNode("li", {
1660
+ class: normalizeClass(["vv-input-file__item", {
1661
+ active: index === selectedFileIndex.value && hasDropArea.value && files.value.length > 1,
1662
+ "cursor-move": _ctx.sortable
1663
+ }]),
1664
+ onClick: withModifiers(($event) => onClickSelectFile(index), ["stop"])
1665
+ }, [
1666
+ unref(hasIconDownload) ? (openBlock(), createElementBlock("button", {
1667
+ key: 0,
1668
+ type: "button",
1669
+ class: "vv-input-file__item-action",
1670
+ title: _ctx.labelDownload,
1671
+ onClick: withModifiers(($event) => onClickDownloadFile(file), ["stop"])
1649
1672
  }, [
1650
- unref(hasIconDownload) ? (openBlock(), createElementBlock("button", {
1651
- key: 0,
1652
- type: "button",
1653
- class: "vv-input-file__item-action",
1654
- title: _ctx.labelDownload,
1655
- onClick: withModifiers(($event) => onClickDownloadFile(file), ["stop"])
1656
- }, [
1657
- createVNode(
1658
- _sfc_main$3,
1659
- normalizeProps(guardReactiveProps(unref(hasIconDownload))),
1660
- null,
1661
- 16
1662
- /* FULL_PROPS */
1663
- )
1664
- ], 8, _hoisted_9)) : createCommentVNode("v-if", true),
1665
- createElementVNode(
1666
- "div",
1667
- _hoisted_10,
1668
- toDisplayString(file.name),
1669
- 1
1670
- /* TEXT */
1671
- ),
1672
- createElementVNode(
1673
- "small",
1674
- _hoisted_11,
1675
- toDisplayString(sizeInKiB(file.size)) + " KB ",
1676
- 1
1677
- /* TEXT */
1678
- ),
1679
- !unref(readonly) ? (openBlock(), createElementBlock("button", {
1680
- key: 1,
1681
- type: "button",
1682
- class: "vv-input-file__item-remove",
1683
- title: _ctx.labelRemove,
1684
- onClick: withModifiers(($event) => onClickRemoveFile(index), ["stop"])
1685
- }, null, 8, _hoisted_12)) : createCommentVNode("v-if", true)
1686
- ], 10, _hoisted_8);
1687
- }),
1688
- 128
1689
- /* KEYED_FRAGMENT */
1690
- ))
1691
- ]),
1673
+ createVNode(
1674
+ _sfc_main$3,
1675
+ normalizeProps(guardReactiveProps(unref(hasIconDownload))),
1676
+ null,
1677
+ 16
1678
+ /* FULL_PROPS */
1679
+ )
1680
+ ], 8, _hoisted_8)) : createCommentVNode("v-if", true),
1681
+ createElementVNode(
1682
+ "div",
1683
+ _hoisted_9,
1684
+ toDisplayString(file.name),
1685
+ 1
1686
+ /* TEXT */
1687
+ ),
1688
+ createElementVNode(
1689
+ "small",
1690
+ _hoisted_10,
1691
+ toDisplayString(sizeInKiB(file.size)) + " KB ",
1692
+ 1
1693
+ /* TEXT */
1694
+ ),
1695
+ !unref(readonly) ? (openBlock(), createElementBlock("button", {
1696
+ key: 1,
1697
+ type: "button",
1698
+ class: "vv-input-file__item-remove",
1699
+ title: _ctx.labelRemove,
1700
+ onClick: withModifiers(($event) => onClickRemoveFile(index), ["stop"])
1701
+ }, null, 8, _hoisted_11)) : createCommentVNode("v-if", true)
1702
+ ], 10, _hoisted_7)
1703
+ ]),
1704
+ _: 1
1705
+ /* STABLE */
1706
+ }, 8, ["modelValue", "move"]),
1692
1707
  createVNode(unref(HintSlot), {
1693
1708
  id: hasHintId.value,
1694
1709
  class: "vv-input-file__hint"
@@ -1 +1 @@
1
- !function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("@vueuse/core"),require("@iconify/vue"),require("uid")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","@iconify/vue","uid"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputFile=l(e.vue,e.core,e.vue$1,e.uid)}(this,(function(e,l,t,o){"use strict";const a="add",n="edit",r="download",i={prefix:"normal"};var u=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(u||{}),d=(e=>(e.before="before",e.after="after",e))(d||{}),s=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(s||{}),c=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(c||{}),v=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(v||{});const p=Symbol.for("volver"),f=Symbol.for("buttonGroup"),m=Symbol.for("dropdownTrigger"),g=Symbol.for("dropdownAction");function y(){return e.inject(p)}function b(l,t,o){return e.computed((()=>{const a={[l]:!0},n="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${l}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((t=>{a[`${l}--${t}`]=e.unref(o.value[t])})),a}))}const h=e.defineComponent({name:"VvIcon",props:e.mergeDefaults({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},i),setup(l){const o=l,a=e.computed((()=>"string"==typeof o.rotate?parseFloat(o.rotate):o.rotate)),n=e.ref(!0),r=y(),{modifiers:i}=e.toRefs(o),u=b("vv-icon",i),d=e.computed((()=>o.provider||(null==r?void 0:r.iconsProvider))),s=e.computed((()=>{const e=o.name??"",l=`@${d.value}:${o.prefix}:${e}`;if(t.iconExists(l))return l;const a=null==r?void 0:r.iconsCollections.find((l=>{const o=`@${d.value}:${l.prefix}:${e}`;return t.iconExists(o)}));return a?`@${d.value}:${a.prefix}:${e}`:e}));function c(e){const l=function(e){let l;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");l=(new e).window}return(l?new l.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=(null==l?void 0:l.innerHTML.trim())||"";l&&a&&t.addIcon(`@${d.value}:${o.prefix}:${o.name}`,{body:a,height:l.viewBox.baseVal.height,width:l.viewBox.baseVal.width})}return r&&o.src&&!t.iconExists(`@${d.value}:${o.prefix}:${o.name}`)&&(n.value=!1,r.fetchIcon(o.src).then((e=>{e&&(c(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&c(o.svg),(l,o)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(t.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:l.inline,width:l.width,height:l.height,horizontalFlip:l.horizontalFlip,verticalFlip:l.verticalFlip,flip:l.flip,rotate:e.unref(a),color:l.color,onLoad:l.onLoad,icon:e.unref(s)}),null,16,["class"])):e.createCommentVNode("v-if",!0)}}),k={to:{type:[String,Object]},href:String,target:{type:String,default:void 0,validator:e=>Object.values(v).includes(e)},rel:{type:String,default:"noopener noreferrer"}},S={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},B={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},L={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},V={disabled:{type:Boolean,default:!1}},w={active:{type:Boolean,default:!1}},A={current:{type:Boolean,default:!1}},$={pressed:{type:Boolean,default:!1}},O={label:{type:[String,Number],default:void 0}},_={readonly:{type:Boolean,default:!1}},C={modifiers:{type:[String,Array],default:void 0}},x={hintLabel:{type:String,default:""}},j={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:d.before,validation:e=>Object.values(d).includes(e)}},N={unselectable:{type:Boolean,default:!0}},R={id:[String,Number]};u.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const P={...R,name:{type:String,required:!0}},E={...V,...O,...$,...w,...A,...k,type:{type:String,default:s.button,validator:e=>Object.values(s).includes(e)},ariaLabel:{type:String,default:void 0},defaultTag:{type:String,default:c.button}},I=E;const D=e.defineComponent({name:"VvAction",props:I,emits:["click","mouseover","mouseleave"],setup(l,{expose:t,emit:o}){const a=l,n=o,r=y(),i=e.ref(null);t({$el:i});const{reference:u,bus:d,aria:s,expanded:v}=e.inject(m,{});e.watch((()=>i.value),(e=>{u&&(u.value=e)}));const p=e.computed((()=>a.pressed||(null==v?void 0:v.value))),{role:f}=e.inject(g,{}),b=e.computed((()=>{switch(!0){case a.disabled:return c.button;case void 0!==a.to:return(null==r?void 0:r.nuxt)?c.nuxtLink:c.routerLink;case void 0!==a.href:return c.a;default:return a.defaultTag}})),h=e.computed((()=>{const e={...null==s?void 0:s.value,ariaPressed:!!p.value||void 0,ariaLabel:a.ariaLabel,role:null==f?void 0:f.value};switch(b.value){case c.a:return{...e,href:a.href,target:a.target,rel:a.rel};case c.routerLink:case c.nuxtLink:return{...e,to:a.to,target:a.target};case c.button:return{...e,type:a.type,disabled:a.disabled};default:return e}})),k=e=>{a.disabled?e.preventDefault():(null==d||d.emit("click",e),n("click",e))},S=e=>{null==d||d.emit("mouseover",e),n("mouseover",e)},B=e=>{null==d||d.emit("mouseleave",e),n("mouseleave",e)};return(l,t)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(b)),e.mergeProps(e.unref(h),{ref_key:"element",ref:i,class:{active:l.active,pressed:e.unref(p),disabled:l.disabled,current:l.current},onClickPassive:k,onMouseoverPassive:S,onMouseleavePassive:B}),{default:e.withCtx((()=>[e.renderSlot(l.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]))])),_:3},16,["class"]))}});function M(e,l,t){return t?z(e,t)===z(l,t):F(e,l)}function F(e,l){if(e===l)return!0;if(e&&l&&"object"==typeof e&&"object"==typeof l){const t=Array.isArray(e),o=Array.isArray(l);let a,n,r;if(t&&o){if(n=e.length,n!=l.length)return!1;for(a=n;0!=a--;)if(!F(e[a],l[a]))return!1;return!0}if(t!=o)return!1;const i=e instanceof Date,u=l instanceof Date;if(i!=u)return!1;if(i&&u)return e.getTime()==l.getTime();const d=e instanceof RegExp,s=l instanceof RegExp;if(d!=s)return!1;if(d&&s)return e.toString()==l.toString();const c=Object.keys(e);if(n=c.length,n!==Object.keys(l).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(l,c[a]))return!1;for(a=n;0!=a--;)if(r=c[a],!F(e[r],l[r]))return!1;return!0}return e!=e&&l!=l}function z(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const t=l.split(".");let o=e;for(let l=0,a=t.length;l<a;++l){if(null==e)return null;o=o[t[l]]}return o}}return null}function T(e,l){if(null!=e&&l&&l.length)for(const t of l)if(M(e,t))return!0;return!1}function U(l){const t=e.inject(l,void 0),o=e.computed((()=>{return l=t,!(null==(o=e.unref(l))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length);var l,o}));return{group:t,isInGroup:o,getGroupOrLocalRef:function(l,o,a){if(null==t?void 0:t.value){const o=e.unref(t.value)[l];return e.computed({get:()=>null==o?void 0:o.value,set(e){o.value=e}})}const n=e.toRef(o,l);return e.computed({get:()=>n.value,set(e){a&&a(`update:${l}`,e)}})}}}const q={...E,...R,...C,...N,...L,...j,iconPosition:{type:String,default:u.left,validator:e=>Object.values(u).includes(e)},loadingIcon:{type:String,default:"eos-icons:bubble-loading"},toggle:{type:Boolean,default:!1},value:{type:[String,Number,Boolean],default:void 0},uncheckedValue:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[String,Number,Boolean],default:void 0}};const H=l=>e.computed((()=>String((null==l?void 0:l.value)||o.uid())));function G(l,t){const o=e.computed((()=>"string"==typeof(null==l?void 0:l.value)?{name:null==l?void 0:l.value}:null==l?void 0:l.value)),a=e.computed((()=>(null==t?void 0:t.value)===d.before?o.value:void 0)),n=e.computed((()=>(null==t?void 0:t.value)===d.after?o.value:void 0)),r=e.computed((()=>(null==t?void 0:t.value)===u.left?o.value:void 0)),i=e.computed((()=>(null==t?void 0:t.value)===u.right?o.value:void 0)),s=e.computed((()=>(null==t?void 0:t.value)===u.top?o.value:void 0)),c=e.computed((()=>(null==t?void 0:t.value)===u.bottom?o.value:void 0));return{hasIcon:o,hasIconLeft:r,hasIconRight:i,hasIconTop:s,hasIconBottom:c,hasIconBefore:a,hasIconAfter:n}}const J={key:1,class:"vv-button__label"},K={key:1,class:"vv-button__label"},Q=e.defineComponent({name:"VvButton",props:q,emits:["update:modelValue"],setup(l,{expose:t,emit:o}){const a=l,n=e.useAttrs(),r=e.useSlots(),i=o,{id:d,modifiers:s,iconPosition:c,icon:v,label:p,modelValue:m,disabled:g,toggle:y,unselectable:k}=function(l,t){const{group:o,isInGroup:a,getGroupOrLocalRef:n}=U(f),{id:r,iconPosition:i,icon:u,label:d,pressed:s}=e.toRefs(l),c=n("modelValue",l,t),v=n("toggle",l),p=n("unselectable",l),m=e.computed((()=>(null==o?void 0:o.value.multiple.value)??!1)),g=e.computed((()=>{let e=l.modifiers,t=null==o?void 0:o.value.modifiers.value;const a=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach((e=>a.add(e)))),t&&(Array.isArray(t)||(t=t.split(" ")),t.forEach((e=>a.add(e)))),Array.from(a)})),y=e.computed((()=>{var e;return Boolean(l.disabled||(null==(e=null==o?void 0:o.value)?void 0:e.disabled.value))}));return{group:o,isInGroup:a,modelValue:c,toggle:v,unselectable:p,multiple:m,modifiers:g,disabled:y,id:r,pressed:s,iconPosition:i,icon:u,label:d}}(a,i),S=H(d),B=e.computed((()=>(null==n?void 0:n.name)||S.value)),L=e.ref(null);t({$el:e.computed((()=>{var e;return null==(e=L.value)?void 0:e.$el}))});const V=e.computed((()=>y.value?Array.isArray(m.value)?T(B.value,m.value):M(B.value,m.value):a.pressed)),w=b("vv-button",s,e.computed((()=>({reverse:[u.right,u.bottom].includes(c.value),column:[u.top,u.bottom].includes(c.value),"icon-only":Boolean((null==v?void 0:v.value)&&!(null==p?void 0:p.value)&&!r.default)})))),{hasIcon:A}=G(v),$=e.computed((()=>void 0!==a.value?a.value:B.value)),O=()=>{if(y.value){if(Array.isArray(m.value))return T($.value,m.value)?void(k.value&&(m.value=m.value.filter((e=>e!==$.value)))):void m.value.push($.value);if($.value===m.value&&k.value)return void(m.value=a.uncheckedValue);m.value=$.value}};return(l,t)=>(e.openBlock(),e.createBlock(D,e.mergeProps({disabled:e.unref(g),pressed:e.unref(V),active:l.active,type:l.type,to:l.to,href:l.href,target:l.target,rel:l.rel,ariaLabel:l.ariaLabel},{id:e.unref(S),ref_key:"element",ref:L,class:e.unref(w),onClick:O}),{default:e.withCtx((()=>[e.renderSlot(l.$slots,"default",{},(()=>[l.loading?e.renderSlot(l.$slots,"loading",{key:0},(()=>[l.loadingIcon?(e.openBlock(),e.createBlock(h,{key:0,class:"vv-button__loading-icon",name:l.loadingIcon},null,8,["name"])):e.createCommentVNode("v-if",!0),l.loadingLabel?(e.openBlock(),e.createElementBlock("span",J,e.toDisplayString(l.loadingLabel),1)):e.createCommentVNode("v-if",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(l.$slots,"before"),e.unref(A)?(e.openBlock(),e.createBlock(h,e.mergeProps({key:0},e.unref(A),{class:"vv-button__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.unref(p)?(e.openBlock(),e.createElementBlock("span",K,[e.renderSlot(l.$slots,"label",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(p)),1)]))])):e.createCommentVNode("v-if",!0),e.renderSlot(l.$slots,"after")],64))]))])),_:3},16,["id","class"]))}});function W(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}const X={...P,...C,...S,...B,...x,...O,...L,..._,...j,modelValue:{type:Object,required:!0},progress:{type:[Number,String],default:void 0},placeholder:{type:String,default:void 0},accept:{type:String,default:"*"},multiple:{type:Boolean,default:!1},capture:{type:String,default:void 0,validation:e=>void 0===e||["user","environment"].includes(e)},max:{type:[Number,String],default:void 0},dropArea:{type:Boolean,default:!1},labelAdd:{type:String,default:"Add file"},iconAdd:{type:[String,Object],default:a},labelReplace:{type:String,default:"Replace file"},iconReplace:{type:[String,Object],default:n},labelDownload:{type:String,default:"Downlaod file"},iconDownload:{type:[String,Object],default:r},labelRemove:{type:String,default:"Remove file"}};const Y=["for"],Z={class:"vv-input-file__preview"},ee=["src","alt"],le={class:"vv-input-file__wrapper"},te=["id","readonly","placeholder","aria-describedby","aria-invalid","aria-errormessage","multiple","accept","capture","name"],oe=["value"],ae={class:"vv-input-file__list"},ne=["onClick"],re=["title","onClick"],ie={class:"vv-input-file__item-name"},ue={class:"vv-input-file__item-info"},de=["title","onClick"];return e.defineComponent({name:"VvInputFile",props:X,emits:["update:modelValue"],setup(t,{emit:o}){const a=t,n=o,r=e.useSlots(),i=function(l,t,o){const a=y(),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[l]))return a.defaults.value[l]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,l=t,a=o;return Object.keys(l).reduce(((t,o)=>{const n=a[o];if(t[o]=n,o in e){if(Array.isArray(l[o])){const a=l[o];a.length&&a[0]===n&&(t[o]=e[o])}if("function"==typeof l[o]&&(0,l[o])()===n&&(t[o]=e[o]),"object"==typeof l[o]){let a=l[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(t[o]=e[o]):a===n&&(t[o]=e[o])}}return t}),{})}))}("VvInputFile",X,a),{modifiers:u,id:d,readonly:s,icon:c,iconPosition:v,iconDownload:p}=e.toRefs(a),f=H(d),m=e.computed((()=>`${f.value}-hint`)),g=e.computed((()=>{if(!a.progress)return!1;const e="string"==typeof a.progress?parseInt(a.progress):a.progress;return e>0&&e<100})),{hasIconBefore:k,hasIconAfter:S}=G(c,v),{hasIcon:B}=G(p),L=b("vv-input-file",u,e.computed((()=>({dragging:N.value,loading:a.loading&&!g.value,valid:!0===a.valid,invalid:!0===a.invalid,"icon-before":!!k.value,"icon-after":!!S.value,"drop-area":x.value})))),{HintSlot:V,hasHintLabelOrSlot:w,hasInvalidLabelOrSlot:A,hintSlotScope:$}=function(l,t){const o=e.computed((()=>e.isRef(l)?l.value:l)),a=e.computed((()=>W(o.value.invalidLabel))),n=e.computed((()=>W(o.value.validLabel))),r=e.computed((()=>o.value.loadingLabel)),i=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(t.loading||r.value)))),d=e.computed((()=>!u.value&&Boolean(o.value.invalid&&(t.invalid||a.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(o.value.valid&&(t.valid||n.value)))),c=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(t.hint||i.value))),v=e.computed((()=>d.value||s.value||u.value||c.value)),p=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),f=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:v,invalidLabel:a,validLabel:n,loadingLabel:r,hintLabel:i,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:c}),render(){var l,t,o,a,n,r,i,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(t=(l=this.$slots).loading)?void 0:t.call(l))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(r=(n=this.$slots).valid)?void 0:r.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(i=this.$slots).hint)?void 0:u.call(i))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:c,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:f}}(i,r),O=l.useVModel(a,"modelValue",n),_=e.computed((()=>{var e;return O.value&&(Array.isArray(O.value)||(null==(e=O.value)?void 0:e.name))?Array.isArray(O.value)?O.value:[O.value]:[]})),C=e.computed((()=>"string"==typeof a.max?parseInt(a.max):a.max)),x=e.computed((()=>a.dropArea&&!s.value)),j=e.computed((()=>!!a.multiple&&(!C.value||C.value-_.value.length>1))),N=e.ref(!1),R=e.ref(),P=()=>{N.value=!0},E=()=>{N.value=!1},I=e=>{var l,t;(null==(l=e.dataTransfer)?void 0:l.files)&&(N.value=!1,M(null==(t=e.dataTransfer)?void 0:t.files))},D=()=>{var e;(null==(e=R.value)?void 0:e.files)&&(M(R.value.files),R.value.value="")},M=e=>{if(!a.multiple)return Array.isArray(O.value)?void(O.value=[...e]):void(O.value=e[0]);let l=[];l=!Array.isArray(O.value)&&O.value?[O.value]:O.value&&Array.isArray(O.value)?[...O.value]:l;for(const t of e){if(C.value&&l.length>=C.value)break;l.push(t)}O.value=l,z.value=l.length-1},F=()=>{R.value&&(s.value||R.value.click())},z=e.ref(0),T=["image/jpeg","image/png"],U=e.computed((()=>{if(0===_.value.length)return;if(!_.value[z.value])return;if(_.value[z.value]instanceof File){const e=_.value[z.value];if(!T.includes(e.type))return;return URL.createObjectURL(e)}const e=_.value[z.value];return e.thumbnailUrl?e.thumbnailUrl:T.includes(e.type)?e.url:void 0}));e.watch(U,((e,l)=>{l&&URL.revokeObjectURL(l)})),e.onBeforeUnmount((()=>{U.value&&URL.revokeObjectURL(U.value)}));const q=e=>{if(e)return Math.floor(e/1024)},J=e.computed((()=>0===_.value.length||j.value?a.labelAdd:a.labelReplace)),K=e.computed((()=>0===_.value.length||j.value?a.iconAdd:a.iconReplace));return(l,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(L))},[l.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(f)},e.toDisplayString(l.label),9,Y)):e.createCommentVNode("v-if",!0),x.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"vv-input-file__drop-area",onDragenter:e.withModifiers(P,["prevent","stop"]),onDragleave:e.withModifiers(E,["prevent","stop"]),onDrop:e.withModifiers(I,["prevent","stop"]),onDragover:t[0]||(t[0]=e.withModifiers((()=>{}),["prevent","stop"])),onClick:e.withModifiers(F,["stop"])},[e.renderSlot(l.$slots,"drop-area",{},(()=>[e.createElementVNode("picture",Z,[U.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:U.value,alt:_.value[z.value].name},null,8,ee)):e.createCommentVNode("v-if",!0)]),e.unref(s)?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(Q,{key:0,modifiers:"action",label:U.value?void 0:J.value,title:U.value?J.value:void 0,class:e.normalizeClass({"vv-input-file__drop-area-action":U.value}),icon:K.value,onClick:e.withModifiers(F,["stop"])},null,8,["label","title","class","icon"]))]))],32)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",le,[e.unref(k)?(e.openBlock(),e.createBlock(h,e.normalizeProps(e.mergeProps({key:0},e.unref(k))),null,16)):e.createCommentVNode("v-if",!0),e.createElementVNode("input",{id:e.unref(f),ref_key:"inputEl",ref:R,type:"file",readonly:e.unref(s),placeholder:l.placeholder,"aria-describedby":e.unref(w)?m.value:void 0,"aria-invalid":l.invalid,"aria-errormessage":e.unref(A)?m.value:void 0,multiple:j.value,accept:l.accept,capture:l.capture,name:l.name,onChange:D},null,40,te),g.value?(e.openBlock(),e.createElementBlock("progress",{key:1,class:"vv-input-file__progress",value:l.progress,max:"100"},e.toDisplayString(l.progress)+"% ",9,oe)):e.createCommentVNode("v-if",!0),e.unref(S)?(e.openBlock(),e.createBlock(h,e.normalizeProps(e.mergeProps({key:2},e.unref(S))),null,16)):e.createCommentVNode("v-if",!0)]),e.createElementVNode("ul",ae,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,((t,o)=>(e.openBlock(),e.createElementBlock("li",{key:o,class:e.normalizeClass(["vv-input-file__item",{active:o===z.value&&x.value&&_.value.length>1}]),onClick:e.withModifiers((e=>(e=>{z.value=e})(o)),["stop"])},[e.unref(B)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"vv-input-file__item-action",title:l.labelDownload,onClick:e.withModifiers((e=>(e=>{const l=document.createElement("a");e instanceof File?l.href=URL.createObjectURL(e):e.url&&(l.href=e.url),l.setAttribute("download",e.name),document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(l.href)})(t)),["stop"])},[e.createVNode(h,e.normalizeProps(e.guardReactiveProps(e.unref(B))),null,16)],8,re)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",ie,e.toDisplayString(t.name),1),e.createElementVNode("small",ue,e.toDisplayString(q(t.size))+" KB ",1),e.unref(s)?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"vv-input-file__item-remove",title:l.labelRemove,onClick:e.withModifiers((e=>(e=>{if(!Array.isArray(O.value))return void(O.value=void 0);z.value===e&&(z.value=0);const l=[...O.value];l.splice(e,1),O.value=l})(o)),["stop"])},null,8,de))],10,ne)))),128))]),e.createVNode(e.unref(V),{id:m.value,class:"vv-input-file__hint"},e.createSlots({_:2},[l.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref($))))])),key:"0"}:void 0,l.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref($))))])),key:"1"}:void 0,l.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref($))))])),key:"2"}:void 0,l.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref($))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
1
+ !function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("@vueuse/core"),require("@iconify/vue"),require("uid"),require("vuedraggable")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","@iconify/vue","uid","vuedraggable"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputFile=l(e.vue,e.core,e.vue$1,e.uid,e.Sortable)}(this,(function(e,l,t,o,a){"use strict";const n="add",r="edit",i="download",u={prefix:"normal"};var d=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(d||{}),s=(e=>(e.before="before",e.after="after",e))(s||{}),v=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(v||{}),c=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(c||{}),p=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(p||{});const f=Symbol.for("volver"),m=Symbol.for("buttonGroup"),g=Symbol.for("dropdownTrigger"),b=Symbol.for("dropdownAction");function y(){return e.inject(f)}function h(l,t,o){return e.computed((()=>{const a={[l]:!0},n="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${l}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((t=>{a[`${l}--${t}`]=e.unref(o.value[t])})),a}))}const k=e.defineComponent({name:"VvIcon",props:e.mergeDefaults({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},u),setup(l){const o=l,a=e.computed((()=>"string"==typeof o.rotate?parseFloat(o.rotate):o.rotate)),n=e.ref(!0),r=y(),{modifiers:i}=e.toRefs(o),u=h("vv-icon",i),d=e.computed((()=>o.provider||(null==r?void 0:r.iconsProvider))),s=e.computed((()=>{const e=o.name??"",l=`@${d.value}:${o.prefix}:${e}`;if(t.iconExists(l))return l;const a=null==r?void 0:r.iconsCollections.find((l=>{const o=`@${d.value}:${l.prefix}:${e}`;return t.iconExists(o)}));return a?`@${d.value}:${a.prefix}:${e}`:e}));function v(e){const l=function(e){let l;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");l=(new e).window}return(l?new l.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=(null==l?void 0:l.innerHTML.trim())||"";l&&a&&t.addIcon(`@${d.value}:${o.prefix}:${o.name}`,{body:a,height:l.viewBox.baseVal.height,width:l.viewBox.baseVal.width})}return r&&o.src&&!t.iconExists(`@${d.value}:${o.prefix}:${o.name}`)&&(n.value=!1,r.fetchIcon(o.src).then((e=>{e&&(v(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&v(o.svg),(l,o)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(t.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:l.inline,width:l.width,height:l.height,horizontalFlip:l.horizontalFlip,verticalFlip:l.verticalFlip,flip:l.flip,rotate:e.unref(a),color:l.color,onLoad:l.onLoad,icon:e.unref(s)}),null,16,["class"])):e.createCommentVNode("v-if",!0)}}),S={to:{type:[String,Object]},href:String,target:{type:String,default:void 0,validator:e=>Object.values(p).includes(e)},rel:{type:String,default:"noopener noreferrer"}},B={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},L={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},V={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},w={disabled:{type:Boolean,default:!1}},A={active:{type:Boolean,default:!1}},$={current:{type:Boolean,default:!1}},_={pressed:{type:Boolean,default:!1}},O={label:{type:[String,Number],default:void 0}},C={readonly:{type:Boolean,default:!1}},x={modifiers:{type:[String,Array],default:void 0}},N={hintLabel:{type:String,default:""}},j={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:s.before,validation:e=>Object.values(s).includes(e)}},R={unselectable:{type:Boolean,default:!0}},I={id:[String,Number]};d.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const P={...I,name:{type:String,required:!0}},E={...w,...O,..._,...A,...$,...S,type:{type:String,default:v.button,validator:e=>Object.values(v).includes(e)},ariaLabel:{type:String,default:void 0},defaultTag:{type:String,default:c.button}},D=E;const M=e.defineComponent({name:"VvAction",props:D,emits:["click","mouseover","mouseleave"],setup(l,{expose:t,emit:o}){const a=l,n=o,r=y(),i=e.ref(null);t({$el:i});const{reference:u,bus:d,aria:s,expanded:v}=e.inject(g,{});e.watch((()=>i.value),(e=>{u&&(u.value=e)}));const p=e.computed((()=>a.pressed||(null==v?void 0:v.value))),{role:f}=e.inject(b,{}),m=e.computed((()=>{switch(!0){case a.disabled:return c.button;case void 0!==a.to:return(null==r?void 0:r.nuxt)?c.nuxtLink:c.routerLink;case void 0!==a.href:return c.a;default:return a.defaultTag}})),h=e.computed((()=>{const e={...null==s?void 0:s.value,ariaPressed:!!p.value||void 0,ariaLabel:a.ariaLabel,role:null==f?void 0:f.value};switch(m.value){case c.a:return{...e,href:a.href,target:a.target,rel:a.rel};case c.routerLink:case c.nuxtLink:return{...e,to:a.to,target:a.target};case c.button:return{...e,type:a.type,disabled:a.disabled};default:return e}})),k=e=>{a.disabled?e.preventDefault():(null==d||d.emit("click",e),n("click",e))},S=e=>{null==d||d.emit("mouseover",e),n("mouseover",e)},B=e=>{null==d||d.emit("mouseleave",e),n("mouseleave",e)};return(l,t)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(m)),e.mergeProps(e.unref(h),{ref_key:"element",ref:i,class:{active:l.active,pressed:e.unref(p),disabled:l.disabled,current:l.current},onClickPassive:k,onMouseoverPassive:S,onMouseleavePassive:B}),{default:e.withCtx((()=>[e.renderSlot(l.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]))])),_:3},16,["class"]))}});const F={...E,...I,...x,...R,...V,...j,iconPosition:{type:String,default:d.left,validator:e=>Object.values(d).includes(e)},loadingIcon:{type:String,default:"eos-icons:bubble-loading"},toggle:{type:Boolean,default:!1},value:{type:[String,Number,Boolean],default:void 0},uncheckedValue:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[String,Number,Boolean],default:void 0}};function z(l,t){const{group:o,isInGroup:a,getGroupOrLocalRef:n}=function(l){const t=e.inject(l,void 0),o=e.computed((()=>void 0!==t));return{group:t,isInGroup:o,getGroupOrLocalRef:function(l,o,a){const n=null==t?void 0:t[l];if(n)return e.computed({get:()=>n.value,set(e){n.value=e}});const r=e.toRef(o,l);return e.computed({get:()=>r.value,set(e){a&&a(`update:${l}`,e)}})}}}(m),{id:r,iconPosition:i,icon:u,label:d,pressed:s}=e.toRefs(l),v=n("modelValue",l,t),c=n("toggle",l),p=n("unselectable",l),f=e.computed((()=>(null==o?void 0:o.multiple.value)??!1)),g=e.computed((()=>{let e=l.modifiers,t=null==o?void 0:o.modifiers.value;const a=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach((e=>a.add(e)))),t&&(Array.isArray(t)||(t=t.split(" ")),t.forEach((e=>a.add(e)))),Array.from(a)})),b=e.computed((()=>Boolean(l.disabled||(null==o?void 0:o.disabled.value))));return{group:o,isInGroup:a,modelValue:v,toggle:c,unselectable:p,multiple:f,modifiers:g,disabled:b,id:r,pressed:s,iconPosition:i,icon:u,label:d}}const U=l=>e.computed((()=>String((null==l?void 0:l.value)||o.uid())));function T(e,l,t){return t?H(e,t)===H(l,t):q(e,l)}function q(e,l){if(e===l)return!0;if(e&&l&&"object"==typeof e&&"object"==typeof l){const t=Array.isArray(e),o=Array.isArray(l);let a,n,r;if(t&&o){if(n=e.length,n!=l.length)return!1;for(a=n;0!=a--;)if(!q(e[a],l[a]))return!1;return!0}if(t!=o)return!1;const i=e instanceof Date,u=l instanceof Date;if(i!=u)return!1;if(i&&u)return e.getTime()==l.getTime();const d=e instanceof RegExp,s=l instanceof RegExp;if(d!=s)return!1;if(d&&s)return e.toString()==l.toString();const v=Object.keys(e);if(n=v.length,n!==Object.keys(l).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(l,v[a]))return!1;for(a=n;0!=a--;)if(r=v[a],!q(e[r],l[r]))return!1;return!0}return e!=e&&l!=l}function H(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const t=l.split(".");let o=e;for(let l=0,a=t.length;l<a;++l){if(null==e)return null;o=o[t[l]]}return o}}return null}function G(e,l){if(null!=e&&l&&l.length)for(const t of l)if(T(e,t))return!0;return!1}function J(l,t){const o=e.computed((()=>"string"==typeof(null==l?void 0:l.value)?{name:null==l?void 0:l.value}:null==l?void 0:l.value)),a=e.computed((()=>(null==t?void 0:t.value)===s.before?o.value:void 0)),n=e.computed((()=>(null==t?void 0:t.value)===s.after?o.value:void 0)),r=e.computed((()=>(null==t?void 0:t.value)===d.left?o.value:void 0)),i=e.computed((()=>(null==t?void 0:t.value)===d.right?o.value:void 0)),u=e.computed((()=>(null==t?void 0:t.value)===d.top?o.value:void 0)),v=e.computed((()=>(null==t?void 0:t.value)===d.bottom?o.value:void 0));return{hasIcon:o,hasIconLeft:r,hasIconRight:i,hasIconTop:u,hasIconBottom:v,hasIconBefore:a,hasIconAfter:n}}const K={key:1,class:"vv-button__label"},Q={key:1,class:"vv-button__label"},W=e.defineComponent({name:"VvButton",props:F,emits:["update:modelValue"],setup(l,{expose:t,emit:o}){const a=l,n=e.useAttrs(),r=e.useSlots(),i=o,{id:u,modifiers:s,iconPosition:v,icon:c,label:p,modelValue:f,disabled:m,toggle:g,unselectable:b}=z(a,i),y=U(u),S=e.computed((()=>(null==n?void 0:n.name)||y.value)),B=e.ref(null);t({$el:e.computed((()=>{var e;return null==(e=B.value)?void 0:e.$el}))});const L=e.computed((()=>g.value?Array.isArray(f.value)?G(S.value,f.value):T(S.value,f.value):a.pressed)),V=h("vv-button",s,e.computed((()=>({reverse:[d.right,d.bottom].includes(v.value),column:[d.top,d.bottom].includes(v.value),"icon-only":Boolean((null==c?void 0:c.value)&&!(null==p?void 0:p.value)&&!r.default)})))),{hasIcon:w}=J(c),A=e.computed((()=>void 0!==a.value?a.value:S.value)),$=()=>{if(g.value){if(Array.isArray(f.value))return G(A.value,f.value)?void(b.value&&(f.value=f.value.filter((e=>e!==A.value)))):void f.value.push(A.value);if(A.value===f.value&&b.value)return void(f.value=a.uncheckedValue);f.value=A.value}};return(l,t)=>(e.openBlock(),e.createBlock(M,e.mergeProps({disabled:e.unref(m),pressed:e.unref(L),active:l.active,type:l.type,to:l.to,href:l.href,target:l.target,rel:l.rel,ariaLabel:l.ariaLabel},{id:e.unref(y),ref_key:"element",ref:B,class:e.unref(V),onClick:$}),{default:e.withCtx((()=>[e.renderSlot(l.$slots,"default",{},(()=>[l.loading?e.renderSlot(l.$slots,"loading",{key:0},(()=>[l.loadingIcon?(e.openBlock(),e.createBlock(k,{key:0,class:"vv-button__loading-icon",name:l.loadingIcon},null,8,["name"])):e.createCommentVNode("v-if",!0),l.loadingLabel?(e.openBlock(),e.createElementBlock("span",K,e.toDisplayString(l.loadingLabel),1)):e.createCommentVNode("v-if",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(l.$slots,"before"),e.unref(w)?(e.openBlock(),e.createBlock(k,e.mergeProps({key:0},e.unref(w),{class:"vv-button__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.unref(p)?(e.openBlock(),e.createElementBlock("span",Q,[e.renderSlot(l.$slots,"label",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(p)),1)]))])):e.createCommentVNode("v-if",!0),e.renderSlot(l.$slots,"after")],64))]))])),_:3},16,["id","class"]))}});function X(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}const Y={...P,...x,...B,...L,...N,...O,...V,...C,...j,modelValue:{type:Object},progress:{type:[Number,String],default:void 0},placeholder:{type:String,default:void 0},accept:{type:String,default:"*"},multiple:{type:Boolean,default:!1},capture:{type:String,default:void 0,validation:e=>void 0===e||["user","environment"].includes(e)},max:{type:[Number,String],default:void 0},dropArea:{type:Boolean,default:!1},sortable:{type:Boolean,default:!1},labelAdd:{type:String,default:"Add file"},iconAdd:{type:[String,Object],default:n},labelReplace:{type:String,default:"Replace file"},iconReplace:{type:[String,Object],default:r},labelDownload:{type:String,default:"Downlaod file"},iconDownload:{type:[String,Object],default:i},labelRemove:{type:String,default:"Remove file"}};const Z=["for"],ee={class:"vv-input-file__preview"},le=["src","alt"],te={class:"vv-input-file__wrapper"},oe=["id","readonly","placeholder","aria-describedby","aria-invalid","aria-errormessage","multiple","accept","capture","name"],ae=["value"],ne=["onClick"],re=["title","onClick"],ie={class:"vv-input-file__item-name"},ue={class:"vv-input-file__item-info"},de=["title","onClick"];return e.defineComponent({name:"VvInputFile",props:Y,emits:["update:modelValue"],setup(t,{emit:o}){const n=t,r=o,i=e.useSlots(),u=function(l,t,o){const a=y(),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[l]))return a.defaults.value[l]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,l=t,a=o;return Object.keys(l).reduce(((t,o)=>{const n=a[o];if(t[o]=n,o in e){if(Array.isArray(l[o])){const a=l[o];a.length&&a[0]===n&&(t[o]=e[o])}if("function"==typeof l[o]&&(0,l[o])()===n&&(t[o]=e[o]),"object"==typeof l[o]){let a=l[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(t[o]=e[o]):a===n&&(t[o]=e[o])}}return t}),{})}))}("VvInputFile",Y,n),{modifiers:d,id:s,readonly:v,icon:c,iconPosition:p,iconDownload:f}=e.toRefs(n),m=U(s),g=e.computed((()=>`${m.value}-hint`)),b=e.computed((()=>{if(!n.progress)return!1;const e="string"==typeof n.progress?parseInt(n.progress):n.progress;return e>0&&e<100})),{hasIconBefore:S,hasIconAfter:B}=J(c,p),{hasIcon:L}=J(f),V=h("vv-input-file",d,e.computed((()=>({dragging:R.value,loading:n.loading&&!b.value,valid:!0===n.valid,invalid:!0===n.invalid,"icon-before":!!S.value,"icon-after":!!B.value,"drop-area":N.value})))),{HintSlot:w,hasHintLabelOrSlot:A,hasInvalidLabelOrSlot:$,hintSlotScope:_}=function(l,t){const o=e.computed((()=>e.isRef(l)?l.value:l)),a=e.computed((()=>X(o.value.invalidLabel))),n=e.computed((()=>X(o.value.validLabel))),r=e.computed((()=>o.value.loadingLabel)),i=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(t.loading||r.value)))),d=e.computed((()=>!u.value&&Boolean(o.value.invalid&&(t.invalid||a.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(o.value.valid&&(t.valid||n.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(t.hint||i.value))),c=e.computed((()=>d.value||s.value||u.value||v.value)),p=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),f=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:a,validLabel:n,loadingLabel:r,hintLabel:i,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var l,t,o,a,n,r,i,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(t=(l=this.$slots).loading)?void 0:t.call(l))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(r=(n=this.$slots).valid)?void 0:r.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(i=this.$slots).hint)?void 0:u.call(i))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:f}}(u,i),O=l.useVModel(n,"modelValue",r),C=e.computed({get:()=>{var e;return O.value&&(Array.isArray(O.value)||(null==(e=O.value)?void 0:e.name))?Array.isArray(O.value)?O.value:[O.value]:[]},set:e=>{j.value?O.value=e:O.value=null==e?void 0:e[0]}}),x=e.computed((()=>"string"==typeof n.max?parseInt(n.max):n.max)),N=e.computed((()=>n.dropArea&&!v.value)),j=e.computed((()=>!!n.multiple&&(!x.value||x.value-C.value.length>1))),R=e.ref(!1),I=e.ref(),P=()=>{R.value=!0},E=()=>{R.value=!1},D=e=>{var l,t;(null==(l=e.dataTransfer)?void 0:l.files)&&(R.value=!1,F(null==(t=e.dataTransfer)?void 0:t.files))},M=()=>{var e;(null==(e=I.value)?void 0:e.files)&&(F(I.value.files),I.value.value="")},F=e=>{if(!n.multiple)return Array.isArray(O.value)?void(O.value=[...e]):void(O.value=e[0]);let l=[];l=!Array.isArray(O.value)&&O.value?[O.value]:O.value&&Array.isArray(O.value)?[...O.value]:l;for(const t of e){if(x.value&&l.length>=x.value)break;l.push(t)}O.value=l,T.value=l.length-1},z=()=>{I.value&&(v.value||I.value.click())},T=e.ref(0),q=["image/jpeg","image/png"],H=e.computed((()=>{if(0===C.value.length)return;if(!C.value[T.value])return;if(C.value[T.value]instanceof File){const e=C.value[T.value];if(!q.includes(e.type))return;return URL.createObjectURL(e)}const e=C.value[T.value];return e.thumbnailUrl?e.thumbnailUrl:q.includes(e.type)?e.url:void 0}));e.watch(H,((e,l)=>{l&&URL.revokeObjectURL(l)})),e.onBeforeUnmount((()=>{H.value&&URL.revokeObjectURL(H.value)}));const G=e=>{if(e)return Math.floor(e/1024)},K=e.computed((()=>0===C.value.length||j.value?n.labelAdd:n.labelReplace)),Q=e.computed((()=>0===C.value.length||j.value?n.iconAdd:n.iconReplace)),se=({newIndex:e})=>{null!==e&&(T.value=e)};return(l,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(V))},[l.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(m)},e.toDisplayString(l.label),9,Z)):e.createCommentVNode("v-if",!0),N.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"vv-input-file__drop-area",onDragenter:e.withModifiers(P,["prevent","stop"]),onDragleave:e.withModifiers(E,["prevent","stop"]),onDrop:e.withModifiers(D,["prevent","stop"]),onDragover:t[0]||(t[0]=e.withModifiers((()=>{}),["prevent","stop"])),onClick:e.withModifiers(z,["stop"])},[e.renderSlot(l.$slots,"drop-area",{},(()=>[e.createElementVNode("picture",ee,[H.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:H.value,alt:C.value[T.value].name},null,8,le)):e.createCommentVNode("v-if",!0)]),e.unref(v)?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(W,{key:0,modifiers:"action",label:H.value?void 0:K.value,title:H.value?K.value:void 0,class:e.normalizeClass({"vv-input-file__drop-area-action":H.value}),icon:Q.value,onClick:e.withModifiers(z,["stop"])},null,8,["label","title","class","icon"]))]))],32)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",te,[e.unref(S)?(e.openBlock(),e.createBlock(k,e.normalizeProps(e.mergeProps({key:0},e.unref(S))),null,16)):e.createCommentVNode("v-if",!0),e.createElementVNode("input",{id:e.unref(m),ref_key:"inputEl",ref:I,type:"file",readonly:e.unref(v),placeholder:l.placeholder,"aria-describedby":e.unref(A)?g.value:void 0,"aria-invalid":l.invalid,"aria-errormessage":e.unref($)?g.value:void 0,multiple:j.value,accept:l.accept,capture:l.capture,name:l.name,onChange:M},null,40,oe),b.value?(e.openBlock(),e.createElementBlock("progress",{key:1,class:"vv-input-file__progress",value:l.progress,max:"100"},e.toDisplayString(l.progress)+"% ",9,ae)):e.createCommentVNode("v-if",!0),e.unref(B)?(e.openBlock(),e.createBlock(k,e.normalizeProps(e.mergeProps({key:2},e.unref(B))),null,16)):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(a),{modelValue:C.value,"onUpdate:modelValue":t[1]||(t[1]=e=>C.value=e),tag:"ul",class:"vv-input-file__list","item-key":"name",move:()=>l.sortable,onEnd:se},{item:e.withCtx((({element:t,index:o})=>[e.createElementVNode("li",{class:e.normalizeClass(["vv-input-file__item",{active:o===T.value&&N.value&&C.value.length>1,"cursor-move":l.sortable}]),onClick:e.withModifiers((e=>(e=>{T.value=e})(o)),["stop"])},[e.unref(L)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"vv-input-file__item-action",title:l.labelDownload,onClick:e.withModifiers((e=>(e=>{const l=document.createElement("a");e instanceof File?l.href=URL.createObjectURL(e):e.url&&(l.href=e.url),l.setAttribute("download",e.name),document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(l.href)})(t)),["stop"])},[e.createVNode(k,e.normalizeProps(e.guardReactiveProps(e.unref(L))),null,16)],8,re)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",ie,e.toDisplayString(t.name),1),e.createElementVNode("small",ue,e.toDisplayString(G(t.size))+" KB ",1),e.unref(v)?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"vv-input-file__item-remove",title:l.labelRemove,onClick:e.withModifiers((e=>(e=>{if(!Array.isArray(O.value))return void(O.value=void 0);T.value===e&&(T.value=0);const l=[...O.value];l.splice(e,1),O.value=l})(o)),["stop"])},null,8,de))],10,ne)])),_:1},8,["modelValue","move"]),e.createVNode(e.unref(w),{id:g.value,class:"vv-input-file__hint"},e.createSlots({_:2},[l.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(_))))])),key:"0"}:void 0,l.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(_))))])),key:"1"}:void 0,l.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(_))))])),key:"2"}:void 0,l.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(_))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
@@ -14,8 +14,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
14
14
  url: string;
15
15
  thumbnailUrl?: string | undefined;
16
16
  lastModified?: number | undefined;
17
- } | File)[] | undefined>;
18
- required: boolean;
17
+ } | File)[]>;
19
18
  };
20
19
  progress: {
21
20
  type: (StringConstructor | NumberConstructor)[];
@@ -46,6 +45,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
46
45
  type: BooleanConstructor;
47
46
  default: boolean;
48
47
  };
48
+ sortable: {
49
+ type: BooleanConstructor;
50
+ default: boolean;
51
+ };
49
52
  labelAdd: {
50
53
  type: StringConstructor;
51
54
  default: string;
@@ -160,8 +163,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
160
163
  url: string;
161
164
  thumbnailUrl?: string | undefined;
162
165
  lastModified?: number | undefined;
163
- } | File)[] | undefined>;
164
- required: boolean;
166
+ } | File)[]>;
165
167
  };
166
168
  progress: {
167
169
  type: (StringConstructor | NumberConstructor)[];
@@ -192,6 +194,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
192
194
  type: BooleanConstructor;
193
195
  default: boolean;
194
196
  };
197
+ sortable: {
198
+ type: BooleanConstructor;
199
+ default: boolean;
200
+ };
195
201
  labelAdd: {
196
202
  type: StringConstructor;
197
203
  default: string;
@@ -291,25 +297,26 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
291
297
  lastModified?: number | undefined;
292
298
  } | File)[] | undefined) => any) | undefined;
293
299
  }, {
294
- readonly: boolean;
295
- valid: boolean;
296
- invalid: boolean;
297
- multiple: boolean;
298
- modifiers: string | string[];
299
300
  label: string | number;
301
+ modifiers: string | string[];
300
302
  progress: string | number;
301
303
  icon: string | import("../VvIcon").VvIconProps;
302
304
  iconPosition: "before" | "after";
303
305
  loading: boolean;
304
306
  loadingLabel: string;
307
+ multiple: boolean;
308
+ readonly: boolean;
305
309
  hintLabel: string;
310
+ invalid: boolean;
306
311
  invalidLabel: string | unknown[];
312
+ valid: boolean;
307
313
  validLabel: string | unknown[];
308
314
  placeholder: string;
309
315
  accept: string;
310
316
  capture: "user" | "environment";
311
317
  max: string | number;
312
318
  dropArea: boolean;
319
+ sortable: boolean;
313
320
  labelAdd: string;
314
321
  iconAdd: string | import("../VvIcon").VvIconProps;
315
322
  labelReplace: string;