@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 E, provide as ee, computed as c, toRefs as j, unref as f, h as te, inject as ne, toRef as re, defineComponent as w, useSlots as I, ref as oe, watchEffect as se, watch as ue, onMounted as ae, openBlock as O, createElementBlock as P, normalizeClass as H, withDirectives as le, createElementVNode as D, vModelCheckbox as ie, renderSlot as N, createTextVNode as ce, toDisplayString as K, createVNode as M, createCommentVNode as fe, Fragment as ve, renderList as de, createBlock as pe, mergeProps as ye } from "vue";
2
- import { toReactive as me, useVModel as he } from "@vueuse/core";
3
- import { nanoid as ge } from "nanoid";
4
- const F = "VV_CHECK_GROUP";
5
- function be(t) {
6
- if (Object.keys(t).some(
7
- (e) => e !== "key" && !E(t[e])
8
- ))
9
- throw Error("One or more groupState props aren't ref.");
10
- ee(
11
- t.key,
12
- c(() => t)
13
- );
14
- }
15
- function ke(t) {
16
- const { options: e, labelKey: n, valueKey: a } = j(t);
17
- return {
18
- options: e,
19
- getOptionLabel: (r) => typeof r != "object" && r !== null ? r : typeof n.value == "function" ? n.value(r) : r[n.value],
20
- getOptionValue: (r) => typeof r != "object" && r !== null ? r : typeof a.value == "function" ? a.value(r) : r[a.value]
21
- };
22
- }
23
- function T(t, e, n) {
24
- return n ? B(t, n) === B(e, n) : G(t, e);
25
- }
26
- function G(t, e) {
27
- if (t === e)
28
- return !0;
29
- if (t && e && typeof t == "object" && typeof e == "object") {
30
- const n = Array.isArray(t), a = Array.isArray(e);
31
- let o, u, r;
32
- if (n && a) {
33
- if (u = t.length, u != e.length)
34
- return !1;
35
- for (o = u; o-- !== 0; )
36
- if (!G(t[o], e[o]))
37
- return !1;
38
- return !0;
39
- }
40
- if (n != a)
41
- return !1;
42
- const v = t instanceof Date, i = e instanceof Date;
43
- if (v != i)
44
- return !1;
45
- if (v && i)
46
- return t.getTime() == e.getTime();
47
- const s = t instanceof RegExp, d = e instanceof RegExp;
48
- if (s != d)
49
- return !1;
50
- if (s && d)
51
- return t.toString() == e.toString();
52
- const l = Object.keys(t);
53
- if (u = l.length, u !== Object.keys(e).length)
54
- return !1;
55
- for (o = u; o-- !== 0; )
56
- if (!Object.prototype.hasOwnProperty.call(e, l[o]))
57
- return !1;
58
- for (o = u; o-- !== 0; )
59
- if (r = l[o], !G(t[r], e[r]))
60
- return !1;
61
- return !0;
62
- }
63
- return t !== t && e !== e;
1
+ import { defineComponent as R, openBlock as P, createElementBlock as B, normalizeClass as N, unref as c, withDirectives as U, createElementVNode as O, isRef as z, vModelCheckbox as J, renderSlot as H, createTextVNode as Q, toDisplayString as I, createVNode as w, createCommentVNode as W, Fragment as X, renderList as Y, createBlock as Z, mergeProps as L } from "vue";
2
+ import { nanoid as ee } from "nanoid";
3
+ const E = "VV_CHECK_GROUP";
4
+ function A(n) {
5
+ return Array.isArray(n) ? n.filter((m) => isString(m)).join(" ") : n;
64
6
  }
65
- function B(t, e) {
66
- if (t && Object.keys(t).length && e) {
67
- if (e.indexOf(".") === -1)
68
- return t[e];
69
- {
70
- const n = e.split(".");
71
- let a = t;
72
- for (let o = 0, u = n.length; o < u; ++o) {
73
- if (t == null)
74
- return null;
75
- a = a[n[o]];
76
- }
77
- return a;
78
- }
79
- } else
80
- return null;
81
- }
82
- function Ve(t, e) {
83
- if (t != null && e && e.length) {
84
- for (const n of e)
85
- if (T(t, n))
86
- return !0;
87
- }
88
- return !1;
89
- }
90
- function q(t) {
91
- return ((e) => e == null || e === "" || Array.isArray(e) && e.length === 0 || !(e instanceof Date) && typeof e == "object" && Object.keys(e).length === 0)(f(t));
92
- }
93
- function Ce(t) {
94
- return typeof t == "string" || t instanceof String;
95
- }
96
- function $(t) {
97
- var e, n;
98
- if (t)
99
- return (n = (e = t.match(
100
- /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g
101
- )) == null ? void 0 : e.join("-")) == null ? void 0 : n.toLowerCase();
102
- }
103
- function z(t, e) {
104
- const n = { [`${t}`]: !0 };
105
- return {
106
- bemCssClasses: c(() => Object.keys(e).reduce((o, u) => {
107
- const r = f(e[u]) || !1;
108
- if (!r)
109
- return o;
110
- if (u === "modifiers") {
111
- const v = Array.isArray(r) ? r : r.split(" ");
112
- return {
113
- ...o,
114
- ...v.reduce(
115
- (i, s) => ({
116
- ...i,
117
- [`${t}--${$(s)}`]: !0
118
- }),
119
- {}
120
- )
121
- };
122
- } else
123
- return {
124
- ...o,
125
- [`${t}--${$(u)}`]: r
126
- };
127
- }, n) || {})
128
- };
129
- }
130
- function x(t) {
131
- return Array.isArray(t) ? t.filter((e) => Ce(e)).join(" ") : t;
132
- }
133
- function Z(t, e) {
7
+ function $(n, m) {
134
8
  const {
135
- invalid: n,
136
- valid: a,
137
- hint: o,
138
- loading: u
139
- } = e, {
140
- hintLabel: r,
141
- modelValue: v,
142
- valid: i,
143
- validLabel: s,
144
- invalid: d,
145
- invalidLabel: l,
146
- ...k
147
- } = j(t), p = B(k, "loading"), y = B(k, "loadingLabel"), h = c(() => d.value ? !!(d.value && n || l != null && l.value && Array.isArray(l.value) && l.value.length > 0 || l != null && l.value && !q(l)) : !1), m = c(
148
- () => !!(r && r.value || o)
149
- ), b = c(
150
- () => !!(s && s.value || a)
151
- ), V = c(
152
- () => !!(p != null && p.value && u || p != null && p.value && (y != null && y.value))
153
- ), C = c(
154
- () => m.value || b.value || h.value || V.value
9
+ invalid: e,
10
+ valid: f,
11
+ hint: r,
12
+ loading: d
13
+ } = m, {
14
+ hintLabel: a,
15
+ modelValue: b,
16
+ valid: v,
17
+ validLabel: t,
18
+ invalid: i,
19
+ invalidLabel: o,
20
+ ...g
21
+ } = toRefs(n), l = resolveFieldData(g, "loading"), u = resolveFieldData(g, "loadingLabel"), p = computed(() => i.value ? !!(i.value && e || o != null && o.value && Array.isArray(o.value) && o.value.length > 0 || o != null && o.value && !isEmpty(o)) : !1), s = computed(
22
+ () => !!(a && a.value || r)
23
+ ), V = computed(
24
+ () => !!(t && t.value || f)
25
+ ), k = computed(
26
+ () => !!(l != null && l.value && d || l != null && l.value && (u != null && u.value))
27
+ ), S = computed(
28
+ () => s.value || V.value || p.value || k.value
155
29
  );
156
30
  return {
157
- hasInvalid: h,
158
- hasHint: m,
159
- hasValid: b,
160
- hasLoading: V,
31
+ hasInvalid: p,
32
+ hasHint: s,
33
+ hasValid: V,
34
+ hasLoading: k,
161
35
  HintSlot: {
162
36
  name: "HintSlot",
163
37
  props: {
@@ -166,31 +40,31 @@ function Z(t, e) {
166
40
  default: () => ({})
167
41
  }
168
42
  },
169
- setup(R) {
170
- const S = c(() => {
171
- const A = me({
172
- hintLabel: r,
173
- modelValue: v,
174
- valid: i,
175
- validLabel: s,
176
- invalid: d,
177
- invalidLabel: l,
178
- loading: p,
179
- loadingLabel: y,
180
- ...R.params
43
+ setup(G) {
44
+ const x = computed(() => {
45
+ const _ = toReactive({
46
+ hintLabel: a,
47
+ modelValue: b,
48
+ valid: v,
49
+ validLabel: t,
50
+ invalid: i,
51
+ invalidLabel: o,
52
+ loading: l,
53
+ loadingLabel: u,
54
+ ...G.params
181
55
  });
182
- return d != null && d.value ? (n == null ? void 0 : n(A)) || x(l == null ? void 0 : l.value) || (r == null ? void 0 : r.value) : i != null && i.value ? (a == null ? void 0 : a(A)) || x(s == null ? void 0 : s.value) || (r == null ? void 0 : r.value) : p != null && p.value ? (u == null ? void 0 : u(A)) || x(y == null ? void 0 : y.value) || (r == null ? void 0 : r.value) : (o == null ? void 0 : o(A)) || x(r == null ? void 0 : r.value) || (r == null ? void 0 : r.value);
56
+ return i != null && i.value ? (e == null ? void 0 : e(_)) || A(o == null ? void 0 : o.value) || (a == null ? void 0 : a.value) : v != null && v.value ? (f == null ? void 0 : f(_)) || A(t == null ? void 0 : t.value) || (a == null ? void 0 : a.value) : l != null && l.value ? (d == null ? void 0 : d(_)) || A(u == null ? void 0 : u.value) || (a == null ? void 0 : a.value) : (r == null ? void 0 : r(_)) || A(a == null ? void 0 : a.value) || (a == null ? void 0 : a.value);
183
57
  });
184
58
  return {
185
- isVisible: C,
186
- hasInvalid: h,
187
- hasValid: b,
188
- hintContent: S
59
+ isVisible: S,
60
+ hasInvalid: p,
61
+ hasValid: V,
62
+ hintContent: x
189
63
  };
190
64
  },
191
65
  render() {
192
66
  if (this.isVisible)
193
- return te(
67
+ return h(
194
68
  "small",
195
69
  {
196
70
  role: this.hasInvalid || this.hasValid ? "alert" : void 0
@@ -201,235 +75,205 @@ function Z(t, e) {
201
75
  }
202
76
  };
203
77
  }
204
- function Ae(t) {
205
- const e = ne(t, void 0), n = c(() => !q(e));
206
- function a(o, u, r) {
207
- if (e != null && e.value) {
208
- const i = f(e.value)[o];
209
- return c({
210
- get() {
211
- return i == null ? void 0 : i.value;
212
- },
213
- set(s) {
214
- i.value = s;
215
- }
216
- });
217
- }
218
- const v = re(u, o);
219
- return c({
220
- get() {
221
- return v.value;
222
- },
223
- set(i) {
224
- r && r(`update:${o}`, i);
225
- }
226
- });
227
- }
228
- return {
229
- group: e,
230
- isInGroup: n,
231
- getGroupOrLocalRef: a
232
- };
233
- }
234
- const U = {
78
+ const D = {
235
79
  valid: Boolean,
236
80
  validLabel: [String, Array]
237
- }, J = {
81
+ }, F = {
238
82
  invalid: Boolean,
239
83
  invalidLabel: [String, Array]
240
- }, Q = {
84
+ }, M = {
241
85
  disabled: Boolean
242
- }, W = {
86
+ }, j = {
243
87
  readonly: Boolean
244
- }, X = {
88
+ }, K = {
245
89
  hintLabel: { type: String, default: "" }
246
- }, _e = {
90
+ }, te = {
247
91
  options: {
248
92
  type: Array,
249
93
  default: () => []
250
94
  },
251
95
  labelKey: { type: [String, Function], default: "label" },
252
96
  valueKey: { type: [String, Function], default: "value" }
253
- }, Se = {
97
+ }, ae = {
254
98
  tabindex: { type: [String, Number], default: 0 }
255
- }, Oe = {
99
+ }, oe = {
256
100
  id: [String, Number],
257
101
  name: { type: String, required: !0 }
258
- }, xe = {
259
- ...Oe,
260
- ...Se,
261
- ...U,
262
- ...J,
263
- ...X,
264
- ...Q,
265
- ...W,
102
+ }, ne = {
103
+ ...oe,
104
+ ...ae,
105
+ ...D,
106
+ ...F,
107
+ ...K,
108
+ ...M,
109
+ ...j,
266
110
  value: [String, Number, Boolean],
267
111
  modelValue: [Object, Number, Boolean, String],
268
112
  label: String
269
- }, Pe = {
270
- ...U,
271
- ...J,
272
- ..._e,
273
- ...X,
274
- ...Q,
275
- ...W,
113
+ }, re = {
114
+ ...D,
115
+ ...F,
116
+ ...te,
117
+ ...K,
118
+ ...M,
119
+ ...j,
276
120
  modelValue: [String, Array],
277
121
  label: String,
278
122
  name: { type: String, required: !0 },
279
123
  vertical: Boolean
280
- }, Be = {
281
- ...xe,
124
+ }, le = {
125
+ ...ne,
282
126
  indeterminate: Boolean,
283
127
  uncheckedValue: [String, Number, Boolean],
284
128
  switch: Boolean
285
- }, je = ["click", "update:modelValue", "change", "blur"];
286
- function Re(t, e) {
287
- const { group: n, isInGroup: a, getGroupOrLocalRef: o } = Ae(F), { switch: u, indeterminate: r } = j(t), v = o("modelValue", t, e), i = o("readonly", t), s = o("disabled", t), d = o("valid", t), l = o("invalid", t);
129
+ }, ue = ["click", "update:modelValue", "change", "blur"];
130
+ function se(n, m) {
131
+ const { group: e, isInGroup: f, getGroupOrLocalRef: r } = useInjectedGroupState(E), { switch: d, indeterminate: a } = toRefs(n), b = r("modelValue", n, m), v = r("readonly", n), t = r("disabled", n), i = r("valid", n), o = r("invalid", n);
288
132
  return {
289
- propsSwitch: u,
290
- indeterminate: r,
291
- group: n,
292
- isInGroup: a,
293
- modelValue: v,
294
- readonly: i,
295
- disabled: s,
296
- valid: d,
297
- invalid: l
133
+ propsSwitch: d,
134
+ indeterminate: a,
135
+ group: e,
136
+ isInGroup: f,
137
+ modelValue: b,
138
+ readonly: v,
139
+ disabled: t,
140
+ valid: i,
141
+ invalid: o
298
142
  };
299
143
  }
300
- const Ge = ["for"], $e = ["id", "name", "disabled", "value", "tabindex", "aria-invalid"], Ee = {
144
+ const ie = ["for"], ce = ["id", "name", "disabled", "value", "tabindex", "aria-invalid"], de = {
301
145
  name: "VvCheckbox"
302
- }, we = /* @__PURE__ */ w({
303
- ...Ee,
304
- props: Be,
305
- emits: je,
306
- setup(t, { emit: e }) {
307
- const n = t, a = I(), {
308
- disabled: o,
309
- readonly: u,
310
- valid: r,
311
- invalid: v,
312
- propsSwitch: i,
313
- modelValue: s,
314
- indeterminate: d,
315
- isInGroup: l
316
- } = Re(n, e), k = c(() => String(n.id || ge())), p = c(() => m.value ? -1 : n.tabindex), y = oe(), h = c(
317
- () => n.uncheckedValue !== void 0 && !l.value
318
- ), m = c(() => o.value || u.value), b = c(() => {
319
- if (v.value === !0)
146
+ }, ve = /* @__PURE__ */ R({
147
+ ...de,
148
+ props: le,
149
+ emits: ue,
150
+ setup(n, { emit: m }) {
151
+ const e = n, f = useSlots(), {
152
+ disabled: r,
153
+ readonly: d,
154
+ valid: a,
155
+ invalid: b,
156
+ propsSwitch: v,
157
+ modelValue: t,
158
+ indeterminate: i,
159
+ isInGroup: o
160
+ } = se(e, m), g = computed(() => String(e.id || ee())), l = computed(() => s.value ? -1 : e.tabindex), u = ref(), p = computed(
161
+ () => e.uncheckedValue !== void 0 && !o.value
162
+ ), s = computed(() => r.value || d.value), V = computed(() => {
163
+ if (b.value === !0)
320
164
  return !0;
321
- if (r.value === !0)
165
+ if (a.value === !0)
322
166
  return !1;
323
- }), V = c(() => h.value ? s.value === n.value : Array.isArray(s.value) ? Ve(n.value, s.value) : T(n.value, s.value)), C = c(() => !!(d.value || !V.value && h.value && n.uncheckedValue !== s.value)), R = c(() => {
324
- if (!h.value)
325
- return ["string", "number", "boolean"].includes(typeof n.value) ? n.value : !0;
326
- }), S = c({
167
+ }), k = computed(() => p.value ? t.value === e.value : Array.isArray(t.value) ? contains(e.value, t.value) : equals(e.value, t.value)), S = computed(() => !!(i.value || !k.value && p.value && e.uncheckedValue !== t.value)), G = computed(() => {
168
+ if (!p.value)
169
+ return ["string", "number", "boolean"].includes(typeof e.value) ? e.value : !0;
170
+ }), x = computed({
327
171
  get() {
328
- return V.value;
172
+ return k.value;
329
173
  },
330
- set(g) {
331
- if (h.value)
332
- s.value = g ? n.value : n.uncheckedValue;
333
- else if (Array.isArray(s.value) || l.value) {
334
- const _ = new Set(
335
- Array.isArray(s.value) ? s.value : s.value !== void 0 ? [s.value] : []
174
+ set(y) {
175
+ if (p.value)
176
+ t.value = y ? e.value : e.uncheckedValue;
177
+ else if (Array.isArray(t.value) || o.value) {
178
+ const C = new Set(
179
+ Array.isArray(t.value) ? t.value : t.value !== void 0 ? [t.value] : []
336
180
  );
337
- g ? _.add(n.value) : _.delete(n.value), s.value = [..._];
181
+ y ? C.add(e.value) : C.delete(e.value), t.value = [...C];
338
182
  } else
339
- s.value = g ? n.value : void 0;
340
- e("change", g);
183
+ t.value = y ? e.value : void 0;
184
+ m("change", y);
341
185
  }
342
- }), { bemCssClasses: A } = z("vv-checkbox", {
343
- switch: i,
344
- valid: r,
345
- invalid: v,
346
- disabled: o,
347
- readonly: u,
348
- indeterminate: d
186
+ }), { bemCssClasses: _ } = useBemModifiers("vv-checkbox", {
187
+ switch: v,
188
+ valid: a,
189
+ invalid: b,
190
+ disabled: r,
191
+ readonly: d,
192
+ indeterminate: i
349
193
  });
350
- se(() => {
351
- h.value && Array.isArray(s.value) && console.warn(
194
+ watchEffect(() => {
195
+ p.value && Array.isArray(t.value) && console.warn(
352
196
  "[VvCheckbox] The model value is an array but the component is in binary mode."
353
197
  );
354
- }), ue(
355
- () => C.value,
356
- (g) => {
357
- g ? y.value.indeterminate = !0 : y.value.indeterminate = !1;
198
+ }), watch(
199
+ () => S.value,
200
+ (y) => {
201
+ y ? u.value.indeterminate = !0 : u.value.indeterminate = !1;
358
202
  }
359
- ), ae(() => {
360
- C.value && (y.value.indeterminate = !0);
203
+ ), onMounted(() => {
204
+ S.value && (u.value.indeterminate = !0);
361
205
  });
362
- const { HintSlot: Y } = Z(n, a);
363
- return (g, _) => (O(), P("label", {
364
- class: H(f(A)),
365
- for: f(k)
206
+ const { HintSlot: q } = $(e, f);
207
+ return (y, C) => (P(), B("label", {
208
+ class: N(c(_)),
209
+ for: c(g)
366
210
  }, [
367
- le(D("input", {
368
- id: f(k),
211
+ U(O("input", {
212
+ id: c(g),
369
213
  ref_key: "input",
370
- ref: y,
371
- "onUpdate:modelValue": _[0] || (_[0] = (L) => E(S) ? S.value = L : null),
214
+ ref: u,
215
+ "onUpdate:modelValue": C[0] || (C[0] = (T) => z(x) ? x.value = T : null),
372
216
  type: "checkbox",
373
217
  class: "vv-checkbox__input",
374
- name: g.name,
375
- disabled: f(m),
376
- value: f(R),
377
- tabindex: f(p),
378
- "aria-invalid": f(b)
379
- }, null, 8, $e), [
380
- [ie, f(S)]
218
+ name: y.name,
219
+ disabled: c(s),
220
+ value: c(G),
221
+ tabindex: c(l),
222
+ "aria-invalid": c(V)
223
+ }, null, 8, ce), [
224
+ [J, c(x)]
381
225
  ]),
382
- N(g.$slots, "default", { value: f(s) }, () => [
383
- ce(K(g.label), 1)
226
+ H(y.$slots, "default", { value: c(t) }, () => [
227
+ Q(I(y.label), 1)
384
228
  ]),
385
- M(f(Y), {
229
+ w(c(q), {
386
230
  class: "vv-checkbox__hint",
387
- params: { value: f(s) }
231
+ params: { value: c(t) }
388
232
  }, null, 8, ["params"])
389
- ], 10, Ge));
233
+ ], 10, ie));
390
234
  }
391
- }), Ie = Pe, He = ["update:modelValue", "change"], De = ["textContent"], Ne = { class: "vv-checkbox-group__wrapper" }, Ke = {
235
+ }), pe = re, me = ["update:modelValue", "change"], fe = ["textContent"], he = { class: "vv-checkbox-group__wrapper" }, ye = {
392
236
  name: "VvCheckboxGroup"
393
- }, qe = /* @__PURE__ */ w({
394
- ...Ke,
395
- props: Ie,
396
- emits: He,
397
- setup(t, { emit: e }) {
398
- const n = t, a = I(), o = he(n, "modelValue", e), { disabled: u, readonly: r, vertical: v, valid: i, invalid: s } = j(n);
399
- be({
400
- key: F,
401
- modelValue: o,
402
- disabled: u,
403
- readonly: r,
404
- valid: i,
405
- invalid: s
406
- });
407
- const { getOptionLabel: l, getOptionValue: k } = ke(n), { bemCssClasses: p } = z("vv-checkbox-group", {
408
- disabled: u,
409
- readonly: r,
410
- horizontal: c(() => !v.value),
411
- valid: i,
412
- invalid: s
413
- }), y = (m, b) => ({
414
- id: `${n.name}_opt${b}`,
415
- name: n.name,
416
- label: l(m),
417
- value: k(m)
418
- }), { HintSlot: h } = Z(n, a);
419
- return (m, b) => (O(), P("fieldset", {
420
- class: H(f(p))
237
+ }, ge = /* @__PURE__ */ R({
238
+ ...ye,
239
+ props: pe,
240
+ emits: me,
241
+ setup(n, { emit: m }) {
242
+ const e = n, f = useSlots(), r = useVModel(e, "modelValue", m), { disabled: d, readonly: a, vertical: b, valid: v, invalid: t } = toRefs(e), i = {
243
+ key: E,
244
+ modelValue: r,
245
+ disabled: d,
246
+ readonly: a,
247
+ valid: v,
248
+ invalid: t
249
+ };
250
+ useProvideGroupState(i);
251
+ const { getOptionLabel: o, getOptionValue: g } = useOptions(e), { bemCssClasses: l } = useBemModifiers("vv-checkbox-group", {
252
+ disabled: d,
253
+ readonly: a,
254
+ horizontal: computed(() => !b.value),
255
+ valid: v,
256
+ invalid: t
257
+ }), u = (s, V) => ({
258
+ id: `${e.name}_opt${V}`,
259
+ name: e.name,
260
+ label: o(s),
261
+ value: g(s)
262
+ }), { HintSlot: p } = $(e, f);
263
+ return (s, V) => (P(), B("fieldset", {
264
+ class: N(c(l))
421
265
  }, [
422
- m.label ? (O(), P("legend", {
266
+ s.label ? (P(), B("legend", {
423
267
  key: 0,
424
- textContent: K(m.label)
425
- }, null, 8, De)) : fe("", !0),
426
- D("div", Ne, [
427
- m.options.length > 0 ? (O(!0), P(ve, { key: 0 }, de(m.options, (V, C) => (O(), pe(we, ye({ key: C }, y(V, C)), null, 16))), 128)) : N(m.$slots, "default", { key: 1 })
268
+ textContent: I(s.label)
269
+ }, null, 8, fe)) : W("", !0),
270
+ O("div", he, [
271
+ s.options.length > 0 ? (P(!0), B(X, { key: 0 }, Y(s.options, (k, S) => (P(), Z(ve, L({ key: S }, u(k, S)), null, 16))), 128)) : H(s.$slots, "default", { key: 1 })
428
272
  ]),
429
- M(f(h), { class: "vv-checkbox-group__hint" })
273
+ w(c(p), { class: "vv-checkbox-group__hint" })
430
274
  ], 2));
431
275
  }
432
276
  });
433
277
  export {
434
- qe as default
278
+ ge as default
435
279
  };