@volverjs/ui-vue 0.0.10-beta.2 → 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 (258) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +98 -3
  3. package/auto-imports.d.ts +6 -2
  4. package/bin/icons.cjs +1 -1
  5. package/bin/icons.js +23 -16
  6. package/dist/Volver.d.ts +1 -1
  7. package/dist/components/VvAccordion/VvAccordion.es.js +70 -14
  8. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  9. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +13 -6
  10. package/dist/components/VvAccordion/index.d.ts +4 -1
  11. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +117 -38
  12. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  13. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -8
  14. package/dist/components/VvAccordionGroup/index.d.ts +4 -1
  15. package/dist/components/VvAction/VvAction.es.js +58 -13
  16. package/dist/components/VvAction/VvAction.umd.js +1 -1
  17. package/dist/components/VvAction/VvAction.vue.d.ts +59 -12
  18. package/dist/components/VvAction/index.d.ts +25 -4
  19. package/dist/components/VvAlert/VvAlert.es.js +195 -152
  20. package/dist/components/VvAlert/VvAlert.umd.js +1 -1
  21. package/dist/components/VvAlert/VvAlert.vue.d.ts +18 -8
  22. package/dist/components/VvAlert/index.d.ts +9 -5
  23. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +240 -174
  24. package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
  25. package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +13 -6
  26. package/dist/components/VvAlertGroup/index.d.ts +6 -2
  27. package/dist/components/VvAvatar/VvAvatar.es.js +54 -9
  28. package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
  29. package/dist/components/VvAvatar/VvAvatar.vue.d.ts +12 -4
  30. package/dist/components/VvAvatar/index.d.ts +4 -1
  31. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +111 -36
  32. package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
  33. package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +10 -3
  34. package/dist/components/VvAvatarGroup/index.d.ts +4 -1
  35. package/dist/components/VvBadge/VvBadge.es.js +73 -17
  36. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  37. package/dist/components/VvBadge/VvBadge.vue.d.ts +12 -4
  38. package/dist/components/VvBadge/index.d.ts +4 -1
  39. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +259 -49
  40. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  41. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +27 -7
  42. package/dist/components/VvBreadcrumb/index.d.ts +6 -10
  43. package/dist/components/VvButton/VvButton.es.js +187 -141
  44. package/dist/components/VvButton/VvButton.umd.js +1 -1
  45. package/dist/components/VvButton/VvButton.vue.d.ts +101 -27
  46. package/dist/components/VvButton/index.d.ts +41 -14
  47. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +69 -16
  48. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  49. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +23 -10
  50. package/dist/components/VvButtonGroup/index.d.ts +8 -2
  51. package/dist/components/VvCard/VvCard.es.js +84 -25
  52. package/dist/components/VvCard/VvCard.umd.js +1 -1
  53. package/dist/components/VvCard/VvCard.vue.d.ts +12 -4
  54. package/dist/components/VvCard/index.d.ts +4 -1
  55. package/dist/components/VvCheckbox/VvCheckbox.es.js +91 -22
  56. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  57. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +104 -32
  58. package/dist/components/VvCheckbox/index.d.ts +45 -12
  59. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +180 -67
  60. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  61. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +100 -29
  62. package/dist/components/VvCheckboxGroup/index.d.ts +45 -12
  63. package/dist/components/VvCombobox/VvCombobox.es.js +758 -531
  64. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  65. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +181 -108
  66. package/dist/components/VvCombobox/index.d.ts +53 -22
  67. package/dist/components/VvDialog/VvDialog.es.js +136 -141
  68. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  69. package/dist/components/VvDialog/VvDialog.vue.d.ts +4 -4
  70. package/dist/components/VvDropdown/VvDropdown.es.js +121 -55
  71. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  72. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +101 -75
  73. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +72 -11
  74. package/dist/components/VvDropdown/VvDropdownItem.vue.d.ts +1 -1
  75. package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +12 -4
  76. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +26 -7
  77. package/dist/components/VvDropdown/index.d.ts +16 -11
  78. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +82 -22
  79. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  80. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +13 -7
  81. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +56 -8
  82. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
  83. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +76 -17
  84. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
  85. package/dist/components/VvIcon/VvIcon.es.js +23 -96
  86. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  87. package/dist/components/VvIcon/VvIcon.vue.d.ts +23 -66
  88. package/dist/components/VvIcon/index.d.ts +33 -48
  89. package/dist/components/VvInputFile/VvInputFile.es.js +1734 -0
  90. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -0
  91. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +313 -0
  92. package/dist/components/VvInputFile/index.d.ts +179 -0
  93. package/dist/components/VvInputText/VvInputClearAction.d.ts +7 -5
  94. package/dist/components/VvInputText/VvInputPasswordAction.d.ts +10 -8
  95. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  96. package/dist/components/VvInputText/VvInputText.es.js +331 -293
  97. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  98. package/dist/components/VvInputText/VvInputText.vue.d.ts +162 -55
  99. package/dist/components/VvInputText/index.d.ts +71 -29
  100. package/dist/components/VvNav/VvNav.es.js +151 -73
  101. package/dist/components/VvNav/VvNav.umd.js +1 -1
  102. package/dist/components/VvNav/VvNav.vue.d.ts +41 -14
  103. package/dist/components/VvNav/VvNavItem.vue.d.ts +9 -0
  104. package/dist/components/VvNav/VvNavSeparator.vue.d.ts +2 -0
  105. package/dist/components/VvNav/index.d.ts +5 -13
  106. package/dist/components/VvNavItem/VvNavItem.es.js +436 -0
  107. package/dist/components/VvNavItem/VvNavItem.umd.js +1 -0
  108. package/dist/components/VvNavSeparator/VvNavSeparator.es.js +24 -0
  109. package/dist/components/VvNavSeparator/VvNavSeparator.umd.js +1 -0
  110. package/dist/components/VvProgress/VvProgress.es.js +65 -14
  111. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  112. package/dist/components/VvProgress/VvProgress.vue.d.ts +10 -3
  113. package/dist/components/VvProgress/index.d.ts +4 -1
  114. package/dist/components/VvRadio/VvRadio.es.js +89 -21
  115. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  116. package/dist/components/VvRadio/VvRadio.vue.d.ts +102 -30
  117. package/dist/components/VvRadio/index.d.ts +44 -11
  118. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +180 -66
  119. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  120. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +100 -29
  121. package/dist/components/VvRadioGroup/index.d.ts +45 -12
  122. package/dist/components/VvSelect/VvSelect.es.js +248 -226
  123. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  124. package/dist/components/VvSelect/VvSelect.vue.d.ts +112 -39
  125. package/dist/components/VvSelect/index.d.ts +48 -14
  126. package/dist/components/VvTab/VvTab.es.js +256 -110
  127. package/dist/components/VvTab/VvTab.umd.js +1 -1
  128. package/dist/components/VvTab/VvTab.vue.d.ts +50 -13
  129. package/dist/components/VvTab/index.d.ts +13 -4
  130. package/dist/components/VvTextarea/VvTextarea.es.js +229 -212
  131. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  132. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +155 -48
  133. package/dist/components/VvTextarea/index.d.ts +68 -19
  134. package/dist/components/VvTooltip/VvTooltip.es.js +72 -17
  135. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  136. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +10 -3
  137. package/dist/components/VvTooltip/index.d.ts +4 -1
  138. package/dist/components/common/HintSlot.d.ts +1 -1
  139. package/dist/components/index.d.ts +10 -0
  140. package/dist/components/index.es.js +2902 -1329
  141. package/dist/components/index.umd.js +1 -1
  142. package/dist/composables/alert/useAlert.d.ts +37 -4
  143. package/dist/composables/dropdown/useProvideDropdown.d.ts +1 -1
  144. package/dist/composables/index.d.ts +1 -0
  145. package/dist/composables/index.es.js +88 -1
  146. package/dist/composables/index.umd.js +1 -1
  147. package/dist/composables/useBlurhash.d.ts +7 -0
  148. package/dist/composables/useComponentIcon.d.ts +9 -8
  149. package/dist/composables/useVolver.d.ts +1 -1
  150. package/dist/directives/index.d.ts +3 -5
  151. package/dist/directives/index.es.js +92 -31
  152. package/dist/directives/index.umd.js +1 -1
  153. package/dist/directives/v-tooltip.es.js +90 -26
  154. package/dist/directives/v-tooltip.umd.js +1 -1
  155. package/dist/icons.es.js +210 -210
  156. package/dist/icons.umd.js +1 -1
  157. package/dist/index.d.ts +3 -1
  158. package/dist/index.es.js +81 -16
  159. package/dist/index.umd.js +1 -1
  160. package/dist/props/index.d.ts +287 -73
  161. package/dist/resolvers/unplugin.d.ts +6 -1
  162. package/dist/resolvers/unplugin.es.js +78 -10
  163. package/dist/resolvers/unplugin.umd.js +1 -1
  164. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +72 -84
  165. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +623 -461
  166. package/dist/stories/AlertGroup/AlertGroupWithComposable.stories.d.ts +1 -1
  167. package/dist/stories/Blurhash/BlurhashComposable.stories.d.ts +4 -0
  168. package/dist/stories/Combobox/Combobox.settings.d.ts +8 -0
  169. package/dist/stories/Icon/Icon.settings.d.ts +1 -0
  170. package/dist/stories/InputFile/InputFile.settings.d.ts +56 -0
  171. package/dist/stories/InputFile/InputFile.stories.d.ts +12 -0
  172. package/dist/stories/InputFile/InputFileDropArea.stories.d.ts +9 -0
  173. package/dist/stories/InputFile/InputFileIconPosition.stories.d.ts +8 -0
  174. package/dist/stories/InputFile/InputFileSlots.stories.d.ts +7 -0
  175. package/dist/stories/Tab/Tab.settings.d.ts +4 -37
  176. package/dist/types/alert.d.ts +13 -0
  177. package/dist/types/blurhash.d.ts +12 -0
  178. package/dist/types/floating-ui.d.ts +6 -0
  179. package/dist/types/generic.d.ts +4 -0
  180. package/dist/types/group.d.ts +37 -0
  181. package/dist/types/index.d.ts +7 -0
  182. package/dist/types/input-file.d.ts +16 -0
  183. package/dist/types/nav.d.ts +18 -0
  184. package/dist/utils/ObjectUtilities.d.ts +0 -1
  185. package/dist/workers/blurhash.d.ts +1 -0
  186. package/package.json +97 -80
  187. package/src/Volver.ts +31 -20
  188. package/src/assets/icons/detailed.json +1 -1
  189. package/src/assets/icons/normal.json +1 -1
  190. package/src/assets/icons/simple.json +1 -1
  191. package/src/components/VvAccordion/VvAccordion.vue +2 -2
  192. package/src/components/VvAction/VvAction.vue +5 -2
  193. package/src/components/VvAlert/index.ts +1 -3
  194. package/src/components/VvAlertGroup/index.ts +2 -1
  195. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +20 -19
  196. package/src/components/VvBreadcrumb/index.ts +2 -8
  197. package/src/components/VvButton/VvButton.vue +6 -6
  198. package/src/components/VvButton/index.ts +2 -4
  199. package/src/components/VvCombobox/VvCombobox.vue +24 -16
  200. package/src/components/VvCombobox/index.ts +4 -0
  201. package/src/components/VvIcon/VvIcon.vue +2 -2
  202. package/src/components/VvIcon/index.ts +35 -48
  203. package/src/components/VvInputFile/VvInputFile.vue +365 -0
  204. package/src/components/VvInputFile/index.ts +116 -0
  205. package/src/components/VvInputText/VvInputClearAction.ts +10 -6
  206. package/src/components/VvInputText/VvInputPasswordAction.ts +13 -9
  207. package/src/components/VvInputText/VvInputText.vue +17 -18
  208. package/src/components/VvInputText/index.ts +7 -15
  209. package/src/components/VvNav/VvNav.vue +30 -50
  210. package/src/components/VvNav/VvNavItem.vue +18 -0
  211. package/src/components/VvNav/VvNavSeparator.vue +11 -0
  212. package/src/components/VvNav/index.ts +2 -15
  213. package/src/components/VvSelect/VvSelect.vue +5 -8
  214. package/src/components/VvTab/VvTab.vue +63 -35
  215. package/src/components/VvTab/index.ts +10 -4
  216. package/src/components/VvTextarea/VvTextarea.vue +6 -9
  217. package/src/components/index.ts +10 -0
  218. package/src/composables/index.ts +1 -0
  219. package/src/composables/useBlurhash.ts +76 -0
  220. package/src/composables/useComponentIcon.ts +15 -14
  221. package/src/composables/useUniqueId.ts +2 -2
  222. package/src/directives/index.ts +3 -6
  223. package/src/directives/v-tooltip.ts +19 -10
  224. package/src/index.ts +3 -1
  225. package/src/props/index.ts +115 -27
  226. package/src/resolvers/unplugin.ts +24 -14
  227. package/src/stories/AlertGroup/AlertGroupWithComposable.stories.ts +2 -2
  228. package/src/stories/Blurhash/BlurhashComposable.stories.ts +195 -0
  229. package/src/stories/Combobox/Combobox.settings.ts +8 -0
  230. package/src/stories/Icon/Icon.settings.ts +3 -3
  231. package/src/stories/InputFile/InputFile.settings.ts +36 -0
  232. package/src/stories/InputFile/InputFile.stories.ts +89 -0
  233. package/src/stories/InputFile/InputFileDropArea.stories.ts +56 -0
  234. package/src/stories/InputFile/InputFileIconPosition.stories.ts +43 -0
  235. package/src/stories/InputFile/InputFileSlots.stories.ts +33 -0
  236. package/src/stories/Nav/Nav.settings.ts +3 -4
  237. package/src/stories/Nav/Nav.test.ts +4 -15
  238. package/src/stories/Tab/Tab.settings.ts +9 -9
  239. package/src/stories/Tab/Tab.stories.ts +2 -2
  240. package/src/stories/Tab/Tab.test.ts +6 -14
  241. package/src/stories/argTypes.ts +1 -1
  242. package/src/types/blurhash.ts +21 -0
  243. package/src/types/generic.ts +6 -0
  244. package/src/types/index.ts +7 -0
  245. package/src/types/input-file.ts +18 -0
  246. package/src/types/nav.ts +20 -0
  247. package/src/utils/ObjectUtilities.ts +0 -11
  248. package/src/workers/blurhash.ts +9 -0
  249. package/dist/components/VvNav/VvNavItemTitle.vue.d.ts +0 -6
  250. package/dist/components/VvNav/VvNavSeparator.d.ts +0 -2
  251. package/dist/components/VvNavItemTitle/VvNavItemTitle.es.js +0 -19
  252. package/dist/components/VvNavItemTitle/VvNavItemTitle.umd.js +0 -1
  253. package/src/components/VvNav/VvNavItemTitle.vue +0 -11
  254. package/src/components/VvNav/VvNavSeparator.ts +0 -8
  255. package/src/types/generic.d.ts +0 -6
  256. /package/src/types/{alert.d.ts → alert.ts} +0 -0
  257. /package/src/types/{floating-ui.d.ts → floating-ui.ts} +0 -0
  258. /package/src/types/{group.d.ts → group.ts} +0 -0
