@volverjs/ui-vue 0.0.3 → 0.0.5-beta.1

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 (236) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +54 -15
  3. package/auto-imports.d.ts +12 -3
  4. package/bin/icons.cjs +1 -73
  5. package/dist/Volver.d.ts +23 -11
  6. package/dist/components/VvAccordion/VvAccordion.es.js +180 -74
  7. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  8. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
  9. package/dist/components/VvAccordion/index.d.ts +8 -3
  10. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +280 -122
  11. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  12. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
  13. package/dist/components/VvAccordionGroup/index.d.ts +8 -0
  14. package/dist/components/VvAction/VvAction.es.js +338 -0
  15. package/dist/components/VvAction/VvAction.umd.js +1 -0
  16. package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
  17. package/dist/components/VvAction/index.d.ts +24 -0
  18. package/dist/components/VvBadge/VvBadge.es.js +251 -22
  19. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  20. package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
  21. package/dist/components/VvBadge/index.d.ts +1 -1
  22. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +280 -62
  23. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  24. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
  25. package/dist/components/VvBreadcrumb/index.d.ts +1 -1
  26. package/dist/components/VvButton/VvButton.es.js +720 -261
  27. package/dist/components/VvButton/VvButton.umd.js +1 -1
  28. package/dist/components/VvButton/VvButton.vue.d.ts +54 -54
  29. package/dist/components/VvButton/index.d.ts +30 -75
  30. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +296 -49
  31. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  32. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
  33. package/dist/components/VvButtonGroup/index.d.ts +1 -1
  34. package/dist/components/VvCard/VvCard.es.js +60 -28
  35. package/dist/components/VvCard/VvCard.umd.js +1 -1
  36. package/dist/components/VvCheckbox/VvCheckbox.es.js +630 -172
  37. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  38. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
  39. package/dist/components/VvCheckbox/index.d.ts +6 -6
  40. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +736 -228
  41. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  42. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +9 -9
  43. package/dist/components/VvCheckboxGroup/index.d.ts +4 -4
  44. package/dist/components/VvCombobox/VvCombobox.es.js +1673 -768
  45. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  46. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +159 -61
  47. package/dist/components/VvCombobox/index.d.ts +54 -23
  48. package/dist/components/VvDialog/VvDialog.es.js +426 -115
  49. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  50. package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
  51. package/dist/components/VvDialog/index.d.ts +4 -1
  52. package/dist/components/VvDropdown/VvDropdown.es.js +504 -190
  53. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  54. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +114 -42
  55. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
  56. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
  57. package/dist/components/VvDropdown/index.d.ts +35 -14
  58. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +454 -0
  59. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
  60. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +48 -18
  61. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  62. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +361 -0
  63. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
  64. package/dist/components/VvIcon/VvIcon.es.js +116 -52
  65. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  66. package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
  67. package/dist/components/VvIcon/index.d.ts +2 -2
  68. package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
  69. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  70. package/dist/components/VvInputText/VvInputText.es.js +1054 -376
  71. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  72. package/dist/components/VvInputText/VvInputText.vue.d.ts +107 -20
  73. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  74. package/dist/components/VvInputText/index.d.ts +67 -3
  75. package/dist/components/VvProgress/VvProgress.es.js +254 -23
  76. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  77. package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
  78. package/dist/components/VvProgress/index.d.ts +1 -1
  79. package/dist/components/VvRadio/VvRadio.es.js +568 -137
  80. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  81. package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
  82. package/dist/components/VvRadio/index.d.ts +6 -6
  83. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +674 -193
  84. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  85. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +9 -9
  86. package/dist/components/VvRadioGroup/index.d.ts +4 -4
  87. package/dist/components/VvSelect/VvSelect.es.js +703 -251
  88. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  89. package/dist/components/VvSelect/VvSelect.vue.d.ts +24 -17
  90. package/dist/components/VvSelect/index.d.ts +8 -8
  91. package/dist/components/VvTextarea/VvTextarea.es.js +747 -272
  92. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  93. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +21 -14
  94. package/dist/components/VvTextarea/index.d.ts +7 -7
  95. package/dist/components/VvTooltip/VvTooltip.es.js +252 -24
  96. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  97. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
  98. package/dist/components/VvTooltip/index.d.ts +2 -2
  99. package/dist/components/index.es.js +3676 -2007
  100. package/dist/components/index.umd.js +1 -1
  101. package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
  102. package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
  103. package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
  104. package/dist/composables/group/useProvideGroupState.d.ts +1 -1
  105. package/dist/composables/useComponentFocus.d.ts +1 -1
  106. package/dist/composables/useComponentIcon.d.ts +7 -7
  107. package/dist/composables/useDebouncedInput.d.ts +4 -1
  108. package/dist/composables/useDefaults.d.ts +2 -0
  109. package/dist/composables/useModifiers.d.ts +1 -1
  110. package/dist/composables/useOptions.d.ts +2 -2
  111. package/dist/composables/useTextCount.d.ts +3 -3
  112. package/dist/composables/useUniqueId.d.ts +1 -1
  113. package/dist/composables/useVolver.d.ts +1 -1
  114. package/dist/constants.d.ts +30 -0
  115. package/dist/directives/index.es.js +288 -0
  116. package/dist/directives/index.umd.js +1 -0
  117. package/dist/directives/v-tooltip.es.js +285 -0
  118. package/dist/directives/v-tooltip.umd.js +1 -0
  119. package/dist/icons.es.js +38 -23
  120. package/dist/icons.umd.js +1 -1
  121. package/dist/index.d.ts +0 -1
  122. package/dist/index.es.js +115 -3269
  123. package/dist/index.umd.js +1 -1
  124. package/dist/props/index.d.ts +215 -23
  125. package/dist/resolvers/unplugin.d.ts +14 -8
  126. package/dist/resolvers/unplugin.es.js +94 -33
  127. package/dist/resolvers/unplugin.umd.js +1 -1
  128. package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
  129. package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
  130. package/dist/stories/InputText/InputText.settings.d.ts +53 -0
  131. package/dist/stories/argTypes.d.ts +1 -1
  132. package/package.json +167 -63
  133. package/src/Volver.ts +60 -26
  134. package/src/assets/icons/detailed.json +1 -1
  135. package/src/assets/icons/normal.json +1 -1
  136. package/src/assets/icons/simple.json +1 -1
  137. package/src/components/VvAccordion/VvAccordion.vue +19 -22
  138. package/src/components/VvAccordion/index.ts +12 -4
  139. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
  140. package/src/components/VvAccordionGroup/index.ts +8 -0
  141. package/src/components/VvAction/VvAction.vue +144 -0
  142. package/src/components/VvAction/index.ts +5 -0
  143. package/src/components/VvBadge/VvBadge.vue +2 -2
  144. package/src/components/VvBadge/index.ts +1 -1
  145. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
  146. package/src/components/VvButton/VvButton.vue +41 -124
  147. package/src/components/VvButton/index.ts +16 -88
  148. package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
  149. package/src/components/VvButtonGroup/index.ts +1 -1
  150. package/src/components/VvCard/VvCard.vue +2 -2
  151. package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
  152. package/src/components/VvCheckbox/index.ts +11 -7
  153. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
  154. package/src/components/VvCheckboxGroup/index.ts +1 -1
  155. package/src/components/VvCombobox/VvCombobox.vue +85 -57
  156. package/src/components/VvCombobox/index.ts +12 -10
  157. package/src/components/VvDialog/VvDialog.vue +28 -11
  158. package/src/components/VvDialog/index.ts +5 -2
  159. package/src/components/VvDropdown/VvDropdown.vue +6 -5
  160. package/src/components/VvDropdown/VvDropdownAction.vue +46 -0
  161. package/src/components/VvDropdown/VvDropdownOption.vue +72 -0
  162. package/src/components/VvDropdown/index.ts +6 -11
  163. package/src/components/VvIcon/VvIcon.vue +3 -3
  164. package/src/components/VvIcon/index.ts +3 -3
  165. package/src/components/VvInputText/VvInputClearAction.ts +2 -2
  166. package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
  167. package/src/components/VvInputText/VvInputStepAction.ts +3 -2
  168. package/src/components/VvInputText/VvInputText.vue +128 -35
  169. package/src/components/VvInputText/VvInputTextActions.ts +5 -8
  170. package/src/components/VvInputText/index.ts +62 -1
  171. package/src/components/VvProgress/VvProgress.vue +2 -2
  172. package/src/components/VvProgress/index.ts +1 -1
  173. package/src/components/VvRadio/VvRadio.vue +3 -7
  174. package/src/components/VvRadio/index.ts +11 -7
  175. package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
  176. package/src/components/VvRadioGroup/index.ts +1 -1
  177. package/src/components/VvSelect/VvSelect.vue +4 -4
  178. package/src/components/VvSelect/index.ts +3 -5
  179. package/src/components/VvTextarea/VvTextarea.vue +4 -4
  180. package/src/components/VvTextarea/index.ts +1 -1
  181. package/src/components/VvTooltip/VvTooltip.vue +2 -2
  182. package/src/components/VvTooltip/index.ts +3 -3
  183. package/src/composables/dropdown/useInjectDropdown.ts +2 -2
  184. package/src/composables/dropdown/useProvideDropdown.ts +9 -11
  185. package/src/composables/group/useInjectedGroupState.ts +1 -1
  186. package/src/composables/group/useProvideGroupState.ts +1 -1
  187. package/src/composables/useComponentIcon.ts +1 -1
  188. package/src/composables/useDebouncedInput.ts +10 -3
  189. package/src/composables/useDefaults.ts +89 -0
  190. package/src/composables/useModifiers.ts +8 -9
  191. package/src/composables/useOptions.ts +1 -1
  192. package/src/composables/useVolver.ts +2 -2
  193. package/src/constants.ts +36 -0
  194. package/src/directives/index.ts +1 -1
  195. package/src/directives/v-tooltip.ts +2 -2
  196. package/src/index.ts +0 -2
  197. package/src/props/index.ts +111 -19
  198. package/src/resolvers/unplugin.ts +96 -49
  199. package/src/stories/Accordion/Accordion.stories.mdx +8 -2
  200. package/src/stories/Accordion/Accordion.test.ts +21 -15
  201. package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
  202. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
  203. package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
  204. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +3 -2
  205. package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
  206. package/src/stories/Button/Button.stories.mdx +4 -2
  207. package/src/stories/Button/Button.test.ts +3 -1
  208. package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
  209. package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
  210. package/src/stories/Button/ButtonState.stories.mdx +2 -11
  211. package/src/stories/Card/Card.stories.mdx +2 -1
  212. package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
  213. package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
  214. package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
  215. package/src/stories/Combobox/Combobox.settings.ts +44 -0
  216. package/src/stories/Combobox/Combobox.stories.mdx +40 -1
  217. package/src/stories/Dialog/Dialog.stories.mdx +2 -1
  218. package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
  219. package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
  220. package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
  221. package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
  222. package/src/stories/Icon/Icon.stories.mdx +2 -1
  223. package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
  224. package/src/stories/InputText/InputText.settings.ts +53 -0
  225. package/src/stories/InputText/InputText.stories.mdx +42 -1
  226. package/src/stories/InputText/InputText.test.ts +5 -2
  227. package/src/stories/Progress/Progress.stories.mdx +2 -1
  228. package/src/stories/Radio/Radio.stories.mdx +2 -1
  229. package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
  230. package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
  231. package/src/stories/Select/Select.stories.mdx +2 -1
  232. package/src/stories/Textarea/Textarea.stories.mdx +2 -1
  233. package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
  234. package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
  235. package/src/stories/argTypes.ts +2 -2
  236. package/src/types/group.d.ts +5 -0
