@volverjs/ui-vue 0.0.4 → 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 (204) hide show
  1. package/README.md +2 -2
  2. package/auto-imports.d.ts +12 -3
  3. package/bin/icons.cjs +1 -73
  4. package/dist/Volver.d.ts +19 -11
  5. package/dist/components/VvAccordion/VvAccordion.es.js +165 -106
  6. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  7. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
  8. package/dist/components/VvAccordion/index.d.ts +8 -3
  9. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +264 -164
  10. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  11. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
  12. package/dist/components/VvAccordionGroup/index.d.ts +8 -0
  13. package/dist/components/VvAction/VvAction.es.js +266 -98
  14. package/dist/components/VvAction/VvAction.umd.js +1 -1
  15. package/dist/components/VvAction/VvAction.vue.d.ts +12 -12
  16. package/dist/components/VvAction/index.d.ts +2 -2
  17. package/dist/components/VvBadge/VvBadge.es.js +203 -44
  18. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  19. package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
  20. package/dist/components/VvBadge/index.d.ts +1 -1
  21. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +237 -75
  22. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  23. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
  24. package/dist/components/VvBreadcrumb/index.d.ts +1 -1
  25. package/dist/components/VvButton/VvButton.es.js +636 -360
  26. package/dist/components/VvButton/VvButton.umd.js +1 -1
  27. package/dist/components/VvButton/VvButton.vue.d.ts +18 -18
  28. package/dist/components/VvButton/index.d.ts +13 -13
  29. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +251 -79
  30. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  31. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
  32. package/dist/components/VvButtonGroup/index.d.ts +1 -1
  33. package/dist/components/VvCard/VvCard.es.js +57 -38
  34. package/dist/components/VvCard/VvCard.umd.js +1 -1
  35. package/dist/components/VvCheckbox/VvCheckbox.es.js +552 -274
  36. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  37. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
  38. package/dist/components/VvCheckbox/index.d.ts +5 -5
  39. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +651 -340
  40. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  41. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +7 -7
  42. package/dist/components/VvCheckboxGroup/index.d.ts +3 -3
  43. package/dist/components/VvCombobox/VvCombobox.es.js +1532 -983
  44. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  45. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +125 -51
  46. package/dist/components/VvCombobox/index.d.ts +36 -10
  47. package/dist/components/VvDialog/VvDialog.es.js +377 -141
  48. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  49. package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
  50. package/dist/components/VvDialog/index.d.ts +4 -1
  51. package/dist/components/VvDropdown/VvDropdown.es.js +440 -244
  52. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  53. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +113 -41
  54. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +13 -13
  55. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +2 -2
  56. package/dist/components/VvDropdown/index.d.ts +35 -11
  57. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +363 -160
  58. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  59. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +43 -28
  60. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  61. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +275 -90
  62. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
  63. package/dist/components/VvIcon/VvIcon.es.js +113 -65
  64. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  65. package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
  66. package/dist/components/VvIcon/index.d.ts +2 -2
  67. package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
  68. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  69. package/dist/components/VvInputText/VvInputText.es.js +974 -460
  70. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  71. package/dist/components/VvInputText/VvInputText.vue.d.ts +96 -16
  72. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  73. package/dist/components/VvInputText/index.d.ts +64 -11
  74. package/dist/components/VvProgress/VvProgress.es.js +206 -45
  75. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  76. package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
  77. package/dist/components/VvProgress/index.d.ts +1 -1
  78. package/dist/components/VvRadio/VvRadio.es.js +489 -238
  79. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  80. package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
  81. package/dist/components/VvRadio/index.d.ts +5 -5
  82. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +588 -304
  83. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  84. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +7 -7
  85. package/dist/components/VvRadioGroup/index.d.ts +3 -3
  86. package/dist/components/VvSelect/VvSelect.es.js +621 -324
  87. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  88. package/dist/components/VvSelect/VvSelect.vue.d.ts +13 -13
  89. package/dist/components/VvSelect/index.d.ts +3 -3
  90. package/dist/components/VvTextarea/VvTextarea.es.js +664 -353
  91. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  92. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +10 -10
  93. package/dist/components/VvTextarea/index.d.ts +2 -2
  94. package/dist/components/VvTooltip/VvTooltip.es.js +205 -47
  95. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  96. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
  97. package/dist/components/VvTooltip/index.d.ts +2 -2
  98. package/dist/components/index.es.js +3508 -2231
  99. package/dist/components/index.umd.js +1 -1
  100. package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
  101. package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
  102. package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
  103. package/dist/composables/group/useProvideGroupState.d.ts +1 -1
  104. package/dist/composables/useComponentFocus.d.ts +1 -1
  105. package/dist/composables/useComponentIcon.d.ts +7 -7
  106. package/dist/composables/useDebouncedInput.d.ts +4 -1
  107. package/dist/composables/useDefaults.d.ts +2 -0
  108. package/dist/composables/useModifiers.d.ts +1 -1
  109. package/dist/composables/useOptions.d.ts +2 -2
  110. package/dist/composables/useTextCount.d.ts +3 -3
  111. package/dist/composables/useUniqueId.d.ts +1 -1
  112. package/dist/composables/useVolver.d.ts +1 -1
  113. package/dist/directives/index.es.js +215 -55
  114. package/dist/directives/index.umd.js +1 -1
  115. package/dist/directives/v-tooltip.es.js +212 -53
  116. package/dist/directives/v-tooltip.umd.js +1 -1
  117. package/dist/icons.es.js +38 -23
  118. package/dist/icons.umd.js +1 -1
  119. package/dist/index.d.ts +0 -1
  120. package/dist/index.es.js +112 -3607
  121. package/dist/index.umd.js +1 -1
  122. package/dist/props/index.d.ts +40 -16
  123. package/dist/resolvers/unplugin.d.ts +7 -1
  124. package/dist/resolvers/unplugin.es.js +77 -37
  125. package/dist/resolvers/unplugin.umd.js +1 -1
  126. package/dist/stories/InputText/InputText.settings.d.ts +53 -0
  127. package/dist/stories/argTypes.d.ts +1 -1
  128. package/package.json +114 -36
  129. package/src/Volver.ts +49 -22
  130. package/src/assets/icons/detailed.json +1 -1
  131. package/src/assets/icons/normal.json +1 -1
  132. package/src/assets/icons/simple.json +1 -1
  133. package/src/components/VvAccordion/VvAccordion.vue +19 -22
  134. package/src/components/VvAccordion/index.ts +12 -4
  135. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
  136. package/src/components/VvAccordionGroup/index.ts +8 -0
  137. package/src/components/VvAction/VvAction.vue +7 -7
  138. package/src/components/VvAction/index.ts +1 -1
  139. package/src/components/VvBadge/VvBadge.vue +2 -2
  140. package/src/components/VvBadge/index.ts +1 -1
  141. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
  142. package/src/components/VvButton/VvButton.vue +11 -11
  143. package/src/components/VvButton/index.ts +10 -9
  144. package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
  145. package/src/components/VvButtonGroup/index.ts +1 -1
  146. package/src/components/VvCard/VvCard.vue +2 -2
  147. package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
  148. package/src/components/VvCheckbox/index.ts +11 -7
  149. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
  150. package/src/components/VvCheckboxGroup/index.ts +1 -1
  151. package/src/components/VvCombobox/VvCombobox.vue +39 -23
  152. package/src/components/VvCombobox/index.ts +1 -1
  153. package/src/components/VvDialog/VvDialog.vue +28 -11
  154. package/src/components/VvDialog/index.ts +5 -2
  155. package/src/components/VvDropdown/VvDropdown.vue +6 -5
  156. package/src/components/VvDropdown/VvDropdownAction.vue +7 -5
  157. package/src/components/VvDropdown/VvDropdownOption.vue +17 -10
  158. package/src/components/VvDropdown/index.ts +3 -3
  159. package/src/components/VvIcon/VvIcon.vue +3 -3
  160. package/src/components/VvIcon/index.ts +3 -3
  161. package/src/components/VvInputText/VvInputClearAction.ts +2 -2
  162. package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
  163. package/src/components/VvInputText/VvInputStepAction.ts +3 -2
  164. package/src/components/VvInputText/VvInputText.vue +128 -35
  165. package/src/components/VvInputText/VvInputTextActions.ts +5 -8
  166. package/src/components/VvInputText/index.ts +62 -1
  167. package/src/components/VvProgress/VvProgress.vue +2 -2
  168. package/src/components/VvProgress/index.ts +1 -1
  169. package/src/components/VvRadio/VvRadio.vue +3 -7
  170. package/src/components/VvRadio/index.ts +11 -7
  171. package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
  172. package/src/components/VvRadioGroup/index.ts +1 -1
  173. package/src/components/VvSelect/VvSelect.vue +4 -4
  174. package/src/components/VvSelect/index.ts +1 -1
  175. package/src/components/VvTextarea/VvTextarea.vue +4 -4
  176. package/src/components/VvTextarea/index.ts +1 -1
  177. package/src/components/VvTooltip/VvTooltip.vue +2 -2
  178. package/src/components/VvTooltip/index.ts +3 -3
  179. package/src/composables/dropdown/useInjectDropdown.ts +2 -2
  180. package/src/composables/dropdown/useProvideDropdown.ts +2 -2
  181. package/src/composables/group/useInjectedGroupState.ts +1 -1
  182. package/src/composables/group/useProvideGroupState.ts +1 -1
  183. package/src/composables/useComponentIcon.ts +1 -1
  184. package/src/composables/useDebouncedInput.ts +10 -3
  185. package/src/composables/useDefaults.ts +89 -0
  186. package/src/composables/useModifiers.ts +4 -2
  187. package/src/composables/useOptions.ts +1 -1
  188. package/src/composables/useVolver.ts +2 -2
  189. package/src/directives/index.ts +1 -1
  190. package/src/directives/v-tooltip.ts +2 -2
  191. package/src/index.ts +0 -2
  192. package/src/props/index.ts +8 -8
  193. package/src/resolvers/unplugin.ts +15 -1
  194. package/src/stories/Accordion/Accordion.stories.mdx +8 -2
  195. package/src/stories/Accordion/Accordion.test.ts +21 -15
  196. package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
  197. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
  198. package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
  199. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +1 -1
  200. package/src/stories/InputText/InputText.settings.ts +53 -0
  201. package/src/stories/InputText/InputText.stories.mdx +40 -0
  202. package/src/stories/InputText/InputText.test.ts +5 -2
  203. package/src/stories/argTypes.ts +2 -2
  204. package/src/types/group.d.ts +5 -0
