@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,6 +1,8 @@
1
- import { defineComponent as X, unref as i, openBlock as f, createBlock as z, mergeProps as N, createCommentVNode as S, createElementBlock as b, normalizeClass as ie, toDisplayString as E, createElementVNode as k, renderSlot as J, normalizeProps as W, guardReactiveProps as G, withDirectives as ae, isRef as le, Fragment as ue, renderList as de, vModelSelect as ce, createVNode as pe } from "vue";
2
- import { iconExists as D, Icon as ve, addIcon as fe } from "@iconify/vue";
3
- const me = {
1
+ import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, h, watch, useSlots, createElementBlock, normalizeClass, toDisplayString, createElementVNode, renderSlot, normalizeProps, guardReactiveProps, withDirectives, isRef, Fragment, renderList, vModelSelect, createVNode } from "vue";
2
+ import { iconExists, Icon, addIcon } from "@iconify/vue";
3
+ import { toReactive, useFocus, useElementVisibility } from "@vueuse/core";
4
+ import { nanoid } from "nanoid";
5
+ const VvIconProps = {
4
6
  /**
5
7
  * Color
6
8
  */
@@ -24,7 +26,7 @@ const me = {
24
26
  */
25
27
  name: {
26
28
  type: String,
27
- required: !0
29
+ required: true
28
30
  },
29
31
  /**
30
32
  * By default 'vv'
@@ -93,91 +95,241 @@ const me = {
93
95
  modifiers: {
94
96
  type: [String, Array]
95
97
  }
96
- }, ge = {
98
+ };
99
+ var Side = /* @__PURE__ */ ((Side2) => {
100
+ Side2["left"] = "left";
101
+ Side2["right"] = "right";
102
+ Side2["top"] = "top";
103
+ Side2["bottom"] = "bottom";
104
+ return Side2;
105
+ })(Side || {});
106
+ var Placement = /* @__PURE__ */ ((Placement2) => {
107
+ Placement2["topStart"] = "top-start";
108
+ Placement2["topEnd"] = "top-end";
109
+ Placement2["bottomStart"] = "bottom-start";
110
+ Placement2["bottomEnd"] = "bottom-end";
111
+ Placement2["leftStart"] = "left-start";
112
+ Placement2["leftEnd"] = "left-end";
113
+ Placement2["rightStart"] = "right-start";
114
+ Placement2["rightEnd"] = "right-end";
115
+ return Placement2;
116
+ })(Placement || {});
117
+ var Position = /* @__PURE__ */ ((Position2) => {
118
+ Position2["before"] = "before";
119
+ Position2["after"] = "after";
120
+ return Position2;
121
+ })(Position || {});
122
+ var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
123
+ ButtonType2["button"] = "button";
124
+ ButtonType2["submit"] = "submit";
125
+ ButtonType2["reset"] = "reset";
126
+ return ButtonType2;
127
+ })(ButtonType || {});
128
+ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
129
+ AnchorTarget2["_blank"] = "_blank";
130
+ AnchorTarget2["_self"] = "_self";
131
+ AnchorTarget2["_parent"] = "_parent";
132
+ AnchorTarget2["_top"] = "_top";
133
+ return AnchorTarget2;
134
+ })(AnchorTarget || {});
135
+ const INJECTION_KEY_VOLVER = Symbol.for("volver");
136
+ function useVolver() {
137
+ return inject(INJECTION_KEY_VOLVER);
138
+ }
139
+ function useModifiers(prefix, modifiers, others) {
140
+ return computed(() => {
141
+ const toReturn = {
142
+ [prefix]: true
143
+ };
144
+ const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
145
+ if (modifiersArray) {
146
+ if (Array.isArray(modifiersArray)) {
147
+ modifiersArray.forEach((modifier) => {
148
+ if (modifier) {
149
+ toReturn[`${prefix}--${modifier}`] = true;
150
+ }
151
+ });
152
+ }
153
+ }
154
+ if (others) {
155
+ Object.keys(others.value).forEach((key) => {
156
+ toReturn[`${prefix}--${key}`] = unref(others.value[key]);
157
+ });
158
+ }
159
+ return toReturn;
160
+ });
161
+ }
162
+ const __default__$1 = {
97
163
  name: "VvIcon"
98
- }, Q = /* @__PURE__ */ X({
99
- ...ge,
100
- props: me,
101
- setup(e) {
102
- const s = e, r = ref(!0), u = useVolver(), { modifiers: c } = toRefs(s), m = useBemModifiers("vv-icon", c), n = computed(() => s.provider || (u == null ? void 0 : u.provider)), B = computed(() => {
103
- const t = s.name ?? "", o = `@${n.value}:${s.prefix}:${s.name}`;
104
- return D(t) ? t : D(o) ? o : (u == null ? void 0 : u.iconsCollections.find(
105
- (p) => {
106
- const l = `@${n.value}:${p.prefix}:${t}`;
107
- if (D(l))
108
- return l;
109
- }
110
- )) || t;
164
+ };
165
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
166
+ ...__default__$1,
167
+ props: VvIconProps,
168
+ setup(__props) {
169
+ const props = __props;
170
+ const show = ref(true);
171
+ const volver = useVolver();
172
+ const { modifiers } = toRefs(props);
173
+ const bemCssClasses = useModifiers("vv-icon", modifiers);
174
+ const provider = computed(() => {
175
+ return props.provider || (volver == null ? void 0 : volver.iconsProvider);
111
176
  });
112
- function g(t) {
113
- let o = null;
114
- if (typeof window > "u") {
115
- const { JSDOM: y } = require("jsdom");
116
- o = new y().window;
177
+ const icon = computed(() => {
178
+ const _name = props.name ?? "";
179
+ const iconName = `@${provider.value}:${props.prefix}:${props.name}`;
180
+ if (iconExists(_name)) {
181
+ return _name;
182
+ } else if (iconExists(iconName)) {
183
+ return iconName;
184
+ } else {
185
+ return (volver == null ? void 0 : volver.iconsCollections.find(
186
+ (iconsCollection) => {
187
+ const icon2 = `@${provider.value}:${iconsCollection.prefix}:${_name}`;
188
+ if (iconExists(icon2)) {
189
+ return icon2;
190
+ }
191
+ }
192
+ )) || _name;
117
193
  }
118
- return (o ? new o.DOMParser() : new window.DOMParser()).parseFromString(t, "text/html").querySelector("svg");
194
+ });
195
+ function getSvgContent(svg) {
196
+ let dom = null;
197
+ if (typeof window === "undefined") {
198
+ const { JSDOM } = require("jsdom");
199
+ dom = new JSDOM().window;
200
+ }
201
+ const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
202
+ const svgDomString = domParser.parseFromString(svg, "text/html");
203
+ const svgEl = svgDomString.querySelector("svg");
204
+ return svgEl;
119
205
  }
120
- function d(t) {
121
- const o = g(t), p = (o == null ? void 0 : o.innerHTML.trim()) || "";
122
- o && p && fe(`@${n.value}:${s.prefix}:${s.name}`, {
123
- body: p,
124
- // Set height and width from svg content
125
- height: o.viewBox.baseVal.height,
126
- width: o.viewBox.baseVal.width
127
- });
206
+ function addIconFromSvg(svg) {
207
+ const svgContentEl = getSvgContent(svg);
208
+ const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
209
+ if (svgContentEl && svgContent) {
210
+ addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
211
+ body: svgContent,
212
+ // Set height and width from svg content
213
+ height: svgContentEl.viewBox.baseVal.height,
214
+ width: svgContentEl.viewBox.baseVal.width
215
+ });
216
+ }
217
+ }
218
+ if (volver) {
219
+ if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
220
+ show.value = false;
221
+ volver.fetchIcon(props.src).then((svg) => {
222
+ if (svg) {
223
+ addIconFromSvg(svg);
224
+ show.value = true;
225
+ }
226
+ }).catch((e) => {
227
+ throw new Error(`During fetch icon: ${e == null ? void 0 : e.message}`);
228
+ });
229
+ } else if (props.svg) {
230
+ addIconFromSvg(props.svg);
231
+ }
128
232
  }
129
- return u && (s.src && !D(`@${n.value}:${s.prefix}:${s.name}`) ? (r.value = !1, u.fetchIcon(s.src).then((t) => {
130
- t && (d(t), r.value = !0);
131
- }).catch((t) => {
132
- throw new Error(`During fetch icon: ${t == null ? void 0 : t.message}`);
133
- })) : s.svg && d(s.svg)), (t, o) => i(r) ? (f(), z(i(ve), N({
134
- key: 0,
135
- class: i(m)
136
- }, {
137
- inline: t.inline,
138
- width: t.width,
139
- height: t.height,
140
- horizontalFlip: t.horizontalFlip,
141
- verticalFlip: t.verticalFlip,
142
- flip: t.flip,
143
- rotate: t.rotate,
144
- color: t.color,
145
- onLoad: t.onLoad,
146
- icon: i(B)
147
- }), null, 16, ["class"])) : S("", !0);
233
+ return (_ctx, _cache) => {
234
+ return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
235
+ key: 0,
236
+ class: unref(bemCssClasses)
237
+ }, {
238
+ inline: _ctx.inline,
239
+ width: _ctx.width,
240
+ height: _ctx.height,
241
+ horizontalFlip: _ctx.horizontalFlip,
242
+ verticalFlip: _ctx.verticalFlip,
243
+ flip: _ctx.flip,
244
+ rotate: _ctx.rotate,
245
+ color: _ctx.color,
246
+ onLoad: _ctx.onLoad,
247
+ icon: unref(icon)
248
+ }), null, 16, ["class"])) : createCommentVNode("", true);
249
+ };
148
250
  }