package/dist/index.es.js CHANGED
@@ -1,3297 +1,143 @@
1
- var At = Object.defineProperty;
2
- var wt = (o, a, e) => a in o ? At(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e;
3
- var Ie = (o, a, e) => (wt(o, typeof a != "symbol" ? a + "" : a, e), e);
4
- import { addCollection as Et, addIcon as rt, addAPIProvider as It, iconExists as Re, Icon as Pt } from "@iconify/vue";
5
- import { defineComponent as q, openBlock as d, createElementBlock as y, normalizeClass as Z, unref as t, renderSlot as $, createTextVNode as X, toDisplayString as x, render as Ot, withModifiers as it, createElementVNode as N, normalizeProps as j, guardReactiveProps as F, Fragment as ne, renderList as ke, createBlock as W, mergeProps as G, withCtx as ve, resolveDynamicComponent as ut, createCommentVNode as w, withDirectives as Se, isRef as Ce, vModelCheckbox as Dt, createVNode as de, Transition as dt, normalizeStyle as Qe, vShow as qe, vModelSelect as Bt, createSlots as Rt, vModelText as ct, toHandlers as Tt, vModelDynamic as Mt, vModelRadio as xt } from "vue";
6
- import { nanoid as Nt } from "nanoid";
7
- import { autoPlacement as Ze, flip as et, shift as tt, size as ot, offset as Ge, arrow as Lt, useFloating as Ht, autoUpdate as Gt } from "@floating-ui/vue";
8
- const Ut = "vv";
9
- var be = /* @__PURE__ */ ((o) => (o.left = "left", o.right = "right", o.top = "top", o.bottom = "bottom", o))(be || {}), vt = /* @__PURE__ */ ((o) => (o.topStart = "top-start", o.topEnd = "top-end", o.bottomStart = "bottom-start", o.bottomEnd = "bottom-end", o.leftStart = "left-start", o.leftEnd = "left-end", o.rightStart = "right-start", o.rightEnd = "right-end", o))(vt || {}), je = /* @__PURE__ */ ((o) => (o.before = "before", o.after = "after", o))(je || {});
10
- const Wt = Symbol.for("volver"), pt = Symbol.for("buttonGroup"), ft = Symbol.for("radioGroup"), mt = Symbol.for("checkGroup"), bt = Symbol.for("accordionGroup"), Pe = {
11
- valid: Boolean,
12
- validLabel: [String, Array]
13
- }, Oe = {
14
- invalid: Boolean,
15
- invalidLabel: [String, Array]
16
- }, Ke = {
17
- loading: Boolean,
18
- loadingLabel: String
19
- }, Ae = {
20
- /**
21
- * Whether the form control is disabled
22
- */
23
- disabled: Boolean
24
- }, De = {
25
- /**
26
- * The value is not editable
27
- */
28
- readonly: Boolean
29
- }, ce = {
30
- /**
31
- * Component BEM modifiers
32
- */
33
- modifiers: [String, Array]
34
- }, Be = {
35
- hintLabel: { type: String, default: "" }
36
- }, ze = {
37
- /**
38
- * List of options, can be string[] or object[]
39
- */
40
- options: {
41
- type: Array,
42
- default: () => []
43
- },
44
- /**
45
- * Used when options are objects: key to use for option label
46
- */
47
- labelKey: { type: [String, Function], default: "label" },
48
- /**
49
- * Used when options are objects: key to use for option label
50
- */
51
- valueKey: { type: [String, Function], default: "value" },
52
- /**
53
- * Used when options are objects: key to use for option disabled
54
- */
55
- disabledKey: { type: [String, Function], default: "disabled" }
56
- }, jt = {
57
- /**
58
- * Show character limit
59
- */
60
- count: {
61
- type: [Boolean, String],
62
- default: !1,
63
- validator: (o) => [!0, !1, "limit", "countdown"].includes(o)
64
- }
65
- }, Ft = {
66
- /**
67
- * Milliseconds to wait before emitting the input event
68
- */
69
- debounce: [Number, String]
70
- }, Ye = {
71
- /**
72
- * VvIcon name or props
73
- * @see VVIcon
74
- */
75
- icon: { type: [String, Object] },
76
- /**
77
- * VvIcon position
78
- */
79
- iconPosition: {
80
- type: String,
81
- default: je.before,
82
- validation: (o) => Object.values(je).includes(o)
83
- }
84
- }, Me = {
85
- /**
86
- * Global attribute tabindex
87
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
88
- */
89
- tabindex: { type: [String, Number], default: 0 }
90
- }, Je = {
91
- /**
92
- * If true the label will be floating
93
- */
94
- floating: Boolean
95
- }, xe = {
96
- /**
97
- * If true the input will be unselectable
98
- */
99
- unselectable: { type: Boolean, default: !0 }
100
- }, Ne = {
101
- /**
102
- * Global attribute id
103
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
104
- */
105
- id: [String, Number]
106
- }, Fe = {
107
- /**
108
- * Dropdown placement
109
- */
110
- placement: {
111
- type: String,
112
- default: be.bottom,
113
- validator: (o) => Object.values(be).includes(o) || Object.values(vt).includes(o)
114
- },
115
- /**
116
- * Dropdown show / hide transition name
117
- */
118
- transitionName: {
119
- type: String
120
- },
121
- /**
122
- * Offset of the dropdown from the trigger
123
- * @see https://floating-ui.com/docs/offset
124
- */
125
- offset: {
126
- type: [Number, String, Object],
127
- default: 0
128
- },
129
- /**
130
- * Move dropdown to the side if there is no space in the default position
131
- * @see https://floating-ui.com/docs/shift
132
- */
133
- shift: {
134
- type: [Boolean, Object],
135
- default: !1
136
- },
137
- /**
138
- * Flip dropdown position if there is no space in the default position
139
- * @see https://floating-ui.com/docs/flip
140
- */
141
- flip: {
142
- type: [Boolean, Object],
143
- default: !0
144
- },
145
- /**
146
- * Size of the dropdown
147
- * @see https://floating-ui.com/docs/size
148
- */
149
- size: {
150
- type: [Boolean, Object],
151
- default: () => ({ padding: 10 })
152
- },
153
- /**
154
- * Automatically change the position of the dropdown
155
- * @see https://floating-ui.com/docs/autoPlacement
156
- */
157
- autoPlacement: {
158
- type: [Boolean, Object],
159
- default: !1
160
- },
161
- /**
162
- * Add arrow to the dropdown
163
- * @see https://floating-ui.com/docs/arrow
164
- */
165
- arrow: {
166
- type: Boolean,
167
- default: !1
168
- },
169
- /**
170
- * Close dropdown on click outside
171
- */
172
- autoClose: {
173
- type: Boolean,
174
- default: !0
175
- },
176
- /**
177
- * Autofocus first item on dropdown open
178
- */
179
- autofocusFirst: {
180
- type: Boolean,
181
- default: !0
182
- },
183
- /**
184
- * Set dropdown width to the same as the trigger
185
- */
186
- triggerWidth: {
187
- type: Boolean
188
- }
189
- }, Le = {
190
- ...Ne,
191
- /**
192
- * Input / Textarea name
193
- * Name of the form control. Submitted with the form as part of a name/value pair
194
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
195
- */
196
- name: { type: String, required: !0 }
197
- }, ht = {
198
- /**
199
- * Global attribute autofocus
200
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
201
- */
202
- autofocus: Boolean
203
- }, yt = {
204
- /**
205
- * Global attribute autocomplete
206
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
207
- */
208
- autocomplete: { type: String, default: "off" }
209
- }, gt = {
210
- ...Le,
211
- ...ht,
212
- ...yt,
213
- ...Me,
214
- ...Ae,
215
- ...De,
216
- ...Pe,
217
- ...Oe,
218
- ...Be,
219
- ...Ke,
220
- ...ce,
221
- ...jt,
222
- ...Ft,
223
- ...Ye,
224
- ...Je,
225
- /**
226
- * Input / Textarea minlength
227
- * Minimum length (number of characters) of value
228
- * Available for input types: text, search, url, tel, email, password
229
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength
230
- */
231
- minlength: Number,
232
- /**
233
- * Input / Textarea maxlength
234
- * Maximum length (number of characters) of value
235
- * Available for input types: text, search, url, tel, email, password
236
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength
237
- */
238
- maxlength: Number,
239
- /**
240
- * Input / Textarea placeholder
241
- * Text that appears in the form control when it has no value set
242
- * Available for input types: text, search, url, tel, email, password, number
243
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#placeholder
244
- */
245
- placeholder: String,
246
- /**
247
- * Input / Textarea required
248
- * A value is required or must be check for the form to be submittable
249
- * Available for all input types except color
250
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#required
251
- */
252
- required: Boolean,
253
- /**
254
- * <label> value for the Input / Textarea
255
- */
256
- label: String
257
- }, _t = {
258
- ...Le,
259
- ...Me,
260
- ...Pe,
261
- ...Oe,
262
- ...Be,
263
- ...Ae,
264
- ...De,
265
- ...ce,
266
- /**
267
- * Input value
268
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
269
- */
270
- value: [String, Number, Boolean],
271
- /**
272
- * Input value
273
- */
274
- modelValue: [Object, Number, Boolean, String],
275
- /**
276
- * <label> for input
277
- */
278
- label: String
279
- }, St = {
280
- ...Pe,
281
- ...Oe,
282
- ...ze,
283
- ...Be,
284
- ...Ae,
285
- ...De,
286
- ...ce,
287
- /**
288
- * Input value
289
- */
290
- modelValue: [String, Array],
291
- /**
292
- * Input label
293
- */
294
- label: String,
295
- /**
296
- * Input name
297
- */
298
- name: { type: String, required: !0 },
299
- /**
300
- * If true, the group will be displayed in a vertical column
301
- */
302
- vertical: Boolean
303
- }, qt = {
304
- ...ce,
305
- /**
306
- * Define the tooltip position
307
- * @default Side.bottom
308
- */
309
- position: {
310
- type: String,
311
- default: be.bottom
312
- },
313
- value: {
314
- type: String
315
- }
316
- }, Kt = /* @__PURE__ */ q({
317
- __name: "VvTooltip",
318
- props: qt,
319
- setup(o) {
320
- const a = o, { modifiers: e } = toRefs(a), s = useBemModifiers(
321
- "vv-tooltip",
322
- e,
323
- computed(() => ({
324
- [a.position]: !0
325
- }))
326
- );
327
- return (l, i) => (d(), y("span", {
328
- class: Z(t(s)),
329
- role: "tooltip",
330
- inert: ""
331
- }, [
332
- $(l.$slots, "default", {}, () => [
333
- X(x(l.value), 1)
334
- ])
335
- ], 2));
336
- }
337
- }), zt = {
338
- beforeMount(o, a) {
339
- const e = h(Kt, {
340
- value: a.value,
341
- position: a.arg
342
- });
343
- Ot(e, o);
344
- }
345
- }, Yt = {
346
- tooltip: zt
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
347
6
  };
348
- function at(o, a, e) {
349
- const s = e || o.name;
350
- if (!s)
351
- return o;
352
- const l = a == null ? void 0 : a[s], i = o.props;
353
- return !l || !i ? { ...o, name: s } : {
354
- ...o,
355
- name: s,
356
- props: Object.keys(i).reduce((u, c) => {
357
- if (!(c in l))
358
- return u[c] = i[c], u;
359
- const p = l[c];
360
- return typeof i[c] == "function" || Array.isArray(i[c]) ? (u[c] = {
361
- type: i[c],
362
- default: p
363
- }, u) : (u[c] = {
364
- ...i[c],
365
- default: p
366
- }, u);
367
- }, {})
368
- };
369
- }
370
- class Jt {
371
- constructor({
372
- fetchWithCredentials: a,
373
- fetchOptions: e,
374
- provider: s,
375
- nuxt: l,
376
- iconsCollections: i
377
- } = {}) {
378
- Ie(this, "fetchOptions", {});
379
- Ie(this, "nuxt", !1);
380
- Ie(this, "iconsCollections", []);
381
- Ie(this, "provider", Ut);
382
- e && (this.fetchOptions = e), a && (this.fetchOptions = { ...this.fetchOptions, credentials: "include" }), s && (this.provider = s), l && (this.nuxt = l), i && Array.isArray(i) && i.forEach((u) => {
383
- this.addCollection(u, this.provider);
384
- });
385
- }
386
- addCollection(a, e) {
387
- return this.iconsCollections = [...this.iconsCollections, a], Et(a, e ?? this.provider);
388
- }
389
- addIcon(a, e) {
390
- return rt(a, e);
391
- }
392
- addAPIProvider(a, e) {
393
- return It(a, e);
394
- }
395
- fetchIcon(a, e = { cache: "force-cache" }) {
396
- return new Promise((s, l) => {
397
- fetch(a, { ...this.fetchOptions, ...e }).catch((i) => l(i)).then((i) => i == null ? void 0 : i.text()).then((i) => s(i));
398
- });
399
- }
400
- }
401
- const pl = {
402
- /**
403
- * Vue.use() hook
404
- * @param {App} Vue
405
- * @param {Object} options
406
- */
407
- install(o, a) {
408
- const e = new Jt(a);
409
- o.config.globalProperties.$vv = e, a.components && Object.entries(a.components).forEach(([s, l]) => {
410
- o.component(
411
- s,
412
- at(l, a.defaults)
413
- );
414
- }), a.aliases && Object.entries(a.aliases).forEach(([s, l]) => {
415
- o.component(
416
- s,
417
- at(l, a.defaults, s)
418
- );
419
- }), Object.entries(Yt).forEach(([s, l]) => {
420
- o.directive(s, l);
421
- }), o.provide(Wt, e);
7
+ import { addCollection, addIcon, addAPIProvider } from "@iconify/vue";
8
+ import { ref } from "vue";
9
+ const DEFAULT_ICONIFY_PROVIDER = "vv";
10
+ const INJECTION_KEY_VOLVER = Symbol.for("volver");
11
+ function useDefaultProps(component, defaults, name) {
12
+ const componentName = name || component.name;
13
+ if (!componentName) {
14
+ return component;
15
+ }
16
+ const componentDefaults = defaults == null ? void 0 : defaults[componentName];
17
+ const props = component.props;
18
+ if (!componentDefaults || !props) {
19
+ return { ...component, name: componentName };
422
20
  }
423
- }, Xt = {
424
- /**
425
- * Accordion name
426
- */
427
- name: String,
428
- /**
429
- * Header title
430
- */
431
- title: String,
432
- /**
433
- * Content text
434
- */
435
- content: String,
436
- /**
437
- * (Optional) Defines if item is open. Event "update:modelValue" is emitted on accordion header click
438
- */
439
- modelValue: {
440
- type: Boolean,
441
- default: void 0
442
- },
443
- /**
444
- * String or String[] of css classes (modifiers) that will be concatenated to prefix 'vv-accordion--'
445
- */
446
- modifiers: [String, Array],
447
- /**
448
- * If true, the accordion will be disabled
449
- */
450
- disabled: Boolean
451
- }, Qt = ["update:modelValue"];
452
- function Zt(o, a) {
453
- const { group: e, isInGroup: s, getGroupOrLocalRef: l } = useInjectedGroupState(
454
- bt
455
- ), { title: i, content: u } = toRefs(o), c = l("modelValue", o, a), p = l("disabled", o), v = l("collapse", o), n = l("modifiers", o);
456
21
  return {
457
- // group props
458
- modelValue: c,
459
- disabled: p,
460
- isInGroup: s,
461
- group: e,
462
- collapse: v,
463
- modifiers: n,
464
- // local props
465
- title: i,
466
- content: u
467
- };
468
- }
469
- const eo = ["id", "open"], to = ["aria-controls", "aria-expanded"], oo = ["aria-hidden"], ao = {
470
- name: "VvAccordion"
471
- }, lo = /* @__PURE__ */ q({
472
- ...ao,
473
- props: Xt,
474
- emits: Qt,
475
- setup(o, { emit: a }) {
476
- const e = o, s = useAttrs(), l = computed(
477
- () => e.name || (s == null ? void 0 : s.id) || Nt()
478
- ), {
479
- modifiers: i,
480
- title: u,
481
- content: c,
482
- disabled: p,
483
- collapse: v,
484
- modelValue: n,
485
- isInGroup: r
486
- } = Zt(e, a), f = ref(!1), g = computed({
487
- get: () => r.value ? v.value && Array.isArray(n.value) ? n.value.includes(l.value) : n.value === l.value : n.value === void 0 ? f.value : n.value,
488
- set: (b) => {
489
- if (r.value) {
490
- if (v.value && Array.isArray(n.value)) {
491
- if (b) {
492
- n.value.push(l.value);
493
- return;
494
- }
495
- n.value = n.value.filter(
496
- (S) => S !== l.value
497
- );
498
- return;
499
- }
500
- n.value = b ? l.value : null;
501
- return;
502
- }
503
- if (n.value === void 0 && typeof b == "boolean") {
504
- f.value = b;
505
- return;
506
- }
507
- n.value = b;
508
- }
509
- }), k = useBemModifiers(
510
- "vv-accordion",
511
- i,
512
- computed(() => ({
513
- disabled: p.value
514
- }))
515
- ), A = useToggle(g);
516
- return (b, S) => (d(), y("details", {
517
- id: t(l),
518
- class: Z(t(k)),
519
- open: t(g),
520
- onClick: S[0] || (S[0] = it((I) => t(A)(), ["prevent"]))
521
- }, [
522
- N("summary", {
523
- "aria-controls": t(l),
524
- "aria-expanded": t(g),
525
- class: "vv-collapse__summary"
526
- }, [
527
- $(b.$slots, "summary", j(F({ open: t(g) })), () => [
528
- X(x(t(u)), 1)
529
- ])
530
- ], 8, to),
531
- N("div", {
532
- "aria-hidden": !t(g),
533
- class: "vv-collapse__content"
534
- }, [
535
- $(b.$slots, "details", j(F({ open: t(g) })), () => [
536
- X(x(t(c)), 1)
537
- ])
538
- ], 8, oo)
539
- ], 10, eo));
540
- }
541
- }), so = {
542
- /**
543
- * VModel
544
- */
545
- modelValue: [String, Array],
546
- /**
547
- * Accordion items
548
- * @type VvAccordionGroupItem
549
- */
550
- items: { type: Array, default: () => [] },
551
- /**
552
- * If true, accordion items stay open when another item is opened
553
- */
554
- collapse: Boolean,
555
- /**
556
- * String or String[] of css classes (modifiers) that will be concatenated to prefix 'vv-accordion-group--'
557
- */
558
- modifiers: [String, Array],
559
- /**
560
- * String or String[] of css classes (modifiers) that will be concatenated to prefix 'vv-accordion--'
561
- */
562
- itemModifiers: {
563
- type: [String, Array],
564
- default: ""
565
- },
566
- /**
567
- * If true, the accordion items will be disabled
568
- */
569
- disabled: Boolean
570
- }, no = ["update:modelValue"], ro = {
571
- name: "VvAccordionGroup"
572
- }, fl = /* @__PURE__ */ q({
573
- ...ro,
574
- props: so,
575
- emits: no,
576
- setup(o, { emit: a }) {
577
- const e = o, { disabled: s, collapse: l, modifiers: i, itemModifiers: u, items: c } = toRefs(e);
578
- watchEffect(() => {
579
- typeof e.modelValue == "string" && l.value && console.warn(
580
- "[VvAccordionGroup]: modelValue is a string but collapse is true."
581
- );
582
- });
583
- const p = ref([]), v = computed({
584
- get: () => {
585
- var r;
586
- return e.modelValue !== void 0 ? l.value ? e.modelValue : Array.isArray(e.modelValue) ? e.modelValue[0] : e.modelValue : l.value ? p.value : (r = p.value) == null ? void 0 : r[0];
587
- },
588
- set: (r) => {
589
- if (e.modelValue !== void 0)
590
- return (Array.isArray(e.modelValue) || l.value) && !Array.isArray(r) && (r = [r]), a("update:modelValue", r);
591
- p.value = Array.isArray(r) ? r : [r];
592
- }
593
- });
594
- useProvideGroupState({
595
- key: bt,
596
- modelValue: v,
597
- disabled: s,
598
- collapse: l,
599
- modifiers: u
600
- });
601
- const n = useBemModifiers(
602
- "vv-accordion-group",
603
- i,
604
- computed(() => ({
605
- disabled: s.value
606
- }))
607
- );
608
- return (r, f) => (d(), y("div", {
609
- class: Z(t(n))
610
- }, [
611
- $(r.$slots, "default", {}, () => [
612
- (d(!0), y(ne, null, ke(t(c), (g) => (d(), W(lo, G({
613
- key: g.title
614
- }, {
615
- name: g.name,
616
- title: g.title,
617
- content: g.content
618
- }), {
619
- header: ve((k) => [
620
- $(r.$slots, `header::${g.name}`, j(F(k)))
621
- ]),
622
- details: ve((k) => [
623
- $(r.$slots, `details::${g.name}`, j(F(k)))
624
- ]),
625
- _: 2
626
- }, 1040))), 128))
627
- ])
628
- ], 2));
629
- }
630
- }), io = {
631
- ...ce,
632
- value: [String, Number]
633
- }, uo = {
634
- name: "VvBadge"
635
- }, co = /* @__PURE__ */ q({
636
- ...uo,
637
- props: io,
638
- setup(o) {
639
- const a = o, { modifiers: e } = toRefs(a), s = useBemModifiers("vv-badge", e);
640
- return (l, i) => (d(), y("span", {
641
- class: Z(t(s)),
642
- role: "status"
643
- }, [
644
- $(l.$slots, "default", {}, () => [
645
- X(x(l.value), 1)
646
- ])
647
- ], 2));
648
- }
649
- });
650
- function vo(o, a, e) {
651
- return computed(() => {
652
- const s = {
653
- [o]: !0
654
- };
655
- let l = unref(a);
656
- return l && (!Array.isArray(l) && typeof l == "string" && (l = l.split(" ")), Array.isArray(l) && l.forEach((i) => {
657
- s[`${o}--${i}`] = !0;
658
- })), e && Object.keys(e.value).forEach((i) => {
659
- s[`${o}--${i}`] = unref(e.value[i]);
660
- }), s;
661
- });
662
- }
663
- const po = {
664
- ...ce,
665
- routes: Array
666
- }, fo = { class: "vv-breadcrumb__list" }, mo = ["content"], bo = {
667
- name: "VvBreadcrumb"
668
- }, ml = /* @__PURE__ */ q({
669
- ...bo,
670
- props: po,
671
- setup(o) {
672
- const a = o, { modifiers: e } = toRefs(a), s = vo("vv-breadcrumb", e);
673
- return (l, i) => (d(), y("nav", {
674
- class: Z(t(s)),
675
- "aria-label": "breadcrumbs"
676
- }, [
677
- N("ol", fo, [
678
- (d(!0), y(ne, null, ke(l.routes, (u, c) => {
679
- var p, v, n, r;
680
- return d(), y("li", {
681
- key: `${u.label}-${c}`,
682
- class: Z({
683
- "vv-breadcrumb__item": c < Number((p = l.routes) == null ? void 0 : p.length) - 1,
684
- "vv-breadcrumb__item-active": c === Number((v = l.routes) == null ? void 0 : v.length) - 1
685
- }),
686
- itemprop: "itemListElement",
687
- itemtype: "https://schema.org/ListItem",
688
- itemscope: ""
689
- }, [
690
- (d(), W(ut(u.to ? "router-link" : u.href ? "a" : "span"), G(u, {
691
- class: {
692
- "vv-breadcrumb__link": c < Number((n = l.routes) == null ? void 0 : n.length) - 1
693
- },
694
- "aria-current": c === Number((r = l.routes) == null ? void 0 : r.length) - 1 ? "page" : void 0,
695
- itemprop: "item"
696
- }), {
697
- default: ve(() => [
698
- $(l.$slots, "label", j(F({ route: u, index: c })), () => [
699
- X(x(u.label), 1)
700
- ])
701
- ]),
702
- _: 2
703
- }, 1040, ["class", "aria-current"])),
704
- N("meta", {
705
- itemprop: "position",
706
- content: `${c + 1}`
707
- }, null, 8, mo)
708
- ], 2);
709
- }), 128))
710
- ])
711
- ], 2));
712
- }
713
- }), ho = {
714
- /**
715
- * Color
716
- */
717
- color: String,
718
- /**
719
- * Width
720
- */
721
- width: {
722
- type: [String, Number]
723
- },
724
- /**
725
- * Height
726
- */
727
- height: {
728
- type: [String, Number]
729
- },
730
- /**
731
- * Icon name
732
- * Can be the full composition of iconify name "@{provider}:{prefix}:{name}" or "{prefix}:{name}" or "{name}"
733
- * https://docs.iconify.design/api/providers.html#provider-in-icon-name
734
- */
735
- name: {
736
- type: String,
737
- required: !0
738
- },
739
- /**
740
- * By default 'vv'
741
- * If custom collection is not added with "addCollection" DS class method, this prop could not be used
742
- * Icon provider: https://docs.iconify.design/api/providers.html#provider-in-icon-name
743
- */
744
- provider: {
745
- type: String
746
- },
747
- /**
748
- * The name of icon set.
749
- * Icon default options prefix: simple | normal | detailed
750
- */
751
- prefix: {
752
- type: String,
753
- default: "normal"
754
- },
755
- /**
756
- * Url remote SVG icon
757
- */
758
- src: String,
759
- /**
760
- * Horizontal flip
761
- */
762
- horizontalFlip: Boolean,
763
- /**
764
- * Vertical flip
765
- */
766
- verticalFlip: Boolean,
767
- /**
768
- * String alternative to "horizontalFlip" and "verticalFlip".
769
- * Example: https://docs.iconify.design/icon-components/vue/transform.html
770
- */
771
- flip: String,
772
- /**
773
- * Icon render mode
774
- * 'style' = 'bg' or 'mask', depending on icon content
775
- * 'bg' = span with style using `background`
776
- * 'mask' = span with style using `mask`
777
- * 'svg' = svg
778
- * Iconify doc: https://docs.iconify.design/iconify-icon/modes.html
779
- */
780
- mode: String,
781
- /**
782
- * Toggles inline or block mode
783
- * Example https://docs.iconify.design/icon-components/vue/inline.html
784
- */
785
- inline: Boolean,
786
- /**
787
- * rotates icon
788
- * Example https://docs.iconify.design/icon-components/vue/transform.html
789
- */
790
- rotate: [Number, String],
791
- /**
792
- * A callback that is called when icon data has been loaded
793
- */
794
- onLoad: Function,
795
- /**
796
- * SVG icon string
797
- */
798
- svg: String,
799
- /**
800
- * Icon modifiers: vv-icon css helper classes, value/s are concatened with prefix 'vv-icon--'
801
- * @values string | Array<string>
802
- */
803
- modifiers: {
804
- type: [String, Array]
805
- }
806
- }, yo = {
807
- name: "VvIcon"
808
- }, Q = /* @__PURE__ */ q({
809
- ...yo,
810
- props: ho,
811
- setup(o) {
812
- const a = o, e = ref(!0), s = useVolver(), { modifiers: l } = toRefs(a), i = useBemModifiers("vv-icon", l), u = computed(() => a.provider || (s == null ? void 0 : s.provider)), c = computed(() => {
813
- const n = a.name ?? "", r = `@${u.value}:${a.prefix}:${a.name}`;
814
- return Re(n) ? n : Re(r) ? r : (s == null ? void 0 : s.iconsCollections.find(
815
- (f) => {
816
- const g = `@${u.value}:${f.prefix}:${n}`;
817
- if (Re(g))
818
- return g;
819
- }
820
- )) || n;
821
- });
822
- function p(n) {
823
- let r = null;
824
- if (typeof window > "u") {
825
- const { JSDOM: A } = require("jsdom");
826
- r = new A().window;
827
- }
828
- return (r ? new r.DOMParser() : new window.DOMParser()).parseFromString(n, "text/html").querySelector("svg");
829
- }
830
- function v(n) {
831
- const r = p(n), f = (r == null ? void 0 : r.innerHTML.trim()) || "";
832
- r && f && rt(`@${u.value}:${a.prefix}:${a.name}`, {
833
- body: f,
834
- // Set height and width from svg content
835
- height: r.viewBox.baseVal.height,
836
- width: r.viewBox.baseVal.width
837
- });
838
- }
839
- return s && (a.src && !Re(`@${u.value}:${a.prefix}:${a.name}`) ? (e.value = !1, s.fetchIcon(a.src).then((n) => {
840
- n && (v(n), e.value = !0);
841
- }).catch((n) => {
842
- throw new Error(`During fetch icon: ${n == null ? void 0 : n.message}`);
843
- })) : a.svg && v(a.svg)), (n, r) => t(e) ? (d(), W(t(Pt), G({
844
- key: 0,
845
- class: t(i)
846
- }, {
847
- inline: n.inline,
848
- width: n.width,
849
- height: n.height,
850
- horizontalFlip: n.horizontalFlip,
851
- verticalFlip: n.verticalFlip,
852
- flip: n.flip,
853
- rotate: n.rotate,
854
- color: n.color,
855
- onLoad: n.onLoad,
856
- icon: t(c)
857
- }), null, 16, ["class"])) : w("", !0);
858
- }
859
- });
860
- var Vt = /* @__PURE__ */ ((o) => (o.button = "button", o.submit = "submit", o.reset = "reset", o))(Vt || {}), ge = /* @__PURE__ */ ((o) => (o.nuxtLink = "nuxt-link", o.routerLink = "router-link", o.a = "a", o.button = "button", o))(ge || {}), $t = /* @__PURE__ */ ((o) => (o._blank = "_blank", o._self = "_self", o._parent = "_parent", o._top = "_top", o))($t || {});
861
- const go = ["update:modelValue"], _o = {
862
- ...Ne,
863
- ...ce,
864
- ...Ae,
865
- ...xe,
866
- /**
867
- * Button icon
868
- */
869
- icon: [String, Object],
870
- /**
871
- * Button icon position
872
- */
873
- iconPosition: {
874
- type: String,
875
- default: be.left,
876
- validator: (o) => Object.values(be).includes(o)
877
- },
878
- /**
879
- * Button label
880
- */
881
- label: [String, Number],
882
- /**
883
- * Loading status
884
- */
885
- loading: Boolean,
886
- /**
887
- * Loading icon
888
- */
889
- loadingIcon: { type: String, default: "eos-icons:bubble-loading" },
890
- /**
891
- * Loading label
892
- */
893
- loadingLabel: {
894
- type: String,
895
- default: "Loading..."
896
- },
897
- /**
898
- * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
899
- * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
900
- */
901
- to: {
902
- type: [String, Object]
903
- },
904
- /**
905
- * Link href
906
- */
907
- href: String,
908
- /**
909
- * Link target
910
- */
911
- target: {
912
- type: String,
913
- validator: (o) => Object.values($t).includes(o)
914
- },
915
- active: Boolean,
916
- /**
917
- * Button pressed mode
918
- */
919
- pressed: Boolean,
920
- /**
921
- * Link rel
922
- */
923
- rel: {
924
- type: String,
925
- default: "noopener noreferrer"
926
- },
927
- /**
928
- * Button type
929
- */
930
- type: {
931
- type: String,
932
- default: "button",
933
- validator: (o) => Object.values(Vt).includes(o)
934
- },
935
- toggle: {
936
- type: Boolean,
937
- default: !1
938
- },
939
- modelValue: String
940
- };
941
- function So(o, a) {
942
- var S;
943
- const { group: e, isInGroup: s, getGroupOrLocalRef: l } = useInjectedGroupState(pt), {
944
- id: i,
945
- iconPosition: u,
946
- icon: c,
947
- label: p,
948
- pressed: v,
949
- modifiers: n
950
- } = toRefs(o), r = l("modelValue", o, a), f = l("disabled", o), g = l("toggle", o), k = l(
951
- "unselectable",
952
- o
953
- ), A = ((S = e == null ? void 0 : e.value) == null ? void 0 : S.multiple) ?? ref(!1), b = computed(() => {
954
- var E;
955
- const I = n != null && n.value ? Array.isArray(n.value) ? n.value : [n.value] : [], B = (E = e == null ? void 0 : e.value.itemModifiers) != null && E.value ? Array.isArray(e.value.itemModifiers.value) ? e.value.itemModifiers.value : [e.value.itemModifiers.value] : [];
956
- return [...I, ...B];
957
- });
958
- return {
959
- // group props
960
- group: e,
961
- isInGroup: s,
962
- modelValue: r,
963
- disabled: f,
964
- toggle: g,
965
- unselectable: k,
966
- multiple: A,
967
- // local props
968
- id: i,
969
- modifiers: b,
970
- pressed: v,
971
- iconPosition: u,
972
- icon: c,
973
- label: p
974
- };
975
- }
976
- const Vo = {
977
- key: 1,
978
- class: "vv-button__label"
979
- }, $o = {
980
- key: 1,
981
- class: "vv-button__label"
982
- }, ko = {
983
- name: "VvButton"
984
- }, bl = /* @__PURE__ */ q({
985
- ...ko,
986
- props: _o,
987
- emits: go,
988
- setup(o, { expose: a, emit: e }) {
989
- const s = o, l = useAttrs(), i = useSlots(), {
990
- id: u,
991
- modifiers: c,
992
- iconPosition: p,
993
- icon: v,
994
- label: n,
995
- modelValue: r,
996
- disabled: f,
997
- toggle: g,
998
- unselectable: k
999
- } = So(s, e), A = useUniqueId(u), b = computed(() => (l == null ? void 0 : l.name) || A.value), S = useVolver(), I = ref(null);
1000
- a({ $el: I });
1001
- const {
1002
- reference: B,
1003
- bus: E,
1004
- aria: O
1005
- } = useInjectedDropdownTrigger();
1006
- watch(
1007
- () => I.value,
1008
- (C) => {
1009
- B && (B.value = C);
1010
- }
1011
- );
1012
- const { role: L } = useInjectedDropdownAction(), K = computed(() => {
1013
- switch (!0) {
1014
- case f.value:
1015
- return ge.button;
1016
- case s.to !== void 0:
1017
- return S != null && S.nuxt ? ge.nuxtLink : ge.routerLink;
1018
- case s.href !== void 0:
1019
- return ge.a;
1020
- default:
1021
- return ge.button;
22
+ ...component,
23
+ name: componentName,
24
+ props: Object.keys(props).reduce((acc, key) => {
25
+ if (!(key in componentDefaults)) {
26
+ acc[key] = props[key];
27
+ return acc;
28
+ }
29
+ const customDefault = componentDefaults[key];
30
+ if (typeof props[key] === "function" || Array.isArray(props[key])) {
31
+ acc[key] = {
32
+ type: props[key],
33
+ default: customDefault
34
+ };
35
+ return acc;
1022
36
  }
1023
- }), ee = computed(() => g.value ? Array.isArray(r.value) ? contains(b.value, r.value) : equals(b.value, r.value) : s.pressed), P = useBemModifiers(
1024
- "vv-button",
1025
- c,
1026
- computed(() => ({
1027
- active: s.active,
1028
- pressed: ee.value,
1029
- disabled: f.value,
1030
- reverse: [be.right, be.bottom].includes(p.value),
1031
- column: [be.top, be.bottom].includes(p.value),
1032
- iconOnly: Boolean((v == null ? void 0 : v.value) && !(n != null && n.value) && !i.default)
1033
- }))
1034
- ), T = computed(
1035
- () => typeof (v == null ? void 0 : v.value) == "string" ? { name: v == null ? void 0 : v.value } : v == null ? void 0 : v.value
1036
- ), U = computed(() => {
1037
- const C = {
1038
- ...O == null ? void 0 : O.value,
1039
- "aria-pressed": ee.value ? !0 : void 0,
1040
- class: P.value,
1041
- role: L
37
+ acc[key] = {
38
+ ...props[key],
39
+ default: customDefault
1042
40
  };
1043
- switch (K.value) {
1044
- case ge.a:
1045
- return {
1046
- ...C,
1047
- role: C.role ?? "button",
1048
- href: s.href,
1049
- target: s.target,
1050
- rel: s.rel
1051
- };
1052
- case ge.routerLink:
1053
- case ge.nuxtLink:
1054
- return {
1055
- ...C,
1056
- role: C.role ?? "button",
1057
- to: s.to,
1058
- target: s.target
1059
- };
1060
- default:
1061
- return {
1062
- ...C,
1063
- type: s.type,
1064
- disabled: f.value
1065
- };
1066
- }
1067
- }), te = (C) => {
1068
- if (E == null || E.emit("click", C), g.value) {
1069
- if (Array.isArray(r.value)) {
1070
- if (contains(b.value, r.value)) {
1071
- k.value && (r.value = r.value.filter(
1072
- (oe) => oe !== b.value
1073
- ));
1074
- return;
1075
- }
1076
- r.value.push(b.value);
1077
- return;
1078
- }
1079
- if (equals(b, r.value) && k.value) {
1080
- r.value = void 0;
1081
- return;
1082
- }
1083
- r.value = b.value;
1084
- }
1085
- }, re = (C) => {
1086
- E == null || E.emit("mouseover", C);
1087
- }, ie = (C) => {
1088
- E == null || E.emit("mouseleave", C);
1089
- };
1090
- return (C, oe) => (d(), W(ut(t(K)), G(t(U), {
1091
- id: t(A),
1092
- ref_key: "$el",
1093
- ref: I,
1094
- onClickPassive: te,
1095
- onMouseoverPassive: re,
1096
- onMouseleavePassive: ie
1097
- }), {
1098
- default: ve(() => [
1099
- $(C.$slots, "default", {}, () => [
1100
- C.loading ? $(C.$slots, "loading", { key: 0 }, () => [
1101
- C.loadingIcon ? (d(), W(Q, {
1102
- key: 0,
1103
- class: "vv-button__loading-icon",
1104
- name: C.loadingIcon
1105
- }, null, 8, ["name"])) : w("", !0),
1106
- C.loadingLabel ? (d(), y("span", Vo, x(C.loadingLabel), 1)) : w("", !0)
1107
- ]) : (d(), y(ne, { key: 1 }, [
1108
- $(C.$slots, "before"),
1109
- t(v) ? (d(), W(Q, G({
1110
- key: 0,
1111
- class: "vv-button__icon"
1112
- }, t(T)), null, 16)) : w("", !0),
1113
- t(n) ? (d(), y("span", $o, [
1114
- $(C.$slots, "label", {}, () => [
1115
- X(x(t(n)), 1)
1116
- ])
1117
- ])) : w("", !0),
1118
- $(C.$slots, "after")
1119
- ], 64))
1120
- ])
1121
- ]),
1122
- _: 3
1123
- }, 16, ["id"]));
1124
- }
1125
- }), Co = {
1126
- ...ce,
1127
- ...Ae,
1128
- ...xe,
1129
- /**
1130
- * String or String[] of css classes (modifiers) that will be provided to each button'
1131
- */
1132
- itemModifiers: { type: [String, Array], default: void 0 },
1133
- toggle: { type: Boolean, default: !1 },
1134
- multiple: { type: Boolean, default: !1 },
1135
- modelValue: { type: [String, Array], default: void 0 }
1136
- }, Ao = ["update:modelValue"], wo = {
1137
- name: "VvButtonGroup"
1138
- }, hl = /* @__PURE__ */ q({
1139
- ...wo,
1140
- props: Co,
1141
- emits: Ao,
1142
- setup(o, { emit: a }) {
1143
- const e = o, {
1144
- disabled: s,
1145
- toggle: l,
1146
- modifiers: i,
1147
- multiple: u,
1148
- unselectable: c,
1149
- itemModifiers: p
1150
- } = toRefs(e);
1151
- watchEffect(() => {
1152
- typeof e.modelValue == "string" && u.value && console.warn(
1153
- "[VvButtonGroup]: modelValue is a string but multiple is true."
1154
- );
1155
- });
1156
- const v = computed({
1157
- get: () => u.value ? e.modelValue : Array.isArray(e.modelValue) ? e.modelValue[0] : e.modelValue,
1158
- set: (r) => (r !== void 0 && (Array.isArray(e.modelValue) || u.value) && !Array.isArray(r) && (r = [r]), a("update:modelValue", r))
1159
- });
1160
- useProvideGroupState({
1161
- key: pt,
1162
- modelValue: v,
1163
- disabled: s,
1164
- toggle: l,
1165
- multiple: u,
1166
- unselectable: c,
1167
- itemModifiers: p
1168
- });
1169
- const n = useBemModifiers("vv-button-group", i);
1170
- return (r, f) => (d(), y("div", {
1171
- class: Z(t(n)),
1172
- role: "group"
1173
- }, [
1174
- $(r.$slots, "default")
1175
- ], 2));
1176
- }
1177
- }), Eo = {
1178
- title: String,
1179
- modifiers: [String, Array]
1180
- }, Io = {
1181
- key: 0,
1182
- class: "vv-card__header"
1183
- }, Po = {
1184
- key: 1,
1185
- class: "vv-card__content"
1186
- }, Oo = {
1187
- key: 2,
1188
- class: "vv-card__footer"
1189
- }, Do = {
1190
- name: "VvCard"
1191
- }, yl = /* @__PURE__ */ q({
1192
- ...Do,
1193
- props: Eo,
1194
- setup(o) {
1195
- const a = o, { modifiers: e } = toRefs(a), s = useBemModifiers("vv-card", e);
1196
- return (l, i) => (d(), y("article", {
1197
- class: Z(t(s))
1198
- }, [
1199
- l.$slots.header || l.title ? (d(), y("header", Io, [
1200
- $(l.$slots, "header", {}, () => [
1201
- X(x(l.title), 1)
1202
- ])
1203
- ])) : w("", !0),
1204
- $(l.$slots, "default"),
1205
- l.$slots.content ? (d(), y("div", Po, [
1206
- $(l.$slots, "content")
1207
- ])) : w("", !0),
1208
- l.$slots.footer ? (d(), y("footer", Oo, [
1209
- $(l.$slots, "footer")
1210
- ])) : w("", !0)
1211
- ], 2));
1212
- }
1213
- }), Bo = {
1214
- ..._t,
1215
- ...ce,
1216
- /**
1217
- * If true, the input will be indeterminated
1218
- */
1219
- indeterminate: Boolean,
1220
- /**
1221
- * Value associated with the unchecked state
1222
- */
1223
- uncheckedValue: [String, Number, Boolean],
1224
- /**
1225
- * If true, the input will be displayed as a switch
1226
- */
1227
- switch: Boolean
1228
- }, Ro = ["click", "update:modelValue", "change", "blur"];
1229
- function To(o, a) {
1230
- const { group: e, isInGroup: s, getGroupOrLocalRef: l } = useInjectedGroupState(mt), { id: i, switch: u, indeterminate: c } = toRefs(o), p = l("modelValue", o, a), v = l("readonly", o), n = l("disabled", o), r = l("valid", o), f = l("invalid", o);
1231
- return {
1232
- // local props
1233
- id: i,
1234
- propsSwitch: u,
1235
- indeterminate: c,
1236
- // global props
1237
- group: e,
1238
- isInGroup: s,
1239
- modelValue: p,
1240
- readonly: v,
1241
- disabled: n,
1242
- valid: r,
1243
- invalid: f
41
+ return acc;
42
+ }, {})
1244
43
  };
1245
44
  }
1246
- function Te(o) {
1247
- return Array.isArray(o) ? o.filter((a) => isString(a)).join(" ") : o;
1248
- }
1249
- function Ve(o, a) {
1250
- const {
1251
- invalid: e,
1252
- valid: s,
1253
- hint: l,
1254
- loading: i
1255
- } = a, {
1256
- hintLabel: u,
1257
- modelValue: c,
1258
- valid: p,
1259
- validLabel: v,
1260
- invalid: n,
1261
- invalidLabel: r,
1262
- ...f
1263
- } = toRefs(o), g = resolveFieldData(f, "loading"), k = resolveFieldData(f, "loadingLabel"), A = computed(() => n.value ? !!(n.value && e || r != null && r.value && Array.isArray(r.value) && r.value.length > 0 || r != null && r.value && !isEmpty(r)) : !1), b = computed(
1264
- () => !!(u && u.value || l)
1265
- ), S = computed(
1266
- () => !!(v && v.value || s)
1267
- ), I = computed(
1268
- () => !!(g != null && g.value && i || g != null && g.value && (k != null && k.value))
1269
- ), B = computed(
1270
- () => b.value || S.value || A.value || I.value
1271
- );
1272
- return {
1273
- hasInvalid: A,
1274
- hasHint: b,
1275
- hasValid: S,
1276
- hasLoading: I,
1277
- HintSlot: {
1278
- name: "HintSlot",
1279
- props: {
1280
- params: {
1281
- type: Object,
1282
- default: () => ({})
1283
- }
1284
- },
1285
- setup(E) {
1286
- const O = computed(() => {
1287
- const L = toReactive({
1288
- hintLabel: u,
1289
- modelValue: c,
1290
- valid: p,
1291
- validLabel: v,
1292
- invalid: n,
1293
- invalidLabel: r,
1294
- loading: g,
1295
- loadingLabel: k,
1296
- ...E.params
1297
- });
1298
- return n != null && n.value ? (e == null ? void 0 : e(L)) || Te(r == null ? void 0 : r.value) || (u == null ? void 0 : u.value) : p != null && p.value ? (s == null ? void 0 : s(L)) || Te(v == null ? void 0 : v.value) || (u == null ? void 0 : u.value) : g != null && g.value ? (i == null ? void 0 : i(L)) || Te(k == null ? void 0 : k.value) || (u == null ? void 0 : u.value) : (l == null ? void 0 : l(L)) || Te(u == null ? void 0 : u.value) || (u == null ? void 0 : u.value);
1299
- });
1300
- return {
1301
- isVisible: B,
1302
- hasInvalid: A,
1303
- hasValid: S,
1304
- hintContent: O
1305
- };
1306
- },
1307
- render() {
1308
- if (this.isVisible)
1309
- return h(
1310
- "small",
1311
- {
1312
- role: this.hasInvalid ? "alert" : this.hasValid ? "status" : void 0
1313
- },
1314
- this.hintContent
1315
- );
1316
- }
45
+ class Volver {
46
+ constructor({
47
+ fetchWithCredentials,
48
+ fetchOptions,
49
+ iconsProvider,
50
+ nuxt,
51
+ iconsCollections,
52
+ defaults
53
+ } = {}) {
54
+ __publicField(this, "_fetchOptions", {});
55
+ __publicField(this, "_iconsCollections", []);
56
+ __publicField(this, "_iconsProvider", DEFAULT_ICONIFY_PROVIDER);
57
+ __publicField(this, "_nuxt", false);
58
+ __publicField(this, "defaults", ref({}));
59
+ if (fetchOptions) {
60
+ this._fetchOptions = fetchOptions;
1317
61
  }
1318
- };
1319
- }
1320
- const Mo = ["for"], xo = ["id", "name", "disabled", "value", "tabindex", "aria-invalid"], No = {
1321
- name: "VvCheckbox"
1322
- }, Lo = /* @__PURE__ */ q({
1323
- ...No,
1324
- props: Bo,
1325
- emits: Ro,
1326
- setup(o, { emit: a }) {
1327
- const e = o, s = useSlots(), {
1328
- id: l,
1329
- disabled: i,
1330
- readonly: u,
1331
- valid: c,
1332
- invalid: p,
1333
- propsSwitch: v,
1334
- modelValue: n,
1335
- indeterminate: r,
1336
- isInGroup: f
1337
- } = To(e, a), g = useUniqueId(l), k = computed(() => S.value ? -1 : e.tabindex), A = ref(), b = computed(
1338
- () => e.uncheckedValue !== void 0 && !f.value
1339
- ), S = computed(() => i.value || u.value), I = computed(() => {
1340
- if (p.value === !0)
1341
- return !0;
1342
- if (c.value === !0)
1343
- return !1;
1344
- }), B = computed(() => b.value ? n.value === e.value : Array.isArray(n.value) ? contains(e.value, n.value) : equals(e.value, n.value)), E = computed(() => !!(r.value || !B.value && b.value && e.uncheckedValue !== n.value)), O = computed(() => {
1345
- if (!b.value)
1346
- return ["string", "number", "boolean"].includes(typeof e.value) ? e.value : !0;
1347
- }), L = computed({
1348
- get() {
1349
- return B.value;
1350
- },
1351
- set(T) {
1352
- if (b.value)
1353
- n.value = T ? e.value : e.uncheckedValue;
1354
- else if (Array.isArray(n.value) || f.value) {
1355
- const U = new Set(
1356
- Array.isArray(n.value) ? n.value : n.value !== void 0 ? [n.value] : []
1357
- );
1358
- T ? U.add(e.value) : U.delete(e.value), n.value = [...U];
1359
- } else
1360
- n.value = T ? e.value : void 0;
1361
- a("change", T);
1362
- }
1363
- }), { modifiers: K } = toRefs(e), ee = useBemModifiers(
1364
- "vv-checkbox",
1365
- K,
1366
- computed(() => ({
1367
- switch: v.value,
1368
- valid: c.value,
1369
- invalid: p.value,
1370
- disabled: i.value,
1371
- readonly: u.value,
1372
- indeterminate: r.value
1373
- }))
1374
- );
1375
- watchEffect(() => {
1376
- b.value && Array.isArray(n.value) && console.warn(
1377
- "[VvCheckbox] The model value is an array but the component is in binary mode."
1378
- );
1379
- }), watch(
1380
- () => E.value,
1381
- (T) => {
1382
- T ? A.value.indeterminate = !0 : A.value.indeterminate = !1;
1383
- }
1384
- ), onMounted(() => {
1385
- E.value && (A.value.indeterminate = !0);
1386
- });
1387
- const { HintSlot: P } = Ve(e, s);
1388
- return (T, U) => (d(), y("label", {
1389
- class: Z(t(ee)),
1390
- for: t(g)
1391
- }, [
1392
- Se(N("input", {
1393
- id: t(g),
1394
- ref_key: "input",
1395
- ref: A,
1396
- "onUpdate:modelValue": U[0] || (U[0] = (te) => Ce(L) ? L.value = te : null),
1397
- type: "checkbox",
1398
- class: "vv-checkbox__input",
1399
- name: T.name,
1400
- disabled: t(S),
1401
- value: t(O),
1402
- tabindex: t(k),
1403
- "aria-invalid": t(I)
1404
- }, null, 8, xo), [
1405
- [Dt, t(L)]
1406
- ]),
1407
- $(T.$slots, "default", { value: t(n) }, () => [
1408
- X(x(T.label), 1)
1409
- ]),
1410
- de(t(P), {
1411
- class: "vv-checkbox__hint",
1412
- params: { value: t(n) }
1413
- }, null, 8, ["params"])
1414
- ], 10, Mo));
1415
- }
1416
- }), Ho = St, Go = ["update:modelValue", "change"], Uo = ["textContent"], Wo = { class: "vv-checkbox-group__wrapper" }, jo = {
1417
- name: "VvCheckboxGroup"
1418
- }, gl = /* @__PURE__ */ q({
1419
- ...jo,
1420
- props: Ho,
1421
- emits: Go,
1422
- setup(o, { emit: a }) {
1423
- const e = o, s = useSlots(), l = useVModel(e, "modelValue", a), { disabled: i, readonly: u, vertical: c, valid: p, invalid: v, modifiers: n } = toRefs(e);
1424
- useProvideGroupState({
1425
- key: mt,
1426
- modelValue: l,
1427
- disabled: i,
1428
- readonly: u,
1429
- valid: p,
1430
- invalid: v
1431
- });
1432
- const { getOptionLabel: r, getOptionValue: f } = useOptions(e), g = useBemModifiers(
1433
- "vv-checkbox-group",
1434
- n,
1435
- computed(() => ({
1436
- disabled: i.value,
1437
- readonly: u.value,
1438
- horizontal: !c.value,
1439
- valid: p.value,
1440
- invalid: v.value
1441
- }))
1442
- ), k = (b, S) => ({
1443
- id: `${e.name}_opt${S}`,
1444
- name: e.name,
1445
- label: r(b),
1446
- value: f(b)
1447
- }), { HintSlot: A } = Ve(e, s);
1448
- return (b, S) => (d(), y("fieldset", {
1449
- class: Z(t(g))
1450
- }, [
1451
- b.label ? (d(), y("legend", {
1452
- key: 0,
1453
- textContent: x(b.label)
1454
- }, null, 8, Uo)) : w("", !0),
1455
- N("div", Wo, [
1456
- b.options.length > 0 ? (d(!0), y(ne, { key: 0 }, ke(b.options, (I, B) => (d(), W(Lo, G({ key: B }, k(I, B)), null, 16))), 128)) : $(b.$slots, "default", { key: 1 })
1457
- ]),
1458
- de(t(A), { class: "vv-checkbox-group__hint" })
1459
- ], 2));
1460
- }
1461
- }), Fo = [
1462
- "update:modelValue",
1463
- "change:search",
1464
- "focus",
1465
- "blur"
1466
- ], qo = {
1467
- ...Le,
1468
- ...Me,
1469
- ...Pe,
1470
- ...Oe,
1471
- ...Be,
1472
- ...Ke,
1473
- ...Ae,
1474
- ...De,
1475
- ...ce,
1476
- ...ze,
1477
- ...Ye,
1478
- ...Je,
1479
- ...xe,
1480
- ...Fe,
1481
- /**
1482
- * modelValue can be a string, number, boolean, object or array of string, number, boolean, object
1483
- */
1484
- modelValue: {
1485
- type: [String, Number, Boolean, Object, Array],
1486
- default: void 0
1487
- },
1488
- /**
1489
- * Select input label
1490
- */
1491
- label: String,
1492
- /**
1493
- * Label for no search results
1494
- */
1495
- noResultsLabel: { type: String, default: "No results" },
1496
- /**
1497
- * Label for selected option hint
1498
- */
1499
- selectedLabel: { type: String, default: "Selected" },
1500
- /**
1501
- * Label for deselect button
1502
- */
1503
- deselectLabel: { type: String, default: "Deselect" },
1504
- /**
1505
- * Label for select option hint
1506
- */
1507
- pressToSelectLabel: { type: String, default: "Press enter to select" },
1508
- /**
1509
- * Label for deselected option hint
1510
- */
1511
- pressToDeselectLabel: { type: String, default: "Press enter to remove" },
1512
- /**
1513
- * Select input placeholder
1514
- */
1515
- placeholder: String,
1516
- /**
1517
- * Use input text to search on options
1518
- */
1519
- searchable: Boolean,
1520
- /**
1521
- * On searchable select is the input search placeholder
1522
- */
1523
- searchPlaceholder: {
1524
- type: String,
1525
- default: "Search..."
1526
- },
1527
- /**
1528
- * The input search debounce time in ms
1529
- */
1530
- debounceSearch: {
1531
- type: [Number, String],
1532
- default: 0
1533
- },
1534
- /**
1535
- * Manage modelValue as string[] or object[]
1536
- */
1537
- multiple: Boolean,
1538
- /**
1539
- * The max number of selected values
1540
- */
1541
- maxValues: [Number, String],
1542
- /**
1543
- * The select label separator visible to the user
1544
- */
1545
- separator: { type: String, default: ", " },
1546
- /**
1547
- * Show native select
1548
- */
1549
- native: Boolean,
1550
- /**
1551
- * Show badges
1552
- */
1553
- badges: Boolean,
1554
- /**
1555
- * Badge modifiers
1556
- */
1557
- badgeModifiers: {
1558
- type: [String, Array],
1559
- default: "action sm"
1560
- },
1561
- /**
1562
- * Set dropdown width to the same as the trigger
1563
- */
1564
- triggerWidth: {
1565
- ...Fe.triggerWidth,
1566
- default: !0
1567
- },
1568
- /**
1569
- * Dropdown modifiers
1570
- */
1571
- dropdownModifiers: {
1572
- type: [String, Array]
1573
- },
1574
- /**
1575
- * Open dropdown on focus
1576
- */
1577
- autoOpen: Boolean,
1578
- /**
1579
- * Close dropdown on select (not multiple)
1580
- */
1581
- autoClose: Boolean
1582
- }, lt = ["listbox", "menu"], Ko = {
1583
- ...Ne,
1584
- ...ce,
1585
- ...Fe,
1586
- /**
1587
- * Show / hide dropdown programmatically
1588
- */
1589
- modelValue: {
1590
- type: Boolean,
1591
- default: void 0
1592
- },
1593
- /**
1594
- * Dropdown trigger element
1595
- */
1596
- reference: {
1597
- type: Object,
1598
- default: null
1599
- },
1600
- /**
1601
- * Dropdown role
1602
- */
1603
- role: {
1604
- type: String,
1605
- default: lt[1],
1606
- validator: (o) => lt.includes(o)
1607
- }
1608
- }, zo = ["id", "tabindex", "role", "aria-labelledby"], Yo = {
1609
- name: "VvDropdown",
1610
- inheritAttrs: !1
1611
- }, kt = /* @__PURE__ */ q({
1612
- ...Yo,
1613
- props: Ko,
1614
- emits: ["update:modelValue"],
1615
- setup(o, { emit: a }) {
1616
- const e = o, { id: s } = toRefs(e), l = useUniqueId(s), i = useAttrs(), u = ref("auto"), c = ref("auto"), p = ref(null), v = ref(null), n = ref(null), r = ref(null), f = computed({
1617
- get: () => e.reference ?? p.value,
1618
- set: (m) => {
1619
- p.value = m;
1620
- }
1621
- }), g = computed(() => {
1622
- const m = [];
1623
- if (e.autoPlacement ? typeof e.autoPlacement == "boolean" ? m.push(Ze()) : m.push(
1624
- Ze(e.autoPlacement)
1625
- ) : e.flip && (typeof e.flip == "boolean" ? m.push(et()) : m.push(et(e.flip))), e.shift && (typeof e.shift == "boolean" ? m.push(tt()) : m.push(tt(e.shift))), e.size) {
1626
- const M = ({
1627
- availableWidth: ue,
1628
- availableHeight: ye
1629
- }) => {
1630
- u.value = `${ue}px`, c.value = `${ye}px`;
1631
- };
1632
- typeof e.size == "boolean" ? m.push(
1633
- ot({
1634
- apply: M
1635
- })
1636
- ) : m.push(
1637
- ot({
1638
- ...e.size,
1639
- apply: M
1640
- })
1641
- );
1642
- }
1643
- return e.offset && (m.push(Ge(Number(e.offset))), ["string", "number"].includes(typeof e.offset) ? m.push(Ge(Number(e.offset))) : m.push(Ge(e.offset))), e.arrow && m.push(
1644
- Lt({
1645
- element: n
1646
- })
1647
- ), m;
1648
- }), { x: k, y: A, strategy: b, middlewareData: S, placement: I } = Ht(
1649
- f,
1650
- v,
1651
- {
1652
- whileElementsMounted: Gt,
1653
- placement: e.placement,
1654
- middleware: g
1655
- }
1656
- ), B = computed(() => ({
1657
- position: b.value,
1658
- top: `${A.value ?? 0}px`,
1659
- left: `${k.value ?? 0}px`,
1660
- maxWidth: u.value,
1661
- maxHeight: c.value,
1662
- width: e.triggerWidth && f.value ? `${f.value.offsetWidth}px` : void 0
1663
- })), E = computed(() => I.value.split("-")[0]), O = computed(
1664
- () => ({
1665
- top: "bottom",
1666
- right: "left",
1667
- bottom: "top",
1668
- left: "right"
1669
- })[E.value] ?? "bottom"
1670
- ), L = computed(() => {
1671
- var m, M, ue, ye;
1672
- return ["bottom", "top"].includes(O.value) ? {
1673
- right: `${((m = S.value.arrow) == null ? void 0 : m.x) ?? 0}px`,
1674
- [O.value]: `${-(((M = n.value) == null ? void 0 : M.offsetWidth) ?? 0) / 2}px`
1675
- } : {
1676
- top: `${((ue = S.value.arrow) == null ? void 0 : ue.y) ?? 0}px`,
1677
- [O.value]: `${-(((ye = n.value) == null ? void 0 : ye.offsetWidth) ?? 0) / 2}px`
62
+ if (fetchWithCredentials) {
63
+ this._fetchOptions = {
64
+ ...this._fetchOptions,
65
+ credentials: "include"
1678
66
  };
1679
- }), K = useVModel(e, "modelValue", a), ee = ref(!1), P = computed({
1680
- get: () => K.value ?? ee.value,
1681
- set: (m) => {
1682
- if (K.value === void 0) {
1683
- ee.value = m;
1684
- return;
1685
- }
1686
- K.value = m;
1687
- }
1688
- }), T = () => {
1689
- P.value = !0;
1690
- }, U = () => {
1691
- P.value = !1;
1692
- }, te = () => {
1693
- P.value = !P.value;
1694
- }, re = (m) => {
1695
- f.value = m;
1696
- };
1697
- watch(P, (m) => {
1698
- m && e.autofocusFirst && nextTick(() => {
1699
- const M = ae(
1700
- v.value
1701
- );
1702
- M.length > 0 && M[0].focus();
1703
- });
1704
- }), onClickOutside(
1705
- v,
1706
- () => {
1707
- e.autoClose && (P.value = !1);
1708
- },
1709
- { ignore: [f] }
1710
- );
1711
- const ie = computed(() => {
1712
- var m;
1713
- return ((m = f.value) == null ? void 0 : m.getAttribute("id")) ?? void 0;
1714
- }), C = computed(() => ({
1715
- "aria-controls": l.value,
1716
- "aria-haspopup": !0,
1717
- "aria-expanded": P.value
1718
- })), { component: oe, bus: fe } = useProvideDropdownTrigger({
1719
- reference: f,
1720
- id: l,
1721
- expanded: P,
1722
- aria: C
1723
- });
1724
- fe.on("click", te);
1725
- const { role: se, modifiers: he } = toRefs(e), { itemRole: z } = useProvideDropdownItem({ role: se, expanded: P }), R = useBemModifiers(
1726
- "vv-dropdown",
1727
- he,
1728
- computed(() => ({
1729
- arrow: e.arrow
1730
- }))
1731
- ), { focused: Y } = useFocusWithin(v);
1732
- function ae(m) {
1733
- return m ? [
1734
- ...m.querySelectorAll(
1735
- 'a[href], button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])'
1736
- )
1737
- ].filter(
1738
- (M) => !M.hasAttribute("disabled") && !M.getAttribute("aria-hidden")
1739
- ) : [];
1740
67
  }
1741
- const me = () => {
1742
- nextTick(() => {
1743
- if (Y.value) {
1744
- const m = ae(
1745
- v.value
1746
- );
1747
- if (m.length === 0 || !document.activeElement)
1748
- return;
1749
- const M = m.indexOf(
1750
- document.activeElement
1751
- );
1752
- M < m.length - 1 ? m[M + 1].focus() : m[0].focus();
1753
- }
1754
- });
1755
- }, pe = () => {
1756
- nextTick(() => {
1757
- if (Y.value) {
1758
- const m = ae(
1759
- v.value
1760
- );
1761
- if (m.length === 0 || !document.activeElement)
1762
- return;
1763
- const M = m.indexOf(
1764
- document.activeElement
1765
- );
1766
- M > 0 ? m[M - 1].focus() : m[m.length - 1].focus();
1767
- }
1768
- });
1769
- };
1770
- return onKeyStroke("Escape", (m) => {
1771
- P.value && (m.preventDefault(), U());
1772
- }), onKeyStroke("ArrowDown", (m) => {
1773
- P.value && Y.value && (m.preventDefault(), me());
1774
- }), onKeyStroke("ArrowUp", (m) => {
1775
- P.value && Y.value && (m.preventDefault(), pe());
1776
- }), onKeyStroke([" ", "Enter"], (m) => {
1777
- P.value && Y.value && (m.preventDefault(), document.activeElement.click());
1778
- }), (m, M) => (d(), y(ne, null, [
1779
- de(t(oe), null, {
1780
- default: ve(() => [
1781
- $(m.$slots, "default", j(F({ init: re, show: T, hide: U, toggle: te, expanded: t(P), aria: t(C) })))
1782
- ]),
1783
- _: 3
1784
- }),
1785
- de(dt, { name: m.transitionName }, {
1786
- default: ve(() => [
1787
- Se(N("div", {
1788
- ref_key: "floatingEl",
1789
- ref: v,
1790
- style: Qe(t(B)),
1791
- class: Z(t(R))
1792
- }, [
1793
- e.arrow ? (d(), y("div", {
1794
- key: 0,
1795
- ref_key: "arrowEl",
1796
- ref: n,
1797
- style: Qe(t(L)),
1798
- class: "vv-dropdown__arrow"
1799
- }, null, 4)) : w("", !0),
1800
- $(m.$slots, "before", j(F({ expanded: t(P) }))),
1801
- N("ul", G(t(i), {
1802
- id: t(l),
1803
- ref_key: "listEl",
1804
- ref: r,
1805
- tabindex: t(P) ? void 0 : -1,
1806
- role: t(se),
1807
- "aria-labelledby": t(ie),
1808
- class: "vv-dropdown__list"
1809
- }), [
1810
- $(m.$slots, "items", j(F({
1811
- role: t(z)
1812
- })))
1813
- ], 16, zo),
1814
- $(m.$slots, "after", j(F({ expanded: t(P) })))
1815
- ], 6), [
1816
- [qe, t(P)]
1817
- ])
1818
- ]),
1819
- _: 3
1820
- }, 8, ["name"])
1821
- ], 64));
1822
- }
1823
- }), Jo = {
1824
- name: "VvDropdownItem"
1825
- }, Ct = /* @__PURE__ */ q({
1826
- ...Jo,
1827
- setup(o) {
1828
- const { role: a, expanded: e } = useInjectedDropdownItem(), s = ref(null);
1829
- useProvideDropdownAction({ expanded: e });
1830
- const l = useElementHover(s), { focused: i } = useFocus(s), { focused: u } = useFocusWithin(s);
1831
- return watch(l, (c) => {
1832
- c && (i.value = !0);
1833
- }), (c, p) => (d(), y("li", G({ role: t(a) }, {
1834
- ref_key: "element",
1835
- ref: s,
1836
- class: ["vv-dropdown__item", { "focus-visible": t(i) || t(u) }]
1837
- }), [
1838
- $(c.$slots, "default")
1839
- ], 16));
1840
- }
1841
- }), Xo = {
1842
- ...Le,
1843
- ...ht,
1844
- ...yt,
1845
- ...Me,
1846
- ...Pe,
1847
- ...Oe,
1848
- ...Be,
1849
- ...Ke,
1850
- ...Ae,
1851
- ...De,
1852
- ...ce,
1853
- ...ze,
1854
- ...Ye,
1855
- ...Je,
1856
- ...xe,
1857
- /**
1858
- * This Boolean attribute indicates that multiple options can be selected in the list.
1859
- * If it is not specified, then only one option can be selected at a time.
1860
- * When multiple is specified, most browsers will show a scrolling list box instead of a single line dropdown.
1861
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-multiple
1862
- */
1863
- multiple: Boolean,
1864
- /**
1865
- * A Boolean attribute indicating that an option with a non-empty string value must be selected.
1866
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-required
1867
- */
1868
- required: Boolean,
1869
- /**
1870
- * If the control is presented as a scrolling list box (e.g. when multiple is specified),
1871
- * this attribute represents the number of rows in the list that should be visible at one time.
1872
- * Browsers are not required to present a select element as a scrolled list box. The default value is 0.
1873
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-size
1874
- */
1875
- size: [String, Number],
1876
- /**
1877
- * modelValue can be a string, number, boolean, object or array of string, number, boolean, object
1878
- */
1879
- modelValue: {
1880
- type: [String, Number, Boolean, Object, Array],
1881
- default: void 0
1882
- },
1883
- /**
1884
- * <label> value for the select
1885
- */
1886
- label: String,
1887
- /**
1888
- * Select placeholder
1889
- */
1890
- placeholder: String
1891
- }, Qo = ["update:modelValue", "focus", "blur"], Zo = ["for"], ea = { class: "vv-select__wrapper" }, ta = {
1892
- key: 0,
1893
- class: "vv-select__input-before"
1894
- }, oa = { class: "vv-select__inner" }, aa = ["id"], la = ["disabled", "hidden"], sa = ["disabled", "value"], na = {
1895
- key: 1,
1896
- class: "vv-select__input-after"
1897
- }, ra = {
1898
- name: "VvSelect"
1899
- }, ia = /* @__PURE__ */ q({
1900
- ...ra,
1901
- props: Xo,
1902
- emits: Qo,
1903
- setup(o, { emit: a }) {
1904
- const e = o, s = useSlots(), l = ref(), { HintSlot: i, hasHint: u, hasInvalid: c } = Ve(e, s), {
1905
- id: p,
1906
- modifiers: v,
1907
- disabled: n,
1908
- readonly: r,
1909
- loading: f,
1910
- icon: g,
1911
- iconPosition: k,
1912
- invalid: A,
1913
- valid: b,
1914
- floating: S,
1915
- multiple: I
1916
- } = toRefs(e), B = useUniqueId(p), E = computed(() => `${B.value}-hint`), { focused: O } = useComponentFocus(l, a), L = useElementVisibility(l);
1917
- watch(L, (R) => {
1918
- R && e.autofocus && (O.value = !0);
1919
- });
1920
- const { hasIcon: K, hasIconBefore: ee, hasIconAfter: P } = useComponentIcon(
1921
- g,
1922
- k
1923
- ), T = computed(() => !isEmpty(e.modelValue)), U = computed(() => e.disabled || e.readonly), te = computed(() => U.value ? -1 : e.tabindex), re = computed(() => {
1924
- if (e.invalid === !0)
1925
- return !0;
1926
- if (e.valid === !0)
1927
- return !1;
1928
- }), ie = useBemModifiers(
1929
- "vv-select",
1930
- v,
1931
- computed(() => ({
1932
- valid: b.value,
1933
- invalid: A.value,
1934
- loading: f.value,
1935
- disabled: n.value,
1936
- readonly: r.value,
1937
- "icon-before": ee.value,
1938
- "icon-after": P.value,
1939
- dirty: T.value,
1940
- focus: O.value,
1941
- floating: S.value,
1942
- multiple: I.value
1943
- }))
1944
- ), C = computed(() => ({
1945
- name: e.name,
1946
- tabindex: te.value,
1947
- disabled: U.value,
1948
- required: e.required,
1949
- size: e.size,
1950
- autocomplete: e.autocomplete,
1951
- multiple: e.multiple,
1952
- "aria-invalid": re.value,
1953
- "aria-describedby": !c.value && u.value ? E.value : void 0,
1954
- "aria-errormessage": c.value ? E.value : void 0
1955
- })), oe = computed(() => ({
1956
- valid: e.valid,
1957
- invalid: e.invalid,
1958
- modelValue: e.modelValue
1959
- })), { getOptionLabel: fe, getOptionValue: se, getOptionDisabled: he } = useOptions(e), z = computed({
1960
- get: () => e.modelValue,
1961
- set: (R) => {
1962
- Array.isArray(R) && (R = R.filter((Y) => Y !== void 0)), a("update:modelValue", R);
1963
- }
1964
- });
1965
- return (R, Y) => (d(), y("div", {
1966
- class: Z(t(ie))
1967
- }, [
1968
- R.label ? (d(), y("label", {
1969
- key: 0,
1970
- for: t(B)
1971
- }, x(R.label), 9, Zo)) : w("", !0),
1972
- N("div", ea, [
1973
- R.$slots.before ? (d(), y("div", ta, [
1974
- $(R.$slots, "before", j(F(t(oe))))
1975
- ])) : w("", !0),
1976
- N("div", oa, [
1977
- t(ee) ? (d(), W(Q, G({
1978
- key: 0,
1979
- class: "vv-select__icon"
1980
- }, t(K)), null, 16)) : w("", !0),
1981
- Se(N("select", G({
1982
- id: t(B),
1983
- ref_key: "select",
1984
- ref: l,
1985
- "onUpdate:modelValue": Y[0] || (Y[0] = (ae) => Ce(z) ? z.value = ae : null)
1986
- }, t(C)), [
1987
- R.placeholder ? (d(), y("option", {
1988
- key: 0,
1989
- value: void 0,
1990
- disabled: !R.unselectable,
1991
- hidden: !R.unselectable
1992
- }, x(R.placeholder), 9, la)) : w("", !0),
1993
- (d(!0), y(ne, null, ke(R.options, (ae, me) => (d(), y("option", {
1994
- key: me,
1995
- disabled: t(he)(ae),
1996
- value: t(se)(ae)
1997
- }, x(t(fe)(ae)), 9, sa))), 128))
1998
- ], 16, aa), [
1999
- [Bt, t(z)]
2000
- ]),
2001
- t(P) ? (d(), W(Q, G({
2002
- key: 1,
2003
- class: "vv-select__icon vv-select__icon-after"
2004
- }, t(K)), null, 16)) : w("", !0)
2005
- ]),
2006
- R.$slots.after ? (d(), y("div", na, [
2007
- $(R.$slots, "after", j(F(t(oe))))
2008
- ])) : w("", !0)
2009
- ]),
2010
- de(t(i), {
2011
- id: t(E),
2012
- class: "vv-select__hint"
2013
- }, null, 8, ["id"])
2014
- ], 2));
2015
- }
2016
- }), ua = ["id"], da = ["id", "for"], ca = ["id", "aria-controls", "aria-labelledby", "aria-describedby", "placeholder"], va = {
2017
- key: 0,
2018
- class: "vv-select__input-before"
2019
- }, pa = { class: "vv-select__inner" }, fa = ["aria-labelledby", "tabindex"], ma = ["aria-label", "onClick"], ba = {
2020
- key: 1,
2021
- class: "vv-select__input-after"
2022
- }, ha = { class: "vv-dropdown-action__hint" }, ya = {
2023
- name: "VvCombobox",
2024
- components: { VvDropdown: kt, VvDropdownItem: Ct }
2025
- }, _l = /* @__PURE__ */ q({
2026
- ...ya,
2027
- props: qo,
2028
- emits: Fo,
2029
- setup(o, { emit: a }) {
2030
- const e = o, s = useSlots(), { HintSlot: l } = Ve(e, s), i = ref(null), u = ref(null), c = ref(null), { focused: p } = useComponentFocus(i, a), { focused: v } = useFocusWithin(c);
2031
- watch(p, (_) => {
2032
- if (e.autoOpen) {
2033
- if (_ && !f.value) {
2034
- k();
2035
- return;
2036
- }
2037
- !_ && f.value && !v.value && A();
2038
- }
2039
- }), watch(v, (_) => {
2040
- !p.value && !_ && f.value && A();
2041
- });
2042
- const n = ref(""), r = refDebounced(
2043
- n,
2044
- Number(e.debounceSearch)
2045
- );
2046
- watch(
2047
- r,
2048
- () => a("change:search", r.value)
2049
- );
2050
- const f = ref(!1), g = () => {
2051
- e.disabled || e.readonly || (f.value = !f.value);
2052
- }, k = () => {
2053
- e.disabled || e.readonly || f.value || (f.value = !0);
2054
- }, A = () => {
2055
- e.disabled || e.readonly || !f.value || (f.value = !1);
2056
- };
2057
- watch(f, (_) => {
2058
- T.value && nextTick(() => {
2059
- if (_) {
2060
- u.value && u.value.focus();
2061
- return;
2062
- }
2063
- n.value = "";
2064
- });
2065
- });
2066
- const {
2067
- id: b,
2068
- icon: S,
2069
- iconPosition: I,
2070
- modifiers: B,
2071
- disabled: E,
2072
- readonly: O,
2073
- loading: L,
2074
- valid: K,
2075
- invalid: ee,
2076
- floating: P,
2077
- searchable: T
2078
- } = toRefs(e), U = useUniqueId(b), te = computed(() => `${U.value}-hint`), re = computed(() => `${U.value}-dropdown`), ie = computed(() => `${U.value}-search`), C = computed(() => `${U.value}-label`), { hasIcon: oe, hasIconBefore: fe, hasIconAfter: se } = useComponentIcon(
2079
- S,
2080
- I
2081
- ), he = computed(() => !isEmpty(e.modelValue)), z = computed(() => E.value || O.value ? -1 : e.tabindex), R = useBemModifiers(
2082
- "vv-select",
2083
- B,
2084
- computed(() => ({
2085
- disabled: E.value,
2086
- loading: L.value,
2087
- readonly: O.value,
2088
- "icon-before": Boolean(fe.value),
2089
- "icon-after": Boolean(se.value),
2090
- valid: K.value,
2091
- invalid: ee.value,
2092
- dirty: he.value,
2093
- focus: p.value,
2094
- floating: P.value
2095
- }))
2096
- ), Y = computed(
2097
- () => e.searchable ? m.value : e.options
2098
- ), { getOptionLabel: ae, getOptionValue: me, getOptionDisabled: pe } = useOptions(e), m = computed(() => {
2099
- var _;
2100
- return (_ = e.options) == null ? void 0 : _.filter((J) => ae(J).toLowerCase().includes(r.value.toLowerCase().trim()));
2101
- });
2102
- function M(_) {
2103
- return Array.isArray(e.modelValue) ? contains(_, e.modelValue) || contains(me(_), e.modelValue) : equals(_, e.modelValue) || equals(me(_), e.modelValue);
68
+ if (iconsProvider) {
69
+ this._iconsProvider = iconsProvider;
2104
70
  }
2105
- const ue = computed(() => {
2106
- let _ = [];
2107
- return Array.isArray(e.modelValue) ? _ = e.modelValue : e.modelValue && (_ = [e.modelValue]), e.options.filter(
2108
- (J) => _.includes(me(J))
2109
- );
2110
- }), ye = computed(() => ue.value.map((_) => ae(_)).join(e.separator));
2111
- watch(ue, () => {
2112
- !e.multiple && e.autoClose && A();
2113
- });
2114
- const He = () => {
2115
- e.autoOpen ? k() : g();
2116
- }, Ee = (_) => {
2117
- var $e;
2118
- if (e.disabled || e.readonly)
2119
- return;
2120
- const J = me(_);
2121
- let H = J;
2122
- if (e.multiple)
2123
- if (Array.isArray(e.modelValue)) {
2124
- if (e.maxValues !== void 0 && e.maxValues >= 0 && (($e = e.modelValue) == null ? void 0 : $e.length) >= e.maxValues && !contains(J, e.modelValue))
2125
- return;
2126
- H = contains(J, e.modelValue) ? removeFromList(J, e.modelValue) : [...e.modelValue, J];
2127
- } else
2128
- H = [J];
2129
- else
2130
- e.unselectable && J === e.modelValue && (H = void 0);
2131
- a("update:modelValue", H);
2132
- }, D = computed(() => ({
2133
- id: U.value,
2134
- name: e.name,
2135
- tabindex: z.value,
2136
- valid: K.value,
2137
- validLabel: e.validLabel,
2138
- invalid: ee.value,
2139
- invalidLabel: e.invalidLabel,
2140
- hintLabel: e.hintLabel,
2141
- loading: L.value,
2142
- loadingLabel: e.loadingLabel,
2143
- disabled: E.value,
2144
- readonly: O.value,
2145
- modifiers: e.modifiers,
2146
- options: Y.value,
2147
- labelKey: e.labelKey,
2148
- valueKey: e.valueKey,
2149
- icon: e.icon,
2150
- iconPosition: e.iconPosition,
2151
- floating: e.floating,
2152
- unselectable: e.unselectable,
2153
- multiple: e.multiple,
2154
- label: e.label,
2155
- placeholder: e.placeholder,
2156
- modelValue: e.modelValue
2157
- })), le = computed(() => ({
2158
- id: re.value,
2159
- reference: c.value,
2160
- placement: e.placement,
2161
- transitionName: e.transitionName,
2162
- offset: e.offset,
2163
- shift: e.shift,
2164
- flip: e.flip,
2165
- autoPlacement: e.autoPlacement,
2166
- arrow: e.arrow,
2167
- autoClose: e.autoClose,
2168
- autofocusFirst: T.value ? !1 : e.autofocusFirst,
2169
- triggerWidth: e.triggerWidth,
2170
- modifiers: e.dropdownModifiers
2171
- })), we = computed(() => ({
2172
- valid: e.valid,
2173
- invalid: e.invalid,
2174
- modelValue: e.modelValue
2175
- }));
2176
- return onKeyStroke([" ", "Enter"], (_) => {
2177
- e.autoOpen || !f.value && p.value && (_.preventDefault(), _.stopImmediatePropagation(), g());
2178
- }), (_, J) => _.native ? (d(), W(ia, G({ key: 1 }, t(D), {
2179
- "onUpdate:modelValue": J[2] || (J[2] = (H) => a("update:modelValue", H))
2180
- }), null, 16)) : (d(), y("div", {
2181
- key: 0,
2182
- id: t(U),
2183
- class: Z(t(R))
2184
- }, [
2185
- _.label ? (d(), y("label", {
2186
- key: 0,
2187
- id: t(C),
2188
- for: t(T) ? t(ie) : void 0
2189
- }, x(_.label), 9, da)) : w("", !0),
2190
- N("div", {
2191
- ref_key: "wrapperEl",
2192
- ref: c,
2193
- class: "vv-select__wrapper"
2194
- }, [
2195
- de(kt, G({
2196
- modelValue: t(f),
2197
- "onUpdate:modelValue": J[1] || (J[1] = (H) => Ce(f) ? f.value = H : null)
2198
- }, t(le), { role: "listbox" }), Rt({
2199
- default: ve(({ aria: H }) => [
2200
- _.$slots.before ? (d(), y("div", va, [
2201
- $(_.$slots, "before", j(F(t(we))))
2202
- ])) : w("", !0),
2203
- N("div", pa, [
2204
- t(fe) ? (d(), W(Q, G({
2205
- key: 0,
2206
- class: "vv-select__icon"
2207
- }, t(oe)), null, 16)) : w("", !0),
2208
- N("div", G({
2209
- ref_key: "inputEl",
2210
- ref: i
2211
- }, H, {
2212
- "aria-labelledby": t(C),
2213
- class: "vv-select__input",
2214
- role: "combobox",
2215
- tabindex: t(z),
2216
- onClickPassive: He
2217
- }), [
2218
- $(_.$slots, "value", j(F({ selectedOptions: t(ue), onInput: Ee })), () => [
2219
- t(ye) ? (d(), y(ne, { key: 0 }, [
2220
- _.badges ? (d(!0), y(ne, { key: 1 }, ke(t(ue), ($e, Xe) => (d(), W(co, {
2221
- key: Xe,
2222
- modifiers: _.badgeModifiers,
2223
- class: "vv-select__badge"
2224
- }, {
2225
- default: ve(() => [
2226
- X(x(t(ae)($e)) + " ", 1),
2227
- _.unselectable && !t(O) && !t(E) ? (d(), y("button", {
2228
- key: 0,
2229
- "aria-label": _.deselectLabel,
2230
- onClick: it((rl) => Ee($e), ["stop"])
2231
- }, [
2232
- de(Q, { name: "close" })
2233
- ], 8, ma)) : w("", !0)
2234
- ]),
2235
- _: 2
2236
- }, 1032, ["modifiers"]))), 128)) : (d(), y(ne, { key: 0 }, [
2237
- X(x(t(ye)), 1)
2238
- ], 64))
2239
- ], 64)) : (d(), y(ne, { key: 1 }, [
2240
- X(x(_.placeholder), 1)
2241
- ], 64))
2242
- ])
2243
- ], 16, fa),
2244
- t(se) ? (d(), W(Q, G({
2245
- key: 1,
2246
- class: "vv-select__icon vv-select__icon-after"
2247
- }, t(oe)), null, 16)) : w("", !0)
2248
- ]),
2249
- _.$slots.after ? (d(), y("div", ba, [
2250
- $(_.$slots, "after", j(F(t(we))))
2251
- ])) : w("", !0)
2252
- ]),
2253
- items: ve(() => [
2254
- (d(!0), y(ne, null, ke(t(m), (H, $e) => (d(), W(Ct, {
2255
- key: $e,
2256
- class: Z(["vv-dropdown-action", {
2257
- disabled: t(pe)(H),
2258
- selected: M(H),
2259
- "vv-dropdown-action--unselectable": _.unselectable && M(H)
2260
- }]),
2261
- tabindex: t(pe)(H) ? -1 : 0,
2262
- "aria-selected": M(H),
2263
- "aria-disabled": t(pe)(H),
2264
- onClickPassive: (Xe) => Ee(H)
2265
- }, {
2266
- default: ve(() => [
2267
- $(_.$slots, "option", j(F({
2268
- option: H,
2269
- selectedOptions: t(ue),
2270
- selected: M(H),
2271
- disabled: t(pe)(H)
2272
- })), () => [
2273
- X(x(t(ae)(H)) + " ", 1),
2274
- N("span", ha, [
2275
- M(H) ? (d(), y(ne, { key: 0 }, [
2276
- X(x(_.unselectable ? _.pressToDeselectLabel : _.selectedLabel), 1)
2277
- ], 64)) : t(pe)(H) ? w("", !0) : (d(), y(ne, { key: 1 }, [
2278
- X(x(_.pressToSelectLabel), 1)
2279
- ], 64))
2280
- ])
2281
- ])
2282
- ]),
2283
- _: 2
2284
- }, 1032, ["tabindex", "class", "aria-selected", "aria-disabled", "onClickPassive"]))), 128))
2285
- ]),
2286
- _: 2
2287
- }, [
2288
- t(T) ? {
2289
- name: "before",
2290
- fn: ve(() => [
2291
- t(T) ? Se((d(), y("input", {
2292
- key: 0,
2293
- id: t(ie),
2294
- ref_key: "inputSearchEl",
2295
- ref: u,
2296
- "onUpdate:modelValue": J[0] || (J[0] = (H) => Ce(n) ? n.value = H : null),
2297
- "aria-autocomplete": "list",
2298
- "aria-controls": t(re),
2299
- "aria-labelledby": t(C),
2300
- "aria-describedby": t(te),
2301
- autocomplete: "off",
2302
- spellcheck: "false",
2303
- type: "search",
2304
- class: "vv-dropdown__search",
2305
- placeholder: _.searchPlaceholder
2306
- }, null, 8, ca)), [
2307
- [qe, t(f)],
2308
- [ct, t(n)]
2309
- ]) : w("", !0)
2310
- ]),
2311
- key: "0"
2312
- } : void 0
2313
- ]), 1040, ["modelValue"])
2314
- ], 512),
2315
- de(t(l), {
2316
- id: t(te),
2317
- class: "vv-select__hint"
2318
- }, null, 8, ["id"])
2319
- ], 10, ua));
2320
- }
2321
- }), ga = ["open", "close", "update:modelValue"], _a = {
2322
- ...Ne,
2323
- /**
2324
- * Dialog title
2325
- */
2326
- title: String,
2327
- /**
2328
- * Show / hide dialog programmatically
2329
- */
2330
- modelValue: Boolean,
2331
- /**
2332
- * Dialog transition
2333
- */
2334
- transition: { type: String, default: "fade-block" },
2335
- /**
2336
- * Dialog size
2337
- */
2338
- size: String,
2339
- /**
2340
- * Close dialog on click outside
2341
- */
2342
- autoClose: { type: Boolean, default: !0 }
2343
- }, Sa = {
2344
- key: 0,
2345
- class: "vv-dialog__header"
2346
- }, Va = { class: "vv-dialog__content" }, $a = {
2347
- key: 1,
2348
- class: "vv-dialog__footer"
2349
- }, ka = {
2350
- name: "VvDialog"
2351
- }, Sl = /* @__PURE__ */ q({
2352
- ...ka,
2353
- props: _a,
2354
- emits: ga,
2355
- setup(o, { emit: a }) {
2356
- const e = o, s = useVModel(e, "modelValue", a), l = ref(!0), i = ref(null), u = computed(() => {
2357
- const { id: r } = e;
2358
- return {
2359
- id: r,
2360
- open: l.value
2361
- };
2362
- }), c = computed(() => e.size ? ["vv-dialog", `vv-dialog--${e.size}`] : "vv-dialog"), p = computed(() => `vv-dialog--${e.transition}`), v = {
2363
- "before-enter": () => {
2364
- l.value = !0, a("open");
2365
- },
2366
- "after-leave": () => {
2367
- l.value = !1, a("close");
2368
- }
2369
- };
2370
- onClickOutside(i, () => {
2371
- e.autoClose && (s.value = !1);
2372
- });
2373
- function n() {
2374
- s.value = !1;
71
+ if (nuxt) {
72
+ this._nuxt = nuxt;
2375
73
  }
2376
- return onKeyStroke("Escape", (r) => {
2377
- s.value && (r.preventDefault(), n());
2378
- }), (r, f) => (d(), W(dt, G({ name: t(p) }, Tt(v)), {
2379
- default: ve(() => [
2380
- Se(N("dialog", G(t(u), { class: t(c) }), [
2381
- N("article", {
2382
- ref_key: "modalWrapper",
2383
- ref: i,
2384
- class: "vv-dialog__wrapper"
2385
- }, [
2386
- r.$slots.header || r.title ? (d(), y("header", Sa, [
2387
- $(r.$slots, "header", {}, () => [
2388
- X(x(r.title) + " ", 1),
2389
- N("button", {
2390
- type: "button",
2391
- "aria-label": "Close",
2392
- class: "vv-dialog__close",
2393
- onClickPassive: n
2394
- }, [
2395
- de(Q, { name: "close" })
2396
- ], 32)
2397
- ])
2398
- ])) : w("", !0),
2399
- N("div", Va, [
2400
- $(r.$slots, "default")
2401
- ]),
2402
- r.$slots.footer ? (d(), y("footer", $a, [
2403
- $(r.$slots, "footer")
2404
- ])) : w("", !0)
2405
- ], 512)
2406
- ], 16), [
2407
- [qe, t(s)]
2408
- ])
2409
- ]),
2410
- _: 3
2411
- }, 16, ["name"]));
2412
- }
2413
- }), V = {
2414
- TEXT: "text",
2415
- PASSWORD: "password",
2416
- NUMBER: "number",
2417
- EMAIL: "email",
2418
- TEL: "tel",
2419
- URL: "url",
2420
- COLOR: "color",
2421
- SEARCH: "search",
2422
- DATE: "date",
2423
- TIME: "time",
2424
- DATETIME_LOCAL: "datetime-local",
2425
- MONTH: "month",
2426
- WEEK: "week"
2427
- }, _e = {
2428
- PASSWORD_SHOW: "eye-on",
2429
- PASSWORD_HIDE: "eye-off",
2430
- DATE: "calendar",
2431
- TIME: "time",
2432
- COLOR: "color",
2433
- SEARCH: "close"
2434
- }, Ca = ["update:modelValue", "focus", "blur", "keyup"], Aa = {
2435
- ...gt,
2436
- /**
2437
- * Input value
2438
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
2439
- */
2440
- modelValue: [String, Number],
2441
- /**
2442
- * Type of form control
2443
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#type
2444
- */
2445
- type: {
2446
- type: String,
2447
- default: V.TEXT,
2448
- validator: (o) => Object.values(V).includes(o)
2449
- },
2450
- /**
2451
- * Minimum value
2452
- * Available for input types: date, month, week, time, datetime-local, number, range.
2453
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#min
2454
- */
2455
- min: [Number, Date, String],
2456
- /**
2457
- * Maximum value
2458
- * Available for input types: date, month, week, time, datetime-local, number, range.
2459
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#max
2460
- */
2461
- max: [Number, Date, String],
2462
- /**
2463
- * Incremental values that are valid
2464
- * Available for input types: date, month, week, time, datetime-local and number
2465
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step
2466
- */
2467
- step: { type: [String, Number], default: 1 },
2468
- /**
2469
- * Pattern the value must match to be valid
2470
- * Available for input types: text, search, url, tel, email and password
2471
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#pattern
2472
- */
2473
- pattern: String,
2474
- /**
2475
- * Whether to allow multiple values
2476
- * Available for input type email
2477
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#multiple
2478
- */
2479
- multiple: Boolean,
2480
- /**
2481
- * VvIcon name for show password button
2482
- * @see VVIcon
2483
- */
2484
- iconShowPassword: {
2485
- type: String,
2486
- default: _e.PASSWORD_SHOW
2487
- },
2488
- /**
2489
- * VvIcon name for hide password button
2490
- * @see VVIcon
2491
- */
2492
- iconHidePassword: {
2493
- type: String,
2494
- default: _e.PASSWORD_HIDE
2495
- },
2496
- /**
2497
- * VvIcon name for clear button
2498
- * @see VVIcon
2499
- */
2500
- iconClear: {
2501
- type: String,
2502
- default: _e.SEARCH
2503
- },
2504
- /**
2505
- * Label for step up button
2506
- */
2507
- labelStepUp: {
2508
- type: String,
2509
- default: "Increase value"
2510
- },
2511
- /**
2512
- * Label for step down button
2513
- */
2514
- labelStepDown: {
2515
- type: String,
2516
- default: "Decrease value"
2517
- },
2518
- /**
2519
- * Label for show password button
2520
- */
2521
- labelShowPassword: {
2522
- type: String,
2523
- default: "Show password"
2524
- },
2525
- /**
2526
- * Label for hide password button
2527
- */
2528
- labelHidePassword: {
2529
- type: String,
2530
- default: "Hide password"
2531
- },
2532
- /**
2533
- * Label for clear button
2534
- */
2535
- labelClear: {
2536
- type: String,
2537
- default: "Clear"
2538
- }
2539
- }, st = defineComponent({
2540
- components: {
2541
- VvIcon: Q
2542
- },
2543
- props: {
2544
- disabled: {
2545
- type: Boolean,
2546
- default: !1
2547
- },
2548
- labelShow: {
2549
- type: String,
2550
- default: "Show password"
2551
- },
2552
- labelHide: {
2553
- type: String,
2554
- default: "Hide password"
2555
- },
2556
- iconShow: {
2557
- type: String,
2558
- default: _e.PASSWORD_SHOW
2559
- },
2560
- iconHide: {
2561
- type: String,
2562
- default: _e.PASSWORD_HIDE
74
+ if (iconsCollections && Array.isArray(iconsCollections)) {
75
+ iconsCollections.forEach((iconsCollection) => {
76
+ this.addCollection(iconsCollection, this._iconsProvider);
77
+ });
2563
78
  }
2564
- },
2565
- emits: ["toggle-password"],
2566
- setup(o, { emit: a }) {
2567
- const e = ref(!1), s = computed(
2568
- () => e.value ? o.iconHide : o.iconShow
2569
- );
2570
- function l(i) {
2571
- i == null || i.stopPropagation(), o.disabled || (e.value = !e.value, a("toggle-password", e.value));
79
+ if (defaults) {
80
+ this.defaults.value = defaults;
2572
81
  }
2573
- return {
2574
- active: e,
2575
- activeIcon: s,
2576
- onClick: l
2577
- };
2578
- },
2579
- render() {
2580
- const o = h(Q, {
2581
- name: this.activeIcon,
2582
- class: "vv-input-text__action-icon"
2583
- });
2584
- return h(
2585
- "button",
2586
- {
2587
- disabled: this.disabled,
2588
- class: "vv-input-text__action",
2589
- ariaLabel: this.active ? this.labelHide : this.labelShow,
2590
- type: "button",
2591
- onClick: this.onClick
2592
- },
2593
- o
2594
- );
2595
82
  }
2596
- }), Ue = defineComponent({
2597
- components: {
2598
- VvIcon: Q
2599
- },
2600
- props: {
2601
- disabled: {
2602
- type: Boolean,
2603
- default: !1
2604
- },
2605
- label: {
2606
- type: String
2607
- },
2608
- mode: {
2609
- type: String,
2610
- validator: (o) => ["up", "down"].includes(o),
2611
- default: "up"
2612
- }
2613
- },
2614
- emits: ["step-up", "step-down"],
2615
- setup(o, { emit: a }) {
2616
- const e = computed(() => o.mode === "up");
2617
- return {
2618
- isUp: e,
2619
- onClick: (l) => {
2620
- l == null || l.stopPropagation(), o.disabled || a(e.value ? "step-up" : "step-down");
2621
- }
2622
- };
2623
- },
2624
- render() {
2625
- return h("button", {
2626
- class: [
2627
- "vv-input-text__action-chevron",
2628
- this.isUp && "vv-input-text__action-chevron-up"
2629
- ],
2630
- disabled: this.disabled,
2631
- ariaLabel: this.label,
2632
- onClick: this.onClick
2633
- });
83
+ get nuxt() {
84
+ return this._nuxt;
2634
85
  }
2635
- }), nt = defineComponent({
2636
- components: {
2637
- VvIcon: Q
2638
- },
2639
- props: {
2640
- disabled: {
2641
- type: Boolean,
2642
- default: !1
2643
- },
2644
- label: {
2645
- type: String,
2646
- default: "Clear"
2647
- },
2648
- icon: {
2649
- type: String,
2650
- default: "close"
2651
- }
2652
- },
2653
- emits: ["clear"],
2654
- setup(o, { emit: a }) {
2655
- function e(s) {
2656
- s == null || s.stopPropagation(), o.disabled || a("clear");
2657
- }
2658
- return {
2659
- onClick: e
2660
- };
2661
- },
2662
- render() {
2663
- const o = h(Q, {
2664
- name: this.icon,
2665
- class: "vv-input-text__action-icon"
2666
- });
2667
- return h(
2668
- "button",
2669
- {
2670
- disabled: this.disabled,
2671
- class: "vv-input-text__action",
2672
- ariaLabel: this.label,
2673
- type: "button",
2674
- onClick: this.onClick
2675
- },
2676
- o
2677
- );
86
+ get iconsProvider() {
87
+ return this._iconsProvider;
2678
88
  }
2679
- });
2680
- function We(o, a) {
2681
- return {
2682
- name: "VvInputTextActions",
2683
- components: {
2684
- VvIcon: Q,
2685
- VvInputPasswordAction: st,
2686
- VvInputStepAction: Ue,
2687
- VvInputClearAction: nt
2688
- },
2689
- setup() {
2690
- return {
2691
- isDisabled: computed(() => a.disabled || a.readonly),
2692
- labelStepUp: a.labelStepUp,
2693
- labelStepDown: a.labelStepDown,
2694
- labelShowPassword: a.labelShowPassword,
2695
- labelHidePassword: a.labelHidePassword,
2696
- labelClear: a.labelClear,
2697
- iconShowPassword: a.iconShowPassword,
2698
- iconHidePassword: a.iconHidePassword
2699
- };
2700
- },
2701
- render() {
2702
- let e = null;
2703
- switch (o) {
2704
- case V.SEARCH: {
2705
- const { onClear: s } = this.$attrs;
2706
- e = [
2707
- h(nt, {
2708
- disabled: this.isDisabled,
2709
- label: this.labelShowPassword,
2710
- onClear: s
2711
- })
2712
- ];
2713
- break;
2714
- }
2715
- case V.PASSWORD: {
2716
- const { onTogglePassword: s } = this.$attrs;
2717
- e = [
2718
- h(st, {
2719
- disabled: this.isDisabled,
2720
- onTogglePassword: s,
2721
- labelShow: this.labelShowPassword,
2722
- labelHide: this.labelHidePassword,
2723
- iconShow: this.iconShowPassword,
2724
- iconHide: this.iconHidePassword
2725
- })
2726
- ];
2727
- break;
2728
- }
2729
- case V.NUMBER: {
2730
- const { onStepUp: s, onStepDown: l } = this.$attrs;
2731
- e = [
2732
- h(Ue, {
2733
- mode: "up",
2734
- disabled: this.isDisabled || a.max !== void 0 && a.modelValue === a.max,
2735
- label: this.labelStepUp,
2736
- onStepUp: s,
2737
- onStepDown: l
2738
- }),
2739
- h(Ue, {
2740
- mode: "down",
2741
- disabled: this.isDisabled || a.min !== void 0 && a.modelValue === a.min,
2742
- label: this.labelStepDown,
2743
- onStepUp: s,
2744
- onStepDown: l
2745
- })
2746
- ];
2747
- break;
2748
- }
2749
- }
2750
- return Array.isArray(e) ? h("div", { class: "vv-input-text__actions-group" }, e) : e;
2751
- }
2752
- };
2753
- }
2754
- const wa = ["for"], Ea = { class: "vv-input-text__wrapper" }, Ia = {
2755
- key: 0,
2756
- class: "vv-input-text__input-before"
2757
- }, Pa = { class: "vv-input-text__inner" }, Oa = ["id"], Da = {
2758
- key: 1,
2759
- class: "vv-input-text__input-after"
2760
- }, Ba = {
2761
- key: 2,
2762
- class: "vv-input-text__limit"
2763
- }, Ra = {
2764
- name: "VvInputText"
2765
- }, Vl = /* @__PURE__ */ q({
2766
- ...Ra,
2767
- props: Aa,
2768
- emits: Ca,
2769
- setup(o, { emit: a }) {
2770
- const e = o, s = useSlots(), l = ref(), {
2771
- id: i,
2772
- icon: u,
2773
- iconPosition: c,
2774
- label: p,
2775
- modelValue: v,
2776
- count: n,
2777
- valid: r,
2778
- invalid: f,
2779
- loading: g
2780
- } = toRefs(e), k = useUniqueId(i), A = computed(() => `${k.value}-hint`), b = computed(
2781
- () => e.floating && isEmpty(e.placeholder) ? " " : e.placeholder
2782
- ), S = useDebouncedInput(v, a, e.debounce), { focused: I } = useComponentFocus(l, a), B = useElementVisibility(l);
2783
- watch(B, (D) => {
2784
- D && e.autofocus && (I.value = !0);
2785
- });
2786
- const E = ref(!1), O = computed(() => e.type === V.PASSWORD), L = () => {
2787
- E.value = !E.value;
2788
- }, K = computed(
2789
- () => e.type === V.TIME || e.type === V.DATETIME_LOCAL || e.type === V.DATE || e.type === V.WEEK || e.type === V.MONTH
2790
- ), ee = computed(() => e.type === V.NUMBER), P = () => {
2791
- se.value && (l.value.stepUp(), S.value = unref(l).value);
2792
- }, T = () => {
2793
- se.value && (l.value.stepDown(), S.value = unref(l).value);
2794
- }, U = computed(() => e.type === V.SEARCH), te = () => {
2795
- S.value = void 0;
2796
- }, { hasIcon: re, hasIconBefore: ie, hasIconAfter: C } = useComponentIcon(
2797
- u,
2798
- c
2799
- ), oe = computed(() => {
2800
- switch (e.type) {
2801
- case V.COLOR:
2802
- return { name: _e.COLOR };
2803
- case V.DATE:
2804
- case V.DATETIME_LOCAL:
2805
- case V.WEEK:
2806
- case V.MONTH:
2807
- return { name: _e.DATE };
2808
- case V.TIME:
2809
- return { name: _e.TIME };
2810
- default:
2811
- return "";
2812
- }
2813
- }), { formatted: fe } = useTextCount(S, {
2814
- mode: e.count,
2815
- upperLimit: e.maxlength,
2816
- lowerLimit: e.minlength
2817
- }), se = computed(() => !e.disabled && !e.readonly), he = computed(
2818
- () => se.value ? e.tabindex : -1
2819
- ), z = computed(() => !isEmpty(v)), R = computed(() => {
2820
- if (f.value === !0)
2821
- return !0;
2822
- if (r.value === !0)
2823
- return !1;
2824
- }), { modifiers: Y } = toRefs(e), ae = useBemModifiers(
2825
- "vv-input-text",
2826
- Y,
2827
- computed(() => ({
2828
- valid: r.value,
2829
- invalid: f.value,
2830
- loading: g.value,
2831
- disabled: e.disabled,
2832
- readonly: e.readonly,
2833
- "icon-before": ie.value,
2834
- "icon-after": C.value || !isEmpty(oe),
2835
- floating: e.floating && !isEmpty(e.label),
2836
- dirty: z.value,
2837
- focus: I.value
2838
- }))
2839
- ), me = computed(() => {
2840
- const D = (() => O.value && E.value || K.value && !z.value && !I.value ? V.TEXT : e.type)(), le = {
2841
- type: D,
2842
- name: e.name,
2843
- tabindex: he.value,
2844
- disabled: e.disabled,
2845
- readonly: e.readonly,
2846
- required: e.required,
2847
- autocomplete: e.autocomplete,
2848
- "aria-invalid": R.value,
2849
- "aria-describedby": !ue.value && M.value ? A.value : void 0,
2850
- "aria-errormessage": ue.value ? A.value : void 0
2851
- };
2852
- return (D === V.DATE || D === V.MONTH || D === V.WEEK || D === V.TIME || D === V.DATETIME_LOCAL || D === V.NUMBER) && (le.step = e.step, le.max = String(e.max), le.min = String(e.min)), (D === V.TEXT || D === V.SEARCH || D === V.URL || D === V.TEL || D === V.EMAIL || D === V.PASSWORD || D === V.NUMBER) && (le.placeholder = b.value), (D === V.TEXT || D === V.SEARCH || D === V.URL || D === V.TEL || D === V.EMAIL || D === V.PASSWORD) && (le.minlength = e.minlength, le.maxlength = e.maxlength, le.pattern = e.pattern), D === V.EMAIL && (le.multiple = e.multiple), le;
2853
- }), pe = computed(() => ({
2854
- valid: e.valid,
2855
- invalid: e.invalid,
2856
- modelValue: e.modelValue,
2857
- togglePassword: L,
2858
- stepUp: P,
2859
- stepDown: T,
2860
- clear: te
2861
- })), { HintSlot: m, hasHint: M, hasInvalid: ue } = Ve(e, s), ye = We(
2862
- V.PASSWORD,
2863
- e
2864
- ), He = We(
2865
- V.NUMBER,
2866
- e
2867
- ), Ee = We(
2868
- V.SEARCH,
2869
- e
2870
- );
2871
- return (D, le) => (d(), y("div", {
2872
- class: Z(t(ae))
2873
- }, [
2874
- t(p) ? (d(), y("label", {
2875
- key: 0,
2876
- for: t(k),
2877
- class: "vv-input-text__label"
2878
- }, x(t(p)), 9, wa)) : w("", !0),
2879
- N("div", Ea, [
2880
- D.$slots.before ? (d(), y("div", Ia, [
2881
- $(D.$slots, "before", j(F(t(pe))))
2882
- ])) : w("", !0),
2883
- N("div", Pa, [
2884
- t(ie) ? (d(), W(Q, G({
2885
- key: 0,
2886
- class: "vv-input-text__icon"
2887
- }, t(re)), null, 16)) : w("", !0),
2888
- Se(N("input", G({
2889
- id: t(k),
2890
- ref_key: "input",
2891
- ref: l,
2892
- "onUpdate:modelValue": le[0] || (le[0] = (we) => Ce(S) ? S.value = we : null)
2893
- }, t(me), {
2894
- onKeyup: le[1] || (le[1] = (we) => a("keyup", we))
2895
- }), null, 16, Oa), [
2896
- [Mt, t(S)]
2897
- ]),
2898
- t(C) || t(oe) ? (d(), W(Q, G({
2899
- key: 1,
2900
- class: "vv-input-text__icon vv-input-text__icon-after"
2901
- }, t(C) ? t(re) : t(oe)), null, 16)) : t(O) ? (d(), W(t(ye), {
2902
- key: 2,
2903
- onTogglePassword: L
2904
- })) : t(ee) ? (d(), W(t(He), {
2905
- key: 3,
2906
- onStepUp: P,
2907
- onStepDown: T
2908
- })) : t(U) ? (d(), W(t(Ee), {
2909
- key: 4,
2910
- onClear: te
2911
- })) : w("", !0)
2912
- ]),
2913
- D.$slots.after ? (d(), y("div", Da, [
2914
- $(D.$slots, "after", j(F(t(pe))))
2915
- ])) : w("", !0),
2916
- t(n) ? (d(), y("span", Ba, [
2917
- $(D.$slots, "count", j(F(t(pe))), () => [
2918
- X(x(t(fe)), 1)
2919
- ])
2920
- ])) : w("", !0)
2921
- ]),
2922
- de(t(m), {
2923
- id: t(A),
2924
- class: "vv-input-text__hint"
2925
- }, null, 8, ["id"])
2926
- ], 2));
89
+ get iconsCollections() {
90
+ return this._iconsCollections;
2927
91
  }
2928
- }), Ta = {
2929
- ...ce,
2930
- /**
2931
- * Progress value
2932
- * This attribute specifies how much of the task that has been completed.
2933
- * It must be a valid floating point number between 0 and max, or between 0 and 1 if max is omitted.
2934
- * If there is no value attribute, the progress bar is indeterminate.
2935
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress#attr-max
2936
- */
2937
- value: {
2938
- type: [Number, String],
2939
- default: void 0
2940
- },
2941
- /**
2942
- * Progress max
2943
- * This attribute describes how much work the task indicated by the progress element requires.
2944
- * The max attribute, if present, must have a value greater than 0 and be a valid floating point number. The default value is 1.
2945
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress#attr-max
2946
- */
2947
- max: {
2948
- type: [Number, String]
2949
- },
2950
- /**
2951
- * Progress aria-label
2952
- */
2953
- label: {
2954
- type: String,
2955
- required: !0
92
+ addCollection(collection, providerName = this._iconsProvider) {
93
+ this._iconsCollections.push(collection);
94
+ return addCollection(collection, providerName);
2956
95
  }
2957
- }, Ma = {
2958
- name: "VvProgress"
2959
- }, $l = /* @__PURE__ */ q({
2960
- ...Ma,
2961
- props: Ta,
2962
- setup(o) {
2963
- const a = o, { value: e, max: s, label: l } = toRefs(a), i = computed(() => a.value === void 0), { modifiers: u } = toRefs(a), c = useBemModifiers(
2964
- "vv-progress",
2965
- u,
2966
- computed(() => ({ indeterminate: i.value }))
2967
- );
2968
- return (p, v) => (d(), y("progress", G({ role: "progressbar" }, {
2969
- class: t(c),
2970
- ariaLabel: t(l),
2971
- max: t(s),
2972
- value: t(e)
2973
- }), null, 16));
96
+ addIcon(name, data) {
97
+ return addIcon(name, data);
2974
98
  }
2975
- }), xa = _t, Na = ["click", "update:modelValue", "change", "blur"];
2976
- function La(o, a) {
2977
- const { id: e } = toRefs(o), { group: s, isInGroup: l, getGroupOrLocalRef: i } = useInjectedGroupState(ft), u = i("modelValue", o, a), c = i("readonly", o), p = i("disabled", o), v = i("valid", o), n = i("invalid", o);
2978
- return {
2979
- // local props
2980
- id: e,
2981
- // global props
2982
- group: s,
2983
- isInGroup: l,
2984
- modelValue: u,
2985
- readonly: c,
2986
- disabled: p,
2987
- valid: v,
2988
- invalid: n
2989
- };
2990
- }
2991
- const Ha = ["for"], Ga = ["id", "name", "disabled", "value", "tabindex", "aria-invalid"], Ua = {
2992
- name: "VvRadio"
2993
- }, Wa = /* @__PURE__ */ q({
2994
- ...Ua,
2995
- props: xa,
2996
- emits: Na,
2997
- setup(o, { emit: a }) {
2998
- const e = o, s = useSlots(), { id: l, disabled: i, readonly: u, modelValue: c, valid: p, invalid: v } = La(e, a), n = useUniqueId(l), r = computed(() => g.value ? -1 : e.tabindex), f = ref(), g = computed(() => i.value || u.value), k = computed(() => {
2999
- if (v.value === !0)
3000
- return !0;
3001
- if (p.value === !0)
3002
- return !1;
3003
- }), A = computed(
3004
- () => Array.isArray(c.value) ? contains(e.value, c.value) : equals(e.value, c.value)
3005
- ), b = computed(
3006
- () => ["string", "number", "boolean"].includes(typeof e.value) ? e.value : !0
3007
- ), S = computed({
3008
- get() {
3009
- return A.value ? b.value : null;
3010
- },
3011
- set(O) {
3012
- Array.isArray(c.value) ? c.value = [e.value] : c.value = e.value, a("change", O);
3013
- }
3014
- }), { modifiers: I } = toRefs(e), B = useBemModifiers(
3015
- "vv-radio",
3016
- I,
3017
- computed(() => ({
3018
- valid: p.value,
3019
- invalid: v.value,
3020
- disabled: i.value,
3021
- readonly: u.value
3022
- }))
3023
- ), { HintSlot: E } = Ve(e, s);
3024
- return (O, L) => (d(), y("label", {
3025
- class: Z(t(B)),
3026
- for: t(n)
3027
- }, [
3028
- Se(N("input", {
3029
- id: t(n),
3030
- ref_key: "input",
3031
- ref: f,
3032
- "onUpdate:modelValue": L[0] || (L[0] = (K) => Ce(S) ? S.value = K : null),
3033
- type: "radio",
3034
- class: "vv-radio__input",
3035
- name: O.name,
3036
- disabled: t(g),
3037
- value: t(b),
3038
- tabindex: t(r),
3039
- "aria-invalid": t(k)
3040
- }, null, 8, Ga), [
3041
- [xt, t(S)]
3042
- ]),
3043
- $(O.$slots, "default", { value: t(c) }, () => [
3044
- X(x(O.label), 1)
3045
- ]),
3046
- de(t(E), {
3047
- class: "vv-radio__hint",
3048
- params: { value: t(c) }
3049
- }, null, 8, ["params"])
3050
- ], 10, Ha));
99
+ addIconsAPIProvider(provider, customConfig) {
100
+ return addAPIProvider(provider, customConfig);
3051
101
  }
3052
- }), ja = St, Fa = ["update:modelValue", "change"], qa = ["textContent"], Ka = { class: "vv-radio-group__wrapper" }, za = {
3053
- name: "VvRadioGroup"
3054
- }, kl = /* @__PURE__ */ q({
3055
- ...za,
3056
- props: ja,
3057
- emits: Fa,
3058
- setup(o, { emit: a }) {
3059
- const e = o, s = useSlots(), l = useVModel(e, "modelValue", a), { disabled: i, readonly: u, vertical: c, valid: p, invalid: v, modifiers: n } = toRefs(e);
3060
- useProvideGroupState({
3061
- key: ft,
3062
- modelValue: l,
3063
- disabled: i,
3064
- readonly: u,
3065
- valid: p,
3066
- invalid: v
102
+ fetchIcon(src, options = { cache: "force-cache" }) {
103
+ return new Promise((resolve, reject) => {
104
+ fetch(src, { ...this._fetchOptions, ...options }).catch((e) => reject(e)).then((response) => response == null ? void 0 : response.text()).then((svg) => resolve(svg));
3067
105
  });
3068
- const { getOptionLabel: r, getOptionValue: f } = useOptions(e), g = useBemModifiers(
3069
- "vv-radio-group",
3070
- n,
3071
- computed(() => ({
3072
- disabled: i.value,
3073
- readonly: u.value,
3074
- horizontal: !c.value,
3075
- valid: p.value,
3076
- invalid: v.value
3077
- }))
3078
- ), k = (b, S) => ({
3079
- id: `${e.name}_opt${S}`,
3080
- name: e.name,
3081
- label: r(b),
3082
- value: f(b)
3083
- }), { HintSlot: A } = Ve(e, s);
3084
- return (b, S) => (d(), y("fieldset", {
3085
- class: Z(t(g))
3086
- }, [
3087
- b.label ? (d(), y("legend", {
3088
- key: 0,
3089
- textContent: x(b.label)
3090
- }, null, 8, qa)) : w("", !0),
3091
- N("div", Ka, [
3092
- b.options.length > 0 ? (d(!0), y(ne, { key: 0 }, ke(b.options, (I, B) => (d(), W(Wa, G({ key: B }, k(I, B)), null, 16))), 128)) : $(b.$slots, "default", { key: 1 })
3093
- ]),
3094
- de(t(A), { class: "vv-radio-group__hint" })
3095
- ], 2));
3096
106
  }
3097
- }), Ya = {
3098
- hard: "hard",
3099
- soft: "soft"
3100
- }, Ja = {
3101
- true: !0,
3102
- false: !1,
3103
- default: "default"
3104
- }, Xa = ["update:modelValue", "focus", "blur", "keyup"], Qa = {
3105
- ...gt,
3106
- /**
3107
- * Textarea value
3108
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#value
3109
- */
3110
- modelValue: String,
3111
- /**
3112
- * The visible width of the text control, in average character widths. If it is specified, it must be a positive integer. If it is not specified, the default value is 20.
3113
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#cols
3114
- */
3115
- cols: { type: [String, Number], default: 20 },
3116
- /**
3117
- * The number of visible text lines for the control. If it is specified, it must be a positive integer. If it is not specified, the default value is 2.
3118
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#rows
3119
- */
3120
- rows: { type: [String, Number], default: 2 },
3121
- /**
3122
- * Indicates how the control should wrap the value for form submission.
3123
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#wrap
3124
- */
3125
- wrap: { type: String, default: Ya.soft },
3126
- /**
3127
- * Specifies whether the <textarea> is subject to spell checking by the underlying browser/OS.
3128
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#wrap
3129
- */
3130
- spellcheck: { type: [Boolean, String], default: Ja.default },
107
+ }
108
+ const VolverPlugin = {
3131
109
  /**
3132
- * If true, the textarea will be resizable
110
+ * Vue.use() hook
111
+ * @param {App} Vue
112
+ * @param {Object} options
3133
113
  */
3134
- resizable: Boolean
3135
- }, Za = ["for"], el = { class: "vv-textarea__wrapper" }, tl = {
3136
- key: 0,
3137
- class: "vv-textarea__input-before"
3138
- }, ol = { class: "vv-textarea__inner" }, al = ["id"], ll = {
3139
- key: 1,
3140
- class: "vv-textarea__input-after"
3141
- }, sl = {
3142
- key: 2,
3143
- class: "vv-textarea__limit"
3144
- }, nl = {
3145
- name: "VvTextarea"
3146
- }, Cl = /* @__PURE__ */ q({
3147
- ...nl,
3148
- props: Qa,
3149
- emits: Xa,
3150
- setup(o, { emit: a }) {
3151
- const e = o, s = useSlots(), l = ref(), {
3152
- id: i,
3153
- icon: u,
3154
- iconPosition: c,
3155
- label: p,
3156
- modelValue: v,
3157
- count: n,
3158
- valid: r,
3159
- invalid: f,
3160
- loading: g,
3161
- modifiers: k
3162
- } = toRefs(e), A = useUniqueId(i), b = computed(() => `${A.value}-hint`), S = computed(
3163
- () => e.floating && isEmpty(e.placeholder) ? " " : e.placeholder
3164
- ), I = useDebouncedInput(v, a, e.debounce), { hasIcon: B, hasIconBefore: E, hasIconAfter: O } = useComponentIcon(
3165
- u,
3166
- c
3167
- ), { focused: L } = useComponentFocus(l, a), K = useElementVisibility(l);
3168
- watch(K, (z) => {
3169
- z && e.autofocus && (L.value = !0);
3170
- });
3171
- const { formatted: ee } = useTextCount(I, {
3172
- mode: e.count,
3173
- upperLimit: e.maxlength,
3174
- lowerLimit: e.minlength
3175
- }), P = computed(() => !e.disabled && !e.readonly), T = computed(
3176
- () => P.value ? e.tabindex : -1
3177
- ), U = computed(() => !isEmpty(v)), te = computed(() => {
3178
- if (e.invalid === !0)
3179
- return !0;
3180
- if (e.valid === !0)
3181
- return !1;
3182
- }), { HintSlot: re, hasHint: ie, hasInvalid: C } = Ve(e, s), oe = useBemModifiers(
3183
- "vv-textarea",
3184
- k,
3185
- computed(() => ({
3186
- valid: r.value,
3187
- invalid: f.value,
3188
- loading: g.value,
3189
- disabled: e.disabled,
3190
- readonly: e.readonly,
3191
- "icon-before": E.value,
3192
- "icon-after": O.value,
3193
- floating: e.floating && !isEmpty(e.label),
3194
- dirty: U.value,
3195
- focused: L.value,
3196
- resizable: e.resizable
3197
- }))
3198
- ), fe = computed(
3199
- () => ({
3200
- name: e.name,
3201
- placeholder: S.value,
3202
- tabindex: T.value,
3203
- disabled: e.disabled,
3204
- readonly: e.readonly,
3205
- required: e.required,
3206
- autocomplete: e.autocomplete,
3207
- minlength: e.minlength,
3208
- maxlength: e.maxlength,
3209
- cols: e.cols,
3210
- rows: e.rows,
3211
- wrap: e.wrap,
3212
- spellcheck: e.spellcheck,
3213
- "aria-invalid": te.value,
3214
- "aria-describedby": !C.value && ie.value ? b.value : void 0,
3215
- "aria-errormessage": C.value ? b.value : void 0
3216
- })
3217
- ), se = computed(() => ({
3218
- valid: e.valid,
3219
- invalid: e.invalid,
3220
- modelValue: e.modelValue,
3221
- hintLabel: e.hintLabel,
3222
- maxlength: e.maxlength,
3223
- minlength: e.minlength,
3224
- clear: he
3225
- })), he = () => {
3226
- I.value = void 0;
3227
- };
3228
- return (z, R) => (d(), y("div", {
3229
- class: Z(t(oe))
3230
- }, [
3231
- t(p) ? (d(), y("label", {
3232
- key: 0,
3233
- for: t(A),
3234
- class: "vv-textarea__label"
3235
- }, x(t(p)), 9, Za)) : w("", !0),
3236
- N("div", el, [
3237
- z.$slots.before ? (d(), y("div", tl, [
3238
- $(z.$slots, "before", j(F(t(se))))
3239
- ])) : w("", !0),
3240
- N("div", ol, [
3241
- t(E) ? (d(), W(Q, G({
3242
- key: 0,
3243
- class: "vv-textarea__icon"
3244
- }, t(B)), null, 16)) : w("", !0),
3245
- Se(N("textarea", G({
3246
- id: t(A),
3247
- ref_key: "textarea",
3248
- ref: l,
3249
- "onUpdate:modelValue": R[0] || (R[0] = (Y) => Ce(I) ? I.value = Y : null)
3250
- }, t(fe), {
3251
- onKeyup: R[1] || (R[1] = (Y) => a("keyup", Y))
3252
- }), null, 16, al), [
3253
- [ct, t(I)]
3254
- ]),
3255
- t(O) ? (d(), W(Q, G({
3256
- key: 1,
3257
- class: "vv-textarea__icon vv-textarea__icon-after"
3258
- }, t(B)), null, 16)) : w("", !0)
3259
- ]),
3260
- z.$slots.after ? (d(), y("div", ll, [
3261
- $(z.$slots, "after", j(F(t(se))))
3262
- ])) : w("", !0),
3263
- t(n) ? (d(), y("span", sl, [
3264
- $(z.$slots, "count", j(F(t(se))), () => [
3265
- X(x(t(ee)), 1)
3266
- ])
3267
- ])) : w("", !0)
3268
- ]),
3269
- de(t(re), {
3270
- id: t(b),
3271
- class: "vv-textarea__hint"
3272
- }, null, 8, ["id"])
3273
- ], 2));
114
+ install(app, options) {
115
+ const volver = new Volver(options);
116
+ app.config.globalProperties.$vv = volver;
117
+ if (options.components) {
118
+ Object.entries(options.components).forEach(([name, component]) => {
119
+ app.component(
120
+ name,
121
+ useDefaultProps(component, options.defaults)
122
+ );
123
+ });
124
+ }
125
+ if (options.aliases) {
126
+ Object.entries(options.aliases).forEach(([name, component]) => {
127
+ app.component(
128
+ name,
129
+ useDefaultProps(component, options.defaults, name)
130
+ );
131
+ });
132
+ }
133
+ if (options.directives) {
134
+ Object.entries(options.directives).forEach(([name, directive]) => {
135
+ app.directive(name, directive);
136
+ });
137
+ }
138
+ app.provide(INJECTION_KEY_VOLVER, volver);
3274
139
  }
3275
- });
140
+ };
3276
141
  export {
3277
- pl as VolverPlugin,
3278
- lo as VvAccordion,
3279
- fl as VvAccordionGroup,
3280
- co as VvBadge,
3281
- ml as VvBreadcrumb,
3282
- bl as VvButton,
3283
- hl as VvButtonGroup,
3284
- yl as VvCard,
3285
- Lo as VvCheckbox,
3286
- gl as VvCheckboxGroup,
3287
- _l as VvCombobox,
3288
- Sl as VvDialog,
3289
- kt as VvDropdown,
3290
- Q as VvIcon,
3291
- Vl as VvInputText,
3292
- $l as VvProgress,
3293
- Wa as VvRadio,
3294
- kl as VvRadioGroup,
3295
- ia as VvSelect,
3296
- Cl as VvTextarea
142
+ VolverPlugin
3297
143
  };