@volverjs/ui-vue 0.0.1 → 0.0.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 (82) hide show
  1. package/README.md +17 -0
  2. package/dist/components/VvButton/VvButton.es.js +159 -147
  3. package/dist/components/VvButton/VvButton.umd.js +1 -1
  4. package/dist/components/VvButton/VvButton.vue.d.ts +0 -8
  5. package/dist/components/VvButton/index.d.ts +4 -4
  6. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +36 -37
  7. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  8. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +10 -10
  9. package/dist/components/VvButtonGroup/index.d.ts +5 -5
  10. package/dist/components/VvCombobox/VvCombobox.es.js +526 -345
  11. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  12. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +22 -0
  13. package/dist/components/VvCombobox/index.d.ts +13 -1
  14. package/dist/components/VvDropdown/VvDropdown.es.js +118 -109
  15. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  16. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +19 -0
  17. package/dist/components/VvDropdown/index.d.ts +12 -0
  18. package/dist/components/VvInputText/VvInputText.es.js +221 -213
  19. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  20. package/dist/components/VvInputText/VvInputText.vue.d.ts +13 -13
  21. package/dist/components/VvInputText/index.d.ts +5 -5
  22. package/dist/components/VvSelect/VvSelect.es.js +186 -167
  23. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  24. package/dist/components/VvSelect/VvSelect.vue.d.ts +23 -11
  25. package/dist/components/VvSelect/index.d.ts +10 -17
  26. package/dist/components/VvTextarea/VvTextarea.es.js +112 -104
  27. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  28. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +12 -12
  29. package/dist/components/VvTextarea/index.d.ts +5 -5
  30. package/dist/components/index.es.js +1045 -975
  31. package/dist/components/index.umd.js +1 -1
  32. package/dist/composables/group/types/IButtonGroupState.d.ts +1 -1
  33. package/dist/composables/group/types/IGroupState.d.ts +1 -1
  34. package/dist/composables/group/useInjectedGroupState.d.ts +1 -1
  35. package/dist/icons.es.js +3 -3
  36. package/dist/icons.umd.js +1 -1
  37. package/dist/index.es.js +1065 -995
  38. package/dist/index.umd.js +1 -1
  39. package/dist/props/index.d.ts +35 -4
  40. package/dist/resolvers/unplugin.es.js +26 -24
  41. package/dist/resolvers/unplugin.umd.js +1 -1
  42. package/dist/stories/Button/Button.settings.d.ts +9 -11
  43. package/dist/stories/ButtonGroup/ButtonGroup.settings.d.ts +9 -0
  44. package/dist/stories/Combobox/Combobox.settings.d.ts +19 -0
  45. package/dist/stories/Dropdown/Dropdown.settings.d.ts +10 -0
  46. package/dist/stories/InputText/InputText.settings.d.ts +23 -23
  47. package/dist/stories/Select/Select.settings.d.ts +42 -23
  48. package/dist/stories/Textarea/Textarea.settings.d.ts +23 -23
  49. package/dist/stories/argTypes.d.ts +50 -1
  50. package/package.json +5 -4
  51. package/src/assets/icons/detailed.json +1 -1
  52. package/src/assets/icons/normal.json +1 -1
  53. package/src/assets/icons/simple.json +1 -1
  54. package/src/components/VvButton/index.ts +28 -10
  55. package/src/components/VvButtonGroup/VvButtonGroup.vue +1 -1
  56. package/src/components/VvButtonGroup/index.ts +3 -6
  57. package/src/components/VvCombobox/VvCombobox.vue +45 -11
  58. package/src/components/VvCombobox/index.ts +6 -0
  59. package/src/components/VvDropdown/VvDropdown.vue +9 -6
  60. package/src/components/VvDropdown/index.ts +11 -1
  61. package/src/components/VvInputText/VvInputText.vue +10 -8
  62. package/src/components/VvSelect/VvSelect.vue +23 -1
  63. package/src/components/VvSelect/index.ts +8 -11
  64. package/src/components/VvTextarea/VvTextarea.vue +10 -8
  65. package/src/composables/group/types/IButtonGroupState.ts +1 -1
  66. package/src/composables/group/types/IGroupState.ts +1 -1
  67. package/src/composables/group/useInjectedGroupState.ts +3 -3
  68. package/src/composables/useTextCount.ts +1 -1
  69. package/src/props/index.ts +33 -15
  70. package/src/resolvers/unplugin.ts +22 -13
  71. package/src/stories/Button/Button.settings.ts +2 -7
  72. package/src/stories/ButtonGroup/ButtonGroup.settings.ts +6 -1
  73. package/src/stories/ButtonGroup/ButtonGroupSlots.stories.mdx +37 -0
  74. package/src/stories/ButtonGroup/ButtonGroupToggle.stories.mdx +12 -1
  75. package/src/stories/Combobox/Combobox.settings.ts +5 -0
  76. package/src/stories/Combobox/Combobox.stories.mdx +51 -0
  77. package/src/stories/Combobox/Combobox.test.ts +7 -0
  78. package/src/stories/Dropdown/Dropdown.settings.ts +10 -1
  79. package/src/stories/Dropdown/Dropdown.stories.mdx +17 -0
  80. package/src/stories/Select/Select.settings.ts +9 -23
  81. package/src/stories/Select/Select.stories.mdx +60 -0
  82. package/src/stories/argTypes.ts +46 -22
