@volverjs/ui-vue 0.0.3 → 0.0.4

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 (145) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +52 -13
  3. package/dist/Volver.d.ts +5 -1
  4. package/dist/components/VvAccordion/VvAccordion.es.js +113 -66
  5. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  6. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +159 -101
  7. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  8. package/dist/components/VvAction/VvAction.es.js +170 -0
  9. package/dist/components/VvAction/VvAction.umd.js +1 -0
  10. package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
  11. package/dist/components/VvAction/index.d.ts +24 -0
  12. package/dist/components/VvBadge/VvBadge.es.js +86 -16
  13. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  14. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +97 -41
  15. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  16. package/dist/components/VvButton/VvButton.es.js +434 -251
  17. package/dist/components/VvButton/VvButton.umd.js +1 -1
  18. package/dist/components/VvButton/VvButton.vue.d.ts +50 -50
  19. package/dist/components/VvButton/index.d.ts +22 -67
  20. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +118 -43
  21. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  22. package/dist/components/VvCard/VvCard.es.js +38 -25
  23. package/dist/components/VvCard/VvCard.umd.js +1 -1
  24. package/dist/components/VvCheckbox/VvCheckbox.es.js +334 -154
  25. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  26. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
  27. package/dist/components/VvCheckbox/index.d.ts +1 -1
  28. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +401 -204
  29. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  30. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +2 -2
  31. package/dist/components/VvCheckboxGroup/index.d.ts +1 -1
  32. package/dist/components/VvCombobox/VvCombobox.es.js +950 -594
  33. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  34. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +54 -30
  35. package/dist/components/VvCombobox/index.d.ts +18 -13
  36. package/dist/components/VvDialog/VvDialog.es.js +139 -64
  37. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  38. package/dist/components/VvDropdown/VvDropdown.es.js +276 -158
  39. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  40. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +9 -9
  41. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
  42. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
  43. package/dist/components/VvDropdown/index.d.ts +6 -9
  44. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +251 -0
  45. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
  46. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +30 -15
  47. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  48. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +176 -0
  49. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
  50. package/dist/components/VvIcon/VvIcon.es.js +48 -32
  51. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  52. package/dist/components/VvInputText/VvInputText.es.js +508 -344
  53. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  54. package/dist/components/VvInputText/VvInputText.vue.d.ts +11 -4
  55. package/dist/components/VvInputText/index.d.ts +13 -2
  56. package/dist/components/VvProgress/VvProgress.es.js +90 -20
  57. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  58. package/dist/components/VvRadio/VvRadio.es.js +305 -125
  59. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  60. package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
  61. package/dist/components/VvRadio/index.d.ts +1 -1
  62. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +372 -175
  63. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  64. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +2 -2
  65. package/dist/components/VvRadioGroup/index.d.ts +1 -1
  66. package/dist/components/VvSelect/VvSelect.es.js +371 -216
  67. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  68. package/dist/components/VvSelect/VvSelect.vue.d.ts +11 -4
  69. package/dist/components/VvSelect/index.d.ts +5 -5
  70. package/dist/components/VvTextarea/VvTextarea.es.js +408 -244
  71. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  72. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +11 -4
  73. package/dist/components/VvTextarea/index.d.ts +5 -5
  74. package/dist/components/VvTooltip/VvTooltip.es.js +88 -18
  75. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  76. package/dist/components/index.es.js +1913 -1521
  77. package/dist/components/index.umd.js +1 -1
  78. package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
  79. package/dist/composables/dropdown/useProvideDropdown.d.ts +2 -2
  80. package/dist/constants.d.ts +30 -0
  81. package/dist/directives/index.es.js +128 -0
  82. package/dist/directives/index.umd.js +1 -0
  83. package/dist/directives/v-tooltip.es.js +126 -0
  84. package/dist/directives/v-tooltip.umd.js +1 -0
  85. package/dist/icons.es.js +3 -3
  86. package/dist/icons.umd.js +1 -1
  87. package/dist/index.es.js +2102 -1761
  88. package/dist/index.umd.js +1 -1
  89. package/dist/props/index.d.ts +179 -11
  90. package/dist/resolvers/unplugin.d.ts +8 -8
  91. package/dist/resolvers/unplugin.es.js +51 -30
  92. package/dist/resolvers/unplugin.umd.js +1 -1
  93. package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
  94. package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
  95. package/package.json +60 -34
  96. package/src/Volver.ts +12 -5
  97. package/src/assets/icons/detailed.json +1 -1
  98. package/src/assets/icons/normal.json +1 -1
  99. package/src/assets/icons/simple.json +1 -1
  100. package/src/components/VvAction/VvAction.vue +144 -0
  101. package/src/components/VvAction/index.ts +5 -0
  102. package/src/components/VvButton/VvButton.vue +31 -114
  103. package/src/components/VvButton/index.ts +6 -79
  104. package/src/components/VvCombobox/VvCombobox.vue +54 -42
  105. package/src/components/VvCombobox/index.ts +11 -9
  106. package/src/components/VvDropdown/VvDropdownAction.vue +44 -0
  107. package/src/components/VvDropdown/VvDropdownOption.vue +65 -0
  108. package/src/components/VvDropdown/index.ts +4 -9
  109. package/src/components/VvSelect/index.ts +2 -4
  110. package/src/composables/dropdown/useInjectDropdown.ts +1 -1
  111. package/src/composables/dropdown/useProvideDropdown.ts +7 -9
  112. package/src/composables/useModifiers.ts +4 -7
  113. package/src/constants.ts +36 -0
  114. package/src/props/index.ts +106 -14
  115. package/src/resolvers/unplugin.ts +81 -48
  116. package/src/stories/Accordion/AccordionSlots.stories.mdx +2 -2
  117. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +2 -1
  118. package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
  119. package/src/stories/Button/Button.stories.mdx +4 -2
  120. package/src/stories/Button/Button.test.ts +3 -1
  121. package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
  122. package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
  123. package/src/stories/Button/ButtonState.stories.mdx +2 -11
  124. package/src/stories/Card/Card.stories.mdx +2 -1
  125. package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
  126. package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
  127. package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
  128. package/src/stories/Combobox/Combobox.settings.ts +44 -0
  129. package/src/stories/Combobox/Combobox.stories.mdx +40 -1
  130. package/src/stories/Dialog/Dialog.stories.mdx +2 -1
  131. package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
  132. package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
  133. package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
  134. package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
  135. package/src/stories/Icon/Icon.stories.mdx +2 -1
  136. package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
  137. package/src/stories/InputText/InputText.stories.mdx +2 -1
  138. package/src/stories/Progress/Progress.stories.mdx +2 -1
  139. package/src/stories/Radio/Radio.stories.mdx +2 -1
  140. package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
  141. package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
  142. package/src/stories/Select/Select.stories.mdx +2 -1
  143. package/src/stories/Textarea/Textarea.stories.mdx +2 -1
  144. package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
  145. package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