149
251
  });
150
- function C(e) {
151
- return Array.isArray(e) ? e.filter((s) => isString(s)).join(" ") : e;
252
+ function resolveFieldData(data, field) {
253
+ if (data && Object.keys(data).length && field) {
254
+ if (field.indexOf(".") === -1) {
255
+ return data[field];
256
+ } else {
257
+ const fields = field.split(".");
258
+ let value = data;
259
+ for (let i = 0, len = fields.length; i < len; ++i) {
260
+ if (data == null) {
261
+ return null;
262
+ }
263
+ value = value[fields[i]];
264
+ }
265
+ return value;
266
+ }
267
+ } else {
268
+ return null;
269
+ }
270
+ }
271
+ function isEmpty(value) {
272
+ 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));
273
+ }
274
+ function isString(value) {
275
+ return typeof value === "string" || value instanceof String;
276
+ }
277
+ function joinLines(errors) {
278
+ if (Array.isArray(errors)) {
279
+ return errors.filter((e) => isString(e)).join(" ");
280
+ }
281
+ return errors;
152
282
  }
153
- function ye(e, s) {
283
+ function HintSlotFactory(parentProps, parentSlots) {
284
+ const {
285
+ invalid: invalidSlot,
286
+ valid: validSlot,
287
+ hint: hintSlot,
288
+ loading: loadingSlot
289
+ } = parentSlots;
154
290
  const {
155
- invalid: r,
156
- valid: u,
157
- hint: c,
158
- loading: m
159
- } = s, {
160
- hintLabel: n,
161
- modelValue: B,
162
- valid: g,
163
- validLabel: d,
164
- invalid: t,
165
- invalidLabel: o,
166
- ...p
167
- } = toRefs(e), l = resolveFieldData(p, "loading"), v = resolveFieldData(p, "loadingLabel"), y = computed(() => t.value ? !!(t.value && r || o != null && o.value && Array.isArray(o.value) && o.value.length > 0 || o != null && o.value && !isEmpty(o)) : !1), $ = computed(
168
- () => !!(n && n.value || c)
169
- ), V = computed(
170
- () => !!(d && d.value || u)
171
- ), F = computed(
172
- () => !!(l != null && l.value && m || l != null && l.value && (v != null && v.value))
173
- ), P = computed(
174
- () => $.value || V.value || y.value || F.value
291
+ hintLabel,
292
+ modelValue,
293
+ valid,
294
+ validLabel,
295
+ invalid,
296
+ invalidLabel,
297
+ ...otherProps
298
+ } = toRefs(parentProps);
299
+ const loading = resolveFieldData(otherProps, "loading");
300
+ const loadingLabel = resolveFieldData(otherProps, "loadingLabel");
301
+ const hasInvalid = computed(() => {
302
+ if (!invalid.value) {
303
+ return false;
304
+ }
305
+ if (invalid.value && invalidSlot) {
306
+ return true;
307
+ }
308
+ if ((invalidLabel == null ? void 0 : invalidLabel.value) && Array.isArray(invalidLabel.value) && invalidLabel.value.length > 0) {
309
+ return true;
310
+ }
311
+ if ((invalidLabel == null ? void 0 : invalidLabel.value) && !isEmpty(invalidLabel)) {
312
+ return true;
313
+ }
314
+ return false;
315
+ });
316
+ const hasHint = computed(
317
+ () => !!(hintLabel && hintLabel.value || hintSlot)
318
+ );
319
+ const hasValid = computed(
320
+ () => !!(validLabel && validLabel.value || validSlot)
321
+ );
322
+ const hasLoading = computed(
323
+ () => !!((loading == null ? void 0 : loading.value) && loadingSlot || (loading == null ? void 0 : loading.value) && (loadingLabel == null ? void 0 : loadingLabel.value))
324
+ );
325
+ const isVisible = computed(
326
+ () => hasHint.value || hasValid.value || hasInvalid.value || hasLoading.value
175
327
  );
176
328
  return {
177
- hasInvalid: y,
178
- hasHint: $,
179
- hasValid: V,
180
- hasLoading: F,
329
+ hasInvalid,
330
+ hasHint,
331
+ hasValid,
332
+ hasLoading,
181
333
  HintSlot: {
182
334
  name: "HintSlot",
183
335
  props: {
@@ -186,30 +338,37 @@ function ye(e, s) {
186
338
  default: () => ({})
187
339
  }
188
340
  },
189
- setup(w) {
190
- const O = computed(() => {
191
- const _ = toReactive({
192
- hintLabel: n,
193
- modelValue: B,
194
- valid: g,
195
- validLabel: d,
196
- invalid: t,
197
- invalidLabel: o,
198
- loading: l,
199
- loadingLabel: v,
200
- ...w.params
341
+ setup(props) {
342
+ const hintContent = computed(() => {
343
+ const slotProps = toReactive({
344
+ hintLabel,
345
+ modelValue,
346
+ valid,
347
+ validLabel,
348
+ invalid,
349
+ invalidLabel,
350
+ loading,
351
+ loadingLabel,
352
+ ...props.params
201
353
  });
202
- return t != null && t.value ? (r == null ? void 0 : r(_)) || C(o == null ? void 0 : o.value) || (n == null ? void 0 : n.value) : g != null && g.value ? (u == null ? void 0 : u(_)) || C(d == null ? void 0 : d.value) || (n == null ? void 0 : n.value) : l != null && l.value ? (m == null ? void 0 : m(_)) || C(v == null ? void 0 : v.value) || (n == null ? void 0 : n.value) : (c == null ? void 0 : c(_)) || C(n == null ? void 0 : n.value) || (n == null ? void 0 : n.value);
354
+ if (invalid == null ? void 0 : invalid.value) {
355
+ return (invalidSlot == null ? void 0 : invalidSlot(slotProps)) || joinLines(invalidLabel == null ? void 0 : invalidLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
356
+ }
357
+ if (valid == null ? void 0 : valid.value)
358
+ return (validSlot == null ? void 0 : validSlot(slotProps)) || joinLines(validLabel == null ? void 0 : validLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
359
+ if (loading == null ? void 0 : loading.value)
360
+ return (loadingSlot == null ? void 0 : loadingSlot(slotProps)) || joinLines(loadingLabel == null ? void 0 : loadingLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
361
+ return (hintSlot == null ? void 0 : hintSlot(slotProps)) || joinLines(hintLabel == null ? void 0 : hintLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
203
362
  });
204
363
  return {
205
- isVisible: P,
206
- hasInvalid: y,
207
- hasValid: V,
208
- hintContent: O
364
+ isVisible,
365
+ hasInvalid,
366
+ hasValid,
367
+ hintContent
209
368
  };
210
369
  },
211
370
  render() {
212
- if (this.isVisible)
371
+ if (this.isVisible) {
213
372
  return h(
214
373
  "small",
215
374
  {
@@ -217,38 +376,111 @@ function ye(e, s) {
217
376
  },
218
377
  this.hintContent
219
378
  );
379
+ }
220
380
  }
221
381
  }
222
382
  };
223
383
  }
224
- var M = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(M || {}), Y = /* @__PURE__ */ ((e) => (e.topStart = "top-start", e.topEnd = "top-end", e.bottomStart = "bottom-start", e.bottomEnd = "bottom-end", e.leftStart = "left-start", e.leftEnd = "left-end", e.rightStart = "right-start", e.rightEnd = "right-end", e))(Y || {}), q = /* @__PURE__ */ ((e) => (e.before = "before", e.after = "after", e))(q || {});
225
- const he = {
384
+ const LinkProps = {
385
+ /**
386
+ * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
387
+ * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
388
+ */
389
+ to: {
390
+ type: [String, Object]
391
+ },
392
+ /**
393
+ * Anchor href
394
+ */
395
+ href: String,
396
+ /**
397
+ * Anchor target
398
+ */
399
+ target: {
400
+ type: String,
401
+ validator: (value) => Object.values(AnchorTarget).includes(value)
402
+ },
403
+ /**
404
+ * Anchor rel
405
+ */
406
+ rel: {
407
+ type: String,
408
+ default: "noopener noreferrer"
409
+ }
410
+ };
411
+ const ValidProps = {
412
+ /**
413
+ * Valid status
414
+ */
226
415
  valid: Boolean,
416
+ /**
417
+ * Valid label
418
+ */
227
419
  validLabel: [String, Array]
228
- }, be = {
420
+ };
421
+ const InvalidProps = {
422
+ /**
423
+ * Invalid status
424
+ */
229
425
  invalid: Boolean,
426
+ /**
427
+ * Invalid label
428
+ */
230
429
  invalidLabel: [String, Array]
231
- }, Se = {
430
+ };
431
+ const LoadingProps = {
432
+ /**
433
+ * Loading status
434
+ */
232
435
  loading: Boolean,
233
- loadingLabel: String
234
- }, Be = {
436
+ /**
437
+ * Loading label
438
+ */
439
+ loadingLabel: {
440
+ type: String,
441
+ default: "Loading..."
442
+ }
443
+ };
444
+ const DisabledProps = {
235
445
  /**
236
446
  * Whether the form control is disabled
237
447
  */
238
448
  disabled: Boolean
239
- }, _e = {
449
+ };
450
+ const ActiveProps = {
451
+ /**
452
+ * Whether the item is active
453
+ */
454
+ active: Boolean
455
+ };
456
+ const PressedProps = {
457
+ /**
458
+ * Whether the item is pressed
459
+ */
460
+ pressed: Boolean
461
+ };
462
+ const LabelProps = {
463
+ /**
464
+ * The item label
465
+ */
466
+ label: [String, Number]
467
+ };
468
+ const ReadonlyProps = {
240
469
  /**
241
470
  * The value is not editable
242
471
  */
243
472
  readonly: Boolean
244
- }, Ve = {
473
+ };
474
+ const ModifiersProps = {
245
475
  /**
246
476
  * Component BEM modifiers
247
477
  */
248
478
  modifiers: [String, Array]
249
- }, Pe = {
479
+ };
480
+ const HintProps = {
250
481
  hintLabel: { type: String, default: "" }
251
- }, we = {
482
+ };
483
+ const OptionsProps = {
252
484
  /**
253
485
  * List of options, can be string[] or object[]
254
486
  */
@@ -268,7 +500,8 @@ const he = {
268
500
  * Used when options are objects: key to use for option disabled
269
501
  */
270
502
  disabledKey: { type: [String, Function], default: "disabled" }
271
- }, Ie = {
503
+ };
504
+ const IconProps = {
272
505
  /**
273
506
  * VvIcon name or props
274
507
  * @see VVIcon
@@ -279,69 +512,177 @@ const he = {
279
512
  */
280
513
  iconPosition: {
281
514
  type: String,
282
- default: q.before,
283
- validation: (e) => Object.values(q).includes(e)
515
+ default: Position.before,
516
+ validation: (value) => Object.values(Position).includes(value)
284
517
  }
285
- }, $e = {
518
+ };
519
+ const TabindexProps = {
286
520
  /**
287
521
  * Global attribute tabindex
288
522
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
289
523
  */
290
524
  tabindex: { type: [String, Number], default: 0 }
291
- }, Fe = {
525
+ };
526
+ const FloatingLabelProps = {
292
527
  /**
293
528
  * If true the label will be floating
294
529
  */
295
530
  floating: Boolean
296
- }, Oe = {
531
+ };
532
+ const UnselectableProps = {
297
533
  /**
298
534
  * If true the input will be unselectable
299
535
  */
300
- unselectable: { type: Boolean, default: !0 }
301
- }, Ae = {
536
+ unselectable: { type: Boolean, default: true }
537
+ };
538
+ const IdProps = {
302
539
  /**
303
540
  * Global attribute id
304
541
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
305
542
  */
306
543
  id: [String, Number]
307
544
  };
308
- M.bottom;
309
- const De = {
310
- ...Ae,
545
+ ({
546
+ /**
547
+ * Dropdown placement
548
+ */
549
+ placement: {
550
+ type: String,
551
+ default: Side.bottom,
552
+ validator: (value) => {
553
+ return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
554
+ }
555
+ },
556
+ /**
557
+ * Dropdown show / hide transition name
558
+ */
559
+ transitionName: {
560
+ type: String
561
+ },
562
+ /**
563
+ * Offset of the dropdown from the trigger
564
+ * @see https://floating-ui.com/docs/offset
565
+ */
566
+ offset: {
567
+ type: [Number, String, Object],
568
+ default: 0
569
+ },
570
+ /**
571
+ * Move dropdown to the side if there is no space in the default position
572
+ * @see https://floating-ui.com/docs/shift
573
+ */
574
+ shift: {
575
+ type: [Boolean, Object],
576
+ default: false
577
+ },
578
+ /**
579
+ * Flip dropdown position if there is no space in the default position
580
+ * @see https://floating-ui.com/docs/flip
581
+ */
582
+ flip: {
583
+ type: [Boolean, Object],
584
+ default: true
585
+ },
586
+ /**
587
+ * Size of the dropdown
588
+ * @see https://floating-ui.com/docs/size
589
+ */
590
+ size: {
591
+ type: [Boolean, Object],
592
+ default: () => ({ padding: 10 })
593
+ },
594
+ /**
595
+ * Automatically change the position of the dropdown
596
+ * @see https://floating-ui.com/docs/autoPlacement
597
+ */
598
+ autoPlacement: {
599
+ type: [Boolean, Object],
600
+ default: false
601
+ },
602
+ /**
603
+ * Add arrow to the dropdown
604
+ * @see https://floating-ui.com/docs/arrow
605
+ */
606
+ arrow: {
607
+ type: Boolean,
608
+ default: false
609
+ },
610
+ /**
611
+ * Close dropdown on click outside
612
+ */
613
+ autoClose: {
614
+ type: Boolean,
615
+ default: true
616
+ },
617
+ /**
618
+ * Autofocus first item on dropdown open
619
+ */
620
+ autofocusFirst: {
621
+ type: Boolean,
622
+ default: true
623
+ },
624
+ /**
625
+ * Set dropdown width to the same as the trigger
626
+ */
627
+ triggerWidth: {
628
+ type: Boolean
629
+ }
630
+ });
631
+ const IdNameProps = {
632
+ ...IdProps,
311
633
  /**
312
634
  * Input / Textarea name
313
635
  * Name of the form control. Submitted with the form as part of a name/value pair
314
636
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
315
637
  */
316
- name: { type: String, required: !0 }
317
- }, Ce = {
638
+ name: { type: String, required: true }
639
+ };
640
+ const AutofocusProps = {
318
641
  /**
319
642
  * Global attribute autofocus
320
643
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
321
644
  */
322
645
  autofocus: Boolean
323
- }, Ne = {
646
+ };
647
+ const AutocompleteProps = {
324
648
  /**
325
649
  * Global attribute autocomplete
326
650
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
327
651
  */
328
652
  autocomplete: { type: String, default: "off" }
329
- }, je = {
330
- ...De,
331
- ...Ce,
332
- ...Ne,
333
- ...$e,
334
- ...he,
335
- ...be,
336
- ...Pe,
337
- ...Se,
338
- ...Be,
339
- ..._e,
340
- ...Ve,
341
- ...we,
342
- ...Ie,
343
- ...Fe,
344
- ...Oe,
653
+ };
654
+ ({
655
+ ...DisabledProps,
656
+ ...LabelProps,
657
+ ...PressedProps,
658
+ ...ActiveProps,
659
+ ...LinkProps,
660
+ /**
661
+ * Button type
662
+ */
663
+ type: {
664
+ type: String,
665
+ default: ButtonType.button,
666
+ validator: (value) => Object.values(ButtonType).includes(value)
667
+ }
668
+ });
669
+ const VvSelectProps = {
670
+ ...IdNameProps,
671
+ ...AutofocusProps,
672
+ ...AutocompleteProps,
673
+ ...TabindexProps,
674
+ ...ValidProps,
675
+ ...InvalidProps,
676
+ ...HintProps,
677
+ ...LoadingProps,
678
+ ...DisabledProps,
679
+ ...ReadonlyProps,
680
+ ...ModifiersProps,
681
+ ...OptionsProps,
682
+ ...IconProps,
683
+ ...FloatingLabelProps,
684
+ ...UnselectableProps,
685
+ ...LabelProps,
345
686
  /**
346
687
  * This Boolean attribute indicates that multiple options can be selected in the list.
347
688
  * If it is not specified, then only one option can be selected at a time.
@@ -368,140 +709,251 @@ const De = {
368
709
  type: [String, Number, Boolean, Object, Array],
369
710
  default: void 0
370
711
  },
371
- /**
372
- * <label> value for the select
373
- */
374
- label: String,
375
712
  /**
376
713
  * Select placeholder
377
714
  */
378
715
  placeholder: String
379
- }, Ee = ["update:modelValue", "focus", "blur"], ke = ["for"], ze = { class: "vv-select__wrapper" }, Me = {
716
+ };
717
+ const VvSelectEmits = ["update:modelValue", "focus", "blur"];
718
+ const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
719
+ function useComponentFocus(inputTemplateRef, emit) {
720
+ const { focused } = useFocus(inputTemplateRef);
721
+ watch(focused, (newValue) => {
722
+ emit(newValue ? "focus" : "blur", unref(inputTemplateRef));
723
+ });
724
+ return {
725
+ focused
726
+ };
727
+ }
728
+ function useComponentIcon(icon, iconPosition) {
729
+ const hasIconBefore = computed(
730
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Position.before)
731
+ );
732
+ const hasIconAfter = computed(
733
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Position.after)
734
+ );
735
+ const hasIconLeft = computed(
736
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.left)
737
+ );
738
+ const hasIconRight = computed(
739
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.right)
740
+ );
741
+ const hasIconTop = computed(
742
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.top)
743
+ );
744
+ const hasIconBottom = computed(
745
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.bottom)
746
+ );
747
+ const hasIcon = computed(() => {
748
+ if (typeof (icon == null ? void 0 : icon.value) === "string") {
749
+ return { name: icon == null ? void 0 : icon.value };
750
+ }
751
+ return icon == null ? void 0 : icon.value;
752
+ });
753
+ return {
754
+ hasIcon,
755
+ hasIconLeft,
756
+ hasIconRight,
757
+ hasIconTop,
758
+ hasIconBottom,
759
+ hasIconBefore,
760
+ hasIconAfter
761
+ };
762
+ }
763
+ function useOptions(props) {
764
+ const { options, labelKey, valueKey, disabledKey } = toRefs(props);
765
+ const getOptionLabel = (option) => {
766
+ if (typeof option !== "object" && option !== null)
767
+ return option;
768
+ return typeof labelKey.value === "function" ? labelKey.value(option) : option[labelKey.value];
769
+ };
770
+ const getOptionValue = (option) => {
771
+ if (typeof option !== "object" && option !== null)
772
+ return option;
773
+ return typeof valueKey.value === "function" ? valueKey.value(option) : option[valueKey.value];
774
+ };
775
+ const getOptionDisabled = (option) => {
776
+ if (typeof option !== "object" && option !== null)
777
+ return false;
778
+ return typeof disabledKey.value === "function" ? disabledKey.value(option) : option[disabledKey.value];
779
+ };
780
+ return {
781
+ options,
782
+ getOptionLabel,
783
+ getOptionValue,
784
+ getOptionDisabled
785
+ };
786
+ }
787
+ const _hoisted_1 = ["for"];
788
+ const _hoisted_2 = { class: "vv-select__wrapper" };
789
+ const _hoisted_3 = {
380
790
  key: 0,
381
791
  class: "vv-select__input-before"
382
- }, qe = { class: "vv-select__inner" }, He = ["id"], Re = ["disabled", "hidden"], Ke = ["disabled", "value"], Te = {
792
+ };
793
+ const _hoisted_4 = { class: "vv-select__inner" };
794
+ const _hoisted_5 = ["id"];
795
+ const _hoisted_6 = ["disabled", "hidden"];
796
+ const _hoisted_7 = ["disabled", "value"];
797
+ const _hoisted_8 = {
383
798
  key: 1,
384
799
  class: "vv-select__input-after"
385
- }, Ue = {
800
+ };
801
+ const __default__ = {
386
802
  name: "VvSelect"
387
- }, Ge = /* @__PURE__ */ X({
388
- ...Ue,
389
- props: je,
390
- emits: Ee,
391
- setup(e, { emit: s }) {
392
- const r = e, u = useSlots(), c = ref(), { HintSlot: m, hasHint: n, hasInvalid: B } = ye(r, u), {
393
- id: g,
394
- modifiers: d,
395
- disabled: t,
396
- readonly: o,
397
- loading: p,
398
- icon: l,
399
- iconPosition: v,
400
- invalid: y,
401
- valid: $,
402
- floating: V,
403
- multiple: F
404
- } = toRefs(r), P = useUniqueId(g), w = computed(() => `${P.value}-hint`), { focused: O } = useComponentFocus(c, s), _ = useElementVisibility(c);
405
- watch(_, (a) => {
406
- a && r.autofocus && (O.value = !0);
803
+ };
804
+ const _sfc_main = /* @__PURE__ */ defineComponent({
805
+ ...__default__,
806
+ props: VvSelectProps,
807
+ emits: VvSelectEmits,
808
+ setup(__props, { emit }) {
809
+ const props = __props;
810
+ const slots = useSlots();
811
+ const select = ref();
812
+ const { HintSlot, hasHint, hasInvalid } = HintSlotFactory(props, slots);
813
+ const {
814
+ id,
815
+ modifiers,
816
+ disabled,
817
+ readonly,
818
+ loading,
819
+ icon,
820
+ iconPosition,
821
+ invalid,
822
+ valid,
823
+ floating,
824
+ multiple
825
+ } = toRefs(props);
826
+ const hasId = useUniqueId(id);
827
+ const hasDescribedBy = computed(() => `${hasId.value}-hint`);
828
+ const { focused } = useComponentFocus(select, emit);
829
+ const isVisible = useElementVisibility(select);
830
+ watch(isVisible, (newValue) => {
831
+ if (newValue && props.autofocus) {
832
+ focused.value = true;
833
+ }
834
+ });
835
+ const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
836
+ icon,
837
+ iconPosition
838
+ );
839
+ const isDirty = computed(() => !isEmpty(props.modelValue));
840
+ const isDisabled = computed(() => props.disabled || props.readonly);
841
+ const hasTabindex = computed(() => {
842
+ return isDisabled.value ? -1 : props.tabindex;
843
+ });
844
+ const isInvalid = computed(() => {
845
+ if (props.invalid === true) {
846
+ return true;
847
+ }
848
+ if (props.valid === true) {
849
+ return false;
850
+ }
851
+ return void 0;
407
852
  });
408
- const { hasIcon: H, hasIconBefore: R, hasIconAfter: K } = useComponentIcon(
409
- l,
410
- v
411
- ), Z = computed(() => !isEmpty(r.modelValue)), T = computed(() => r.disabled || r.readonly), x = computed(() => T.value ? -1 : r.tabindex), L = computed(() => {
412
- if (r.invalid === !0)
413
- return !0;
414
- if (r.valid === !0)
415
- return !1;
416
- }), ee = useBemModifiers(
853
+ const bemCssClasses = useModifiers(
417
854
  "vv-select",
418
- d,
855
+ modifiers,
419
856
  computed(() => ({
420
- valid: $.value,
421
- invalid: y.value,
422
- loading: p.value,
423
- disabled: t.value,
424
- readonly: o.value,
425
- "icon-before": R.value,
426
- "icon-after": K.value,
427
- dirty: Z.value,
428
- focus: O.value,
429
- floating: V.value,
430
- multiple: F.value
857
+ valid: valid.value,
858
+ invalid: invalid.value,
859
+ loading: loading.value,
860
+ disabled: disabled.value,
861
+ readonly: readonly.value,
862
+ "icon-before": hasIconBefore.value,
863
+ "icon-after": hasIconAfter.value,
864
+ dirty: isDirty.value,
865
+ focus: focused.value,
866
+ floating: floating.value,
867
+ multiple: multiple.value
431
868
  }))
432
- ), te = computed(() => ({
433
- name: r.name,
434
- tabindex: x.value,
435
- disabled: T.value,
436
- required: r.required,
437
- size: r.size,
438
- autocomplete: r.autocomplete,
439
- multiple: r.multiple,
440
- "aria-invalid": L.value,
441
- "aria-describedby": !B.value && n.value ? w.value : void 0,
442
- "aria-errormessage": B.value ? w.value : void 0
443
- })), U = computed(() => ({
444
- valid: r.valid,
445
- invalid: r.invalid,
446
- modelValue: r.modelValue
447
- })), { getOptionLabel: oe, getOptionValue: re, getOptionDisabled: ne } = useOptions(r), j = computed({
448
- get: () => r.modelValue,
449
- set: (a) => {
450
- Array.isArray(a) && (a = a.filter((A) => A !== void 0)), s("update:modelValue", a);
869
+ );
870
+ const hasAttrs = computed(() => {
871
+ return {
872
+ name: props.name,
873
+ tabindex: hasTabindex.value,
874
+ disabled: isDisabled.value,
875
+ required: props.required,
876
+ size: props.size,
877
+ autocomplete: props.autocomplete,
878
+ multiple: props.multiple,
879
+ "aria-invalid": isInvalid.value,
880
+ "aria-describedby": !hasInvalid.value && hasHint.value ? hasDescribedBy.value : void 0,
881
+ "aria-errormessage": hasInvalid.value ? hasDescribedBy.value : void 0
882
+ };
883
+ });
884
+ const slotProps = computed(() => ({
885
+ valid: props.valid,
886
+ invalid: props.invalid,
887
+ modelValue: props.modelValue
888
+ }));
889
+ const { getOptionLabel, getOptionValue, getOptionDisabled } = useOptions(props);
890
+ const localModelValue = computed({
891
+ get: () => {
892
+ return props.modelValue;
893
+ },
894
+ set: (newValue) => {
895
+ if (Array.isArray(newValue)) {
896
+ newValue = newValue.filter((item) => item !== void 0);
897
+ }
898
+ emit("update:modelValue", newValue);
451
899
  }
452
900
  });
453
- return (a, A) => (f(), b("div", {
454
- class: ie(i(ee))
455
- }, [
456
- a.label ? (f(), b("label", {
457
- key: 0,
458
- for: i(P)
459
- }, E(a.label), 9, ke)) : S("", !0),
460
- k("div", ze, [
461
- a.$slots.before ? (f(), b("div", Me, [
462
- J(a.$slots, "before", W(G(i(U))))
463
- ])) : S("", !0),
464
- k("div", qe, [
465
- i(R) ? (f(), z(Q, N({
466
- key: 0,
467
- class: "vv-select__icon"
468
- }, i(H)), null, 16)) : S("", !0),
469
- ae(k("select", N({
470
- id: i(P),
471
- ref_key: "select",
472
- ref: c,
473
- "onUpdate:modelValue": A[0] || (A[0] = (I) => le(j) ? j.value = I : null)
474
- }, i(te)), [
475
- a.placeholder ? (f(), b("option", {
901
+ return (_ctx, _cache) => {
902
+ return openBlock(), createElementBlock("div", {
903
+ class: normalizeClass(unref(bemCssClasses))
904
+ }, [
905
+ _ctx.label ? (openBlock(), createElementBlock("label", {
906
+ key: 0,
907
+ for: unref(hasId)
908
+ }, toDisplayString(_ctx.label), 9, _hoisted_1)) : createCommentVNode("", true),
909
+ createElementVNode("div", _hoisted_2, [
910
+ _ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_3, [
911
+ renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
912
+ ])) : createCommentVNode("", true),
913
+ createElementVNode("div", _hoisted_4, [
914
+ unref(hasIconBefore) ? (openBlock(), createBlock(_sfc_main$1, mergeProps({
476
915
  key: 0,
477
- value: void 0,
478
- disabled: !a.unselectable,
479
- hidden: !a.unselectable
480
- }, E(a.placeholder), 9, Re)) : S("", !0),
481
- (f(!0), b(ue, null, de(a.options, (I, se) => (f(), b("option", {
482
- key: se,
483
- disabled: i(ne)(I),
484
- value: i(re)(I)
485
- }, E(i(oe)(I)), 9, Ke))), 128))
486
- ], 16, He), [
487
- [ce, i(j)]
916
+ class: "vv-select__icon"
917
+ }, unref(hasIcon)), null, 16)) : createCommentVNode("", true),
918
+ withDirectives(createElementVNode("select", mergeProps({
919
+ id: unref(hasId),
920
+ ref_key: "select",
921
+ ref: select,
922
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
923
+ }, unref(hasAttrs)), [
924
+ _ctx.placeholder ? (openBlock(), createElementBlock("option", {
925
+ key: 0,
926
+ value: void 0,
927
+ disabled: !_ctx.unselectable,
928
+ hidden: !_ctx.unselectable
929
+ }, toDisplayString(_ctx.placeholder), 9, _hoisted_6)) : createCommentVNode("", true),
930
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
931
+ return openBlock(), createElementBlock("option", {
932
+ key: index,
933
+ disabled: unref(getOptionDisabled)(option),
934
+ value: unref(getOptionValue)(option)
935
+ }, toDisplayString(unref(getOptionLabel)(option)), 9, _hoisted_7);
936
+ }), 128))
937
+ ], 16, _hoisted_5), [
938
+ [vModelSelect, unref(localModelValue)]
939
+ ]),
940
+ unref(hasIconAfter) ? (openBlock(), createBlock(_sfc_main$1, mergeProps({
941
+ key: 1,
942
+ class: "vv-select__icon vv-select__icon-after"
943
+ }, unref(hasIcon)), null, 16)) : createCommentVNode("", true)
488
944
  ]),
489
- i(K) ? (f(), z(Q, N({
490
- key: 1,
491
- class: "vv-select__icon vv-select__icon-after"
492
- }, i(H)), null, 16)) : S("", !0)
945
+ _ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_8, [
946
+ renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
947
+ ])) : createCommentVNode("", true)
493
948
  ]),
494
- a.$slots.after ? (f(), b("div", Te, [
495
- J(a.$slots, "after", W(G(i(U))))
496
- ])) : S("", !0)
497
- ]),
498
- pe(i(m), {
499
- id: i(w),
500
- class: "vv-select__hint"
501
- }, null, 8, ["id"])
502
- ], 2));
949
+ createVNode(unref(HintSlot), {
950
+ id: unref(hasDescribedBy),
951
+ class: "vv-select__hint"
952
+ }, null, 8, ["id"])
953
+ ], 2);
954
+ };
503
955
  }
504
956
  });
505
957
  export {
506
- Ge as default
958
+ _sfc_main as default
507
959
  };