@volverjs/ui-vue 0.0.4 → 0.0.5-beta.2

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 (215) 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 +276 -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 +213 -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 +247 -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 +646 -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 +261 -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 +562 -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 +661 -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 +1546 -983
  44. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  45. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +138 -51
  46. package/dist/components/VvCombobox/index.d.ts +41 -10
  47. package/dist/components/VvDialog/VvDialog.es.js +387 -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 +452 -244
  52. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  53. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +130 -42
  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 +40 -11
  57. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +373 -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 +285 -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 +986 -462
  70. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  71. package/dist/components/VvInputText/VvInputText.vue.d.ts +100 -20
  72. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  73. package/dist/components/VvInputText/index.d.ts +66 -13
  74. package/dist/components/VvProgress/VvProgress.es.js +216 -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 +499 -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 +598 -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 +631 -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 +676 -355
  91. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  92. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +20 -20
  93. package/dist/components/VvTextarea/index.d.ts +4 -4
  94. package/dist/components/VvTooltip/VvTooltip.es.js +215 -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 +3522 -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.d.ts +1 -0
  114. package/dist/directives/index.es.js +264 -55
  115. package/dist/directives/index.umd.js +1 -1
  116. package/dist/directives/v-contextmenu.d.ts +3 -0
  117. package/dist/directives/v-contextmenu.es.js +42 -0
  118. package/dist/directives/v-contextmenu.umd.js +1 -0
  119. package/dist/directives/v-tooltip.es.js +222 -53
  120. package/dist/directives/v-tooltip.umd.js +1 -1
  121. package/dist/icons.d.ts +3 -1
  122. package/dist/icons.es.js +40 -23
  123. package/dist/icons.umd.js +1 -1
  124. package/dist/index.d.ts +0 -1
  125. package/dist/index.es.js +112 -3607
  126. package/dist/index.umd.js +1 -1
  127. package/dist/props/index.d.ts +50 -18
  128. package/dist/resolvers/unplugin.d.ts +7 -1
  129. package/dist/resolvers/unplugin.es.js +77 -37
  130. package/dist/resolvers/unplugin.umd.js +1 -1
  131. package/dist/stories/Combobox/Combobox.settings.d.ts +12 -0
  132. package/dist/stories/Dropdown/Dropdown.settings.d.ts +12 -0
  133. package/dist/stories/InputText/InputText.settings.d.ts +53 -0
  134. package/dist/stories/argTypes.d.ts +13 -1
  135. package/package.json +126 -40
  136. package/src/Volver.ts +49 -22
  137. package/src/assets/icons/detailed.json +1 -1
  138. package/src/assets/icons/normal.json +1 -1
  139. package/src/assets/icons/simple.json +1 -1
  140. package/src/components/VvAccordion/VvAccordion.vue +19 -22
  141. package/src/components/VvAccordion/index.ts +12 -4
  142. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
  143. package/src/components/VvAccordionGroup/index.ts +8 -0
  144. package/src/components/VvAction/VvAction.vue +7 -7
  145. package/src/components/VvAction/index.ts +1 -1
  146. package/src/components/VvBadge/VvBadge.vue +2 -2
  147. package/src/components/VvBadge/index.ts +1 -1
  148. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
  149. package/src/components/VvButton/VvButton.vue +11 -11
  150. package/src/components/VvButton/index.ts +10 -9
  151. package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
  152. package/src/components/VvButtonGroup/index.ts +1 -1
  153. package/src/components/VvCard/VvCard.vue +2 -2
  154. package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
  155. package/src/components/VvCheckbox/index.ts +11 -7
  156. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
  157. package/src/components/VvCheckboxGroup/index.ts +1 -1
  158. package/src/components/VvCombobox/VvCombobox.vue +44 -26
  159. package/src/components/VvCombobox/index.ts +1 -1
  160. package/src/components/VvDialog/VvDialog.vue +28 -11
  161. package/src/components/VvDialog/index.ts +5 -2
  162. package/src/components/VvDropdown/VvDropdown.vue +7 -5
  163. package/src/components/VvDropdown/VvDropdownAction.vue +7 -5
  164. package/src/components/VvDropdown/VvDropdownOption.vue +17 -10
  165. package/src/components/VvDropdown/index.ts +3 -3
  166. package/src/components/VvIcon/VvIcon.vue +3 -3
  167. package/src/components/VvIcon/index.ts +3 -3
  168. package/src/components/VvInputText/VvInputClearAction.ts +2 -2
  169. package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
  170. package/src/components/VvInputText/VvInputStepAction.ts +3 -2
  171. package/src/components/VvInputText/VvInputText.vue +130 -37
  172. package/src/components/VvInputText/VvInputTextActions.ts +5 -8
  173. package/src/components/VvInputText/index.ts +62 -1
  174. package/src/components/VvProgress/VvProgress.vue +2 -2
  175. package/src/components/VvProgress/index.ts +1 -1
  176. package/src/components/VvRadio/VvRadio.vue +3 -7
  177. package/src/components/VvRadio/index.ts +11 -7
  178. package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
  179. package/src/components/VvRadioGroup/index.ts +1 -1
  180. package/src/components/VvSelect/VvSelect.vue +4 -4
  181. package/src/components/VvSelect/index.ts +1 -1
  182. package/src/components/VvTextarea/VvTextarea.vue +6 -6
  183. package/src/components/VvTextarea/index.ts +1 -1
  184. package/src/components/VvTooltip/VvTooltip.vue +2 -2
  185. package/src/components/VvTooltip/index.ts +3 -3
  186. package/src/composables/dropdown/useInjectDropdown.ts +2 -2
  187. package/src/composables/dropdown/useProvideDropdown.ts +2 -2
  188. package/src/composables/group/useInjectedGroupState.ts +1 -1
  189. package/src/composables/group/useProvideGroupState.ts +1 -1
  190. package/src/composables/useComponentIcon.ts +1 -1
  191. package/src/composables/useDebouncedInput.ts +10 -3
  192. package/src/composables/useDefaults.ts +89 -0
  193. package/src/composables/useModifiers.ts +4 -2
  194. package/src/composables/useOptions.ts +1 -1
  195. package/src/composables/useVolver.ts +2 -2
  196. package/src/directives/index.ts +3 -1
  197. package/src/directives/v-contextmenu.ts +40 -0
  198. package/src/directives/v-tooltip.ts +2 -2
  199. package/src/icons.ts +1 -1
  200. package/src/index.ts +0 -2
  201. package/src/props/index.ts +20 -10
  202. package/src/resolvers/unplugin.ts +15 -1
  203. package/src/stories/Accordion/Accordion.stories.mdx +8 -2
  204. package/src/stories/Accordion/Accordion.test.ts +21 -15
  205. package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
  206. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
  207. package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
  208. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +1 -1
  209. package/src/stories/Dropdown/DropdownContextmenuDirective.stories.mdx +41 -0
  210. package/src/stories/InputText/InputText.settings.ts +53 -0
  211. package/src/stories/InputText/InputText.stories.mdx +40 -0
  212. package/src/stories/InputText/InputText.test.ts +5 -2
  213. package/src/stories/Tooltip/TooltipDirective.stories.mdx +1 -1
  214. package/src/stories/argTypes.ts +12 -2
  215. 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) {
197
284
  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
285
+ invalid: invalidSlot,
286
+ valid: validSlot,
287
+ hint: hintSlot,
288
+ loading: loadingSlot
289
+ } = parentSlots;
290
+ const {
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,149 @@ 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 strategy
558
+ */
559
+ strategy: {
560
+ type: String,
561
+ default: "absolute",
562
+ validator: (value) => {
563
+ return ["fixed", "absolute"].includes(value);
564
+ }
565
+ },
566
+ /**
567
+ * Dropdown show / hide transition name
568
+ */
569
+ transitionName: {
570
+ type: String
571
+ },
572
+ /**
573
+ * Offset of the dropdown from the trigger
574
+ * @see https://floating-ui.com/docs/offset
575
+ */
576
+ offset: {
577
+ type: [Number, String, Object],
578
+ default: 0
579
+ },
580
+ /**
581
+ * Move dropdown to the side if there is no space in the default position
582
+ * @see https://floating-ui.com/docs/shift
583
+ */
584
+ shift: {
585
+ type: [Boolean, Object],
586
+ default: false
587
+ },
588
+ /**
589
+ * Flip dropdown position if there is no space in the default position
590
+ * @see https://floating-ui.com/docs/flip
591
+ */
592
+ flip: {
593
+ type: [Boolean, Object],
594
+ default: true
595
+ },
596
+ /**
597
+ * Size of the dropdown
598
+ * @see https://floating-ui.com/docs/size
599
+ */
600
+ size: {
601
+ type: [Boolean, Object],
602
+ default: () => ({ padding: 10 })
603
+ },
604
+ /**
605
+ * Automatically change the position of the dropdown
606
+ * @see https://floating-ui.com/docs/autoPlacement
607
+ */
608
+ autoPlacement: {
609
+ type: [Boolean, Object],
610
+ default: false
611
+ },
612
+ /**
613
+ * Add arrow to the dropdown
614
+ * @see https://floating-ui.com/docs/arrow
615
+ */
616
+ arrow: {
617
+ type: Boolean,
618
+ default: false
619
+ },
620
+ /**
621
+ * Close dropdown on click outside
622
+ */
623
+ autoClose: {
624
+ type: Boolean,
625
+ default: true
626
+ },
627
+ /**
628
+ * Autofocus first item on dropdown open
629
+ */
630
+ autofocusFirst: {
631
+ type: Boolean,
632
+ default: true
633
+ },
634
+ /**
635
+ * Set dropdown width to the same as the trigger
636
+ */
637
+ triggerWidth: {
638
+ type: Boolean
639
+ }
640
+ });
641
+ const IdNameProps = {
642
+ ...IdProps,
415
643
  /**
416
644
  * Input / Textarea name
417
645
  * Name of the form control. Submitted with the form as part of a name/value pair
418
646
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
419
647
  */
420
- name: { type: String, required: !0 }
421
- }, et = {
648
+ name: { type: String, required: true }
649
+ };
650
+ const AutofocusProps = {
422
651
  /**
423
652
  * Global attribute autofocus
424
653
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
425
654
  */
426
655
  autofocus: Boolean
427
- }, tt = {
656
+ };
657
+ const AutocompleteProps = {
428
658
  /**
429
659
  * Global attribute autocomplete
430
660
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
@@ -432,33 +662,37 @@ const xe = {
432
662
  autocomplete: { type: String, default: "off" }
433
663
  };
434
664
  ({
435
- ...le,
436
- ...ae,
437
- ...Le,
438
- ...Re,
439
- ...qe,
665
+ ...DisabledProps,
666
+ ...LabelProps,
667
+ ...PressedProps,
668
+ ...ActiveProps,
669
+ ...LinkProps,
440
670
  /**
441
671
  * Button type
442
672
  */
443
- type: K.button
673
+ type: {
674
+ type: String,
675
+ default: ButtonType.button,
676
+ validator: (value) => Object.values(ButtonType).includes(value)
677
+ }
444
678
  });
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,
679
+ const VvSelectProps = {
680
+ ...IdNameProps,
681
+ ...AutofocusProps,
682
+ ...AutocompleteProps,
683
+ ...TabindexProps,
684
+ ...ValidProps,
685
+ ...InvalidProps,
686
+ ...HintProps,
687
+ ...LoadingProps,
688
+ ...DisabledProps,
689
+ ...ReadonlyProps,
690
+ ...ModifiersProps,
691
+ ...OptionsProps,
692
+ ...IconProps,
693
+ ...FloatingLabelProps,
694
+ ...UnselectableProps,
695
+ ...LabelProps,
462
696
  /**
463
697
  * This Boolean attribute indicates that multiple options can be selected in the list.
464
698
  * If it is not specified, then only one option can be selected at a time.
@@ -489,174 +723,247 @@ const rt = {
489
723
  * Select placeholder
490
724
  */
491
725
  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
726
+ };
727
+ const VvSelectEmits = ["update:modelValue", "focus", "blur"];
728
+ const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
729
+ function useComponentFocus(inputTemplateRef, emit) {
730
+ const { focused } = useFocus(inputTemplateRef);
731
+ watch(focused, (newValue) => {
732
+ emit(newValue ? "focus" : "blur", unref(inputTemplateRef));
733
+ });
734
+ return {
735
+ focused
499
736
  };
500
737
  }
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)
738
+ function useComponentIcon(icon, iconPosition) {
739
+ const hasIconBefore = computed(
740
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Position.before)
741
+ );
742
+ const hasIconAfter = computed(
743
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Position.after)
514
744
  );
