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