@@ -1,8 +1,8 @@
1
- import { inject as ye, computed as u, unref as c, defineComponent as T, ref as x, toRefs as C, openBlock as b, createBlock as M, mergeProps as N, createCommentVNode as B, h as be, watch as ee, useSlots as me, createElementBlock as S, normalizeClass as he, toDisplayString as q, createElementVNode as H, renderSlot as Y, normalizeProps as G, guardReactiveProps as Q, withDirectives as Se, isRef as Be, Fragment as _e, renderList as Oe, vModelSelect as Ie, createVNode as Ve } from "vue";
2
- import { iconExists as D, Icon as je, addIcon as $e } from "@iconify/vue";
3
- import { toReactive as Pe, useFocus as we, useElementVisibility as Ae } from "@vueuse/core";
4
- import { nanoid as Fe } from "nanoid";
5
- const ke = {
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 = {
6
6
  /**
7
7
  * Color
8
8
  */
@@ -26,7 +26,7 @@ const ke = {
26
26
  */
27
27
  name: {
28
28
  type: String,
29
- required: !0
29
+ required: true
30
30
  },
31
31
  /**
32
32
  * By default 'vv'
@@ -96,131 +96,240 @@ const ke = {
96
96
  type: [String, Array]
97
97
  }
98
98
  };
99
- var _ = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(_ || {}), te = /* @__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))(te || {}), P = /* @__PURE__ */ ((e) => (e.before = "before", e.after = "after", e))(P || {}), K = /* @__PURE__ */ ((e) => (e.button = "button", e.submit = "submit", e.reset = "reset", e))(K || {}), re = /* @__PURE__ */ ((e) => (e._blank = "_blank", e._self = "_self", e._parent = "_parent", e._top = "_top", e))(re || {});
100
- const De = Symbol.for("volver");
101
- function Ee() {
102
- return ye(De);
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);
103
138
  }
104
- function oe(e, t, r) {
105
- return u(() => {
106
- const n = {
107
- [e]: !0
108
- }, i = typeof (t == null ? void 0 : t.value) == "string" ? t.value.split(" ") : t == null ? void 0 : t.value;
109
- return i && Array.isArray(i) && i.forEach((d) => {
110
- n[`${e}--${d}`] = !0;
111
- }), r && Object.keys(r.value).forEach((d) => {
112
- n[`${e}--${d}`] = c(r.value[d]);
113
- }), n;
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;
114
160
  });
115
161
  }
116
- const Ne = {
162
+ const __default__$1 = {
117
163
  name: "VvIcon"
118
- }, X = /* @__PURE__ */ T({
119
- ...Ne,
120
- props: ke,
121
- setup(e) {
122
- const t = e, r = x(!0), n = Ee(), { modifiers: i } = C(t), d = oe("vv-icon", i), a = u(() => t.provider || (n == null ? void 0 : n.provider)), m = u(() => {
123
- const o = t.name ?? "", l = `@${a.value}:${t.prefix}:${t.name}`;
124
- return D(o) ? o : D(l) ? l : (n == null ? void 0 : n.iconsCollections.find(
125
- (g) => {
126
- const v = `@${a.value}:${g.prefix}:${o}`;
127
- if (D(v))
128
- return v;
129
- }
130
- )) || o;
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);
131
176
  });
132
- function s(o) {
133
- let l = null;
134
- if (typeof window > "u") {
135
- const { JSDOM: h } = require("jsdom");
136
- l = new h().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;
137
193
  }
138
- return (l ? new l.DOMParser() : new window.DOMParser()).parseFromString(o, "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;
139
205
  }
140
- function p(o) {
141
- const l = s(o), g = (l == null ? void 0 : l.innerHTML.trim()) || "";
142
- l && g && $e(`@${a.value}:${t.prefix}:${t.name}`, {
143
- body: g,
144
- // Set height and width from svg content
145
- height: l.viewBox.baseVal.height,
146
- width: l.viewBox.baseVal.width
147
- });
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
+ }
148
232
  }
149
- return n && (t.src && !D(`@${a.value}:${t.prefix}:${t.name}`) ? (r.value = !1, n.fetchIcon(t.src).then((o) => {
150
- o && (p(o), r.value = !0);
151
- }).catch((o) => {
152
- throw new Error(`During fetch icon: ${o == null ? void 0 : o.message}`);
153
- })) : t.svg && p(t.svg)), (o, l) => c(r) ? (b(), M(c(je), N({
154
- key: 0,
155
- class: c(d)
156
- }, {
157
- inline: o.inline,
158
- width: o.width,
159
- height: o.height,
160
- horizontalFlip: o.horizontalFlip,
161
- verticalFlip: o.verticalFlip,
162
- flip: o.flip,
163
- rotate: o.rotate,
164
- color: o.color,
165
- onLoad: o.onLoad,
166
- icon: c(m)
167
- }), null, 16, ["class"])) : B("", !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
+ };
168
250
  }
169
251
  });
170
- function Z(e, t) {
171
- if (e && Object.keys(e).length && t) {
172
- if (t.indexOf(".") === -1)
173
- return e[t];
174
- {
175
- const r = t.split(".");
176
- let n = e;
177
- for (let i = 0, d = r.length; i < d; ++i) {
178
- if (e == null)
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) {
179
261
  return null;
180
- n = n[r[i]];
262
+ }
263
+ value = value[fields[i]];
181
264
  }
182
- return n;
265
+ return value;
183
266
  }
184
- } else
267
+ } else {
185
268
  return null;
269
+ }
186
270
  }
