@volverjs/ui-vue 0.0.10-beta.20 → 0.0.10-beta.21

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 (115) hide show
  1. package/dist/components/VvAccordion/VvAccordion.es.js +3 -1
  2. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  3. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +1 -1
  4. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +6 -1
  5. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  6. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +1 -1
  7. package/dist/components/VvAction/VvAction.es.js +2 -1
  8. package/dist/components/VvAction/VvAction.umd.js +1 -1
  9. package/dist/components/VvAction/VvAction.vue.d.ts +1 -1
  10. package/dist/components/VvAlert/VvAlert.es.js +7 -0
  11. package/dist/components/VvAlert/VvAlert.umd.js +1 -1
  12. package/dist/components/VvAlert/VvAlert.vue.d.ts +1 -1
  13. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +10 -0
  14. package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
  15. package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +1 -1
  16. package/dist/components/VvAvatar/VvAvatar.vue.d.ts +1 -1
  17. package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +1 -1
  18. package/dist/components/VvBadge/VvBadge.es.js +2 -1
  19. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  20. package/dist/components/VvBadge/VvBadge.vue.d.ts +1 -1
  21. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +3 -1
  22. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  23. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +1 -1
  24. package/dist/components/VvButton/VvButton.es.js +33 -15
  25. package/dist/components/VvButton/VvButton.umd.js +1 -1
  26. package/dist/components/VvButton/VvButton.vue.d.ts +1 -1
  27. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +2 -1
  28. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  29. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +1 -1
  30. package/dist/components/VvCard/VvCard.es.js +5 -1
  31. package/dist/components/VvCard/VvCard.umd.js +1 -1
  32. package/dist/components/VvCard/VvCard.vue.d.ts +1 -1
  33. package/dist/components/VvCheckbox/VvCheckbox.es.js +2 -1
  34. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  35. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +1 -1
  36. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +13 -2
  37. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  38. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +1 -1
  39. package/dist/components/VvCombobox/VvCombobox.es.js +48 -15
  40. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  41. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +42 -42
  42. package/dist/components/VvDialog/VvDialog.es.js +3 -0
  43. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  44. package/dist/components/VvDialog/VvDialog.vue.d.ts +1 -1
  45. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +42 -42
  46. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +1 -1
  47. package/dist/components/VvDropdown/VvDropdownItem.vue.d.ts +1 -1
  48. package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +1 -1
  49. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +1 -1
  50. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +2 -1
  51. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  52. package/dist/components/VvIcon/VvIcon.vue.d.ts +1 -1
  53. package/dist/components/VvIcon/index.d.ts +12 -0
  54. package/dist/components/VvInputFile/VvInputFile.es.js +258 -82
  55. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  56. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +152 -29
  57. package/dist/components/VvInputFile/index.d.ts +119 -14
  58. package/dist/components/VvInputText/VvInputClearAction.d.ts +6 -4
  59. package/dist/components/VvInputText/VvInputPasswordAction.d.ts +10 -8
  60. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  61. package/dist/components/VvInputText/VvInputText.es.js +79 -65
  62. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  63. package/dist/components/VvInputText/VvInputText.vue.d.ts +10 -10
  64. package/dist/components/VvInputText/index.d.ts +6 -15
  65. package/dist/components/VvNav/VvNav.es.js +2 -1
  66. package/dist/components/VvNav/VvNav.umd.js +1 -1
  67. package/dist/components/VvNav/VvNav.vue.d.ts +1 -1
  68. package/dist/components/VvNav/VvNavItem.vue.d.ts +1 -1
  69. package/dist/components/VvNav/VvNavSeparator.vue.d.ts +1 -1
  70. package/dist/components/VvNavItem/VvNavItem.es.js +2 -1
  71. package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
  72. package/dist/components/VvProgress/VvProgress.vue.d.ts +1 -1
  73. package/dist/components/VvRadio/VvRadio.vue.d.ts +1 -1
  74. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +13 -1
  75. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  76. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +1 -1
  77. package/dist/components/VvSelect/VvSelect.es.js +4 -0
  78. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  79. package/dist/components/VvSelect/VvSelect.vue.d.ts +1 -1
  80. package/dist/components/VvTab/VvTab.es.js +7 -2
  81. package/dist/components/VvTab/VvTab.umd.js +1 -1
  82. package/dist/components/VvTab/VvTab.vue.d.ts +1 -1
  83. package/dist/components/VvTextarea/VvTextarea.es.js +4 -0
  84. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  85. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +1 -1
  86. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +1 -1
  87. package/dist/components/common/HintSlot.d.ts +1 -1
  88. package/dist/components/index.es.js +354 -115
  89. package/dist/components/index.umd.js +1 -1
  90. package/dist/composables/alert/useAlert.d.ts +1 -1
  91. package/dist/composables/dropdown/useProvideDropdown.d.ts +1 -1
  92. package/dist/icons.es.js +210 -210
  93. package/dist/icons.umd.js +1 -1
  94. package/dist/stories/InputFile/InputFile.stories.d.ts +1 -2
  95. package/dist/stories/InputFile/{InputFileModifiers.stories.d.ts → InputFileDropArea.stories.d.ts} +4 -4
  96. package/dist/stories/InputFile/InputFileIconPosition.stories.d.ts +8 -0
  97. package/dist/stories/InputFile/InputFileSlots.stories.d.ts +1 -0
  98. package/dist/types/input-file.d.ts +2 -0
  99. package/package.json +45 -45
  100. package/src/assets/icons/detailed.json +1 -1
  101. package/src/assets/icons/normal.json +1 -1
  102. package/src/assets/icons/simple.json +1 -1
  103. package/src/components/VvIcon/index.ts +13 -0
  104. package/src/components/VvInputFile/VvInputFile.vue +103 -40
  105. package/src/components/VvInputFile/index.ts +88 -10
  106. package/src/components/VvInputText/VvInputClearAction.ts +10 -6
  107. package/src/components/VvInputText/VvInputPasswordAction.ts +13 -9
  108. package/src/components/VvInputText/VvInputText.vue +6 -6
  109. package/src/components/VvInputText/index.ts +7 -15
  110. package/src/stories/InputFile/InputFile.settings.ts +1 -1
  111. package/src/stories/InputFile/InputFile.stories.ts +7 -16
  112. package/src/stories/InputFile/{InputFileModifiers.stories.ts → InputFileDropArea.stories.ts} +18 -13
  113. package/src/stories/InputFile/InputFileIconPosition.stories.ts +43 -0
  114. package/src/stories/InputFile/InputFileSlots.stories.ts +11 -3
  115. package/src/types/input-file.ts +4 -2
@@ -1,7 +1,19 @@
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, renderList, createVNode, createSlots, normalizeProps, guardReactiveProps } 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, renderList, 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
+ const ACTION_ICONS = {
6
+ showPassword: "eye-on",
7
+ hidePassword: "eye-off",
8
+ showDatePicker: "calendar",
9
+ showTimePicker: "time",
10
+ showColorPicker: "color",
11
+ clear: "close",
12
+ add: "add",
13
+ remove: "trash",
14
+ edit: "edit",
15
+ download: "download"
16
+ };
5
17
  const VvIconPropsDefaults = {
6
18
  prefix: "normal"
7
19
  /* normal */
@@ -459,6 +471,15 @@ const IdProps = {
459
471
  default: false
460
472
  }
461
473
  });
