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