187
- function ne(e) {
188
- return ((t) => t == null || t === "" || Array.isArray(t) && t.length === 0 || !(t instanceof Date) && typeof t == "object" && Object.keys(t).length === 0)(c(e));
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));
189
273
  }
190
- function Ce(e) {
191
- return typeof e == "string" || e instanceof String;
274
+ function isString(value) {
275
+ return typeof value === "string" || value instanceof String;
192
276
  }
193
- function E(e) {
194
- return Array.isArray(e) ? e.filter((t) => Ce(t)).join(" ") : e;
277
+ function joinLines(errors) {
278
+ if (Array.isArray(errors)) {
279
+ return errors.filter((e) => isString(e)).join(" ");
280
+ }
281
+ return errors;
195
282
  }
196
- function ze(e, t) {
283
+ function HintSlotFactory(parentProps, parentSlots) {
284
+ const {
285
+ invalid: invalidSlot,
286
+ valid: validSlot,
287
+ hint: hintSlot,
288
+ loading: loadingSlot
289
+ } = parentSlots;
197
290
  const {
198
- invalid: r,
199
- valid: n,
200
- hint: i,
201
- loading: d
202
- } = t, {
203
- hintLabel: a,
204
- modelValue: m,
205
- valid: s,
206
- validLabel: p,
207
- invalid: o,
208
- invalidLabel: l,
209
- ...g
210
- } = C(e), v = Z(g, "loading"), y = Z(g, "loadingLabel"), h = u(() => o.value ? !!(o.value && r || l != null && l.value && Array.isArray(l.value) && l.value.length > 0 || l != null && l.value && !ne(l)) : !1), w = u(
211
- () => !!(a && a.value || i)
212
- ), I = u(
213
- () => !!(p && p.value || n)
214
- ), A = u(
215
- () => !!(v != null && v.value && d || v != null && v.value && (y != null && y.value))
216
- ), V = u(
217
- () => w.value || I.value || h.value || A.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
218
327
  );
219
328
  return {
220
- hasInvalid: h,
221
- hasHint: w,
222
- hasValid: I,
223
- hasLoading: A,
329
+ hasInvalid,
330
+ hasHint,
331
+ hasValid,
332
+ hasLoading,
224
333
  HintSlot: {
225
334
  name: "HintSlot",
226
335
  props: {
@@ -229,42 +338,50 @@ function ze(e, t) {
229
338
  default: () => ({})
230
339
  }
231
340
  },
232
- setup(j) {
233
- const F = u(() => {
234
- const O = Pe({
235
- hintLabel: a,
236
- modelValue: m,
237
- valid: s,
238
- validLabel: p,
239
- invalid: o,
240
- invalidLabel: l,
241
- loading: v,
242
- loadingLabel: y,
243
- ...j.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
244
353
  });
245
- return o != null && o.value ? (r == null ? void 0 : r(O)) || E(l == null ? void 0 : l.value) || (a == null ? void 0 : a.value) : s != null && s.value ? (n == null ? void 0 : n(O)) || E(p == null ? void 0 : p.value) || (a == null ? void 0 : a.value) : v != null && v.value ? (d == null ? void 0 : d(O)) || E(y == null ? void 0 : y.value) || (a == null ? void 0 : a.value) : (i == null ? void 0 : i(O)) || E(a == null ? void 0 : a.value) || (a == null ? void 0 : a.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);
246
362
  });
247
363
  return {
248
- isVisible: V,
249
- hasInvalid: h,
250
- hasValid: I,
251
- hintContent: F
364
+ isVisible,
365
+ hasInvalid,
366
+ hasValid,
367
+ hintContent
252
368
  };
253
369
  },
254
370
  render() {
255
- if (this.isVisible)
256
- return be(
371
+ if (this.isVisible) {
372
+ return h(
257
373
  "small",
258
374
  {
259
375
  role: this.hasInvalid ? "alert" : this.hasValid ? "status" : void 0
260
376
  },
261
377
  this.hintContent
262
378
  );
379
+ }
263
380
  }
264
381
  }
265
382
  };
266
383
  }
267
- const qe = {
384
+ const LinkProps = {
268
385
  /**
269
386
  * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
270
387
  * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
@@ -281,7 +398,7 @@ const qe = {
281
398
  */
282
399
  target: {
283
400
  type: String,
284
- validator: (e) => Object.values(re).includes(e)
401
+ validator: (value) => Object.values(AnchorTarget).includes(value)
285
402
  },
286
403
  /**
287
404
  * Anchor rel
@@ -290,7 +407,8 @@ const qe = {
290
407
  type: String,
291
408
  default: "noopener noreferrer"
292
409
  }
293
- }, He = {
410
+ };
411
+ const ValidProps = {
294
412
  /**
295
413
  * Valid status
296
414
  */
@@ -299,7 +417,8 @@ const qe = {
299
417
  * Valid label
300
418
  */
301
419
  validLabel: [String, Array]
302
- }, Me = {
420
+ };
421
+ const InvalidProps = {
303
422
  /**
304
423
  * Invalid status
305
424
  */
@@ -308,7 +427,8 @@ const qe = {
308
427
  * Invalid label
309
428
  */
310
429
  invalidLabel: [String, Array]
311
- }, Ke = {
430
+ };
431
+ const LoadingProps = {
312
432
  /**
313
433
  * Loading status
314
434
  */
@@ -320,39 +440,47 @@ const qe = {
320
440
  type: String,
321
441
  default: "Loading..."
322
442
  }
323
- }, le = {
443
+ };
444
+ const DisabledProps = {
324
445
  /**
325
446
  * Whether the form control is disabled
326
447
  */
327
448
  disabled: Boolean
328
- }, Re = {
449
+ };
450
+ const ActiveProps = {
329
451
  /**
330
452
  * Whether the item is active
331
453
  */
332
454
  active: Boolean
333
- }, Le = {
455
+ };
456
+ const PressedProps = {
334
457
  /**
335
458
  * Whether the item is pressed
336
459
  */
337
460
  pressed: Boolean
338
- }, ae = {
461
+ };
462
+ const LabelProps = {
339
463
  /**
340
464
  * The item label
341
465
  */
342
466
  label: [String, Number]
343
- }, Ue = {
467
+ };
468
+ const ReadonlyProps = {
344
469
  /**
345
470
  * The value is not editable
346
471
  */
347
472
  readonly: Boolean
348
- }, Je = {
473
+ };
474
+ const ModifiersProps = {
349
475
  /**
350
476
  * Component BEM modifiers
351
477
  */
352
478
  modifiers: [String, Array]
353
- }, We = {
479
+ };
480
+ const HintProps = {
354
481
  hintLabel: { type: String, default: "" }
355
- }, Ye = {
482
+ };
483
+ const OptionsProps = {
356
484
  /**
357
485
  * List of options, can be string[] or object[]
358
486
  */
@@ -372,7 +500,8 @@ const qe = {
372
500
  * Used when options are objects: key to use for option disabled
373
501
  */
374
502
  disabledKey: { type: [String, Function], default: "disabled" }
375
- }, Ge = {
503
+ };
504
+ const IconProps = {
376
505
  /**
377
506
  * VvIcon name or props
378
507
  * @see VVIcon
@@ -383,48 +512,139 @@ const qe = {
383
512
  */
384
513
  iconPosition: {
385
514
  type: String,
386
- default: P.before,
387
- validation: (e) => Object.values(P).includes(e)
515
+ default: Position.before,
516
+ validation: (value) => Object.values(Position).includes(value)
388
517
  }
389
- }, Qe = {
518
+ };
519
+ const TabindexProps = {
390
520
  /**
391
521
  * Global attribute tabindex
392
522
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
393
523
  */
394
524
  tabindex: { type: [String, Number], default: 0 }
395
- }, Xe = {
525
+ };
526
+ const FloatingLabelProps = {
396
527
  /**
397
528
  * If true the label will be floating
398
529
  */
399
530
  floating: Boolean
400
- }, Ze = {
531
+ };
532
+ const UnselectableProps = {
401
533
  /**
402
534
  * If true the input will be unselectable
403
535
  */
404
- unselectable: { type: Boolean, default: !0 }
405
- }, Te = {
536
+ unselectable: { type: Boolean, default: true }
537
+ };
538
+ const IdProps = {
406
539
  /**
407
540
  * Global attribute id
408
541
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
409
542
  */
410
543
  id: [String, Number]
411
544
  };
412
- _.bottom;
413
- const xe = {
414
- ...Te,
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,
415
633
  /**
416
634
  * Input / Textarea name
417
635
  * Name of the form control. Submitted with the form as part of a name/value pair
418
636
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
419
637
  */
420
- name: { type: String, required: !0 }
421
- }, et = {
638
+ name: { type: String, required: true }
639
+ };
640
+ const AutofocusProps = {
422
641
  /**
423
642
  * Global attribute autofocus
424
643
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
425
644
  */
426
645
  autofocus: Boolean
427
- }, tt = {
646
+ };
647
+ const AutocompleteProps = {
428
648
  /**
429
649
  * Global attribute autocomplete
430
650
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
@@ -432,33 +652,37 @@ const xe = {
432
652
  autocomplete: { type: String, default: "off" }
433
653
  };
434
654
  ({
435
- ...le,
436
- ...ae,
437
- ...Le,
438
- ...Re,
439
- ...qe,
655
+ ...DisabledProps,
656
+ ...LabelProps,
657
+ ...PressedProps,
658
+ ...ActiveProps,
659
+ ...LinkProps,
440
660
  /**
441
661
  * Button type
442
662
  */
443
- type: K.button
663
+ type: {
664
+ type: String,
665
+ default: ButtonType.button,
666
+ validator: (value) => Object.values(ButtonType).includes(value)
667
+ }
444
668
  });
445
- const rt = {
446
- ...xe,
447
- ...et,
448
- ...tt,
449
- ...Qe,
450
- ...He,
451
- ...Me,
452
- ...We,
453
- ...Ke,
454
- ...le,
455
- ...Ue,
456
- ...Je,
457
- ...Ye,
458
- ...Ge,
459
- ...Xe,
460
- ...Ze,
461
- ...ae,
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,
462
686
  /**
463
687
  * This Boolean attribute indicates that multiple options can be selected in the list.
464
688
  * If it is not specified, then only one option can be selected at a time.
@@ -489,174 +713,247 @@ const rt = {
489
713
  * Select placeholder
490
714
  */
491
715
  placeholder: String
492
- }, ot = ["update:modelValue", "focus", "blur"], nt = (e) => u(() => String((e == null ? void 0 : e.value) || Fe()));
493
- function lt(e, t) {
494
- const { focused: r } = we(e);
495
- return ee(r, (n) => {
496
- t(n ? "focus" : "blur", c(e));
497
- }), {
498
- focused: r
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
499
726
  };
500
727
  }
501
- function at(e, t) {
502
- const r = u(
503
- () => Boolean((e == null ? void 0 : e.value) && t.value === P.before)
504
- ), n = u(
505
- () => Boolean((e == null ? void 0 : e.value) && t.value === P.after)
506
- ), i = u(
507
- () => Boolean((e == null ? void 0 : e.value) && t.value === _.left)
508
- ), d = u(
509
- () => Boolean((e == null ? void 0 : e.value) && t.value === _.right)
510
- ), a = u(
511
- () => Boolean((e == null ? void 0 : e.value) && t.value === _.top)
512
- ), m = u(
513
- () => Boolean((e == null ? void 0 : e.value) && t.value === _.bottom)
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)
514
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
+ });
515
753
  return {
516
- hasIcon: u(() => typeof (e == null ? void 0 : e.value) == "string" ? { name: e == null ? void 0 : e.value } : e == null ? void 0 : e.value),
517
- hasIconLeft: i,
518
- hasIconRight: d,
519
- hasIconTop: a,
520
- hasIconBottom: m,
521
- hasIconBefore: r,
522
- hasIconAfter: n
754
+ hasIcon,
755
+ hasIconLeft,
756
+ hasIconRight,
757
+ hasIconTop,
758
+ hasIconBottom,
759
+ hasIconBefore,
760
+ hasIconAfter
523
761
  };
524
762
  }
525
- function st(e) {
526
- const { options: t, labelKey: r, valueKey: n, disabledKey: i } = C(e);
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
+ };
527
780
  return {
528
- options: t,
529
- getOptionLabel: (s) => typeof s != "object" && s !== null ? s : typeof r.value == "function" ? r.value(s) : s[r.value],
530
- getOptionValue: (s) => typeof s != "object" && s !== null ? s : typeof n.value == "function" ? n.value(s) : s[n.value],
531
- getOptionDisabled: (s) => typeof s != "object" && s !== null ? !1 : typeof i.value == "function" ? i.value(s) : s[i.value]
781
+ options,
782
+ getOptionLabel,
783
+ getOptionValue,
784
+ getOptionDisabled
532
785
  };
533
786
  }
534
- const ut = ["for"], it = { class: "vv-select__wrapper" }, ct = {
787
+ const _hoisted_1 = ["for"];
788
+ const _hoisted_2 = { class: "vv-select__wrapper" };
789
+ const _hoisted_3 = {
535
790
  key: 0,
536
791
  class: "vv-select__input-before"
537
- }, dt = { class: "vv-select__inner" }, ft = ["id"], vt = ["disabled", "hidden"], pt = ["disabled", "value"], gt = {
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 = {
538
798
  key: 1,
539
799
  class: "vv-select__input-after"
540
- }, yt = {
800
+ };
801
+ const __default__ = {
541
802
  name: "VvSelect"
542
- }, Bt = /* @__PURE__ */ T({
543
- ...yt,
544
- props: rt,
545
- emits: ot,
546
- setup(e, { emit: t }) {
547
- const r = e, n = me(), i = x(), { HintSlot: d, hasHint: a, hasInvalid: m } = ze(r, n), {
548
- id: s,
549
- modifiers: p,
550
- disabled: o,
551
- readonly: l,
552
- loading: g,
553
- icon: v,
554
- iconPosition: y,
555
- invalid: h,
556
- valid: w,
557
- floating: I,
558
- multiple: A
559
- } = C(r), V = nt(s), j = u(() => `${V.value}-hint`), { focused: F } = lt(i, t), O = Ae(i);
560
- ee(O, (f) => {
561
- f && r.autofocus && (F.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;
562
843
  });
563
- const { hasIcon: R, hasIconBefore: L, hasIconAfter: U } = at(
564
- v,
565
- y
566
- ), se = u(() => !ne(r.modelValue)), J = u(() => r.disabled || r.readonly), ue = u(() => J.value ? -1 : r.tabindex), ie = u(() => {
567
- if (r.invalid === !0)
568
- return !0;
569
- if (r.valid === !0)
570
- return !1;
571
- }), ce = oe(
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;
852
+ });
853
+ const bemCssClasses = useModifiers(
572
854
  "vv-select",
573
- p,
574
- u(() => ({
575
- valid: w.value,
576
- invalid: h.value,
577
- loading: g.value,
578
- disabled: o.value,
579
- readonly: l.value,
580
- "icon-before": L.value,
581
- "icon-after": U.value,
582
- dirty: se.value,
583
- focus: F.value,
584
- floating: I.value,
585
- multiple: A.value
855
+ modifiers,
856
+ computed(() => ({
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
586
868
  }))
587
- ), de = u(() => ({
588
- name: r.name,
589
- tabindex: ue.value,
590
- disabled: J.value,
591
- required: r.required,
592
- size: r.size,
593
- autocomplete: r.autocomplete,
594
- multiple: r.multiple,
595
- "aria-invalid": ie.value,
596
- "aria-describedby": !m.value && a.value ? j.value : void 0,
597
- "aria-errormessage": m.value ? j.value : void 0
598
- })), W = u(() => ({
599
- valid: r.valid,
600
- invalid: r.invalid,
601
- modelValue: r.modelValue
602
- })), { getOptionLabel: fe, getOptionValue: ve, getOptionDisabled: pe } = st(r), z = u({
603
- get: () => r.modelValue,
604
- set: (f) => {
605
- Array.isArray(f) && (f = f.filter((k) => k !== void 0)), t("update:modelValue", f);
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);
606
899
  }
607
900
  });
608
- return (f, k) => (b(), S("div", {
609
- class: he(c(ce))
610
- }, [
611
- f.label ? (b(), S("label", {
612
- key: 0,
613
- for: c(V)
614
- }, q(f.label), 9, ut)) : B("", !0),
615
- H("div", it, [
616
- f.$slots.before ? (b(), S("div", ct, [
617
- Y(f.$slots, "before", G(Q(c(W))))
618
- ])) : B("", !0),
619
- H("div", dt, [
620
- c(L) ? (b(), M(X, N({
621
- key: 0,
622
- class: "vv-select__icon"
623
- }, c(R)), null, 16)) : B("", !0),
624
- Se(H("select", N({
625
- id: c(V),
626
- ref_key: "select",
627
- ref: i,
628
- "onUpdate:modelValue": k[0] || (k[0] = ($) => Be(z) ? z.value = $ : null)
629
- }, c(de)), [
630
- f.placeholder ? (b(), S("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({
631
915
  key: 0,
632
- value: void 0,
633
- disabled: !f.unselectable,
634
- hidden: !f.unselectable
635
- }, q(f.placeholder), 9, vt)) : B("", !0),
636
- (b(!0), S(_e, null, Oe(f.options, ($, ge) => (b(), S("option", {
637
- key: ge,
638
- disabled: c(pe)($),
639
- value: c(ve)($)
640
- }, q(c(fe)($)), 9, pt))), 128))
641
- ], 16, ft), [
642
- [Ie, c(z)]
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)
643
944
  ]),
644
- c(U) ? (b(), M(X, N({
645
- key: 1,
646
- class: "vv-select__icon vv-select__icon-after"
647
- }, c(R)), null, 16)) : B("", !0)
945
+ _ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_8, [
946
+ renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
947
+ ])) : createCommentVNode("", true)
648
948
  ]),
649
- f.$slots.after ? (b(), S("div", gt, [
650
- Y(f.$slots, "after", G(Q(c(W))))
651
- ])) : B("", !0)
652
- ]),
653
- Ve(c(d), {
654
- id: c(j),
655
- class: "vv-select__hint"
656
- }, null, 8, ["id"])
657
- ], 2));
949
+ createVNode(unref(HintSlot), {
950
+ id: unref(hasDescribedBy),
951
+ class: "vv-select__hint"
952
+ }, null, 8, ["id"])
953
+ ], 2);
954
+ };
658
955
  }
659
956
  });
660
957
  export {
661
- Bt as default
958
+ _sfc_main as default
662
959
  };