745
+ const hasIconLeft = computed(
746
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.left)
747
+ );
748
+ const hasIconRight = computed(
749
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.right)
750
+ );
751
+ const hasIconTop = computed(
752
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.top)
753
+ );
754
+ const hasIconBottom = computed(
755
+ () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.bottom)
756
+ );
757
+ const hasIcon = computed(() => {
758
+ if (typeof (icon == null ? void 0 : icon.value) === "string") {
759
+ return { name: icon == null ? void 0 : icon.value };
760
+ }
761
+ return icon == null ? void 0 : icon.value;
762
+ });
515
763
  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
764
+ hasIcon,
765
+ hasIconLeft,
766
+ hasIconRight,
767
+ hasIconTop,
768
+ hasIconBottom,
769
+ hasIconBefore,
770
+ hasIconAfter
523
771
  };
524
772
  }
525
- function st(e) {
526
- const { options: t, labelKey: r, valueKey: n, disabledKey: i } = C(e);
773
+ function useOptions(props) {
774
+ const { options, labelKey, valueKey, disabledKey } = toRefs(props);
775
+ const getOptionLabel = (option) => {
776
+ if (typeof option !== "object" && option !== null)
777
+ return option;
778
+ return typeof labelKey.value === "function" ? labelKey.value(option) : option[labelKey.value];
779
+ };
780
+ const getOptionValue = (option) => {
781
+ if (typeof option !== "object" && option !== null)
782
+ return option;
783
+ return typeof valueKey.value === "function" ? valueKey.value(option) : option[valueKey.value];
784
+ };
785
+ const getOptionDisabled = (option) => {
786
+ if (typeof option !== "object" && option !== null)
787
+ return false;
788
+ return typeof disabledKey.value === "function" ? disabledKey.value(option) : option[disabledKey.value];
789
+ };
527
790
  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]
791
+ options,
792
+ getOptionLabel,
793
+ getOptionValue,
794
+ getOptionDisabled
532
795
  };