@@ -0,0 +1,1734 @@
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
+ import { useVModel } from "@vueuse/core";
3
+ import { iconExists, Icon, addIcon } from "@iconify/vue";
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
+ };
17
+ const VvIconPropsDefaults = {
18
+ prefix: "normal"
19
+ /* normal */
20
+ };
21
+ var Strategy = /* @__PURE__ */ ((Strategy2) => {
22
+ Strategy2["absolute"] = "absolute";
23
+ Strategy2["fixed"] = "fixed";
24
+ return Strategy2;
25
+ })(Strategy || {});
26
+ var Side = /* @__PURE__ */ ((Side2) => {
27
+ Side2["left"] = "left";
28
+ Side2["right"] = "right";
29
+ Side2["top"] = "top";
30
+ Side2["bottom"] = "bottom";
31
+ return Side2;
32
+ })(Side || {});
33
+ var Placement = /* @__PURE__ */ ((Placement2) => {
34
+ Placement2["topStart"] = "top-start";
35
+ Placement2["topEnd"] = "top-end";
36
+ Placement2["bottomStart"] = "bottom-start";
37
+ Placement2["bottomEnd"] = "bottom-end";
38
+ Placement2["leftStart"] = "left-start";
39
+ Placement2["leftEnd"] = "left-end";
40
+ Placement2["rightStart"] = "right-start";
41
+ Placement2["rightEnd"] = "right-end";
42
+ return Placement2;
43
+ })(Placement || {});
44
+ var Position = /* @__PURE__ */ ((Position2) => {
45
+ Position2["before"] = "before";
46
+ Position2["after"] = "after";
47
+ return Position2;
48
+ })(Position || {});
49
+ var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
50
+ ButtonType2["button"] = "button";
51
+ ButtonType2["submit"] = "submit";
52
+ ButtonType2["reset"] = "reset";
53
+ return ButtonType2;
54
+ })(ButtonType || {});
55
+ var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
56
+ ActionTag2["nuxtLink"] = "nuxt-link";
57
+ ActionTag2["routerLink"] = "router-link";
58
+ ActionTag2["a"] = "a";
59
+ ActionTag2["button"] = "button";
60
+ return ActionTag2;
61
+ })(ActionTag || {});
62
+ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
63
+ AnchorTarget2["_blank"] = "_blank";
64
+ AnchorTarget2["_self"] = "_self";
65
+ AnchorTarget2["_parent"] = "_parent";
66
+ AnchorTarget2["_top"] = "_top";
67
+ return AnchorTarget2;
68
+ })(AnchorTarget || {});
69
+ const INJECTION_KEY_VOLVER = Symbol.for("volver");
70
+ const INJECTION_KEY_BUTTON_GROUP = Symbol.for("buttonGroup");
71
+ const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for(
72
+ "dropdownTrigger"
73
+ );
74
+ const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for(
75
+ "dropdownAction"
76
+ );
77
+ function useVolver() {
78
+ return inject(INJECTION_KEY_VOLVER);
79
+ }
80
+ function useModifiers(prefix, modifiers, others) {
81
+ return computed(() => {
82
+ const toReturn = {
83
+ [prefix]: true
84
+ };
85
+ const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
86
+ if (modifiersArray) {
87
+ if (Array.isArray(modifiersArray)) {
88
+ modifiersArray.forEach((modifier) => {
89
+ if (modifier) {
90
+ toReturn[`${prefix}--${modifier}`] = true;
91
+ }
92
+ });
93
+ }
94
+ }
95
+ if (others) {
96
+ Object.keys(others.value).forEach((key) => {
97
+ toReturn[`${prefix}--${key}`] = unref(others.value[key]);
98
+ });
99
+ }
100
+ return toReturn;
101
+ });
102
+ }
103
+ const __default__$3 = {
104
+ name: "VvIcon"
105
+ };
106
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
107
+ ...__default__$3,
108
+ props: /* @__PURE__ */ mergeDefaults({
109
+ name: {},
110
+ color: {},
111
+ width: {},
112
+ height: {},
113
+ provider: {},
114
+ prefix: {},
115
+ src: {},
116
+ horizontalFlip: { type: Boolean },
117
+ verticalFlip: { type: Boolean },
118
+ flip: {},
119
+ mode: {},
120
+ inline: { type: Boolean },
121
+ rotate: {},
122
+ onLoad: { type: Function },
123
+ svg: {},
124
+ modifiers: {}
125
+ }, VvIconPropsDefaults),
126
+ setup(__props) {
127
+ const props = __props;
128
+ const hasRotate = computed(() => {
129
+ if (typeof props.rotate === "string") {
130
+ return parseFloat(props.rotate);
131
+ }
132
+ return props.rotate;
133
+ });
134
+ const show = ref(true);
135
+ const volver = useVolver();
136
+ const { modifiers } = toRefs(props);
137
+ const bemCssClasses = useModifiers("vv-icon", modifiers);
138
+ const provider = computed(() => {
139
+ return props.provider || (volver == null ? void 0 : volver.iconsProvider);
140
+ });
141
+ const icon = computed(() => {
142
+ const name = props.name ?? "";
143
+ const iconName = `@${provider.value}:${props.prefix}:${name}`;
144
+ if (iconExists(iconName)) {
145
+ return iconName;
146
+ }
147
+ const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
148
+ (iconsCollection2) => {
149
+ const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
150
+ return iconExists(icon2);
151
+ }
152
+ );
153
+ if (iconsCollection) {
154
+ return `@${provider.value}:${iconsCollection.prefix}:${name}`;
155
+ }
156
+ return name;
157
+ });
158
+ function getSvgContent(svg) {
159
+ let dom;
160
+ if (typeof window === "undefined") {
161
+ const { JSDOM } = require("jsdom");
162
+ dom = new JSDOM().window;
163
+ }
164
+ const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
165
+ const svgDomString = domParser.parseFromString(svg, "text/html");
166
+ const svgEl = svgDomString.querySelector("svg");
167
+ return svgEl;
168
+ }
169
+ function addIconFromSvg(svg) {
170
+ const svgContentEl = getSvgContent(svg);
171
+ const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
172
+ if (svgContentEl && svgContent) {
173
+ addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
174
+ body: svgContent,
175
+ // Set height and width from svg content
176
+ height: svgContentEl.viewBox.baseVal.height,
177
+ width: svgContentEl.viewBox.baseVal.width
178
+ });
179
+ }
180
+ }
181
+ if (volver) {
182
+ if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
183
+ show.value = false;
184
+ volver.fetchIcon(props.src).then((svg) => {
185
+ if (svg) {
186
+ addIconFromSvg(svg);
187
+ show.value = true;
188
+ }
189
+ }).catch((e) => {
190
+ throw new Error(`Error during fetch icon: ${e == null ? void 0 : e.message}`);
191
+ });
192
+ }
193
+ }
194
+ if (props.svg) {
195
+ addIconFromSvg(props.svg);
196
+ }
197
+ return (_ctx, _cache) => {
198
+ return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
199
+ key: 0,
200
+ class: unref(bemCssClasses)
201
+ }, {
202
+ inline: _ctx.inline,
203
+ width: _ctx.width,
204
+ height: _ctx.height,
205
+ horizontalFlip: _ctx.horizontalFlip,
206
+ verticalFlip: _ctx.verticalFlip,
207
+ flip: _ctx.flip,
208
+ rotate: unref(hasRotate),
209
+ color: _ctx.color,
210
+ onLoad: _ctx.onLoad,
211
+ icon: unref(icon)
212
+ }), null, 16, ["class"])) : createCommentVNode("v-if", true);
213
+ };
214
+ }
215
+ });
216
+ const LinkProps = {
217
+ /**
218
+ * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
219
+ * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
220
+ */
221
+ to: {
222
+ type: [String, Object]
223
+ },
224
+ /**
225
+ * Anchor href
226
+ */
227
+ href: String,
228
+ /**
229
+ * Anchor target
230
+ */
231
+ target: {
232
+ type: String,
233
+ default: void 0,
234
+ validator: (value) => Object.values(AnchorTarget).includes(value)
235
+ },
236
+ /**
237
+ * Anchor rel
238
+ */
239
+ rel: {
240
+ type: String,
241
+ default: "noopener noreferrer"
242
+ }
243
+ };
244
+ const ValidProps = {
245
+ /**
246
+ * Valid status
247
+ */
248
+ valid: { type: Boolean, default: false },
249
+ /**
250
+ * Valid label
251
+ */
252
+ validLabel: { type: [String, Array], default: void 0 }
253
+ };
254
+ const InvalidProps = {
255
+ /**
256
+ * Invalid status
257
+ */
258
+ invalid: {
259
+ type: Boolean,
260
+ default: false
261
+ },
262
+ /**
263
+ * Invalid label
264
+ */
265
+ invalidLabel: { type: [String, Array], default: void 0 }
266
+ };
267
+ const LoadingProps = {
268
+ /**
269
+ * Loading status
270
+ */
271
+ loading: {
272
+ type: Boolean,
273
+ default: false
274
+ },
275
+ /**
276
+ * Loading label
277
+ */
278
+ loadingLabel: {
279
+ type: String,
280
+ default: "Loading..."
281
+ }
282
+ };
283
+ const DisabledProps = {
284
+ /**
285
+ * Whether the form control is disabled
286
+ */
287
+ disabled: {
288
+ type: Boolean,
289
+ default: false
290
+ }
291
+ };
292
+ const ActiveProps = {
293
+ /**
294
+ * Whether the item is active
295
+ */
296
+ active: {
297
+ type: Boolean,
298
+ default: false
299
+ }
300
+ };
301
+ const CurrentProps = {
302
+ /**
303
+ * Whether the item is current
304
+ */
305
+ current: {
306
+ type: Boolean,
307
+ default: false
308
+ }
309
+ };
310
+ const PressedProps = {
311
+ /**
312
+ * Whether the item is pressed
313
+ */
314
+ pressed: {
315
+ type: Boolean,
316
+ default: false
317
+ }
318
+ };
319
+ const LabelProps = {
320
+ /**
321
+ * The item label
322
+ */
323
+ label: {
324
+ type: [String, Number],
325
+ default: void 0
326
+ }
327
+ };
328
+ const ReadonlyProps = {
329
+ /**
330
+ * The value is not editable
331
+ */
332
+ readonly: {
333
+ type: Boolean,
334
+ default: false
335
+ }
336
+ };
337
+ const ModifiersProps = {
338
+ /**
339
+ * Component BEM modifiers
340
+ */
341
+ modifiers: {
342
+ type: [String, Array],
343
+ default: void 0
344
+ }
345
+ };
346
+ const HintProps = {
347
+ hintLabel: { type: String, default: "" }
348
+ };
349
+ const IconProps = {
350
+ /**
351
+ * VvIcon name or props
352
+ * @see VVIcon
353
+ */
354
+ icon: {
355
+ type: [String, Object],
356
+ default: void 0
357
+ },
358
+ /**
359
+ * VvIcon position
360
+ */
361
+ iconPosition: {
362
+ type: String,
363
+ default: Position.before,
364
+ validation: (value) => Object.values(Position).includes(value)
365
+ }
366
+ };
367
+ const UnselectableProps = {
368
+ /**
369
+ * If true the input will be unselectable
370
+ */
371
+ unselectable: { type: Boolean, default: true }
372
+ };
373
+ const IdProps = {
374
+ /**
375
+ * Global attribute id
376
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
377
+ */
378
+ id: [String, Number]
379
+ };
380
+ ({
381
+ /**
382
+ * Dropdown placement
383
+ */
384
+ placement: {
385
+ type: String,
386
+ default: Side.bottom,
387
+ validator: (value) => Object.values(Side).includes(value) || Object.values(Placement).includes(value)
388
+ },
389
+ /**
390
+ * Dropdown strategy
391
+ */
392
+ strategy: {
393
+ type: String,
394
+ default: void 0,
395
+ validator: (value) => Object.values(Strategy).includes(value)
396
+ },
397
+ /**
398
+ * Dropdown show / hide transition name
399
+ */
400
+ transitionName: {
401
+ type: String,
402
+ default: void 0
403
+ },
404
+ /**
405
+ * Offset of the dropdown from the trigger
406
+ * @see https://floating-ui.com/docs/offset
407
+ */
408
+ offset: {
409
+ type: [Number, String, Object],
410
+ default: 0
411
+ },
412
+ /**
413
+ * Move dropdown to the side if there is no space in the default position
414
+ * @see https://floating-ui.com/docs/shift
415
+ */
416
+ shift: {
417
+ type: [Boolean, Object],
418
+ default: false
419
+ },
420
+ /**
421
+ * Flip dropdown position if there is no space in the default position
422
+ * @see https://floating-ui.com/docs/flip
423
+ */
424
+ flip: {
425
+ type: [Boolean, Object],
426
+ default: true
427
+ },
428
+ /**
429
+ * Size of the dropdown
430
+ * @see https://floating-ui.com/docs/size
431
+ */
432
+ size: {
433
+ type: [Boolean, Object],
434
+ default: () => ({ padding: 10 })
435
+ },
436
+ /**
437
+ * Automatically change the position of the dropdown
438
+ * @see https://floating-ui.com/docs/autoPlacement
439
+ */
440
+ autoPlacement: {
441
+ type: [Boolean, Object],
442
+ default: false
443
+ },
444
+ /**
445
+ * Add arrow to the dropdown
446
+ * @see https://floating-ui.com/docs/arrow
447
+ */
448
+ arrow: {
449
+ type: Boolean,
450
+ default: false
451
+ },
452
+ /**
453
+ * Keep open dropdown on click outside
454
+ */
455
+ keepOpen: {
456
+ type: Boolean,
457
+ default: false
458
+ },
459
+ /**
460
+ * Autofocus first item on dropdown open
461
+ */
462
+ autofocusFirst: {
463
+ type: Boolean,
464
+ default: true
465
+ },
466
+ /**
467
+ * Set dropdown width to the same as the trigger
468
+ */
469
+ triggerWidth: {
470
+ type: Boolean,
471
+ default: false
472
+ }
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
+ };
483
+ const ActionProps = {
484
+ ...DisabledProps,
485
+ ...LabelProps,
486
+ ...PressedProps,
487
+ ...ActiveProps,
488
+ ...CurrentProps,
489
+ ...LinkProps,
490
+ /**
491
+ * Button type
492
+ */
493
+ type: {
494
+ type: String,
495
+ default: ButtonType.button,
496
+ validator: (value) => Object.values(ButtonType).includes(value)
497
+ },
498
+ /**
499
+ * Button aria-label
500
+ */
501
+ ariaLabel: {
502
+ type: String,
503
+ default: void 0
504
+ },
505
+ /**
506
+ * Default tag for the action
507
+ */
508
+ defaultTag: {
509
+ type: String,
510
+ default: ActionTag.button
511
+ }
512
+ };
513
+ const VvActionEvents = ["click", "mouseover", "mouseleave"];
514
+ const VvActionProps = ActionProps;
515
+ function useInjectedDropdownTrigger() {
516
+ return inject(INJECTION_KEY_DROPDOWN_TRIGGER, {});
517
+ }
518
+ function useInjectedDropdownAction() {
519
+ return inject(INJECTION_KEY_DROPDOWN_ACTION, {});
520
+ }
521
+ const __default__$2 = {
522
+ name: "VvAction"
523
+ };
524
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
525
+ ...__default__$2,
526
+ props: VvActionProps,
527
+ emits: VvActionEvents,
528
+ setup(__props, { expose: __expose, emit: __emit }) {
529
+ const props = __props;
530
+ const emit = __emit;
531
+ const volver = useVolver();
532
+ const element = ref(null);
533
+ __expose({ $el: element });
534
+ const {
535
+ reference: dropdownTriggerReference,
536
+ bus: dropdownEventBus,
537
+ aria: dropdownAria,
538
+ expanded: dropdownExpanded
539
+ } = useInjectedDropdownTrigger();
540
+ watch(
541
+ () => element.value,
542
+ (newValue) => {
543
+ if (dropdownTriggerReference) {
544
+ dropdownTriggerReference.value = newValue;
545
+ }
546
+ }
547
+ );
548
+ const pressed = computed(() => {
549
+ return props.pressed || (dropdownExpanded == null ? void 0 : dropdownExpanded.value);
550
+ });
551
+ const { role } = useInjectedDropdownAction();
552
+ const hasTag = computed(() => {
553
+ switch (true) {
554
+ case props.disabled:
555
+ return ActionTag.button;
556
+ case props.to !== void 0:
557
+ return (volver == null ? void 0 : volver.nuxt) ? ActionTag.nuxtLink : ActionTag.routerLink;
558
+ case props.href !== void 0:
559
+ return ActionTag.a;
560
+ default:
561
+ return props.defaultTag;
562
+ }
563
+ });
564
+ const hasProps = computed(() => {
565
+ const toReturn = {
566
+ ...dropdownAria == null ? void 0 : dropdownAria.value,
567
+ ariaPressed: pressed.value ? true : void 0,
568
+ ariaLabel: props.ariaLabel,
569
+ role: role == null ? void 0 : role.value
570
+ };
571
+ switch (hasTag.value) {
572
+ case ActionTag.a:
573
+ return {
574
+ ...toReturn,
575
+ href: props.href,
576
+ target: props.target,
577
+ rel: props.rel
578
+ };
579
+ case ActionTag.routerLink:
580
+ case ActionTag.nuxtLink:
581
+ return {
582
+ ...toReturn,
583
+ to: props.to,
584
+ target: props.target
585
+ };
586
+ case ActionTag.button:
587
+ return {
588
+ ...toReturn,
589
+ type: props.type,
590
+ disabled: props.disabled
591
+ };
592
+ default:
593
+ return toReturn;
594
+ }
595
+ });
596
+ const onClick = (e) => {
597
+ if (props.disabled) {
598
+ e.preventDefault();
599
+ return;
600
+ }
601
+ dropdownEventBus == null ? void 0 : dropdownEventBus.emit("click", e);
602
+ emit("click", e);
603
+ };
604
+ const onMouseover = (e) => {
605
+ dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseover", e);
606
+ emit("mouseover", e);
607
+ };
608
+ const onMouseleave = (e) => {
609
+ dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseleave", e);
610
+ emit("mouseleave", e);
611
+ };
612
+ return (_ctx, _cache) => {
613
+ return openBlock(), createBlock(resolveDynamicComponent(unref(hasTag)), mergeProps(unref(hasProps), {
614
+ ref_key: "element",
615
+ ref: element,
616
+ class: {
617
+ active: _ctx.active,
618
+ pressed: unref(pressed),
619
+ disabled: _ctx.disabled,
620
+ current: _ctx.current
621
+ },
622
+ onClickPassive: onClick,
623
+ onMouseoverPassive: onMouseover,
624
+ onMouseleavePassive: onMouseleave
625
+ }), {
626
+ default: withCtx(() => [
627
+ createCommentVNode(" @slot Default slot "),
628
+ renderSlot(_ctx.$slots, "default", {}, () => [
629
+ createTextVNode(
630
+ toDisplayString(_ctx.label),
631
+ 1
632
+ /* TEXT */
633
+ )
634
+ ])
635
+ ]),
636
+ _: 3
637
+ /* FORWARDED */
638
+ }, 16, ["class"]);
639
+ };
640
+ }
641
+ });
642
+ function equals(obj1, obj2, field) {
643
+ if (field) {
644
+ return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
645
+ }
646
+ return deepEquals(obj1, obj2);
647
+ }
648
+ function deepEquals(a, b) {
649
+ if (a === b)
650
+ return true;
651
+ if (a && b && typeof a == "object" && typeof b == "object") {
652
+ const arrA = Array.isArray(a);
653
+ const arrB = Array.isArray(b);
654
+ let i, length, key;
655
+ if (arrA && arrB) {
656
+ length = a.length;
657
+ if (length != b.length)
658
+ return false;
659
+ for (i = length; i-- !== 0; )
660
+ if (!deepEquals(a[i], b[i]))
661
+ return false;
662
+ return true;
663
+ }
664
+ if (arrA != arrB)
665
+ return false;
666
+ const dateA = a instanceof Date, dateB = b instanceof Date;
667
+ if (dateA != dateB)
668
+ return false;
669
+ if (dateA && dateB)
670
+ return a.getTime() == b.getTime();
671
+ const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
672
+ if (regexpA != regexpB)
673
+ return false;
674
+ if (regexpA && regexpB)
675
+ return a.toString() == b.toString();
676
+ const keys = Object.keys(a);
677
+ length = keys.length;
678
+ if (length !== Object.keys(b).length)
679
+ return false;
680
+ for (i = length; i-- !== 0; )
681
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
682
+ return false;
683
+ for (i = length; i-- !== 0; ) {
684
+ key = keys[i];
685
+ if (!deepEquals(a[key], b[key]))
686
+ return false;
687
+ }
688
+ return true;
689
+ }
690
+ return a !== a && b !== b;
691
+ }
692
+ function resolveFieldData(data, field) {
693
+ if (data && Object.keys(data).length && field) {
694
+ if (field.indexOf(".") === -1) {
695
+ return data[field];
696
+ } else {
697
+ const fields = field.split(".");
698
+ let value = data;
699
+ for (let i = 0, len = fields.length; i < len; ++i) {
700
+ if (data == null) {
701
+ return null;
702
+ }
703
+ value = value[fields[i]];
704
+ }
705
+ return value;
706
+ }
707
+ } else {
708
+ return null;
709
+ }
710
+ }
711
+ function contains(value, list) {
712
+ if (value != null && list && list.length) {
713
+ for (const val of list) {
714
+ if (equals(value, val)) {
715
+ return true;
716
+ }
717
+ }
718
+ }
719
+ return false;
720
+ }
721
+ function isEmpty(value) {
722
+ 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));
723
+ }
724
+ function isString(value) {
725
+ return typeof value === "string" || value instanceof String;
726
+ }
727
+ function useInjectedGroupState(groupKey) {
728
+ const group = inject(groupKey, void 0);
729
+ const isInGroup = computed(() => !isEmpty(group));
730
+ function getGroupOrLocalRef(propName, props, emit) {
731
+ if (group == null ? void 0 : group.value) {
732
+ const groupPropValue = unref(group.value)[propName];
733
+ return computed({
734
+ get() {
735
+ return groupPropValue == null ? void 0 : groupPropValue.value;
736
+ },
737
+ set(value) {
738
+ groupPropValue.value = value;
739
+ }
740
+ });
741
+ }
742
+ const propRef = toRef(props, propName);
743
+ return computed({
744
+ get() {
745
+ return propRef.value;
746
+ },
747
+ set(value) {
748
+ if (emit)
749
+ emit(`update:${propName}`, value);
750
+ }
751
+ });
752
+ }
753
+ return {
754
+ group,
755
+ isInGroup,
756
+ getGroupOrLocalRef
757
+ };
758
+ }
759
+ const VvButtonEvents = ["update:modelValue"];
760
+ const VvButtonProps = {
761
+ ...ActionProps,
762
+ ...IdProps,
763
+ ...ModifiersProps,
764
+ ...UnselectableProps,
765
+ ...LoadingProps,
766
+ ...IconProps,
767
+ /**
768
+ * Button icon position
769
+ */
770
+ iconPosition: {
771
+ type: String,
772
+ default: Side.left,
773
+ validator: (value) => Object.values(Side).includes(value)
774
+ },
775
+ /**
776
+ * Loading icon
777
+ */
778
+ loadingIcon: { type: String, default: "eos-icons:bubble-loading" },
779
+ /**
780
+ * Enable button toggle
781
+ */
782
+ toggle: {
783
+ type: Boolean,
784
+ default: false
785
+ },
786
+ /**
787
+ * Button toggle value
788
+ */
789
+ value: {
790
+ type: [String, Number, Boolean],
791
+ default: void 0
792
+ },
793
+ /**
794
+ * Value associated with the unchecked state
795
+ */
796
+ uncheckedValue: {
797
+ type: [String, Number, Boolean],
798
+ default: void 0
799
+ },
800
+ /**
801
+ * Button toggle model value
802
+ */
803
+ modelValue: {
804
+ type: [String, Number, Boolean],
805
+ default: void 0
806
+ }
807
+ };
808
+ function useGroupProps(props, emit) {
809
+ const { group, isInGroup, getGroupOrLocalRef } = useInjectedGroupState(INJECTION_KEY_BUTTON_GROUP);
810
+ const { id, iconPosition, icon, label, pressed } = toRefs(props);
811
+ const modelValue = getGroupOrLocalRef("modelValue", props, emit);
812
+ const toggle = getGroupOrLocalRef("toggle", props);
813
+ const unselectable = getGroupOrLocalRef(
814
+ "unselectable",
815
+ props
816
+ );
817
+ const multiple = computed(() => (group == null ? void 0 : group.value.multiple.value) ?? false);
818
+ const modifiers = computed(() => {
819
+ let localModifiers = props.modifiers;
820
+ let groupModifiers = group == null ? void 0 : group.value.modifiers.value;
821
+ const toReturn = /* @__PURE__ */ new Set();
822
+ if (localModifiers) {
823
+ if (!Array.isArray(localModifiers)) {
824
+ localModifiers = localModifiers.split(" ");
825
+ }
826
+ localModifiers.forEach((modifier) => toReturn.add(modifier));
827
+ }
828
+ if (groupModifiers) {
829
+ if (!Array.isArray(groupModifiers)) {
830
+ groupModifiers = groupModifiers.split(" ");
831
+ }
832
+ groupModifiers.forEach((modifier) => toReturn.add(modifier));
833
+ }
834
+ return Array.from(toReturn);
835
+ });
836
+ const disabled = computed(
837
+ () => {
838
+ var _a;
839
+ return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
840
+ }
841
+ );
842
+ return {
843
+ // group props
844
+ group,
845
+ isInGroup,
846
+ modelValue,
847
+ toggle,
848
+ unselectable,
849
+ multiple,
850
+ modifiers,
851
+ disabled,
852
+ // local props
853
+ id,
854
+ pressed,
855
+ iconPosition,
856
+ icon,
857
+ label
858
+ };
859
+ }
860
+ const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || uid()));
861
+ function useComponentIcon(icon, iconPosition) {
862
+ const hasIcon = computed(() => {
863
+ if (typeof (icon == null ? void 0 : icon.value) === "string") {
864
+ return { name: icon == null ? void 0 : icon.value };
865
+ }
866
+ return icon == null ? void 0 : icon.value;
867
+ });
868
+ const hasIconBefore = computed(
869
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Position.before ? hasIcon.value : void 0
870
+ );
871
+ const hasIconAfter = computed(
872
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Position.after ? hasIcon.value : void 0
873
+ );
874
+ const hasIconLeft = computed(
875
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Side.left ? hasIcon.value : void 0
876
+ );
877
+ const hasIconRight = computed(
878
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Side.right ? hasIcon.value : void 0
879
+ );
880
+ const hasIconTop = computed(
881
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Side.top ? hasIcon.value : void 0
882
+ );
883
+ const hasIconBottom = computed(
884
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Side.bottom ? hasIcon.value : void 0
885
+ );
886
+ return {
887
+ hasIcon,
888
+ hasIconLeft,
889
+ hasIconRight,
890
+ hasIconTop,
891
+ hasIconBottom,
892
+ hasIconBefore,
893
+ hasIconAfter
894
+ };
895
+ }
896
+ const _hoisted_1$1 = {
897
+ key: 1,
898
+ class: "vv-button__label"
899
+ };
900
+ const _hoisted_2$1 = {
901
+ key: 1,
902
+ class: "vv-button__label"
903
+ };
904
+ const __default__$1 = {
905
+ name: "VvButton"
906
+ };
907
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
908
+ ...__default__$1,
909
+ props: VvButtonProps,
910
+ emits: VvButtonEvents,
911
+ setup(__props, { expose: __expose, emit: __emit }) {
912
+ const props = __props;
913
+ const attrs = useAttrs();
914
+ const slots = useSlots();
915
+ const emit = __emit;
916
+ const {
917
+ id,
918
+ modifiers,
919
+ iconPosition,
920
+ icon,
921
+ label,
922
+ modelValue,
923
+ disabled,
924
+ toggle,
925
+ unselectable
926
+ } = useGroupProps(props, emit);
927
+ const hasId = useUniqueId(id);
928
+ const name = computed(() => (attrs == null ? void 0 : attrs.name) || hasId.value);
929
+ const element = ref(null);
930
+ const $el = computed(() => {
931
+ var _a;
932
+ return (_a = element.value) == null ? void 0 : _a.$el;
933
+ });
934
+ __expose({ $el });
935
+ const pressed = computed(() => {
936
+ if (!toggle.value) {
937
+ return props.pressed;
938
+ }
939
+ if (Array.isArray(modelValue.value)) {
940
+ return contains(name.value, modelValue.value);
941
+ }
942
+ return equals(name.value, modelValue.value);
943
+ });
944
+ const bemCssClasses = useModifiers(
945
+ "vv-button",
946
+ modifiers,
947
+ computed(() => ({
948
+ reverse: [Side.right, Side.bottom].includes(
949
+ iconPosition.value
950
+ ),
951
+ column: [Side.top, Side.bottom].includes(
952
+ iconPosition.value
953
+ ),
954
+ "icon-only": Boolean(
955
+ (icon == null ? void 0 : icon.value) && !(label == null ? void 0 : label.value) && !slots.default
956
+ )
957
+ }))
958
+ );
959
+ const { hasIcon } = useComponentIcon(icon);
960
+ const toggleValue = computed(() => {
961
+ return props.value !== void 0 ? props.value : name.value;
962
+ });
963
+ const onClick = () => {
964
+ if (toggle.value) {
965
+ if (Array.isArray(modelValue.value)) {
966
+ if (contains(toggleValue.value, modelValue.value)) {
967
+ if (unselectable.value) {
968
+ modelValue.value = modelValue.value.filter(
969
+ (n) => n !== toggleValue.value
970
+ );
971
+ }
972
+ return;
973
+ }
974
+ modelValue.value.push(toggleValue.value);
975
+ return;
976
+ }
977
+ if (toggleValue.value === modelValue.value && unselectable.value) {
978
+ modelValue.value = props.uncheckedValue;
979
+ return;
980
+ }
981
+ modelValue.value = toggleValue.value;
982
+ }
983
+ };
984
+ return (_ctx, _cache) => {
985
+ return openBlock(), createBlock(_sfc_main$2, mergeProps({
986
+ disabled: unref(disabled),
987
+ pressed: unref(pressed),
988
+ active: _ctx.active,
989
+ type: _ctx.type,
990
+ to: _ctx.to,
991
+ href: _ctx.href,
992
+ target: _ctx.target,
993
+ rel: _ctx.rel,
994
+ ariaLabel: _ctx.ariaLabel
995
+ }, {
996
+ id: unref(hasId),
997
+ ref_key: "element",
998
+ ref: element,
999
+ class: unref(bemCssClasses),
1000
+ onClick
1001
+ }), {
1002
+ default: withCtx(() => [
1003
+ createCommentVNode(" @slot Default slot "),
1004
+ renderSlot(_ctx.$slots, "default", {}, () => [
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(
1029
+ Fragment,
1030
+ { key: 1 },
1031
+ [
1032
+ createCommentVNode(" #endregion "),
1033
+ createCommentVNode(" #region button "),
1034
+ createCommentVNode(" @slot Before label and icon "),
1035
+ renderSlot(_ctx.$slots, "before"),
1036
+ unref(hasIcon) ? (openBlock(), createBlock(
1037
+ _sfc_main$3,
1038
+ mergeProps({ key: 0 }, unref(hasIcon), { class: "vv-button__icon" }),
1039
+ null,
1040
+ 16
1041
+ /* FULL_PROPS */
1042
+ )) : createCommentVNode("v-if", true),
1043
+ unref(label) ? (openBlock(), createElementBlock("span", _hoisted_2$1, [
1044
+ createCommentVNode(" @slot Use this slot for button label "),
1045
+ renderSlot(_ctx.$slots, "label", {}, () => [
1046
+ createTextVNode(
1047
+ toDisplayString(unref(label)),
1048
+ 1
1049
+ /* TEXT */
1050
+ )
1051
+ ])
1052
+ ])) : createCommentVNode("v-if", true),
1053
+ createCommentVNode(" @slot After label and icon "),
1054
+ renderSlot(_ctx.$slots, "after")
1055
+ ],
1056
+ 64
1057
+ /* STABLE_FRAGMENT */
1058
+ )),
1059
+ createCommentVNode(" #endregion ")
1060
+ ])
1061
+ ]),
1062
+ _: 3
1063
+ /* FORWARDED */
1064
+ }, 16, ["id", "class"]);
1065
+ };
1066
+ }
1067
+ });
1068
+ function joinLines(items) {
1069
+ if (Array.isArray(items)) {
1070
+ return items.filter((item) => isString(item)).join(" ");
1071
+ }
1072
+ return items;
1073
+ }
1074
+ function HintSlotFactory(propsOrRef, slots) {
1075
+ const props = computed(() => {
1076
+ if (isRef(propsOrRef)) {
1077
+ return propsOrRef.value;
1078
+ }
1079
+ return propsOrRef;
1080
+ });
1081
+ const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
1082
+ const validLabel = computed(() => joinLines(props.value.validLabel));
1083
+ const loadingLabel = computed(() => props.value.loadingLabel);
1084
+ const hintLabel = computed(() => props.value.hintLabel);
1085
+ const hasLoadingLabelOrSlot = computed(
1086
+ () => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
1087
+ );
1088
+ const hasInvalidLabelOrSlot = computed(
1089
+ () => !hasLoadingLabelOrSlot.value && Boolean(
1090
+ props.value.invalid && (slots.invalid || invalidLabel.value)
1091
+ )
1092
+ );
1093
+ const hasValidLabelOrSlot = computed(
1094
+ () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
1095
+ );
1096
+ const hasHintLabelOrSlot = computed(
1097
+ () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
1098
+ );
1099
+ const isVisible = computed(
1100
+ () => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
1101
+ );
1102
+ const hintSlotScope = computed(() => ({
1103
+ modelValue: props.value.modelValue,
1104
+ valid: props.value.valid,
1105
+ invalid: props.value.invalid,
1106
+ loading: props.value.loading
1107
+ }));
1108
+ const HintSlot = defineComponent({
1109
+ name: "HintSlot",
1110
+ props: {
1111
+ tag: {
1112
+ type: String,
1113
+ default: "small"
1114
+ }
1115
+ },
1116
+ setup() {
1117
+ return {
1118
+ isVisible,
1119
+ invalidLabel,
1120
+ validLabel,
1121
+ loadingLabel,
1122
+ hintLabel,
1123
+ hasInvalidLabelOrSlot,
1124
+ hasValidLabelOrSlot,
1125
+ hasLoadingLabelOrSlot,
1126
+ hasHintLabelOrSlot
1127
+ };
1128
+ },
1129
+ render() {
1130
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1131
+ if (this.isVisible) {
1132
+ let role;
1133
+ if (this.hasInvalidLabelOrSlot) {
1134
+ role = "alert";
1135
+ }
1136
+ if (this.hasValidLabelOrSlot) {
1137
+ role = "status";
1138
+ }
1139
+ if (this.hasLoadingLabelOrSlot) {
1140
+ return h(
1141
+ this.tag,
1142
+ {
1143
+ role
1144
+ },
1145
+ ((_b = (_a = this.$slots).loading) == null ? void 0 : _b.call(_a)) ?? this.loadingLabel
1146
+ );
1147
+ }
1148
+ if (this.hasInvalidLabelOrSlot) {
1149
+ return h(
1150
+ this.tag,
1151
+ {
1152
+ role
1153
+ },
1154
+ ((_d = (_c = this.$slots).invalid) == null ? void 0 : _d.call(_c)) ?? this.$slots.invalid ?? this.invalidLabel
1155
+ );
1156
+ }
1157
+ if (this.hasValidLabelOrSlot) {
1158
+ return h(
1159
+ this.tag,
1160
+ {
1161
+ role
1162
+ },
1163
+ ((_f = (_e = this.$slots).valid) == null ? void 0 : _f.call(_e)) ?? this.validLabel
1164
+ );
1165
+ }
1166
+ return h(
1167
+ this.tag,
1168
+ {
1169
+ role
1170
+ },
1171
+ ((_h = (_g = this.$slots).hint) == null ? void 0 : _h.call(_g)) ?? this.$slots.hint ?? this.hintLabel
1172
+ );
1173
+ }
1174
+ return null;
1175
+ }
1176
+ });
1177
+ return {
1178
+ hasInvalidLabelOrSlot,
1179
+ hasHintLabelOrSlot,
1180
+ hasValidLabelOrSlot,
1181
+ hasLoadingLabelOrSlot,
1182
+ hintSlotScope,
1183
+ HintSlot
1184
+ };
1185
+ }
1186
+ const VvInputFileProps = {
1187
+ ...IdNameProps,
1188
+ ...ModifiersProps,
1189
+ ...ValidProps,
1190
+ ...InvalidProps,
1191
+ ...HintProps,
1192
+ ...LabelProps,
1193
+ ...LoadingProps,
1194
+ ...ReadonlyProps,
1195
+ ...IconProps,
1196
+ /**
1197
+ * Input value
1198
+ */
1199
+ modelValue: {
1200
+ type: Object,
1201
+ required: true
1202
+ },
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
+ }
1283
+ };
1284
+ function useDefaults(componentName, propsDefinition, props) {
1285
+ const volver = useVolver();
1286
+ const volverComponentDefaults = computed(() => {
1287
+ var _a;
1288
+ if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
1289
+ return void 0;
1290
+ }
1291
+ return volver.defaults.value[componentName];
1292
+ });
1293
+ return computed(() => {
1294
+ if (volverComponentDefaults.value === void 0) {
1295
+ return props;
1296
+ }
1297
+ const componentDefaults = volverComponentDefaults.value;
1298
+ const simplifiedPropsDefinition = propsDefinition;
1299
+ const simplifiedProps = props;
1300
+ return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
1301
+ const propValue = simplifiedProps[key];
1302
+ acc[key] = propValue;
1303
+ if (key in componentDefaults) {
1304
+ if (Array.isArray(simplifiedPropsDefinition[key])) {
1305
+ const typeArray = simplifiedPropsDefinition[key];
1306
+ if (typeArray.length) {
1307
+ const typeFunction = typeArray[0];
1308
+ if (typeFunction === propValue) {
1309
+ acc[key] = componentDefaults[key];
1310
+ }
1311
+ }
1312
+ }
1313
+ if (typeof simplifiedPropsDefinition[key] === "function") {
1314
+ const typeFunction = simplifiedPropsDefinition[key];
1315
+ if (typeFunction() === propValue) {
1316
+ acc[key] = componentDefaults[key];
1317
+ }
1318
+ }
1319
+ if (typeof simplifiedPropsDefinition[key] === "object") {
1320
+ let defaultValue = simplifiedPropsDefinition[key].default;
1321
+ if (typeof defaultValue === "function") {
1322
+ defaultValue = defaultValue();
1323
+ }
1324
+ if (typeof defaultValue === "object") {
1325
+ if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
1326
+ acc[key] = componentDefaults[key];
1327
+ }
1328
+ } else if (defaultValue === propValue) {
1329
+ acc[key] = componentDefaults[key];
1330
+ }
1331
+ }
1332
+ }
1333
+ return acc;
1334
+ }, {});
1335
+ });
1336
+ }
1337
+ const _hoisted_1 = ["for"];
1338
+ const _hoisted_2 = { class: "vv-input-file__preview" };
1339
+ const _hoisted_3 = ["src", "alt"];
1340
+ const _hoisted_4 = { class: "vv-input-file__wrapper" };
1341
+ const _hoisted_5 = ["id", "readonly", "placeholder", "aria-describedby", "aria-invalid", "aria-errormessage", "multiple", "accept", "name"];
1342
+ const _hoisted_6 = ["value"];
1343
+ const _hoisted_7 = { class: "vv-input-file__list" };
1344
+ const _hoisted_8 = ["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"];
1349
+ const __default__ = {
1350
+ name: "VvInputFile"
1351
+ };
1352
+ const _sfc_main = /* @__PURE__ */ defineComponent({
1353
+ ...__default__,
1354
+ props: VvInputFileProps,
1355
+ emits: ["update:modelValue"],
1356
+ setup(__props, { emit: __emit }) {
1357
+ const props = __props;
1358
+ const emit = __emit;
1359
+ const slots = useSlots();
1360
+ const propsDefaults = useDefaults(
1361
+ "VvInputFile",
1362
+ VvInputFileProps,
1363
+ props
1364
+ );
1365
+ const { modifiers, id, readonly, icon, iconPosition, iconDownload } = toRefs(props);
1366
+ const hasId = useUniqueId(id);
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);
1377
+ const bemCssClasses = useModifiers(
1378
+ "vv-input-file",
1379
+ modifiers,
1380
+ computed(() => ({
1381
+ dragging: isDragging.value,
1382
+ loading: props.loading && !hasProgress.value,
1383
+ valid: props.valid === true,
1384
+ invalid: props.invalid === true,
1385
+ "icon-before": !!hasIconBefore.value,
1386
+ "icon-after": !!hasIconAfter.value,
1387
+ "drop-area": hasDropArea.value
1388
+ }))
1389
+ );
1390
+ const {
1391
+ HintSlot,
1392
+ hasHintLabelOrSlot,
1393
+ hasInvalidLabelOrSlot,
1394
+ hintSlotScope
1395
+ } = HintSlotFactory(propsDefaults, slots);
1396
+ const localModelValue = useVModel(props, "modelValue", emit);
1397
+ const files = computed(() => {
1398
+ var _a;
1399
+ if (!localModelValue.value || !Array.isArray(localModelValue.value) && !((_a = localModelValue.value) == null ? void 0 : _a.name)) {
1400
+ return [];
1401
+ }
1402
+ return Array.isArray(localModelValue.value) ? localModelValue.value : [localModelValue.value];
1403
+ });
1404
+ const hasMax = computed(() => {
1405
+ return typeof props.max === "string" ? parseInt(props.max) : props.max;
1406
+ });
1407
+ const hasDropArea = computed(() => {
1408
+ return props.dropArea && !readonly.value;
1409
+ });
1410
+ const isMultiple = computed(() => {
1411
+ if (!props.multiple) {
1412
+ return false;
1413
+ }
1414
+ if (!hasMax.value) {
1415
+ return true;
1416
+ }
1417
+ return hasMax.value - files.value.length > 1;
1418
+ });
1419
+ const isDragging = ref(false);
1420
+ const inputEl = ref();
1421
+ const onDragenter = () => {
1422
+ isDragging.value = true;
1423
+ };
1424
+ const onDragleave = () => {
1425
+ isDragging.value = false;
1426
+ };
1427
+ const onDrop = (event) => {
1428
+ var _a, _b;
1429
+ if (!((_a = event.dataTransfer) == null ? void 0 : _a.files)) {
1430
+ return;
1431
+ }
1432
+ isDragging.value = false;
1433
+ addFiles((_b = event.dataTransfer) == null ? void 0 : _b.files);
1434
+ };
1435
+ const onChange = () => {
1436
+ var _a;
1437
+ if (!((_a = inputEl.value) == null ? void 0 : _a.files)) {
1438
+ return;
1439
+ }
1440
+ addFiles(inputEl.value.files);
1441
+ inputEl.value.value = "";
1442
+ };
1443
+ const addFiles = (uploadedFiles) => {
1444
+ if (!props.multiple) {
1445
+ if (Array.isArray(localModelValue.value)) {
1446
+ localModelValue.value = [...uploadedFiles];
1447
+ return;
1448
+ }
1449
+ localModelValue.value = uploadedFiles[0];
1450
+ return;
1451
+ }
1452
+ let toReturn = [];
1453
+ if (!Array.isArray(localModelValue.value) && localModelValue.value) {
1454
+ toReturn = [localModelValue.value];
1455
+ } else {
1456
+ toReturn = localModelValue.value && Array.isArray(localModelValue.value) ? [...localModelValue.value] : toReturn;
1457
+ }
1458
+ for (const file of uploadedFiles) {
1459
+ if (hasMax.value && toReturn.length >= hasMax.value) {
1460
+ break;
1461
+ }
1462
+ toReturn.push(file);
1463
+ }
1464
+ localModelValue.value = toReturn;
1465
+ selectedFileIndex.value = toReturn.length - 1;
1466
+ };
1467
+ const onClickDropArea = () => {
1468
+ if (!inputEl.value) {
1469
+ return;
1470
+ }
1471
+ if (!readonly.value) {
1472
+ inputEl.value.click();
1473
+ }
1474
+ };
1475
+ const onClickRemoveFile = (index) => {
1476
+ if (!Array.isArray(localModelValue.value)) {
1477
+ localModelValue.value = void 0;
1478
+ return;
1479
+ }
1480
+ const toReturn = [...localModelValue.value];
1481
+ toReturn.splice(index, 1);
1482
+ localModelValue.value = toReturn;
1483
+ };
1484
+ const selectedFileIndex = ref(0);
1485
+ const PREVIEW_MIME_TYPES = ["image/jpeg", "image/png"];
1486
+ const previewSrc = computed(() => {
1487
+ if (files.value.length === 0) {
1488
+ return;
1489
+ }
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);
1509
+ }
1510
+ });
1511
+ onBeforeUnmount(() => {
1512
+ if (previewSrc.value) {
1513
+ URL.revokeObjectURL(previewSrc.value);
1514
+ }
1515
+ });
1516
+ const sizeInKiB = (size) => {
1517
+ if (!size) {
1518
+ return;
1519
+ }
1520
+ return Math.floor(size / 1024);
1521
+ };
1522
+ const onClickDownloadFile = (file) => {
1523
+ const link = document.createElement("a");
1524
+ if (file instanceof File) {
1525
+ link.href = URL.createObjectURL(file);
1526
+ } else if (file.url) {
1527
+ link.href = file.url;
1528
+ }
1529
+ link.setAttribute("download", file.name);
1530
+ document.body.appendChild(link);
1531
+ link.click();
1532
+ document.body.removeChild(link);
1533
+ URL.revokeObjectURL(link.href);
1534
+ };
1535
+ const onClickSelectFile = (index) => {
1536
+ selectedFileIndex.value = index;
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
+ });
1550
+ return (_ctx, _cache) => {
1551
+ return openBlock(), createElementBlock(
1552
+ "div",
1553
+ {
1554
+ class: normalizeClass(unref(bemCssClasses))
1555
+ },
1556
+ [
1557
+ _ctx.label ? (openBlock(), createElementBlock("label", {
1558
+ key: 0,
1559
+ for: unref(hasId)
1560
+ }, toDisplayString(_ctx.label), 9, _hoisted_1)) : createCommentVNode("v-if", true),
1561
+ hasDropArea.value ? (openBlock(), createElementBlock(
1562
+ "div",
1563
+ {
1564
+ key: 1,
1565
+ class: "vv-input-file__drop-area",
1566
+ onDragenter: withModifiers(onDragenter, ["prevent", "stop"]),
1567
+ onDragleave: withModifiers(onDragleave, ["prevent", "stop"]),
1568
+ onDrop: withModifiers(onDrop, ["prevent", "stop"]),
1569
+ onDragover: _cache[0] || (_cache[0] = withModifiers(() => {
1570
+ }, ["prevent", "stop"])),
1571
+ onClick: withModifiers(onClickDropArea, ["stop"])
1572
+ },
1573
+ [
1574
+ renderSlot(_ctx.$slots, "drop-area", {}, () => [
1575
+ createElementVNode("picture", _hoisted_2, [
1576
+ previewSrc.value ? (openBlock(), createElementBlock("img", {
1577
+ key: 0,
1578
+ src: previewSrc.value,
1579
+ alt: files.value[selectedFileIndex.value].name
1580
+ }, null, 8, _hoisted_3)) : createCommentVNode("v-if", true)
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)
1593
+ ])
1594
+ ],
1595
+ 32
1596
+ /* NEED_HYDRATION */
1597
+ )) : createCommentVNode("v-if", true),
1598
+ createElementVNode("div", _hoisted_4, [
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),
1606
+ createElementVNode("input", {
1607
+ id: unref(hasId),
1608
+ ref_key: "inputEl",
1609
+ ref: inputEl,
1610
+ type: "file",
1611
+ readonly: unref(readonly),
1612
+ placeholder: _ctx.placeholder,
1613
+ "aria-describedby": unref(hasHintLabelOrSlot) ? hasHintId.value : void 0,
1614
+ "aria-invalid": _ctx.invalid,
1615
+ "aria-errormessage": unref(hasInvalidLabelOrSlot) ? hasHintId.value : void 0,
1616
+ multiple: isMultiple.value,
1617
+ accept: _ctx.accept,
1618
+ name: _ctx.name,
1619
+ onChange
1620
+ }, null, 40, _hoisted_5),
1621
+ hasProgress.value ? (openBlock(), createElementBlock("progress", {
1622
+ key: 1,
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)
1634
+ ]),
1635
+ createElementVNode("ul", _hoisted_7, [
1636
+ (openBlock(true), createElementBlock(
1637
+ Fragment,
1638
+ null,
1639
+ renderList(files.value, (file, index) => {
1640
+ return openBlock(), createElementBlock("li", {
1641
+ key: index,
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"])
1646
+ }, [
1647
+ unref(hasIconDownload) ? (openBlock(), createElementBlock("button", {
1648
+ key: 0,
1649
+ type: "button",
1650
+ class: "vv-input-file__item-action",
1651
+ title: _ctx.labelDownload,
1652
+ onClick: withModifiers(($event) => onClickDownloadFile(file), ["stop"])
1653
+ }, [
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),
1662
+ createElementVNode(
1663
+ "div",
1664
+ _hoisted_10,
1665
+ toDisplayString(file.name),
1666
+ 1
1667
+ /* TEXT */
1668
+ ),
1669
+ createElementVNode(
1670
+ "small",
1671
+ _hoisted_11,
1672
+ toDisplayString(sizeInKiB(file.size)) + " KB ",
1673
+ 1
1674
+ /* TEXT */
1675
+ ),
1676
+ !unref(readonly) ? (openBlock(), createElementBlock("button", {
1677
+ key: 1,
1678
+ type: "button",
1679
+ class: "vv-input-file__item-remove",
1680
+ title: _ctx.labelRemove,
1681
+ onClick: withModifiers(($event) => onClickRemoveFile(index), ["stop"])
1682
+ }, null, 8, _hoisted_12)) : createCommentVNode("v-if", true)
1683
+ ], 10, _hoisted_8);
1684
+ }),
1685
+ 128
1686
+ /* KEYED_FRAGMENT */
1687
+ ))
1688
+ ]),
1689
+ createVNode(unref(HintSlot), {
1690
+ id: hasHintId.value,
1691
+ class: "vv-input-file__hint"
1692
+ }, createSlots({
1693
+ _: 2
1694
+ /* DYNAMIC */
1695
+ }, [
1696
+ _ctx.$slots.hint ? {
1697
+ name: "hint",
1698
+ fn: withCtx(() => [
1699
+ renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
1700
+ ]),
1701
+ key: "0"
1702
+ } : void 0,
1703
+ _ctx.$slots.loading ? {
1704
+ name: "loading",
1705
+ fn: withCtx(() => [
1706
+ renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
1707
+ ]),
1708
+ key: "1"
1709
+ } : void 0,
1710
+ _ctx.$slots.valid ? {
1711
+ name: "valid",
1712
+ fn: withCtx(() => [
1713
+ renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
1714
+ ]),
1715
+ key: "2"
1716
+ } : void 0,
1717
+ _ctx.$slots.invalid ? {
1718
+ name: "invalid",
1719
+ fn: withCtx(() => [
1720
+ renderSlot(_ctx.$slots, "invalid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
1721
+ ]),
1722
+ key: "3"
1723
+ } : void 0
1724
+ ]), 1032, ["id"])
1725
+ ],
1726
+ 2
1727
+ /* CLASS */
1728
+ );
1729
+ };
1730
+ }
1731
+ });
1732
+ export {
1733
+ _sfc_main as default
1734
+ };