474
+ const IdNameProps = {
475
+ ...IdProps,
476
+ /**
477
+ * Input / Textarea name
478
+ * Name of the form control. Submitted with the form as part of a name/value pair
479
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
480
+ */
481
+ name: { type: String, required: true }
482
+ };
462
483
  const ActionProps = {
463
484
  ...DisabledProps,
464
485
  ...LabelProps,
@@ -603,6 +624,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
603
624
  onMouseleavePassive: onMouseleave
604
625
  }), {
605
626
  default: withCtx(() => [
627
+ createCommentVNode(" @slot Default slot "),
606
628
  renderSlot(_ctx.$slots, "default", {}, () => [
607
629
  createTextVNode(
608
630
  toDisplayString(_ctx.label),
@@ -978,24 +1000,38 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
978
1000
  onClick
979
1001
  }), {
980
1002
  default: withCtx(() => [
1003
+ createCommentVNode(" @slot Default slot "),
981
1004
  renderSlot(_ctx.$slots, "default", {}, () => [
982
- _ctx.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }, () => [
983
- _ctx.loadingIcon ? (openBlock(), createBlock(_sfc_main$3, {
984
- key: 0,
985
- class: "vv-button__loading-icon",
986
- name: _ctx.loadingIcon
987
- }, null, 8, ["name"])) : createCommentVNode("v-if", true),
988
- _ctx.loadingLabel ? (openBlock(), createElementBlock(
989
- "span",
990
- _hoisted_1$1,
991
- toDisplayString(_ctx.loadingLabel),
992
- 1
993
- /* TEXT */
994
- )) : createCommentVNode("v-if", true)
995
- ]) : (openBlock(), createElementBlock(
1005
+ createCommentVNode(" #region loading "),
1006
+ _ctx.loading ? (openBlock(), createElementBlock(
1007
+ Fragment,
1008
+ { key: 0 },
1009
+ [
1010
+ createCommentVNode(" @slot Slot for loading content "),
1011
+ renderSlot(_ctx.$slots, "loading", {}, () => [
1012
+ _ctx.loadingIcon ? (openBlock(), createBlock(_sfc_main$3, {
1013
+ key: 0,
1014
+ class: "vv-button__loading-icon",
1015
+ name: _ctx.loadingIcon
1016
+ }, null, 8, ["name"])) : createCommentVNode("v-if", true),
1017
+ _ctx.loadingLabel ? (openBlock(), createElementBlock(
1018
+ "span",
1019
+ _hoisted_1$1,
1020
+ toDisplayString(_ctx.loadingLabel),
1021
+ 1
1022
+ /* TEXT */
1023
+ )) : createCommentVNode("v-if", true)
1024
+ ])
1025
+ ],
1026
+ 64
1027
+ /* STABLE_FRAGMENT */
1028
+ )) : (openBlock(), createElementBlock(
996
1029
  Fragment,
997
1030
  { key: 1 },
998
1031
  [
1032
+ createCommentVNode(" #endregion "),
1033
+ createCommentVNode(" #region button "),
1034
+ createCommentVNode(" @slot Before label and icon "),
999
1035
  renderSlot(_ctx.$slots, "before"),
1000
1036
  unref(hasIcon) ? (openBlock(), createBlock(
1001
1037
  _sfc_main$3,
@@ -1005,6 +1041,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1005
1041
  /* FULL_PROPS */
1006
1042
  )) : createCommentVNode("v-if", true),
1007
1043
  unref(label) ? (openBlock(), createElementBlock("span", _hoisted_2$1, [
1044
+ createCommentVNode(" @slot Use this slot for button label "),
1008
1045
  renderSlot(_ctx.$slots, "label", {}, () => [
1009
1046
  createTextVNode(
1010
1047
  toDisplayString(unref(label)),
@@ -1013,11 +1050,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1013
1050
  )
1014
1051
  ])
1015
1052
  ])) : createCommentVNode("v-if", true),
1053
+ createCommentVNode(" @slot After label and icon "),
1016
1054
  renderSlot(_ctx.$slots, "after")
1017
1055
  ],
1018
1056
  64
1019
1057
  /* STABLE_FRAGMENT */
1020
- ))
1058
+ )),
1059
+ createCommentVNode(" #endregion ")
1021
1060
  ])
1022
1061
  ]),
1023
1062
  _: 3
@@ -1145,6 +1184,7 @@ function HintSlotFactory(propsOrRef, slots) {
1145
1184
  };
1146
1185
  }
1147
1186
  const VvInputFileProps = {
1187
+ ...IdNameProps,
1148
1188
  ...ModifiersProps,
1149
1189
  ...ValidProps,
1150
1190
  ...InvalidProps,
@@ -1152,20 +1192,94 @@ const VvInputFileProps = {
1152
1192
  ...LabelProps,
1153
1193
  ...LoadingProps,
1154
1194
  ...ReadonlyProps,
1155
- name: { type: String },
1156
- id: { type: String },
1195
+ ...IconProps,
1196
+ /**
1197
+ * Input value
1198
+ */
1157
1199
  modelValue: {
1158
1200
  type: Object,
1159
1201
  required: true
1160
1202
  },
1161
- max: [Number, String],
1162
- labelButton: { type: String, default: "Image" },
1163
- loading: Boolean,
1164
- accept: String,
1165
- placeholder: String,
1166
- multiple: Boolean,
1167
- iconLeft: String,
1168
- iconRight: String
1203
+ /**
1204
+ * Whether to show progress bar
1205
+ */
1206
+ progress: { type: [Number, String], default: void 0 },
1207
+ /**
1208
+ * Input
1209
+ * Text that appears in the form control when it has no value set
1210
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#placeholder
1211
+ */
1212
+ placeholder: { type: String, default: void 0 },
1213
+ /**
1214
+ * File types to accept
1215
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept
1216
+ */
1217
+ accept: { type: String, default: "*" },
1218
+ /**
1219
+ * Whether to allow multiple values
1220
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#multiple
1221
+ */
1222
+ multiple: { type: Boolean, default: false },
1223
+ /**
1224
+ * Max number of files
1225
+ */
1226
+ max: { type: [Number, String], default: void 0 },
1227
+ /**
1228
+ * Show drop area
1229
+ */
1230
+ dropArea: { type: Boolean, default: false },
1231
+ /**
1232
+ * Label for add button
1233
+ */
1234
+ labelAdd: {
1235
+ type: String,
1236
+ default: "Add file"
1237
+ },
1238
+ /**
1239
+ * VvIcon name for add button
1240
+ * @see VVIcon
1241
+ */
1242
+ iconAdd: {
1243
+ type: [String, Object],
1244
+ default: ACTION_ICONS.add
1245
+ },
1246
+ /**
1247
+ * Label for replace button
1248
+ */
1249
+ labelReplace: {
1250
+ type: String,
1251
+ default: "Replace file"
1252
+ },
1253
+ /**
1254
+ * VvIcon name for replace button
1255
+ * @see VVIcon
1256
+ */
1257
+ iconReplace: {
1258
+ type: [String, Object],
1259
+ default: ACTION_ICONS.edit
1260
+ },
1261
+ /**
1262
+ * Label for download button
1263
+ */
1264
+ labelDownload: {
1265
+ type: String,
1266
+ default: "Downlaod file"
1267
+ },
1268
+ /**
1269
+ * VvIcon name for download button
1270
+ * @see VVIcon
1271
+ */
1272
+ iconDownload: {
1273
+ type: [String, Object],
1274
+ default: ACTION_ICONS.download
1275
+ },
1276
+ /**
1277
+ * Label for remove button
1278
+ */
1279
+ labelRemove: {
1280
+ type: String,
1281
+ default: "Remove file"
1282
+ }
1169
1283
  };
1170
1284
  function useDefaults(componentName, propsDefinition, props) {
1171
1285
  const volver = useVolver();
@@ -1225,12 +1339,13 @@ const _hoisted_2 = { class: "vv-input-file__preview" };
1225
1339
  const _hoisted_3 = ["src", "alt"];
1226
1340
  const _hoisted_4 = { class: "vv-input-file__wrapper" };
1227
1341
  const _hoisted_5 = ["id", "readonly", "placeholder", "aria-describedby", "aria-invalid", "aria-errormessage", "multiple", "accept", "name"];
1228
- const _hoisted_6 = { class: "vv-input-file__list" };
1229
- const _hoisted_7 = ["onClick"];
1342
+ const _hoisted_6 = ["value"];
1343
+ const _hoisted_7 = { class: "vv-input-file__list" };
1230
1344
  const _hoisted_8 = ["onClick"];
1231
- const _hoisted_9 = { class: "vv-input-file__item-name cursor-pointer" };
1232
- const _hoisted_10 = { class: "vv-input-file__item-info" };
1233
- const _hoisted_11 = ["onClick"];
1345
+ const _hoisted_9 = ["title", "onClick"];
1346
+ const _hoisted_10 = { class: "vv-input-file__item-name" };
1347
+ const _hoisted_11 = { class: "vv-input-file__item-info" };
1348
+ const _hoisted_12 = ["title", "onClick"];
1234
1349
  const __default__ = {
1235
1350
  name: "VvInputFile"
1236
1351
  };
@@ -1247,19 +1362,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1247
1362
  VvInputFileProps,
1248
1363
  props
1249
1364
  );
1250
- const { modifiers, id, readonly } = toRefs(props);
1365
+ const { modifiers, id, readonly, icon, iconPosition, iconDownload } = toRefs(props);
1251
1366
  const hasId = useUniqueId(id);
1252
1367
  const hasHintId = computed(() => `${hasId.value}-hint`);
1368
+ const hasProgress = computed(() => {
1369
+ if (!props.progress) {
1370
+ return false;
1371
+ }
1372
+ const progress = typeof props.progress === "string" ? parseInt(props.progress) : props.progress;
1373
+ return progress > 0 && progress < 100;
1374
+ });
1375
+ const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition);
1376
+ const { hasIcon: hasIconDownload } = useComponentIcon(iconDownload);
1253
1377
  const bemCssClasses = useModifiers(
1254
1378
  "vv-input-file",
1255
1379
  modifiers,
1256
1380
  computed(() => ({
1257
1381
  dragging: isDragging.value,
1258
- loading: props.loading,
1382
+ loading: props.loading && !hasProgress.value,
1259
1383
  valid: props.valid === true,
1260
1384
  invalid: props.invalid === true,
1261
- "icon-before": !!props.iconLeft,
1262
- "icon-after": !!props.iconRight
1385
+ "icon-before": !!hasIconBefore.value,
1386
+ "icon-after": !!hasIconAfter.value,
1387
+ "drop-area": hasDropArea.value
1263
1388
  }))
1264
1389
  );
1265
1390
  const {
@@ -1280,8 +1405,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1280
1405
  return typeof props.max === "string" ? parseInt(props.max) : props.max;
1281
1406
  });
1282
1407
  const hasDropArea = computed(() => {
1283
- var _a;
1284
- return (_a = modifiers == null ? void 0 : modifiers.value) == null ? void 0 : _a.includes("drop-area");
1408
+ return props.dropArea && !readonly.value;
1285
1409
  });
1286
1410
  const isMultiple = computed(() => {
1287
1411
  if (!props.multiple) {
@@ -1338,8 +1462,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1338
1462
  toReturn.push(file);
1339
1463
  }
1340
1464
  localModelValue.value = toReturn;
1465
+ selectedFileIndex.value = toReturn.length - 1;
1341
1466
  };
1342
- const onClick = () => {
1467
+ const onClickDropArea = () => {
1343
1468
  if (!inputEl.value) {
1344
1469
  return;
1345
1470
  }
@@ -1356,17 +1481,32 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1356
1481
  toReturn.splice(index, 1);
1357
1482
  localModelValue.value = toReturn;
1358
1483
  };
1359
- const currentFileIndex = ref(0);
1484
+ const selectedFileIndex = ref(0);
1485
+ const PREVIEW_MIME_TYPES = ["image/jpeg", "image/png"];
1360
1486
  const previewSrc = computed(() => {
1361
1487
  if (files.value.length === 0) {
1362
1488
  return;
1363
1489
  }
1364
- if (files.value[currentFileIndex.value] instanceof File) {
1365
- return URL.createObjectURL(
1366
- files.value[currentFileIndex.value]
1367
- );
1490
+ if (files.value[selectedFileIndex.value] instanceof File) {
1491
+ const currentFile2 = files.value[selectedFileIndex.value];
1492
+ if (!PREVIEW_MIME_TYPES.includes(currentFile2.type)) {
1493
+ return void 0;
1494
+ }
1495
+ return URL.createObjectURL(currentFile2);
1496
+ }
1497
+ const currentFile = files.value[selectedFileIndex.value];
1498
+ if (currentFile.thumbnailUrl) {
1499
+ return currentFile.thumbnailUrl;
1500
+ }
1501
+ if (!PREVIEW_MIME_TYPES.includes(currentFile.type)) {
1502
+ return void 0;
1503
+ }
1504
+ return currentFile.url;
1505
+ });
1506
+ watch(previewSrc, (_newValue, oldValue) => {
1507
+ if (oldValue) {
1508
+ URL.revokeObjectURL(oldValue);
1368
1509
  }
1369
- return files.value[currentFileIndex.value].url;
1370
1510
  });
1371
1511
  onBeforeUnmount(() => {
1372
1512
  if (previewSrc.value) {
@@ -1389,7 +1529,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1389
1529
  link.setAttribute("download", file.name);
1390
1530
  document.body.appendChild(link);
1391
1531
  link.click();
1532
+ document.body.removeChild(link);
1533
+ URL.revokeObjectURL(link.href);
1534
+ };
1535
+ const onClickSelectFile = (index) => {
1536
+ selectedFileIndex.value = index;
1392
1537
  };
1538
+ const dropdAreaActionLabel = computed(() => {
1539
+ if (files.value.length === 0 || isMultiple.value) {
1540
+ return props.labelAdd;
1541
+ }
1542
+ return props.labelReplace;
1543
+ });
1544
+ const dropAreaActionIcon = computed(() => {
1545
+ if (files.value.length === 0 || isMultiple.value) {
1546
+ return props.iconAdd;
1547
+ }
1548
+ return props.iconReplace;
1549
+ });
1393
1550
  return (_ctx, _cache) => {
1394
1551
  return openBlock(), createElementBlock(
1395
1552
  "div",
@@ -1411,42 +1568,46 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1411
1568
  onDrop: withModifiers(onDrop, ["prevent", "stop"]),
1412
1569
  onDragover: _cache[0] || (_cache[0] = withModifiers(() => {
1413
1570
  }, ["prevent", "stop"])),
1414
- onClick: withModifiers(onClick, ["stop"])
1571
+ onClick: withModifiers(onClickDropArea, ["stop"])
1415
1572
  },
1416
1573
  [
1417
1574
  renderSlot(_ctx.$slots, "drop-area", {}, () => [
1418
- !unref(readonly) ? (openBlock(), createBlock(_sfc_main$1, {
1419
- key: 0,
1420
- modifiers: "action",
1421
- "aria-label": "upload",
1422
- label: !previewSrc.value ? _ctx.labelButton : void 0,
1423
- class: normalizeClass([{
1424
- "absolute top-8 right-8": previewSrc.value
1425
- }, "z-1"]),
1426
- icon: !previewSrc.value ? "image" : isMultiple.value ? "add" : "edit",
1427
- onClick: withModifiers(onClick, ["stop"])
1428
- }, null, 8, ["label", "class", "icon"])) : createCommentVNode("v-if", true),
1429
1575
  createElementVNode("picture", _hoisted_2, [
1430
1576
  previewSrc.value ? (openBlock(), createElementBlock("img", {
1431
1577
  key: 0,
1432
1578
  src: previewSrc.value,
1433
- alt: files.value[currentFileIndex.value].name
1579
+ alt: files.value[selectedFileIndex.value].name
1434
1580
  }, null, 8, _hoisted_3)) : createCommentVNode("v-if", true)
1435
- ])
1581
+ ]),
1582
+ !unref(readonly) ? (openBlock(), createBlock(_sfc_main$1, {
1583
+ key: 0,
1584
+ modifiers: "action",
1585
+ label: !previewSrc.value ? dropdAreaActionLabel.value : void 0,
1586
+ title: previewSrc.value ? dropdAreaActionLabel.value : void 0,
1587
+ class: normalizeClass({
1588
+ "vv-input-file__drop-area-action": previewSrc.value
1589
+ }),
1590
+ icon: dropAreaActionIcon.value,
1591
+ onClick: withModifiers(onClickDropArea, ["stop"])
1592
+ }, null, 8, ["label", "title", "class", "icon"])) : createCommentVNode("v-if", true)
1436
1593
  ])
1437
1594
  ],
1438
1595
  32
1439
1596
  /* NEED_HYDRATION */
1440
1597
  )) : createCommentVNode("v-if", true),
1441
1598
  createElementVNode("div", _hoisted_4, [
1442
- _ctx.iconLeft ? (openBlock(), createBlock(_sfc_main$3, {
1443
- key: 0,
1444
- name: _ctx.iconLeft
1445
- }, null, 8, ["name"])) : createCommentVNode("v-if", true),
1599
+ unref(hasIconBefore) ? (openBlock(), createBlock(
1600
+ _sfc_main$3,
1601
+ normalizeProps(mergeProps({ key: 0 }, unref(hasIconBefore))),
1602
+ null,
1603
+ 16
1604
+ /* FULL_PROPS */
1605
+ )) : createCommentVNode("v-if", true),
1446
1606
  createElementVNode("input", {
1447
1607
  id: unref(hasId),
1448
1608
  ref_key: "inputEl",
1449
1609
  ref: inputEl,
1610
+ type: "file",
1450
1611
  readonly: unref(readonly),
1451
1612
  placeholder: _ctx.placeholder,
1452
1613
  "aria-describedby": unref(hasHintLabelOrSlot) ? hasHintId.value : void 0,
@@ -1454,57 +1615,72 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1454
1615
  "aria-errormessage": unref(hasInvalidLabelOrSlot) ? hasHintId.value : void 0,
1455
1616
  multiple: isMultiple.value,
1456
1617
  accept: _ctx.accept,
1457
- type: "file",
1458
1618
  name: _ctx.name,
1459
1619
  onChange
1460
1620
  }, null, 40, _hoisted_5),
1461
- _ctx.iconRight ? (openBlock(), createBlock(_sfc_main$3, {
1621
+ hasProgress.value ? (openBlock(), createElementBlock("progress", {
1462
1622
  key: 1,
1463
- name: _ctx.iconRight
1464
- }, null, 8, ["name"])) : createCommentVNode("v-if", true)
1623
+ class: "vv-input-file__progress",
1624
+ value: _ctx.progress,
1625
+ max: "100"
1626
+ }, toDisplayString(_ctx.progress) + "% ", 9, _hoisted_6)) : createCommentVNode("v-if", true),
1627
+ unref(hasIconAfter) ? (openBlock(), createBlock(
1628
+ _sfc_main$3,
1629
+ normalizeProps(mergeProps({ key: 2 }, unref(hasIconAfter))),
1630
+ null,
1631
+ 16
1632
+ /* FULL_PROPS */
1633
+ )) : createCommentVNode("v-if", true)
1465
1634
  ]),
1466
- createElementVNode("ul", _hoisted_6, [
1635
+ createElementVNode("ul", _hoisted_7, [
1467
1636
  (openBlock(true), createElementBlock(
1468
1637
  Fragment,
1469
1638
  null,
1470
1639
  renderList(files.value, (file, index) => {
1471
1640
  return openBlock(), createElementBlock("li", {
1472
1641
  key: index,
1473
- class: "vv-input-file__item",
1474
- onClick: withModifiers(($event) => currentFileIndex.value = index, ["stop"])
1642
+ class: normalizeClass(["vv-input-file__item", {
1643
+ active: index === selectedFileIndex.value && hasDropArea.value && files.value.length > 1
1644
+ }]),
1645
+ onClick: withModifiers(($event) => onClickSelectFile(index), ["stop"])
1475
1646
  }, [
1476
- createElementVNode("button", {
1647
+ unref(hasIconDownload) ? (openBlock(), createElementBlock("button", {
1648
+ key: 0,
1477
1649
  type: "button",
1478
- class: "vv-input-file__item-icon cursor-pointer",
1479
- title: "Download",
1480
- "aria-label": "download-file",
1650
+ class: "vv-input-file__item-action",
1651
+ title: _ctx.labelDownload,
1481
1652
  onClick: withModifiers(($event) => onClickDownloadFile(file), ["stop"])
1482
1653
  }, [
1483
- createVNode(_sfc_main$3, { name: "download" })
1484
- ], 8, _hoisted_8),
1654
+ createVNode(
1655
+ _sfc_main$3,
1656
+ normalizeProps(guardReactiveProps(unref(hasIconDownload))),
1657
+ null,
1658
+ 16
1659
+ /* FULL_PROPS */
1660
+ )
1661
+ ], 8, _hoisted_9)) : createCommentVNode("v-if", true),
1485
1662
  createElementVNode(
1486
1663
  "div",
1487
- _hoisted_9,
1664
+ _hoisted_10,
1488
1665
  toDisplayString(file.name),
1489
1666
  1
1490
1667
  /* TEXT */
1491
1668
  ),
1492
1669
  createElementVNode(
1493
1670
  "small",
1494
- _hoisted_10,
1671
+ _hoisted_11,
1495
1672
  toDisplayString(sizeInKiB(file.size)) + " KB ",
1496
1673
  1
1497
1674
  /* TEXT */
1498
1675
  ),
1499
1676
  !unref(readonly) ? (openBlock(), createElementBlock("button", {
1500
- key: 0,
1677
+ key: 1,
1501
1678
  type: "button",
1502
1679
  class: "vv-input-file__item-remove",
1503
- title: "Remove",
1504
- "aria-label": "remove-file",
1680
+ title: _ctx.labelRemove,
1505
1681
  onClick: withModifiers(($event) => onClickRemoveFile(index), ["stop"])
1506
- }, null, 8, _hoisted_11)) : createCommentVNode("v-if", true)
1507
- ], 8, _hoisted_7);
1682
+ }, null, 8, _hoisted_12)) : createCommentVNode("v-if", true)
1683
+ ], 10, _hoisted_8);
1508
1684
  }),
1509
1685
  128
1510
1686
  /* KEYED_FRAGMENT */
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@vueuse/core"),require("@iconify/vue"),require("uid")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","@iconify/vue","uid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputFile=t(e.vue,e.core,e.vue$1,e.uid)}(this,(function(e,t,l,o){"use strict";const a={prefix:"normal"};var n=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(n||{}),i=(e=>(e.before="before",e.after="after",e))(i||{}),r=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(r||{}),u=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(u||{}),d=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(d||{});const s=Symbol.for("volver"),c=Symbol.for("buttonGroup"),v=Symbol.for("dropdownTrigger"),f=Symbol.for("dropdownAction");function p(){return e.inject(s)}function m(t,l,o){return e.computed((()=>{const a={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const g=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:{}},a),setup(t){const o=t,a=e.computed((()=>"string"==typeof o.rotate?parseFloat(o.rotate):o.rotate)),n=e.ref(!0),i=p(),{modifiers:r}=e.toRefs(o),u=m("vv-icon",r),d=e.computed((()=>o.provider||(null==i?void 0:i.iconsProvider))),s=e.computed((()=>{const e=o.name??"",t=`@${d.value}:${o.prefix}:${e}`;if(l.iconExists(t))return t;const a=null==i?void 0:i.iconsCollections.find((t=>{const o=`@${d.value}:${t.prefix}:${e}`;return l.iconExists(o)}));return a?`@${d.value}:${a.prefix}:${e}`:e}));function c(e){const t=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=(null==t?void 0:t.innerHTML.trim())||"";t&&a&&l.addIcon(`@${d.value}:${o.prefix}:${o.name}`,{body:a,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&o.src&&!l.iconExists(`@${d.value}:${o.prefix}:${o.name}`)&&(n.value=!1,i.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),(t,o)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(l.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(a),color:t.color,onLoad:t.onLoad,icon:e.unref(s)}),null,16,["class"])):e.createCommentVNode("v-if",!0)}}),b={to:{type:[String,Object]},href:String,target:{type:String,default:void 0,validator:e=>Object.values(d).includes(e)},rel:{type:String,default:"noopener noreferrer"}},y={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},h={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},k={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},S={disabled:{type:Boolean,default:!1}},B={active:{type:Boolean,default:!1}},L={current:{type:Boolean,default:!1}},V={pressed:{type:Boolean,default:!1}},$={label:{type:[String,Number],default:void 0}},w={readonly:{type:Boolean,default:!1}},_={modifiers:{type:[String,Array],default:void 0}},A={hintLabel:{type:String,default:""}},O={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:i.before,validation:e=>Object.values(i).includes(e)}},C={unselectable:{type:Boolean,default:!0}},x={id:[String,Number]};n.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const N={...S,...$,...V,...B,...L,...b,type:{type:String,default:r.button,validator:e=>Object.values(r).includes(e)},ariaLabel:{type:String,default:void 0},defaultTag:{type:String,default:u.button}},E=N;const j=e.defineComponent({name:"VvAction",props:E,emits:["click","mouseover","mouseleave"],setup(t,{expose:l,emit:o}){const a=t,n=o,i=p(),r=e.ref(null);l({$el:r});const{reference:d,bus:s,aria:c,expanded:m}=e.inject(v,{});e.watch((()=>r.value),(e=>{d&&(d.value=e)}));const g=e.computed((()=>a.pressed||(null==m?void 0:m.value))),{role:b}=e.inject(f,{}),y=e.computed((()=>{switch(!0){case a.disabled:return u.button;case void 0!==a.to:return(null==i?void 0:i.nuxt)?u.nuxtLink:u.routerLink;case void 0!==a.href:return u.a;default:return a.defaultTag}})),h=e.computed((()=>{const e={...null==c?void 0:c.value,ariaPressed:!!g.value||void 0,ariaLabel:a.ariaLabel,role:null==b?void 0:b.value};switch(y.value){case u.a:return{...e,href:a.href,target:a.target,rel:a.rel};case u.routerLink:case u.nuxtLink:return{...e,to:a.to,target:a.target};case u.button:return{...e,type:a.type,disabled:a.disabled};default:return e}})),k=e=>{a.disabled?e.preventDefault():(null==s||s.emit("click",e),n("click",e))},S=e=>{null==s||s.emit("mouseover",e),n("mouseover",e)},B=e=>{null==s||s.emit("mouseleave",e),n("mouseleave",e)};return(t,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(y)),e.mergeProps(e.unref(h),{ref_key:"element",ref:r,class:{active:t.active,pressed:e.unref(g),disabled:t.disabled,current:t.current},onClickPassive:k,onMouseoverPassive:S,onMouseleavePassive:B}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});function I(e,t,l){return l?R(e,l)===R(t,l):P(e,t)}function P(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),o=Array.isArray(t);let a,n,i;if(l&&o){if(n=e.length,n!=t.length)return!1;for(a=n;0!=a--;)if(!P(e[a],t[a]))return!1;return!0}if(l!=o)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==t.getTime();const d=e instanceof RegExp,s=t instanceof RegExp;if(d!=s)return!1;if(d&&s)return e.toString()==t.toString();const c=Object.keys(e);if(n=c.length,n!==Object.keys(t).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,c[a]))return!1;for(a=n;0!=a--;)if(i=c[a],!P(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function R(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const l=t.split(".");let o=e;for(let t=0,a=l.length;t<a;++t){if(null==e)return null;o=o[l[t]]}return o}}return null}function D(e,t){if(null!=e&&t&&t.length)for(const l of t)if(I(e,l))return!0;return!1}function M(t){const l=e.inject(t,void 0),o=e.computed((()=>{return t=l,!(null==(o=e.unref(t))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length);var t,o}));return{group:l,isInGroup:o,getGroupOrLocalRef:function(t,o,a){if(null==l?void 0:l.value){const o=e.unref(l.value)[t];return e.computed({get:()=>null==o?void 0:o.value,set(e){o.value=e}})}const n=e.toRef(o,t);return e.computed({get:()=>n.value,set(e){a&&a(`update:${t}`,e)}})}}}const F={...N,...x,..._,...C,...k,...O,iconPosition:{type:String,default:n.left,validator:e=>Object.values(n).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 T=t=>e.computed((()=>String((null==t?void 0:t.value)||o.uid())));const z={key:1,class:"vv-button__label"},q={key:1,class:"vv-button__label"},H=e.defineComponent({name:"VvButton",props:F,emits:["update:modelValue"],setup(t,{expose:l,emit:o}){const a=t,r=e.useAttrs(),u=e.useSlots(),d=o,{id:s,modifiers:v,iconPosition:f,icon:p,label:b,modelValue:y,disabled:h,toggle:k,unselectable:S}=function(t,l){const{group:o,isInGroup:a,getGroupOrLocalRef:n}=M(c),{id:i,iconPosition:r,icon:u,label:d,pressed:s}=e.toRefs(t),v=n("modelValue",t,l),f=n("toggle",t),p=n("unselectable",t),m=e.computed((()=>(null==o?void 0:o.value.multiple.value)??!1)),g=e.computed((()=>{let e=t.modifiers,l=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)))),l&&(Array.isArray(l)||(l=l.split(" ")),l.forEach((e=>a.add(e)))),Array.from(a)})),b=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==o?void 0:o.value)?void 0:e.disabled.value))}));return{group:o,isInGroup:a,modelValue:v,toggle:f,unselectable:p,multiple:m,modifiers:g,disabled:b,id:i,pressed:s,iconPosition:r,icon:u,label:d}}(a,d),B=T(s),L=e.computed((()=>(null==r?void 0:r.name)||B.value)),V=e.ref(null);l({$el:e.computed((()=>{var e;return null==(e=V.value)?void 0:e.$el}))});const $=e.computed((()=>k.value?Array.isArray(y.value)?D(L.value,y.value):I(L.value,y.value):a.pressed)),w=m("vv-button",v,e.computed((()=>({reverse:[n.right,n.bottom].includes(f.value),column:[n.top,n.bottom].includes(f.value),"icon-only":Boolean((null==p?void 0:p.value)&&!(null==b?void 0:b.value)&&!u.default)})))),{hasIcon:_}=function(t,l){const o=e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),a=e.computed((()=>(null==l?void 0:l.value)===i.before?o.value:void 0)),r=e.computed((()=>(null==l?void 0:l.value)===i.after?o.value:void 0)),u=e.computed((()=>(null==l?void 0:l.value)===n.left?o.value:void 0)),d=e.computed((()=>(null==l?void 0:l.value)===n.right?o.value:void 0)),s=e.computed((()=>(null==l?void 0:l.value)===n.top?o.value:void 0)),c=e.computed((()=>(null==l?void 0:l.value)===n.bottom?o.value:void 0));return{hasIcon:o,hasIconLeft:u,hasIconRight:d,hasIconTop:s,hasIconBottom:c,hasIconBefore:a,hasIconAfter:r}}(p),A=e.computed((()=>void 0!==a.value?a.value:L.value)),O=()=>{if(k.value){if(Array.isArray(y.value))return D(A.value,y.value)?void(S.value&&(y.value=y.value.filter((e=>e!==A.value)))):void y.value.push(A.value);if(A.value===y.value&&S.value)return void(y.value=a.uncheckedValue);y.value=A.value}};return(t,l)=>(e.openBlock(),e.createBlock(j,e.mergeProps({disabled:e.unref(h),pressed:e.unref($),active:t.active,type:t.type,to:t.to,href:t.href,target:t.target,rel:t.rel,ariaLabel:t.ariaLabel},{id:e.unref(B),ref_key:"element",ref:V,class:e.unref(w),onClick:O}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[t.loading?e.renderSlot(t.$slots,"loading",{key:0},(()=>[t.loadingIcon?(e.openBlock(),e.createBlock(g,{key:0,class:"vv-button__loading-icon",name:t.loadingIcon},null,8,["name"])):e.createCommentVNode("v-if",!0),t.loadingLabel?(e.openBlock(),e.createElementBlock("span",z,e.toDisplayString(t.loadingLabel),1)):e.createCommentVNode("v-if",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(t.$slots,"before"),e.unref(_)?(e.openBlock(),e.createBlock(g,e.mergeProps({key:0},e.unref(_),{class:"vv-button__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.unref(b)?(e.openBlock(),e.createElementBlock("span",q,[e.renderSlot(t.$slots,"label",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(b)),1)]))])):e.createCommentVNode("v-if",!0),e.renderSlot(t.$slots,"after")],64))]))])),_:3},16,["id","class"]))}});function U(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const G={..._,...y,...h,...A,...$,...k,...w,name:{type:String},id:{type:String},modelValue:{type:Object,required:!0},max:[Number,String],labelButton:{type:String,default:"Image"},loading:Boolean,accept:String,placeholder:String,multiple:Boolean,iconLeft:String,iconRight:String};const J=["for"],K={class:"vv-input-file__preview"},Q=["src","alt"],W={class:"vv-input-file__wrapper"},X=["id","readonly","placeholder","aria-describedby","aria-invalid","aria-errormessage","multiple","accept","name"],Y={class:"vv-input-file__list"},Z=["onClick"],ee=["onClick"],te={class:"vv-input-file__item-name cursor-pointer"},le={class:"vv-input-file__item-info"},oe=["onClick"];return e.defineComponent({name:"VvInputFile",props:G,emits:["update:modelValue"],setup(l,{emit:o}){const a=l,n=o,i=e.useSlots(),r=function(t,l,o){const a=p(),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const n=a[o];if(l[o]=n,o in e){if(Array.isArray(t[o])){const a=t[o];a.length&&a[0]===n&&(l[o]=e[o])}if("function"==typeof t[o]&&(0,t[o])()===n&&(l[o]=e[o]),"object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(l[o]=e[o]):a===n&&(l[o]=e[o])}}return l}),{})}))}("VvInputFile",G,a),{modifiers:u,id:d,readonly:s}=e.toRefs(a),c=T(d),v=e.computed((()=>`${c.value}-hint`)),f=m("vv-input-file",u,e.computed((()=>({dragging:w.value,loading:a.loading,valid:!0===a.valid,invalid:!0===a.invalid,"icon-before":!!a.iconLeft,"icon-after":!!a.iconRight})))),{HintSlot:b,hasHintLabelOrSlot:y,hasInvalidLabelOrSlot:h,hintSlotScope:k}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>U(o.value.invalidLabel))),n=e.computed((()=>U(o.value.validLabel))),i=e.computed((()=>o.value.loadingLabel)),r=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(l.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(o.value.invalid&&(l.invalid||a.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(o.value.valid&&(l.valid||n.value)))),c=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),v=e.computed((()=>d.value||s.value||u.value||c.value)),f=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:v,invalidLabel:a,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:c}),render(){var t,l,o,a,n,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??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==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:c,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:f,HintSlot:p}}(r,i),S=t.useVModel(a,"modelValue",n),B=e.computed((()=>{var e;return S.value&&(Array.isArray(S.value)||(null==(e=S.value)?void 0:e.name))?Array.isArray(S.value)?S.value:[S.value]:[]})),L=e.computed((()=>"string"==typeof a.max?parseInt(a.max):a.max)),V=e.computed((()=>{var e;return null==(e=null==u?void 0:u.value)?void 0:e.includes("drop-area")})),$=e.computed((()=>!!a.multiple&&(!L.value||L.value-B.value.length>1))),w=e.ref(!1),_=e.ref(),A=()=>{w.value=!0},O=()=>{w.value=!1},C=e=>{var t,l;(null==(t=e.dataTransfer)?void 0:t.files)&&(w.value=!1,N(null==(l=e.dataTransfer)?void 0:l.files))},x=()=>{var e;(null==(e=_.value)?void 0:e.files)&&(N(_.value.files),_.value.value="")},N=e=>{if(!a.multiple)return Array.isArray(S.value)?void(S.value=[...e]):void(S.value=e[0]);let t=[];t=!Array.isArray(S.value)&&S.value?[S.value]:S.value&&Array.isArray(S.value)?[...S.value]:t;for(const l of e){if(L.value&&t.length>=L.value)break;t.push(l)}S.value=t},E=()=>{_.value&&(s.value||_.value.click())},j=e.ref(0),I=e.computed((()=>{if(0!==B.value.length)return B.value[j.value]instanceof File?URL.createObjectURL(B.value[j.value]):B.value[j.value].url}));e.onBeforeUnmount((()=>{I.value&&URL.revokeObjectURL(I.value)}));const P=e=>{if(e)return Math.floor(e/1024)};return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(f))},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(c)},e.toDisplayString(t.label),9,J)):e.createCommentVNode("v-if",!0),V.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"vv-input-file__drop-area",onDragenter:e.withModifiers(A,["prevent","stop"]),onDragleave:e.withModifiers(O,["prevent","stop"]),onDrop:e.withModifiers(C,["prevent","stop"]),onDragover:l[0]||(l[0]=e.withModifiers((()=>{}),["prevent","stop"])),onClick:e.withModifiers(E,["stop"])},[e.renderSlot(t.$slots,"drop-area",{},(()=>[e.unref(s)?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(H,{key:0,modifiers:"action","aria-label":"upload",label:I.value?void 0:t.labelButton,class:e.normalizeClass([{"absolute top-8 right-8":I.value},"z-1"]),icon:I.value?$.value?"add":"edit":"image",onClick:e.withModifiers(E,["stop"])},null,8,["label","class","icon"])),e.createElementVNode("picture",K,[I.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:I.value,alt:B.value[j.value].name},null,8,Q)):e.createCommentVNode("v-if",!0)])]))],32)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",W,[t.iconLeft?(e.openBlock(),e.createBlock(g,{key:0,name:t.iconLeft},null,8,["name"])):e.createCommentVNode("v-if",!0),e.createElementVNode("input",{id:e.unref(c),ref_key:"inputEl",ref:_,readonly:e.unref(s),placeholder:t.placeholder,"aria-describedby":e.unref(y)?v.value:void 0,"aria-invalid":t.invalid,"aria-errormessage":e.unref(h)?v.value:void 0,multiple:$.value,accept:t.accept,type:"file",name:t.name,onChange:x},null,40,X),t.iconRight?(e.openBlock(),e.createBlock(g,{key:1,name:t.iconRight},null,8,["name"])):e.createCommentVNode("v-if",!0)]),e.createElementVNode("ul",Y,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value,((t,l)=>(e.openBlock(),e.createElementBlock("li",{key:l,class:"vv-input-file__item",onClick:e.withModifiers((e=>j.value=l),["stop"])},[e.createElementVNode("button",{type:"button",class:"vv-input-file__item-icon cursor-pointer",title:"Download","aria-label":"download-file",onClick:e.withModifiers((e=>(e=>{const t=document.createElement("a");e instanceof File?t.href=URL.createObjectURL(e):e.url&&(t.href=e.url),t.setAttribute("download",e.name),document.body.appendChild(t),t.click()})(t)),["stop"])},[e.createVNode(g,{name:"download"})],8,ee),e.createElementVNode("div",te,e.toDisplayString(t.name),1),e.createElementVNode("small",le,e.toDisplayString(P(t.size))+" KB ",1),e.unref(s)?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"vv-input-file__item-remove",title:"Remove","aria-label":"remove-file",onClick:e.withModifiers((e=>(e=>{if(!Array.isArray(S.value))return void(S.value=void 0);const t=[...S.value];t.splice(e,1),S.value=t})(l)),["stop"])},null,8,oe))],8,Z)))),128))]),e.createVNode(e.unref(b),{id:v.value,class:"vv-input-file__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@vueuse/core"),require("@iconify/vue"),require("uid")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","@iconify/vue","uid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputFile=t(e.vue,e.core,e.vue$1,e.uid)}(this,(function(e,t,l,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 f=Symbol.for("volver"),p=Symbol.for("buttonGroup"),m=Symbol.for("dropdownTrigger"),g=Symbol.for("dropdownAction");function b(){return e.inject(f)}function y(t,l,o){return e.computed((()=>{const a={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),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(t){const o=t,a=e.computed((()=>"string"==typeof o.rotate?parseFloat(o.rotate):o.rotate)),n=e.ref(!0),r=b(),{modifiers:i}=e.toRefs(o),u=y("vv-icon",i),d=e.computed((()=>o.provider||(null==r?void 0:r.iconsProvider))),s=e.computed((()=>{const e=o.name??"",t=`@${d.value}:${o.prefix}:${e}`;if(l.iconExists(t))return t;const a=null==r?void 0:r.iconsCollections.find((t=>{const o=`@${d.value}:${t.prefix}:${e}`;return l.iconExists(o)}));return a?`@${d.value}:${a.prefix}:${e}`:e}));function c(e){const t=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=(null==t?void 0:t.innerHTML.trim())||"";t&&a&&l.addIcon(`@${d.value}:${o.prefix}:${o.name}`,{body:a,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return r&&o.src&&!l.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),(t,o)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(l.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(a),color:t.color,onLoad:t.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}},C={active:{type:Boolean,default:!1}},w={current:{type:Boolean,default:!1}},A={pressed:{type:Boolean,default:!1}},$={label:{type:[String,Number],default:void 0}},O={readonly:{type:Boolean,default:!1}},_={modifiers:{type:[String,Array],default:void 0}},N={hintLabel:{type:String,default:""}},x={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:d.before,validation:e=>Object.values(d).includes(e)}},j={unselectable:{type:Boolean,default:!0}},R={id:[String,Number]};u.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const E={...R,name:{type:String,required:!0}},P={...V,...$,...A,...C,...w,...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=P;const D=e.defineComponent({name:"VvAction",props:I,emits:["click","mouseover","mouseleave"],setup(t,{expose:l,emit:o}){const a=t,n=o,r=b(),i=e.ref(null);l({$el:i});const{reference:u,bus:d,aria:s,expanded:v}=e.inject(m,{});e.watch((()=>i.value),(e=>{u&&(u.value=e)}));const f=e.computed((()=>a.pressed||(null==v?void 0:v.value))),{role:p}=e.inject(g,{}),y=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:!!f.value||void 0,ariaLabel:a.ariaLabel,role:null==p?void 0:p.value};switch(y.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(t,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(y)),e.mergeProps(e.unref(h),{ref_key:"element",ref:i,class:{active:t.active,pressed:e.unref(f),disabled:t.disabled,current:t.current},onClickPassive:k,onMouseoverPassive:S,onMouseleavePassive:B}),{default:e.withCtx((()=>[e.createCommentVNode(" @slot Default slot "),e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});function F(e,t,l){return l?z(e,l)===z(t,l):M(e,t)}function M(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),o=Array.isArray(t);let a,n,r;if(l&&o){if(n=e.length,n!=t.length)return!1;for(a=n;0!=a--;)if(!M(e[a],t[a]))return!1;return!0}if(l!=o)return!1;const i=e instanceof Date,u=t instanceof Date;if(i!=u)return!1;if(i&&u)return e.getTime()==t.getTime();const d=e instanceof RegExp,s=t instanceof RegExp;if(d!=s)return!1;if(d&&s)return e.toString()==t.toString();const c=Object.keys(e);if(n=c.length,n!==Object.keys(t).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,c[a]))return!1;for(a=n;0!=a--;)if(r=c[a],!M(e[r],t[r]))return!1;return!0}return e!=e&&t!=t}function z(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const l=t.split(".");let o=e;for(let t=0,a=l.length;t<a;++t){if(null==e)return null;o=o[l[t]]}return o}}return null}function U(e,t){if(null!=e&&t&&t.length)for(const l of t)if(F(e,l))return!0;return!1}function T(t){const l=e.inject(t,void 0),o=e.computed((()=>{return t=l,!(null==(o=e.unref(t))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length);var t,o}));return{group:l,isInGroup:o,getGroupOrLocalRef:function(t,o,a){if(null==l?void 0:l.value){const o=e.unref(l.value)[t];return e.computed({get:()=>null==o?void 0:o.value,set(e){o.value=e}})}const n=e.toRef(o,t);return e.computed({get:()=>n.value,set(e){a&&a(`update:${t}`,e)}})}}}const q={...P,...R,..._,...j,...L,...x,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=t=>e.computed((()=>String((null==t?void 0:t.value)||o.uid())));function G(t,l){const o=e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),a=e.computed((()=>(null==l?void 0:l.value)===d.before?o.value:void 0)),n=e.computed((()=>(null==l?void 0:l.value)===d.after?o.value:void 0)),r=e.computed((()=>(null==l?void 0:l.value)===u.left?o.value:void 0)),i=e.computed((()=>(null==l?void 0:l.value)===u.right?o.value:void 0)),s=e.computed((()=>(null==l?void 0:l.value)===u.top?o.value:void 0)),c=e.computed((()=>(null==l?void 0:l.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(t,{expose:l,emit:o}){const a=t,n=e.useAttrs(),r=e.useSlots(),i=o,{id:d,modifiers:s,iconPosition:c,icon:v,label:f,modelValue:m,disabled:g,toggle:b,unselectable:k}=function(t,l){const{group:o,isInGroup:a,getGroupOrLocalRef:n}=T(p),{id:r,iconPosition:i,icon:u,label:d,pressed:s}=e.toRefs(t),c=n("modelValue",t,l),v=n("toggle",t),f=n("unselectable",t),m=e.computed((()=>(null==o?void 0:o.value.multiple.value)??!1)),g=e.computed((()=>{let e=t.modifiers,l=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)))),l&&(Array.isArray(l)||(l=l.split(" ")),l.forEach((e=>a.add(e)))),Array.from(a)})),b=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==o?void 0:o.value)?void 0:e.disabled.value))}));return{group:o,isInGroup:a,modelValue:c,toggle:v,unselectable:f,multiple:m,modifiers:g,disabled:b,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);l({$el:e.computed((()=>{var e;return null==(e=L.value)?void 0:e.$el}))});const V=e.computed((()=>b.value?Array.isArray(m.value)?U(B.value,m.value):F(B.value,m.value):a.pressed)),C=y("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==f?void 0:f.value)&&!r.default)})))),{hasIcon:w}=G(v),A=e.computed((()=>void 0!==a.value?a.value:B.value)),$=()=>{if(b.value){if(Array.isArray(m.value))return U(A.value,m.value)?void(k.value&&(m.value=m.value.filter((e=>e!==A.value)))):void m.value.push(A.value);if(A.value===m.value&&k.value)return void(m.value=a.uncheckedValue);m.value=A.value}};return(t,l)=>(e.openBlock(),e.createBlock(D,e.mergeProps({disabled:e.unref(g),pressed:e.unref(V),active:t.active,type:t.type,to:t.to,href:t.href,target:t.target,rel:t.rel,ariaLabel:t.ariaLabel},{id:e.unref(S),ref_key:"element",ref:L,class:e.unref(C),onClick:$}),{default:e.withCtx((()=>[e.createCommentVNode(" @slot Default slot "),e.renderSlot(t.$slots,"default",{},(()=>[e.createCommentVNode(" #region loading "),t.loading?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createCommentVNode(" @slot Slot for loading content "),e.renderSlot(t.$slots,"loading",{},(()=>[t.loadingIcon?(e.openBlock(),e.createBlock(h,{key:0,class:"vv-button__loading-icon",name:t.loadingIcon},null,8,["name"])):e.createCommentVNode("v-if",!0),t.loadingLabel?(e.openBlock(),e.createElementBlock("span",J,e.toDisplayString(t.loadingLabel),1)):e.createCommentVNode("v-if",!0)]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createCommentVNode(" #endregion "),e.createCommentVNode(" #region button "),e.createCommentVNode(" @slot Before label and icon "),e.renderSlot(t.$slots,"before"),e.unref(w)?(e.openBlock(),e.createBlock(h,e.mergeProps({key:0},e.unref(w),{class:"vv-button__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.unref(f)?(e.openBlock(),e.createElementBlock("span",K,[e.createCommentVNode(" @slot Use this slot for button label "),e.renderSlot(t.$slots,"label",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)),1)]))])):e.createCommentVNode("v-if",!0),e.createCommentVNode(" @slot After label and icon "),e.renderSlot(t.$slots,"after")],64)),e.createCommentVNode(" #endregion ")]))])),_:3},16,["id","class"]))}});function W(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const X={...E,..._,...S,...B,...N,...$,...L,...O,...x,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},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"],te={class:"vv-input-file__wrapper"},le=["id","readonly","placeholder","aria-describedby","aria-invalid","aria-errormessage","multiple","accept","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(l,{emit:o}){const a=l,n=o,r=e.useSlots(),i=function(t,l,o){const a=b(),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const n=a[o];if(l[o]=n,o in e){if(Array.isArray(t[o])){const a=t[o];a.length&&a[0]===n&&(l[o]=e[o])}if("function"==typeof t[o]&&(0,t[o])()===n&&(l[o]=e[o]),"object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(l[o]=e[o]):a===n&&(l[o]=e[o])}}return l}),{})}))}("VvInputFile",X,a),{modifiers:u,id:d,readonly:s,icon:c,iconPosition:v,iconDownload:f}=e.toRefs(a),p=H(d),m=e.computed((()=>`${p.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(f),L=y("vv-input-file",u,e.computed((()=>({dragging:j.value,loading:a.loading&&!g.value,valid:!0===a.valid,invalid:!0===a.invalid,"icon-before":!!k.value,"icon-after":!!S.value,"drop-area":N.value})))),{HintSlot:V,hasHintLabelOrSlot:C,hasInvalidLabelOrSlot:w,hintSlotScope:A}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),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&&(l.loading||r.value)))),d=e.computed((()=>!u.value&&Boolean(o.value.invalid&&(l.invalid||a.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(o.value.valid&&(l.valid||n.value)))),c=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||i.value))),v=e.computed((()=>d.value||s.value||u.value||c.value)),f=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),p=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 t,l,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==(l=(t=this.$slots).loading)?void 0:l.call(t))??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:f,HintSlot:p}}(i,r),$=t.useVModel(a,"modelValue",n),O=e.computed((()=>{var e;return $.value&&(Array.isArray($.value)||(null==(e=$.value)?void 0:e.name))?Array.isArray($.value)?$.value:[$.value]:[]})),_=e.computed((()=>"string"==typeof a.max?parseInt(a.max):a.max)),N=e.computed((()=>a.dropArea&&!s.value)),x=e.computed((()=>!!a.multiple&&(!_.value||_.value-O.value.length>1))),j=e.ref(!1),R=e.ref(),E=()=>{j.value=!0},P=()=>{j.value=!1},I=e=>{var t,l;(null==(t=e.dataTransfer)?void 0:t.files)&&(j.value=!1,F(null==(l=e.dataTransfer)?void 0:l.files))},D=()=>{var e;(null==(e=R.value)?void 0:e.files)&&(F(R.value.files),R.value.value="")},F=e=>{if(!a.multiple)return Array.isArray($.value)?void($.value=[...e]):void($.value=e[0]);let t=[];t=!Array.isArray($.value)&&$.value?[$.value]:$.value&&Array.isArray($.value)?[...$.value]:t;for(const l of e){if(_.value&&t.length>=_.value)break;t.push(l)}$.value=t,z.value=t.length-1},M=()=>{R.value&&(s.value||R.value.click())},z=e.ref(0),U=["image/jpeg","image/png"],T=e.computed((()=>{if(0===O.value.length)return;if(O.value[z.value]instanceof File){const e=O.value[z.value];if(!U.includes(e.type))return;return URL.createObjectURL(e)}const e=O.value[z.value];return e.thumbnailUrl?e.thumbnailUrl:U.includes(e.type)?e.url:void 0}));e.watch(T,((e,t)=>{t&&URL.revokeObjectURL(t)})),e.onBeforeUnmount((()=>{T.value&&URL.revokeObjectURL(T.value)}));const q=e=>{if(e)return Math.floor(e/1024)},J=e.computed((()=>0===O.value.length||x.value?a.labelAdd:a.labelReplace)),K=e.computed((()=>0===O.value.length||x.value?a.iconAdd:a.iconReplace));return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(L))},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(p)},e.toDisplayString(t.label),9,Y)):e.createCommentVNode("v-if",!0),N.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"vv-input-file__drop-area",onDragenter:e.withModifiers(E,["prevent","stop"]),onDragleave:e.withModifiers(P,["prevent","stop"]),onDrop:e.withModifiers(I,["prevent","stop"]),onDragover:l[0]||(l[0]=e.withModifiers((()=>{}),["prevent","stop"])),onClick:e.withModifiers(M,["stop"])},[e.renderSlot(t.$slots,"drop-area",{},(()=>[e.createElementVNode("picture",Z,[T.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:T.value,alt:O.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:T.value?void 0:J.value,title:T.value?J.value:void 0,class:e.normalizeClass({"vv-input-file__drop-area-action":T.value}),icon:K.value,onClick:e.withModifiers(M,["stop"])},null,8,["label","title","class","icon"]))]))],32)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",te,[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(p),ref_key:"inputEl",ref:R,type:"file",readonly:e.unref(s),placeholder:t.placeholder,"aria-describedby":e.unref(C)?m.value:void 0,"aria-invalid":t.invalid,"aria-errormessage":e.unref(w)?m.value:void 0,multiple:x.value,accept:t.accept,name:t.name,onChange:D},null,40,le),g.value?(e.openBlock(),e.createElementBlock("progress",{key:1,class:"vv-input-file__progress",value:t.progress,max:"100"},e.toDisplayString(t.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(O.value,((l,o)=>(e.openBlock(),e.createElementBlock("li",{key:o,class:e.normalizeClass(["vv-input-file__item",{active:o===z.value&&N.value&&O.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:t.labelDownload,onClick:e.withModifiers((e=>(e=>{const t=document.createElement("a");e instanceof File?t.href=URL.createObjectURL(e):e.url&&(t.href=e.url),t.setAttribute("download",e.name),document.body.appendChild(t),t.click(),document.body.removeChild(t),URL.revokeObjectURL(t.href)})(l)),["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(l.name),1),e.createElementVNode("small",ue,e.toDisplayString(q(l.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:t.labelRemove,onClick:e.withModifiers((e=>(e=>{if(!Array.isArray($.value))return void($.value=void 0);const t=[...$.value];t.splice(e,1),$.value=t})(o)),["stop"])},null,8,de))],10,ne)))),128))]),e.createVNode(e.unref(V),{id:m.value,class:"vv-input-file__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(A))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(A))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(A))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(A))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));