@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,37 +1,92 @@
1
- import { defineComponent as C, openBlock as E, createElementBlock as P, normalizeClass as x, unref as i, withDirectives as D, createElementVNode as k, isRef as G, vModelRadio as H, renderSlot as F, createTextVNode as M, toDisplayString as q, createVNode as T } from "vue";
2
- var R = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(R || {}), A = /* @__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 || {}), I = /* @__PURE__ */ ((e) => (e.before = "before", e.after = "after", e))(I || {});
3
- const U = Symbol.for("radioGroup"), w = {
1
+ import { unref as v, inject as q, computed as i, toRef as M, toRefs as P, h as w, defineComponent as F, useSlots as U, ref as z, openBlock as J, createElementBlock as K, normalizeClass as W, withDirectives as Y, createElementVNode as Q, isRef as T, vModelRadio as X, renderSlot as Z, createTextVNode as L, toDisplayString as ee, createVNode as te } from "vue";
2
+ import { toReactive as re } from "@vueuse/core";
3
+ import { nanoid as ne } from "nanoid";
4
+ var R = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(R || {}), N = /* @__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))(N || {}), k = /* @__PURE__ */ ((e) => (e.before = "before", e.after = "after", e))(k || {}), E = /* @__PURE__ */ ((e) => (e.button = "button", e.submit = "submit", e.reset = "reset", e))(E || {}), x = /* @__PURE__ */ ((e) => (e._blank = "_blank", e._self = "_self", e._parent = "_parent", e._top = "_top", e))(x || {});
5
+ const oe = Symbol.for("radioGroup"), ae = {
6
+ /**
7
+ * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
8
+ * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
9
+ */
10
+ to: {
11
+ type: [String, Object]
12
+ },
13
+ /**
14
+ * Anchor href
15
+ */
16
+ href: String,
17
+ /**
18
+ * Anchor target
19
+ */
20
+ target: {
21
+ type: String,
22
+ validator: (e) => Object.values(x).includes(e)
23
+ },
24
+ /**
25
+ * Anchor rel
26
+ */
27
+ rel: {
28
+ type: String,
29
+ default: "noopener noreferrer"
30
+ }
31
+ }, se = {
32
+ /**
33
+ * Valid status
34
+ */
4
35
  valid: Boolean,
36
+ /**
37
+ * Valid label
38
+ */
5
39
  validLabel: [String, Array]
6
- }, z = {
40
+ }, le = {
41
+ /**
42
+ * Invalid status
43
+ */
7
44
  invalid: Boolean,
45
+ /**
46
+ * Invalid label
47
+ */
8
48
  invalidLabel: [String, Array]
9
- }, J = {
49
+ }, C = {
10
50
  /**
11
51
  * Whether the form control is disabled
12
52
  */
13
53
  disabled: Boolean
14
- }, K = {
54
+ }, ue = {
55
+ /**
56
+ * Whether the item is active
57
+ */
58
+ active: Boolean
59
+ }, ie = {
60
+ /**
61
+ * Whether the item is pressed
62
+ */
63
+ pressed: Boolean
64
+ }, D = {
65
+ /**
66
+ * The item label
67
+ */
68
+ label: [String, Number]
69
+ }, ce = {
15
70
  /**
16
71
  * The value is not editable
17
72
  */
18
73
  readonly: Boolean
19
- }, W = {
74
+ }, fe = {
20
75
  /**
21
76
  * Component BEM modifiers
22
77
  */
23
78
  modifiers: [String, Array]
24
- }, Y = {
79
+ }, de = {
25
80
  hintLabel: { type: String, default: "" }
26
81
  };
27
- I.before;
28
- const $ = {
82
+ k.before;
83
+ const ve = {
29
84
  /**
30
85
  * Global attribute tabindex
31
86
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
32
87
  */
33
88
  tabindex: { type: [String, Number], default: 0 }
34
- }, Q = {
89
+ }, pe = {
35
90
  /**
36
91
  * Global attribute id
37
92
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
@@ -39,23 +94,24 @@ const $ = {
39
94
  id: [String, Number]
40
95
  };
41
96
  R.bottom;
42
- const X = {
43
- ...Q,
97
+ const ye = {
98
+ ...pe,
44
99
  /**
45
100
  * Input / Textarea name
46
101
  * Name of the form control. Submitted with the form as part of a name/value pair
47
102
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
48
103
  */
49
104
  name: { type: String, required: !0 }
50
- }, Z = {
51
- ...X,
52
- ...$,
53
- ...w,
54
- ...z,
55
- ...Y,
56
- ...J,
57
- ...K,
58
- ...W,
105
+ }, ge = {
106
+ ...ye,
107
+ ...ve,
108
+ ...se,
109
+ ...le,
110
+ ...de,
111
+ ...C,
112
+ ...ce,
113
+ ...fe,
114
+ ...D,
59
115
  /**
60
116
  * Input value
61
117
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
@@ -64,58 +120,169 @@ const X = {
64
120
  /**
65
121
  * Input value
66
122
  */
67
- modelValue: [Object, Number, Boolean, String],
123
+ modelValue: [Object, Number, Boolean, String]
124
+ };
125
+ ({
126
+ ...C,
127
+ ...D,
128
+ ...ie,
129
+ ...ue,
130
+ ...ae,
68
131
  /**
69
- * <label> for input
132
+ * Button type
70
133
  */
71
- label: String
72
- }, L = Z, ee = ["click", "update:modelValue", "change", "blur"];
73
- function te(e, v) {
74
- const { id: a } = toRefs(e), { group: p, isInGroup: f, getGroupOrLocalRef: r } = useInjectedGroupState(U), t = r("modelValue", e, v), l = r("readonly", e), d = r("disabled", e), u = r("valid", e), s = r("invalid", e);
134
+ type: E.button
135
+ });
136
+ function G(e, t, r) {
137
+ return r ? A(e, r) === A(t, r) : I(e, t);
138
+ }
139
+ function I(e, t) {
140
+ if (e === t)
141
+ return !0;
142
+ if (e && t && typeof e == "object" && typeof t == "object") {
143
+ const r = Array.isArray(e), s = Array.isArray(t);
144
+ let n, o, a;
145
+ if (r && s) {
146
+ if (o = e.length, o != t.length)
147
+ return !1;
148
+ for (n = o; n-- !== 0; )
149
+ if (!I(e[n], t[n]))
150
+ return !1;
151
+ return !0;
152
+ }
153
+ if (r != s)
154
+ return !1;
155
+ const c = e instanceof Date, l = t instanceof Date;
156
+ if (c != l)
157
+ return !1;
158
+ if (c && l)
159
+ return e.getTime() == t.getTime();
160
+ const f = e instanceof RegExp, d = t instanceof RegExp;
161
+ if (f != d)
162
+ return !1;
163
+ if (f && d)
164
+ return e.toString() == t.toString();
165
+ const u = Object.keys(e);
166
+ if (o = u.length, o !== Object.keys(t).length)
167
+ return !1;
168
+ for (n = o; n-- !== 0; )
169
+ if (!Object.prototype.hasOwnProperty.call(t, u[n]))
170
+ return !1;
171
+ for (n = o; n-- !== 0; )
172
+ if (a = u[n], !I(e[a], t[a]))
173
+ return !1;
174
+ return !0;
175
+ }
176
+ return e !== e && t !== t;
177
+ }
178
+ function A(e, t) {
179
+ if (e && Object.keys(e).length && t) {
180
+ if (t.indexOf(".") === -1)
181
+ return e[t];
182
+ {
183
+ const r = t.split(".");
184
+ let s = e;
185
+ for (let n = 0, o = r.length; n < o; ++n) {
186
+ if (e == null)
187
+ return null;
188
+ s = s[r[n]];
189
+ }
190
+ return s;
191
+ }
192
+ } else
193
+ return null;
194
+ }
195
+ function be(e, t) {
196
+ if (e != null && t && t.length) {
197
+ for (const r of t)
198
+ if (G(e, r))
199
+ return !0;
200
+ }
201
+ return !1;
202
+ }
203
+ function H(e) {
204
+ return ((t) => t == null || t === "" || Array.isArray(t) && t.length === 0 || !(t instanceof Date) && typeof t == "object" && Object.keys(t).length === 0)(v(e));
205
+ }
206
+ function me(e) {
207
+ return typeof e == "string" || e instanceof String;
208
+ }
209
+ function he(e) {
210
+ const t = q(e, void 0), r = i(() => !H(t));
211
+ function s(n, o, a) {
212
+ if (t != null && t.value) {
213
+ const l = v(t.value)[n];
214
+ return i({
215
+ get() {
216
+ return l == null ? void 0 : l.value;
217
+ },
218
+ set(f) {
219
+ l.value = f;
220
+ }
221
+ });
222
+ }
223
+ const c = M(o, n);
224
+ return i({
225
+ get() {
226
+ return c.value;
227
+ },
228
+ set(l) {
229
+ a && a(`update:${n}`, l);
230
+ }
231
+ });
232
+ }
233
+ return {
234
+ group: t,
235
+ isInGroup: r,
236
+ getGroupOrLocalRef: s
237
+ };
238
+ }
239
+ const Se = ge, Oe = ["click", "update:modelValue", "change", "blur"];
240
+ function je(e, t) {
241
+ const { id: r } = P(e), { group: s, isInGroup: n, getGroupOrLocalRef: o } = he(oe), a = o("modelValue", e, t), c = o("readonly", e), l = o("disabled", e), f = o("valid", e), d = o("invalid", e);
75
242
  return {
76
243
  // local props
77
- id: a,
244
+ id: r,
78
245
  // global props
79
- group: p,
80
- isInGroup: f,
81
- modelValue: t,
82
- readonly: l,
83
- disabled: d,
84
- valid: u,
85
- invalid: s
246
+ group: s,
247
+ isInGroup: n,
248
+ modelValue: a,
249
+ readonly: c,
250
+ disabled: l,
251
+ valid: f,
252
+ invalid: d
86
253
  };
87
254
  }
88
- function O(e) {
89
- return Array.isArray(e) ? e.filter((v) => isString(v)).join(" ") : e;
255
+ function _(e) {
256
+ return Array.isArray(e) ? e.filter((t) => me(t)).join(" ") : e;
90
257
  }
91
- function ae(e, v) {
258
+ function _e(e, t) {
92
259
  const {
93
- invalid: a,
94
- valid: p,
95
- hint: f,
96
- loading: r
97
- } = v, {
98
- hintLabel: t,
99
- modelValue: l,
100
- valid: d,
101
- validLabel: u,
102
- invalid: s,
103
- invalidLabel: o,
104
- ...V
105
- } = toRefs(e), n = resolveFieldData(V, "loading"), c = resolveFieldData(V, "loadingLabel"), g = computed(() => s.value ? !!(s.value && a || o != null && o.value && Array.isArray(o.value) && o.value.length > 0 || o != null && o.value && !isEmpty(o)) : !1), S = computed(
106
- () => !!(t && t.value || f)
107
- ), m = computed(
108
- () => !!(u && u.value || p)
109
- ), B = computed(
110
- () => !!(n != null && n.value && r || n != null && n.value && (c != null && c.value))
111
- ), _ = computed(
112
- () => S.value || m.value || g.value || B.value
260
+ invalid: r,
261
+ valid: s,
262
+ hint: n,
263
+ loading: o
264
+ } = t, {
265
+ hintLabel: a,
266
+ modelValue: c,
267
+ valid: l,
268
+ validLabel: f,
269
+ invalid: d,
270
+ invalidLabel: u,
271
+ ...O
272
+ } = P(e), p = A(O, "loading"), y = A(O, "loadingLabel"), h = i(() => d.value ? !!(d.value && r || u != null && u.value && Array.isArray(u.value) && u.value.length > 0 || u != null && u.value && !H(u)) : !1), S = i(
273
+ () => !!(a && a.value || n)
274
+ ), g = i(
275
+ () => !!(f && f.value || s)
276
+ ), j = i(
277
+ () => !!(p != null && p.value && o || p != null && p.value && (y != null && y.value))
278
+ ), B = i(
279
+ () => S.value || g.value || h.value || j.value
113
280
  );
114
281
  return {
115
- hasInvalid: g,
282
+ hasInvalid: h,
116
283
  hasHint: S,
117
- hasValid: m,
118
- hasLoading: B,
284
+ hasValid: g,
285
+ hasLoading: j,
119
286
  HintSlot: {
120
287
  name: "HintSlot",
121
288
  props: {
@@ -124,31 +291,31 @@ function ae(e, v) {
124
291
  default: () => ({})
125
292
  }
126
293
  },
127
- setup(j) {
128
- const y = computed(() => {
129
- const b = toReactive({
130
- hintLabel: t,
131
- modelValue: l,
132
- valid: d,
133
- validLabel: u,
134
- invalid: s,
135
- invalidLabel: o,
136
- loading: n,
137
- loadingLabel: c,
138
- ...j.params
294
+ setup(V) {
295
+ const b = i(() => {
296
+ const m = re({
297
+ hintLabel: a,
298
+ modelValue: c,
299
+ valid: l,
300
+ validLabel: f,
301
+ invalid: d,
302
+ invalidLabel: u,
303
+ loading: p,
304
+ loadingLabel: y,
305
+ ...V.params
139
306
  });
140
- return s != null && s.value ? (a == null ? void 0 : a(b)) || O(o == null ? void 0 : o.value) || (t == null ? void 0 : t.value) : d != null && d.value ? (p == null ? void 0 : p(b)) || O(u == null ? void 0 : u.value) || (t == null ? void 0 : t.value) : n != null && n.value ? (r == null ? void 0 : r(b)) || O(c == null ? void 0 : c.value) || (t == null ? void 0 : t.value) : (f == null ? void 0 : f(b)) || O(t == null ? void 0 : t.value) || (t == null ? void 0 : t.value);
307
+ return d != null && d.value ? (r == null ? void 0 : r(m)) || _(u == null ? void 0 : u.value) || (a == null ? void 0 : a.value) : l != null && l.value ? (s == null ? void 0 : s(m)) || _(f == null ? void 0 : f.value) || (a == null ? void 0 : a.value) : p != null && p.value ? (o == null ? void 0 : o(m)) || _(y == null ? void 0 : y.value) || (a == null ? void 0 : a.value) : (n == null ? void 0 : n(m)) || _(a == null ? void 0 : a.value) || (a == null ? void 0 : a.value);
141
308
  });
142
309
  return {
143
- isVisible: _,
144
- hasInvalid: g,
145
- hasValid: m,
146
- hintContent: y
310
+ isVisible: B,
311
+ hasInvalid: h,
312
+ hasValid: g,
313
+ hintContent: b
147
314
  };
148
315
  },
149
316
  render() {
150
317
  if (this.isVisible)
151
- return h(
318
+ return w(
152
319
  "small",
153
320
  {
154
321
  role: this.hasInvalid ? "alert" : this.hasValid ? "status" : void 0
@@ -159,68 +326,81 @@ function ae(e, v) {
159
326
  }
160
327
  };
161
328
  }
162
- const oe = ["for"], re = ["id", "name", "disabled", "value", "tabindex", "aria-invalid"], ne = {
329
+ const Ae = (e) => i(() => String((e == null ? void 0 : e.value) || ne()));
330
+ function Be(e, t, r) {
331
+ return i(() => {
332
+ const s = {
333
+ [e]: !0
334
+ }, n = typeof (t == null ? void 0 : t.value) == "string" ? t.value.split(" ") : t == null ? void 0 : t.value;
335
+ return n && Array.isArray(n) && n.forEach((o) => {
336
+ s[`${e}--${o}`] = !0;
337
+ }), r && Object.keys(r.value).forEach((o) => {
338
+ s[`${e}--${o}`] = v(r.value[o]);
339
+ }), s;
340
+ });
341
+ }
342
+ const Ve = ["for"], Re = ["id", "name", "disabled", "value", "tabindex", "aria-invalid"], ke = {
163
343
  name: "VvRadio"
164
- }, ue = /* @__PURE__ */ C({
165
- ...ne,
166
- props: L,
167
- emits: ee,
168
- setup(e, { emit: v }) {
169
- const a = e, p = useSlots(), { id: f, disabled: r, readonly: t, modelValue: l, valid: d, invalid: u } = te(a, v), s = useUniqueId(f), o = computed(() => n.value ? -1 : a.tabindex), V = ref(), n = computed(() => r.value || t.value), c = computed(() => {
170
- if (u.value === !0)
344
+ }, Ne = /* @__PURE__ */ F({
345
+ ...ke,
346
+ props: Se,
347
+ emits: Oe,
348
+ setup(e, { emit: t }) {
349
+ const r = e, s = U(), { id: n, disabled: o, readonly: a, modelValue: c, valid: l, invalid: f } = je(r, t), d = Ae(n), u = i(() => p.value ? -1 : r.tabindex), O = z(), p = i(() => o.value || a.value), y = i(() => {
350
+ if (f.value === !0)
171
351
  return !0;
172
- if (d.value === !0)
352
+ if (l.value === !0)
173
353
  return !1;
174
- }), g = computed(
175
- () => Array.isArray(l.value) ? contains(a.value, l.value) : equals(a.value, l.value)
176
- ), S = computed(
177
- () => ["string", "number", "boolean"].includes(typeof a.value) ? a.value : !0
178
- ), m = computed({
354
+ }), h = i(
355
+ () => Array.isArray(c.value) ? be(r.value, c.value) : G(r.value, c.value)
356
+ ), S = i(
357
+ () => ["string", "number", "boolean"].includes(typeof r.value) ? r.value : !0
358
+ ), g = i({
179
359
  get() {
180
- return g.value ? S.value : null;
360
+ return h.value ? S.value : null;
181
361
  },
182
- set(y) {
183
- Array.isArray(l.value) ? l.value = [a.value] : l.value = a.value, v("change", y);
362
+ set(b) {
363
+ Array.isArray(c.value) ? c.value = [r.value] : c.value = r.value, t("change", b);
184
364
  }
185
- }), { modifiers: B } = toRefs(a), _ = useBemModifiers(
365
+ }), { modifiers: j } = P(r), B = Be(
186
366
  "vv-radio",
187
- B,
188
- computed(() => ({
189
- valid: d.value,
190
- invalid: u.value,
191
- disabled: r.value,
192
- readonly: t.value
367
+ j,
368
+ i(() => ({
369
+ valid: l.value,
370
+ invalid: f.value,
371
+ disabled: o.value,
372
+ readonly: a.value
193
373
  }))
194
- ), { HintSlot: j } = ae(a, p);
195
- return (y, b) => (E(), P("label", {
196
- class: x(i(_)),
197
- for: i(s)
374
+ ), { HintSlot: V } = _e(r, s);
375
+ return (b, m) => (J(), K("label", {
376
+ class: W(v(B)),
377
+ for: v(d)
198
378
  }, [
199
- D(k("input", {
200
- id: i(s),
379
+ Y(Q("input", {
380
+ id: v(d),
201
381
  ref_key: "input",
202
- ref: V,
203
- "onUpdate:modelValue": b[0] || (b[0] = (N) => G(m) ? m.value = N : null),
382
+ ref: O,
383
+ "onUpdate:modelValue": m[0] || (m[0] = ($) => T(g) ? g.value = $ : null),
204
384
  type: "radio",
205
385
  class: "vv-radio__input",
206
- name: y.name,
207
- disabled: i(n),
208
- value: i(S),
209
- tabindex: i(o),
210
- "aria-invalid": i(c)
211
- }, null, 8, re), [
212
- [H, i(m)]
386
+ name: b.name,
387
+ disabled: v(p),
388
+ value: v(S),
389
+ tabindex: v(u),
390
+ "aria-invalid": v(y)
391
+ }, null, 8, Re), [
392
+ [X, v(g)]
213
393
  ]),
214
- F(y.$slots, "default", { value: i(l) }, () => [
215
- M(q(y.label), 1)
394
+ Z(b.$slots, "default", { value: v(c) }, () => [
395
+ L(ee(b.label), 1)
216
396
  ]),
217
- T(i(j), {
397
+ te(v(V), {
218
398
  class: "vv-radio__hint",
219
- params: { value: i(l) }
399
+ params: { value: v(c) }
220
400
  }, null, 8, ["params"])
221
- ], 10, oe));
401
+ ], 10, Ve));
222
402
  }
223
403
  });
224
404
  export {
225
- ue as default
405
+ Ne as default
226
406
  };
@@ -1 +1 @@
1
- (function(t,m){typeof exports=="object"&&typeof module<"u"?module.exports=m(require("vue")):typeof define=="function"&&define.amd?define(["vue"],m):(t=typeof globalThis<"u"?globalThis:t||self,t.VvRadio=m(t.vue))})(this,function(t){"use strict";var m=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(m||{}),N=(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))(N||{}),j=(e=>(e.before="before",e.after="after",e))(j||{});const A=Symbol.for("radioGroup"),C={valid:Boolean,validLabel:[String,Array]},P={invalid:Boolean,invalidLabel:[String,Array]},E={disabled:Boolean},x={readonly:Boolean},k={modifiers:[String,Array]},D={hintLabel:{type:String,default:""}};j.before;const G={tabindex:{type:[String,Number],default:0}},H={id:[String,Number]};m.bottom;const T={...{...H,name:{type:String,required:!0}},...G,...C,...P,...D,...E,...x,...k,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String],label:String},q=["click","update:modelValue","change","blur"];function F(e,f){const{id:a}=toRefs(e),{group:p,isInGroup:v,getGroupOrLocalRef:n}=useInjectedGroupState(A),o=n("modelValue",e,f),l=n("readonly",e),d=n("disabled",e),u=n("valid",e),i=n("invalid",e);return{id:a,group:p,isInGroup:v,modelValue:o,readonly:l,disabled:d,valid:u,invalid:i}}function B(e){return Array.isArray(e)?e.filter(f=>isString(f)).join(" "):e}function M(e,f){const{invalid:a,valid:p,hint:v,loading:n}=f,{hintLabel:o,modelValue:l,valid:d,validLabel:u,invalid:i,invalidLabel:r,..._}=toRefs(e),s=resolveFieldData(_,"loading"),c=resolveFieldData(_,"loadingLabel"),S=computed(()=>i.value?!!(i.value&&a||r!=null&&r.value&&Array.isArray(r.value)&&r.value.length>0||r!=null&&r.value&&!isEmpty(r)):!1),V=computed(()=>!!(o&&o.value||v)),y=computed(()=>!!(u&&u.value||p)),R=computed(()=>!!(s!=null&&s.value&&n||s!=null&&s.value&&(c!=null&&c.value))),O=computed(()=>V.value||y.value||S.value||R.value);return{hasInvalid:S,hasHint:V,hasValid:y,hasLoading:R,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(I){const b=computed(()=>{const g=toReactive({hintLabel:o,modelValue:l,valid:d,validLabel:u,invalid:i,invalidLabel:r,loading:s,loadingLabel:c,...I.params});return i!=null&&i.value?(a==null?void 0:a(g))||B(r==null?void 0:r.value)||(o==null?void 0:o.value):d!=null&&d.value?(p==null?void 0:p(g))||B(u==null?void 0:u.value)||(o==null?void 0:o.value):s!=null&&s.value?(n==null?void 0:n(g))||B(c==null?void 0:c.value)||(o==null?void 0:o.value):(v==null?void 0:v(g))||B(o==null?void 0:o.value)||(o==null?void 0:o.value)});return{isVisible:O,hasInvalid:S,hasValid:y,hintContent:b}},render(){if(this.isVisible)return h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}const U=["for"],w=["id","name","disabled","value","tabindex","aria-invalid"],z={name:"VvRadio"};return t.defineComponent({...z,props:T,emits:q,setup(e,{emit:f}){const a=e,p=useSlots(),{id:v,disabled:n,readonly:o,modelValue:l,valid:d,invalid:u}=F(a,f),i=useUniqueId(v),r=computed(()=>s.value?-1:a.tabindex),_=ref(),s=computed(()=>n.value||o.value),c=computed(()=>{if(u.value===!0)return!0;if(d.value===!0)return!1}),S=computed(()=>Array.isArray(l.value)?contains(a.value,l.value):equals(a.value,l.value)),V=computed(()=>["string","number","boolean"].includes(typeof a.value)?a.value:!0),y=computed({get(){return S.value?V.value:null},set(b){Array.isArray(l.value)?l.value=[a.value]:l.value=a.value,f("change",b)}}),{modifiers:R}=toRefs(a),O=useBemModifiers("vv-radio",R,computed(()=>({valid:d.value,invalid:u.value,disabled:n.value,readonly:o.value}))),{HintSlot:I}=M(a,p);return(b,g)=>(t.openBlock(),t.createElementBlock("label",{class:t.normalizeClass(t.unref(O)),for:t.unref(i)},[t.withDirectives(t.createElementVNode("input",{id:t.unref(i),ref_key:"input",ref:_,"onUpdate:modelValue":g[0]||(g[0]=J=>t.isRef(y)?y.value=J:null),type:"radio",class:"vv-radio__input",name:b.name,disabled:t.unref(s),value:t.unref(V),tabindex:t.unref(r),"aria-invalid":t.unref(c)},null,8,w),[[t.vModelRadio,t.unref(y)]]),t.renderSlot(b.$slots,"default",{value:t.unref(l)},()=>[t.createTextVNode(t.toDisplayString(b.label),1)]),t.createVNode(t.unref(I),{class:"vv-radio__hint",params:{value:t.unref(l)}},null,8,["params"])],10,U))}})});
1
+ (function(n,b){typeof exports=="object"&&typeof module<"u"?module.exports=b(require("vue"),require("@vueuse/core"),require("nanoid")):typeof define=="function"&&define.amd?define(["vue","@vueuse/core","nanoid"],b):(n=typeof globalThis<"u"?globalThis:n||self,n.VvRadio=b(n.vue,n.core,n.nanoid))})(this,function(n,b,q){"use strict";var R=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(R||{}),P=(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))(P||{}),B=(e=>(e.before="before",e.after="after",e))(B||{}),V=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(V||{}),N=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(N||{});const H=Symbol.for("radioGroup"),$={to:{type:[String,Object]},href:String,target:{type:String,validator:e=>Object.values(N).includes(e)},rel:{type:String,default:"noopener noreferrer"}},M={valid:Boolean,validLabel:[String,Array]},w={invalid:Boolean,invalidLabel:[String,Array]},x={disabled:Boolean},F={active:Boolean},U={pressed:Boolean},C={label:[String,Number]},z={readonly:Boolean},T={modifiers:[String,Array]},J={hintLabel:{type:String,default:""}};B.before;const K={tabindex:{type:[String,Number],default:0}},W={id:[String,Number]};R.bottom;const Y={...{...W,name:{type:String,required:!0}},...K,...M,...w,...J,...x,...z,...T,...C,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]};({...x,...C,...U,...F,...$,type:V.button});function D(e,t,r){return r?O(e,r)===O(t,r):k(e,t)}function k(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){const r=Array.isArray(e),u=Array.isArray(t);let o,a,s;if(r&&u){if(a=e.length,a!=t.length)return!1;for(o=a;o--!==0;)if(!k(e[o],t[o]))return!1;return!0}if(r!=u)return!1;const c=e instanceof Date,l=t instanceof Date;if(c!=l)return!1;if(c&&l)return e.getTime()==t.getTime();const f=e instanceof RegExp,d=t instanceof RegExp;if(f!=d)return!1;if(f&&d)return e.toString()==t.toString();const i=Object.keys(e);if(a=i.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[o]))return!1;for(o=a;o--!==0;)if(s=i[o],!k(e[s],t[s]))return!1;return!0}return e!==e&&t!==t}function O(e,t){if(e&&Object.keys(e).length&&t){if(t.indexOf(".")===-1)return e[t];{const r=t.split(".");let u=e;for(let o=0,a=r.length;o<a;++o){if(e==null)return null;u=u[r[o]]}return u}}else return null}function Q(e,t){if(e!=null&&t&&t.length){for(const r of t)if(D(e,r))return!0}return!1}function G(e){return(t=>t==null||t===""||Array.isArray(t)&&t.length===0||!(t instanceof Date)&&typeof t=="object"&&Object.keys(t).length===0)(n.unref(e))}function X(e){return typeof e=="string"||e instanceof String}function Z(e){const t=n.inject(e,void 0),r=n.computed(()=>!G(t));function u(o,a,s){if(t!=null&&t.value){const l=n.unref(t.value)[o];return n.computed({get(){return l==null?void 0:l.value},set(f){l.value=f}})}const c=n.toRef(a,o);return n.computed({get(){return c.value},set(l){s&&s(`update:${o}`,l)}})}return{group:t,isInGroup:r,getGroupOrLocalRef:u}}const L=Y,ee=["click","update:modelValue","change","blur"];function te(e,t){const{id:r}=n.toRefs(e),{group:u,isInGroup:o,getGroupOrLocalRef:a}=Z(H),s=a("modelValue",e,t),c=a("readonly",e),l=a("disabled",e),f=a("valid",e),d=a("invalid",e);return{id:r,group:u,isInGroup:o,modelValue:s,readonly:c,disabled:l,valid:f,invalid:d}}function j(e){return Array.isArray(e)?e.filter(t=>X(t)).join(" "):e}function ne(e,t){const{invalid:r,valid:u,hint:o,loading:a}=t,{hintLabel:s,modelValue:c,valid:l,validLabel:f,invalid:d,invalidLabel:i,..._}=n.toRefs(e),p=O(_,"loading"),y=O(_,"loadingLabel"),h=n.computed(()=>d.value?!!(d.value&&r||i!=null&&i.value&&Array.isArray(i.value)&&i.value.length>0||i!=null&&i.value&&!G(i)):!1),S=n.computed(()=>!!(s&&s.value||o)),v=n.computed(()=>!!(f&&f.value||u)),A=n.computed(()=>!!(p!=null&&p.value&&a||p!=null&&p.value&&(y!=null&&y.value))),E=n.computed(()=>S.value||v.value||h.value||A.value);return{hasInvalid:h,hasHint:S,hasValid:v,hasLoading:A,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(I){const m=n.computed(()=>{const g=b.toReactive({hintLabel:s,modelValue:c,valid:l,validLabel:f,invalid:d,invalidLabel:i,loading:p,loadingLabel:y,...I.params});return d!=null&&d.value?(r==null?void 0:r(g))||j(i==null?void 0:i.value)||(s==null?void 0:s.value):l!=null&&l.value?(u==null?void 0:u(g))||j(f==null?void 0:f.value)||(s==null?void 0:s.value):p!=null&&p.value?(a==null?void 0:a(g))||j(y==null?void 0:y.value)||(s==null?void 0:s.value):(o==null?void 0:o(g))||j(s==null?void 0:s.value)||(s==null?void 0:s.value)});return{isVisible:E,hasInvalid:h,hasValid:v,hintContent:m}},render(){if(this.isVisible)return n.h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}const re=e=>n.computed(()=>String((e==null?void 0:e.value)||q.nanoid()));function oe(e,t,r){return n.computed(()=>{const u={[e]:!0},o=typeof(t==null?void 0:t.value)=="string"?t.value.split(" "):t==null?void 0:t.value;return o&&Array.isArray(o)&&o.forEach(a=>{u[`${e}--${a}`]=!0}),r&&Object.keys(r.value).forEach(a=>{u[`${e}--${a}`]=n.unref(r.value[a])}),u})}const ae=["for"],se=["id","name","disabled","value","tabindex","aria-invalid"],ue={name:"VvRadio"};return n.defineComponent({...ue,props:L,emits:ee,setup(e,{emit:t}){const r=e,u=n.useSlots(),{id:o,disabled:a,readonly:s,modelValue:c,valid:l,invalid:f}=te(r,t),d=re(o),i=n.computed(()=>p.value?-1:r.tabindex),_=n.ref(),p=n.computed(()=>a.value||s.value),y=n.computed(()=>{if(f.value===!0)return!0;if(l.value===!0)return!1}),h=n.computed(()=>Array.isArray(c.value)?Q(r.value,c.value):D(r.value,c.value)),S=n.computed(()=>["string","number","boolean"].includes(typeof r.value)?r.value:!0),v=n.computed({get(){return h.value?S.value:null},set(m){Array.isArray(c.value)?c.value=[r.value]:c.value=r.value,t("change",m)}}),{modifiers:A}=n.toRefs(r),E=oe("vv-radio",A,n.computed(()=>({valid:l.value,invalid:f.value,disabled:a.value,readonly:s.value}))),{HintSlot:I}=ne(r,u);return(m,g)=>(n.openBlock(),n.createElementBlock("label",{class:n.normalizeClass(n.unref(E)),for:n.unref(d)},[n.withDirectives(n.createElementVNode("input",{id:n.unref(d),ref_key:"input",ref:_,"onUpdate:modelValue":g[0]||(g[0]=le=>n.isRef(v)?v.value=le:null),type:"radio",class:"vv-radio__input",name:m.name,disabled:n.unref(p),value:n.unref(S),tabindex:n.unref(i),"aria-invalid":n.unref(y)},null,8,se),[[n.vModelRadio,n.unref(v)]]),n.renderSlot(m.$slots,"default",{value:n.unref(c)},()=>[n.createTextVNode(n.toDisplayString(m.label),1)]),n.createVNode(n.unref(I),{class:"vv-radio__hint",params:{value:n.unref(c)}},null,8,["params"])],10,ae))}})});
@@ -1,7 +1,7 @@
1
1
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
2
2
  value: (StringConstructor | BooleanConstructor | NumberConstructor)[];
3
3
  modelValue: (StringConstructor | BooleanConstructor | ObjectConstructor | NumberConstructor)[];
4
- label: StringConstructor;
4
+ label: (StringConstructor | NumberConstructor)[];
5
5
  modifiers: import("vue").PropType<string | string[]>;
6
6
  readonly: BooleanConstructor;
7
7
  disabled: BooleanConstructor;
@@ -25,7 +25,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
25
25
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
26
26
  value: (StringConstructor | BooleanConstructor | NumberConstructor)[];
27
27
  modelValue: (StringConstructor | BooleanConstructor | ObjectConstructor | NumberConstructor)[];
28
- label: StringConstructor;
28
+ label: (StringConstructor | NumberConstructor)[];
29
29
  modifiers: import("vue").PropType<string | string[]>;
30
30
  readonly: BooleanConstructor;
31
31
  disabled: BooleanConstructor;
@@ -3,7 +3,7 @@ import type { InputGroupState } from '@/types/group';
3
3
  export declare const VvRadioProps: {
4
4
  value: (StringConstructor | BooleanConstructor | NumberConstructor)[];
5
5
  modelValue: (StringConstructor | BooleanConstructor | ObjectConstructor | NumberConstructor)[];
6
- label: StringConstructor;
6
+ label: (StringConstructor | NumberConstructor)[];
7
7
  modifiers: import("vue").PropType<string | string[]>;
8
8
  readonly: BooleanConstructor;
9
9
  disabled: BooleanConstructor;