@geckou/ui-vue 0.6.0 → 0.7.0
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 +24 -0
- package/dist/components/ArticleList/Parts/CardHeading.vue.d.ts +6 -1
- package/dist/components/ArticleList/Parts/CardHeading.vue2.js +7 -7
- package/dist/components/CheckBox.vue.d.ts +2 -2
- package/dist/components/CheckBox.vue2.js +43 -41
- package/dist/components/CheckBox.vue3.js +2 -2
- package/dist/components/DatePicker.vue.d.ts +9 -0
- package/dist/components/DatePicker.vue2.js +80 -60
- package/dist/components/DatePicker.vue3.js +14 -12
- package/dist/components/DateSelector.vue.d.ts +9 -0
- package/dist/components/DateSelector.vue2.js +97 -77
- package/dist/components/DateSelector.vue3.js +12 -10
- package/dist/components/LabeledCheckbox.vue3.js +1 -1
- package/dist/components/ModalBox.vue2.js +37 -31
- package/dist/components/ToggleButton.vue.d.ts +1 -1
- package/dist/components/ToggleButton.vue2.js +45 -43
- package/dist/components/ToggleButton.vue3.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { daysInMonth as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
import { defineComponent as T, ref as x, computed as y, watch as M, watchEffect as A, onBeforeUnmount as O, openBlock as s, createBlock as j, normalizeClass as u, withCtx as U, createElementVNode as o, createElementBlock as d, Fragment as h, renderList as $, toDisplayString as B, createVNode as c, createCommentVNode as Y, unref as k } from "vue";
|
|
2
|
+
import { daysInMonth as z, splitDate as H } from "@geckou/ui-core";
|
|
3
|
+
import P from "./InputBox.vue.js";
|
|
4
|
+
import C from "./Icon/KeyboardArrowDownIcon.vue.js";
|
|
5
|
+
import G from "./TextButton.vue.js";
|
|
6
|
+
import { nextUniqueId as J } from "../scripts/unique-id.js";
|
|
7
|
+
const K = ["value", "name", "aria-label", "aria-labelledby", "required"], Q = ["value"], W = ["value", "name", "aria-label", "aria-labelledby", "required"], X = ["value"], Z = ["value", "name", "aria-label", "aria-labelledby", "required"], w = ["value"], _ = ["id"], ee = ["id"], te = ["id"], de = /* @__PURE__ */ T({
|
|
7
8
|
__name: "DateSelector",
|
|
8
9
|
props: {
|
|
9
10
|
name: {},
|
|
@@ -12,32 +13,34 @@ const L = ["value", "name", "aria-label", "required"], P = ["value"], U = ["valu
|
|
|
12
13
|
formValidationManager: { default: null },
|
|
13
14
|
type: { default: "date" },
|
|
14
15
|
minYear: { default: void 0 },
|
|
15
|
-
maxYear: { default: void 0 }
|
|
16
|
+
maxYear: { default: void 0 },
|
|
17
|
+
ariaLabel: { default: void 0 },
|
|
18
|
+
ariaLabelledBy: { default: void 0 }
|
|
16
19
|
},
|
|
17
20
|
emits: ["update:modelValue"],
|
|
18
|
-
setup(
|
|
19
|
-
const
|
|
21
|
+
setup(i, { emit: D }) {
|
|
22
|
+
const q = D, l = i, m = J("date_selector_unit"), f = (e) => l.ariaLabelledBy ? void 0 : `${l.ariaLabel ?? l.name}の${e}`, v = (e) => l.ariaLabelledBy ? `${l.ariaLabelledBy} ${m}_${e}` : void 0, n = x({
|
|
20
23
|
year: "",
|
|
21
24
|
month: "",
|
|
22
25
|
day: ""
|
|
23
|
-
}),
|
|
24
|
-
const e = (/* @__PURE__ */ new Date()).getFullYear(), a =
|
|
25
|
-
return Array.from({ length: r }, (
|
|
26
|
-
}),
|
|
26
|
+
}), E = y(() => {
|
|
27
|
+
const e = (/* @__PURE__ */ new Date()).getFullYear(), a = l.minYear ?? e - 100, t = l.maxYear ?? e - 14, r = Math.max(t - a + 1, 0);
|
|
28
|
+
return Array.from({ length: r }, (g, F) => (a + F).toString()).map((g) => ({ label: g, value: g }));
|
|
29
|
+
}), N = y(() => Array.from({ length: 12 }, (e, a) => {
|
|
27
30
|
const t = (a + 1).toString();
|
|
28
31
|
return {
|
|
29
32
|
label: t,
|
|
30
33
|
value: t.padStart(2, "0")
|
|
31
34
|
};
|
|
32
|
-
})),
|
|
35
|
+
})), S = y(() => {
|
|
33
36
|
var t, r;
|
|
34
37
|
const e = Number((t = n.value) == null ? void 0 : t.month);
|
|
35
38
|
if (!e)
|
|
36
39
|
return 31;
|
|
37
40
|
const a = Number((r = n.value) == null ? void 0 : r.year) || 2e3;
|
|
38
|
-
return
|
|
39
|
-
}),
|
|
40
|
-
const e = [], a =
|
|
41
|
+
return z(a, e);
|
|
42
|
+
}), R = y(() => {
|
|
43
|
+
const e = [], a = S.value;
|
|
41
44
|
for (let t = 1; t <= a; t++) {
|
|
42
45
|
const r = t.toString();
|
|
43
46
|
e.push(r);
|
|
@@ -46,119 +49,136 @@ const L = ["value", "name", "aria-label", "required"], P = ["value"], U = ["valu
|
|
|
46
49
|
label: t,
|
|
47
50
|
value: String(t).padStart(2, "0")
|
|
48
51
|
}));
|
|
49
|
-
}),
|
|
52
|
+
}), b = (e) => {
|
|
50
53
|
const t = e.currentTarget.firstElementChild;
|
|
51
54
|
t && t.click();
|
|
52
|
-
},
|
|
55
|
+
}, p = (e, a) => {
|
|
53
56
|
const t = e.target, { value: r } = t;
|
|
54
57
|
n.value = { ...n.value, [a]: r };
|
|
55
58
|
};
|
|
56
|
-
|
|
59
|
+
M(S, (e) => {
|
|
57
60
|
const a = Number(n.value.day);
|
|
58
61
|
a && a > e && (n.value = { ...n.value, day: String(e).padStart(2, "0") });
|
|
59
62
|
});
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
n.value =
|
|
63
|
+
const V = { year: "", month: "", day: "" };
|
|
64
|
+
A(() => {
|
|
65
|
+
n.value = l.modelValue ? H(l.modelValue) : { ...V };
|
|
63
66
|
});
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
const a = !!(e.year && e.month && (
|
|
68
|
-
return
|
|
67
|
+
const L = (e) => {
|
|
68
|
+
l.formValidationManager && l.formValidationManager.setValid(l.name, e);
|
|
69
|
+
}, I = (e) => {
|
|
70
|
+
const a = !!(e.year && e.month && (l.type === "month" || e.day)), t = !e.year && !e.month && !e.day;
|
|
71
|
+
return l.isRequired ? a : a || t;
|
|
69
72
|
};
|
|
70
|
-
return
|
|
73
|
+
return L(I(n.value)), M(
|
|
71
74
|
() => n.value,
|
|
72
75
|
(e) => {
|
|
73
|
-
const a = !!(e.year && e.month && (
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
+
const a = !!(e.year && e.month && (l.type === "month" || e.day)), t = !e.year && !e.month && !e.day;
|
|
77
|
+
if (L(I(e)), t)
|
|
78
|
+
q("update:modelValue", "");
|
|
76
79
|
else if (a) {
|
|
77
|
-
const r =
|
|
78
|
-
|
|
80
|
+
const r = l.type === "month" ? [e.year, e.month] : [e.year, e.month, e.day];
|
|
81
|
+
q("update:modelValue", r.filter(Boolean).join("-"));
|
|
79
82
|
} else
|
|
80
83
|
return;
|
|
81
84
|
},
|
|
82
85
|
{ deep: !0 }
|
|
83
|
-
),
|
|
86
|
+
), O(() => {
|
|
84
87
|
var e;
|
|
85
|
-
return (e =
|
|
86
|
-
}), (e, a) => (s(),
|
|
88
|
+
return (e = l.formValidationManager) == null ? void 0 : e.remove(l.name);
|
|
89
|
+
}), (e, a) => (s(), j(P, {
|
|
87
90
|
class: u(e.$style.date_selector)
|
|
88
91
|
}, {
|
|
89
|
-
default:
|
|
90
|
-
|
|
92
|
+
default: U(() => [
|
|
93
|
+
o("div", {
|
|
91
94
|
class: u([e.$style.selector_wrapper]),
|
|
92
|
-
onClick: a[1] || (a[1] = (t) =>
|
|
95
|
+
onClick: a[1] || (a[1] = (t) => b(t))
|
|
93
96
|
}, [
|
|
94
|
-
|
|
97
|
+
o("select", {
|
|
95
98
|
value: n.value.year,
|
|
96
|
-
name: `${
|
|
97
|
-
"aria-label":
|
|
98
|
-
|
|
99
|
+
name: `${i.name}-year`,
|
|
100
|
+
"aria-label": f("年"),
|
|
101
|
+
"aria-labelledby": v("年"),
|
|
102
|
+
required: i.isRequired,
|
|
99
103
|
class: u(e.$style.year),
|
|
100
|
-
onChange: a[0] || (a[0] = (t) =>
|
|
104
|
+
onChange: a[0] || (a[0] = (t) => p(t, "year"))
|
|
101
105
|
}, [
|
|
102
|
-
a[7] || (a[7] =
|
|
106
|
+
a[7] || (a[7] = o("option", {
|
|
103
107
|
disabled: "",
|
|
104
108
|
selected: "",
|
|
105
109
|
value: ""
|
|
106
110
|
}, "年", -1)),
|
|
107
|
-
(s(!0), d(
|
|
111
|
+
(s(!0), d(h, null, $(E.value, (t) => (s(), d("option", {
|
|
108
112
|
key: t.value,
|
|
109
113
|
value: t.value
|
|
110
|
-
},
|
|
111
|
-
], 42,
|
|
112
|
-
|
|
114
|
+
}, B(t.label), 9, Q))), 128))
|
|
115
|
+
], 42, K),
|
|
116
|
+
c(C)
|
|
113
117
|
], 2),
|
|
114
|
-
|
|
118
|
+
o("div", {
|
|
115
119
|
class: u([e.$style.selector_wrapper]),
|
|
116
|
-
onClick: a[3] || (a[3] = (t) =>
|
|
120
|
+
onClick: a[3] || (a[3] = (t) => b(t))
|
|
117
121
|
}, [
|
|
118
|
-
|
|
122
|
+
o("select", {
|
|
119
123
|
value: n.value.month,
|
|
120
|
-
name: `${
|
|
121
|
-
"aria-label":
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
name: `${i.name}-month`,
|
|
125
|
+
"aria-label": f("月"),
|
|
126
|
+
"aria-labelledby": v("月"),
|
|
127
|
+
required: i.isRequired,
|
|
128
|
+
onChange: a[2] || (a[2] = (t) => p(t, "month"))
|
|
124
129
|
}, [
|
|
125
|
-
a[8] || (a[8] =
|
|
130
|
+
a[8] || (a[8] = o("option", {
|
|
126
131
|
disabled: "",
|
|
127
132
|
selected: "",
|
|
128
133
|
value: ""
|
|
129
134
|
}, "月", -1)),
|
|
130
|
-
(s(!0), d(
|
|
135
|
+
(s(!0), d(h, null, $(N.value, (t) => (s(), d("option", {
|
|
131
136
|
key: t.value,
|
|
132
137
|
value: t.value
|
|
133
|
-
},
|
|
134
|
-
], 40,
|
|
135
|
-
|
|
138
|
+
}, B(t.label), 9, X))), 128))
|
|
139
|
+
], 40, W),
|
|
140
|
+
c(C)
|
|
136
141
|
], 2),
|
|
137
|
-
|
|
142
|
+
i.type === "date" ? (s(), d("div", {
|
|
138
143
|
key: 0,
|
|
139
144
|
class: u([e.$style.selector_wrapper]),
|
|
140
|
-
onClick: a[5] || (a[5] = (t) =>
|
|
145
|
+
onClick: a[5] || (a[5] = (t) => b(t))
|
|
141
146
|
}, [
|
|
142
|
-
|
|
147
|
+
o("select", {
|
|
143
148
|
value: n.value.day,
|
|
144
|
-
name: `${
|
|
145
|
-
"aria-label":
|
|
146
|
-
|
|
147
|
-
|
|
149
|
+
name: `${i.name}-day`,
|
|
150
|
+
"aria-label": f("日"),
|
|
151
|
+
"aria-labelledby": v("日"),
|
|
152
|
+
required: i.isRequired,
|
|
153
|
+
onChange: a[4] || (a[4] = (t) => p(t, "day"))
|
|
148
154
|
}, [
|
|
149
|
-
a[9] || (a[9] =
|
|
155
|
+
a[9] || (a[9] = o("option", {
|
|
150
156
|
disabled: "",
|
|
151
157
|
selected: "",
|
|
152
158
|
value: ""
|
|
153
159
|
}, "日", -1)),
|
|
154
|
-
(s(!0), d(
|
|
160
|
+
(s(!0), d(h, null, $(R.value, (t) => (s(), d("option", {
|
|
155
161
|
key: t.value,
|
|
156
162
|
value: t.value
|
|
157
|
-
},
|
|
158
|
-
], 40,
|
|
159
|
-
|
|
160
|
-
], 2)) :
|
|
161
|
-
|
|
163
|
+
}, B(t.label), 9, w))), 128))
|
|
164
|
+
], 40, Z),
|
|
165
|
+
c(C)
|
|
166
|
+
], 2)) : Y("", !0),
|
|
167
|
+
i.ariaLabelledBy ? (s(), d("span", {
|
|
168
|
+
key: 1,
|
|
169
|
+
class: u(e.$style.unit_labels)
|
|
170
|
+
}, [
|
|
171
|
+
o("span", {
|
|
172
|
+
id: `${k(m)}_年`
|
|
173
|
+
}, "の年", 8, _),
|
|
174
|
+
o("span", {
|
|
175
|
+
id: `${k(m)}_月`
|
|
176
|
+
}, "の月", 8, ee),
|
|
177
|
+
o("span", {
|
|
178
|
+
id: `${k(m)}_日`
|
|
179
|
+
}, "の日", 8, te)
|
|
180
|
+
], 2)) : Y("", !0),
|
|
181
|
+
c(G, {
|
|
162
182
|
text: "削除",
|
|
163
183
|
variant: "caution",
|
|
164
184
|
class: u(e.$style.delete_button),
|
|
@@ -170,5 +190,5 @@ const L = ["value", "name", "aria-label", "required"], P = ["value"], U = ["valu
|
|
|
170
190
|
}
|
|
171
191
|
});
|
|
172
192
|
export {
|
|
173
|
-
|
|
193
|
+
de as default
|
|
174
194
|
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
const e = "
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
const e = "_unit_labels_pa04y_1", t = "_date_selector_pa04y_13", _ = "_selector_wrapper_pa04y_23", a = "_year_pa04y_49", l = "_delete_button_pa04y_53", s = {
|
|
2
|
+
unit_labels: e,
|
|
3
|
+
date_selector: t,
|
|
4
|
+
selector_wrapper: _,
|
|
5
|
+
year: a,
|
|
6
|
+
delete_button: l
|
|
6
7
|
};
|
|
7
8
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
t as date_selector,
|
|
10
|
+
s as default,
|
|
11
|
+
l as delete_button,
|
|
12
|
+
_ as selector_wrapper,
|
|
13
|
+
e as unit_labels,
|
|
14
|
+
a as year
|
|
13
15
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { createScrollLock as M } from "@geckou/ui-core";
|
|
3
|
-
import
|
|
4
|
-
import { nextUniqueId as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as p, ref as g, watch as $, nextTick as C, computed as E, onMounted as L, onBeforeUnmount as B, openBlock as i, createElementBlock as d, normalizeClass as o, withModifiers as I, createElementVNode as c, unref as k, renderSlot as u, createCommentVNode as w, createVNode as z } from "vue";
|
|
2
|
+
import { createScrollLock as M, handleTabKey as N } from "@geckou/ui-core";
|
|
3
|
+
import V from "./Icon/CloseIcon.vue.js";
|
|
4
|
+
import { nextUniqueId as q } from "../scripts/unique-id.js";
|
|
5
|
+
const K = ["aria-hidden", "inert"], T = ["aria-labelledby", "aria-label"], U = ["id"], H = /* @__PURE__ */ p({
|
|
6
6
|
__name: "ModalBox",
|
|
7
7
|
props: {
|
|
8
8
|
isShown: { type: Boolean },
|
|
@@ -11,7 +11,7 @@ const q = ["aria-hidden", "inert"], U = ["aria-labelledby", "aria-label"], D = [
|
|
|
11
11
|
},
|
|
12
12
|
emits: ["close"],
|
|
13
13
|
setup(n, { emit: b }) {
|
|
14
|
-
const t = n,
|
|
14
|
+
const t = n, m = q("modal_header"), s = g(null), v = b, f = M(), h = (e) => f.toggle(e), a = () => v("close");
|
|
15
15
|
$(
|
|
16
16
|
() => t.isShown,
|
|
17
17
|
(e) => h(e)
|
|
@@ -20,66 +20,72 @@ const q = ["aria-hidden", "inert"], U = ["aria-labelledby", "aria-label"], D = [
|
|
|
20
20
|
$(
|
|
21
21
|
() => t.isShown,
|
|
22
22
|
async (e) => {
|
|
23
|
-
var
|
|
23
|
+
var r;
|
|
24
24
|
if (!e) {
|
|
25
25
|
l == null || l.focus(), l = null;
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
l = typeof document > "u" ? null : document.activeElement, await C(), (
|
|
28
|
+
l = typeof document > "u" ? null : document.activeElement, await C(), (r = s.value) == null || r.focus();
|
|
29
29
|
}
|
|
30
30
|
);
|
|
31
|
-
const
|
|
32
|
-
t.isShown
|
|
31
|
+
const S = E(() => !t.isShown || void 0), y = (e) => {
|
|
32
|
+
if (t.isShown) {
|
|
33
|
+
if (e.key === "Escape") {
|
|
34
|
+
a();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
N(s.value, e, document.activeElement);
|
|
38
|
+
}
|
|
33
39
|
};
|
|
34
|
-
return
|
|
40
|
+
return L(() => {
|
|
35
41
|
h(t.isShown), document.addEventListener("keydown", y);
|
|
36
42
|
}), B(() => {
|
|
37
43
|
f.release(), document.removeEventListener("keydown", y);
|
|
38
|
-
}), (e,
|
|
44
|
+
}), (e, r) => (i(), d("div", {
|
|
39
45
|
class: o([e.$style.overlay, { [e.$style.display]: n.isShown }]),
|
|
40
46
|
"aria-hidden": !n.isShown,
|
|
41
|
-
inert:
|
|
42
|
-
onClick: I(
|
|
47
|
+
inert: S.value,
|
|
48
|
+
onClick: I(a, ["self"])
|
|
43
49
|
}, [
|
|
44
|
-
|
|
50
|
+
c("div", {
|
|
45
51
|
ref_key: "dialog",
|
|
46
|
-
ref:
|
|
52
|
+
ref: s,
|
|
47
53
|
role: "dialog",
|
|
48
54
|
"aria-modal": "true",
|
|
49
|
-
"aria-labelledby": e.$slots.header ? k(
|
|
55
|
+
"aria-labelledby": e.$slots.header ? k(m) : void 0,
|
|
50
56
|
"aria-label": e.$slots.header ? void 0 : n.ariaLabel ?? "ダイアログ",
|
|
51
57
|
tabindex: -1,
|
|
52
58
|
class: o([e.$style.container, e.$style[n.size ?? "medium"]])
|
|
53
59
|
}, [
|
|
54
|
-
e.$slots.header ? (i(),
|
|
60
|
+
e.$slots.header ? (i(), d("header", {
|
|
55
61
|
key: 0,
|
|
56
|
-
id: k(
|
|
62
|
+
id: k(m),
|
|
57
63
|
class: o(e.$style.header)
|
|
58
64
|
}, [
|
|
59
|
-
|
|
60
|
-
], 10,
|
|
61
|
-
|
|
65
|
+
u(e.$slots, "header")
|
|
66
|
+
], 10, U)) : w("", !0),
|
|
67
|
+
c("div", {
|
|
62
68
|
class: o(e.$style.contents)
|
|
63
69
|
}, [
|
|
64
|
-
|
|
70
|
+
u(e.$slots, "default")
|
|
65
71
|
], 2),
|
|
66
|
-
e.$slots.footer ? (i(),
|
|
72
|
+
e.$slots.footer ? (i(), d("footer", {
|
|
67
73
|
key: 1,
|
|
68
74
|
class: o(e.$style.footer)
|
|
69
75
|
}, [
|
|
70
|
-
|
|
76
|
+
u(e.$slots, "footer")
|
|
71
77
|
], 2)) : w("", !0),
|
|
72
|
-
|
|
78
|
+
c("button", {
|
|
73
79
|
type: "button",
|
|
74
80
|
class: o(e.$style.close_button),
|
|
75
|
-
onClick:
|
|
81
|
+
onClick: a
|
|
76
82
|
}, [
|
|
77
|
-
z(
|
|
83
|
+
z(V)
|
|
78
84
|
], 2)
|
|
79
|
-
], 10,
|
|
80
|
-
], 10,
|
|
85
|
+
], 10, T)
|
|
86
|
+
], 10, K));
|
|
81
87
|
}
|
|
82
88
|
});
|
|
83
89
|
export {
|
|
84
|
-
|
|
90
|
+
H as default
|
|
85
91
|
};
|
|
@@ -22,5 +22,5 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
22
22
|
label: Record<"on" | "off", string>;
|
|
23
23
|
ariaLabel: string;
|
|
24
24
|
ariaLabelledBy: string;
|
|
25
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {},
|
|
25
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
26
26
|
export default _default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { defineComponent as w, computed as r, openBlock as
|
|
1
|
+
import { defineComponent as w, computed as r, openBlock as v, createElementBlock as k, Fragment as B, createElementVNode as s, mergeProps as z, withModifiers as $, normalizeClass as C, createCommentVNode as V } from "vue";
|
|
2
2
|
import { COLOR as l } from "@geckou/ui-core";
|
|
3
|
-
const G = ["disabled", "aria-checked", "aria-labelledby", "aria-label"], O = ["
|
|
3
|
+
const G = ["disabled", "data-checked", "aria-checked", "aria-labelledby", "aria-label"], O = ["data-on", "data-off"], S = ["name", "disabled"], E = /* @__PURE__ */ w({
|
|
4
|
+
inheritAttrs: !1,
|
|
4
5
|
__name: "ToggleButton",
|
|
5
6
|
props: {
|
|
6
7
|
name: {},
|
|
@@ -12,11 +13,11 @@ const G = ["disabled", "aria-checked", "aria-labelledby", "aria-label"], O = ["n
|
|
|
12
13
|
ariaLabelledBy: { default: void 0 }
|
|
13
14
|
},
|
|
14
15
|
emits: ["update:modelValue"],
|
|
15
|
-
setup(o, { emit:
|
|
16
|
-
const
|
|
16
|
+
setup(o, { emit: D }) {
|
|
17
|
+
const x = D, a = o, d = r({
|
|
17
18
|
get: () => a.modelValue ?? !1,
|
|
18
|
-
set: (e) =>
|
|
19
|
-
}),
|
|
19
|
+
set: (e) => x("update:modelValue", e)
|
|
20
|
+
}), L = r(() => {
|
|
20
21
|
const e = a.label.on.length, t = a.label.off.length;
|
|
21
22
|
return e > t ? e : t;
|
|
22
23
|
}), i = r(() => {
|
|
@@ -48,47 +49,48 @@ const G = ["disabled", "aria-checked", "aria-labelledby", "aria-label"], O = ["n
|
|
|
48
49
|
}[d.value ? "on" : "off"];
|
|
49
50
|
});
|
|
50
51
|
return (e, t) => {
|
|
51
|
-
var n, u, c, f, m,
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
52
|
+
var n, u, b, c, f, m, h, g, y;
|
|
53
|
+
return v(), k(B, null, [
|
|
54
|
+
s("button", z(e.$attrs, {
|
|
55
|
+
class: e.$style.toggle_button,
|
|
56
|
+
style: {
|
|
57
|
+
"--text-color": (n = i.value) == null ? void 0 : n.textColor,
|
|
58
|
+
"--border-color": (b = (u = i.value) == null ? void 0 : u.border) == null ? void 0 : b.color,
|
|
59
|
+
"--border-size": (f = (c = i.value) == null ? void 0 : c.border) == null ? void 0 : f.size,
|
|
60
|
+
"--radius-size": (h = (m = i.value) == null ? void 0 : m.border) == null ? void 0 : h.radius,
|
|
61
|
+
"--background-color": (g = i.value) == null ? void 0 : g.backgroundColor,
|
|
62
|
+
"--box-shadow": (y = i.value) == null ? void 0 : y.boxShadow,
|
|
63
|
+
"--inline-size": `${L.value * 2}ch`
|
|
64
|
+
},
|
|
65
|
+
type: "button",
|
|
66
|
+
disabled: o.isDisabled,
|
|
67
|
+
role: "switch",
|
|
68
|
+
"data-checked": d.value,
|
|
69
|
+
"aria-checked": d.value,
|
|
70
|
+
"aria-labelledby": o.ariaLabelledBy,
|
|
71
|
+
"aria-label": o.ariaLabelledBy ? void 0 : o.ariaLabel ?? o.name,
|
|
72
|
+
onClick: t[0] || (t[0] = $((F) => o.isDisabled ? null : d.value = !d.value, ["stop"]))
|
|
73
|
+
}), [
|
|
74
|
+
s("div", {
|
|
75
|
+
class: C([e.$style.text, { [e.$style.on]: d.value }]),
|
|
76
|
+
"data-on": o.label.on,
|
|
77
|
+
"data-off": o.label.off
|
|
78
|
+
}, null, 10, O),
|
|
79
|
+
s("div", {
|
|
80
|
+
class: C(e.$style.handle)
|
|
81
|
+
}, null, 2)
|
|
82
|
+
], 16, G),
|
|
83
|
+
d.value ? (v(), k("input", {
|
|
84
|
+
key: 0,
|
|
85
|
+
type: "hidden",
|
|
75
86
|
name: o.name,
|
|
87
|
+
value: "on",
|
|
76
88
|
disabled: o.isDisabled
|
|
77
|
-
}, null, 8,
|
|
78
|
-
|
|
79
|
-
]),
|
|
80
|
-
b("div", {
|
|
81
|
-
class: s([e.$style.text, { [e.$style.on]: d.value }]),
|
|
82
|
-
"data-on": o.label.on,
|
|
83
|
-
"data-off": o.label.off
|
|
84
|
-
}, null, 10, p),
|
|
85
|
-
b("div", {
|
|
86
|
-
class: s(e.$style.handle)
|
|
87
|
-
}, null, 2)
|
|
88
|
-
], 14, G);
|
|
89
|
+
}, null, 8, S)) : V("", !0)
|
|
90
|
+
], 64);
|
|
89
91
|
};
|
|
90
92
|
}
|
|
91
93
|
});
|
|
92
94
|
export {
|
|
93
|
-
|
|
95
|
+
E as default
|
|
94
96
|
};
|