@volverjs/ui-vue 0.0.2 → 0.0.3-beta.3

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 (171) hide show
  1. package/auto-imports.d.ts +289 -0
  2. package/dist/components/VvAccordion/VvAccordion.es.js +63 -131
  3. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  4. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +2 -2
  5. package/dist/components/VvAccordion/index.d.ts +2 -2
  6. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +97 -176
  7. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  8. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +4 -4
  9. package/dist/components/VvAccordionGroup/index.d.ts +2 -2
  10. package/dist/components/VvBadge/VvBadge.es.js +16 -50
  11. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  12. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +38 -45
  13. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  14. package/dist/components/VvButton/VvButton.es.js +170 -306
  15. package/dist/components/VvButton/VvButton.umd.js +1 -1
  16. package/dist/components/VvButton/VvButton.vue.d.ts +4 -4
  17. package/dist/components/VvButton/index.d.ts +3 -3
  18. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +39 -84
  19. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  20. package/dist/components/VvCard/VvCard.es.js +26 -60
  21. package/dist/components/VvCard/VvCard.umd.js +1 -1
  22. package/dist/components/VvCard/VvCard.vue.d.ts +2 -2
  23. package/dist/components/VvCard/index.d.ts +1 -1
  24. package/dist/components/VvCheckbox/VvCheckbox.es.js +144 -282
  25. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  26. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +6 -6
  27. package/dist/components/VvCheckbox/index.d.ts +10 -4
  28. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +190 -346
  29. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  30. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +7 -7
  31. package/dist/components/VvCheckboxGroup/index.d.ts +3 -3
  32. package/dist/components/VvCombobox/VvCombobox.es.js +330 -487
  33. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  34. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +8 -8
  35. package/dist/components/VvCombobox/index.d.ts +4 -4
  36. package/dist/components/VvDialog/VvDialog.es.js +66 -102
  37. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  38. package/dist/components/VvDropdown/VvDropdown.es.js +61 -185
  39. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  40. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +2 -2
  41. package/dist/components/VvDropdown/index.d.ts +1 -1
  42. package/dist/components/VvIcon/VvIcon.es.js +30 -65
  43. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  44. package/dist/components/VvInputText/VvInputText.es.js +304 -407
  45. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  46. package/dist/components/VvInputText/VvInputText.vue.d.ts +10 -10
  47. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  48. package/dist/components/VvInputText/index.d.ts +5 -5
  49. package/dist/components/VvProgress/VvProgress.es.js +17 -51
  50. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  51. package/dist/components/VvRadio/VvRadio.es.js +110 -249
  52. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  53. package/dist/components/VvRadio/VvRadio.vue.d.ts +6 -6
  54. package/dist/components/VvRadio/index.d.ts +3 -3
  55. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +161 -318
  56. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  57. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +7 -7
  58. package/dist/components/VvRadioGroup/index.d.ts +3 -3
  59. package/dist/components/VvSelect/VvSelect.es.js +200 -292
  60. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  61. package/dist/components/VvSelect/VvSelect.vue.d.ts +8 -8
  62. package/dist/components/VvSelect/index.d.ts +4 -4
  63. package/dist/components/VvTextarea/VvTextarea.es.js +196 -299
  64. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  65. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +6 -6
  66. package/dist/components/VvTextarea/index.d.ts +3 -3
  67. package/dist/components/VvTooltip/VvTooltip.es.js +28 -0
  68. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -0
  69. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +23 -0
  70. package/dist/components/VvTooltip/index.d.ts +18 -0
  71. package/dist/components/common/HintSlot.d.ts +1 -1
  72. package/dist/components/index.es.js +1179 -1371
  73. package/dist/components/index.umd.js +1 -1
  74. package/dist/composables/group/useInjectedGroupState.d.ts +1 -1
  75. package/dist/composables/useComponentFocus.d.ts +1 -1
  76. package/dist/composables/useComponentIcons.d.ts +1 -1
  77. package/dist/composables/useDebouncedInput.d.ts +1 -1
  78. package/dist/composables/useModifiers.d.ts +1 -1
  79. package/dist/composables/useTextCount.d.ts +1 -1
  80. package/dist/icons.es.js +3 -3
  81. package/dist/icons.umd.js +1 -1
  82. package/dist/index.es.js +1211 -1404
  83. package/dist/index.umd.js +1 -1
  84. package/dist/props/index.d.ts +12 -12
  85. package/dist/stories/Tooltip/Tooltip.settings.d.ts +42 -0
  86. package/dist/stories/Tooltip/Tooltip.test.d.ts +2 -0
  87. package/dist/utils/ObjectUtilities.d.ts +1 -1
  88. package/package.json +27 -20
  89. package/src/assets/icons/detailed.json +1 -1
  90. package/src/assets/icons/normal.json +1 -1
  91. package/src/assets/icons/simple.json +1 -1
  92. package/src/components/VvAccordion/VvAccordion.vue +0 -3
  93. package/src/components/VvAccordion/index.ts +1 -2
  94. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +1 -3
  95. package/src/components/VvBadge/VvBadge.vue +0 -1
  96. package/src/components/VvButton/VvButton.vue +0 -3
  97. package/src/components/VvButton/index.ts +2 -10
  98. package/src/components/VvButtonGroup/VvButtonGroup.vue +0 -3
  99. package/src/components/VvCard/VvCard.vue +0 -1
  100. package/src/components/VvCheckbox/VvCheckbox.vue +0 -3
  101. package/src/components/VvCheckbox/index.ts +1 -2
  102. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +0 -5
  103. package/src/components/VvCombobox/VvCombobox.vue +0 -7
  104. package/src/components/VvDialog/VvDialog.vue +1 -2
  105. package/src/components/VvDropdown/VvDropdown.vue +0 -4
  106. package/src/components/VvIcon/VvIcon.vue +0 -2
  107. package/src/components/VvInputText/VvInputClearAction.ts +0 -1
  108. package/src/components/VvInputText/VvInputPasswordAction.ts +0 -1
  109. package/src/components/VvInputText/VvInputStepAction.ts +0 -1
  110. package/src/components/VvInputText/VvInputText.vue +1 -16
  111. package/src/components/VvInputText/VvInputTextActions.ts +1 -1
  112. package/src/components/VvProgress/VvProgress.vue +0 -2
  113. package/src/components/VvRadio/VvRadio.vue +0 -3
  114. package/src/components/VvRadio/index.ts +0 -1
  115. package/src/components/VvRadioGroup/VvRadioGroup.vue +0 -5
  116. package/src/components/VvSelect/VvSelect.vue +1 -14
  117. package/src/components/VvTextarea/VvTextarea.vue +1 -15
  118. package/src/components/VvTooltip/VvTooltip.vue +17 -0
  119. package/src/components/VvTooltip/index.ts +21 -0
  120. package/src/components/common/HintSlot.ts +1 -11
  121. package/src/composables/group/types/IAccordionGroupState.ts +0 -1
  122. package/src/composables/group/types/IButtonGroupState.ts +0 -1
  123. package/src/composables/group/types/IInputGroup.ts +0 -1
  124. package/src/composables/group/useInjectedGroupState.ts +1 -2
  125. package/src/composables/group/useProvideGroupState.ts +0 -1
  126. package/src/composables/useComponentFocus.ts +1 -2
  127. package/src/composables/useComponentIcons.ts +1 -1
  128. package/src/composables/useDebouncedInput.ts +1 -1
  129. package/src/composables/useModifiers.ts +1 -2
  130. package/src/composables/useOptions.ts +0 -1
  131. package/src/composables/useTextCount.ts +1 -1
  132. package/src/stories/Accordion/Accordion.stories.mdx +1 -1
  133. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +1 -1
  134. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +1 -1
  135. package/src/stories/Badge/Badge.stories.mdx +1 -1
  136. package/src/stories/Breadcrumb/Breadcrumb.settings.ts +0 -1
  137. package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +1 -1
  138. package/src/stories/Breadcrumb/BreadcrumbSlots.stories.mdx +1 -1
  139. package/src/stories/Button/Button.stories.mdx +1 -1
  140. package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
  141. package/src/stories/Button/ButtonSlots.stories.mdx +3 -3
  142. package/src/stories/ButtonGroup/ButtonGroup.settings.ts +0 -1
  143. package/src/stories/ButtonGroup/ButtonGroup.stories.mdx +1 -1
  144. package/src/stories/ButtonGroup/ButtonGroupSlots.stories.mdx +1 -1
  145. package/src/stories/Card/Card.stories.mdx +1 -1
  146. package/src/stories/Card/CardSlots.stories.mdx +1 -1
  147. package/src/stories/Checkbox/Checkbox.stories.mdx +1 -1
  148. package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +1 -1
  149. package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +1 -1
  150. package/src/stories/Combobox/Combobox.settings.ts +0 -1
  151. package/src/stories/Combobox/Combobox.stories.mdx +1 -1
  152. package/src/stories/Dialog/Dialog.stories.mdx +1 -1
  153. package/src/stories/Dropdown/Dropdown.settings.ts +0 -1
  154. package/src/stories/Dropdown/Dropdown.stories.mdx +1 -1
  155. package/src/stories/Icon/Icon.settings.ts +0 -1
  156. package/src/stories/Icon/Icon.stories.mdx +1 -1
  157. package/src/stories/Icon/IconsCollection.stories.mdx +1 -1
  158. package/src/stories/InputText/InputText.settings.ts +0 -1
  159. package/src/stories/InputText/InputText.stories.mdx +1 -1
  160. package/src/stories/Progress/Progress.stories.mdx +1 -1
  161. package/src/stories/Radio/Radio.stories.mdx +1 -1
  162. package/src/stories/RadioGroup/RadioGroup.stories.mdx +1 -1
  163. package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +1 -1
  164. package/src/stories/Select/Select.settings.ts +0 -1
  165. package/src/stories/Select/Select.stories.mdx +1 -1
  166. package/src/stories/Textarea/Textarea.settings.ts +0 -1
  167. package/src/stories/Textarea/Textarea.stories.mdx +1 -1
  168. package/src/stories/Tooltip/Tooltip.settings.ts +25 -0
  169. package/src/stories/Tooltip/Tooltip.stories.mdx +98 -0
  170. package/src/stories/Tooltip/Tooltip.test.ts +49 -0
  171. package/src/utils/ObjectUtilities.ts +1 -1