@@ -1,36 +1,111 @@
1
- import { defineComponent as k, openBlock as O, createElementBlock as C, normalizeClass as I, unref as d, withDirectives as U, createElementVNode as N, isRef as J, vModelRadio as W, renderSlot as E, createTextVNode as Y, toDisplayString as G, createVNode as F, createCommentVNode as Q, Fragment as X, renderList as Z, createBlock as L, mergeProps as ee } from "vue";
2
- var j = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(j || {}), $ = /* @__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))($ || {}), A = /* @__PURE__ */ ((e) => (e.before = "before", e.after = "after", e))(A || {});
3
- const D = Symbol.for("radioGroup");
4
- function R(e) {
5
- return Array.isArray(e) ? e.filter((p) => isString(p)).join(" ") : e;
1
+ import { unref as v, toRefs as k, computed as c, h as ne, inject as oe, toRef as ae, defineComponent as D, useSlots as x, ref as le, openBlock as j, createElementBlock as B, normalizeClass as F, withDirectives as se, createElementVNode as H, isRef as K, vModelRadio as ue, renderSlot as q, createTextVNode as ie, toDisplayString as w, createVNode as M, provide as ce, createCommentVNode as de, Fragment as fe, renderList as ve, createBlock as pe, mergeProps as ye } from "vue";
2
+ import { toReactive as ge, useVModel as be } from "@vueuse/core";
3
+ import { nanoid as me } from "nanoid";
4
+ var E = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(E || {}), z = /* @__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))(z || {}), C = /* @__PURE__ */ ((e) => (e.before = "before", e.after = "after", e))(C || {}), I = /* @__PURE__ */ ((e) => (e.button = "button", e.submit = "submit", e.reset = "reset", e))(I || {}), U = /* @__PURE__ */ ((e) => (e._blank = "_blank", e._self = "_self", e._parent = "_parent", e._top = "_top", e))(U || {});
5
+ const J = Symbol.for("radioGroup");
6
+ function W(e, t, r) {
7
+ return r ? R(e, r) === R(t, r) : G(e, t);
6
8
  }
7
- function H(e, p) {
9
+ function G(e, t) {
10
+ if (e === t)
11
+ return !0;
12
+ if (e && t && typeof e == "object" && typeof t == "object") {
13
+ const r = Array.isArray(e), s = Array.isArray(t);
14
+ let o, a, l;
15
+ if (r && s) {
16
+ if (a = e.length, a != t.length)
17
+ return !1;
18
+ for (o = a; o-- !== 0; )
19
+ if (!G(e[o], t[o]))
20
+ return !1;
21
+ return !0;
22
+ }
23
+ if (r != s)
24
+ return !1;
25
+ const i = e instanceof Date, n = t instanceof Date;
26
+ if (i != n)
27
+ return !1;
28
+ if (i && n)
29
+ return e.getTime() == t.getTime();
30
+ const d = e instanceof RegExp, f = t instanceof RegExp;
31
+ if (d != f)
32
+ return !1;
33
+ if (d && f)
34
+ return e.toString() == t.toString();
35
+ const u = Object.keys(e);
36
+ if (a = u.length, a !== Object.keys(t).length)
37
+ return !1;
38
+ for (o = a; o-- !== 0; )
39
+ if (!Object.prototype.hasOwnProperty.call(t, u[o]))
40
+ return !1;
41
+ for (o = a; o-- !== 0; )
42
+ if (l = u[o], !G(e[l], t[l]))
43
+ return !1;
44
+ return !0;
45
+ }
46
+ return e !== e && t !== t;
47
+ }
48
+ function R(e, t) {
49
+ if (e && Object.keys(e).length && t) {
50
+ if (t.indexOf(".") === -1)
51
+ return e[t];
52
+ {
53
+ const r = t.split(".");
54
+ let s = e;
55
+ for (let o = 0, a = r.length; o < a; ++o) {
56
+ if (e == null)
57
+ return null;
58
+ s = s[r[o]];
59
+ }
60
+ return s;
61
+ }
62
+ } else
63
+ return null;
64
+ }
65
+ function he(e, t) {
66
+ if (e != null && t && t.length) {
67
+ for (const r of t)
68
+ if (W(e, r))
69
+ return !0;
70
+ }
71
+ return !1;
72
+ }
73
+ function Y(e) {
74
+ return ((t) => t == null || t === "" || Array.isArray(t) && t.length === 0 || !(t instanceof Date) && typeof t == "object" && Object.keys(t).length === 0)(v(e));
75
+ }
76
+ function Oe(e) {
77
+ return typeof e == "string" || e instanceof String;
78
+ }
79
+ function A(e) {
80
+ return Array.isArray(e) ? e.filter((t) => Oe(t)).join(" ") : e;
81
+ }
82
+ function Q(e, t) {
8
83
  const {
9
- invalid: o,
10
- valid: f,
11
- hint: m,
12
- loading: r
13
- } = p, {
14
- hintLabel: t,
15
- modelValue: l,
16
- valid: c,
17
- validLabel: s,
18
- invalid: i,
19
- invalidLabel: a,
20
- ...V
21
- } = toRefs(e), n = resolveFieldData(V, "loading"), v = resolveFieldData(V, "loadingLabel"), b = computed(() => i.value ? !!(i.value && o || a != null && a.value && Array.isArray(a.value) && a.value.length > 0 || a != null && a.value && !isEmpty(a)) : !1), u = computed(
22
- () => !!(t && t.value || m)
23
- ), y = computed(
24
- () => !!(s && s.value || f)
25
- ), _ = computed(
26
- () => !!(n != null && n.value && r || n != null && n.value && (v != null && v.value))
27
- ), B = computed(
28
- () => u.value || y.value || b.value || _.value
84
+ invalid: r,
85
+ valid: s,
86
+ hint: o,
87
+ loading: a
88
+ } = t, {
89
+ hintLabel: l,
90
+ modelValue: i,
91
+ valid: n,
92
+ validLabel: d,
93
+ invalid: f,
94
+ invalidLabel: u,
95
+ ...S
96
+ } = k(e), p = R(S, "loading"), g = R(S, "loadingLabel"), m = c(() => f.value ? !!(f.value && r || u != null && u.value && Array.isArray(u.value) && u.value.length > 0 || u != null && u.value && !Y(u)) : !1), y = c(
97
+ () => !!(l && l.value || o)
98
+ ), b = c(
99
+ () => !!(d && d.value || s)
100
+ ), _ = c(
101
+ () => !!(p != null && p.value && a || p != null && p.value && (g != null && g.value))
102
+ ), V = c(
103
+ () => y.value || b.value || m.value || _.value
29
104
  );
30
105
  return {
31
- hasInvalid: b,
32
- hasHint: u,
33
- hasValid: y,
106
+ hasInvalid: m,
107
+ hasHint: y,
108
+ hasValid: b,
34
109
  hasLoading: _,
35
110
  HintSlot: {
36
111
  name: "HintSlot",
@@ -41,30 +116,30 @@ function H(e, p) {
41
116
  }
42
117
  },
43
118
  setup(P) {
44
- const g = computed(() => {
45
- const S = toReactive({
46
- hintLabel: t,
47
- modelValue: l,
48
- valid: c,
49
- validLabel: s,
50
- invalid: i,
51
- invalidLabel: a,
52
- loading: n,
53
- loadingLabel: v,
119
+ const h = c(() => {
120
+ const O = ge({
121
+ hintLabel: l,
122
+ modelValue: i,
123
+ valid: n,
124
+ validLabel: d,
125
+ invalid: f,
126
+ invalidLabel: u,
127
+ loading: p,
128
+ loadingLabel: g,
54
129
  ...P.params
55
130
  });
56
- return i != null && i.value ? (o == null ? void 0 : o(S)) || R(a == null ? void 0 : a.value) || (t == null ? void 0 : t.value) : c != null && c.value ? (f == null ? void 0 : f(S)) || R(s == null ? void 0 : s.value) || (t == null ? void 0 : t.value) : n != null && n.value ? (r == null ? void 0 : r(S)) || R(v == null ? void 0 : v.value) || (t == null ? void 0 : t.value) : (m == null ? void 0 : m(S)) || R(t == null ? void 0 : t.value) || (t == null ? void 0 : t.value);
131
+ return f != null && f.value ? (r == null ? void 0 : r(O)) || A(u == null ? void 0 : u.value) || (l == null ? void 0 : l.value) : n != null && n.value ? (s == null ? void 0 : s(O)) || A(d == null ? void 0 : d.value) || (l == null ? void 0 : l.value) : p != null && p.value ? (a == null ? void 0 : a(O)) || A(g == null ? void 0 : g.value) || (l == null ? void 0 : l.value) : (o == null ? void 0 : o(O)) || A(l == null ? void 0 : l.value) || (l == null ? void 0 : l.value);
57
132
  });
58
133
  return {
59
- isVisible: B,
60
- hasInvalid: b,
61
- hasValid: y,
62
- hintContent: g
134
+ isVisible: V,
135
+ hasInvalid: m,
136
+ hasValid: b,
137
+ hintContent: h
63
138
  };
64
139
  },
65
140
  render() {
66
141
  if (this.isVisible)
67
- return h(
142
+ return ne(
68
143
  "small",
69
144
  {
70
145
  role: this.hasInvalid ? "alert" : this.hasValid ? "status" : void 0
@@ -75,30 +150,83 @@ function H(e, p) {
75
150
  }
76
151
  };
77
152
  }
78
- const M = {
153
+ const Se = {
154
+ /**
155
+ * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
156
+ * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
157
+ */
158
+ to: {
159
+ type: [String, Object]
160
+ },
161
+ /**
162
+ * Anchor href
163
+ */
164
+ href: String,
165
+ /**
166
+ * Anchor target
167
+ */
168
+ target: {
169
+ type: String,
170
+ validator: (e) => Object.values(U).includes(e)
171
+ },
172
+ /**
173
+ * Anchor rel
174
+ */
175
+ rel: {
176
+ type: String,
177
+ default: "noopener noreferrer"
178
+ }
179
+ }, T = {
180
+ /**
181
+ * Valid status
182
+ */
79
183
  valid: Boolean,
184
+ /**
185
+ * Valid label
186
+ */
80
187
  validLabel: [String, Array]
81
- }, x = {
188
+ }, X = {
189
+ /**
190
+ * Invalid status
191
+ */
82
192
  invalid: Boolean,
193
+ /**
194
+ * Invalid label
195
+ */
83
196
  invalidLabel: [String, Array]
84
- }, q = {
197
+ }, $ = {
85
198
  /**
86
199
  * Whether the form control is disabled
87
200
  */
88
201
  disabled: Boolean
89
- }, K = {
202
+ }, _e = {
203
+ /**
204
+ * Whether the item is active
205
+ */
206
+ active: Boolean
207
+ }, Ve = {
208
+ /**
209
+ * Whether the item is pressed
210
+ */
211
+ pressed: Boolean
212
+ }, N = {
213
+ /**
214
+ * The item label
215
+ */
216
+ label: [String, Number]
217
+ }, Z = {
90
218
  /**
91
219
  * The value is not editable
92
220
  */
93
221
  readonly: Boolean
94
- }, w = {
222
+ }, L = {
95
223
  /**
96
224
  * Component BEM modifiers
97
225
  */
98
226
  modifiers: [String, Array]
99
- }, z = {
227
+ }, ee = {
100
228
  hintLabel: { type: String, default: "" }
101
- }, te = {
229
+ }, je = {
102
230
  /**
103
231
  * List of options, can be string[] or object[]
104
232
  */
@@ -119,38 +247,39 @@ const M = {
119
247
  */
120
248
  disabledKey: { type: [String, Function], default: "disabled" }
121
249
  };
122
- A.before;
123
- const oe = {
250
+ C.before;
251
+ const ke = {
124
252
  /**
125
253
  * Global attribute tabindex
126
254
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
127
255
  */
128
256
  tabindex: { type: [String, Number], default: 0 }
129
- }, ae = {
257
+ }, Ae = {
130
258
  /**
131
259
  * Global attribute id
132
260
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
133
261
  */
134
262
  id: [String, Number]
135
263
  };
136
- j.bottom;
137
- const re = {
138
- ...ae,
264
+ E.bottom;
265
+ const Be = {
266
+ ...Ae,
139
267
  /**
140
268
  * Input / Textarea name
141
269
  * Name of the form control. Submitted with the form as part of a name/value pair
142
270
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
143
271
  */
144
272
  name: { type: String, required: !0 }
145
- }, ne = {
146
- ...re,
147
- ...oe,
148
- ...M,
149
- ...x,
150
- ...z,
151
- ...q,
152
- ...K,
153
- ...w,
273
+ }, Re = {
274
+ ...Be,
275
+ ...ke,
276
+ ...T,
277
+ ...X,
278
+ ...ee,
279
+ ...$,
280
+ ...Z,
281
+ ...L,
282
+ ...N,
154
283
  /**
155
284
  * Input value
156
285
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
@@ -159,27 +288,20 @@ const re = {
159
288
  /**
160
289
  * Input value
161
290
  */
162
- modelValue: [Object, Number, Boolean, String],
163
- /**
164
- * <label> for input
165
- */
166
- label: String
167
- }, le = {
168
- ...M,
169
- ...x,
170
- ...te,
171
- ...z,
172
- ...q,
173
- ...K,
174
- ...w,
291
+ modelValue: [Object, Number, Boolean, String]
292
+ }, Pe = {
293
+ ...T,
294
+ ...X,
295
+ ...je,
296
+ ...ee,
297
+ ...$,
298
+ ...Z,
299
+ ...L,
300
+ ...N,
175
301
  /**
176
302
  * Input value
177
303
  */
178
304
  modelValue: [String, Array],
179
- /**
180
- * Input label
181
- */
182
- label: String,
183
305
  /**
184
306
  * Input name
185
307
  */
@@ -188,129 +310,204 @@ const re = {
188
310
  * If true, the group will be displayed in a vertical column
189
311
  */
190
312
  vertical: Boolean
191
- }, se = ne, ue = ["click", "update:modelValue", "change", "blur"];
192
- function ie(e, p) {
193
- const { id: o } = toRefs(e), { group: f, isInGroup: m, getGroupOrLocalRef: r } = useInjectedGroupState(D), t = r("modelValue", e, p), l = r("readonly", e), c = r("disabled", e), s = r("valid", e), i = r("invalid", e);
313
+ };
314
+ ({
315
+ ...$,
316
+ ...N,
317
+ ...Ve,
318
+ ..._e,
319
+ ...Se,
320
+ /**
321
+ * Button type
322
+ */
323
+ type: I.button
324
+ });
325
+ function Ee(e) {
326
+ const t = oe(e, void 0), r = c(() => !Y(t));
327
+ function s(o, a, l) {
328
+ if (t != null && t.value) {
329
+ const n = v(t.value)[o];
330
+ return c({
331
+ get() {
332
+ return n == null ? void 0 : n.value;
333
+ },
334
+ set(d) {
335
+ n.value = d;
336
+ }
337
+ });
338
+ }
339
+ const i = ae(a, o);
340
+ return c({
341
+ get() {
342
+ return i.value;
343
+ },
344
+ set(n) {
345
+ l && l(`update:${o}`, n);
346
+ }
347
+ });
348
+ }
349
+ return {
350
+ group: t,
351
+ isInGroup: r,
352
+ getGroupOrLocalRef: s
353
+ };
354
+ }
355
+ const Ce = Re, Ie = ["click", "update:modelValue", "change", "blur"];
356
+ function Ge(e, t) {
357
+ const { id: r } = k(e), { group: s, isInGroup: o, getGroupOrLocalRef: a } = Ee(J), l = a("modelValue", e, t), i = a("readonly", e), n = a("disabled", e), d = a("valid", e), f = a("invalid", e);
194
358
  return {
195
359
  // local props
196
- id: o,
360
+ id: r,
197
361
  // global props
198
- group: f,
199
- isInGroup: m,
200
- modelValue: t,
201
- readonly: l,
202
- disabled: c,
203
- valid: s,
204
- invalid: i
362
+ group: s,
363
+ isInGroup: o,
364
+ modelValue: l,
365
+ readonly: i,
366
+ disabled: n,
367
+ valid: d,
368
+ invalid: f
205
369
  };
206
370
  }
207
- const de = ["for"], ce = ["id", "name", "disabled", "value", "tabindex", "aria-invalid"], ve = {
371
+ const $e = (e) => c(() => String((e == null ? void 0 : e.value) || me()));
372
+ function te(e, t, r) {
373
+ return c(() => {
374
+ const s = {
375
+ [e]: !0
376
+ }, o = typeof (t == null ? void 0 : t.value) == "string" ? t.value.split(" ") : t == null ? void 0 : t.value;
377
+ return o && Array.isArray(o) && o.forEach((a) => {
378
+ s[`${e}--${a}`] = !0;
379
+ }), r && Object.keys(r.value).forEach((a) => {
380
+ s[`${e}--${a}`] = v(r.value[a]);
381
+ }), s;
382
+ });
383
+ }
384
+ const Ne = ["for"], De = ["id", "name", "disabled", "value", "tabindex", "aria-invalid"], xe = {
208
385
  name: "VvRadio"
209
- }, pe = /* @__PURE__ */ k({
210
- ...ve,
211
- props: se,
212
- emits: ue,
213
- setup(e, { emit: p }) {
214
- const o = e, f = useSlots(), { id: m, disabled: r, readonly: t, modelValue: l, valid: c, invalid: s } = ie(o, p), i = useUniqueId(m), a = computed(() => n.value ? -1 : o.tabindex), V = ref(), n = computed(() => r.value || t.value), v = computed(() => {
215
- if (s.value === !0)
386
+ }, Fe = /* @__PURE__ */ D({
387
+ ...xe,
388
+ props: Ce,
389
+ emits: Ie,
390
+ setup(e, { emit: t }) {
391
+ const r = e, s = x(), { id: o, disabled: a, readonly: l, modelValue: i, valid: n, invalid: d } = Ge(r, t), f = $e(o), u = c(() => p.value ? -1 : r.tabindex), S = le(), p = c(() => a.value || l.value), g = c(() => {
392
+ if (d.value === !0)
216
393
  return !0;
217
- if (c.value === !0)
394
+ if (n.value === !0)
218
395
  return !1;
219
- }), b = computed(
220
- () => Array.isArray(l.value) ? contains(o.value, l.value) : equals(o.value, l.value)
221
- ), u = computed(
222
- () => ["string", "number", "boolean"].includes(typeof o.value) ? o.value : !0
223
- ), y = computed({
396
+ }), m = c(
397
+ () => Array.isArray(i.value) ? he(r.value, i.value) : W(r.value, i.value)
398
+ ), y = c(
399
+ () => ["string", "number", "boolean"].includes(typeof r.value) ? r.value : !0
400
+ ), b = c({
224
401
  get() {
225
- return b.value ? u.value : null;
402
+ return m.value ? y.value : null;
226
403
  },
227
- set(g) {
228
- Array.isArray(l.value) ? l.value = [o.value] : l.value = o.value, p("change", g);
404
+ set(h) {
405
+ Array.isArray(i.value) ? i.value = [r.value] : i.value = r.value, t("change", h);
229
406
  }
230
- }), { modifiers: _ } = toRefs(o), B = useBemModifiers(
407
+ }), { modifiers: _ } = k(r), V = te(
231
408
  "vv-radio",
232
409
  _,
233
- computed(() => ({
234
- valid: c.value,
235
- invalid: s.value,
236
- disabled: r.value,
237
- readonly: t.value
410
+ c(() => ({
411
+ valid: n.value,
412
+ invalid: d.value,
413
+ disabled: a.value,
414
+ readonly: l.value
238
415
  }))
239
- ), { HintSlot: P } = H(o, f);
240
- return (g, S) => (O(), C("label", {
241
- class: I(d(B)),
242
- for: d(i)
416
+ ), { HintSlot: P } = Q(r, s);
417
+ return (h, O) => (j(), B("label", {
418
+ class: F(v(V)),
419
+ for: v(f)
243
420
  }, [
244
- U(N("input", {
245
- id: d(i),
421
+ se(H("input", {
422
+ id: v(f),
246
423
  ref_key: "input",
247
- ref: V,
248
- "onUpdate:modelValue": S[0] || (S[0] = (T) => J(y) ? y.value = T : null),
424
+ ref: S,
425
+ "onUpdate:modelValue": O[0] || (O[0] = (re) => K(b) ? b.value = re : null),
249
426
  type: "radio",
250
427
  class: "vv-radio__input",
251
- name: g.name,
252
- disabled: d(n),
253
- value: d(u),
254
- tabindex: d(a),
255
- "aria-invalid": d(v)
256
- }, null, 8, ce), [
257
- [W, d(y)]
428
+ name: h.name,
429
+ disabled: v(p),
430
+ value: v(y),
431
+ tabindex: v(u),
432
+ "aria-invalid": v(g)
433
+ }, null, 8, De), [
434
+ [ue, v(b)]
258
435
  ]),
259
- E(g.$slots, "default", { value: d(l) }, () => [
260
- Y(G(g.label), 1)
436
+ q(h.$slots, "default", { value: v(i) }, () => [
437
+ ie(w(h.label), 1)
261
438
  ]),
262
- F(d(P), {
439
+ M(v(P), {
263
440
  class: "vv-radio__hint",
264
- params: { value: d(l) }
441
+ params: { value: v(i) }
265
442
  }, null, 8, ["params"])
266
- ], 10, de));
443
+ ], 10, Ne));
267
444
  }
268
- }), fe = le, me = ["update:modelValue", "change"], ye = ["textContent"], be = { class: "vv-radio-group__wrapper" }, ge = {
445
+ }), He = Pe, Ke = ["update:modelValue", "change"];
446
+ function qe(e) {
447
+ if (Object.keys(e).some(
448
+ (t) => t !== "key" && !K(e[t])
449
+ ))
450
+ throw Error("One or more groupState props aren't ref.");
451
+ ce(
452
+ e.key,
453
+ c(() => e)
454
+ );
455
+ }
456
+ function we(e) {
457
+ const { options: t, labelKey: r, valueKey: s, disabledKey: o } = k(e);
458
+ return {
459
+ options: t,
460
+ getOptionLabel: (n) => typeof n != "object" && n !== null ? n : typeof r.value == "function" ? r.value(n) : n[r.value],
461
+ getOptionValue: (n) => typeof n != "object" && n !== null ? n : typeof s.value == "function" ? s.value(n) : n[s.value],
462
+ getOptionDisabled: (n) => typeof n != "object" && n !== null ? !1 : typeof o.value == "function" ? o.value(n) : n[o.value]
463
+ };
464
+ }
465
+ const Me = ["textContent"], ze = { class: "vv-radio-group__wrapper" }, Ue = {
269
466
  name: "VvRadioGroup"
270
- }, Se = /* @__PURE__ */ k({
271
- ...ge,
272
- props: fe,
273
- emits: me,
274
- setup(e, { emit: p }) {
275
- const o = e, f = useSlots(), m = useVModel(o, "modelValue", p), { disabled: r, readonly: t, vertical: l, valid: c, invalid: s, modifiers: i } = toRefs(o);
276
- useProvideGroupState({
277
- key: D,
278
- modelValue: m,
279
- disabled: r,
280
- readonly: t,
281
- valid: c,
282
- invalid: s
467
+ }, Qe = /* @__PURE__ */ D({
468
+ ...Ue,
469
+ props: He,
470
+ emits: Ke,
471
+ setup(e, { emit: t }) {
472
+ const r = e, s = x(), o = be(r, "modelValue", t), { disabled: a, readonly: l, vertical: i, valid: n, invalid: d, modifiers: f } = k(r);
473
+ qe({
474
+ key: J,
475
+ modelValue: o,
476
+ disabled: a,
477
+ readonly: l,
478
+ valid: n,
479
+ invalid: d
283
480
  });
284
- const { getOptionLabel: a, getOptionValue: V } = useOptions(o), n = useBemModifiers(
481
+ const { getOptionLabel: u, getOptionValue: S } = we(r), p = te(
285
482
  "vv-radio-group",
286
- i,
287
- computed(() => ({
288
- disabled: r.value,
289
- readonly: t.value,
290
- horizontal: !l.value,
291
- valid: c.value,
292
- invalid: s.value
483
+ f,
484
+ c(() => ({
485
+ disabled: a.value,
486
+ readonly: l.value,
487
+ horizontal: !i.value,
488
+ valid: n.value,
489
+ invalid: d.value
293
490
  }))
294
- ), v = (u, y) => ({
295
- id: `${o.name}_opt${y}`,
296
- name: o.name,
297
- label: a(u),
298
- value: V(u)
299
- }), { HintSlot: b } = H(o, f);
300
- return (u, y) => (O(), C("fieldset", {
301
- class: I(d(n))
491
+ ), g = (y, b) => ({
492
+ id: `${r.name}_opt${b}`,
493
+ name: r.name,
494
+ label: u(y),
495
+ value: S(y)
496
+ }), { HintSlot: m } = Q(r, s);
497
+ return (y, b) => (j(), B("fieldset", {
498
+ class: F(v(p))
302
499
  }, [
303
- u.label ? (O(), C("legend", {
500
+ y.label ? (j(), B("legend", {
304
501
  key: 0,
305
- textContent: G(u.label)
306
- }, null, 8, ye)) : Q("", !0),
307
- N("div", be, [
308
- u.options.length > 0 ? (O(!0), C(X, { key: 0 }, Z(u.options, (_, B) => (O(), L(pe, ee({ key: B }, v(_, B)), null, 16))), 128)) : E(u.$slots, "default", { key: 1 })
502
+ textContent: w(y.label)
503
+ }, null, 8, Me)) : de("", !0),
504
+ H("div", ze, [
505
+ y.options.length > 0 ? (j(!0), B(fe, { key: 0 }, ve(y.options, (_, V) => (j(), pe(Fe, ye({ key: V }, g(_, V)), null, 16))), 128)) : q(y.$slots, "default", { key: 1 })
309
506
  ]),
310
- F(d(b), { class: "vv-radio-group__hint" })
507
+ M(v(m), { class: "vv-radio-group__hint" })
311
508
  ], 2));
312
509
  }
313
510
  });
314
511
  export {
315
- Se as default
512
+ Qe as default
316
513
  };