@volverjs/ui-vue 0.0.1 → 0.0.3-beta.2
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/README.md +17 -0
- package/auto-imports.d.ts +289 -0
- package/dist/components/VvButton/VvButton.es.js +159 -147
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +0 -8
- package/dist/components/VvButton/index.d.ts +4 -4
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +36 -37
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +10 -10
- package/dist/components/VvButtonGroup/index.d.ts +5 -5
- package/dist/components/VvCombobox/VvCombobox.es.js +526 -345
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +22 -0
- package/dist/components/VvCombobox/index.d.ts +13 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +118 -109
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +19 -0
- package/dist/components/VvDropdown/index.d.ts +12 -0
- package/dist/components/VvInputText/VvInputText.es.js +221 -213
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +13 -13
- package/dist/components/VvInputText/index.d.ts +5 -5
- package/dist/components/VvSelect/VvSelect.es.js +186 -167
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +23 -11
- package/dist/components/VvSelect/index.d.ts +10 -17
- package/dist/components/VvTextarea/VvTextarea.es.js +241 -277
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +12 -12
- package/dist/components/VvTextarea/index.d.ts +5 -5
- package/dist/components/VvTooltip/VvTooltip.es.js +28 -0
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -0
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +23 -0
- package/dist/components/VvTooltip/index.d.ts +18 -0
- package/dist/components/index.es.js +1046 -976
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/group/types/IButtonGroupState.d.ts +1 -1
- package/dist/composables/group/types/IGroupState.d.ts +1 -1
- package/dist/composables/group/useInjectedGroupState.d.ts +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/index.es.js +1127 -1057
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +35 -4
- package/dist/resolvers/unplugin.es.js +26 -24
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Button/Button.settings.d.ts +9 -11
- package/dist/stories/ButtonGroup/ButtonGroup.settings.d.ts +9 -0
- package/dist/stories/Combobox/Combobox.settings.d.ts +19 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +10 -0
- package/dist/stories/InputText/InputText.settings.d.ts +23 -23
- package/dist/stories/Select/Select.settings.d.ts +42 -23
- package/dist/stories/Textarea/Textarea.settings.d.ts +23 -23
- package/dist/stories/Tooltip/Tooltip.settings.d.ts +42 -0
- package/dist/stories/Tooltip/Tooltip.test.d.ts +2 -0
- package/dist/stories/argTypes.d.ts +50 -1
- package/package.json +31 -23
- 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/VvButton/index.ts +28 -10
- package/src/components/VvButtonGroup/VvButtonGroup.vue +1 -1
- package/src/components/VvButtonGroup/index.ts +3 -6
- package/src/components/VvCombobox/VvCombobox.vue +45 -11
- package/src/components/VvCombobox/index.ts +6 -0
- package/src/components/VvDropdown/VvDropdown.vue +9 -6
- package/src/components/VvDropdown/index.ts +11 -1
- package/src/components/VvInputText/VvInputText.vue +10 -8
- package/src/components/VvSelect/VvSelect.vue +23 -1
- package/src/components/VvSelect/index.ts +8 -11
- package/src/components/VvTextarea/VvTextarea.vue +9 -21
- package/src/components/VvTooltip/VvTooltip.vue +17 -0
- package/src/components/VvTooltip/index.ts +21 -0
- package/src/composables/group/types/IButtonGroupState.ts +1 -1
- package/src/composables/group/types/IGroupState.ts +1 -1
- package/src/composables/group/useInjectedGroupState.ts +3 -3
- package/src/composables/useTextCount.ts +1 -1
- package/src/props/index.ts +33 -15
- package/src/resolvers/unplugin.ts +22 -13
- package/src/stories/Accordion/Accordion.stories.mdx +1 -1
- package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +1 -1
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +1 -1
- package/src/stories/Badge/Badge.stories.mdx +1 -1
- package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +1 -1
- package/src/stories/Breadcrumb/BreadcrumbSlots.stories.mdx +1 -1
- package/src/stories/Button/Button.settings.ts +2 -7
- package/src/stories/Button/Button.stories.mdx +1 -1
- package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
- package/src/stories/Button/ButtonSlots.stories.mdx +3 -3
- package/src/stories/ButtonGroup/ButtonGroup.settings.ts +6 -1
- package/src/stories/ButtonGroup/ButtonGroup.stories.mdx +1 -1
- package/src/stories/ButtonGroup/ButtonGroupSlots.stories.mdx +37 -0
- package/src/stories/ButtonGroup/ButtonGroupToggle.stories.mdx +12 -1
- package/src/stories/Card/Card.stories.mdx +1 -1
- package/src/stories/Card/CardSlots.stories.mdx +1 -1
- package/src/stories/Checkbox/Checkbox.stories.mdx +1 -1
- package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +1 -1
- package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +1 -1
- package/src/stories/Combobox/Combobox.settings.ts +5 -0
- package/src/stories/Combobox/Combobox.stories.mdx +52 -1
- package/src/stories/Combobox/Combobox.test.ts +7 -0
- package/src/stories/Dialog/Dialog.stories.mdx +1 -1
- package/src/stories/Dropdown/Dropdown.settings.ts +10 -1
- package/src/stories/Dropdown/Dropdown.stories.mdx +18 -1
- package/src/stories/Icon/Icon.stories.mdx +1 -1
- package/src/stories/Icon/IconsCollection.stories.mdx +1 -1
- package/src/stories/InputText/InputText.stories.mdx +1 -1
- package/src/stories/Progress/Progress.stories.mdx +1 -1
- package/src/stories/Radio/Radio.stories.mdx +1 -1
- package/src/stories/RadioGroup/RadioGroup.stories.mdx +1 -1
- package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +1 -1
- package/src/stories/Select/Select.settings.ts +9 -23
- package/src/stories/Select/Select.stories.mdx +61 -1
- package/src/stories/Textarea/Textarea.stories.mdx +1 -1
- package/src/stories/Tooltip/Tooltip.settings.ts +26 -0
- package/src/stories/Tooltip/Tooltip.stories.mdx +98 -0
- package/src/stories/Tooltip/Tooltip.test.ts +49 -0
- package/src/stories/argTypes.ts +46 -22
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
import { unref as
|
|
1
|
+
import { unref as g, computed as d, defineComponent as N, ref as q, toRefs as z, inject as F, openBlock as h, createBlock as V, mergeProps as D, createCommentVNode as $, toRef as T, useAttrs as X, useSlots as K, resolveDynamicComponent as Q, withCtx as W, renderSlot as _, createElementBlock as P, toDisplayString as R, Fragment as Y, createTextVNode as ee } from "vue";
|
|
2
2
|
import { nanoid as te } from "nanoid";
|
|
3
|
-
import { iconExists as
|
|
4
|
-
function
|
|
5
|
-
return r ?
|
|
3
|
+
import { iconExists as O, Icon as re, addIcon as ne } from "@iconify/vue";
|
|
4
|
+
function j(e, t, r) {
|
|
5
|
+
return r ? E(e, r) === E(t, r) : B(e, t);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function B(e, t) {
|
|
8
8
|
if (e === t)
|
|
9
9
|
return !0;
|
|
10
10
|
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
11
|
-
const r = Array.isArray(e),
|
|
12
|
-
let o,
|
|
13
|
-
if (r &&
|
|
14
|
-
if (
|
|
11
|
+
const r = Array.isArray(e), c = Array.isArray(t);
|
|
12
|
+
let o, l, u;
|
|
13
|
+
if (r && c) {
|
|
14
|
+
if (l = e.length, l != t.length)
|
|
15
15
|
return !1;
|
|
16
|
-
for (o =
|
|
17
|
-
if (!
|
|
16
|
+
for (o = l; o-- !== 0; )
|
|
17
|
+
if (!B(e[o], t[o]))
|
|
18
18
|
return !1;
|
|
19
19
|
return !0;
|
|
20
20
|
}
|
|
21
|
-
if (r !=
|
|
21
|
+
if (r != c)
|
|
22
22
|
return !1;
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
23
|
+
const v = e instanceof Date, s = t instanceof Date;
|
|
24
|
+
if (v != s)
|
|
25
25
|
return !1;
|
|
26
|
-
if (
|
|
26
|
+
if (v && s)
|
|
27
27
|
return e.getTime() == t.getTime();
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
28
|
+
const a = e instanceof RegExp, n = t instanceof RegExp;
|
|
29
|
+
if (a != n)
|
|
30
30
|
return !1;
|
|
31
|
-
if (
|
|
31
|
+
if (a && n)
|
|
32
32
|
return e.toString() == t.toString();
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
33
|
+
const i = Object.keys(e);
|
|
34
|
+
if (l = i.length, l !== Object.keys(t).length)
|
|
35
35
|
return !1;
|
|
36
|
-
for (o =
|
|
37
|
-
if (!Object.prototype.hasOwnProperty.call(t,
|
|
36
|
+
for (o = l; o-- !== 0; )
|
|
37
|
+
if (!Object.prototype.hasOwnProperty.call(t, i[o]))
|
|
38
38
|
return !1;
|
|
39
|
-
for (o =
|
|
40
|
-
if (
|
|
39
|
+
for (o = l; o-- !== 0; )
|
|
40
|
+
if (u = i[o], !B(e[u], t[u]))
|
|
41
41
|
return !1;
|
|
42
42
|
return !0;
|
|
43
43
|
}
|
|
44
44
|
return e !== e && t !== t;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function E(e, t) {
|
|
47
47
|
if (e && Object.keys(e).length && t) {
|
|
48
48
|
if (t.indexOf(".") === -1)
|
|
49
49
|
return e[t];
|
|
50
50
|
{
|
|
51
51
|
const r = t.split(".");
|
|
52
|
-
let
|
|
53
|
-
for (let o = 0,
|
|
52
|
+
let c = e;
|
|
53
|
+
for (let o = 0, l = r.length; o < l; ++o) {
|
|
54
54
|
if (e == null)
|
|
55
55
|
return null;
|
|
56
|
-
|
|
56
|
+
c = c[r[o]];
|
|
57
57
|
}
|
|
58
|
-
return
|
|
58
|
+
return c;
|
|
59
59
|
}
|
|
60
60
|
} else
|
|
61
61
|
return null;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function I(e, t) {
|
|
64
64
|
if (e != null && t && t.length) {
|
|
65
65
|
for (const r of t)
|
|
66
|
-
if (
|
|
66
|
+
if (j(e, r))
|
|
67
67
|
return !0;
|
|
68
68
|
}
|
|
69
69
|
return !1;
|
|
70
70
|
}
|
|
71
71
|
function oe(e) {
|
|
72
|
-
return ((t) => t == null || t === "" || Array.isArray(t) && t.length === 0 || !(t instanceof Date) && typeof t == "object" && Object.keys(t).length === 0)(
|
|
72
|
+
return ((t) => t == null || t === "" || Array.isArray(t) && t.length === 0 || !(t instanceof Date) && typeof t == "object" && Object.keys(t).length === 0)(g(e));
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function M(e) {
|
|
75
75
|
var t, r;
|
|
76
76
|
if (e)
|
|
77
77
|
return (r = (t = e.match(
|
|
78
78
|
/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g
|
|
79
79
|
)) == null ? void 0 : t.join("-")) == null ? void 0 : r.toLowerCase();
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
function
|
|
81
|
+
const U = "ds";
|
|
82
|
+
function Z(e, t) {
|
|
83
83
|
const r = { [`${e}`]: !0 };
|
|
84
84
|
return {
|
|
85
|
-
bemCssClasses:
|
|
86
|
-
const
|
|
87
|
-
if (!
|
|
85
|
+
bemCssClasses: d(() => Object.keys(t).reduce((o, l) => {
|
|
86
|
+
const u = g(t[l]) || !1;
|
|
87
|
+
if (!u)
|
|
88
88
|
return o;
|
|
89
|
-
if (
|
|
90
|
-
const
|
|
89
|
+
if (l === "modifiers") {
|
|
90
|
+
const v = Array.isArray(u) ? u : u.split(" ");
|
|
91
91
|
return {
|
|
92
92
|
...o,
|
|
93
|
-
...
|
|
94
|
-
(s,
|
|
93
|
+
...v.reduce(
|
|
94
|
+
(s, a) => ({
|
|
95
95
|
...s,
|
|
96
|
-
[`${e}--${
|
|
96
|
+
[`${e}--${M(a)}`]: !0
|
|
97
97
|
}),
|
|
98
98
|
{}
|
|
99
99
|
)
|
|
@@ -101,7 +101,7 @@ function q(e, t) {
|
|
|
101
101
|
} else
|
|
102
102
|
return {
|
|
103
103
|
...o,
|
|
104
|
-
[`${e}--${
|
|
104
|
+
[`${e}--${M(l)}`]: u
|
|
105
105
|
};
|
|
106
106
|
}, r) || {})
|
|
107
107
|
};
|
|
@@ -137,45 +137,45 @@ const se = {
|
|
|
137
137
|
modifiers: {
|
|
138
138
|
type: [String, Array]
|
|
139
139
|
}
|
|
140
|
-
},
|
|
140
|
+
}, le = {
|
|
141
141
|
name: "VvIcon"
|
|
142
|
-
},
|
|
143
|
-
...
|
|
142
|
+
}, G = /* @__PURE__ */ N({
|
|
143
|
+
...le,
|
|
144
144
|
props: se,
|
|
145
145
|
setup(e) {
|
|
146
|
-
const t = e, r =
|
|
147
|
-
modifiers:
|
|
148
|
-
}),
|
|
149
|
-
const n = t.name ?? "",
|
|
150
|
-
return
|
|
151
|
-
const y = `@${
|
|
152
|
-
if (
|
|
146
|
+
const t = e, r = q(!0), { modifiers: c } = z(t), o = F(U), { bemCssClasses: l } = Z("vv-icon", {
|
|
147
|
+
modifiers: c
|
|
148
|
+
}), u = d(() => t.provider || (o == null ? void 0 : o.provider)), v = d(() => {
|
|
149
|
+
const n = t.name ?? "", i = `@${u.value}:${t.prefix}:${t.name}`;
|
|
150
|
+
return O(n) ? n : O(i) ? i : (o == null ? void 0 : o.iconsCollections.find((p) => {
|
|
151
|
+
const y = `@${u.value}:${p.prefix}:${n}`;
|
|
152
|
+
if (O(y))
|
|
153
153
|
return y;
|
|
154
154
|
})) || n;
|
|
155
155
|
});
|
|
156
156
|
function s(n) {
|
|
157
|
-
let
|
|
157
|
+
let i = null;
|
|
158
158
|
if (typeof window > "u") {
|
|
159
|
-
const { JSDOM:
|
|
160
|
-
|
|
159
|
+
const { JSDOM: S } = require("jsdom");
|
|
160
|
+
i = new S().window;
|
|
161
161
|
}
|
|
162
|
-
return (
|
|
162
|
+
return (i ? new i.DOMParser() : new window.DOMParser()).parseFromString(n, "text/html").querySelector("svg");
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
const
|
|
166
|
-
|
|
164
|
+
function a(n) {
|
|
165
|
+
const i = s(n), p = (i == null ? void 0 : i.innerHTML.trim()) || "";
|
|
166
|
+
i && p && ne(`@${u.value}:${t.prefix}:${t.name}`, {
|
|
167
167
|
body: p,
|
|
168
|
-
height:
|
|
169
|
-
width:
|
|
168
|
+
height: i.viewBox.baseVal.height,
|
|
169
|
+
width: i.viewBox.baseVal.width
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
return o && (t.src && !
|
|
173
|
-
n && (
|
|
172
|
+
return o && (t.src && !O(`@${u.value}:${t.prefix}:${t.name}`) ? (r.value = !1, o.fetchIcon(t.src).then((n) => {
|
|
173
|
+
n && (a(n), r.value = !0);
|
|
174
174
|
}).catch((n) => {
|
|
175
175
|
throw new Error(`During fetch icon: ${n == null ? void 0 : n.message}`);
|
|
176
|
-
})) : t.svg &&
|
|
176
|
+
})) : t.svg && a(t.svg)), (n, i) => r.value ? (h(), V(g(re), D({
|
|
177
177
|
key: 0,
|
|
178
|
-
class:
|
|
178
|
+
class: g(l)
|
|
179
179
|
}, {
|
|
180
180
|
inline: n.inline,
|
|
181
181
|
width: n.width,
|
|
@@ -186,49 +186,52 @@ const se = {
|
|
|
186
186
|
rotate: n.rotate,
|
|
187
187
|
color: n.color,
|
|
188
188
|
onLoad: n.onLoad,
|
|
189
|
-
icon: v
|
|
189
|
+
icon: g(v)
|
|
190
190
|
}), null, 16, ["class"])) : $("", !0);
|
|
191
191
|
}
|
|
192
|
-
}),
|
|
192
|
+
}), ie = {
|
|
193
193
|
disabled: Boolean
|
|
194
194
|
}, ae = {
|
|
195
195
|
modifiers: [String, Array]
|
|
196
|
+
}, ue = {
|
|
197
|
+
unselectable: { type: Boolean, default: !0 }
|
|
196
198
|
};
|
|
197
|
-
function
|
|
198
|
-
const t =
|
|
199
|
-
function
|
|
199
|
+
function ce(e) {
|
|
200
|
+
const t = F(e, void 0), r = d(() => !oe(t));
|
|
201
|
+
function c(o, l, u) {
|
|
200
202
|
if (t != null && t.value) {
|
|
201
|
-
const s =
|
|
202
|
-
return
|
|
203
|
+
const s = g(t.value)[o];
|
|
204
|
+
return d({
|
|
203
205
|
get() {
|
|
204
206
|
return s == null ? void 0 : s.value;
|
|
205
207
|
},
|
|
206
|
-
set(
|
|
207
|
-
s.value =
|
|
208
|
+
set(a) {
|
|
209
|
+
s.value = a;
|
|
208
210
|
}
|
|
209
211
|
});
|
|
210
212
|
}
|
|
211
|
-
const
|
|
212
|
-
return
|
|
213
|
+
const v = T(l, o);
|
|
214
|
+
return d({
|
|
213
215
|
get() {
|
|
214
|
-
return
|
|
216
|
+
return v.value;
|
|
215
217
|
},
|
|
216
218
|
set(s) {
|
|
217
|
-
|
|
219
|
+
u && u(`update:${o}`, s);
|
|
218
220
|
}
|
|
219
221
|
});
|
|
220
222
|
}
|
|
221
223
|
return {
|
|
222
224
|
group: t,
|
|
223
225
|
isInGroup: r,
|
|
224
|
-
getGroupOrLocalRef:
|
|
226
|
+
getGroupOrLocalRef: c
|
|
225
227
|
};
|
|
226
228
|
}
|
|
227
|
-
const
|
|
228
|
-
var k = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(k || {}),
|
|
229
|
-
const
|
|
229
|
+
const fe = "VV_BUTTON_GROUP";
|
|
230
|
+
var k = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(k || {}), x = /* @__PURE__ */ ((e) => (e.button = "button", e.submit = "submit", e.reset = "reset", e))(x || {}), m = /* @__PURE__ */ ((e) => (e.nuxtLink = "nuxt-link", e.routerLink = "router-link", e.a = "a", e.button = "button", e))(m || {}), H = /* @__PURE__ */ ((e) => (e._blank = "_blank", e._self = "_self", e._parent = "_parent", e._top = "_top", e))(H || {});
|
|
231
|
+
const de = ["update:modelValue"], ve = {
|
|
230
232
|
...ae,
|
|
231
|
-
...
|
|
233
|
+
...ie,
|
|
234
|
+
...ue,
|
|
232
235
|
icon: {
|
|
233
236
|
type: [String, Object],
|
|
234
237
|
default: ""
|
|
@@ -251,7 +254,7 @@ const fe = ["update:modelValue"], de = {
|
|
|
251
254
|
href: String,
|
|
252
255
|
target: {
|
|
253
256
|
type: String,
|
|
254
|
-
validator: (e) => e in
|
|
257
|
+
validator: (e) => e in H
|
|
255
258
|
},
|
|
256
259
|
active: Boolean,
|
|
257
260
|
pressed: Boolean,
|
|
@@ -262,95 +265,104 @@ const fe = ["update:modelValue"], de = {
|
|
|
262
265
|
type: {
|
|
263
266
|
type: String,
|
|
264
267
|
default: "button",
|
|
265
|
-
validator: (e) => e in
|
|
268
|
+
validator: (e) => e in x
|
|
266
269
|
},
|
|
267
270
|
toggle: {
|
|
268
271
|
type: Boolean,
|
|
269
272
|
default: !1
|
|
270
273
|
},
|
|
271
|
-
modelValue: String
|
|
272
|
-
unselectable: { type: Boolean, default: !0 }
|
|
274
|
+
modelValue: String
|
|
273
275
|
};
|
|
274
276
|
function ge(e, t) {
|
|
275
|
-
var
|
|
276
|
-
const { group: r, isInGroup:
|
|
277
|
+
var A;
|
|
278
|
+
const { group: r, isInGroup: c, getGroupOrLocalRef: o } = ce(fe), {
|
|
279
|
+
iconPosition: l,
|
|
280
|
+
icon: u,
|
|
281
|
+
label: v,
|
|
282
|
+
pressed: s,
|
|
283
|
+
modifiers: a
|
|
284
|
+
} = z(e), n = o("modelValue", e, t), i = o("disabled", e), p = o("toggle", e), y = o(
|
|
277
285
|
"unselectable",
|
|
278
286
|
e
|
|
279
|
-
),
|
|
287
|
+
), b = ((A = r == null ? void 0 : r.value) == null ? void 0 : A.multiple) ?? q(!1), S = d(() => {
|
|
288
|
+
var w;
|
|
289
|
+
const C = a != null && a.value ? Array.isArray(a.value) ? a.value : [a.value] : [], L = (w = r == null ? void 0 : r.value.itemModifiers) != null && w.value ? Array.isArray(r.value.itemModifiers.value) ? r.value.itemModifiers.value : [r.value.itemModifiers.value] : [];
|
|
290
|
+
return [...C, ...L];
|
|
291
|
+
});
|
|
280
292
|
return {
|
|
281
|
-
modelValue: c,
|
|
282
|
-
disabled: n,
|
|
283
|
-
toggle: l,
|
|
284
|
-
isInGroup: u,
|
|
285
293
|
group: r,
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
294
|
+
isInGroup: c,
|
|
295
|
+
modelValue: n,
|
|
296
|
+
disabled: i,
|
|
297
|
+
toggle: p,
|
|
298
|
+
unselectable: y,
|
|
299
|
+
multiple: b,
|
|
300
|
+
modifiers: S,
|
|
289
301
|
pressed: s,
|
|
290
|
-
iconPosition:
|
|
291
|
-
icon:
|
|
292
|
-
label:
|
|
302
|
+
iconPosition: l,
|
|
303
|
+
icon: u,
|
|
304
|
+
label: v
|
|
293
305
|
};
|
|
294
306
|
}
|
|
295
|
-
const
|
|
307
|
+
const pe = {
|
|
296
308
|
key: 1,
|
|
297
309
|
class: "vv-button__label"
|
|
298
|
-
},
|
|
310
|
+
}, me = {
|
|
299
311
|
key: 1,
|
|
300
312
|
class: "vv-button__label"
|
|
301
|
-
},
|
|
313
|
+
}, ye = {
|
|
302
314
|
name: "VvButton"
|
|
303
|
-
},
|
|
304
|
-
...
|
|
305
|
-
props:
|
|
306
|
-
emits:
|
|
315
|
+
}, Ae = /* @__PURE__ */ N({
|
|
316
|
+
...ye,
|
|
317
|
+
props: ve,
|
|
318
|
+
emits: de,
|
|
307
319
|
setup(e, { emit: t }) {
|
|
308
|
-
const r = e,
|
|
309
|
-
modifiers:
|
|
310
|
-
iconPosition:
|
|
320
|
+
const r = e, c = X(), o = K(), l = (c == null ? void 0 : c.name) || te(), {
|
|
321
|
+
modifiers: u,
|
|
322
|
+
iconPosition: v,
|
|
311
323
|
icon: s,
|
|
312
|
-
label:
|
|
324
|
+
label: a,
|
|
313
325
|
modelValue: n,
|
|
314
|
-
disabled:
|
|
326
|
+
disabled: i,
|
|
315
327
|
toggle: p,
|
|
316
328
|
unselectable: y
|
|
317
|
-
} = ge(r, t),
|
|
329
|
+
} = ge(r, t), b = F(U), S = d(() => {
|
|
318
330
|
switch (!0) {
|
|
319
|
-
case
|
|
331
|
+
case i.value:
|
|
320
332
|
return m.button;
|
|
321
333
|
case r.to !== void 0:
|
|
322
|
-
return
|
|
334
|
+
return b != null && b.nuxt ? m.nuxtLink : m.routerLink;
|
|
323
335
|
case r.href !== void 0:
|
|
324
336
|
return m.a;
|
|
325
337
|
default:
|
|
326
338
|
return m.button;
|
|
327
339
|
}
|
|
328
|
-
}),
|
|
329
|
-
modifiers:
|
|
340
|
+
}), A = d(() => p.value ? Array.isArray(n.value) ? I(l, n.value) : j(l, n.value) : r.pressed), { bemCssClasses: C } = Z("vv-button", {
|
|
341
|
+
modifiers: u,
|
|
330
342
|
active: r.active,
|
|
331
|
-
pressed:
|
|
332
|
-
disabled:
|
|
333
|
-
reverse:
|
|
343
|
+
pressed: A,
|
|
344
|
+
disabled: i,
|
|
345
|
+
reverse: d(
|
|
334
346
|
() => [k.right, k.bottom].includes(
|
|
335
|
-
|
|
347
|
+
v.value
|
|
336
348
|
)
|
|
337
349
|
),
|
|
338
|
-
column:
|
|
350
|
+
column: d(
|
|
339
351
|
() => [k.top, k.bottom].includes(
|
|
340
|
-
|
|
352
|
+
v.value
|
|
341
353
|
)
|
|
342
354
|
),
|
|
343
|
-
iconOnly:
|
|
344
|
-
() => (s == null ? void 0 : s.value) && !(
|
|
355
|
+
iconOnly: d(
|
|
356
|
+
() => (s == null ? void 0 : s.value) && !(a != null && a.value) && !o.default
|
|
345
357
|
)
|
|
346
|
-
}),
|
|
358
|
+
}), L = d(
|
|
347
359
|
() => typeof (s == null ? void 0 : s.value) == "string" ? { name: s == null ? void 0 : s.value } : s == null ? void 0 : s.value
|
|
348
|
-
),
|
|
360
|
+
), w = d(() => {
|
|
349
361
|
const f = {
|
|
350
|
-
class:
|
|
351
|
-
"aria-pressed":
|
|
362
|
+
class: C.value,
|
|
363
|
+
"aria-pressed": A.value ? !0 : void 0
|
|
352
364
|
};
|
|
353
|
-
switch (
|
|
365
|
+
switch (S.value) {
|
|
354
366
|
case m.a:
|
|
355
367
|
return {
|
|
356
368
|
...f,
|
|
@@ -371,47 +383,47 @@ const ve = {
|
|
|
371
383
|
return {
|
|
372
384
|
...f,
|
|
373
385
|
type: r.type,
|
|
374
|
-
disabled:
|
|
386
|
+
disabled: i.value
|
|
375
387
|
};
|
|
376
388
|
}
|
|
377
389
|
}), J = () => {
|
|
378
390
|
if (p.value) {
|
|
379
391
|
if (Array.isArray(n.value)) {
|
|
380
|
-
if (
|
|
392
|
+
if (I(l, n.value)) {
|
|
381
393
|
y.value && (n.value = n.value.filter(
|
|
382
|
-
(f) => f !==
|
|
394
|
+
(f) => f !== l
|
|
383
395
|
));
|
|
384
396
|
return;
|
|
385
397
|
}
|
|
386
|
-
n.value.push(
|
|
398
|
+
n.value.push(l);
|
|
387
399
|
return;
|
|
388
400
|
}
|
|
389
|
-
if (
|
|
401
|
+
if (j(l, n.value) && y.value) {
|
|
390
402
|
n.value = void 0;
|
|
391
403
|
return;
|
|
392
404
|
}
|
|
393
|
-
n.value =
|
|
405
|
+
n.value = l;
|
|
394
406
|
}
|
|
395
407
|
};
|
|
396
|
-
return (f,
|
|
408
|
+
return (f, he) => (h(), V(Q(g(S)), D(g(w), { onClickPassive: J }), {
|
|
397
409
|
default: W(() => [
|
|
398
410
|
_(f.$slots, "default", {}, () => [
|
|
399
411
|
f.loading ? _(f.$slots, "loading", { key: 0 }, () => [
|
|
400
|
-
f.loadingIcon ? (
|
|
412
|
+
f.loadingIcon ? (h(), V(G, {
|
|
401
413
|
key: 0,
|
|
402
414
|
class: "vv-button__loading-icon",
|
|
403
415
|
name: f.loadingIcon
|
|
404
416
|
}, null, 8, ["name"])) : $("", !0),
|
|
405
|
-
f.loadingLabel ? (
|
|
406
|
-
]) : (
|
|
417
|
+
f.loadingLabel ? (h(), P("span", pe, R(f.loadingLabel), 1)) : $("", !0)
|
|
418
|
+
]) : (h(), P(Y, { key: 1 }, [
|
|
407
419
|
_(f.$slots, "before"),
|
|
408
|
-
|
|
420
|
+
g(s) ? (h(), V(G, D({
|
|
409
421
|
key: 0,
|
|
410
422
|
class: "vv-button__icon"
|
|
411
|
-
},
|
|
412
|
-
|
|
423
|
+
}, g(L)), null, 16)) : $("", !0),
|
|
424
|
+
g(a) ? (h(), P("span", me, [
|
|
413
425
|
_(f.$slots, "label", {}, () => [
|
|
414
|
-
ee(
|
|
426
|
+
ee(R(g(a)), 1)
|
|
415
427
|
])
|
|
416
428
|
])) : $("", !0),
|
|
417
429
|
_(f.$slots, "after")
|
|
@@ -423,5 +435,5 @@ const ve = {
|
|
|
423
435
|
}
|
|
424
436
|
});
|
|
425
437
|
export {
|
|
426
|
-
|
|
438
|
+
Ae as default
|
|
427
439
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,
|
|
1
|
+
(function(e,v){typeof exports=="object"&&typeof module<"u"?module.exports=v(require("vue"),require("nanoid"),require("@iconify/vue")):typeof define=="function"&&define.amd?define(["vue","nanoid","@iconify/vue"],v):(e=typeof globalThis<"u"?globalThis:e||self,e.VvButton=v(e.vue,e.nanoid,e.vue$1))})(this,function(e,v,h){"use strict";function V(t,n,r){return r?$(t,r)===$(n,r):C(t,n)}function C(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){const r=Array.isArray(t),f=Array.isArray(n);let s,l,u;if(r&&f){if(l=t.length,l!=n.length)return!1;for(s=l;s--!==0;)if(!C(t[s],n[s]))return!1;return!0}if(r!=f)return!1;const p=t instanceof Date,i=n instanceof Date;if(p!=i)return!1;if(p&&i)return t.getTime()==n.getTime();const c=t instanceof RegExp,o=n instanceof RegExp;if(c!=o)return!1;if(c&&o)return t.toString()==n.toString();const a=Object.keys(t);if(l=a.length,l!==Object.keys(n).length)return!1;for(s=l;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[s]))return!1;for(s=l;s--!==0;)if(u=a[s],!C(t[u],n[u]))return!1;return!0}return t!==t&&n!==n}function $(t,n){if(t&&Object.keys(t).length&&n){if(n.indexOf(".")===-1)return t[n];{const r=n.split(".");let f=t;for(let s=0,l=r.length;s<l;++s){if(t==null)return null;f=f[r[s]]}return f}}else return null}function O(t,n){if(t!=null&&n&&n.length){for(const r of n)if(V(t,r))return!0}return!1}function F(t){return(n=>n==null||n===""||Array.isArray(n)&&n.length===0||!(n instanceof Date)&&typeof n=="object"&&Object.keys(n).length===0)(e.unref(t))}function P(t){var n,r;if(t)return(r=(n=t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:n.join("-"))==null?void 0:r.toLowerCase()}const L="ds";function j(t,n){const r={[`${t}`]:!0};return{bemCssClasses:e.computed(()=>Object.keys(n).reduce((s,l)=>{const u=e.unref(n[l])||!1;if(!u)return s;if(l==="modifiers"){const p=Array.isArray(u)?u:u.split(" ");return{...s,...p.reduce((i,c)=>({...i,[`${t}--${P(c)}`]:!0}),{})}}else return{...s,[`${t}--${P(l)}`]:u}},r)||{})}}const I={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}},N={name:"VvIcon"},E=e.defineComponent({...N,props:I,setup(t){const n=t,r=e.ref(!0),{modifiers:f}=e.toRefs(n),s=e.inject(L),{bemCssClasses:l}=j("vv-icon",{modifiers:f}),u=e.computed(()=>n.provider||(s==null?void 0:s.provider)),p=e.computed(()=>{const o=n.name??"",a=`@${u.value}:${n.prefix}:${n.name}`;return h.iconExists(o)?o:h.iconExists(a)?a:(s==null?void 0:s.iconsCollections.find(m=>{const y=`@${u.value}:${m.prefix}:${o}`;if(h.iconExists(y))return y}))||o});function i(o){let a=null;if(typeof window>"u"){const{JSDOM:k}=require("jsdom");a=new k().window}return(a?new a.DOMParser:new window.DOMParser).parseFromString(o,"text/html").querySelector("svg")}function c(o){const a=i(o),m=(a==null?void 0:a.innerHTML.trim())||"";a&&m&&h.addIcon(`@${u.value}:${n.prefix}:${n.name}`,{body:m,height:a.viewBox.baseVal.height,width:a.viewBox.baseVal.width})}return s&&(n.src&&!h.iconExists(`@${u.value}:${n.prefix}:${n.name}`)?(r.value=!1,s.fetchIcon(n.src).then(o=>{o&&(c(o),r.value=!0)}).catch(o=>{throw new Error(`During fetch icon: ${o==null?void 0:o.message}`)})):n.svg&&c(n.svg)),(o,a)=>r.value?(e.openBlock(),e.createBlock(e.unref(h.Icon),e.mergeProps({key:0,class:e.unref(l)},{inline:o.inline,width:o.width,height:o.height,horizontalFlip:o.horizontalFlip,verticalFlip:o.verticalFlip,flip:o.flip,rotate:o.rotate,color:o.color,onLoad:o.onLoad,icon:e.unref(p)}),null,16,["class"])):e.createCommentVNode("",!0)}}),M={disabled:Boolean},q={modifiers:[String,Array]},G={unselectable:{type:Boolean,default:!0}};function x(t){const n=e.inject(t,void 0),r=e.computed(()=>!F(n));function f(s,l,u){if(n!=null&&n.value){const i=e.unref(n.value)[s];return e.computed({get(){return i==null?void 0:i.value},set(c){i.value=c}})}const p=e.toRef(l,s);return e.computed({get(){return p.value},set(i){u&&u(`update:${s}`,i)}})}return{group:n,isInGroup:r,getGroupOrLocalRef:f}}const z="VV_BUTTON_GROUP";var b=(t=>(t.left="left",t.right="right",t.top="top",t.bottom="bottom",t))(b||{}),D=(t=>(t.button="button",t.submit="submit",t.reset="reset",t))(D||{}),g=(t=>(t.nuxtLink="nuxt-link",t.routerLink="router-link",t.a="a",t.button="button",t))(g||{}),R=(t=>(t._blank="_blank",t._self="_self",t._parent="_parent",t._top="_top",t))(R||{});const U=["update:modelValue"],Z={...q,...M,...G,icon:{type:[String,Object],default:""},iconPosition:{type:String,default:"left",validator:t=>t in b},label:[String,Number],loading:Boolean,loadingIcon:{type:String,default:"eos-icons:bubble-loading"},loadingLabel:{type:String,default:"Loading..."},to:{type:[String,Object]},href:String,target:{type:String,validator:t=>t in R},active:Boolean,pressed:Boolean,rel:{type:String,default:"noopener noreferrer"},type:{type:String,default:"button",validator:t=>t in D},toggle:{type:Boolean,default:!1},modelValue:String};function T(t,n){var _;const{group:r,isInGroup:f,getGroupOrLocalRef:s}=x(z),{iconPosition:l,icon:u,label:p,pressed:i,modifiers:c}=e.toRefs(t),o=s("modelValue",t,n),a=s("disabled",t),m=s("toggle",t),y=s("unselectable",t),S=((_=r==null?void 0:r.value)==null?void 0:_.multiple)??e.ref(!1),k=e.computed(()=>{var A;const w=c!=null&&c.value?Array.isArray(c.value)?c.value:[c.value]:[],B=(A=r==null?void 0:r.value.itemModifiers)!=null&&A.value?Array.isArray(r.value.itemModifiers.value)?r.value.itemModifiers.value:[r.value.itemModifiers.value]:[];return[...w,...B]});return{group:r,isInGroup:f,modelValue:o,disabled:a,toggle:m,unselectable:y,multiple:S,modifiers:k,pressed:i,iconPosition:l,icon:u,label:p}}const H={key:1,class:"vv-button__label"},J={key:1,class:"vv-button__label"},X={name:"VvButton"};return e.defineComponent({...X,props:Z,emits:U,setup(t,{emit:n}){const r=t,f=e.useAttrs(),s=e.useSlots(),l=(f==null?void 0:f.name)||v.nanoid(),{modifiers:u,iconPosition:p,icon:i,label:c,modelValue:o,disabled:a,toggle:m,unselectable:y}=T(r,n),S=e.inject(L),k=e.computed(()=>{switch(!0){case a.value:return g.button;case r.to!==void 0:return S!=null&&S.nuxt?g.nuxtLink:g.routerLink;case r.href!==void 0:return g.a;default:return g.button}}),_=e.computed(()=>m.value?Array.isArray(o.value)?O(l,o.value):V(l,o.value):r.pressed),{bemCssClasses:w}=j("vv-button",{modifiers:u,active:r.active,pressed:_,disabled:a,reverse:e.computed(()=>[b.right,b.bottom].includes(p.value)),column:e.computed(()=>[b.top,b.bottom].includes(p.value)),iconOnly:e.computed(()=>(i==null?void 0:i.value)&&!(c!=null&&c.value)&&!s.default)}),B=e.computed(()=>typeof(i==null?void 0:i.value)=="string"?{name:i==null?void 0:i.value}:i==null?void 0:i.value),A=e.computed(()=>{const d={class:w.value,"aria-pressed":_.value?!0:void 0};switch(k.value){case g.a:return{...d,role:"button",href:r.href,target:r.target,rel:r.rel};case g.routerLink:case g.nuxtLink:return{...d,role:"button",to:r.to,target:r.target};default:return{...d,type:r.type,disabled:a.value}}}),K=()=>{if(m.value){if(Array.isArray(o.value)){if(O(l,o.value)){y.value&&(o.value=o.value.filter(d=>d!==l));return}o.value.push(l);return}if(V(l,o.value)&&y.value){o.value=void 0;return}o.value=l}};return(d,W)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(k)),e.mergeProps(e.unref(A),{onClickPassive:K}),{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default",{},()=>[d.loading?e.renderSlot(d.$slots,"loading",{key:0},()=>[d.loadingIcon?(e.openBlock(),e.createBlock(E,{key:0,class:"vv-button__loading-icon",name:d.loadingIcon},null,8,["name"])):e.createCommentVNode("",!0),d.loadingLabel?(e.openBlock(),e.createElementBlock("span",H,e.toDisplayString(d.loadingLabel),1)):e.createCommentVNode("",!0)]):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(d.$slots,"before"),e.unref(i)?(e.openBlock(),e.createBlock(E,e.mergeProps({key:0,class:"vv-button__icon"},e.unref(B)),null,16)):e.createCommentVNode("",!0),e.unref(c)?(e.openBlock(),e.createElementBlock("span",J,[e.renderSlot(d.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(c)),1)])])):e.createCommentVNode("",!0),e.renderSlot(d.$slots,"after")],64))])]),_:3},16))}})});
|
|
@@ -2,10 +2,6 @@ import { ButtonIconPosition } from '@/components/VvButton';
|
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
3
3
|
icon: {
|
|
4
4
|
type: (ObjectConstructor | StringConstructor)[];
|
|
5
|
-
/**
|
|
6
|
-
* @description The tag defined by props.
|
|
7
|
-
* @returns {string} The tag.
|
|
8
|
-
*/
|
|
9
5
|
default: string;
|
|
10
6
|
};
|
|
11
7
|
iconPosition: {
|
|
@@ -56,10 +52,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
56
52
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
57
53
|
icon: {
|
|
58
54
|
type: (ObjectConstructor | StringConstructor)[];
|
|
59
|
-
/**
|
|
60
|
-
* @description The tag defined by props.
|
|
61
|
-
* @returns {string} The tag.
|
|
62
|
-
*/
|
|
63
55
|
default: string;
|
|
64
56
|
};
|
|
65
57
|
iconPosition: {
|
|
@@ -117,14 +117,14 @@ export type VvButtonPropsTypes = ExtractPropTypes<typeof VvButtonProps>;
|
|
|
117
117
|
* Merges local and group props
|
|
118
118
|
*/
|
|
119
119
|
export declare function useGroupProps(props: VvButtonPropsTypes, emit: (event: (typeof VvButtonEvents)[number], value: unknown) => void): {
|
|
120
|
+
group: Ref<IButtonGroupState> | undefined;
|
|
121
|
+
isInGroup: import("vue").ComputedRef<boolean>;
|
|
120
122
|
modelValue: Ref<string | string[] | undefined>;
|
|
121
123
|
disabled: Ref<boolean>;
|
|
122
124
|
toggle: Ref<boolean>;
|
|
123
|
-
isInGroup: import("vue").ComputedRef<boolean>;
|
|
124
|
-
group: Ref<IButtonGroupState> | undefined;
|
|
125
|
-
modifiers: Ref<string | string[]>;
|
|
126
|
-
multiple: Ref<boolean>;
|
|
127
125
|
unselectable: Ref<boolean>;
|
|
126
|
+
multiple: Ref<boolean>;
|
|
127
|
+
modifiers: import("vue").ComputedRef<string[]>;
|
|
128
128
|
pressed: Ref<boolean>;
|
|
129
129
|
iconPosition: Ref<ButtonIconPosition>;
|
|
130
130
|
icon: Ref<string | Record<string, any>>;
|