@@ -1,99 +1,99 @@
1
- import { unref as u, computed as i, toRefs as j, watch as oe, defineComponent as G, ref as J, inject as se, openBlock as y, createBlock as R, mergeProps as D, createCommentVNode as $, h as ae, useSlots as ie, createElementBlock as O, normalizeClass as le, toDisplayString as N, createElementVNode as H, renderSlot as M, normalizeProps as T, withDirectives as ue, isRef as ce, Fragment as de, renderList as fe, vModelSelect as ve, createVNode as pe } from "vue";
2
- import { nanoid as me } from "nanoid";
3
- import { useFocus as ge, toReactive as he } from "@vueuse/core";
4
- import { iconExists as F, Icon as ye, addIcon as be } from "@iconify/vue";
5
- function q(e, r) {
1
+ import { unref as c, computed as i, toRefs as j, watch as J, defineComponent as X, ref as Q, inject as ae, openBlock as y, createBlock as R, mergeProps as D, createCommentVNode as O, h as ue, useSlots as ce, createElementBlock as B, normalizeClass as de, toDisplayString as E, createElementVNode as T, renderSlot as q, normalizeProps as L, withDirectives as fe, isRef as ve, Fragment as pe, renderList as me, vModelSelect as ge, createVNode as he } from "vue";
2
+ import { nanoid as ye } from "nanoid";
3
+ import { useFocus as be, toReactive as Se, useElementVisibility as Ie } from "@vueuse/core";
4
+ import { iconExists as F, Icon as Ve, addIcon as Pe } from "@iconify/vue";
5
+ function K(e, r) {
6
6
  if (e && Object.keys(e).length && r) {
7
7
  if (r.indexOf(".") === -1)
8
8
  return e[r];
9
9
  {
10
10
  const t = r.split(".");
11
- let l = e;
12
- for (let a = 0, c = t.length; a < c; ++a) {
11
+ let a = e;
12
+ for (let l = 0, d = t.length; l < d; ++l) {
13
13
  if (e == null)
14
14
  return null;
15
- l = l[t[a]];
15
+ a = a[t[l]];
16
16
  }
17
- return l;
17
+ return a;
18
18
  }
19
19
  } else
20
20
  return null;
21
21
  }
22
- function U(e) {
23
- return ((r) => r == null || r === "" || Array.isArray(r) && r.length === 0 || !(r instanceof Date) && typeof r == "object" && Object.keys(r).length === 0)(u(e));
22
+ function W(e) {
23
+ return ((r) => r == null || r === "" || Array.isArray(r) && r.length === 0 || !(r instanceof Date) && typeof r == "object" && Object.keys(r).length === 0)(c(e));
24
24
  }
25
- function Se(e) {
25
+ function Ae(e) {
26
26
  return typeof e == "string" || e instanceof String;
27
27
  }
28
- function L(e) {
28
+ function Z(e) {
29
29
  var r, t;
30
30
  if (e)
31
31
  return (t = (r = e.match(
32
32
  /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g
33
33
  )) == null ? void 0 : r.join("-")) == null ? void 0 : t.toLowerCase();
34
34
  }
35
- function X(e, r) {
35
+ function Y(e, r) {
36
36
  const t = { [`${e}`]: !0 };
37
37
  return {
38
- bemCssClasses: i(() => Object.keys(r).reduce((a, c) => {
39
- const n = u(r[c]) || !1;
38
+ bemCssClasses: i(() => Object.keys(r).reduce((l, d) => {
39
+ const n = c(r[d]) || !1;
40
40
  if (!n)
41
- return a;
42
- if (c === "modifiers") {
41
+ return l;
42
+ if (d === "modifiers") {
43
43
  const h = Array.isArray(n) ? n : n.split(" ");
44
44
  return {
45
- ...a,
45
+ ...l,
46
46
  ...h.reduce(
47
- (p, f) => ({
47
+ (p, v) => ({
48
48
  ...p,
49
- [`${e}--${L(f)}`]: !0
49
+ [`${e}--${Z(v)}`]: !0
50
50
  }),
51
51
  {}
52
52
  )
53
53
  };
54
54
  } else
55
55
  return {
56
- ...a,
57
- [`${e}--${L(c)}`]: n
56
+ ...l,
57
+ [`${e}--${Z(d)}`]: n
58
58
  };
59
59
  }, t) || {})
60
60
  };
61
61
  }
62
- function Ie(e, r, t) {
63
- const l = i(
62
+ function Be(e, r, t) {
63
+ const a = i(
64
64
  () => !!(e != null && e.value && r.value === "left" || t != null && t.iconLeft)
65
- ), a = i(
65
+ ), l = i(
66
66
  () => !!(e != null && e.value && r.value === "right" || t != null && t.iconRight)
67
- ), c = i(
67
+ ), d = i(
68
68
  () => !!(e != null && e.value && r.value === "top" || t != null && t.iconTop)
69
69
  ), n = i(
70
70
  () => !!(e != null && e.value && r.value === "bottom" || t != null && t.iconBottom)
71
71
  );
72
72
  return {
73
73
  hasIcon: i(() => typeof (e == null ? void 0 : e.value) == "string" ? { name: e == null ? void 0 : e.value } : e == null ? void 0 : e.value),
74
- hasIconLeft: l,
75
- hasIconRight: a,
76
- hasIconTop: c,
74
+ hasIconLeft: a,
75
+ hasIconRight: l,
76
+ hasIconTop: d,
77
77
  hasIconBottom: n
78
78
  };
79
79
  }
80
- function Ve(e) {
81
- const { options: r, labelKey: t, valueKey: l } = j(e);
80
+ function Oe(e) {
81
+ const { options: r, labelKey: t, valueKey: a } = j(e);
82
82
  return {
83
83
  options: r,
84
84
  getOptionLabel: (n) => typeof n != "object" && n !== null ? n : typeof t.value == "function" ? t.value(n) : n[t.value],
85
- getOptionValue: (n) => typeof n != "object" && n !== null ? n : typeof l.value == "function" ? l.value(n) : n[l.value]
85
+ getOptionValue: (n) => typeof n != "object" && n !== null ? n : typeof a.value == "function" ? a.value(n) : n[a.value]
86
86
  };
87
87
  }
88
- function we(e, r) {
89
- const { focused: t } = ge(e);
90
- return oe(t, (l) => {
91
- r(l ? "focus" : "blur", u(e));
88
+ function $e(e, r) {
89
+ const { focused: t } = be(e);
90
+ return J(t, (a) => {
91
+ r(a ? "focus" : "blur", c(e));
92
92
  }), {
93
93
  focused: t
94
94
  };
95
95
  }
96
- const Oe = "ds", $e = {
96
+ const Ce = "ds", we = {
97
97
  color: String,
98
98
  width: {
99
99
  type: [String, Number]
@@ -124,20 +124,20 @@ const Oe = "ds", $e = {
124
124
  modifiers: {
125
125
  type: [String, Array]
126
126
  }
127
- }, Ce = {
127
+ }, Fe = {
128
128
  name: "VvIcon"
129
- }, K = /* @__PURE__ */ G({
130
- ...Ce,
131
- props: $e,
129
+ }, G = /* @__PURE__ */ X({
130
+ ...Fe,
131
+ props: we,
132
132
  setup(e) {
133
- const r = e, t = J(!0), { modifiers: l } = j(r), a = se(Oe), { bemCssClasses: c } = X("vv-icon", {
134
- modifiers: l
135
- }), n = i(() => r.provider || (a == null ? void 0 : a.provider)), h = i(() => {
133
+ const r = e, t = Q(!0), { modifiers: a } = j(r), l = ae(Ce), { bemCssClasses: d } = Y("vv-icon", {
134
+ modifiers: a
135
+ }), n = i(() => r.provider || (l == null ? void 0 : l.provider)), h = i(() => {
136
136
  const o = r.name ?? "", s = `@${n.value}:${r.prefix}:${r.name}`;
137
- return F(o) ? o : F(s) ? s : (a == null ? void 0 : a.iconsCollections.find((m) => {
138
- const d = `@${n.value}:${m.prefix}:${o}`;
139
- if (F(d))
140
- return d;
137
+ return F(o) ? o : F(s) ? s : (l == null ? void 0 : l.iconsCollections.find((m) => {
138
+ const f = `@${n.value}:${m.prefix}:${o}`;
139
+ if (F(f))
140
+ return f;
141
141
  })) || o;
142
142
  });
143
143
  function p(o) {
@@ -148,21 +148,21 @@ const Oe = "ds", $e = {
148
148
  }
149
149
  return (s ? new s.DOMParser() : new window.DOMParser()).parseFromString(o, "text/html").querySelector("svg");
150
150
  }
151
- function f(o) {
151
+ function v(o) {
152
152
  const s = p(o), m = (s == null ? void 0 : s.innerHTML.trim()) || "";
153
- s && m && be(`@${n.value}:${r.prefix}:${r.name}`, {
153
+ s && m && Pe(`@${n.value}:${r.prefix}:${r.name}`, {
154
154
  body: m,
155
155
  height: s.viewBox.baseVal.height,
156
156
  width: s.viewBox.baseVal.width
157
157
  });
158
158
  }
159
- return a && (r.src && !F(`@${n.value}:${r.prefix}:${r.name}`) ? (t.value = !1, a.fetchIcon(r.src).then((o) => {
160
- o && (f(o), t.value = !0);
159
+ return l && (r.src && !F(`@${n.value}:${r.prefix}:${r.name}`) ? (t.value = !1, l.fetchIcon(r.src).then((o) => {
160
+ o && (v(o), t.value = !0);
161
161
  }).catch((o) => {
162
162
  throw new Error(`During fetch icon: ${o == null ? void 0 : o.message}`);
163
- })) : r.svg && f(r.svg)), (o, s) => t.value ? (y(), R(u(ye), D({
163
+ })) : r.svg && v(r.svg)), (o, s) => t.value ? (y(), R(c(Ve), D({
164
164
  key: 0,
165
- class: u(c)
165
+ class: c(d)
166
166
  }, {
167
167
  inline: o.inline,
168
168
  width: o.width,
@@ -173,41 +173,41 @@ const Oe = "ds", $e = {
173
173
  rotate: o.rotate,
174
174
  color: o.color,
175
175
  onLoad: o.onLoad,
176
- icon: u(h)
177
- }), null, 16, ["class"])) : $("", !0);
176
+ icon: c(h)
177
+ }), null, 16, ["class"])) : O("", !0);
178
178
  }
179
179
  });
180
180
  function _(e) {
181
- return Array.isArray(e) ? e.filter((r) => Se(r)).join(" ") : e;
181
+ return Array.isArray(e) ? e.filter((r) => Ae(r)).join(" ") : e;
182
182
  }
183
- function Pe(e, r) {
183
+ function _e(e, r) {
184
184
  const {
185
185
  invalid: t,
186
- valid: l,
187
- hint: a,
188
- loading: c
186
+ valid: a,
187
+ hint: l,
188
+ loading: d
189
189
  } = r, {
190
190
  hintLabel: n,
191
191
  modelValue: h,
192
192
  valid: p,
193
- validLabel: f,
193
+ validLabel: v,
194
194
  invalid: o,
195
195
  invalidLabel: s,
196
196
  ...m
197
- } = j(e), d = q(m, "loading"), g = q(m, "loadingLabel"), b = i(() => o.value ? !!(o.value && t || s != null && s.value && Array.isArray(s.value) && s.value.length > 0 || s != null && s.value && !U(s)) : !1), I = i(
198
- () => !!(n && n.value || a)
199
- ), S = i(
200
- () => !!(f && f.value || l)
201
- ), C = i(
202
- () => !!(d != null && d.value && c || d != null && d.value && (g != null && g.value))
197
+ } = j(e), f = K(m, "loading"), g = K(m, "loadingLabel"), b = i(() => o.value ? !!(o.value && t || s != null && s.value && Array.isArray(s.value) && s.value.length > 0 || s != null && s.value && !W(s)) : !1), $ = i(
198
+ () => !!(n && n.value || l)
199
+ ), V = i(
200
+ () => !!(v && v.value || a)
201
+ ), I = i(
202
+ () => !!(f != null && f.value && d || f != null && f.value && (g != null && g.value))
203
203
  ), P = i(
204
- () => I.value || S.value || b.value || C.value
204
+ () => $.value || V.value || b.value || I.value
205
205
  );
206
206
  return {
207
207
  hasInvalid: b,
208
- hasHint: I,
209
- hasValid: S,
210
- hasLoading: C,
208
+ hasHint: $,
209
+ hasValid: V,
210
+ hasLoading: I,
211
211
  HintSlot: {
212
212
  name: "HintSlot",
213
213
  props: {
@@ -216,31 +216,31 @@ function Pe(e, r) {
216
216
  default: () => ({})
217
217
  }
218
218
  },
219
- setup(B) {
220
- const A = i(() => {
221
- const V = he({
219
+ setup(C) {
220
+ const k = i(() => {
221
+ const S = Se({
222
222
  hintLabel: n,
223
223
  modelValue: h,
224
224
  valid: p,
225
- validLabel: f,
225
+ validLabel: v,
226
226
  invalid: o,
227
227
  invalidLabel: s,
228
- loading: d,
228
+ loading: f,
229
229
  loadingLabel: g,
230
- ...B.params
230
+ ...C.params
231
231
  });
232
- return o != null && o.value ? (t == null ? void 0 : t(V)) || _(s == null ? void 0 : s.value) || (n == null ? void 0 : n.value) : p != null && p.value ? (l == null ? void 0 : l(V)) || _(f == null ? void 0 : f.value) || (n == null ? void 0 : n.value) : d != null && d.value ? (c == null ? void 0 : c(V)) || _(g == null ? void 0 : g.value) || (n == null ? void 0 : n.value) : (a == null ? void 0 : a(V)) || _(n == null ? void 0 : n.value) || (n == null ? void 0 : n.value);
232
+ return o != null && o.value ? (t == null ? void 0 : t(S)) || _(s == null ? void 0 : s.value) || (n == null ? void 0 : n.value) : p != null && p.value ? (a == null ? void 0 : a(S)) || _(v == null ? void 0 : v.value) || (n == null ? void 0 : n.value) : f != null && f.value ? (d == null ? void 0 : d(S)) || _(g == null ? void 0 : g.value) || (n == null ? void 0 : n.value) : (l == null ? void 0 : l(S)) || _(n == null ? void 0 : n.value) || (n == null ? void 0 : n.value);
233
233
  });
234
234
  return {
235
235
  isVisible: P,
236
236
  hasInvalid: b,
237
- hasValid: S,
238
- hintContent: A
237
+ hasValid: V,
238
+ hintContent: k
239
239
  };
240
240
  },
241
241
  render() {
242
242
  if (this.isVisible)
243
- return ae(
243
+ return ue(
244
244
  "small",
245
245
  {
246
246
  role: this.hasInvalid || this.hasValid ? "alert" : void 0
@@ -251,59 +251,69 @@ function Pe(e, r) {
251
251
  }
252
252
  };
253
253
  }
254
- const Be = {
254
+ const De = {
255
255
  valid: Boolean,
256
256
  validLabel: [String, Array]
257
- }, Ae = {
257
+ }, je = {
258
258
  invalid: Boolean,
259
259
  invalidLabel: [String, Array]
260
- }, Fe = {
260
+ }, ke = {
261
261
  loading: Boolean,
262
262
  loadingLabel: String
263
- }, _e = {
263
+ }, Ne = {
264
264
  disabled: Boolean
265
- }, De = {
265
+ }, Ee = {
266
266
  readonly: Boolean
267
- }, je = {
267
+ }, Re = {
268
268
  modifiers: [String, Array]
269
- }, ke = {
269
+ }, ze = {
270
270
  hintLabel: { type: String, default: "" }
271
- }, Ne = {
271
+ }, He = {
272
272
  options: {
273
273
  type: Array,
274
274
  default: () => []
275
275
  },
276
276
  labelKey: { type: [String, Function], default: "label" },
277
277
  valueKey: { type: [String, Function], default: "value" }
278
- }, Z = {
278
+ }, U = {
279
279
  LEFT: "left",
280
280
  RIGHT: "right"
281
- }, Re = {
281
+ }, Me = {
282
282
  icon: { type: [String, Object] },
283
283
  iconPosition: {
284
284
  type: String,
285
- validation: (e) => Object.values(Z).includes(e),
286
- default: Z.RIGHT
285
+ validation: (e) => Object.values(U).includes(e),
286
+ default: U.RIGHT
287
287
  }
288
- }, ze = {
288
+ }, Te = {
289
289
  tabindex: { type: [String, Number], default: 0 }
290
- }, Ee = {
290
+ }, qe = {
291
+ floating: Boolean
292
+ }, Le = {
293
+ unselectable: { type: Boolean, default: !0 }
294
+ }, Ke = {
291
295
  id: [String, Number],
292
296
  name: { type: String, required: !0 }
293
- }, He = {
294
- ...Ee,
295
- ...ze,
296
- ...Be,
297
- ...Ae,
298
- ...ke,
299
- ...Fe,
300
- ..._e,
297
+ }, Ze = {
298
+ autofocus: Boolean
299
+ }, Ge = {
300
+ autocomplete: { type: String, default: "off" }
301
+ }, Ue = {
302
+ ...Ke,
303
+ ...Ze,
304
+ ...Ge,
305
+ ...Te,
301
306
  ...De,
302
307
  ...je,
308
+ ...ze,
309
+ ...ke,
303
310
  ...Ne,
311
+ ...Ee,
304
312
  ...Re,
305
- autocomplete: { type: String, default: "off" },
306
- autofocus: Boolean,
313
+ ...He,
314
+ ...Me,
315
+ ...qe,
316
+ ...Le,
307
317
  multiple: Boolean,
308
318
  required: Boolean,
309
319
  size: [String, Number],
@@ -313,103 +323,112 @@ const Be = {
313
323
  },
314
324
  label: String,
315
325
  placeholder: String
316
- }, Me = ["update:modelValue", "focus", "blur"], Te = ["for"], qe = { class: "vv-select__wrapper" }, Le = ["id"], Ke = {
317
- key: 0,
318
- value: void 0,
319
- disabled: ""
320
- }, Ze = ["disabled", "value"], Ge = {
326
+ }, Je = ["update:modelValue", "focus", "blur"], Xe = ["for"], Qe = { class: "vv-select__wrapper" }, We = ["id"], Ye = ["disabled", "hidden"], xe = ["disabled", "value"], et = {
321
327
  name: "VvSelect"
322
- }, Qe = /* @__PURE__ */ G({
323
- ...Ge,
324
- props: He,
325
- emits: Me,
328
+ }, st = /* @__PURE__ */ X({
329
+ ...et,
330
+ props: Ue,
331
+ emits: Je,
326
332
  setup(e, { emit: r }) {
327
- const t = e, l = ie(), a = J(), { HintSlot: c, hasHint: n, hasInvalid: h } = Pe(t, l), {
333
+ const t = e, a = ce(), l = Q(), { HintSlot: d, hasHint: n, hasInvalid: h } = _e(t, a), {
328
334
  modifiers: p,
329
- disabled: f,
335
+ disabled: v,
330
336
  readonly: o,
331
337
  loading: s,
332
338
  icon: m,
333
- iconPosition: d,
339
+ iconPosition: f,
334
340
  invalid: g,
335
- valid: b
336
- } = j(t), I = i(() => String(t.id || me())), S = i(() => `${I.value}-hint`), { focused: C } = we(a, r), { hasIcon: P, hasIconLeft: B, hasIconRight: A } = Ie(
341
+ valid: b,
342
+ floating: $,
343
+ multiple: V
344
+ } = j(t), I = i(() => String(t.id || ye())), P = i(() => `${I.value}-hint`), { focused: C } = $e(l, r), k = Ie(l);
345
+ J(k, (u) => {
346
+ u && t.autofocus && (C.value = !0);
347
+ });
348
+ const { hasIcon: S, hasIconLeft: z, hasIconRight: H } = Be(
337
349
  m,
338
- d
339
- ), V = i(() => !U(t.modelValue)), z = i(() => t.disabled || t.readonly), x = i(() => z.value ? -1 : t.tabindex), Q = i(() => {
350
+ f
351
+ ), x = i(() => !W(t.modelValue)), M = i(() => t.disabled || t.readonly), ee = i(() => M.value ? -1 : t.tabindex), te = i(() => {
340
352
  if (t.invalid === !0)
341
353
  return !0;
342
354
  if (t.valid === !0)
343
355
  return !1;
344
- }), { bemCssClasses: W } = X("vv-select", {
356
+ }), { bemCssClasses: re } = Y("vv-select", {
345
357
  modifiers: p,
346
358
  valid: b,
347
359
  invalid: g,
348
360
  loading: s,
349
- disabled: f,
361
+ disabled: v,
350
362
  readonly: o,
351
- iconLeft: B,
352
- iconRight: A,
353
- dirty: V,
354
- focus: C
355
- }), Y = i(() => ({
363
+ iconLeft: z,
364
+ iconRight: H,
365
+ dirty: x,
366
+ focus: C,
367
+ floating: $,
368
+ multiple: V
369
+ }), ne = i(() => ({
356
370
  name: t.name,
357
- tabindex: x.value,
358
- disabled: z.value,
371
+ tabindex: ee.value,
372
+ disabled: M.value,
359
373
  required: t.required,
360
374
  size: t.size,
361
375
  autocomplete: t.autocomplete,
362
376
  multiple: t.multiple,
363
- "aria-invalid": Q.value,
364
- "aria-describedby": !h.value && n.value ? S.value : void 0,
365
- "aria-errormessage": h.value ? S.value : void 0
366
- })), { getOptionLabel: ee, getOptionValue: te } = Ve(t);
367
- function re(v) {
368
- return typeof v == "string" || v.disabled === void 0 ? f.value : v.disabled;
377
+ "aria-invalid": te.value,
378
+ "aria-describedby": !h.value && n.value ? P.value : void 0,
379
+ "aria-errormessage": h.value ? P.value : void 0
380
+ })), { getOptionLabel: oe, getOptionValue: se } = Oe(t);
381
+ function le(u) {
382
+ return typeof u == "string" || u.disabled === void 0 ? v.value : u.disabled;
369
383
  }
370
- const k = i({
384
+ const N = i({
371
385
  get: () => t.modelValue,
372
- set: (v) => {
373
- r("update:modelValue", v);
386
+ set: (u) => {
387
+ Array.isArray(u) && (u = u.filter((w) => w !== void 0)), r("update:modelValue", u);
374
388
  }
375
389
  });
376
- return (v, E) => (y(), O("div", {
377
- class: le(u(W))
390
+ return (u, w) => (y(), B("div", {
391
+ class: de(c(re))
378
392
  }, [
379
- v.label ? (y(), O("label", {
393
+ u.label ? (y(), B("label", {
380
394
  key: 0,
381
- for: u(I)
382
- }, N(v.label), 9, Te)) : $("", !0),
383
- H("div", qe, [
384
- M(v.$slots, "before", {}, () => [
385
- u(B) ? (y(), R(K, T(D({ key: 0 }, u(P))), null, 16)) : $("", !0)
395
+ for: c(I)
396
+ }, E(u.label), 9, Xe)) : O("", !0),
397
+ T("div", Qe, [
398
+ q(u.$slots, "before", {}, () => [
399
+ c(z) ? (y(), R(G, L(D({ key: 0 }, c(S))), null, 16)) : O("", !0)
386
400
  ]),
387
- ue(H("select", D({
388
- id: u(I),
401
+ fe(T("select", D({
402
+ id: c(I),
389
403
  ref_key: "select",
390
- ref: a,
391
- "onUpdate:modelValue": E[0] || (E[0] = (w) => ce(k) ? k.value = w : null)
392
- }, u(Y)), [
393
- v.placeholder ? (y(), O("option", Ke, N(v.placeholder), 1)) : $("", !0),
394
- (y(!0), O(de, null, fe(v.options, (w, ne) => (y(), O("option", {
395
- key: ne,
396
- disabled: re(w),
397
- value: u(te)(w)
398
- }, N(u(ee)(w)), 9, Ze))), 128))
399
- ], 16, Le), [
400
- [ve, u(k)]
404
+ ref: l,
405
+ "onUpdate:modelValue": w[0] || (w[0] = (A) => ve(N) ? N.value = A : null)
406
+ }, c(ne)), [
407
+ u.placeholder ? (y(), B("option", {
408
+ key: 0,
409
+ value: void 0,
410
+ disabled: !u.unselectable,
411
+ hidden: !u.unselectable
412
+ }, E(u.placeholder), 9, Ye)) : O("", !0),
413
+ (y(!0), B(pe, null, me(u.options, (A, ie) => (y(), B("option", {
414
+ key: ie,
415
+ disabled: le(A),
416
+ value: c(se)(A)
417
+ }, E(c(oe)(A)), 9, xe))), 128))
418
+ ], 16, We), [
419
+ [ge, c(N)]
401
420
  ]),
402
- M(v.$slots, "after", {}, () => [
403
- u(A) ? (y(), R(K, T(D({ key: 0 }, u(P))), null, 16)) : $("", !0)
421
+ q(u.$slots, "after", {}, () => [
422
+ c(H) ? (y(), R(G, L(D({ key: 0 }, c(S))), null, 16)) : O("", !0)
404
423
  ])
405
424
  ]),
406
- pe(u(c), {
407
- id: u(S),
425
+ he(c(d), {
426
+ id: c(P),
408
427
  class: "vv-select__hint"
409
428
  }, null, 8, ["id"])
410
429
  ], 2));
411
430
  }
412
431
  });
413
432
  export {
414
- Qe as default
433
+ st as default
415
434
  };
@@ -1 +1 @@
1
- (function(e,I){typeof exports=="object"&&typeof module<"u"?module.exports=I(require("vue"),require("nanoid"),require("@vueuse/core"),require("@iconify/vue")):typeof define=="function"&&define.amd?define(["vue","nanoid","@vueuse/core","@iconify/vue"],I):(e=typeof globalThis<"u"?globalThis:e||self,e.VvSelect=I(e.vue,e.nanoid,e.core,e.vue$1))})(this,function(e,I,_,b){"use strict";function A(t,r){if(t&&Object.keys(t).length&&r){if(r.indexOf(".")===-1)return t[r];{const n=r.split(".");let l=t;for(let a=0,c=n.length;a<c;++a){if(t==null)return null;l=l[n[a]]}return l}}else return null}function $(t){return(r=>r==null||r===""||Array.isArray(r)&&r.length===0||!(r instanceof Date)&&typeof r=="object"&&Object.keys(r).length===0)(e.unref(t))}function z(t){return typeof t=="string"||t instanceof String}function E(t){var r,n;if(t)return(n=(r=t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:r.join("-"))==null?void 0:n.toLowerCase()}function F(t,r){const n={[`${t}`]:!0};return{bemCssClasses:e.computed(()=>Object.keys(r).reduce((a,c)=>{const o=e.unref(r[c])||!1;if(!o)return a;if(c==="modifiers"){const h=Array.isArray(o)?o:o.split(" ");return{...a,...h.reduce((p,d)=>({...p,[`${t}--${E(d)}`]:!0}),{})}}else return{...a,[`${t}--${E(c)}`]:o}},n)||{})}}function T(t,r,n){const l=e.computed(()=>!!(t!=null&&t.value&&r.value==="left"||n!=null&&n.iconLeft)),a=e.computed(()=>!!(t!=null&&t.value&&r.value==="right"||n!=null&&n.iconRight)),c=e.computed(()=>!!(t!=null&&t.value&&r.value==="top"||n!=null&&n.iconTop)),o=e.computed(()=>!!(t!=null&&t.value&&r.value==="bottom"||n!=null&&n.iconBottom));return{hasIcon:e.computed(()=>typeof(t==null?void 0:t.value)=="string"?{name:t==null?void 0:t.value}:t==null?void 0:t.value),hasIconLeft:l,hasIconRight:a,hasIconTop:c,hasIconBottom:o}}function H(t){const{options:r,labelKey:n,valueKey:l}=e.toRefs(t);return{options:r,getOptionLabel:o=>typeof o!="object"&&o!==null?o:typeof n.value=="function"?n.value(o):o[n.value],getOptionValue:o=>typeof o!="object"&&o!==null?o:typeof l.value=="function"?l.value(o):o[l.value]}}function M(t,r){const{focused:n}=_.useFocus(t);return e.watch(n,l=>{r(l?"focus":"blur",e.unref(t))}),{focused:n}}const x="ds",L={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}},K={name:"VvIcon"},D=e.defineComponent({...K,props:L,setup(t){const r=t,n=e.ref(!0),{modifiers:l}=e.toRefs(r),a=e.inject(x),{bemCssClasses:c}=F("vv-icon",{modifiers:l}),o=e.computed(()=>r.provider||(a==null?void 0:a.provider)),h=e.computed(()=>{const s=r.name??"",i=`@${o.value}:${r.prefix}:${r.name}`;return b.iconExists(s)?s:b.iconExists(i)?i:(a==null?void 0:a.iconsCollections.find(m=>{const u=`@${o.value}:${m.prefix}:${s}`;if(b.iconExists(u))return u}))||s});function p(s){let i=null;if(typeof window>"u"){const{JSDOM:y}=require("jsdom");i=new y().window}return(i?new i.DOMParser:new window.DOMParser).parseFromString(s,"text/html").querySelector("svg")}function d(s){const i=p(s),m=(i==null?void 0:i.innerHTML.trim())||"";i&&m&&b.addIcon(`@${o.value}:${r.prefix}:${r.name}`,{body:m,height:i.viewBox.baseVal.height,width:i.viewBox.baseVal.width})}return a&&(r.src&&!b.iconExists(`@${o.value}:${r.prefix}:${r.name}`)?(n.value=!1,a.fetchIcon(r.src).then(s=>{s&&(d(s),n.value=!0)}).catch(s=>{throw new Error(`During fetch icon: ${s==null?void 0:s.message}`)})):r.svg&&d(r.svg)),(s,i)=>n.value?(e.openBlock(),e.createBlock(e.unref(b.Icon),e.mergeProps({key:0,class:e.unref(c)},{inline:s.inline,width:s.width,height:s.height,horizontalFlip:s.horizontalFlip,verticalFlip:s.verticalFlip,flip:s.flip,rotate:s.rotate,color:s.color,onLoad:s.onLoad,icon:e.unref(h)}),null,16,["class"])):e.createCommentVNode("",!0)}});function k(t){return Array.isArray(t)?t.filter(r=>z(r)).join(" "):t}function Z(t,r){const{invalid:n,valid:l,hint:a,loading:c}=r,{hintLabel:o,modelValue:h,valid:p,validLabel:d,invalid:s,invalidLabel:i,...m}=e.toRefs(t),u=A(m,"loading"),g=A(m,"loadingLabel"),y=e.computed(()=>s.value?!!(s.value&&n||i!=null&&i.value&&Array.isArray(i.value)&&i.value.length>0||i!=null&&i.value&&!$(i)):!1),B=e.computed(()=>!!(o&&o.value||a)),S=e.computed(()=>!!(d&&d.value||l)),C=e.computed(()=>!!(u!=null&&u.value&&c||u!=null&&u.value&&(g!=null&&g.value))),v=e.computed(()=>B.value||S.value||y.value||C.value);return{hasInvalid:y,hasHint:B,hasValid:S,hasLoading:C,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(w){const O=e.computed(()=>{const V=_.toReactive({hintLabel:o,modelValue:h,valid:p,validLabel:d,invalid:s,invalidLabel:i,loading:u,loadingLabel:g,...w.params});return s!=null&&s.value?(n==null?void 0:n(V))||k(i==null?void 0:i.value)||(o==null?void 0:o.value):p!=null&&p.value?(l==null?void 0:l(V))||k(d==null?void 0:d.value)||(o==null?void 0:o.value):u!=null&&u.value?(c==null?void 0:c(V))||k(g==null?void 0:g.value)||(o==null?void 0:o.value):(a==null?void 0:a(V))||k(o==null?void 0:o.value)||(o==null?void 0:o.value)});return{isVisible:v,hasInvalid:y,hasValid:S,hintContent:O}},render(){if(this.isVisible)return e.h("small",{role:this.hasInvalid||this.hasValid?"alert":void 0},this.hintContent)}}}}const G={valid:Boolean,validLabel:[String,Array]},J={invalid:Boolean,invalidLabel:[String,Array]},U={loading:Boolean,loadingLabel:String},X={disabled:Boolean},Q={readonly:Boolean},W={modifiers:[String,Array]},Y={hintLabel:{type:String,default:""}},ee={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"}},j={LEFT:"left",RIGHT:"right"},te={icon:{type:[String,Object]},iconPosition:{type:String,validation:t=>Object.values(j).includes(t),default:j.RIGHT}},ne={...{id:[String,Number],name:{type:String,required:!0}},...{tabindex:{type:[String,Number],default:0}},...G,...J,...Y,...U,...X,...Q,...W,...ee,...te,autocomplete:{type:String,default:"off"},autofocus:Boolean,multiple:Boolean,required:Boolean,size:[String,Number],modelValue:{type:[String,Number,Boolean,Object,Array],default:void 0},label:String,placeholder:String},re=["update:modelValue","focus","blur"],oe=["for"],se={class:"vv-select__wrapper"},ie=["id"],ae={key:0,value:void 0,disabled:""},le=["disabled","value"],ce={name:"VvSelect"};return e.defineComponent({...ce,props:ne,emits:re,setup(t,{emit:r}){const n=t,l=e.useSlots(),a=e.ref(),{HintSlot:c,hasHint:o,hasInvalid:h}=Z(n,l),{modifiers:p,disabled:d,readonly:s,loading:i,icon:m,iconPosition:u,invalid:g,valid:y}=e.toRefs(n),B=e.computed(()=>String(n.id||I.nanoid())),S=e.computed(()=>`${B.value}-hint`),{focused:C}=M(a,r),{hasIcon:v,hasIconLeft:w,hasIconRight:O}=T(m,u),V=e.computed(()=>!$(n.modelValue)),R=e.computed(()=>n.disabled||n.readonly),ue=e.computed(()=>R.value?-1:n.tabindex),de=e.computed(()=>{if(n.invalid===!0)return!0;if(n.valid===!0)return!1}),{bemCssClasses:fe}=F("vv-select",{modifiers:p,valid:y,invalid:g,loading:i,disabled:d,readonly:s,iconLeft:w,iconRight:O,dirty:V,focus:C}),pe=e.computed(()=>({name:n.name,tabindex:ue.value,disabled:R.value,required:n.required,size:n.size,autocomplete:n.autocomplete,multiple:n.multiple,"aria-invalid":de.value,"aria-describedby":!h.value&&o.value?S.value:void 0,"aria-errormessage":h.value?S.value:void 0})),{getOptionLabel:me,getOptionValue:ge}=H(n);function he(f){return typeof f=="string"||f.disabled===void 0?d.value:f.disabled}const N=e.computed({get:()=>n.modelValue,set:f=>{r("update:modelValue",f)}});return(f,q)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(fe))},[f.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(B)},e.toDisplayString(f.label),9,oe)):e.createCommentVNode("",!0),e.createElementVNode("div",se,[e.renderSlot(f.$slots,"before",{},()=>[e.unref(w)?(e.openBlock(),e.createBlock(D,e.normalizeProps(e.mergeProps({key:0},e.unref(v))),null,16)):e.createCommentVNode("",!0)]),e.withDirectives(e.createElementVNode("select",e.mergeProps({id:e.unref(B),ref_key:"select",ref:a,"onUpdate:modelValue":q[0]||(q[0]=P=>e.isRef(N)?N.value=P:null)},e.unref(pe)),[f.placeholder?(e.openBlock(),e.createElementBlock("option",ae,e.toDisplayString(f.placeholder),1)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.options,(P,ye)=>(e.openBlock(),e.createElementBlock("option",{key:ye,disabled:he(P),value:e.unref(ge)(P)},e.toDisplayString(e.unref(me)(P)),9,le))),128))],16,ie),[[e.vModelSelect,e.unref(N)]]),e.renderSlot(f.$slots,"after",{},()=>[e.unref(O)?(e.openBlock(),e.createBlock(D,e.normalizeProps(e.mergeProps({key:0},e.unref(v))),null,16)):e.createCommentVNode("",!0)])]),e.createVNode(e.unref(c),{id:e.unref(S),class:"vv-select__hint"},null,8,["id"])],2))}})});
1
+ (function(e,P){typeof exports=="object"&&typeof module<"u"?module.exports=P(require("vue"),require("nanoid"),require("@vueuse/core"),require("@iconify/vue")):typeof define=="function"&&define.amd?define(["vue","nanoid","@vueuse/core","@iconify/vue"],P):(e=typeof globalThis<"u"?globalThis:e||self,e.VvSelect=P(e.vue,e.nanoid,e.core,e.vue$1))})(this,function(e,P,w,S){"use strict";function E(t,r){if(t&&Object.keys(t).length&&r){if(r.indexOf(".")===-1)return t[r];{const n=r.split(".");let a=t;for(let l=0,u=n.length;l<u;++l){if(t==null)return null;a=a[n[l]]}return a}}else return null}function $(t){return(r=>r==null||r===""||Array.isArray(r)&&r.length===0||!(r instanceof Date)&&typeof r=="object"&&Object.keys(r).length===0)(e.unref(t))}function H(t){return typeof t=="string"||t instanceof String}function _(t){var r,n;if(t)return(n=(r=t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:r.join("-"))==null?void 0:n.toLowerCase()}function D(t,r){const n={[`${t}`]:!0};return{bemCssClasses:e.computed(()=>Object.keys(r).reduce((l,u)=>{const o=e.unref(r[u])||!1;if(!o)return l;if(u==="modifiers"){const y=Array.isArray(o)?o:o.split(" ");return{...l,...y.reduce((p,f)=>({...p,[`${t}--${_(f)}`]:!0}),{})}}else return{...l,[`${t}--${_(u)}`]:o}},n)||{})}}function M(t,r,n){const a=e.computed(()=>!!(t!=null&&t.value&&r.value==="left"||n!=null&&n.iconLeft)),l=e.computed(()=>!!(t!=null&&t.value&&r.value==="right"||n!=null&&n.iconRight)),u=e.computed(()=>!!(t!=null&&t.value&&r.value==="top"||n!=null&&n.iconTop)),o=e.computed(()=>!!(t!=null&&t.value&&r.value==="bottom"||n!=null&&n.iconBottom));return{hasIcon:e.computed(()=>typeof(t==null?void 0:t.value)=="string"?{name:t==null?void 0:t.value}:t==null?void 0:t.value),hasIconLeft:a,hasIconRight:l,hasIconTop:u,hasIconBottom:o}}function L(t){const{options:r,labelKey:n,valueKey:a}=e.toRefs(t);return{options:r,getOptionLabel:o=>typeof o!="object"&&o!==null?o:typeof n.value=="function"?n.value(o):o[n.value],getOptionValue:o=>typeof o!="object"&&o!==null?o:typeof a.value=="function"?a.value(o):o[a.value]}}function K(t,r){const{focused:n}=w.useFocus(t);return e.watch(n,a=>{r(a?"focus":"blur",e.unref(t))}),{focused:n}}const Z="ds",x={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}},U={name:"VvIcon"},j=e.defineComponent({...U,props:x,setup(t){const r=t,n=e.ref(!0),{modifiers:a}=e.toRefs(r),l=e.inject(Z),{bemCssClasses:u}=D("vv-icon",{modifiers:a}),o=e.computed(()=>r.provider||(l==null?void 0:l.provider)),y=e.computed(()=>{const s=r.name??"",i=`@${o.value}:${r.prefix}:${r.name}`;return S.iconExists(s)?s:S.iconExists(i)?i:(l==null?void 0:l.iconsCollections.find(m=>{const d=`@${o.value}:${m.prefix}:${s}`;if(S.iconExists(d))return d}))||s});function p(s){let i=null;if(typeof window>"u"){const{JSDOM:h}=require("jsdom");i=new h().window}return(i?new i.DOMParser:new window.DOMParser).parseFromString(s,"text/html").querySelector("svg")}function f(s){const i=p(s),m=(i==null?void 0:i.innerHTML.trim())||"";i&&m&&S.addIcon(`@${o.value}:${r.prefix}:${r.name}`,{body:m,height:i.viewBox.baseVal.height,width:i.viewBox.baseVal.width})}return l&&(r.src&&!S.iconExists(`@${o.value}:${r.prefix}:${r.name}`)?(n.value=!1,l.fetchIcon(r.src).then(s=>{s&&(f(s),n.value=!0)}).catch(s=>{throw new Error(`During fetch icon: ${s==null?void 0:s.message}`)})):r.svg&&f(r.svg)),(s,i)=>n.value?(e.openBlock(),e.createBlock(e.unref(S.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:s.inline,width:s.width,height:s.height,horizontalFlip:s.horizontalFlip,verticalFlip:s.verticalFlip,flip:s.flip,rotate:s.rotate,color:s.color,onLoad:s.onLoad,icon:e.unref(y)}),null,16,["class"])):e.createCommentVNode("",!0)}});function C(t){return Array.isArray(t)?t.filter(r=>H(r)).join(" "):t}function G(t,r){const{invalid:n,valid:a,hint:l,loading:u}=r,{hintLabel:o,modelValue:y,valid:p,validLabel:f,invalid:s,invalidLabel:i,...m}=e.toRefs(t),d=E(m,"loading"),g=E(m,"loadingLabel"),h=e.computed(()=>s.value?!!(s.value&&n||i!=null&&i.value&&Array.isArray(i.value)&&i.value.length>0||i!=null&&i.value&&!$(i)):!1),v=e.computed(()=>!!(o&&o.value||l)),V=e.computed(()=>!!(f&&f.value||a)),B=e.computed(()=>!!(d!=null&&d.value&&u||d!=null&&d.value&&(g!=null&&g.value))),I=e.computed(()=>v.value||V.value||h.value||B.value);return{hasInvalid:h,hasHint:v,hasValid:V,hasLoading:B,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(A){const F=e.computed(()=>{const b=w.toReactive({hintLabel:o,modelValue:y,valid:p,validLabel:f,invalid:s,invalidLabel:i,loading:d,loadingLabel:g,...A.params});return s!=null&&s.value?(n==null?void 0:n(b))||C(i==null?void 0:i.value)||(o==null?void 0:o.value):p!=null&&p.value?(a==null?void 0:a(b))||C(f==null?void 0:f.value)||(o==null?void 0:o.value):d!=null&&d.value?(u==null?void 0:u(b))||C(g==null?void 0:g.value)||(o==null?void 0:o.value):(l==null?void 0:l(b))||C(o==null?void 0:o.value)||(o==null?void 0:o.value)});return{isVisible:I,hasInvalid:h,hasValid:V,hintContent:F}},render(){if(this.isVisible)return e.h("small",{role:this.hasInvalid||this.hasValid?"alert":void 0},this.hintContent)}}}}const J={valid:Boolean,validLabel:[String,Array]},X={invalid:Boolean,invalidLabel:[String,Array]},Q={loading:Boolean,loadingLabel:String},W={disabled:Boolean},Y={readonly:Boolean},ee={modifiers:[String,Array]},te={hintLabel:{type:String,default:""}},ne={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"}},R={LEFT:"left",RIGHT:"right"},re={icon:{type:[String,Object]},iconPosition:{type:String,validation:t=>Object.values(R).includes(t),default:R.RIGHT}},oe={...{id:[String,Number],name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...{tabindex:{type:[String,Number],default:0}},...J,...X,...te,...Q,...W,...Y,...ee,...ne,...re,...{floating:Boolean},...{unselectable:{type:Boolean,default:!0}},multiple:Boolean,required:Boolean,size:[String,Number],modelValue:{type:[String,Number,Boolean,Object,Array],default:void 0},label:String,placeholder:String},se=["update:modelValue","focus","blur"],ie=["for"],le={class:"vv-select__wrapper"},ae=["id"],ce=["disabled","hidden"],ue=["disabled","value"],de={name:"VvSelect"};return e.defineComponent({...de,props:oe,emits:se,setup(t,{emit:r}){const n=t,a=e.useSlots(),l=e.ref(),{HintSlot:u,hasHint:o,hasInvalid:y}=G(n,a),{modifiers:p,disabled:f,readonly:s,loading:i,icon:m,iconPosition:d,invalid:g,valid:h,floating:v,multiple:V}=e.toRefs(n),B=e.computed(()=>String(n.id||P.nanoid())),I=e.computed(()=>`${B.value}-hint`),{focused:A}=K(l,r),F=w.useElementVisibility(l);e.watch(F,c=>{c&&n.autofocus&&(A.value=!0)});const{hasIcon:b,hasIconLeft:q,hasIconRight:z}=M(m,d),fe=e.computed(()=>!$(n.modelValue)),T=e.computed(()=>n.disabled||n.readonly),pe=e.computed(()=>T.value?-1:n.tabindex),me=e.computed(()=>{if(n.invalid===!0)return!0;if(n.valid===!0)return!1}),{bemCssClasses:ge}=D("vv-select",{modifiers:p,valid:h,invalid:g,loading:i,disabled:f,readonly:s,iconLeft:q,iconRight:z,dirty:fe,focus:A,floating:v,multiple:V}),ye=e.computed(()=>({name:n.name,tabindex:pe.value,disabled:T.value,required:n.required,size:n.size,autocomplete:n.autocomplete,multiple:n.multiple,"aria-invalid":me.value,"aria-describedby":!y.value&&o.value?I.value:void 0,"aria-errormessage":y.value?I.value:void 0})),{getOptionLabel:he,getOptionValue:be}=L(n);function Se(c){return typeof c=="string"||c.disabled===void 0?f.value:c.disabled}const N=e.computed({get:()=>n.modelValue,set:c=>{Array.isArray(c)&&(c=c.filter(O=>O!==void 0)),r("update:modelValue",c)}});return(c,O)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(ge))},[c.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(B)},e.toDisplayString(c.label),9,ie)):e.createCommentVNode("",!0),e.createElementVNode("div",le,[e.renderSlot(c.$slots,"before",{},()=>[e.unref(q)?(e.openBlock(),e.createBlock(j,e.normalizeProps(e.mergeProps({key:0},e.unref(b))),null,16)):e.createCommentVNode("",!0)]),e.withDirectives(e.createElementVNode("select",e.mergeProps({id:e.unref(B),ref_key:"select",ref:l,"onUpdate:modelValue":O[0]||(O[0]=k=>e.isRef(N)?N.value=k:null)},e.unref(ye)),[c.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,value:void 0,disabled:!c.unselectable,hidden:!c.unselectable},e.toDisplayString(c.placeholder),9,ce)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.options,(k,Be)=>(e.openBlock(),e.createElementBlock("option",{key:Be,disabled:Se(k),value:e.unref(be)(k)},e.toDisplayString(e.unref(he)(k)),9,ue))),128))],16,ae),[[e.vModelSelect,e.unref(N)]]),e.renderSlot(c.$slots,"after",{},()=>[e.unref(z)?(e.openBlock(),e.createBlock(j,e.normalizeProps(e.mergeProps({key:0},e.unref(b))),null,16)):e.createCommentVNode("",!0)])]),e.createVNode(e.unref(u),{id:e.unref(I),class:"vv-select__hint"},null,8,["id"])],2))}})});