@volverjs/ui-vue 0.0.3 → 0.0.4

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