@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
@@ -1,34 +1,171 @@
1
- import { defineComponent as ce, unref as t, openBlock as u, createBlock as Y, mergeProps as N, createCommentVNode as k, createElementBlock as v, Fragment as q, createVNode as de, withCtx as ne, renderSlot as A, normalizeProps as T, guardReactiveProps as R, Transition as tt, withDirectives as ke, createElementVNode as H, normalizeStyle as Be, normalizeClass as ve, vShow as xe, toDisplayString as F, isRef as _e, renderList as Se, vModelSelect as ot, createTextVNode as se, createSlots as lt, withModifiers as at, vModelText as st } from "vue";
2
- import { iconExists as me, Icon as nt, addIcon as rt } from "@iconify/vue";
3
- import { autoPlacement as De, flip as Ie, shift as Oe, size as Ce, offset as ge, arrow as it, useFloating as ut, autoUpdate as dt } from "@floating-ui/vue";
4
- var we = /* @__PURE__ */ ((s) => (s.left = "left", s.right = "right", s.top = "top", s.bottom = "bottom", s))(we || {}), Fe = /* @__PURE__ */ ((s) => (s.topStart = "top-start", s.topEnd = "top-end", s.bottomStart = "bottom-start", s.bottomEnd = "bottom-end", s.leftStart = "left-start", s.leftEnd = "left-end", s.rightStart = "right-start", s.rightEnd = "right-end", s))(Fe || {}), Ve = /* @__PURE__ */ ((s) => (s.before = "before", s.after = "after", s))(Ve || {});
5
- const Ne = {
1
+ import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, h, Fragment, provide, useAttrs, watch, nextTick, createElementBlock, createVNode, withCtx, renderSlot, normalizeProps, guardReactiveProps, Transition, withDirectives, createElementVNode, normalizeStyle, normalizeClass, vShow, createTextVNode, toDisplayString, useSlots, isRef, renderList, vModelSelect, createSlots, withModifiers, vModelText } from "vue";
2
+ import { iconExists, Icon, addIcon } from "@iconify/vue";
3
+ import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
4
+ import { nanoid } from "nanoid";
5
+ import { useVModel, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, toReactive, useElementVisibility, refDebounced } from "@vueuse/core";
6
+ import mitt from "mitt";
7
+ var Side = /* @__PURE__ */ ((Side2) => {
8
+ Side2["left"] = "left";
9
+ Side2["right"] = "right";
10
+ Side2["top"] = "top";
11
+ Side2["bottom"] = "bottom";
12
+ return Side2;
13
+ })(Side || {});
14
+ var Placement = /* @__PURE__ */ ((Placement2) => {
15
+ Placement2["topStart"] = "top-start";
16
+ Placement2["topEnd"] = "top-end";
17
+ Placement2["bottomStart"] = "bottom-start";
18
+ Placement2["bottomEnd"] = "bottom-end";
19
+ Placement2["leftStart"] = "left-start";
20
+ Placement2["leftEnd"] = "left-end";
21
+ Placement2["rightStart"] = "right-start";
22
+ Placement2["rightEnd"] = "right-end";
23
+ return Placement2;
24
+ })(Placement || {});
25
+ var Position = /* @__PURE__ */ ((Position2) => {
26
+ Position2["before"] = "before";
27
+ Position2["after"] = "after";
28
+ return Position2;
29
+ })(Position || {});
30
+ var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
31
+ ButtonType2["button"] = "button";
32
+ ButtonType2["submit"] = "submit";
33
+ ButtonType2["reset"] = "reset";
34
+ return ButtonType2;
35
+ })(ButtonType || {});
36
+ var ActionRoles = /* @__PURE__ */ ((ActionRoles2) => {
37
+ ActionRoles2["button"] = "button";
38
+ ActionRoles2["link"] = "link";
39
+ ActionRoles2["menuitem"] = "menuitem";
40
+ return ActionRoles2;
41
+ })(ActionRoles || {});
42
+ var DropdownRole = /* @__PURE__ */ ((DropdownRole2) => {
43
+ DropdownRole2["listbox"] = "listbox";
44
+ DropdownRole2["menu"] = "menu";
45
+ return DropdownRole2;
46
+ })(DropdownRole || {});
47
+ var DropdownItemRole = /* @__PURE__ */ ((DropdownItemRole2) => {
48
+ DropdownItemRole2["option"] = "option";
49
+ DropdownItemRole2["presentation"] = "presentation";
50
+ return DropdownItemRole2;
51
+ })(DropdownItemRole || {});
52
+ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
53
+ AnchorTarget2["_blank"] = "_blank";
54
+ AnchorTarget2["_self"] = "_self";
55
+ AnchorTarget2["_parent"] = "_parent";
56
+ AnchorTarget2["_top"] = "_top";
57
+ return AnchorTarget2;
58
+ })(AnchorTarget || {});
59
+ const INJECTION_KEY_VOLVER = Symbol.for("volver");
60
+ const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for("dropdownTrigger");
61
+ const INJECTION_KEY_DROPDOWN_ITEM = Symbol.for("dropdownItem");
62
+ const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for("dropdownAction");
63
+ const LinkProps = {
64
+ /**
65
+ * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
66
+ * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
67
+ */
68
+ to: {
69
+ type: [String, Object]
70
+ },
71
+ /**
72
+ * Anchor href
73
+ */
74
+ href: String,
75
+ /**
76
+ * Anchor target
77
+ */
78
+ target: {
79
+ type: String,
80
+ validator: (value) => Object.values(AnchorTarget).includes(value)
81
+ },
82
+ /**
83
+ * Anchor rel
84
+ */
85
+ rel: {
86
+ type: String,
87
+ default: "noopener noreferrer"
88
+ }
89
+ };
90
+ const ValidProps = {
91
+ /**
92
+ * Valid status
93
+ */
6
94
  valid: Boolean,
95
+ /**
96
+ * Valid label
97
+ */
7
98
  validLabel: [String, Array]
8
- }, Le = {
99
+ };
100
+ const InvalidProps = {
101
+ /**
102
+ * Invalid status
103
+ */
9
104
  invalid: Boolean,
105
+ /**
106
+ * Invalid label
107
+ */
10
108
  invalidLabel: [String, Array]
11
- }, Me = {
109
+ };
110
+ const LoadingProps = {
111
+ /**
112
+ * Loading status
113
+ */
12
114
  loading: Boolean,
13
- loadingLabel: String
14
- }, Te = {
115
+ /**
116
+ * Loading label
117
+ */
118
+ loadingLabel: {
119
+ type: String,
120
+ default: "Loading..."
121
+ }
122
+ };
123
+ const DisabledProps = {
15
124
  /**
16
125
  * Whether the form control is disabled
17
126
  */
18
127
  disabled: Boolean
19
- }, Re = {
128
+ };
129
+ const SelectedProps = {
130
+ /**
131
+ * Whether the item is selected
132
+ */
133
+ selected: Boolean
134
+ };
135
+ const ActiveProps = {
136
+ /**
137
+ * Whether the item is active
138
+ */
139
+ active: Boolean
140
+ };
141
+ const PressedProps = {
142
+ /**
143
+ * Whether the item is pressed
144
+ */
145
+ pressed: Boolean
146
+ };
147
+ const LabelProps = {
148
+ /**
149
+ * The item label
150
+ */
151
+ label: [String, Number]
152
+ };
153
+ const ReadonlyProps = {
20
154
  /**
21
155
  * The value is not editable
22
156
  */
23
157
  readonly: Boolean
24
- }, he = {
158
+ };
159
+ const ModifiersProps = {
25
160
  /**
26
161
  * Component BEM modifiers
27
162
  */
28
163
  modifiers: [String, Array]
29
- }, je = {
164
+ };
165
+ const HintProps = {
30
166
  hintLabel: { type: String, default: "" }
31
- }, We = {
167
+ };
168
+ const OptionsProps = {
32
169
  /**
33
170
  * List of options, can be string[] or object[]
34
171
  */
@@ -48,7 +185,8 @@ const Ne = {
48
185
  * Used when options are objects: key to use for option disabled
49
186
  */
50
187
  disabledKey: { type: [String, Function], default: "disabled" }
51
- }, ze = {
188
+ };
189
+ const IconProps = {
52
190
  /**
53
191
  * VvIcon name or props
54
192
  * @see VVIcon
@@ -59,39 +197,46 @@ const Ne = {
59
197
  */
60
198
  iconPosition: {
61
199
  type: String,
62
- default: Ve.before,
63
- validation: (s) => Object.values(Ve).includes(s)
200
+ default: Position.before,
201
+ validation: (value) => Object.values(Position).includes(value)
64
202
  }
65
- }, qe = {
203
+ };
204
+ const TabindexProps = {
66
205
  /**
67
206
  * Global attribute tabindex
68
207
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
69
208
  */
70
209
  tabindex: { type: [String, Number], default: 0 }
71
- }, He = {
210
+ };
211
+ const FloatingLabelProps = {
72
212
  /**
73
213
  * If true the label will be floating
74
214
  */
75
215
  floating: Boolean
76
- }, Ke = {
216
+ };
217
+ const UnselectableProps = {
77
218
  /**
78
219
  * If true the input will be unselectable
79
220
  */
80
- unselectable: { type: Boolean, default: !0 }
81
- }, Ue = {
221
+ unselectable: { type: Boolean, default: true }
222
+ };
223
+ const IdProps = {
82
224
  /**
83
225
  * Global attribute id
84
226
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
85
227
  */
86
228
  id: [String, Number]
87
- }, $e = {
229
+ };
230
+ const DropdownProps = {
88
231
  /**
89
232
  * Dropdown placement
90
233
  */
91
234
  placement: {
92
235
  type: String,
93
- default: we.bottom,
94
- validator: (s) => Object.values(we).includes(s) || Object.values(Fe).includes(s)
236
+ default: Side.bottom,
237
+ validator: (value) => {
238
+ return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
239
+ }
95
240
  },
96
241
  /**
97
242
  * Dropdown show / hide transition name
@@ -113,7 +258,7 @@ const Ne = {
113
258
  */
114
259
  shift: {
115
260
  type: [Boolean, Object],
116
- default: !1
261
+ default: false
117
262
  },
118
263
  /**
119
264
  * Flip dropdown position if there is no space in the default position
@@ -121,7 +266,7 @@ const Ne = {
121
266
  */
122
267
  flip: {
123
268
  type: [Boolean, Object],
124
- default: !0
269
+ default: true
125
270
  },
126
271
  /**
127
272
  * Size of the dropdown
@@ -137,7 +282,7 @@ const Ne = {
137
282
  */
138
283
  autoPlacement: {
139
284
  type: [Boolean, Object],
140
- default: !1
285
+ default: false
141
286
  },
142
287
  /**
143
288
  * Add arrow to the dropdown
@@ -145,21 +290,21 @@ const Ne = {
145
290
  */
146
291
  arrow: {
147
292
  type: Boolean,
148
- default: !1
293
+ default: false
149
294
  },
150
295
  /**
151
296
  * Close dropdown on click outside
152
297
  */
153
298
  autoClose: {
154
299
  type: Boolean,
155
- default: !0
300
+ default: true
156
301
  },
157
302
  /**
158
303
  * Autofocus first item on dropdown open
159
304
  */
160
305
  autofocusFirst: {
161
306
  type: Boolean,
162
- default: !0
307
+ default: true
163
308
  },
164
309
  /**
165
310
  * Set dropdown width to the same as the trigger
@@ -167,46 +312,67 @@ const Ne = {
167
312
  triggerWidth: {
168
313
  type: Boolean
169
314
  }
170
- }, Je = {
171
- ...Ue,
315
+ };
316
+ const IdNameProps = {
317
+ ...IdProps,
172
318
  /**
173
319
  * Input / Textarea name
174
320
  * Name of the form control. Submitted with the form as part of a name/value pair
175
321
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
176
322
  */
177
- name: { type: String, required: !0 }
178
- }, ct = {
323
+ name: { type: String, required: true }
324
+ };
325
+ const AutofocusProps = {
179
326
  /**
180
327
  * Global attribute autofocus
181
328
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
182
329
  */
183
330
  autofocus: Boolean
184
- }, ft = {
331
+ };
332
+ const AutocompleteProps = {
185
333
  /**
186
334
  * Global attribute autocomplete
187
335
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
188
336
  */
189
337
  autocomplete: { type: String, default: "off" }
190
- }, pt = [
338
+ };
339
+ ({
340
+ ...DisabledProps,
341
+ ...LabelProps,
342
+ ...PressedProps,
343
+ ...ActiveProps,
344
+ ...LinkProps,
345
+ /**
346
+ * Button type
347
+ */
348
+ type: {
349
+ type: String,
350
+ default: ButtonType.button,
351
+ validator: (value) => Object.values(ButtonType).includes(value)
352
+ }
353
+ });
354
+ const VvComboboxEvents = [
191
355
  "update:modelValue",
192
356
  "change:search",
193
357
  "focus",
194
358
  "blur"
195
- ], vt = {
196
- ...Je,
197
- ...qe,
198
- ...Ne,
199
- ...Le,
200
- ...je,
201
- ...Me,
202
- ...Te,
203
- ...Re,
204
- ...he,
205
- ...We,
206
- ...ze,
207
- ...He,
208
- ...Ke,
209
- ...$e,
359
+ ];
360
+ const VvComboboxProps = {
361
+ ...IdNameProps,
362
+ ...TabindexProps,
363
+ ...ValidProps,
364
+ ...InvalidProps,
365
+ ...HintProps,
366
+ ...LoadingProps,
367
+ ...DisabledProps,
368
+ ...ReadonlyProps,
369
+ ...ModifiersProps,
370
+ ...OptionsProps,
371
+ ...IconProps,
372
+ ...FloatingLabelProps,
373
+ ...UnselectableProps,
374
+ ...DropdownProps,
375
+ ...LabelProps,
210
376
  /**
211
377
  * modelValue can be a string, number, boolean, object or array of string, number, boolean, object
212
378
  */
@@ -214,30 +380,30 @@ const Ne = {
214
380
  type: [String, Number, Boolean, Object, Array],
215
381
  default: void 0
216
382
  },
217
- /**
218
- * Select input label
219
- */
220
- label: String,
221
383
  /**
222
384
  * Label for no search results
223
385
  */
224
386
  noResultsLabel: { type: String, default: "No results" },
387
+ /**
388
+ * Label for no options available
389
+ */
390
+ noOptionsLabel: { type: String, default: "No options available" },
225
391
  /**
226
392
  * Label for selected option hint
227
393
  */
228
- selectedLabel: { type: String, default: "Selected" },
394
+ selectedHintLabel: { type: String, default: "Selected" },
229
395
  /**
230
- * Label for deselect button
396
+ * Label for deselect action button
231
397
  */
232
- deselectLabel: { type: String, default: "Deselect" },
398
+ deselectActionLabel: { type: String, default: "Deselect" },
233
399
  /**
234
400
  * Label for select option hint
235
401
  */
236
- pressToSelectLabel: { type: String, default: "Press enter to select" },
402
+ selectHintLabel: { type: String, default: "Press enter to select" },
237
403
  /**
238
404
  * Label for deselected option hint
239
405
  */
240
- pressToDeselectLabel: { type: String, default: "Press enter to remove" },
406
+ deselectHintLabel: { type: String, default: "Press enter to remove" },
241
407
  /**
242
408
  * Select input placeholder
243
409
  */
@@ -291,8 +457,8 @@ const Ne = {
291
457
  * Set dropdown width to the same as the trigger
292
458
  */
293
459
  triggerWidth: {
294
- ...$e.triggerWidth,
295
- default: !0
460
+ ...DropdownProps.triggerWidth,
461
+ default: true
296
462
  },
297
463
  /**
298
464
  * Dropdown modifiers
@@ -308,7 +474,8 @@ const Ne = {
308
474
  * Close dropdown on select (not multiple)
309
475
  */
310
476
  autoClose: Boolean
311
- }, mt = {
477
+ };
478
+ const VvIconProps = {
312
479
  /**
313
480
  * Color
314
481
  */
@@ -332,7 +499,7 @@ const Ne = {
332
499
  */
333
500
  name: {
334
501
  type: String,
335
- required: !0
502
+ required: true
336
503
  },
337
504
  /**
338
505
  * By default 'vv'
@@ -401,63 +568,127 @@ const Ne = {
401
568
  modifiers: {
402
569
  type: [String, Array]
403
570
  }
404
- }, bt = {
571
+ };
572
+ function useVolver() {
573
+ return inject(INJECTION_KEY_VOLVER);
574
+ }
575
+ function useModifiers(prefix, modifiers, others) {
576
+ return computed(() => {
577
+ const toReturn = {
578
+ [prefix]: true
579
+ };
580
+ const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
581
+ if (modifiersArray) {
582
+ if (Array.isArray(modifiersArray)) {
583
+ modifiersArray.forEach((modifier) => {
584
+ if (modifier) {
585
+ toReturn[`${prefix}--${modifier}`] = true;
586
+ }
587
+ });
588
+ }
589
+ }
590
+ if (others) {
591
+ Object.keys(others.value).forEach((key) => {
592
+ toReturn[`${prefix}--${key}`] = unref(others.value[key]);
593
+ });
594
+ }
595
+ return toReturn;
596
+ });
597
+ }
598
+ const __default__$6 = {
405
599
  name: "VvIcon"
406
- }, pe = /* @__PURE__ */ ce({
407
- ...bt,
408
- props: mt,
409
- setup(s) {
410
- const d = s, e = ref(!0), c = useVolver(), { modifiers: g } = toRefs(d), w = useBemModifiers("vv-icon", g), r = computed(() => d.provider || (c == null ? void 0 : c.provider)), V = computed(() => {
411
- const a = d.name ?? "", n = `@${r.value}:${d.prefix}:${d.name}`;
412
- return me(a) ? a : me(n) ? n : (c == null ? void 0 : c.iconsCollections.find(
413
- (i) => {
414
- const _ = `@${r.value}:${i.prefix}:${a}`;
415
- if (me(_))
416
- return _;
417
- }
418
- )) || a;
600
+ };
601
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
602
+ ...__default__$6,
603
+ props: VvIconProps,
604
+ setup(__props) {
605
+ const props = __props;
606
+ const show = ref(true);
607
+ const volver = useVolver();
608
+ const { modifiers } = toRefs(props);
609
+ const bemCssClasses = useModifiers("vv-icon", modifiers);
610
+ const provider = computed(() => {
611
+ return props.provider || (volver == null ? void 0 : volver.iconsProvider);
612
+ });
613
+ const icon = computed(() => {
614
+ const _name = props.name ?? "";
615
+ const iconName = `@${provider.value}:${props.prefix}:${props.name}`;
616
+ if (iconExists(_name)) {
617
+ return _name;
618
+ } else if (iconExists(iconName)) {
619
+ return iconName;
620
+ } else {
621
+ return (volver == null ? void 0 : volver.iconsCollections.find(
622
+ (iconsCollection) => {
623
+ const icon2 = `@${provider.value}:${iconsCollection.prefix}:${_name}`;
624
+ if (iconExists(icon2)) {
625
+ return icon2;
626
+ }
627
+ }
628
+ )) || _name;
629
+ }
419
630
  });
420
- function $(a) {
421
- let n = null;
422
- if (typeof window > "u") {
423
- const { JSDOM: B } = require("jsdom");
424
- n = new B().window;
631
+ function getSvgContent(svg) {
632
+ let dom = null;
633
+ if (typeof window === "undefined") {
634
+ const { JSDOM } = require("jsdom");
635
+ dom = new JSDOM().window;
425
636
  }
426
- return (n ? new n.DOMParser() : new window.DOMParser()).parseFromString(a, "text/html").querySelector("svg");
637
+ const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
638
+ const svgDomString = domParser.parseFromString(svg, "text/html");
639
+ const svgEl = svgDomString.querySelector("svg");
640
+ return svgEl;
427
641
  }
428
- function b(a) {
429
- const n = $(a), i = (n == null ? void 0 : n.innerHTML.trim()) || "";
430
- n && i && rt(`@${r.value}:${d.prefix}:${d.name}`, {
431
- body: i,
432
- // Set height and width from svg content
433
- height: n.viewBox.baseVal.height,
434
- width: n.viewBox.baseVal.width
435
- });
642
+ function addIconFromSvg(svg) {
643
+ const svgContentEl = getSvgContent(svg);
644
+ const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
645
+ if (svgContentEl && svgContent) {
646
+ addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
647
+ body: svgContent,
648
+ // Set height and width from svg content
649
+ height: svgContentEl.viewBox.baseVal.height,
650
+ width: svgContentEl.viewBox.baseVal.width
651
+ });
652
+ }
436
653
  }
437
- return c && (d.src && !me(`@${r.value}:${d.prefix}:${d.name}`) ? (e.value = !1, c.fetchIcon(d.src).then((a) => {
438
- a && (b(a), e.value = !0);
439
- }).catch((a) => {
440
- throw new Error(`During fetch icon: ${a == null ? void 0 : a.message}`);
441
- })) : d.svg && b(d.svg)), (a, n) => t(e) ? (u(), Y(t(nt), N({
442
- key: 0,
443
- class: t(w)
444
- }, {
445
- inline: a.inline,
446
- width: a.width,
447
- height: a.height,
448
- horizontalFlip: a.horizontalFlip,
449
- verticalFlip: a.verticalFlip,
450
- flip: a.flip,
451
- rotate: a.rotate,
452
- color: a.color,
453
- onLoad: a.onLoad,
454
- icon: t(V)
455
- }), null, 16, ["class"])) : k("", !0);
654
+ if (volver) {
655
+ if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
656
+ show.value = false;
657
+ volver.fetchIcon(props.src).then((svg) => {
658
+ if (svg) {
659
+ addIconFromSvg(svg);
660
+ show.value = true;
661
+ }
662
+ }).catch((e) => {
663
+ throw new Error(`During fetch icon: ${e == null ? void 0 : e.message}`);
664
+ });
665
+ } else if (props.svg) {
666
+ addIconFromSvg(props.svg);
667
+ }
668
+ }
669
+ return (_ctx, _cache) => {
670
+ return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
671
+ key: 0,
672
+ class: unref(bemCssClasses)
673
+ }, {
674
+ inline: _ctx.inline,
675
+ width: _ctx.width,
676
+ height: _ctx.height,
677
+ horizontalFlip: _ctx.horizontalFlip,
678
+ verticalFlip: _ctx.verticalFlip,
679
+ flip: _ctx.flip,
680
+ rotate: _ctx.rotate,
681
+ color: _ctx.color,
682
+ onLoad: _ctx.onLoad,
683
+ icon: unref(icon)
684
+ }), null, 16, ["class"])) : createCommentVNode("", true);
685
+ };
456
686
  }
457
- }), Ae = ["listbox", "menu"], ht = {
458
- ...Ue,
459
- ...he,
460
- ...$e,
687
+ });
688
+ const VvDropdownProps = {
689
+ ...IdProps,
690
+ ...ModifiersProps,
691
+ ...DropdownProps,
461
692
  /**
462
693
  * Show / hide dropdown programmatically
463
694
  */
@@ -477,274 +708,646 @@ const Ne = {
477
708
  */
478
709
  role: {
479
710
  type: String,
480
- default: Ae[1],
481
- validator: (s) => Ae.includes(s)
711
+ default: DropdownRole.menu,
712
+ validator: (value) => Object.values(DropdownRole).includes(value)
482
713
  }
483
- }, yt = ["id", "tabindex", "role", "aria-labelledby"], gt = {
714
+ };
715
+ const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
716
+ function useProvideDropdownTrigger({
717
+ reference,
718
+ id,
719
+ expanded,
720
+ aria
721
+ }) {
722
+ const bus = mitt();
723
+ const component = defineComponent({
724
+ name: "VvDropdownTriggerProvider",
725
+ provide() {
726
+ return {
727
+ [INJECTION_KEY_DROPDOWN_TRIGGER]: {
728
+ reference,
729
+ id,
730
+ expanded,
731
+ aria,
732
+ bus
733
+ }
734
+ };
735
+ },
736
+ setup() {
737
+ return {};
738
+ },
739
+ render() {
740
+ var _a, _b;
741
+ return h(Fragment, {}, (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a));
742
+ }
743
+ });
744
+ return {
745
+ bus,
746
+ component
747
+ };
748
+ }
749
+ function useProvideDropdownItem({
750
+ role,
751
+ expanded
752
+ }) {
753
+ const itemRole = computed(
754
+ () => role.value === DropdownRole.listbox ? DropdownItemRole.option : DropdownItemRole.presentation
755
+ );
756
+ provide(INJECTION_KEY_DROPDOWN_ITEM, {
757
+ role: itemRole,
758
+ expanded
759
+ });
760
+ return { itemRole };
761
+ }
762
+ function useProvideDropdownAction({
763
+ expanded
764
+ }) {
765
+ provide(INJECTION_KEY_DROPDOWN_ACTION, {
766
+ role: ActionRoles.menuitem,
767
+ expanded
768
+ });
769
+ }
770
+ const _hoisted_1$3 = ["id", "tabindex", "role", "aria-labelledby"];
771
+ const __default__$5 = {
484
772
  name: "VvDropdown",
485
- inheritAttrs: !1
486
- }, Ge = /* @__PURE__ */ ce({
487
- ...gt,
488
- props: ht,
773
+ inheritAttrs: false
774
+ };
775
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
776
+ ...__default__$5,
777
+ props: VvDropdownProps,
489
778
  emits: ["update:modelValue"],
490
- setup(s, { emit: d }) {
491
- const e = s, { id: c } = toRefs(e), g = useUniqueId(c), w = useAttrs(), r = ref("auto"), V = ref("auto"), $ = ref(null), b = ref(null), a = ref(null), n = ref(null), i = computed({
492
- get: () => e.reference ?? $.value,
493
- set: (o) => {
494
- $.value = o;
779
+ setup(__props, { emit }) {
780
+ const props = __props;
781
+ const { id } = toRefs(props);
782
+ const hasId = useUniqueId(id);
783
+ const attrs = useAttrs();
784
+ const maxWidth = ref("auto");
785
+ const maxHeight = ref("auto");
786
+ const localReferenceEl = ref(null);
787
+ const floatingEl = ref(null);
788
+ const arrowEl = ref(null);
789
+ const listEl = ref(null);
790
+ const referenceEl = computed({
791
+ get: () => props.reference ?? localReferenceEl.value,
792
+ set: (newValue) => {
793
+ localReferenceEl.value = newValue;
794
+ }
795
+ });
796
+ const middleware = computed(() => {
797
+ const toReturn = [];
798
+ if (props.autoPlacement) {
799
+ if (typeof props.autoPlacement === "boolean") {
800
+ toReturn.push(autoPlacement());
801
+ } else {
802
+ toReturn.push(
803
+ autoPlacement(props.autoPlacement)
804
+ );
805
+ }
806
+ } else if (props.flip) {
807
+ if (typeof props.flip === "boolean") {
808
+ toReturn.push(flip());
809
+ } else {
810
+ toReturn.push(flip(props.flip));
811
+ }
495
812
  }
496
- }), _ = computed(() => {
497
- const o = [];
498
- if (e.autoPlacement ? typeof e.autoPlacement == "boolean" ? o.push(De()) : o.push(
499
- De(e.autoPlacement)
500
- ) : e.flip && (typeof e.flip == "boolean" ? o.push(Ie()) : o.push(Ie(e.flip))), e.shift && (typeof e.shift == "boolean" ? o.push(Oe()) : o.push(Oe(e.shift))), e.size) {
501
- const p = ({
502
- availableWidth: M,
503
- availableHeight: le
813
+ if (props.shift) {
814
+ if (typeof props.shift === "boolean") {
815
+ toReturn.push(shift());
816
+ } else {
817
+ toReturn.push(shift(props.shift));
818
+ }
819
+ }
820
+ if (props.size) {
821
+ const apply = ({
822
+ availableWidth,
823
+ availableHeight
504
824
  }) => {
505
- r.value = `${M}px`, V.value = `${le}px`;
825
+ maxWidth.value = `${availableWidth}px`;
826
+ maxHeight.value = `${availableHeight}px`;
506
827
  };
507
- typeof e.size == "boolean" ? o.push(
508
- Ce({
509
- apply: p
510
- })
511
- ) : o.push(
512
- Ce({
513
- ...e.size,
514
- apply: p
828
+ if (typeof props.size === "boolean") {
829
+ toReturn.push(
830
+ size({
831
+ apply
832
+ })
833
+ );
834
+ } else {
835
+ toReturn.push(
836
+ size({
837
+ ...props.size,
838
+ apply
839
+ })
840
+ );
841
+ }
842
+ }
843
+ if (props.offset) {
844
+ toReturn.push(offset(Number(props.offset)));
845
+ if (["string", "number"].includes(typeof props.offset)) {
846
+ toReturn.push(offset(Number(props.offset)));
847
+ } else {
848
+ toReturn.push(offset(props.offset));
849
+ }
850
+ }
851
+ if (props.arrow) {
852
+ toReturn.push(
853
+ arrow({
854
+ element: arrowEl
515
855
  })
516
856
  );
517
857
  }
518
- return e.offset && (o.push(ge(Number(e.offset))), ["string", "number"].includes(typeof e.offset) ? o.push(ge(Number(e.offset))) : o.push(ge(e.offset))), e.arrow && o.push(
519
- it({
520
- element: a
521
- })
522
- ), o;
523
- }), { x: P, y: B, strategy: K, middlewareData: L, placement: U } = ut(
524
- i,
525
- b,
858
+ return toReturn;
859
+ });
860
+ const { x, y, strategy, middlewareData, placement } = useFloating(
861
+ referenceEl,
862
+ floatingEl,
526
863
  {
527
- whileElementsMounted: dt,
528
- placement: e.placement,
529
- middleware: _
864
+ whileElementsMounted: autoUpdate,
865
+ placement: props.placement,
866
+ middleware
530
867
  }
531
- ), j = computed(() => ({
532
- position: K.value,
533
- top: `${B.value ?? 0}px`,
534
- left: `${P.value ?? 0}px`,
535
- maxWidth: r.value,
536
- maxHeight: V.value,
537
- width: e.triggerWidth && i.value ? `${i.value.offsetWidth}px` : void 0
538
- })), I = computed(() => U.value.split("-")[0]), D = computed(
868
+ );
869
+ const dropdownPlacement = computed(() => ({
870
+ position: strategy.value,
871
+ top: `${y.value ?? 0}px`,
872
+ left: `${x.value ?? 0}px`,
873
+ maxWidth: maxWidth.value,
874
+ maxHeight: maxHeight.value,
875
+ width: props.triggerWidth && referenceEl.value ? `${referenceEl.value.offsetWidth}px` : void 0
876
+ }));
877
+ const side = computed(() => placement.value.split("-")[0]);
878
+ const staticSide = computed(
539
879
  () => ({
540
880
  top: "bottom",
541
881
  right: "left",
542
882
  bottom: "top",
543
883
  left: "right"
544
- })[I.value] ?? "bottom"
545
- ), x = computed(() => {
546
- var o, p, M, le;
547
- return ["bottom", "top"].includes(D.value) ? {
548
- right: `${((o = L.value.arrow) == null ? void 0 : o.x) ?? 0}px`,
549
- [D.value]: `${-(((p = a.value) == null ? void 0 : p.offsetWidth) ?? 0) / 2}px`
550
- } : {
551
- top: `${((M = L.value.arrow) == null ? void 0 : M.y) ?? 0}px`,
552
- [D.value]: `${-(((le = a.value) == null ? void 0 : le.offsetWidth) ?? 0) / 2}px`
884
+ })[side.value] ?? "bottom"
885
+ );
886
+ const arrowPlacement = computed(() => {
887
+ var _a, _b, _c, _d;
888
+ if (["bottom", "top"].includes(staticSide.value)) {
889
+ return {
890
+ right: `${((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) ?? 0}px`,
891
+ [staticSide.value]: `${-(((_b = arrowEl.value) == null ? void 0 : _b.offsetWidth) ?? 0) / 2}px`
892
+ };
893
+ }
894
+ return {
895
+ top: `${((_c = middlewareData.value.arrow) == null ? void 0 : _c.y) ?? 0}px`,
896
+ [staticSide.value]: `${-(((_d = arrowEl.value) == null ? void 0 : _d.offsetWidth) ?? 0) / 2}px`
553
897
  };
554
- }), W = useVModel(e, "modelValue", d), J = ref(!1), m = computed({
555
- get: () => W.value ?? J.value,
556
- set: (o) => {
557
- if (W.value === void 0) {
558
- J.value = o;
898
+ });
899
+ const modelValue = useVModel(props, "modelValue", emit);
900
+ const localModelValue = ref(false);
901
+ const expanded = computed({
902
+ get: () => modelValue.value ?? localModelValue.value,
903
+ set: (newValue) => {
904
+ if (modelValue.value === void 0) {
905
+ localModelValue.value = newValue;
559
906
  return;
560
907
  }
561
- W.value = o;
908
+ modelValue.value = newValue;
562
909
  }
563
- }), z = () => {
564
- m.value = !0;
565
- }, O = () => {
566
- m.value = !1;
567
- }, Z = () => {
568
- m.value = !m.value;
569
- }, re = (o) => {
570
- i.value = o;
910
+ });
911
+ const show = () => {
912
+ expanded.value = true;
571
913
  };
572
- watch(m, (o) => {
573
- o && e.autofocusFirst && nextTick(() => {
574
- const p = E(
575
- b.value
576
- );
577
- p.length > 0 && p[0].focus();
578
- });
579
- }), onClickOutside(
580
- b,
914
+ const hide = () => {
915
+ expanded.value = false;
916
+ };
917
+ const toggle = () => {
918
+ expanded.value = !expanded.value;
919
+ };
920
+ const init = (el) => {
921
+ referenceEl.value = el;
922
+ };
923
+ watch(expanded, (newValue) => {
924
+ if (newValue && props.autofocusFirst) {
925
+ nextTick(() => {
926
+ const focusableElements = getKeyboardFocusableElements(
927
+ floatingEl.value
928
+ );
929
+ if (focusableElements.length > 0) {
930
+ focusableElements[0].focus();
931
+ }
932
+ });
933
+ }
934
+ });
935
+ onClickOutside(
936
+ floatingEl,
581
937
  () => {
582
- e.autoClose && (m.value = !1);
938
+ if (props.autoClose) {
939
+ expanded.value = false;
940
+ }
583
941
  },
584
- { ignore: [i] }
942
+ { ignore: [referenceEl] }
585
943
  );
586
- const ie = computed(() => {
587
- var o;
588
- return ((o = i.value) == null ? void 0 : o.getAttribute("id")) ?? void 0;
589
- }), G = computed(() => ({
590
- "aria-controls": g.value,
591
- "aria-haspopup": !0,
592
- "aria-expanded": m.value
593
- })), { component: ee, bus: ue } = useProvideDropdownTrigger({
594
- reference: i,
595
- id: g,
596
- expanded: m,
597
- aria: G
944
+ const hasAriaLabelledby = computed(() => {
945
+ var _a, _b;
946
+ return ((_b = (_a = referenceEl.value) == null ? void 0 : _a.getAttribute) == null ? void 0 : _b.call(_a, "id")) ?? void 0;
598
947
  });
599
- ue.on("click", Z);
600
- const { role: te, modifiers: fe } = toRefs(e), { itemRole: Q } = useProvideDropdownItem({ role: te, expanded: m }), y = useBemModifiers(
948
+ const referenceAria = computed(() => ({
949
+ "aria-controls": hasId.value,
950
+ "aria-haspopup": true,
951
+ "aria-expanded": expanded.value
952
+ }));
953
+ const { component: VvDropdownTriggerProvider, bus } = useProvideDropdownTrigger({
954
+ reference: referenceEl,
955
+ id: hasId,
956
+ expanded,
957
+ aria: referenceAria
958
+ });
959
+ bus.on("click", toggle);
960
+ const { role, modifiers } = toRefs(props);
961
+ const { itemRole } = useProvideDropdownItem({ role, expanded });
962
+ const bemCssClasses = useModifiers(
601
963
  "vv-dropdown",
602
- fe,
964
+ modifiers,
603
965
  computed(() => ({
604
- arrow: e.arrow
966
+ arrow: props.arrow
605
967
  }))
606
- ), { focused: C } = useFocusWithin(b);
607
- function E(o) {
608
- return o ? [
609
- ...o.querySelectorAll(
968
+ );
969
+ const { focused } = useFocusWithin(floatingEl);
970
+ function getKeyboardFocusableElements(element) {
971
+ if (!element) {
972
+ return [];
973
+ }
974
+ return [
975
+ ...element.querySelectorAll(
610
976
  'a[href], button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])'
611
977
  )
612
978
  ].filter(
613
- (p) => !p.hasAttribute("disabled") && !p.getAttribute("aria-hidden")
614
- ) : [];
979
+ (el) => !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden")
980
+ );
615
981
  }
616
- const X = () => {
982
+ const focusNext = () => {
617
983
  nextTick(() => {
618
- if (C.value) {
619
- const o = E(
620
- b.value
984
+ if (focused.value) {
985
+ const focusableElements = getKeyboardFocusableElements(
986
+ floatingEl.value
621
987
  );
622
- if (o.length === 0 || !document.activeElement)
988
+ if (focusableElements.length === 0 || !document.activeElement) {
623
989
  return;
624
- const p = o.indexOf(
990
+ }
991
+ const activeElementIndex = focusableElements.indexOf(
625
992
  document.activeElement
626
993
  );
627
- p < o.length - 1 ? o[p + 1].focus() : o[0].focus();
994
+ if (activeElementIndex < focusableElements.length - 1) {
995
+ focusableElements[activeElementIndex + 1].focus();
996
+ } else {
997
+ focusableElements[0].focus();
998
+ }
628
999
  }
629
1000
  });
630
- }, oe = () => {
1001
+ };
1002
+ const focusPrev = () => {
631
1003
  nextTick(() => {
632
- if (C.value) {
633
- const o = E(
634
- b.value
1004
+ if (focused.value) {
1005
+ const focusableElements = getKeyboardFocusableElements(
1006
+ floatingEl.value
635
1007
  );
636
- if (o.length === 0 || !document.activeElement)
1008
+ if (focusableElements.length === 0 || !document.activeElement) {
637
1009
  return;
638
- const p = o.indexOf(
1010
+ }
1011
+ const activeElementIndex = focusableElements.indexOf(
639
1012
  document.activeElement
640
1013
  );
641
- p > 0 ? o[p - 1].focus() : o[o.length - 1].focus();
1014
+ if (activeElementIndex > 0) {
1015
+ focusableElements[activeElementIndex - 1].focus();
1016
+ } else {
1017
+ focusableElements[focusableElements.length - 1].focus();
1018
+ }
642
1019
  }
643
1020
  });
644
1021
  };
645
- return onKeyStroke("Escape", (o) => {
646
- m.value && (o.preventDefault(), O());
647
- }), onKeyStroke("ArrowDown", (o) => {
648
- m.value && C.value && (o.preventDefault(), X());
649
- }), onKeyStroke("ArrowUp", (o) => {
650
- m.value && C.value && (o.preventDefault(), oe());
651
- }), onKeyStroke([" ", "Enter"], (o) => {
652
- m.value && C.value && (o.preventDefault(), document.activeElement.click());
653
- }), (o, p) => (u(), v(q, null, [
654
- de(t(ee), null, {
655
- default: ne(() => [
656
- A(o.$slots, "default", T(R({ init: re, show: z, hide: O, toggle: Z, expanded: t(m), aria: t(G) })))
657
- ]),
658
- _: 3
659
- }),
660
- de(tt, { name: o.transitionName }, {
661
- default: ne(() => [
662
- ke(H("div", {
663
- ref_key: "floatingEl",
664
- ref: b,
665
- style: Be(t(j)),
666
- class: ve(t(y))
1022
+ onKeyStroke("Escape", (e) => {
1023
+ if (expanded.value) {
1024
+ e.preventDefault();
1025
+ hide();
1026
+ }
1027
+ });
1028
+ onKeyStroke("ArrowDown", (e) => {
1029
+ if (expanded.value && focused.value) {
1030
+ e.preventDefault();
1031
+ focusNext();
1032
+ }
1033
+ });
1034
+ onKeyStroke("ArrowUp", (e) => {
1035
+ if (expanded.value && focused.value) {
1036
+ e.preventDefault();
1037
+ focusPrev();
1038
+ }
1039
+ });
1040
+ onKeyStroke([" ", "Enter"], (e) => {
1041
+ if (expanded.value && focused.value) {
1042
+ e.preventDefault();
1043
+ const activeElement = document.activeElement;
1044
+ activeElement.click();
1045
+ }
1046
+ });
1047
+ return (_ctx, _cache) => {
1048
+ return openBlock(), createElementBlock(Fragment, null, [
1049
+ createVNode(unref(VvDropdownTriggerProvider), null, {
1050
+ default: withCtx(() => [
1051
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ init, show, hide, toggle, expanded: unref(expanded), aria: unref(referenceAria) })))
1052
+ ]),
1053
+ _: 3
1054
+ }),
1055
+ createVNode(Transition, { name: _ctx.transitionName }, {
1056
+ default: withCtx(() => [
1057
+ withDirectives(createElementVNode("div", {
1058
+ ref_key: "floatingEl",
1059
+ ref: floatingEl,
1060
+ style: normalizeStyle(unref(dropdownPlacement)),
1061
+ class: normalizeClass(unref(bemCssClasses))
1062
+ }, [
1063
+ props.arrow ? (openBlock(), createElementBlock("div", {
1064
+ key: 0,
1065
+ ref_key: "arrowEl",
1066
+ ref: arrowEl,
1067
+ style: normalizeStyle(unref(arrowPlacement)),
1068
+ class: "vv-dropdown__arrow"
1069
+ }, null, 4)) : createCommentVNode("", true),
1070
+ renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps({ expanded: unref(expanded) }))),
1071
+ createElementVNode("ul", mergeProps(unref(attrs), {
1072
+ id: unref(hasId),
1073
+ ref_key: "listEl",
1074
+ ref: listEl,
1075
+ tabindex: !unref(expanded) ? -1 : void 0,
1076
+ role: unref(role),
1077
+ "aria-labelledby": unref(hasAriaLabelledby),
1078
+ class: "vv-dropdown__list"
1079
+ }), [
1080
+ renderSlot(_ctx.$slots, "items", normalizeProps(guardReactiveProps({
1081
+ role: unref(itemRole)
1082
+ })))
1083
+ ], 16, _hoisted_1$3),
1084
+ renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps({ expanded: unref(expanded) })))
1085
+ ], 6), [
1086
+ [vShow, unref(expanded)]
1087
+ ])
1088
+ ]),
1089
+ _: 3
1090
+ }, 8, ["name"])
1091
+ ], 64);
1092
+ };
1093
+ }
1094
+ });
1095
+ function useInjectedDropdownItem() {
1096
+ return inject(INJECTION_KEY_DROPDOWN_ITEM, {});
1097
+ }
1098
+ const __default__$4 = {
1099
+ name: "VvDropdownItem"
1100
+ };
1101
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1102
+ ...__default__$4,
1103
+ setup(__props) {
1104
+ const { role, expanded } = useInjectedDropdownItem();
1105
+ const element = ref(null);
1106
+ useProvideDropdownAction({ expanded });
1107
+ const hovered = useElementHover(element);
1108
+ const { focused } = useFocus(element);
1109
+ const { focused: focusedWithin } = useFocusWithin(element);
1110
+ watch(hovered, (newValue) => {
1111
+ if (newValue) {
1112
+ focused.value = true;
1113
+ }
1114
+ });
1115
+ return (_ctx, _cache) => {
1116
+ return openBlock(), createElementBlock("li", mergeProps({ role: unref(role) }, {
1117
+ ref_key: "element",
1118
+ ref: element,
1119
+ class: ["vv-dropdown__item", { "focus-visible": unref(focused) || unref(focusedWithin) }]
1120
+ }), [
1121
+ renderSlot(_ctx.$slots, "default")
1122
+ ], 16);
1123
+ };
1124
+ }
1125
+ });
1126
+ const _hoisted_1$2 = ["title"];
1127
+ const __default__$3 = {
1128
+ name: "VvDropdownOption"
1129
+ };
1130
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1131
+ ...__default__$3,
1132
+ props: {
1133
+ ...DisabledProps,
1134
+ ...SelectedProps,
1135
+ ...UnselectableProps,
1136
+ ...ModifiersProps,
1137
+ deselectHintLabel: {
1138
+ type: String
1139
+ },
1140
+ selectHintLabel: {
1141
+ type: String
1142
+ },
1143
+ selectedHintLabel: {
1144
+ type: String
1145
+ }
1146
+ },
1147
+ setup(__props) {
1148
+ const props = __props;
1149
+ const { modifiers } = toRefs(props);
1150
+ const bemCssClasses = useModifiers(
1151
+ "vv-dropdown-option",
1152
+ modifiers,
1153
+ computed(() => ({
1154
+ disabled: props.disabled,
1155
+ selected: props.selected,
1156
+ unselectable: props.unselectable && props.selected
1157
+ }))
1158
+ );
1159
+ const hintLabel = computed(() => {
1160
+ if (props.selected) {
1161
+ return props.unselectable ? props.deselectHintLabel : props.selectedHintLabel;
1162
+ }
1163
+ if (!props.disabled) {
1164
+ return props.selectHintLabel;
1165
+ }
1166
+ });
1167
+ return (_ctx, _cache) => {
1168
+ return openBlock(), createBlock(_sfc_main$4, {
1169
+ class: normalizeClass(unref(bemCssClasses)),
1170
+ tabindex: _ctx.disabled ? -1 : 0,
1171
+ "aria-selected": _ctx.selected,
1172
+ "aria-disabled": _ctx.disabled
1173
+ }, {
1174
+ default: withCtx(() => [
1175
+ renderSlot(_ctx.$slots, "default"),
1176
+ createElementVNode("span", {
1177
+ class: "vv-dropdown-option__hint",
1178
+ title: unref(hintLabel)
667
1179
  }, [
668
- e.arrow ? (u(), v("div", {
669
- key: 0,
670
- ref_key: "arrowEl",
671
- ref: a,
672
- style: Be(t(x)),
673
- class: "vv-dropdown__arrow"
674
- }, null, 4)) : k("", !0),
675
- A(o.$slots, "before", T(R({ expanded: t(m) }))),
676
- H("ul", N(t(w), {
677
- id: t(g),
678
- ref_key: "listEl",
679
- ref: n,
680
- tabindex: t(m) ? void 0 : -1,
681
- role: t(te),
682
- "aria-labelledby": t(ie),
683
- class: "vv-dropdown__list"
684
- }), [
685
- A(o.$slots, "items", T(R({
686
- role: t(Q)
687
- })))
688
- ], 16, yt),
689
- A(o.$slots, "after", T(R({ expanded: t(m) })))
690
- ], 6), [
691
- [xe, t(m)]
692
- ])
1180
+ renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps({ disabled: _ctx.disabled, selected: _ctx.selected, unselectable: _ctx.unselectable })), () => [
1181
+ createTextVNode(toDisplayString(unref(hintLabel)), 1)
1182
+ ])
1183
+ ], 8, _hoisted_1$2)
693
1184
  ]),
694
1185
  _: 3
695
- }, 8, ["name"])
696
- ], 64));
697
- }
698
- }), _t = {
699
- name: "VvDropdownItem"
700
- }, Qe = /* @__PURE__ */ ce({
701
- ..._t,
702
- setup(s) {
703
- const { role: d, expanded: e } = useInjectedDropdownItem(), c = ref(null);
704
- useProvideDropdownAction({ expanded: e });
705
- const g = useElementHover(c), { focused: w } = useFocus(c), { focused: r } = useFocusWithin(c);
706
- return watch(g, (V) => {
707
- V && (w.value = !0);
708
- }), (V, $) => (u(), v("li", N({ role: t(d) }, {
709
- ref_key: "element",
710
- ref: c,
711
- class: ["vv-dropdown__item", { "focus-visible": t(w) || t(r) }]
712
- }), [
713
- A(V.$slots, "default")
714
- ], 16));
1186
+ }, 8, ["class", "tabindex", "aria-selected", "aria-disabled"]);
1187
+ };
715
1188
  }
716
1189
  });
717
- function be(s) {
718
- return Array.isArray(s) ? s.filter((d) => isString(d)).join(" ") : s;
1190
+ function equals(obj1, obj2, field) {
1191
+ if (field)
1192
+ return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
1193
+ else
1194
+ return deepEquals(obj1, obj2);
719
1195
  }
720
- function Xe(s, d) {
1196
+ function deepEquals(a, b) {
1197
+ if (a === b)
1198
+ return true;
1199
+ if (a && b && typeof a == "object" && typeof b == "object") {
1200
+ const arrA = Array.isArray(a);
1201
+ const arrB = Array.isArray(b);
1202
+ let i, length, key;
1203
+ if (arrA && arrB) {
1204
+ length = a.length;
1205
+ if (length != b.length)
1206
+ return false;
1207
+ for (i = length; i-- !== 0; )
1208
+ if (!deepEquals(a[i], b[i]))
1209
+ return false;
1210
+ return true;
1211
+ }
1212
+ if (arrA != arrB)
1213
+ return false;
1214
+ const dateA = a instanceof Date, dateB = b instanceof Date;
1215
+ if (dateA != dateB)
1216
+ return false;
1217
+ if (dateA && dateB)
1218
+ return a.getTime() == b.getTime();
1219
+ const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
1220
+ if (regexpA != regexpB)
1221
+ return false;
1222
+ if (regexpA && regexpB)
1223
+ return a.toString() == b.toString();
1224
+ const keys = Object.keys(a);
1225
+ length = keys.length;
1226
+ if (length !== Object.keys(b).length)
1227
+ return false;
1228
+ for (i = length; i-- !== 0; )
1229
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
1230
+ return false;
1231
+ for (i = length; i-- !== 0; ) {
1232
+ key = keys[i];
1233
+ if (!deepEquals(a[key], b[key]))
1234
+ return false;
1235
+ }
1236
+ return true;
1237
+ }
1238
+ return a !== a && b !== b;
1239
+ }
1240
+ function resolveFieldData(data, field) {
1241
+ if (data && Object.keys(data).length && field) {
1242
+ if (field.indexOf(".") === -1) {
1243
+ return data[field];
1244
+ } else {
1245
+ const fields = field.split(".");
1246
+ let value = data;
1247
+ for (let i = 0, len = fields.length; i < len; ++i) {
1248
+ if (data == null) {
1249
+ return null;
1250
+ }
1251
+ value = value[fields[i]];
1252
+ }
1253
+ return value;
1254
+ }
1255
+ } else {
1256
+ return null;
1257
+ }
1258
+ }
1259
+ function findIndexInList(value, list) {
1260
+ let index = -1;
1261
+ if (list) {
1262
+ for (let i = 0; i < list.length; i++) {
1263
+ if (equals(list[i], value)) {
1264
+ index = i;
1265
+ break;
1266
+ }
1267
+ }
1268
+ }
1269
+ return index;
1270
+ }
1271
+ function contains(value, list) {
1272
+ if (value != null && list && list.length) {
1273
+ for (const val of list) {
1274
+ if (equals(value, val)) {
1275
+ return true;
1276
+ }
1277
+ }
1278
+ }
1279
+ return false;
1280
+ }
1281
+ function isEmpty(value) {
1282
+ return ((value2) => value2 === null || value2 === void 0 || value2 === "" || Array.isArray(value2) && value2.length === 0 || !(value2 instanceof Date) && typeof value2 === "object" && Object.keys(value2).length === 0)(unref(value));
1283
+ }
1284
+ function removeFromList(value, list) {
1285
+ const indexElToRemove = findIndexInList(value, list);
1286
+ if (indexElToRemove > -1) {
1287
+ return list.filter((el, elIndex) => elIndex !== indexElToRemove);
1288
+ } else {
1289
+ return list;
1290
+ }
1291
+ }
1292
+ function isString(value) {
1293
+ return typeof value === "string" || value instanceof String;
1294
+ }
1295
+ function joinLines(errors) {
1296
+ if (Array.isArray(errors)) {
1297
+ return errors.filter((e) => isString(e)).join(" ");
1298
+ }
1299
+ return errors;
1300
+ }
1301
+ function HintSlotFactory(parentProps, parentSlots) {
721
1302
  const {
722
- invalid: e,
723
- valid: c,
724
- hint: g,
725
- loading: w
726
- } = d, {
727
- hintLabel: r,
728
- modelValue: V,
729
- valid: $,
730
- validLabel: b,
731
- invalid: a,
732
- invalidLabel: n,
733
- ...i
734
- } = toRefs(s), _ = resolveFieldData(i, "loading"), P = resolveFieldData(i, "loadingLabel"), B = computed(() => a.value ? !!(a.value && e || n != null && n.value && Array.isArray(n.value) && n.value.length > 0 || n != null && n.value && !isEmpty(n)) : !1), K = computed(
735
- () => !!(r && r.value || g)
736
- ), L = computed(
737
- () => !!(b && b.value || c)
738
- ), U = computed(
739
- () => !!(_ != null && _.value && w || _ != null && _.value && (P != null && P.value))
740
- ), j = computed(
741
- () => K.value || L.value || B.value || U.value
1303
+ invalid: invalidSlot,
1304
+ valid: validSlot,
1305
+ hint: hintSlot,
1306
+ loading: loadingSlot
1307
+ } = parentSlots;
1308
+ const {
1309
+ hintLabel,
1310
+ modelValue,
1311
+ valid,
1312
+ validLabel,
1313
+ invalid,
1314
+ invalidLabel,
1315
+ ...otherProps
1316
+ } = toRefs(parentProps);
1317
+ const loading = resolveFieldData(otherProps, "loading");
1318
+ const loadingLabel = resolveFieldData(otherProps, "loadingLabel");
1319
+ const hasInvalid = computed(() => {
1320
+ if (!invalid.value) {
1321
+ return false;
1322
+ }
1323
+ if (invalid.value && invalidSlot) {
1324
+ return true;
1325
+ }
1326
+ if ((invalidLabel == null ? void 0 : invalidLabel.value) && Array.isArray(invalidLabel.value) && invalidLabel.value.length > 0) {
1327
+ return true;
1328
+ }
1329
+ if ((invalidLabel == null ? void 0 : invalidLabel.value) && !isEmpty(invalidLabel)) {
1330
+ return true;
1331
+ }
1332
+ return false;
1333
+ });
1334
+ const hasHint = computed(
1335
+ () => !!(hintLabel && hintLabel.value || hintSlot)
1336
+ );
1337
+ const hasValid = computed(
1338
+ () => !!(validLabel && validLabel.value || validSlot)
1339
+ );
1340
+ const hasLoading = computed(
1341
+ () => !!((loading == null ? void 0 : loading.value) && loadingSlot || (loading == null ? void 0 : loading.value) && (loadingLabel == null ? void 0 : loadingLabel.value))
1342
+ );
1343
+ const isVisible = computed(
1344
+ () => hasHint.value || hasValid.value || hasInvalid.value || hasLoading.value
742
1345
  );
743
1346
  return {
744
- hasInvalid: B,
745
- hasHint: K,
746
- hasValid: L,
747
- hasLoading: U,
1347
+ hasInvalid,
1348
+ hasHint,
1349
+ hasValid,
1350
+ hasLoading,
748
1351
  HintSlot: {
749
1352
  name: "HintSlot",
750
1353
  props: {
@@ -753,30 +1356,37 @@ function Xe(s, d) {
753
1356
  default: () => ({})
754
1357
  }
755
1358
  },
756
- setup(I) {
757
- const D = computed(() => {
758
- const x = toReactive({
759
- hintLabel: r,
760
- modelValue: V,
761
- valid: $,
762
- validLabel: b,
763
- invalid: a,
764
- invalidLabel: n,
765
- loading: _,
766
- loadingLabel: P,
767
- ...I.params
1359
+ setup(props) {
1360
+ const hintContent = computed(() => {
1361
+ const slotProps = toReactive({
1362
+ hintLabel,
1363
+ modelValue,
1364
+ valid,
1365
+ validLabel,
1366
+ invalid,
1367
+ invalidLabel,
1368
+ loading,
1369
+ loadingLabel,
1370
+ ...props.params
768
1371
  });
769
- return a != null && a.value ? (e == null ? void 0 : e(x)) || be(n == null ? void 0 : n.value) || (r == null ? void 0 : r.value) : $ != null && $.value ? (c == null ? void 0 : c(x)) || be(b == null ? void 0 : b.value) || (r == null ? void 0 : r.value) : _ != null && _.value ? (w == null ? void 0 : w(x)) || be(P == null ? void 0 : P.value) || (r == null ? void 0 : r.value) : (g == null ? void 0 : g(x)) || be(r == null ? void 0 : r.value) || (r == null ? void 0 : r.value);
1372
+ if (invalid == null ? void 0 : invalid.value) {
1373
+ return (invalidSlot == null ? void 0 : invalidSlot(slotProps)) || joinLines(invalidLabel == null ? void 0 : invalidLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
1374
+ }
1375
+ if (valid == null ? void 0 : valid.value)
1376
+ return (validSlot == null ? void 0 : validSlot(slotProps)) || joinLines(validLabel == null ? void 0 : validLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
1377
+ if (loading == null ? void 0 : loading.value)
1378
+ return (loadingSlot == null ? void 0 : loadingSlot(slotProps)) || joinLines(loadingLabel == null ? void 0 : loadingLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
1379
+ return (hintSlot == null ? void 0 : hintSlot(slotProps)) || joinLines(hintLabel == null ? void 0 : hintLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
770
1380
  });
771
1381
  return {
772
- isVisible: j,
773
- hasInvalid: B,
774
- hasValid: L,
775
- hintContent: D
1382
+ isVisible,
1383
+ hasInvalid,
1384
+ hasValid,
1385
+ hintContent
776
1386
  };
777
1387
  },
778
1388
  render() {
779
- if (this.isVisible)
1389
+ if (this.isVisible) {
780
1390
  return h(
781
1391
  "small",
782
1392
  {
@@ -784,26 +1394,28 @@ function Xe(s, d) {
784
1394
  },
785
1395
  this.hintContent
786
1396
  );
1397
+ }
787
1398
  }
788
1399
  }
789
1400
  };
790
1401
  }
791
- const St = {
792
- ...Je,
793
- ...ct,
794
- ...ft,
795
- ...qe,
796
- ...Ne,
797
- ...Le,
798
- ...je,
799
- ...Me,
800
- ...Te,
801
- ...Re,
802
- ...he,
803
- ...We,
804
- ...ze,
805
- ...He,
806
- ...Ke,
1402
+ const VvSelectProps = {
1403
+ ...IdNameProps,
1404
+ ...AutofocusProps,
1405
+ ...AutocompleteProps,
1406
+ ...TabindexProps,
1407
+ ...ValidProps,
1408
+ ...InvalidProps,
1409
+ ...HintProps,
1410
+ ...LoadingProps,
1411
+ ...DisabledProps,
1412
+ ...ReadonlyProps,
1413
+ ...ModifiersProps,
1414
+ ...OptionsProps,
1415
+ ...IconProps,
1416
+ ...FloatingLabelProps,
1417
+ ...UnselectableProps,
1418
+ ...LabelProps,
807
1419
  /**
808
1420
  * This Boolean attribute indicates that multiple options can be selected in the list.
809
1421
  * If it is not specified, then only one option can be selected at a time.
@@ -830,464 +1442,757 @@ const St = {
830
1442
  type: [String, Number, Boolean, Object, Array],
831
1443
  default: void 0
832
1444
  },
833
- /**
834
- * <label> value for the select
835
- */
836
- label: String,
837
1445
  /**
838
1446
  * Select placeholder
839
1447
  */
840
1448
  placeholder: String
841
- }, wt = ["update:modelValue", "focus", "blur"], Vt = ["for"], $t = { class: "vv-select__wrapper" }, kt = {
1449
+ };
1450
+ const VvSelectEmits = ["update:modelValue", "focus", "blur"];
1451
+ function useComponentFocus(inputTemplateRef, emit) {
1452
+ const { focused } = useFocus(inputTemplateRef);
1453
+ watch(focused, (newValue) => {
1454
+ emit(newValue ? "focus" : "blur", unref(inputTemplateRef));
1455
+ });
1456
+ return {
1457
+ focused
1458
+ };
1459
+ }
1460
+ function useComponentIcon(icon, iconPosition) {
1461
+ const hasIconBefore = computed(
1462
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Position.before)
1463
+ );
1464
+ const hasIconAfter = computed(
1465
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Position.after)
1466
+ );
1467
+ const hasIconLeft = computed(
1468
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.left)
1469
+ );
1470
+ const hasIconRight = computed(
1471
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.right)
1472
+ );
1473
+ const hasIconTop = computed(
1474
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.top)
1475
+ );
1476
+ const hasIconBottom = computed(
1477
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.bottom)
1478
+ );
1479
+ const hasIcon = computed(() => {
1480
+ if (typeof (icon == null ? void 0 : icon.value) === "string") {
1481
+ return { name: icon == null ? void 0 : icon.value };
1482
+ }
1483
+ return icon == null ? void 0 : icon.value;
1484
+ });
1485
+ return {
1486
+ hasIcon,
1487
+ hasIconLeft,
1488
+ hasIconRight,
1489
+ hasIconTop,
1490
+ hasIconBottom,
1491
+ hasIconBefore,
1492
+ hasIconAfter
1493
+ };
1494
+ }
1495
+ function useOptions(props) {
1496
+ const { options, labelKey, valueKey, disabledKey } = toRefs(props);
1497
+ const getOptionLabel = (option) => {
1498
+ if (typeof option !== "object" && option !== null)
1499
+ return option;
1500
+ return typeof labelKey.value === "function" ? labelKey.value(option) : option[labelKey.value];
1501
+ };
1502
+ const getOptionValue = (option) => {
1503
+ if (typeof option !== "object" && option !== null)
1504
+ return option;
1505
+ return typeof valueKey.value === "function" ? valueKey.value(option) : option[valueKey.value];
1506
+ };
1507
+ const getOptionDisabled = (option) => {
1508
+ if (typeof option !== "object" && option !== null)
1509
+ return false;
1510
+ return typeof disabledKey.value === "function" ? disabledKey.value(option) : option[disabledKey.value];
1511
+ };
1512
+ return {
1513
+ options,
1514
+ getOptionLabel,
1515
+ getOptionValue,
1516
+ getOptionDisabled
1517
+ };
1518
+ }
1519
+ const _hoisted_1$1 = ["for"];
1520
+ const _hoisted_2$1 = { class: "vv-select__wrapper" };
1521
+ const _hoisted_3$1 = {
842
1522
  key: 0,
843
1523
  class: "vv-select__input-before"
844
- }, Pt = { class: "vv-select__inner" }, Et = ["id"], Bt = ["disabled", "hidden"], Dt = ["disabled", "value"], It = {
1524
+ };
1525
+ const _hoisted_4$1 = { class: "vv-select__inner" };
1526
+ const _hoisted_5$1 = ["id"];
1527
+ const _hoisted_6$1 = ["disabled", "hidden"];
1528
+ const _hoisted_7$1 = ["disabled", "value"];
1529
+ const _hoisted_8$1 = {
845
1530
  key: 1,
846
1531
  class: "vv-select__input-after"
847
- }, Ot = {
1532
+ };
1533
+ const __default__$2 = {
848
1534
  name: "VvSelect"
849
- }, Ct = /* @__PURE__ */ ce({
850
- ...Ot,
851
- props: St,
852
- emits: wt,
853
- setup(s, { emit: d }) {
854
- const e = s, c = useSlots(), g = ref(), { HintSlot: w, hasHint: r, hasInvalid: V } = Xe(e, c), {
855
- id: $,
856
- modifiers: b,
857
- disabled: a,
858
- readonly: n,
859
- loading: i,
860
- icon: _,
861
- iconPosition: P,
862
- invalid: B,
863
- valid: K,
864
- floating: L,
865
- multiple: U
866
- } = toRefs(e), j = useUniqueId($), I = computed(() => `${j.value}-hint`), { focused: D } = useComponentFocus(g, d), x = useElementVisibility(g);
867
- watch(x, (y) => {
868
- y && e.autofocus && (D.value = !0);
1535
+ };
1536
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1537
+ ...__default__$2,
1538
+ props: VvSelectProps,
1539
+ emits: VvSelectEmits,
1540
+ setup(__props, { emit }) {
1541
+ const props = __props;
1542
+ const slots = useSlots();
1543
+ const select = ref();
1544
+ const { HintSlot, hasHint, hasInvalid } = HintSlotFactory(props, slots);
1545
+ const {
1546
+ id,
1547
+ modifiers,
1548
+ disabled,
1549
+ readonly,
1550
+ loading,
1551
+ icon,
1552
+ iconPosition,
1553
+ invalid,
1554
+ valid,
1555
+ floating,
1556
+ multiple
1557
+ } = toRefs(props);
1558
+ const hasId = useUniqueId(id);
1559
+ const hasDescribedBy = computed(() => `${hasId.value}-hint`);
1560
+ const { focused } = useComponentFocus(select, emit);
1561
+ const isVisible = useElementVisibility(select);
1562
+ watch(isVisible, (newValue) => {
1563
+ if (newValue && props.autofocus) {
1564
+ focused.value = true;
1565
+ }
1566
+ });
1567
+ const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
1568
+ icon,
1569
+ iconPosition
1570
+ );
1571
+ const isDirty = computed(() => !isEmpty(props.modelValue));
1572
+ const isDisabled = computed(() => props.disabled || props.readonly);
1573
+ const hasTabindex = computed(() => {
1574
+ return isDisabled.value ? -1 : props.tabindex;
869
1575
  });
870
- const { hasIcon: W, hasIconBefore: J, hasIconAfter: m } = useComponentIcon(
871
- _,
872
- P
873
- ), z = computed(() => !isEmpty(e.modelValue)), O = computed(() => e.disabled || e.readonly), Z = computed(() => O.value ? -1 : e.tabindex), re = computed(() => {
874
- if (e.invalid === !0)
875
- return !0;
876
- if (e.valid === !0)
877
- return !1;
878
- }), ie = useBemModifiers(
1576
+ const isInvalid = computed(() => {
1577
+ if (props.invalid === true) {
1578
+ return true;
1579
+ }
1580
+ if (props.valid === true) {
1581
+ return false;
1582
+ }
1583
+ return void 0;
1584
+ });
1585
+ const bemCssClasses = useModifiers(
879
1586
  "vv-select",
880
- b,
1587
+ modifiers,
881
1588
  computed(() => ({
882
- valid: K.value,
883
- invalid: B.value,
884
- loading: i.value,
885
- disabled: a.value,
886
- readonly: n.value,
887
- "icon-before": J.value,
888
- "icon-after": m.value,
889
- dirty: z.value,
890
- focus: D.value,
891
- floating: L.value,
892
- multiple: U.value
1589
+ valid: valid.value,
1590
+ invalid: invalid.value,
1591
+ loading: loading.value,
1592
+ disabled: disabled.value,
1593
+ readonly: readonly.value,
1594
+ "icon-before": hasIconBefore.value,
1595
+ "icon-after": hasIconAfter.value,
1596
+ dirty: isDirty.value,
1597
+ focus: focused.value,
1598
+ floating: floating.value,
1599
+ multiple: multiple.value
893
1600
  }))
894
- ), G = computed(() => ({
895
- name: e.name,
896
- tabindex: Z.value,
897
- disabled: O.value,
898
- required: e.required,
899
- size: e.size,
900
- autocomplete: e.autocomplete,
901
- multiple: e.multiple,
902
- "aria-invalid": re.value,
903
- "aria-describedby": !V.value && r.value ? I.value : void 0,
904
- "aria-errormessage": V.value ? I.value : void 0
905
- })), ee = computed(() => ({
906
- valid: e.valid,
907
- invalid: e.invalid,
908
- modelValue: e.modelValue
909
- })), { getOptionLabel: ue, getOptionValue: te, getOptionDisabled: fe } = useOptions(e), Q = computed({
910
- get: () => e.modelValue,
911
- set: (y) => {
912
- Array.isArray(y) && (y = y.filter((C) => C !== void 0)), d("update:modelValue", y);
1601
+ );
1602
+ const hasAttrs = computed(() => {
1603
+ return {
1604
+ name: props.name,
1605
+ tabindex: hasTabindex.value,
1606
+ disabled: isDisabled.value,
1607
+ required: props.required,
1608
+ size: props.size,
1609
+ autocomplete: props.autocomplete,
1610
+ multiple: props.multiple,
1611
+ "aria-invalid": isInvalid.value,
1612
+ "aria-describedby": !hasInvalid.value && hasHint.value ? hasDescribedBy.value : void 0,
1613
+ "aria-errormessage": hasInvalid.value ? hasDescribedBy.value : void 0
1614
+ };
1615
+ });
1616
+ const slotProps = computed(() => ({
1617
+ valid: props.valid,
1618
+ invalid: props.invalid,
1619
+ modelValue: props.modelValue
1620
+ }));
1621
+ const { getOptionLabel, getOptionValue, getOptionDisabled } = useOptions(props);
1622
+ const localModelValue = computed({
1623
+ get: () => {
1624
+ return props.modelValue;
1625
+ },
1626
+ set: (newValue) => {
1627
+ if (Array.isArray(newValue)) {
1628
+ newValue = newValue.filter((item) => item !== void 0);
1629
+ }
1630
+ emit("update:modelValue", newValue);
913
1631
  }
914
1632
  });
915
- return (y, C) => (u(), v("div", {
916
- class: ve(t(ie))
917
- }, [
918
- y.label ? (u(), v("label", {
919
- key: 0,
920
- for: t(j)
921
- }, F(y.label), 9, Vt)) : k("", !0),
922
- H("div", $t, [
923
- y.$slots.before ? (u(), v("div", kt, [
924
- A(y.$slots, "before", T(R(t(ee))))
925
- ])) : k("", !0),
926
- H("div", Pt, [
927
- t(J) ? (u(), Y(pe, N({
928
- key: 0,
929
- class: "vv-select__icon"
930
- }, t(W)), null, 16)) : k("", !0),
931
- ke(H("select", N({
932
- id: t(j),
933
- ref_key: "select",
934
- ref: g,
935
- "onUpdate:modelValue": C[0] || (C[0] = (E) => _e(Q) ? Q.value = E : null)
936
- }, t(G)), [
937
- y.placeholder ? (u(), v("option", {
1633
+ return (_ctx, _cache) => {
1634
+ return openBlock(), createElementBlock("div", {
1635
+ class: normalizeClass(unref(bemCssClasses))
1636
+ }, [
1637
+ _ctx.label ? (openBlock(), createElementBlock("label", {
1638
+ key: 0,
1639
+ for: unref(hasId)
1640
+ }, toDisplayString(_ctx.label), 9, _hoisted_1$1)) : createCommentVNode("", true),
1641
+ createElementVNode("div", _hoisted_2$1, [
1642
+ _ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
1643
+ renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
1644
+ ])) : createCommentVNode("", true),
1645
+ createElementVNode("div", _hoisted_4$1, [
1646
+ unref(hasIconBefore) ? (openBlock(), createBlock(_sfc_main$6, mergeProps({
938
1647
  key: 0,
939
- value: void 0,
940
- disabled: !y.unselectable,
941
- hidden: !y.unselectable
942
- }, F(y.placeholder), 9, Bt)) : k("", !0),
943
- (u(!0), v(q, null, Se(y.options, (E, X) => (u(), v("option", {
944
- key: X,
945
- disabled: t(fe)(E),
946
- value: t(te)(E)
947
- }, F(t(ue)(E)), 9, Dt))), 128))
948
- ], 16, Et), [
949
- [ot, t(Q)]
1648
+ class: "vv-select__icon"
1649
+ }, unref(hasIcon)), null, 16)) : createCommentVNode("", true),
1650
+ withDirectives(createElementVNode("select", mergeProps({
1651
+ id: unref(hasId),
1652
+ ref_key: "select",
1653
+ ref: select,
1654
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
1655
+ }, unref(hasAttrs)), [
1656
+ _ctx.placeholder ? (openBlock(), createElementBlock("option", {
1657
+ key: 0,
1658
+ value: void 0,
1659
+ disabled: !_ctx.unselectable,
1660
+ hidden: !_ctx.unselectable
1661
+ }, toDisplayString(_ctx.placeholder), 9, _hoisted_6$1)) : createCommentVNode("", true),
1662
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
1663
+ return openBlock(), createElementBlock("option", {
1664
+ key: index,
1665
+ disabled: unref(getOptionDisabled)(option),
1666
+ value: unref(getOptionValue)(option)
1667
+ }, toDisplayString(unref(getOptionLabel)(option)), 9, _hoisted_7$1);
1668
+ }), 128))
1669
+ ], 16, _hoisted_5$1), [
1670
+ [vModelSelect, unref(localModelValue)]
1671
+ ]),
1672
+ unref(hasIconAfter) ? (openBlock(), createBlock(_sfc_main$6, mergeProps({
1673
+ key: 1,
1674
+ class: "vv-select__icon vv-select__icon-after"
1675
+ }, unref(hasIcon)), null, 16)) : createCommentVNode("", true)
950
1676
  ]),
951
- t(m) ? (u(), Y(pe, N({
952
- key: 1,
953
- class: "vv-select__icon vv-select__icon-after"
954
- }, t(W)), null, 16)) : k("", !0)
1677
+ _ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_8$1, [
1678
+ renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
1679
+ ])) : createCommentVNode("", true)
955
1680
  ]),
956
- y.$slots.after ? (u(), v("div", It, [
957
- A(y.$slots, "after", T(R(t(ee))))
958
- ])) : k("", !0)
959
- ]),
960
- de(t(w), {
961
- id: t(I),
962
- class: "vv-select__hint"
963
- }, null, 8, ["id"])
964
- ], 2));
1681
+ createVNode(unref(HintSlot), {
1682
+ id: unref(hasDescribedBy),
1683
+ class: "vv-select__hint"
1684
+ }, null, 8, ["id"])
1685
+ ], 2);
1686
+ };
965
1687
  }
966
- }), At = {
967
- ...he,
1688
+ });
1689
+ const VvBadgeProps = {
1690
+ ...ModifiersProps,
968
1691
  value: [String, Number]
969
- }, xt = {
1692
+ };
1693
+ const __default__$1 = {
970
1694
  name: "VvBadge"
971
- }, Ft = /* @__PURE__ */ ce({
972
- ...xt,
973
- props: At,
974
- setup(s) {
975
- const d = s, { modifiers: e } = toRefs(d), c = useBemModifiers("vv-badge", e);
976
- return (g, w) => (u(), v("span", {
977
- class: ve(t(c)),
978
- role: "status"
979
- }, [
980
- A(g.$slots, "default", {}, () => [
981
- se(F(g.value), 1)
982
- ])
983
- ], 2));
1695
+ };
1696
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1697
+ ...__default__$1,
1698
+ props: VvBadgeProps,
1699
+ setup(__props) {
1700
+ const props = __props;
1701
+ const { modifiers } = toRefs(props);
1702
+ const bemCssClasses = useModifiers("vv-badge", modifiers);
1703
+ return (_ctx, _cache) => {
1704
+ return openBlock(), createElementBlock("span", {
1705
+ class: normalizeClass(unref(bemCssClasses)),
1706
+ role: "status"
1707
+ }, [
1708
+ renderSlot(_ctx.$slots, "default", {}, () => [
1709
+ createTextVNode(toDisplayString(_ctx.value), 1)
1710
+ ])
1711
+ ], 2);
1712
+ };
984
1713
  }
985
- }), Nt = ["id"], Lt = ["id", "for"], Mt = ["id", "aria-controls", "aria-labelledby", "aria-describedby", "placeholder"], Tt = {
1714
+ });
1715
+ function useDefaults(componentName, propsDefinition, props) {
1716
+ const volver = useVolver();
1717
+ const volverComponentDefaults = computed(() => {
1718
+ var _a;
1719
+ if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
1720
+ return void 0;
1721
+ }
1722
+ return volver.defaults.value[componentName];
1723
+ });
1724
+ return computed(() => {
1725
+ if (volverComponentDefaults.value === void 0) {
1726
+ return props;
1727
+ }
1728
+ const componentDefaults = volverComponentDefaults.value;
1729
+ const simplifiedPropsDefinition = propsDefinition;
1730
+ const simplifiedProps = props;
1731
+ return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
1732
+ const propValue = simplifiedProps[key];
1733
+ acc[key] = propValue;
1734
+ if (key in componentDefaults) {
1735
+ if (Array.isArray(simplifiedPropsDefinition[key])) {
1736
+ const typeArray = simplifiedPropsDefinition[key];
1737
+ if (typeArray.length) {
1738
+ const typeFunction = typeArray[0];
1739
+ if (typeFunction === propValue) {
1740
+ acc[key] = componentDefaults[key];
1741
+ }
1742
+ }
1743
+ }
1744
+ if (typeof simplifiedPropsDefinition[key] === "function") {
1745
+ const typeFunction = simplifiedPropsDefinition[key];
1746
+ if (typeFunction() === propValue) {
1747
+ acc[key] = componentDefaults[key];
1748
+ }
1749
+ }
1750
+ if (typeof simplifiedPropsDefinition[key] === "object") {
1751
+ let defaultValue = simplifiedPropsDefinition[key].default;
1752
+ if (typeof defaultValue === "function") {
1753
+ defaultValue = defaultValue();
1754
+ }
1755
+ if (typeof defaultValue === "object") {
1756
+ if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
1757
+ acc[key] = componentDefaults[key];
1758
+ }
1759
+ } else if (defaultValue === propValue) {
1760
+ acc[key] = componentDefaults[key];
1761
+ }
1762
+ }
1763
+ }
1764
+ return acc;
1765
+ }, {});
1766
+ });
1767
+ }
1768
+ const _hoisted_1 = ["id"];
1769
+ const _hoisted_2 = ["id", "for"];
1770
+ const _hoisted_3 = ["id", "aria-controls", "aria-labelledby", "aria-describedby", "placeholder"];
1771
+ const _hoisted_4 = {
986
1772
  key: 0,
987
1773
  class: "vv-select__input-before"
988
- }, Rt = { class: "vv-select__inner" }, jt = ["aria-labelledby", "tabindex"], Wt = ["aria-label", "onClick"], zt = {
1774
+ };
1775
+ const _hoisted_5 = { class: "vv-select__inner" };
1776
+ const _hoisted_6 = ["aria-labelledby", "tabindex"];
1777
+ const _hoisted_7 = ["aria-label", "onClick"];
1778
+ const _hoisted_8 = {
989
1779
  key: 1,
990
1780
  class: "vv-select__input-after"
991
- }, qt = { class: "vv-dropdown-action__hint" }, Ht = {
1781
+ };
1782
+ const __default__ = {
992
1783
  name: "VvCombobox",
993
- components: { VvDropdown: Ge, VvDropdownItem: Qe }
994
- }, Qt = /* @__PURE__ */ ce({
995
- ...Ht,
996
- props: vt,
997
- emits: pt,
998
- setup(s, { emit: d }) {
999
- const e = s, c = useSlots(), { HintSlot: g } = Xe(e, c), w = ref(null), r = ref(null), V = ref(null), { focused: $ } = useComponentFocus(w, d), { focused: b } = useFocusWithin(V);
1000
- watch($, (l) => {
1001
- if (e.autoOpen) {
1002
- if (l && !i.value) {
1003
- P();
1004
- return;
1005
- }
1006
- !l && i.value && !b.value && B();
1784
+ components: { VvDropdown: _sfc_main$5, VvDropdownOption: _sfc_main$3 }
1785
+ };
1786
+ const _sfc_main = /* @__PURE__ */ defineComponent({
1787
+ ...__default__,
1788
+ props: VvComboboxProps,
1789
+ emits: VvComboboxEvents,
1790
+ setup(__props, { emit }) {
1791
+ const props = __props;
1792
+ const slots = useSlots();
1793
+ const propsDefaults = useDefaults(
1794
+ "VvCombobox",
1795
+ VvComboboxProps,
1796
+ props
1797
+ );
1798
+ const { HintSlot } = HintSlotFactory(props, slots);
1799
+ const inputEl = ref(null);
1800
+ const inputSearchEl = ref(null);
1801
+ const wrapperEl = ref(null);
1802
+ const { focused } = useComponentFocus(inputEl, emit);
1803
+ const { focused: focusedWithin } = useFocusWithin(wrapperEl);
1804
+ watch(focused, (newValue) => {
1805
+ if (!props.autoOpen) {
1806
+ return;
1807
+ }
1808
+ if (newValue && !expanded.value) {
1809
+ expand();
1810
+ return;
1811
+ }
1812
+ if (!newValue && expanded.value && !focusedWithin.value) {
1813
+ collapse();
1814
+ }
1815
+ });
1816
+ watch(focusedWithin, (newValue) => {
1817
+ if (!focused.value && !newValue && expanded.value) {
1818
+ collapse();
1007
1819
  }
1008
- }), watch(b, (l) => {
1009
- !$.value && !l && i.value && B();
1010
1820
  });
1011
- const a = ref(""), n = refDebounced(
1012
- a,
1013
- Number(e.debounceSearch)
1821
+ const searchText = ref("");
1822
+ const debouncedSearchText = refDebounced(
1823
+ searchText,
1824
+ Number(props.debounceSearch)
1014
1825
  );
1015
1826
  watch(
1016
- n,
1017
- () => d("change:search", n.value)
1827
+ debouncedSearchText,
1828
+ () => emit("change:search", debouncedSearchText.value)
1018
1829
  );
1019
- const i = ref(!1), _ = () => {
1020
- e.disabled || e.readonly || (i.value = !i.value);
1021
- }, P = () => {
1022
- e.disabled || e.readonly || i.value || (i.value = !0);
1023
- }, B = () => {
1024
- e.disabled || e.readonly || !i.value || (i.value = !1);
1830
+ const expanded = ref(false);
1831
+ const toggleExpanded = () => {
1832
+ if (props.disabled || props.readonly)
1833
+ return;
1834
+ expanded.value = !expanded.value;
1025
1835
  };
1026
- watch(i, (l) => {
1027
- z.value && nextTick(() => {
1028
- if (l) {
1029
- r.value && r.value.focus();
1030
- return;
1031
- }
1032
- a.value = "";
1033
- });
1836
+ const expand = () => {
1837
+ if (props.disabled || props.readonly || expanded.value)
1838
+ return;
1839
+ expanded.value = true;
1840
+ };
1841
+ const collapse = () => {
1842
+ if (props.disabled || props.readonly || !expanded.value)
1843
+ return;
1844
+ expanded.value = false;
1845
+ };
1846
+ watch(expanded, (newValue) => {
1847
+ if (searchable.value) {
1848
+ nextTick(() => {
1849
+ if (newValue) {
1850
+ if (inputSearchEl.value) {
1851
+ inputSearchEl.value.focus();
1852
+ }
1853
+ return;
1854
+ }
1855
+ searchText.value = "";
1856
+ });
1857
+ }
1034
1858
  });
1035
1859
  const {
1036
- id: K,
1037
- icon: L,
1038
- iconPosition: U,
1039
- modifiers: j,
1040
- disabled: I,
1041
- readonly: D,
1042
- loading: x,
1043
- valid: W,
1044
- invalid: J,
1045
- floating: m,
1046
- searchable: z
1047
- } = toRefs(e), O = useUniqueId(K), Z = computed(() => `${O.value}-hint`), re = computed(() => `${O.value}-dropdown`), ie = computed(() => `${O.value}-search`), G = computed(() => `${O.value}-label`), { hasIcon: ee, hasIconBefore: ue, hasIconAfter: te } = useComponentIcon(
1048
- L,
1049
- U
1050
- ), fe = computed(() => !isEmpty(e.modelValue)), Q = computed(() => I.value || D.value ? -1 : e.tabindex), y = useBemModifiers(
1860
+ id,
1861
+ icon,
1862
+ iconPosition,
1863
+ modifiers,
1864
+ disabled,
1865
+ readonly,
1866
+ loading,
1867
+ valid,
1868
+ invalid,
1869
+ floating,
1870
+ searchable
1871
+ } = toRefs(props);
1872
+ const hasId = useUniqueId(id);
1873
+ const hasHintId = computed(() => `${hasId.value}-hint`);
1874
+ const hasDropdownId = computed(() => `${hasId.value}-dropdown`);
1875
+ const hasSearchId = computed(() => `${hasId.value}-search`);
1876
+ const hasLabelId = computed(() => `${hasId.value}-label`);
1877
+ const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
1878
+ icon,
1879
+ iconPosition
1880
+ );
1881
+ const isDirty = computed(() => !isEmpty(props.modelValue));
1882
+ const hasTabindex = computed(() => {
1883
+ return disabled.value || readonly.value ? -1 : props.tabindex;
1884
+ });
1885
+ const bemCssClasses = useModifiers(
1051
1886
  "vv-select",
1052
- j,
1887
+ modifiers,
1053
1888
  computed(() => ({
1054
- disabled: I.value,
1055
- loading: x.value,
1056
- readonly: D.value,
1057
- "icon-before": Boolean(ue.value),
1058
- "icon-after": Boolean(te.value),
1059
- valid: W.value,
1060
- invalid: J.value,
1061
- dirty: fe.value,
1062
- focus: $.value,
1063
- floating: m.value
1889
+ disabled: disabled.value,
1890
+ loading: loading.value,
1891
+ readonly: readonly.value,
1892
+ "icon-before": Boolean(hasIconBefore.value),
1893
+ "icon-after": Boolean(hasIconAfter.value),
1894
+ valid: valid.value,
1895
+ invalid: invalid.value,
1896
+ dirty: isDirty.value,
1897
+ focus: focused.value,
1898
+ floating: floating.value
1064
1899
  }))
1065
- ), C = computed(
1066
- () => e.searchable ? o.value : e.options
1067
- ), { getOptionLabel: E, getOptionValue: X, getOptionDisabled: oe } = useOptions(e), o = computed(() => {
1068
- var l;
1069
- return (l = e.options) == null ? void 0 : l.filter((S) => E(S).toLowerCase().includes(n.value.toLowerCase().trim()));
1900
+ );
1901
+ const hasOptions = computed(
1902
+ () => props.searchable ? filteredOptions.value : props.options
1903
+ );
1904
+ const { getOptionLabel, getOptionValue, getOptionDisabled } = useOptions(props);
1905
+ const filteredOptions = computed(() => {
1906
+ var _a;
1907
+ return (_a = props.options) == null ? void 0 : _a.filter((option) => {
1908
+ return getOptionLabel(option).toLowerCase().includes(debouncedSearchText.value.toLowerCase().trim());
1909
+ });
1070
1910
  });
1071
- function p(l) {
1072
- return Array.isArray(e.modelValue) ? contains(l, e.modelValue) || contains(X(l), e.modelValue) : equals(l, e.modelValue) || equals(X(l), e.modelValue);
1911
+ function getOptionSelected(option) {
1912
+ if (Array.isArray(props.modelValue)) {
1913
+ return contains(option, props.modelValue) || contains(getOptionValue(option), props.modelValue);
1914
+ }
1915
+ return equals(option, props.modelValue) || equals(getOptionValue(option), props.modelValue);
1073
1916
  }
1074
- const M = computed(() => {
1075
- let l = [];
1076
- return Array.isArray(e.modelValue) ? l = e.modelValue : e.modelValue && (l = [e.modelValue]), e.options.filter(
1077
- (S) => l.includes(X(S))
1917
+ const selectedOptions = computed(() => {
1918
+ let selectedValues = [];
1919
+ if (Array.isArray(props.modelValue)) {
1920
+ selectedValues = props.modelValue;
1921
+ } else if (props.modelValue) {
1922
+ selectedValues = [props.modelValue];
1923
+ }
1924
+ return props.options.filter(
1925
+ (option) => selectedValues.includes(getOptionValue(option))
1078
1926
  );
1079
- }), le = computed(() => M.value.map((l) => E(l)).join(e.separator));
1080
- watch(M, () => {
1081
- !e.multiple && e.autoClose && B();
1082
1927
  });
1083
- const Ye = () => {
1084
- e.autoOpen ? P() : _();
1085
- }, ye = (l) => {
1086
- var ae;
1087
- if (e.disabled || e.readonly)
1928
+ const hasValue = computed(() => {
1929
+ return selectedOptions.value.map((option) => getOptionLabel(option)).join(props.separator);
1930
+ });
1931
+ watch(selectedOptions, () => {
1932
+ if (!props.multiple && props.autoClose) {
1933
+ collapse();
1934
+ }
1935
+ });
1936
+ const onClickInput = () => {
1937
+ props.autoOpen ? expand() : toggleExpanded();
1938
+ };
1939
+ const onInput = (option) => {
1940
+ var _a;
1941
+ if (props.disabled || props.readonly) {
1088
1942
  return;
1089
- const S = X(l);
1090
- let f = S;
1091
- if (e.multiple)
1092
- if (Array.isArray(e.modelValue)) {
1093
- if (e.maxValues !== void 0 && e.maxValues >= 0 && ((ae = e.modelValue) == null ? void 0 : ae.length) >= e.maxValues && !contains(S, e.modelValue))
1094
- return;
1095
- f = contains(S, e.modelValue) ? removeFromList(S, e.modelValue) : [...e.modelValue, S];
1096
- } else
1097
- f = [S];
1098
- else
1099
- e.unselectable && S === e.modelValue && (f = void 0);
1100
- d("update:modelValue", f);
1101
- }, Ze = computed(() => ({
1102
- id: O.value,
1103
- name: e.name,
1104
- tabindex: Q.value,
1105
- valid: W.value,
1106
- validLabel: e.validLabel,
1107
- invalid: J.value,
1108
- invalidLabel: e.invalidLabel,
1109
- hintLabel: e.hintLabel,
1110
- loading: x.value,
1111
- loadingLabel: e.loadingLabel,
1112
- disabled: I.value,
1113
- readonly: D.value,
1114
- modifiers: e.modifiers,
1115
- options: C.value,
1116
- labelKey: e.labelKey,
1117
- valueKey: e.valueKey,
1118
- icon: e.icon,
1119
- iconPosition: e.iconPosition,
1120
- floating: e.floating,
1121
- unselectable: e.unselectable,
1122
- multiple: e.multiple,
1123
- label: e.label,
1124
- placeholder: e.placeholder,
1125
- modelValue: e.modelValue
1126
- })), et = computed(() => ({
1127
- id: re.value,
1128
- reference: V.value,
1129
- placement: e.placement,
1130
- transitionName: e.transitionName,
1131
- offset: e.offset,
1132
- shift: e.shift,
1133
- flip: e.flip,
1134
- autoPlacement: e.autoPlacement,
1135
- arrow: e.arrow,
1136
- autoClose: e.autoClose,
1137
- autofocusFirst: z.value ? !1 : e.autofocusFirst,
1138
- triggerWidth: e.triggerWidth,
1139
- modifiers: e.dropdownModifiers
1140
- })), Pe = computed(() => ({
1141
- valid: e.valid,
1142
- invalid: e.invalid,
1143
- modelValue: e.modelValue
1943
+ }
1944
+ const value = getOptionValue(option);
1945
+ let toReturn = value;
1946
+ if (props.multiple) {
1947
+ if (Array.isArray(props.modelValue)) {
1948
+ if (props.maxValues !== void 0 && props.maxValues >= 0 && ((_a = props.modelValue) == null ? void 0 : _a.length) >= props.maxValues) {
1949
+ if (!contains(value, props.modelValue)) {
1950
+ return;
1951
+ }
1952
+ }
1953
+ toReturn = contains(value, props.modelValue) ? removeFromList(value, props.modelValue) : [...props.modelValue, value];
1954
+ } else {
1955
+ toReturn = [value];
1956
+ }
1957
+ } else {
1958
+ if (props.autoClose) {
1959
+ collapse();
1960
+ }
1961
+ if (props.unselectable && value === props.modelValue) {
1962
+ toReturn = void 0;
1963
+ }
1964
+ }
1965
+ emit("update:modelValue", toReturn);
1966
+ };
1967
+ const selectProps = computed(() => ({
1968
+ id: hasId.value,
1969
+ name: props.name,
1970
+ tabindex: hasTabindex.value,
1971
+ valid: valid.value,
1972
+ validLabel: propsDefaults.value.validLabel,
1973
+ invalid: invalid.value,
1974
+ invalidLabel: propsDefaults.value.invalidLabel,
1975
+ hintLabel: propsDefaults.value.hintLabel,
1976
+ loading: loading.value,
1977
+ loadingLabel: propsDefaults.value.loadingLabel,
1978
+ disabled: disabled.value,
1979
+ readonly: readonly.value,
1980
+ modifiers: props.modifiers,
1981
+ options: hasOptions.value,
1982
+ labelKey: props.labelKey,
1983
+ valueKey: props.valueKey,
1984
+ icon: props.icon,
1985
+ iconPosition: props.iconPosition,
1986
+ floating: props.floating,
1987
+ unselectable: props.unselectable,
1988
+ multiple: props.multiple,
1989
+ label: props.label,
1990
+ placeholder: props.placeholder,
1991
+ modelValue: props.modelValue
1992
+ }));
1993
+ const dropdownProps = computed(() => ({
1994
+ id: hasDropdownId.value,
1995
+ reference: wrapperEl.value,
1996
+ placement: props.placement,
1997
+ transitionName: props.transitionName,
1998
+ offset: props.offset,
1999
+ shift: props.shift,
2000
+ flip: props.flip,
2001
+ autoPlacement: props.autoPlacement,
2002
+ arrow: props.arrow,
2003
+ autoClose: props.autoClose,
2004
+ autofocusFirst: searchable.value ? false : props.autofocusFirst,
2005
+ triggerWidth: props.triggerWidth,
2006
+ modifiers: props.dropdownModifiers
2007
+ }));
2008
+ const slotProps = computed(() => ({
2009
+ valid: props.valid,
2010
+ invalid: props.invalid,
2011
+ modelValue: props.modelValue
1144
2012
  }));
1145
- return onKeyStroke([" ", "Enter"], (l) => {
1146
- e.autoOpen || !i.value && $.value && (l.preventDefault(), l.stopImmediatePropagation(), _());
1147
- }), (l, S) => l.native ? (u(), Y(Ct, N({ key: 1 }, t(Ze), {
1148
- "onUpdate:modelValue": S[2] || (S[2] = (f) => d("update:modelValue", f))
1149
- }), null, 16)) : (u(), v("div", {
1150
- key: 0,
1151
- id: t(O),
1152
- class: ve(t(y))
1153
- }, [
1154
- l.label ? (u(), v("label", {
2013
+ onKeyStroke([" ", "Enter"], (e) => {
2014
+ if (props.autoOpen) {
2015
+ return;
2016
+ }
2017
+ if (!expanded.value && focused.value) {
2018
+ e.preventDefault();
2019
+ e.stopImmediatePropagation();
2020
+ toggleExpanded();
2021
+ }
2022
+ });
2023
+ return (_ctx, _cache) => {
2024
+ return !_ctx.native ? (openBlock(), createElementBlock("div", {
1155
2025
  key: 0,
1156
- id: t(G),
1157
- for: t(z) ? t(ie) : void 0
1158
- }, F(l.label), 9, Lt)) : k("", !0),
1159
- H("div", {
1160
- ref_key: "wrapperEl",
1161
- ref: V,
1162
- class: "vv-select__wrapper"
2026
+ id: unref(hasId),
2027
+ class: normalizeClass(unref(bemCssClasses))
1163
2028
  }, [
1164
- de(Ge, N({
1165
- modelValue: t(i),
1166
- "onUpdate:modelValue": S[1] || (S[1] = (f) => _e(i) ? i.value = f : null)
1167
- }, t(et), { role: "listbox" }), lt({
1168
- default: ne(({ aria: f }) => [
1169
- l.$slots.before ? (u(), v("div", Tt, [
1170
- A(l.$slots, "before", T(R(t(Pe))))
1171
- ])) : k("", !0),
1172
- H("div", Rt, [
1173
- t(ue) ? (u(), Y(pe, N({
1174
- key: 0,
1175
- class: "vv-select__icon"
1176
- }, t(ee)), null, 16)) : k("", !0),
1177
- H("div", N({
1178
- ref_key: "inputEl",
1179
- ref: w
1180
- }, f, {
1181
- "aria-labelledby": t(G),
1182
- class: "vv-select__input",
1183
- role: "combobox",
1184
- tabindex: t(Q),
1185
- onClickPassive: Ye
1186
- }), [
1187
- A(l.$slots, "value", T(R({ selectedOptions: t(M), onInput: ye })), () => [
1188
- t(le) ? (u(), v(q, { key: 0 }, [
1189
- l.badges ? (u(!0), v(q, { key: 1 }, Se(t(M), (ae, Ee) => (u(), Y(Ft, {
1190
- key: Ee,
1191
- modifiers: l.badgeModifiers,
1192
- class: "vv-select__badge"
1193
- }, {
1194
- default: ne(() => [
1195
- se(F(t(E)(ae)) + " ", 1),
1196
- l.unselectable && !t(D) && !t(I) ? (u(), v("button", {
1197
- key: 0,
1198
- "aria-label": l.deselectLabel,
1199
- onClick: at((Kt) => ye(ae), ["stop"])
1200
- }, [
1201
- de(pe, { name: "close" })
1202
- ], 8, Wt)) : k("", !0)
1203
- ]),
1204
- _: 2
1205
- }, 1032, ["modifiers"]))), 128)) : (u(), v(q, { key: 0 }, [
1206
- se(F(t(le)), 1)
1207
- ], 64))
1208
- ], 64)) : (u(), v(q, { key: 1 }, [
1209
- se(F(l.placeholder), 1)
1210
- ], 64))
1211
- ])
1212
- ], 16, jt),
1213
- t(te) ? (u(), Y(pe, N({
1214
- key: 1,
1215
- class: "vv-select__icon vv-select__icon-after"
1216
- }, t(ee)), null, 16)) : k("", !0)
1217
- ]),
1218
- l.$slots.after ? (u(), v("div", zt, [
1219
- A(l.$slots, "after", T(R(t(Pe))))
1220
- ])) : k("", !0)
1221
- ]),
1222
- items: ne(() => [
1223
- (u(!0), v(q, null, Se(t(o), (f, ae) => (u(), Y(Qe, {
1224
- key: ae,
1225
- class: ve(["vv-dropdown-action", {
1226
- disabled: t(oe)(f),
1227
- selected: p(f),
1228
- "vv-dropdown-action--unselectable": l.unselectable && p(f)
1229
- }]),
1230
- tabindex: t(oe)(f) ? -1 : 0,
1231
- "aria-selected": p(f),
1232
- "aria-disabled": t(oe)(f),
1233
- onClickPassive: (Ee) => ye(f)
1234
- }, {
1235
- default: ne(() => [
1236
- A(l.$slots, "option", T(R({
1237
- option: f,
1238
- selectedOptions: t(M),
1239
- selected: p(f),
1240
- disabled: t(oe)(f)
1241
- })), () => [
1242
- se(F(t(E)(f)) + " ", 1),
1243
- H("span", qt, [
1244
- p(f) ? (u(), v(q, { key: 0 }, [
1245
- se(F(l.unselectable ? l.pressToDeselectLabel : l.selectedLabel), 1)
1246
- ], 64)) : t(oe)(f) ? k("", !0) : (u(), v(q, { key: 1 }, [
1247
- se(F(l.pressToSelectLabel), 1)
2029
+ _ctx.label ? (openBlock(), createElementBlock("label", {
2030
+ key: 0,
2031
+ id: unref(hasLabelId),
2032
+ for: unref(searchable) ? unref(hasSearchId) : void 0
2033
+ }, toDisplayString(_ctx.label), 9, _hoisted_2)) : createCommentVNode("", true),
2034
+ createElementVNode("div", {
2035
+ ref_key: "wrapperEl",
2036
+ ref: wrapperEl,
2037
+ class: "vv-select__wrapper"
2038
+ }, [
2039
+ createVNode(_sfc_main$5, mergeProps({
2040
+ modelValue: unref(expanded),
2041
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(expanded) ? expanded.value = $event : null)
2042
+ }, unref(dropdownProps), {
2043
+ role: unref(DropdownRole).listbox
2044
+ }), createSlots({
2045
+ default: withCtx(({ aria }) => [
2046
+ _ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_4, [
2047
+ renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
2048
+ ])) : createCommentVNode("", true),
2049
+ createElementVNode("div", _hoisted_5, [
2050
+ unref(hasIconBefore) ? (openBlock(), createBlock(_sfc_main$6, mergeProps({
2051
+ key: 0,
2052
+ class: "vv-select__icon"
2053
+ }, unref(hasIcon)), null, 16)) : createCommentVNode("", true),
2054
+ createElementVNode("div", mergeProps({
2055
+ ref_key: "inputEl",
2056
+ ref: inputEl
2057
+ }, aria, {
2058
+ "aria-labelledby": unref(hasLabelId),
2059
+ class: "vv-select__input",
2060
+ role: "combobox",
2061
+ tabindex: unref(hasTabindex),
2062
+ onClickPassive: onClickInput
2063
+ }), [
2064
+ renderSlot(_ctx.$slots, "value", normalizeProps(guardReactiveProps({ selectedOptions: unref(selectedOptions), onInput })), () => [
2065
+ unref(hasValue) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2066
+ !_ctx.badges ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2067
+ createTextVNode(toDisplayString(unref(hasValue)), 1)
2068
+ ], 64)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(selectedOptions), (option, index) => {
2069
+ return openBlock(), createBlock(_sfc_main$1, {
2070
+ key: index,
2071
+ modifiers: _ctx.badgeModifiers,
2072
+ class: "vv-select__badge"
2073
+ }, {
2074
+ default: withCtx(() => [
2075
+ createTextVNode(toDisplayString(unref(getOptionLabel)(option)) + " ", 1),
2076
+ _ctx.unselectable && !unref(readonly) && !unref(disabled) ? (openBlock(), createElementBlock("button", {
2077
+ key: 0,
2078
+ "aria-label": unref(propsDefaults).deselectActionLabel,
2079
+ onClick: withModifiers(($event) => onInput(option), ["stop"])
2080
+ }, [
2081
+ createVNode(_sfc_main$6, { name: "close" })
2082
+ ], 8, _hoisted_7)) : createCommentVNode("", true)
2083
+ ]),
2084
+ _: 2
2085
+ }, 1032, ["modifiers"]);
2086
+ }), 128))
2087
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2088
+ createTextVNode(toDisplayString(_ctx.placeholder), 1)
1248
2089
  ], 64))
1249
2090
  ])
1250
- ])
2091
+ ], 16, _hoisted_6),
2092
+ unref(hasIconAfter) ? (openBlock(), createBlock(_sfc_main$6, mergeProps({
2093
+ key: 1,
2094
+ class: "vv-select__icon vv-select__icon-after"
2095
+ }, unref(hasIcon)), null, 16)) : createCommentVNode("", true)
1251
2096
  ]),
1252
- _: 2
1253
- }, 1032, ["tabindex", "class", "aria-selected", "aria-disabled", "onClickPassive"]))), 128))
1254
- ]),
1255
- _: 2
1256
- }, [
1257
- t(z) ? {
1258
- name: "before",
1259
- fn: ne(() => [
1260
- t(z) ? ke((u(), v("input", {
1261
- key: 0,
1262
- id: t(ie),
1263
- ref_key: "inputSearchEl",
1264
- ref: r,
1265
- "onUpdate:modelValue": S[0] || (S[0] = (f) => _e(a) ? a.value = f : null),
1266
- "aria-autocomplete": "list",
1267
- "aria-controls": t(re),
1268
- "aria-labelledby": t(G),
1269
- "aria-describedby": t(Z),
1270
- autocomplete: "off",
1271
- spellcheck: "false",
1272
- type: "search",
1273
- class: "vv-dropdown__search",
1274
- placeholder: l.searchPlaceholder
1275
- }, null, 8, Mt)), [
1276
- [xe, t(i)],
1277
- [st, t(a)]
1278
- ]) : k("", !0)
2097
+ _ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_8, [
2098
+ renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
2099
+ ])) : createCommentVNode("", true)
2100
+ ]),
2101
+ items: withCtx(() => [
2102
+ unref(filteredOptions).length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(filteredOptions), (option, index) => {
2103
+ return openBlock(), createBlock(_sfc_main$3, mergeProps({
2104
+ disabled: unref(getOptionDisabled)(option),
2105
+ selected: getOptionSelected(option),
2106
+ unselectable: _ctx.unselectable,
2107
+ deselectHintLabel: unref(propsDefaults).deselectHintLabel,
2108
+ selectHintLabel: unref(propsDefaults).selectHintLabel,
2109
+ selectedHintLabel: unref(propsDefaults).selectedHintLabel
2110
+ }, {
2111
+ key: index,
2112
+ class: "vv-dropdown-option",
2113
+ onClickPassive: ($event) => onInput(option)
2114
+ }), {
2115
+ default: withCtx(() => [
2116
+ renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
2117
+ option,
2118
+ selectedOptions: unref(selectedOptions),
2119
+ selected: getOptionSelected(option),
2120
+ disabled: unref(getOptionDisabled)(option)
2121
+ })), () => [
2122
+ createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
2123
+ ])
2124
+ ]),
2125
+ _: 2
2126
+ }, 1040, ["onClickPassive"]);
2127
+ }), 128)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$3, {
2128
+ key: 1,
2129
+ modifiers: "inert"
2130
+ }, {
2131
+ default: withCtx(() => [
2132
+ renderSlot(_ctx.$slots, "no-options", {}, () => [
2133
+ createTextVNode(toDisplayString(unref(propsDefaults).noOptionsLabel), 1)
2134
+ ])
2135
+ ]),
2136
+ _: 3
2137
+ })) : (openBlock(), createBlock(_sfc_main$3, {
2138
+ key: 2,
2139
+ modifiers: "inert"
2140
+ }, {
2141
+ default: withCtx(() => [
2142
+ renderSlot(_ctx.$slots, "no-results", {}, () => [
2143
+ createTextVNode(toDisplayString(unref(propsDefaults).noResultsLabel), 1)
2144
+ ])
2145
+ ]),
2146
+ _: 3
2147
+ }))
1279
2148
  ]),
1280
- key: "0"
1281
- } : void 0
1282
- ]), 1040, ["modelValue"])
1283
- ], 512),
1284
- de(t(g), {
1285
- id: t(Z),
1286
- class: "vv-select__hint"
1287
- }, null, 8, ["id"])
1288
- ], 10, Nt));
2149
+ _: 2
2150
+ }, [
2151
+ unref(searchable) || _ctx.$slots["dropdown::before"] ? {
2152
+ name: "before",
2153
+ fn: withCtx(() => [
2154
+ renderSlot(_ctx.$slots, "dropdown::before"),
2155
+ unref(searchable) ? withDirectives((openBlock(), createElementBlock("input", {
2156
+ key: 0,
2157
+ id: unref(hasSearchId),
2158
+ ref_key: "inputSearchEl",
2159
+ ref: inputSearchEl,
2160
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(searchText) ? searchText.value = $event : null),
2161
+ "aria-autocomplete": "list",
2162
+ "aria-controls": unref(hasDropdownId),
2163
+ "aria-labelledby": unref(hasLabelId),
2164
+ "aria-describedby": unref(hasHintId),
2165
+ autocomplete: "off",
2166
+ spellcheck: "false",
2167
+ type: "search",
2168
+ class: "vv-dropdown__search",
2169
+ placeholder: unref(propsDefaults).searchPlaceholder
2170
+ }, null, 8, _hoisted_3)), [
2171
+ [vShow, unref(expanded)],
2172
+ [vModelText, unref(searchText)]
2173
+ ]) : createCommentVNode("", true)
2174
+ ]),
2175
+ key: "0"
2176
+ } : void 0,
2177
+ _ctx.$slots["dropdown::after"] ? {
2178
+ name: "after",
2179
+ fn: withCtx(() => [
2180
+ renderSlot(_ctx.$slots, "dropdown::after")
2181
+ ]),
2182
+ key: "1"
2183
+ } : void 0
2184
+ ]), 1040, ["modelValue", "role"])
2185
+ ], 512),
2186
+ createVNode(unref(HintSlot), {
2187
+ id: unref(hasHintId),
2188
+ class: "vv-select__hint"
2189
+ }, null, 8, ["id"])
2190
+ ], 10, _hoisted_1)) : (openBlock(), createBlock(_sfc_main$2, mergeProps({ key: 1 }, unref(selectProps), {
2191
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => emit("update:modelValue", $event))
2192
+ }), null, 16));
2193
+ };
1289
2194
  }
1290
2195
  });
1291
2196
  export {
1292
- Qt as default
2197
+ _sfc_main as default
1293
2198
  };