533
796
  }
534
- const ut = ["for"], it = { class: "vv-select__wrapper" }, ct = {
797
+ const _hoisted_1 = ["for"];
798
+ const _hoisted_2 = { class: "vv-select__wrapper" };
799
+ const _hoisted_3 = {
535
800
  key: 0,
536
801
  class: "vv-select__input-before"
537
- }, dt = { class: "vv-select__inner" }, ft = ["id"], vt = ["disabled", "hidden"], pt = ["disabled", "value"], gt = {
802
+ };
803
+ const _hoisted_4 = { class: "vv-select__inner" };
804
+ const _hoisted_5 = ["id"];
805
+ const _hoisted_6 = ["disabled", "hidden"];
806
+ const _hoisted_7 = ["disabled", "value"];
807
+ const _hoisted_8 = {
538
808
  key: 1,
539
809
  class: "vv-select__input-after"
540
- }, yt = {
810
+ };
811
+ const __default__ = {
541
812
  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);
813
+ };
814
+ const _sfc_main = /* @__PURE__ */ defineComponent({
815
+ ...__default__,
816
+ props: VvSelectProps,
817
+ emits: VvSelectEmits,
818
+ setup(__props, { emit }) {
819
+ const props = __props;
820
+ const slots = useSlots();
821
+ const select = ref();
822
+ const { HintSlot, hasHint, hasInvalid } = HintSlotFactory(props, slots);
823
+ const {
824
+ id,
825
+ modifiers,
826
+ disabled,
827
+ readonly,
828
+ loading,
829
+ icon,
830
+ iconPosition,
831
+ invalid,
832
+ valid,
833
+ floating,
834
+ multiple
835
+ } = toRefs(props);
836
+ const hasId = useUniqueId(id);
837
+ const hasDescribedBy = computed(() => `${hasId.value}-hint`);
838
+ const { focused } = useComponentFocus(select, emit);
839
+ const isVisible = useElementVisibility(select);
840
+ watch(isVisible, (newValue) => {
841
+ if (newValue && props.autofocus) {
842
+ focused.value = true;
843
+ }
844
+ });
845
+ const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
846
+ icon,
847
+ iconPosition
848
+ );
849
+ const isDirty = computed(() => !isEmpty(props.modelValue));
850
+ const isDisabled = computed(() => props.disabled || props.readonly);
851
+ const hasTabindex = computed(() => {
852
+ return isDisabled.value ? -1 : props.tabindex;
562
853
  });
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(
854
+ const isInvalid = computed(() => {
855
+ if (props.invalid === true) {
856
+ return true;
857
+ }
858
+ if (props.valid === true) {
859
+ return false;
860
+ }
861
+ return void 0;
862
+ });
863
+ const bemCssClasses = useModifiers(
572
864
  "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
865
+ modifiers,
866
+ computed(() => ({
867
+ valid: valid.value,
868
+ invalid: invalid.value,
869
+ loading: loading.value,
870
+ disabled: disabled.value,
871
+ readonly: readonly.value,
872
+ "icon-before": hasIconBefore.value,
873
+ "icon-after": hasIconAfter.value,
874
+ dirty: isDirty.value,
875
+ focus: focused.value,
876
+ floating: floating.value,
877
+ multiple: multiple.value
586
878
  }))
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);
879
+ );
880
+ const hasAttrs = computed(() => {
881
+ return {
882
+ name: props.name,
883
+ tabindex: hasTabindex.value,
884
+ disabled: isDisabled.value,
885
+ required: props.required,
886
+ size: props.size,
887
+ autocomplete: props.autocomplete,
888
+ multiple: props.multiple,
889
+ "aria-invalid": isInvalid.value,
890
+ "aria-describedby": !hasInvalid.value && hasHint.value ? hasDescribedBy.value : void 0,
891
+ "aria-errormessage": hasInvalid.value ? hasDescribedBy.value : void 0
892
+ };
893
+ });
894
+ const slotProps = computed(() => ({
895
+ valid: props.valid,
896
+ invalid: props.invalid,
897
+ modelValue: props.modelValue
898
+ }));
899
+ const { getOptionLabel, getOptionValue, getOptionDisabled } = useOptions(props);
900
+ const localModelValue = computed({
901
+ get: () => {
902
+ return props.modelValue;
903
+ },
904
+ set: (newValue) => {
905
+ if (Array.isArray(newValue)) {
906
+ newValue = newValue.filter((item) => item !== void 0);
907
+ }
908
+ emit("update:modelValue", newValue);
606
909
  }
607
910
  });
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", {
911
+ return (_ctx, _cache) => {
912
+ return openBlock(), createElementBlock("div", {
913
+ class: normalizeClass(unref(bemCssClasses))
914
+ }, [
915
+ _ctx.label ? (openBlock(), createElementBlock("label", {
916
+ key: 0,
917
+ for: unref(hasId)
918
+ }, toDisplayString(_ctx.label), 9, _hoisted_1)) : createCommentVNode("", true),
919
+ createElementVNode("div", _hoisted_2, [
920
+ _ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_3, [
921
+ renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
922
+ ])) : createCommentVNode("", true),
923
+ createElementVNode("div", _hoisted_4, [
924
+ unref(hasIconBefore) ? (openBlock(), createBlock(_sfc_main$1, mergeProps({
631
925
  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)]
926
+ class: "vv-select__icon"
927
+ }, unref(hasIcon)), null, 16)) : createCommentVNode("", true),
928
+ withDirectives(createElementVNode("select", mergeProps({
929
+ id: unref(hasId),
930
+ ref_key: "select",
931
+ ref: select,
932
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
933
+ }, unref(hasAttrs)), [
934
+ _ctx.placeholder ? (openBlock(), createElementBlock("option", {
935
+ key: 0,
936
+ value: void 0,
937
+ disabled: !_ctx.unselectable,
938
+ hidden: !_ctx.unselectable
939
+ }, toDisplayString(_ctx.placeholder), 9, _hoisted_6)) : createCommentVNode("", true),
940
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
941
+ return openBlock(), createElementBlock("option", {
942
+ key: index,
943
+ disabled: unref(getOptionDisabled)(option),
944
+ value: unref(getOptionValue)(option)
945
+ }, toDisplayString(unref(getOptionLabel)(option)), 9, _hoisted_7);
946
+ }), 128))
947
+ ], 16, _hoisted_5), [
948
+ [vModelSelect, unref(localModelValue)]
949
+ ]),
950
+ unref(hasIconAfter) ? (openBlock(), createBlock(_sfc_main$1, mergeProps({
951
+ key: 1,
952
+ class: "vv-select__icon vv-select__icon-after"
953
+ }, unref(hasIcon)), null, 16)) : createCommentVNode("", true)
643
954
  ]),
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)
955
+ _ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_8, [
956
+ renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
957
+ ])) : createCommentVNode("", true)
648
958
  ]),
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));
959
+ createVNode(unref(HintSlot), {
960
+ id: unref(hasDescribedBy),
961
+ class: "vv-select__hint"
962
+ }, null, 8, ["id"])
963
+ ], 2);
964
+ };
658
965
  }
659
966
  });
660
967
  export {
661
- Bt as default
968
+ _sfc_main as default
662
969
  };