@@ -1,163 +1,37 @@
1
- import { isRef as G, provide as W, computed as c, toRefs as B, unref as f, h as X, inject as Y, toRef as L, defineComponent as D, useSlots as I, ref as ee, openBlock as A, createElementBlock as C, normalizeClass as E, withDirectives as te, createElementVNode as x, vModelRadio as ne, renderSlot as H, createTextVNode as re, toDisplayString as N, createVNode as w, createCommentVNode as oe, Fragment as se, renderList as ae, createBlock as le, mergeProps as ue } from "vue";
2
- import { toReactive as ie, useVModel as ce } from "@vueuse/core";
3
- import { nanoid as fe } from "nanoid";
4
- function de(t) {
5
- if (Object.keys(t).some(
6
- (e) => e !== "key" && !G(t[e])
7
- ))
8
- throw Error("One or more groupState props aren't ref.");
9
- W(
10
- t.key,
11
- c(() => t)
12
- );
13
- }
14
- function ve(t) {
15
- const { options: e, labelKey: r, valueKey: a } = B(t);
16
- return {
17
- options: e,
18
- getOptionLabel: (n) => typeof n != "object" && n !== null ? n : typeof r.value == "function" ? r.value(n) : n[r.value],
19
- getOptionValue: (n) => typeof n != "object" && n !== null ? n : typeof a.value == "function" ? a.value(n) : n[a.value]
20
- };
21
- }
22
- function F(t, e, r) {
23
- return r ? R(t, r) === R(e, r) : j(t, e);
24
- }
25
- function j(t, e) {
26
- if (t === e)
27
- return !0;
28
- if (t && e && typeof t == "object" && typeof e == "object") {
29
- const r = Array.isArray(t), a = Array.isArray(e);
30
- let o, s, n;
31
- if (r && a) {
32
- if (s = t.length, s != e.length)
33
- return !1;
34
- for (o = s; o-- !== 0; )
35
- if (!j(t[o], e[o]))
36
- return !1;
37
- return !0;
38
- }
39
- if (r != a)
40
- return !1;
41
- const d = t instanceof Date, l = e instanceof Date;
42
- if (d != l)
43
- return !1;
44
- if (d && l)
45
- return t.getTime() == e.getTime();
46
- const u = t instanceof RegExp, y = e instanceof RegExp;
47
- if (u != y)
48
- return !1;
49
- if (u && y)
50
- return t.toString() == e.toString();
51
- const i = Object.keys(t);
52
- if (s = i.length, s !== Object.keys(e).length)
53
- return !1;
54
- for (o = s; o-- !== 0; )
55
- if (!Object.prototype.hasOwnProperty.call(e, i[o]))
56
- return !1;
57
- for (o = s; o-- !== 0; )
58
- if (n = i[o], !j(t[n], e[n]))
59
- return !1;
60
- return !0;
61
- }
62
- return t !== t && e !== e;
63
- }
64
- function R(t, e) {
65
- if (t && Object.keys(t).length && e) {
66
- if (e.indexOf(".") === -1)
67
- return t[e];
68
- {
69
- const r = e.split(".");
70
- let a = t;
71
- for (let o = 0, s = r.length; o < s; ++o) {
72
- if (t == null)
73
- return null;
74
- a = a[r[o]];
75
- }
76
- return a;
77
- }
78
- } else
79
- return null;
80
- }
81
- function pe(t, e) {
82
- if (t != null && e && e.length) {
83
- for (const r of e)
84
- if (F(t, r))
85
- return !0;
86
- }
87
- return !1;
88
- }
89
- function M(t) {
90
- return ((e) => e == null || e === "" || Array.isArray(e) && e.length === 0 || !(e instanceof Date) && typeof e == "object" && Object.keys(e).length === 0)(f(t));
91
- }
92
- function ye(t) {
93
- return typeof t == "string" || t instanceof String;
94
- }
95
- function $(t) {
96
- var e, r;
97
- if (t)
98
- return (r = (e = t.match(
99
- /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g
100
- )) == null ? void 0 : e.join("-")) == null ? void 0 : r.toLowerCase();
101
- }
102
- function q(t, e) {
103
- const r = { [`${t}`]: !0 };
104
- return {
105
- bemCssClasses: c(() => Object.keys(e).reduce((o, s) => {
106
- const n = f(e[s]) || !1;
107
- if (!n)
108
- return o;
109
- if (s === "modifiers") {
110
- const d = Array.isArray(n) ? n : n.split(" ");
111
- return {
112
- ...o,
113
- ...d.reduce(
114
- (l, u) => ({
115
- ...l,
116
- [`${t}--${$(u)}`]: !0
117
- }),
118
- {}
119
- )
120
- };
121
- } else
122
- return {
123
- ...o,
124
- [`${t}--${$(s)}`]: n
125
- };
126
- }, r) || {})
127
- };
128
- }
129
- const z = "VV_RADIO_GROUP";
130
- function k(t) {
131
- return Array.isArray(t) ? t.filter((e) => ye(e)).join(" ") : t;
1
+ import { defineComponent as B, openBlock as S, createElementBlock as A, normalizeClass as O, unref as u, withDirectives as q, createElementVNode as G, isRef as U, vModelRadio as w, renderSlot as I, createTextVNode as z, toDisplayString as N, createVNode as D, createCommentVNode as K, Fragment as T, renderList as J, createBlock as Q, mergeProps as W } from "vue";
2
+ import { nanoid as X } from "nanoid";
3
+ const $ = "VV_RADIO_GROUP";
4
+ function C(a) {
5
+ return Array.isArray(a) ? a.filter((v) => isString(v)).join(" ") : a;
132
6
  }
133
- function K(t, e) {
7
+ function H(a, v) {
134
8
  const {
135
- invalid: r,
136
- valid: a,
137
- hint: o,
138
- loading: s
139
- } = e, {
140
- hintLabel: n,
141
- modelValue: d,
142
- valid: l,
143
- validLabel: u,
144
- invalid: y,
145
- invalidLabel: i,
146
- ...b
147
- } = B(t), p = R(b, "loading"), m = R(b, "loadingLabel"), h = c(() => y.value ? !!(y.value && r || i != null && i.value && Array.isArray(i.value) && i.value.length > 0 || i != null && i.value && !M(i)) : !1), v = c(
148
- () => !!(n && n.value || o)
149
- ), V = c(
150
- () => !!(u && u.value || a)
151
- ), _ = c(
152
- () => !!(p != null && p.value && s || p != null && p.value && (m != null && m.value))
153
- ), g = c(
154
- () => v.value || V.value || h.value || _.value
9
+ invalid: t,
10
+ valid: p,
11
+ hint: n,
12
+ loading: i
13
+ } = v, {
14
+ hintLabel: e,
15
+ modelValue: y,
16
+ valid: d,
17
+ validLabel: r,
18
+ invalid: m,
19
+ invalidLabel: o,
20
+ ..._
21
+ } = toRefs(a), l = resolveFieldData(_, "loading"), c = resolveFieldData(_, "loadingLabel"), V = computed(() => m.value ? !!(m.value && t || o != null && o.value && Array.isArray(o.value) && o.value.length > 0 || o != null && o.value && !isEmpty(o)) : !1), s = computed(
22
+ () => !!(e && e.value || n)
23
+ ), g = computed(
24
+ () => !!(r && r.value || p)
25
+ ), b = computed(
26
+ () => !!(l != null && l.value && i || l != null && l.value && (c != null && c.value))
27
+ ), f = computed(
28
+ () => s.value || g.value || V.value || b.value
155
29
  );
156
30
  return {
157
- hasInvalid: h,
158
- hasHint: v,
159
- hasValid: V,
160
- hasLoading: _,
31
+ hasInvalid: V,
32
+ hasHint: s,
33
+ hasValid: g,
34
+ hasLoading: b,
161
35
  HintSlot: {
162
36
  name: "HintSlot",
163
37
  props: {
@@ -166,31 +40,31 @@ function K(t, e) {
166
40
  default: () => ({})
167
41
  }
168
42
  },
169
- setup(O) {
170
- const P = c(() => {
171
- const S = ie({
172
- hintLabel: n,
173
- modelValue: d,
174
- valid: l,
175
- validLabel: u,
176
- invalid: y,
177
- invalidLabel: i,
178
- loading: p,
179
- loadingLabel: m,
180
- ...O.params
43
+ setup(P) {
44
+ const k = computed(() => {
45
+ const R = toReactive({
46
+ hintLabel: e,
47
+ modelValue: y,
48
+ valid: d,
49
+ validLabel: r,
50
+ invalid: m,
51
+ invalidLabel: o,
52
+ loading: l,
53
+ loadingLabel: c,
54
+ ...P.params
181
55
  });
182
- return y != null && y.value ? (r == null ? void 0 : r(S)) || k(i == null ? void 0 : i.value) || (n == null ? void 0 : n.value) : l != null && l.value ? (a == null ? void 0 : a(S)) || k(u == null ? void 0 : u.value) || (n == null ? void 0 : n.value) : p != null && p.value ? (s == null ? void 0 : s(S)) || k(m == null ? void 0 : m.value) || (n == null ? void 0 : n.value) : (o == null ? void 0 : o(S)) || k(n == null ? void 0 : n.value) || (n == null ? void 0 : n.value);
56
+ return m != null && m.value ? (t == null ? void 0 : t(R)) || C(o == null ? void 0 : o.value) || (e == null ? void 0 : e.value) : d != null && d.value ? (p == null ? void 0 : p(R)) || C(r == null ? void 0 : r.value) || (e == null ? void 0 : e.value) : l != null && l.value ? (i == null ? void 0 : i(R)) || C(c == null ? void 0 : c.value) || (e == null ? void 0 : e.value) : (n == null ? void 0 : n(R)) || C(e == null ? void 0 : e.value) || (e == null ? void 0 : e.value);
183
57
  });
184
58
  return {
185
- isVisible: g,
186
- hasInvalid: h,
187
- hasValid: V,
188
- hintContent: P
59
+ isVisible: f,
60
+ hasInvalid: V,
61
+ hasValid: g,
62
+ hintContent: k
189
63
  };
190
64
  },
191
65
  render() {
192
66
  if (this.isVisible)
193
- return X(
67
+ return h(
194
68
  "small",
195
69
  {
196
70
  role: this.hasInvalid || this.hasValid ? "alert" : void 0
@@ -201,198 +75,167 @@ function K(t, e) {
201
75
  }
202
76
  };
203
77
  }
204
- const T = {
78
+ const F = {
205
79
  valid: Boolean,
206
80
  validLabel: [String, Array]
207
- }, Z = {
81
+ }, j = {
208
82
  invalid: Boolean,
209
83
  invalidLabel: [String, Array]
210
- }, U = {
84
+ }, x = {
211
85
  disabled: Boolean
212
- }, J = {
86
+ }, E = {
213
87
  readonly: Boolean
214
- }, Q = {
88
+ }, M = {
215
89
  hintLabel: { type: String, default: "" }
216
- }, me = {
90
+ }, Y = {
217
91
  options: {
218
92
  type: Array,
219
93
  default: () => []
220
94
  },
221
95
  labelKey: { type: [String, Function], default: "label" },
222
96
  valueKey: { type: [String, Function], default: "value" }
223
- }, ge = {
97
+ }, Z = {
224
98
  tabindex: { type: [String, Number], default: 0 }
225
- }, he = {
99
+ }, L = {
226
100
  id: [String, Number],
227
101
  name: { type: String, required: !0 }
228
- }, Ve = {
229
- ...he,
230
- ...ge,
231
- ...T,
102
+ }, ee = {
103
+ ...L,
232
104
  ...Z,
233
- ...Q,
234
- ...U,
235
- ...J,
105
+ ...F,
106
+ ...j,
107
+ ...M,
108
+ ...x,
109
+ ...E,
236
110
  value: [String, Number, Boolean],
237
111
  modelValue: [Object, Number, Boolean, String],
238
112
  label: String
239
- }, be = {
240
- ...T,
241
- ...Z,
242
- ...me,
243
- ...Q,
244
- ...U,
245
- ...J,
113
+ }, te = {
114
+ ...F,
115
+ ...j,
116
+ ...Y,
117
+ ...M,
118
+ ...x,
119
+ ...E,
246
120
  modelValue: [String, Array],
247
121
  label: String,
248
122
  name: { type: String, required: !0 },
249
123
  vertical: Boolean
250
- };
251
- function _e(t) {
252
- const e = Y(t, void 0), r = c(() => !M(e));
253
- function a(o, s, n) {
254
- if (e != null && e.value) {
255
- const l = f(e.value)[o];
256
- return c({
257
- get() {
258
- return l == null ? void 0 : l.value;
259
- },
260
- set(u) {
261
- l.value = u;
262
- }
263
- });
264
- }
265
- const d = L(s, o);
266
- return c({
267
- get() {
268
- return d.value;
269
- },
270
- set(l) {
271
- n && n(`update:${o}`, l);
272
- }
273
- });
274
- }
275
- return {
276
- group: e,
277
- isInGroup: r,
278
- getGroupOrLocalRef: a
279
- };
280
- }
281
- const Ae = Ve, Oe = ["click", "update:modelValue", "change", "blur"];
282
- function Se(t, e) {
283
- const { group: r, isInGroup: a, getGroupOrLocalRef: o } = _e(z), s = o("modelValue", t, e), n = o("readonly", t), d = o("disabled", t), l = o("valid", t), u = o("invalid", t);
124
+ }, oe = ee, ae = ["click", "update:modelValue", "change", "blur"];
125
+ function ne(a, v) {
126
+ const { group: t, isInGroup: p, getGroupOrLocalRef: n } = useInjectedGroupState($), i = n("modelValue", a, v), e = n("readonly", a), y = n("disabled", a), d = n("valid", a), r = n("invalid", a);
284
127
  return {
285
- group: r,
286
- isInGroup: a,
287
- modelValue: s,
288
- readonly: n,
289
- disabled: d,
290
- valid: l,
291
- invalid: u
128
+ group: t,
129
+ isInGroup: p,
130
+ modelValue: i,
131
+ readonly: e,
132
+ disabled: y,
133
+ valid: d,
134
+ invalid: r
292
135
  };
293
136
  }
294
- const ke = ["for"], Ce = ["id", "name", "disabled", "value", "tabindex", "aria-invalid"], Re = {
137
+ const se = ["for"], re = ["id", "name", "disabled", "value", "tabindex", "aria-invalid"], le = {
295
138
  name: "VvRadio"
296
- }, Pe = /* @__PURE__ */ D({
297
- ...Re,
298
- props: Ae,
299
- emits: Oe,
300
- setup(t, { emit: e }) {
301
- const r = t, a = I(), { disabled: o, readonly: s, modelValue: n, valid: d, invalid: l } = Se(
302
- r,
303
- e
304
- ), u = c(() => String(r.id || fe())), y = c(() => b.value ? -1 : r.tabindex), i = ee(), b = c(() => o.value || s.value), p = c(() => {
305
- if (l.value === !0)
306
- return !0;
139
+ }, ue = /* @__PURE__ */ B({
140
+ ...le,
141
+ props: oe,
142
+ emits: ae,
143
+ setup(a, { emit: v }) {
144
+ const t = a, p = useSlots(), { disabled: n, readonly: i, modelValue: e, valid: y, invalid: d } = ne(
145
+ t,
146
+ v
147
+ ), r = computed(() => String(t.id || X())), m = computed(() => _.value ? -1 : t.tabindex), o = ref(), _ = computed(() => n.value || i.value), l = computed(() => {
307
148
  if (d.value === !0)
149
+ return !0;
150
+ if (y.value === !0)
308
151
  return !1;
309
- }), m = c(
310
- () => Array.isArray(n.value) ? pe(r.value, n.value) : F(r.value, n.value)
311
- ), h = c(
312
- () => ["string", "number", "boolean"].includes(typeof r.value) ? r.value : !0
313
- ), v = c({
152
+ }), c = computed(
153
+ () => Array.isArray(e.value) ? contains(t.value, e.value) : equals(t.value, e.value)
154
+ ), V = computed(
155
+ () => ["string", "number", "boolean"].includes(typeof t.value) ? t.value : !0
156
+ ), s = computed({
314
157
  get() {
315
- return m.value ? h.value : null;
158
+ return c.value ? V.value : null;
316
159
  },
317
- set(g) {
318
- Array.isArray(n.value) ? n.value = [r.value] : n.value = r.value, e("change", g);
160
+ set(f) {
161
+ Array.isArray(e.value) ? e.value = [t.value] : e.value = t.value, v("change", f);
319
162
  }
320
- }), { bemCssClasses: V } = q("vv-radio", {
321
- valid: d,
322
- invalid: l,
323
- disabled: o,
324
- readonly: s
325
- }), { HintSlot: _ } = K(r, a);
326
- return (g, O) => (A(), C("label", {
327
- class: E(f(V)),
328
- for: f(u)
163
+ }), { bemCssClasses: g } = useBemModifiers("vv-radio", {
164
+ valid: y,
165
+ invalid: d,
166
+ disabled: n,
167
+ readonly: i
168
+ }), { HintSlot: b } = H(t, p);
169
+ return (f, P) => (S(), A("label", {
170
+ class: O(u(g)),
171
+ for: u(r)
329
172
  }, [
330
- te(x("input", {
331
- id: f(u),
173
+ q(G("input", {
174
+ id: u(r),
332
175
  ref_key: "input",
333
- ref: i,
334
- "onUpdate:modelValue": O[0] || (O[0] = (P) => G(v) ? v.value = P : null),
176
+ ref: o,
177
+ "onUpdate:modelValue": P[0] || (P[0] = (k) => U(s) ? s.value = k : null),
335
178
  type: "radio",
336
179
  class: "vv-radio__input",
337
- name: g.name,
338
- disabled: f(b),
339
- value: f(h),
340
- tabindex: f(y),
341
- "aria-invalid": f(p)
342
- }, null, 8, Ce), [
343
- [ne, f(v)]
180
+ name: f.name,
181
+ disabled: u(_),
182
+ value: u(V),
183
+ tabindex: u(m),
184
+ "aria-invalid": u(l)
185
+ }, null, 8, re), [
186
+ [w, u(s)]
344
187
  ]),
345
- H(g.$slots, "default", { value: f(n) }, () => [
346
- re(N(g.label), 1)
188
+ I(f.$slots, "default", { value: u(e) }, () => [
189
+ z(N(f.label), 1)
347
190
  ]),
348
- w(f(_), {
191
+ D(u(b), {
349
192
  class: "vv-radio__hint",
350
- params: { value: f(n) }
193
+ params: { value: u(e) }
351
194
  }, null, 8, ["params"])
352
- ], 10, ke));
195
+ ], 10, se));
353
196
  }
354
- }), je = be, Be = ["update:modelValue", "change"], $e = ["textContent"], Ge = { class: "vv-radio-group__wrapper" }, De = {
197
+ }), ie = te, de = ["update:modelValue", "change"], ce = ["textContent"], ve = { class: "vv-radio-group__wrapper" }, pe = {
355
198
  name: "VvRadioGroup"
356
- }, He = /* @__PURE__ */ D({
357
- ...De,
358
- props: je,
359
- emits: Be,
360
- setup(t, { emit: e }) {
361
- const r = t, a = I(), o = ce(r, "modelValue", e), { disabled: s, readonly: n, vertical: d, valid: l, invalid: u } = B(r);
362
- de({
363
- key: z,
364
- modelValue: o,
365
- disabled: s,
366
- readonly: n,
367
- valid: l,
368
- invalid: u
369
- });
370
- const { getOptionLabel: i, getOptionValue: b } = ve(r), { bemCssClasses: p } = q("vv-radio-group", {
371
- disabled: s,
372
- readonly: n,
373
- horizontal: c(() => !d.value),
374
- valid: l,
375
- invalid: u
376
- }), m = (v, V) => ({
377
- id: `${r.name}_opt${V}`,
378
- name: r.name,
379
- label: i(v),
380
- value: b(v)
381
- }), { HintSlot: h } = K(r, a);
382
- return (v, V) => (A(), C("fieldset", {
383
- class: E(f(p))
199
+ }, ye = /* @__PURE__ */ B({
200
+ ...pe,
201
+ props: ie,
202
+ emits: de,
203
+ setup(a, { emit: v }) {
204
+ const t = a, p = useSlots(), n = useVModel(t, "modelValue", v), { disabled: i, readonly: e, vertical: y, valid: d, invalid: r } = toRefs(t), m = {
205
+ key: $,
206
+ modelValue: n,
207
+ disabled: i,
208
+ readonly: e,
209
+ valid: d,
210
+ invalid: r
211
+ };
212
+ useProvideGroupState(m);
213
+ const { getOptionLabel: o, getOptionValue: _ } = useOptions(t), { bemCssClasses: l } = useBemModifiers("vv-radio-group", {
214
+ disabled: i,
215
+ readonly: e,
216
+ horizontal: computed(() => !y.value),
217
+ valid: d,
218
+ invalid: r
219
+ }), c = (s, g) => ({
220
+ id: `${t.name}_opt${g}`,
221
+ name: t.name,
222
+ label: o(s),
223
+ value: _(s)
224
+ }), { HintSlot: V } = H(t, p);
225
+ return (s, g) => (S(), A("fieldset", {
226
+ class: O(u(l))
384
227
  }, [
385
- v.label ? (A(), C("legend", {
228
+ s.label ? (S(), A("legend", {
386
229
  key: 0,
387
- textContent: N(v.label)
388
- }, null, 8, $e)) : oe("", !0),
389
- x("div", Ge, [
390
- v.options.length > 0 ? (A(!0), C(se, { key: 0 }, ae(v.options, (_, g) => (A(), le(Pe, ue({ key: g }, m(_, g)), null, 16))), 128)) : H(v.$slots, "default", { key: 1 })
230
+ textContent: N(s.label)
231
+ }, null, 8, ce)) : K("", !0),
232
+ G("div", ve, [
233
+ s.options.length > 0 ? (S(!0), A(T, { key: 0 }, J(s.options, (b, f) => (S(), Q(ue, W({ key: f }, c(b, f)), null, 16))), 128)) : I(s.$slots, "default", { key: 1 })
391
234
  ]),
392
- w(f(h), { class: "vv-radio-group__hint" })
235
+ D(u(V), { class: "vv-radio-group__hint" })
393
236
  ], 2));
394
237
  }
395
238
  });
396
239
  export {
397
- He as default
240
+ ye as default
398
241
  };
@@ -1 +1 @@
1
- (function(e,_){typeof exports=="object"&&typeof module<"u"?module.exports=_(require("vue"),require("@vueuse/core"),require("nanoid")):typeof define=="function"&&define.amd?define(["vue","@vueuse/core","nanoid"],_):(e=typeof globalThis<"u"?globalThis:e||self,e.VvRadioGroup=_(e.vue,e.core,e.nanoid))})(this,function(e,_,H){"use strict";function T(n){if(Object.keys(n).some(t=>t!=="key"&&!e.isRef(n[t])))throw Error("One or more groupState props aren't ref.");e.provide(n.key,e.computed(()=>n))}function w(n){const{options:t,labelKey:o,valueKey:l}=e.toRefs(n);return{options:t,getOptionLabel:r=>typeof r!="object"&&r!==null?r:typeof o.value=="function"?o.value(r):r[o.value],getOptionValue:r=>typeof r!="object"&&r!==null?r:typeof l.value=="function"?l.value(r):r[l.value]}}function P(n,t,o){return o?k(n,o)===k(t,o):R(n,t)}function R(n,t){if(n===t)return!0;if(n&&t&&typeof n=="object"&&typeof t=="object"){const o=Array.isArray(n),l=Array.isArray(t);let s,a,r;if(o&&l){if(a=n.length,a!=t.length)return!1;for(s=a;s--!==0;)if(!R(n[s],t[s]))return!1;return!0}if(o!=l)return!1;const d=n instanceof Date,i=t instanceof Date;if(d!=i)return!1;if(d&&i)return n.getTime()==t.getTime();const u=n instanceof RegExp,m=t instanceof RegExp;if(u!=m)return!1;if(u&&m)return n.toString()==t.toString();const c=Object.keys(n);if(a=c.length,a!==Object.keys(t).length)return!1;for(s=a;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,c[s]))return!1;for(s=a;s--!==0;)if(r=c[s],!R(n[r],t[r]))return!1;return!0}return n!==n&&t!==t}function k(n,t){if(n&&Object.keys(n).length&&t){if(t.indexOf(".")===-1)return n[t];{const o=t.split(".");let l=n;for(let s=0,a=o.length;s<a;++s){if(n==null)return null;l=l[o[s]]}return l}}else return null}function z(n,t){if(n!=null&&t&&t.length){for(const o of t)if(P(n,o))return!0}return!1}function B(n){return(t=>t==null||t===""||Array.isArray(t)&&t.length===0||!(t instanceof Date)&&typeof t=="object"&&Object.keys(t).length===0)(e.unref(n))}function F(n){return typeof n=="string"||n instanceof String}function j(n){var t,o;if(n)return(o=(t=n.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:t.join("-"))==null?void 0:o.toLowerCase()}function G(n,t){const o={[`${n}`]:!0};return{bemCssClasses:e.computed(()=>Object.keys(t).reduce((s,a)=>{const r=e.unref(t[a])||!1;if(!r)return s;if(a==="modifiers"){const d=Array.isArray(r)?r:r.split(" ");return{...s,...d.reduce((i,u)=>({...i,[`${n}--${j(u)}`]:!0}),{})}}else return{...s,[`${n}--${j(a)}`]:r}},o)||{})}}const $="VV_RADIO_GROUP";function A(n){return Array.isArray(n)?n.filter(t=>F(t)).join(" "):n}function E(n,t){const{invalid:o,valid:l,hint:s,loading:a}=t,{hintLabel:r,modelValue:d,valid:i,validLabel:u,invalid:m,invalidLabel:c,...v}=e.toRefs(n),p=k(v,"loading"),y=k(v,"loadingLabel"),h=e.computed(()=>m.value?!!(m.value&&o||c!=null&&c.value&&Array.isArray(c.value)&&c.value.length>0||c!=null&&c.value&&!B(c)):!1),f=e.computed(()=>!!(r&&r.value||s)),V=e.computed(()=>!!(u&&u.value||l)),b=e.computed(()=>!!(p!=null&&p.value&&a||p!=null&&p.value&&(y!=null&&y.value))),g=e.computed(()=>f.value||V.value||h.value||b.value);return{hasInvalid:h,hasHint:f,hasValid:V,hasLoading:b,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(S){const C=e.computed(()=>{const O=_.toReactive({hintLabel:r,modelValue:d,valid:i,validLabel:u,invalid:m,invalidLabel:c,loading:p,loadingLabel:y,...S.params});return m!=null&&m.value?(o==null?void 0:o(O))||A(c==null?void 0:c.value)||(r==null?void 0:r.value):i!=null&&i.value?(l==null?void 0:l(O))||A(u==null?void 0:u.value)||(r==null?void 0:r.value):p!=null&&p.value?(a==null?void 0:a(O))||A(y==null?void 0:y.value)||(r==null?void 0:r.value):(s==null?void 0:s(O))||A(r==null?void 0:r.value)||(r==null?void 0:r.value)});return{isVisible:g,hasInvalid:h,hasValid:V,hintContent:C}},render(){if(this.isVisible)return e.h("small",{role:this.hasInvalid||this.hasValid?"alert":void 0},this.hintContent)}}}}const D={valid:Boolean,validLabel:[String,Array]},I={invalid:Boolean,invalidLabel:[String,Array]},x={disabled:Boolean},N={readonly:Boolean},q={hintLabel:{type:String,default:""}},M={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"}},K={...{id:[String,Number],name:{type:String,required:!0}},...{tabindex:{type:[String,Number],default:0}},...D,...I,...q,...x,...N,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String],label:String},Z={...D,...I,...M,...q,...x,...N,modelValue:[String,Array],label:String,name:{type:String,required:!0},vertical:Boolean};function U(n){const t=e.inject(n,void 0),o=e.computed(()=>!B(t));function l(s,a,r){if(t!=null&&t.value){const i=e.unref(t.value)[s];return e.computed({get(){return i==null?void 0:i.value},set(u){i.value=u}})}const d=e.toRef(a,s);return e.computed({get(){return d.value},set(i){r&&r(`update:${s}`,i)}})}return{group:t,isInGroup:o,getGroupOrLocalRef:l}}const J=K,Q=["click","update:modelValue","change","blur"];function W(n,t){const{group:o,isInGroup:l,getGroupOrLocalRef:s}=U($),a=s("modelValue",n,t),r=s("readonly",n),d=s("disabled",n),i=s("valid",n),u=s("invalid",n);return{group:o,isInGroup:l,modelValue:a,readonly:r,disabled:d,valid:i,invalid:u}}const X=["for"],Y=["id","name","disabled","value","tabindex","aria-invalid"],L={name:"VvRadio"},ee=e.defineComponent({...L,props:J,emits:Q,setup(n,{emit:t}){const o=n,l=e.useSlots(),{disabled:s,readonly:a,modelValue:r,valid:d,invalid:i}=W(o,t),u=e.computed(()=>String(o.id||H.nanoid())),m=e.computed(()=>v.value?-1:o.tabindex),c=e.ref(),v=e.computed(()=>s.value||a.value),p=e.computed(()=>{if(i.value===!0)return!0;if(d.value===!0)return!1}),y=e.computed(()=>Array.isArray(r.value)?z(o.value,r.value):P(o.value,r.value)),h=e.computed(()=>["string","number","boolean"].includes(typeof o.value)?o.value:!0),f=e.computed({get(){return y.value?h.value:null},set(g){Array.isArray(r.value)?r.value=[o.value]:r.value=o.value,t("change",g)}}),{bemCssClasses:V}=G("vv-radio",{valid:d,invalid:i,disabled:s,readonly:a}),{HintSlot:b}=E(o,l);return(g,S)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(V)),for:e.unref(u)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(u),ref_key:"input",ref:c,"onUpdate:modelValue":S[0]||(S[0]=C=>e.isRef(f)?f.value=C:null),type:"radio",class:"vv-radio__input",name:g.name,disabled:e.unref(v),value:e.unref(h),tabindex:e.unref(m),"aria-invalid":e.unref(p)},null,8,Y),[[e.vModelRadio,e.unref(f)]]),e.renderSlot(g.$slots,"default",{value:e.unref(r)},()=>[e.createTextVNode(e.toDisplayString(g.label),1)]),e.createVNode(e.unref(b),{class:"vv-radio__hint",params:{value:e.unref(r)}},null,8,["params"])],10,X))}}),te=Z,ne=["update:modelValue","change"],re=["textContent"],oe={class:"vv-radio-group__wrapper"},se={name:"VvRadioGroup"};return e.defineComponent({...se,props:te,emits:ne,setup(n,{emit:t}){const o=n,l=e.useSlots(),s=_.useVModel(o,"modelValue",t),{disabled:a,readonly:r,vertical:d,valid:i,invalid:u}=e.toRefs(o);T({key:$,modelValue:s,disabled:a,readonly:r,valid:i,invalid:u});const{getOptionLabel:c,getOptionValue:v}=w(o),{bemCssClasses:p}=G("vv-radio-group",{disabled:a,readonly:r,horizontal:e.computed(()=>!d.value),valid:i,invalid:u}),y=(f,V)=>({id:`${o.name}_opt${V}`,name:o.name,label:c(f),value:v(f)}),{HintSlot:h}=E(o,l);return(f,V)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(p))},[f.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(f.label)},null,8,re)):e.createCommentVNode("",!0),e.createElementVNode("div",oe,[f.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(f.options,(b,g)=>(e.openBlock(),e.createBlock(ee,e.mergeProps({key:g},y(b,g)),null,16))),128)):e.renderSlot(f.$slots,"default",{key:1})]),e.createVNode(e.unref(h),{class:"vv-radio-group__hint"})],2))}})});
1
+ (function(e,S){typeof exports=="object"&&typeof module<"u"?module.exports=S(require("vue"),require("nanoid")):typeof define=="function"&&define.amd?define(["vue","nanoid"],S):(e=typeof globalThis<"u"?globalThis:e||self,e.VvRadioGroup=S(e.vue,e.nanoid))})(this,function(e,S){"use strict";const C="VV_RADIO_GROUP";function P(a){return Array.isArray(a)?a.filter(p=>isString(p)).join(" "):a}function A(a,p){const{invalid:o,valid:m,hint:r,loading:u}=p,{hintLabel:t,modelValue:y,valid:d,validLabel:l,invalid:f,invalidLabel:n,..._}=toRefs(a),i=resolveFieldData(_,"loading"),c=resolveFieldData(_,"loadingLabel"),V=computed(()=>f.value?!!(f.value&&o||n!=null&&n.value&&Array.isArray(n.value)&&n.value.length>0||n!=null&&n.value&&!isEmpty(n)):!1),s=computed(()=>!!(t&&t.value||r)),g=computed(()=>!!(l&&l.value||m)),b=computed(()=>!!(i!=null&&i.value&&u||i!=null&&i.value&&(c!=null&&c.value))),v=computed(()=>s.value||g.value||V.value||b.value);return{hasInvalid:V,hasHint:s,hasValid:g,hasLoading:b,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(k){const B=computed(()=>{const R=toReactive({hintLabel:t,modelValue:y,valid:d,validLabel:l,invalid:f,invalidLabel:n,loading:i,loadingLabel:c,...k.params});return f!=null&&f.value?(o==null?void 0:o(R))||P(n==null?void 0:n.value)||(t==null?void 0:t.value):d!=null&&d.value?(m==null?void 0:m(R))||P(l==null?void 0:l.value)||(t==null?void 0:t.value):i!=null&&i.value?(u==null?void 0:u(R))||P(c==null?void 0:c.value)||(t==null?void 0:t.value):(r==null?void 0:r(R))||P(t==null?void 0:t.value)||(t==null?void 0:t.value)});return{isVisible:v,hasInvalid:V,hasValid:g,hintContent:B}},render(){if(this.isVisible)return h("small",{role:this.hasInvalid||this.hasValid?"alert":void 0},this.hintContent)}}}}const G={valid:Boolean,validLabel:[String,Array]},N={invalid:Boolean,invalidLabel:[String,Array]},O={disabled:Boolean},I={readonly:Boolean},D={hintLabel:{type:String,default:""}},E={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"}},$={...{id:[String,Number],name:{type:String,required:!0}},...{tabindex:{type:[String,Number],default:0}},...G,...N,...D,...O,...I,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String],label:String},x={...G,...N,...E,...D,...O,...I,modelValue:[String,Array],label:String,name:{type:String,required:!0},vertical:Boolean},H=$,j=["click","update:modelValue","change","blur"];function F(a,p){const{group:o,isInGroup:m,getGroupOrLocalRef:r}=useInjectedGroupState(C),u=r("modelValue",a,p),t=r("readonly",a),y=r("disabled",a),d=r("valid",a),l=r("invalid",a);return{group:o,isInGroup:m,modelValue:u,readonly:t,disabled:y,valid:d,invalid:l}}const q=["for"],M=["id","name","disabled","value","tabindex","aria-invalid"],T={name:"VvRadio"},z=e.defineComponent({...T,props:H,emits:j,setup(a,{emit:p}){const o=a,m=useSlots(),{disabled:r,readonly:u,modelValue:t,valid:y,invalid:d}=F(o,p),l=computed(()=>String(o.id||S.nanoid())),f=computed(()=>_.value?-1:o.tabindex),n=ref(),_=computed(()=>r.value||u.value),i=computed(()=>{if(d.value===!0)return!0;if(y.value===!0)return!1}),c=computed(()=>Array.isArray(t.value)?contains(o.value,t.value):equals(o.value,t.value)),V=computed(()=>["string","number","boolean"].includes(typeof o.value)?o.value:!0),s=computed({get(){return c.value?V.value:null},set(v){Array.isArray(t.value)?t.value=[o.value]:t.value=o.value,p("change",v)}}),{bemCssClasses:g}=useBemModifiers("vv-radio",{valid:y,invalid:d,disabled:r,readonly:u}),{HintSlot:b}=A(o,m);return(v,k)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(g)),for:e.unref(l)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(l),ref_key:"input",ref:n,"onUpdate:modelValue":k[0]||(k[0]=B=>e.isRef(s)?s.value=B:null),type:"radio",class:"vv-radio__input",name:v.name,disabled:e.unref(_),value:e.unref(V),tabindex:e.unref(f),"aria-invalid":e.unref(i)},null,8,M),[[e.vModelRadio,e.unref(s)]]),e.renderSlot(v.$slots,"default",{value:e.unref(t)},()=>[e.createTextVNode(e.toDisplayString(v.label),1)]),e.createVNode(e.unref(b),{class:"vv-radio__hint",params:{value:e.unref(t)}},null,8,["params"])],10,q))}}),U=x,w=["update:modelValue","change"],K=["textContent"],J={class:"vv-radio-group__wrapper"},Q={name:"VvRadioGroup"};return e.defineComponent({...Q,props:U,emits:w,setup(a,{emit:p}){const o=a,m=useSlots(),r=useVModel(o,"modelValue",p),{disabled:u,readonly:t,vertical:y,valid:d,invalid:l}=toRefs(o),f={key:C,modelValue:r,disabled:u,readonly:t,valid:d,invalid:l};useProvideGroupState(f);const{getOptionLabel:n,getOptionValue:_}=useOptions(o),{bemCssClasses:i}=useBemModifiers("vv-radio-group",{disabled:u,readonly:t,horizontal:computed(()=>!y.value),valid:d,invalid:l}),c=(s,g)=>({id:`${o.name}_opt${g}`,name:o.name,label:n(s),value:_(s)}),{HintSlot:V}=A(o,m);return(s,g)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(i))},[s.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(s.label)},null,8,K)):e.createCommentVNode("",!0),e.createElementVNode("div",J,[s.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(s.options,(b,v)=>(e.openBlock(),e.createBlock(z,e.mergeProps({key:v},c(b,v)),null,16))),128)):e.renderSlot(s.$slots,"default",{key:1})]),e.createVNode(e.unref(V),{class:"vv-radio-group__hint"})],2))}})});
@@ -1,6 +1,6 @@
1
1
  import type { Option } from '@/types/generic';
2
2
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
3
- modelValue: (ArrayConstructor | StringConstructor)[];
3
+ modelValue: (StringConstructor | ArrayConstructor)[];
4
4
  label: StringConstructor;
5
5
  name: {
6
6
  type: StringConstructor;
@@ -26,11 +26,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
26
26
  default: string;
27
27
  };
28
28
  invalid: BooleanConstructor;
29
- invalidLabel: (ArrayConstructor | StringConstructor)[];
29
+ invalidLabel: (StringConstructor | ArrayConstructor)[];
30
30
  valid: BooleanConstructor;
31
- validLabel: (ArrayConstructor | StringConstructor)[];
31
+ validLabel: (StringConstructor | ArrayConstructor)[];
32
32
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
33
- modelValue: (ArrayConstructor | StringConstructor)[];
33
+ modelValue: (StringConstructor | ArrayConstructor)[];
34
34
  label: StringConstructor;
35
35
  name: {
36
36
  type: StringConstructor;
@@ -56,9 +56,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
56
56
  default: string;
57
57
  };
58
58
  invalid: BooleanConstructor;
59
- invalidLabel: (ArrayConstructor | StringConstructor)[];
59
+ invalidLabel: (StringConstructor | ArrayConstructor)[];
60
60
  valid: BooleanConstructor;
61
- validLabel: (ArrayConstructor | StringConstructor)[];
61
+ validLabel: (StringConstructor | ArrayConstructor)[];
62
62
  }>> & {
63
63
  [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
64
64
  }, {
@@ -67,10 +67,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
67
67
  hintLabel: string;
68
68
  invalid: boolean;
69
69
  valid: boolean;
70
+ vertical: boolean;
70
71
  options: (string | Option)[];
71
72
  labelKey: string | Function;
72
73
  valueKey: string | Function;
73
- vertical: boolean;
74
74
  }>, {
75
75
  default: (_: {}) => any;
76
76
  }>;