@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.
- package/LICENSE +1 -1
- package/README.md +52 -13
- package/dist/Volver.d.ts +5 -1
- package/dist/components/VvAccordion/VvAccordion.es.js +113 -66
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +159 -101
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAction/VvAction.es.js +170 -0
- package/dist/components/VvAction/VvAction.umd.js +1 -0
- package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
- package/dist/components/VvAction/index.d.ts +24 -0
- package/dist/components/VvBadge/VvBadge.es.js +86 -16
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +97 -41
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvButton/VvButton.es.js +434 -251
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +50 -50
- package/dist/components/VvButton/index.d.ts +22 -67
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +118 -43
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvCard/VvCard.es.js +38 -25
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +334 -154
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
- package/dist/components/VvCheckbox/index.d.ts +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +401 -204
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +2 -2
- package/dist/components/VvCheckboxGroup/index.d.ts +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +950 -594
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +54 -30
- package/dist/components/VvCombobox/index.d.ts +18 -13
- package/dist/components/VvDialog/VvDialog.es.js +139 -64
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +276 -158
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +9 -9
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
- package/dist/components/VvDropdown/index.d.ts +6 -9
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +251 -0
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +30 -15
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +176 -0
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
- package/dist/components/VvIcon/VvIcon.es.js +48 -32
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +508 -344
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +11 -4
- package/dist/components/VvInputText/index.d.ts +13 -2
- package/dist/components/VvProgress/VvProgress.es.js +90 -20
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +305 -125
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
- package/dist/components/VvRadio/index.d.ts +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +372 -175
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +2 -2
- package/dist/components/VvRadioGroup/index.d.ts +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +371 -216
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +11 -4
- package/dist/components/VvSelect/index.d.ts +5 -5
- package/dist/components/VvTextarea/VvTextarea.es.js +408 -244
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +11 -4
- package/dist/components/VvTextarea/index.d.ts +5 -5
- package/dist/components/VvTooltip/VvTooltip.es.js +88 -18
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/index.es.js +1913 -1521
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
- package/dist/composables/dropdown/useProvideDropdown.d.ts +2 -2
- package/dist/constants.d.ts +30 -0
- package/dist/directives/index.es.js +128 -0
- package/dist/directives/index.umd.js +1 -0
- package/dist/directives/v-tooltip.es.js +126 -0
- package/dist/directives/v-tooltip.umd.js +1 -0
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/index.es.js +2102 -1761
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +179 -11
- package/dist/resolvers/unplugin.d.ts +8 -8
- package/dist/resolvers/unplugin.es.js +51 -30
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
- package/package.json +60 -34
- package/src/Volver.ts +12 -5
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAction/VvAction.vue +144 -0
- package/src/components/VvAction/index.ts +5 -0
- package/src/components/VvButton/VvButton.vue +31 -114
- package/src/components/VvButton/index.ts +6 -79
- package/src/components/VvCombobox/VvCombobox.vue +54 -42
- package/src/components/VvCombobox/index.ts +11 -9
- package/src/components/VvDropdown/VvDropdownAction.vue +44 -0
- package/src/components/VvDropdown/VvDropdownOption.vue +65 -0
- package/src/components/VvDropdown/index.ts +4 -9
- package/src/components/VvSelect/index.ts +2 -4
- package/src/composables/dropdown/useInjectDropdown.ts +1 -1
- package/src/composables/dropdown/useProvideDropdown.ts +7 -9
- package/src/composables/useModifiers.ts +4 -7
- package/src/constants.ts +36 -0
- package/src/props/index.ts +106 -14
- package/src/resolvers/unplugin.ts +81 -48
- package/src/stories/Accordion/AccordionSlots.stories.mdx +2 -2
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +2 -1
- package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
- package/src/stories/Button/Button.stories.mdx +4 -2
- package/src/stories/Button/Button.test.ts +3 -1
- package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
- package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
- package/src/stories/Button/ButtonState.stories.mdx +2 -11
- package/src/stories/Card/Card.stories.mdx +2 -1
- package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
- package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
- package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
- package/src/stories/Combobox/Combobox.settings.ts +44 -0
- package/src/stories/Combobox/Combobox.stories.mdx +40 -1
- package/src/stories/Dialog/Dialog.stories.mdx +2 -1
- package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
- package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
- package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
- package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
- package/src/stories/Icon/Icon.stories.mdx +2 -1
- package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
- package/src/stories/InputText/InputText.stories.mdx +2 -1
- package/src/stories/Progress/Progress.stories.mdx +2 -1
- package/src/stories/Radio/Radio.stories.mdx +2 -1
- package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
- package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
- package/src/stories/Select/Select.stories.mdx +2 -1
- package/src/stories/Textarea/Textarea.stories.mdx +2 -1
- package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
- package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
|
@@ -1,61 +1,117 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
},
|
|
40
|
+
}, he = {
|
|
41
|
+
/**
|
|
42
|
+
* Invalid status
|
|
43
|
+
*/
|
|
7
44
|
invalid: Boolean,
|
|
45
|
+
/**
|
|
46
|
+
* Invalid label
|
|
47
|
+
*/
|
|
8
48
|
invalidLabel: [String, Array]
|
|
9
|
-
},
|
|
49
|
+
}, G = {
|
|
10
50
|
/**
|
|
11
51
|
* Whether the form control is disabled
|
|
12
52
|
*/
|
|
13
53
|
disabled: Boolean
|
|
14
|
-
},
|
|
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
|
-
},
|
|
74
|
+
}, H = {
|
|
20
75
|
/**
|
|
21
76
|
* Component BEM modifiers
|
|
22
77
|
*/
|
|
23
78
|
modifiers: [String, Array]
|
|
24
|
-
},
|
|
79
|
+
}, Se = {
|
|
25
80
|
hintLabel: { type: String, default: "" }
|
|
26
81
|
};
|
|
27
|
-
|
|
28
|
-
const
|
|
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
|
-
},
|
|
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
|
-
|
|
42
|
-
const
|
|
43
|
-
...
|
|
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
|
-
},
|
|
51
|
-
...
|
|
52
|
-
...
|
|
53
|
-
|
|
54
|
-
...
|
|
55
|
-
...
|
|
56
|
-
...
|
|
57
|
-
...
|
|
58
|
-
...
|
|
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
|
-
*
|
|
132
|
+
* Button type
|
|
70
133
|
*/
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
},
|
|
88
|
-
function
|
|
89
|
-
const { group:
|
|
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:
|
|
93
|
-
propsSwitch:
|
|
94
|
-
indeterminate:
|
|
259
|
+
id: u,
|
|
260
|
+
propsSwitch: a,
|
|
261
|
+
indeterminate: p,
|
|
95
262
|
// global props
|
|
96
|
-
group:
|
|
97
|
-
isInGroup:
|
|
263
|
+
group: r,
|
|
264
|
+
isInGroup: s,
|
|
98
265
|
modelValue: c,
|
|
99
|
-
readonly:
|
|
100
|
-
disabled:
|
|
101
|
-
valid:
|
|
102
|
-
invalid:
|
|
266
|
+
readonly: f,
|
|
267
|
+
disabled: o,
|
|
268
|
+
valid: l,
|
|
269
|
+
invalid: S
|
|
103
270
|
};
|
|
104
271
|
}
|
|
105
|
-
function
|
|
106
|
-
return Array.isArray(e) ? e.filter((
|
|
272
|
+
function _(e) {
|
|
273
|
+
return Array.isArray(e) ? e.filter((t) => _e(t)).join(" ") : e;
|
|
107
274
|
}
|
|
108
|
-
function
|
|
275
|
+
function Ie(e, t) {
|
|
109
276
|
const {
|
|
110
|
-
invalid:
|
|
111
|
-
valid:
|
|
112
|
-
hint:
|
|
113
|
-
loading:
|
|
114
|
-
} =
|
|
115
|
-
hintLabel:
|
|
116
|
-
modelValue:
|
|
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:
|
|
119
|
-
invalid:
|
|
120
|
-
invalidLabel:
|
|
121
|
-
...
|
|
122
|
-
} =
|
|
123
|
-
() => !!(
|
|
124
|
-
),
|
|
125
|
-
() => !!(
|
|
126
|
-
),
|
|
127
|
-
() => !!(
|
|
128
|
-
),
|
|
129
|
-
() =>
|
|
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:
|
|
133
|
-
hasHint:
|
|
134
|
-
hasValid:
|
|
135
|
-
hasLoading:
|
|
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(
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
hintLabel:
|
|
148
|
-
modelValue:
|
|
311
|
+
setup(B) {
|
|
312
|
+
const x = i(() => {
|
|
313
|
+
const m = fe({
|
|
314
|
+
hintLabel: a,
|
|
315
|
+
modelValue: p,
|
|
149
316
|
valid: c,
|
|
150
|
-
validLabel:
|
|
151
|
-
invalid:
|
|
152
|
-
invalidLabel:
|
|
153
|
-
loading:
|
|
154
|
-
loadingLabel:
|
|
155
|
-
...
|
|
317
|
+
validLabel: f,
|
|
318
|
+
invalid: o,
|
|
319
|
+
invalidLabel: l,
|
|
320
|
+
loading: d,
|
|
321
|
+
loadingLabel: h,
|
|
322
|
+
...B.params
|
|
156
323
|
});
|
|
157
|
-
return
|
|
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:
|
|
161
|
-
hasInvalid:
|
|
162
|
-
hasValid:
|
|
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
|
|
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
|
|
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
|
-
},
|
|
182
|
-
...
|
|
183
|
-
props:
|
|
184
|
-
emits:
|
|
185
|
-
setup(e, { emit:
|
|
186
|
-
const
|
|
187
|
-
id:
|
|
188
|
-
disabled:
|
|
189
|
-
readonly:
|
|
190
|
-
valid:
|
|
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:
|
|
193
|
-
modelValue:
|
|
194
|
-
indeterminate:
|
|
195
|
-
isInGroup:
|
|
196
|
-
} =
|
|
197
|
-
() =>
|
|
198
|
-
),
|
|
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 (
|
|
381
|
+
if (p.value === !0)
|
|
202
382
|
return !1;
|
|
203
|
-
}),
|
|
204
|
-
if (!
|
|
205
|
-
return ["string", "number", "boolean"].includes(typeof
|
|
206
|
-
}),
|
|
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
|
|
388
|
+
return A.value;
|
|
209
389
|
},
|
|
210
|
-
set(
|
|
211
|
-
if (
|
|
212
|
-
|
|
213
|
-
else if (Array.isArray(
|
|
214
|
-
const
|
|
215
|
-
Array.isArray(
|
|
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
|
-
|
|
397
|
+
y ? O.add(r.value) : O.delete(r.value), o.value = [...O];
|
|
218
398
|
} else
|
|
219
|
-
|
|
220
|
-
|
|
399
|
+
o.value = y ? r.value : void 0;
|
|
400
|
+
t("change", y);
|
|
221
401
|
}
|
|
222
|
-
}), { modifiers:
|
|
402
|
+
}), { modifiers: q } = R(r), F = Re(
|
|
223
403
|
"vv-checkbox",
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
switch:
|
|
227
|
-
valid:
|
|
404
|
+
q,
|
|
405
|
+
i(() => ({
|
|
406
|
+
switch: f.value,
|
|
407
|
+
valid: p.value,
|
|
228
408
|
invalid: c.value,
|
|
229
|
-
disabled:
|
|
230
|
-
readonly:
|
|
231
|
-
indeterminate:
|
|
409
|
+
disabled: u.value,
|
|
410
|
+
readonly: a.value,
|
|
411
|
+
indeterminate: l.value
|
|
232
412
|
}))
|
|
233
413
|
);
|
|
234
|
-
|
|
235
|
-
|
|
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
|
-
}),
|
|
239
|
-
() =>
|
|
240
|
-
(
|
|
241
|
-
|
|
418
|
+
}), Z(
|
|
419
|
+
() => B.value,
|
|
420
|
+
(y) => {
|
|
421
|
+
y ? b.value.indeterminate = !0 : b.value.indeterminate = !1;
|
|
242
422
|
}
|
|
243
|
-
),
|
|
244
|
-
|
|
423
|
+
), L(() => {
|
|
424
|
+
B.value && (b.value.indeterminate = !0);
|
|
245
425
|
});
|
|
246
|
-
const { HintSlot:
|
|
247
|
-
return (
|
|
248
|
-
class:
|
|
249
|
-
for:
|
|
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
|
-
|
|
252
|
-
id:
|
|
431
|
+
ne(ae("input", {
|
|
432
|
+
id: v(d),
|
|
253
433
|
ref_key: "input",
|
|
254
|
-
ref:
|
|
255
|
-
"onUpdate:modelValue":
|
|
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:
|
|
259
|
-
disabled:
|
|
260
|
-
value:
|
|
261
|
-
tabindex:
|
|
262
|
-
"aria-invalid":
|
|
263
|
-
}, null, 8,
|
|
264
|
-
[
|
|
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
|
-
|
|
267
|
-
|
|
446
|
+
le(y.$slots, "default", { value: v(o) }, () => [
|
|
447
|
+
se(ie(y.label), 1)
|
|
268
448
|
]),
|
|
269
|
-
|
|
449
|
+
ce(v(U), {
|
|
270
450
|
class: "vv-checkbox__hint",
|
|
271
|
-
params: { value:
|
|
451
|
+
params: { value: v(o) }
|
|
272
452
|
}, null, 8, ["params"])
|
|
273
|
-
], 10,
|
|
453
|
+
], 10, Ne));
|
|
274
454
|
}
|
|
275
455
|
});
|
|
276
456
|
export {
|
|
277
|
-
|
|
457
|
+
Me as default
|
|
278
458
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,
|
|
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))}})});
|