@q1travel/design-system 0.1.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 +28 -0
- package/dist/design-system.d.ts +1099 -0
- package/dist/design-system.js +3931 -0
- package/dist/style.css +7046 -0
- package/package.json +49 -0
|
@@ -0,0 +1,3931 @@
|
|
|
1
|
+
import { jsxs as i, jsx as e, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Ee, createElement as he, createContext as Ie, useContext as Se, useState as E, useRef as I, useCallback as J, useEffect as B, useLayoutEffect as G, useMemo as fe, useId as W, isValidElement as ke, Fragment as we, cloneElement as Ve } from "react";
|
|
3
|
+
import { createPortal as Xe } from "react-dom";
|
|
4
|
+
const Ze = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Ae = (...t) => t.filter((n, r, a) => !!n && n.trim() !== "" && a.indexOf(n) === r).join(" ").trim();
|
|
5
|
+
var Qe = {
|
|
6
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
+
width: 24,
|
|
8
|
+
height: 24,
|
|
9
|
+
viewBox: "0 0 24 24",
|
|
10
|
+
fill: "none",
|
|
11
|
+
stroke: "currentColor",
|
|
12
|
+
strokeWidth: 2,
|
|
13
|
+
strokeLinecap: "round",
|
|
14
|
+
strokeLinejoin: "round"
|
|
15
|
+
};
|
|
16
|
+
const Je = Ee(
|
|
17
|
+
({
|
|
18
|
+
color: t = "currentColor",
|
|
19
|
+
size: n = 24,
|
|
20
|
+
strokeWidth: r = 2,
|
|
21
|
+
absoluteStrokeWidth: a,
|
|
22
|
+
className: l = "",
|
|
23
|
+
children: s,
|
|
24
|
+
iconNode: o,
|
|
25
|
+
...u
|
|
26
|
+
}, c) => he(
|
|
27
|
+
"svg",
|
|
28
|
+
{
|
|
29
|
+
ref: c,
|
|
30
|
+
...Qe,
|
|
31
|
+
width: n,
|
|
32
|
+
height: n,
|
|
33
|
+
stroke: t,
|
|
34
|
+
strokeWidth: a ? Number(r) * 24 / Number(n) : r,
|
|
35
|
+
className: Ae("lucide", l),
|
|
36
|
+
...u
|
|
37
|
+
},
|
|
38
|
+
[
|
|
39
|
+
...o.map(([_, d]) => he(_, d)),
|
|
40
|
+
...Array.isArray(s) ? s : [s]
|
|
41
|
+
]
|
|
42
|
+
)
|
|
43
|
+
);
|
|
44
|
+
const A = (t, n) => {
|
|
45
|
+
const r = Ee(
|
|
46
|
+
({ className: a, ...l }, s) => he(Je, {
|
|
47
|
+
ref: s,
|
|
48
|
+
iconNode: n,
|
|
49
|
+
className: Ae(`lucide-${Ze(t)}`, a),
|
|
50
|
+
...l
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
return r.displayName = `${t}`, r;
|
|
54
|
+
};
|
|
55
|
+
const et = A("ArrowLeft", [
|
|
56
|
+
["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
|
|
57
|
+
["path", { d: "M19 12H5", key: "x3x0zl" }]
|
|
58
|
+
]);
|
|
59
|
+
const Te = A("ArrowRight", [
|
|
60
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
61
|
+
["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
|
|
62
|
+
]);
|
|
63
|
+
const tt = A("Calendar", [
|
|
64
|
+
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
65
|
+
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
66
|
+
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
67
|
+
["path", { d: "M3 10h18", key: "8toen8" }]
|
|
68
|
+
]);
|
|
69
|
+
const j = A("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
70
|
+
const K = A("ChevronDown", [
|
|
71
|
+
["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
|
|
72
|
+
]);
|
|
73
|
+
const _e = A("ChevronLeft", [
|
|
74
|
+
["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]
|
|
75
|
+
]);
|
|
76
|
+
const O = A("ChevronRight", [
|
|
77
|
+
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
|
78
|
+
]);
|
|
79
|
+
const ze = A("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
|
|
80
|
+
const be = A("CircleAlert", [
|
|
81
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
82
|
+
["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
|
|
83
|
+
["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
|
|
84
|
+
]);
|
|
85
|
+
const We = A("CircleCheck", [
|
|
86
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
87
|
+
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
88
|
+
]);
|
|
89
|
+
const Be = A("CircleX", [
|
|
90
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
91
|
+
["path", { d: "m15 9-6 6", key: "1uzhvr" }],
|
|
92
|
+
["path", { d: "m9 9 6 6", key: "z0biqf" }]
|
|
93
|
+
]);
|
|
94
|
+
const nt = A("Clock", [
|
|
95
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
96
|
+
["polyline", { points: "12 6 12 12 16 14", key: "68esgv" }]
|
|
97
|
+
]);
|
|
98
|
+
const ee = A("Copy", [
|
|
99
|
+
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
100
|
+
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
|
101
|
+
]);
|
|
102
|
+
const Le = A("Ellipsis", [
|
|
103
|
+
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
|
104
|
+
["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
|
|
105
|
+
["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
|
|
106
|
+
]);
|
|
107
|
+
const ve = A("FileCode", [
|
|
108
|
+
["path", { d: "M10 12.5 8 15l2 2.5", key: "1tg20x" }],
|
|
109
|
+
["path", { d: "m14 12.5 2 2.5-2 2.5", key: "yinavb" }],
|
|
110
|
+
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
111
|
+
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z", key: "1mlx9k" }]
|
|
112
|
+
]);
|
|
113
|
+
const at = A("File", [
|
|
114
|
+
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
115
|
+
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }]
|
|
116
|
+
]);
|
|
117
|
+
const rt = A("FolderOpen", [
|
|
118
|
+
[
|
|
119
|
+
"path",
|
|
120
|
+
{
|
|
121
|
+
d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
|
|
122
|
+
key: "usdka0"
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
]);
|
|
126
|
+
const lt = A("Folder", [
|
|
127
|
+
[
|
|
128
|
+
"path",
|
|
129
|
+
{
|
|
130
|
+
d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
|
|
131
|
+
key: "1kt360"
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
]);
|
|
135
|
+
const st = A("Frown", [
|
|
136
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
137
|
+
["path", { d: "M16 16s-1.5-2-4-2-4 2-4 2", key: "epbg0q" }],
|
|
138
|
+
["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
|
|
139
|
+
["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
|
|
140
|
+
]);
|
|
141
|
+
const ot = A("Heart", [
|
|
142
|
+
[
|
|
143
|
+
"path",
|
|
144
|
+
{
|
|
145
|
+
d: "M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",
|
|
146
|
+
key: "c3ymky"
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
]);
|
|
150
|
+
const re = A("Info", [
|
|
151
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
152
|
+
["path", { d: "M12 16v-4", key: "1dtifu" }],
|
|
153
|
+
["path", { d: "M12 8h.01", key: "e9boi3" }]
|
|
154
|
+
]);
|
|
155
|
+
const se = A("LoaderCircle", [
|
|
156
|
+
["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
|
|
157
|
+
]);
|
|
158
|
+
const it = A("Lock", [
|
|
159
|
+
["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
|
|
160
|
+
["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
|
|
161
|
+
]);
|
|
162
|
+
const ct = A("Meh", [
|
|
163
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
164
|
+
["line", { x1: "8", x2: "16", y1: "15", y2: "15", key: "1xb1d9" }],
|
|
165
|
+
["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
|
|
166
|
+
["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
|
|
167
|
+
]);
|
|
168
|
+
const dt = A("Monitor", [
|
|
169
|
+
["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
|
|
170
|
+
["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
|
|
171
|
+
["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
|
|
172
|
+
]);
|
|
173
|
+
const ut = A("Moon", [
|
|
174
|
+
["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z", key: "a7tn18" }]
|
|
175
|
+
]);
|
|
176
|
+
const mt = A("RotateCw", [
|
|
177
|
+
["path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8", key: "1p45f6" }],
|
|
178
|
+
["path", { d: "M21 3v5h-5", key: "1q7to0" }]
|
|
179
|
+
]);
|
|
180
|
+
const le = A("Search", [
|
|
181
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
182
|
+
["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
|
|
183
|
+
]);
|
|
184
|
+
const ht = A("ShieldCheck", [
|
|
185
|
+
[
|
|
186
|
+
"path",
|
|
187
|
+
{
|
|
188
|
+
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
|
189
|
+
key: "oel41y"
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
193
|
+
]);
|
|
194
|
+
const pt = A("Smile", [
|
|
195
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
196
|
+
["path", { d: "M8 14s1.5 2 4 2 4-2 4-2", key: "1y1vjs" }],
|
|
197
|
+
["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
|
|
198
|
+
["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
|
|
199
|
+
]);
|
|
200
|
+
const ft = A("Sun", [
|
|
201
|
+
["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
|
|
202
|
+
["path", { d: "M12 2v2", key: "tus03m" }],
|
|
203
|
+
["path", { d: "M12 20v2", key: "1lh1kg" }],
|
|
204
|
+
["path", { d: "m4.93 4.93 1.41 1.41", key: "149t6j" }],
|
|
205
|
+
["path", { d: "m17.66 17.66 1.41 1.41", key: "ptbguv" }],
|
|
206
|
+
["path", { d: "M2 12h2", key: "1t8f8n" }],
|
|
207
|
+
["path", { d: "M20 12h2", key: "1q8mjw" }],
|
|
208
|
+
["path", { d: "m6.34 17.66-1.41 1.41", key: "1m8zz5" }],
|
|
209
|
+
["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }]
|
|
210
|
+
]);
|
|
211
|
+
const oe = A("TriangleAlert", [
|
|
212
|
+
[
|
|
213
|
+
"path",
|
|
214
|
+
{
|
|
215
|
+
d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
|
|
216
|
+
key: "wmoenq"
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
["path", { d: "M12 9v4", key: "juzpu7" }],
|
|
220
|
+
["path", { d: "M12 17h.01", key: "p32p05" }]
|
|
221
|
+
]);
|
|
222
|
+
const q = A("X", [
|
|
223
|
+
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
224
|
+
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
225
|
+
]), _t = {
|
|
226
|
+
success: We,
|
|
227
|
+
warning: oe,
|
|
228
|
+
error: Be
|
|
229
|
+
}, Re = Ie(null);
|
|
230
|
+
function bt() {
|
|
231
|
+
const t = Se(Re);
|
|
232
|
+
if (!t)
|
|
233
|
+
throw new Error("useToast 必须在 ToastProvider 内使用");
|
|
234
|
+
return t;
|
|
235
|
+
}
|
|
236
|
+
function tn({ children: t }) {
|
|
237
|
+
const [n, r] = E([]), a = I(0), l = I(/* @__PURE__ */ new Map()), s = I(!1), o = I(null), [u, c] = E(!1), _ = J((y) => {
|
|
238
|
+
const k = l.current.get(y);
|
|
239
|
+
k && (window.clearTimeout(k.handle), l.current.delete(y)), r((f) => f.filter((N) => N.id !== y));
|
|
240
|
+
}, []), d = J(
|
|
241
|
+
({ tone: y = "default", title: k, description: f, actionLabel: N, preserve: v, duration: D = 4e3 }) => {
|
|
242
|
+
const C = a.current += 1;
|
|
243
|
+
if (r((h) => [...h, { id: C, tone: y, title: k, description: f, actionLabel: N, preserve: v }]), !v) {
|
|
244
|
+
const h = s.current ? 0 : window.setTimeout(() => _(C), D);
|
|
245
|
+
l.current.set(C, { remaining: D, start: Date.now(), handle: h });
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
[_]
|
|
249
|
+
);
|
|
250
|
+
function b() {
|
|
251
|
+
if (s.current) return;
|
|
252
|
+
s.current = !0;
|
|
253
|
+
const y = Date.now();
|
|
254
|
+
l.current.forEach((k) => {
|
|
255
|
+
window.clearTimeout(k.handle), k.remaining = Math.max(0, k.remaining - (y - k.start));
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function p() {
|
|
259
|
+
if (!s.current) return;
|
|
260
|
+
s.current = !1;
|
|
261
|
+
const y = Date.now();
|
|
262
|
+
l.current.forEach((k, f) => {
|
|
263
|
+
k.start = y, k.handle = window.setTimeout(() => _(f), k.remaining);
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
B(
|
|
267
|
+
() => () => {
|
|
268
|
+
l.current.forEach((y) => window.clearTimeout(y.handle));
|
|
269
|
+
},
|
|
270
|
+
[]
|
|
271
|
+
), G(() => {
|
|
272
|
+
const y = o.current;
|
|
273
|
+
if (!y) return;
|
|
274
|
+
const k = [...y.querySelectorAll(".toast")], f = 12, N = 14;
|
|
275
|
+
let v = 0, D = 0;
|
|
276
|
+
for (let x = k.length - 1; x >= 0; x -= 1) {
|
|
277
|
+
const g = k[x], w = k.length - 1 - x;
|
|
278
|
+
w === 0 && (D = g.offsetHeight), g.style.setProperty("--depth", String(w)), g.style.setProperty("--y", `${-v}px`), g.style.zIndex = String(100 + x), v += g.offsetHeight + f;
|
|
279
|
+
}
|
|
280
|
+
const C = D + Math.min(k.length - 1, 2) * N, h = k.length === 0 ? 0 : u ? Math.max(v - f, 0) : C;
|
|
281
|
+
y.style.setProperty("--toast-stack-h", `${h}px`);
|
|
282
|
+
}, [n, u]);
|
|
283
|
+
const m = fe(() => ({ push: d, dismiss: _ }), [d, _]);
|
|
284
|
+
return /* @__PURE__ */ i(Re.Provider, { value: m, children: [
|
|
285
|
+
t,
|
|
286
|
+
/* @__PURE__ */ e(
|
|
287
|
+
"div",
|
|
288
|
+
{
|
|
289
|
+
ref: o,
|
|
290
|
+
className: "toast-region",
|
|
291
|
+
role: "region",
|
|
292
|
+
"aria-live": "polite",
|
|
293
|
+
"aria-label": "通知",
|
|
294
|
+
"data-expanded": u,
|
|
295
|
+
onMouseEnter: () => {
|
|
296
|
+
c(!0), b();
|
|
297
|
+
},
|
|
298
|
+
onMouseLeave: () => {
|
|
299
|
+
c(!1), p();
|
|
300
|
+
},
|
|
301
|
+
onFocusCapture: () => {
|
|
302
|
+
c(!0), b();
|
|
303
|
+
},
|
|
304
|
+
onBlurCapture: (y) => {
|
|
305
|
+
y.currentTarget.contains(y.relatedTarget) || (c(!1), p());
|
|
306
|
+
},
|
|
307
|
+
children: n.map((y) => {
|
|
308
|
+
const k = y.tone === "default" ? null : _t[y.tone];
|
|
309
|
+
return /* @__PURE__ */ i("div", { className: `toast toast--${y.tone}`, "aria-atomic": "true", children: [
|
|
310
|
+
k ? /* @__PURE__ */ e(k, { className: "toast__icon", size: 16, strokeWidth: 2, "aria-hidden": "true" }) : null,
|
|
311
|
+
/* @__PURE__ */ i("div", { className: "toast__body", children: [
|
|
312
|
+
/* @__PURE__ */ e("p", { className: "toast__title", children: y.title }),
|
|
313
|
+
y.description ? /* @__PURE__ */ e("p", { className: "toast__description", children: y.description }) : null
|
|
314
|
+
] }),
|
|
315
|
+
y.actionLabel ? /* @__PURE__ */ e("button", { type: "button", className: "toast__action", onClick: () => _(y.id), children: y.actionLabel }) : null,
|
|
316
|
+
/* @__PURE__ */ e("button", { type: "button", className: "toast__close", "aria-label": "关闭", onClick: () => _(y.id), children: /* @__PURE__ */ e(q, { size: 16, strokeWidth: 2, "aria-hidden": "true" }) })
|
|
317
|
+
] }, y.id);
|
|
318
|
+
})
|
|
319
|
+
}
|
|
320
|
+
)
|
|
321
|
+
] });
|
|
322
|
+
}
|
|
323
|
+
function yt(t) {
|
|
324
|
+
const n = document.createElement("textarea");
|
|
325
|
+
n.value = t, n.setAttribute("readonly", ""), n.style.position = "fixed", n.style.top = "0", n.style.left = "0", n.style.width = "1px", n.style.height = "1px", n.style.opacity = "0";
|
|
326
|
+
try {
|
|
327
|
+
return document.body.append(n), n.focus(), n.select(), n.setSelectionRange(0, t.length), document.execCommand("copy");
|
|
328
|
+
} finally {
|
|
329
|
+
n.remove();
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
async function Fe(t) {
|
|
333
|
+
try {
|
|
334
|
+
await navigator.clipboard.writeText(t);
|
|
335
|
+
return;
|
|
336
|
+
} catch {
|
|
337
|
+
if (!yt(t))
|
|
338
|
+
throw new Error("clipboard write failed");
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function ie() {
|
|
342
|
+
const [t, n] = E(!1), r = I(void 0), { push: a } = bt(), l = J(
|
|
343
|
+
async (o, u = "已复制到剪贴板") => {
|
|
344
|
+
try {
|
|
345
|
+
await Fe(o), n(!0), r.current && clearTimeout(r.current), r.current = setTimeout(() => n(!1), 1500), a({ title: u });
|
|
346
|
+
} catch {
|
|
347
|
+
a({ tone: "error", title: "无法复制到剪贴板。请重试。" });
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
[a]
|
|
351
|
+
), s = J(() => {
|
|
352
|
+
r.current && clearTimeout(r.current), n(!1);
|
|
353
|
+
}, []);
|
|
354
|
+
return { copied: t, copy: l, reset: s };
|
|
355
|
+
}
|
|
356
|
+
function nn({
|
|
357
|
+
value: t,
|
|
358
|
+
label: n,
|
|
359
|
+
successMessage: r,
|
|
360
|
+
size: a = 16,
|
|
361
|
+
className: l
|
|
362
|
+
}) {
|
|
363
|
+
const { copied: s, copy: o } = ie();
|
|
364
|
+
return /* @__PURE__ */ e(
|
|
365
|
+
"button",
|
|
366
|
+
{
|
|
367
|
+
type: "button",
|
|
368
|
+
className: l ? `copy-button ${l}` : "copy-button",
|
|
369
|
+
"aria-label": n,
|
|
370
|
+
onClick: () => o(t, r),
|
|
371
|
+
children: s ? /* @__PURE__ */ e(j, { size: a, strokeWidth: 2, "aria-hidden": "true" }) : /* @__PURE__ */ e(ee, { size: a, strokeWidth: 2, "aria-hidden": "true" })
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
function gt({
|
|
376
|
+
className: t,
|
|
377
|
+
label: n,
|
|
378
|
+
onClick: r
|
|
379
|
+
}) {
|
|
380
|
+
return /* @__PURE__ */ e("button", { type: "button", className: t, "aria-label": n, onClick: r, children: /* @__PURE__ */ e(q, { size: 14, strokeWidth: 2, "aria-hidden": "true" }) });
|
|
381
|
+
}
|
|
382
|
+
function Nt({ variant: t, size: n, iconOnly: r, circle: a, rounded: l, loading: s, className: o }) {
|
|
383
|
+
return [
|
|
384
|
+
"button",
|
|
385
|
+
t ? `button--${t}` : "",
|
|
386
|
+
n && n !== "md" ? `button--${n}` : "",
|
|
387
|
+
r ? "button--icon" : "",
|
|
388
|
+
a ? "button--circle" : "",
|
|
389
|
+
// circle 与 rounded 互斥:circle 是圆形 icon-only、rounded 是药丸文字 CTA;同传时 circle 优先。
|
|
390
|
+
l && !a ? "button--rounded" : "",
|
|
391
|
+
s ? "button--loading" : "",
|
|
392
|
+
o
|
|
393
|
+
].filter(Boolean).join(" ");
|
|
394
|
+
}
|
|
395
|
+
function an(t) {
|
|
396
|
+
const {
|
|
397
|
+
loading: n,
|
|
398
|
+
disabled: r,
|
|
399
|
+
href: a,
|
|
400
|
+
type: l = "button",
|
|
401
|
+
shortcut: s,
|
|
402
|
+
children: o,
|
|
403
|
+
onClick: u,
|
|
404
|
+
ariaLabel: c,
|
|
405
|
+
ariaKeyshortcuts: _,
|
|
406
|
+
"aria-describedby": d,
|
|
407
|
+
onFocus: b,
|
|
408
|
+
onBlur: p,
|
|
409
|
+
onKeyDown: m
|
|
410
|
+
} = t, y = Nt(t), k = /* @__PURE__ */ i(F, { children: [
|
|
411
|
+
n ? /* @__PURE__ */ e(se, { className: "button__spinner", size: 14, strokeWidth: 1.8, "aria-hidden": "true" }) : null,
|
|
412
|
+
o,
|
|
413
|
+
s ? /* @__PURE__ */ e("kbd", { className: "button__shortcut", "aria-hidden": "true", children: s }) : null
|
|
414
|
+
] });
|
|
415
|
+
return a ? /* @__PURE__ */ e(
|
|
416
|
+
"a",
|
|
417
|
+
{
|
|
418
|
+
className: y,
|
|
419
|
+
href: r ? void 0 : a,
|
|
420
|
+
"aria-disabled": r || void 0,
|
|
421
|
+
tabIndex: r ? -1 : void 0,
|
|
422
|
+
"aria-label": c,
|
|
423
|
+
"aria-describedby": d,
|
|
424
|
+
onClick: r ? (f) => f.preventDefault() : u,
|
|
425
|
+
onFocus: b,
|
|
426
|
+
onBlur: p,
|
|
427
|
+
onKeyDown: m,
|
|
428
|
+
children: k
|
|
429
|
+
}
|
|
430
|
+
) : /* @__PURE__ */ e(
|
|
431
|
+
"button",
|
|
432
|
+
{
|
|
433
|
+
type: l,
|
|
434
|
+
className: y,
|
|
435
|
+
disabled: r,
|
|
436
|
+
"aria-busy": n || void 0,
|
|
437
|
+
"aria-label": c,
|
|
438
|
+
"aria-keyshortcuts": _,
|
|
439
|
+
"aria-describedby": d,
|
|
440
|
+
onClick: u,
|
|
441
|
+
onFocus: b,
|
|
442
|
+
onBlur: p,
|
|
443
|
+
onKeyDown: m,
|
|
444
|
+
children: k
|
|
445
|
+
}
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
function te(t, n) {
|
|
449
|
+
return `${t}-${n ? "message" : "description"}`;
|
|
450
|
+
}
|
|
451
|
+
function ye({
|
|
452
|
+
controlId: t,
|
|
453
|
+
label: n,
|
|
454
|
+
description: r,
|
|
455
|
+
error: a,
|
|
456
|
+
wide: l,
|
|
457
|
+
children: s
|
|
458
|
+
}) {
|
|
459
|
+
const o = ["form-field", l ? "form-field--wide" : "", a ? "form-field--error" : ""].filter(Boolean).join(" "), u = te(t, !!a);
|
|
460
|
+
return /* @__PURE__ */ i("label", { className: o, htmlFor: t, children: [
|
|
461
|
+
/* @__PURE__ */ e("span", { className: "form-field__label", children: n }),
|
|
462
|
+
s,
|
|
463
|
+
a ? /* @__PURE__ */ e("span", { className: "form-field__message", id: u, children: a }) : r ? /* @__PURE__ */ e("span", { className: "form-field__description", id: u, children: r }) : null
|
|
464
|
+
] });
|
|
465
|
+
}
|
|
466
|
+
function rn({
|
|
467
|
+
id: t,
|
|
468
|
+
label: n,
|
|
469
|
+
description: r,
|
|
470
|
+
error: a,
|
|
471
|
+
prefix: l,
|
|
472
|
+
suffix: s,
|
|
473
|
+
prefixStyling: o = !0,
|
|
474
|
+
suffixStyling: u = !0,
|
|
475
|
+
rounded: c,
|
|
476
|
+
wide: _,
|
|
477
|
+
size: d = "md",
|
|
478
|
+
className: b,
|
|
479
|
+
...p
|
|
480
|
+
}) {
|
|
481
|
+
const m = ["form-control", d !== "md" ? `form-control--${d}` : "", b ?? ""].filter(Boolean).join(" "), y = ["input-control", c ? "input-control--rounded" : ""].filter(Boolean).join(" "), k = /* @__PURE__ */ e(
|
|
482
|
+
"input",
|
|
483
|
+
{
|
|
484
|
+
id: t,
|
|
485
|
+
className: m,
|
|
486
|
+
"aria-describedby": r || a ? te(t, !!a) : void 0,
|
|
487
|
+
"aria-invalid": a ? !0 : void 0,
|
|
488
|
+
...p
|
|
489
|
+
}
|
|
490
|
+
);
|
|
491
|
+
return /* @__PURE__ */ e(ye, { controlId: t, label: n, description: r, error: a, wide: _, children: l || s || c ? /* @__PURE__ */ i("span", { className: y, children: [
|
|
492
|
+
l ? /* @__PURE__ */ e(
|
|
493
|
+
"span",
|
|
494
|
+
{
|
|
495
|
+
className: `input-control__prefix${o ? "" : " input-control__prefix--plain"}`,
|
|
496
|
+
"aria-hidden": "true",
|
|
497
|
+
children: l
|
|
498
|
+
}
|
|
499
|
+
) : null,
|
|
500
|
+
k,
|
|
501
|
+
s ? /* @__PURE__ */ e(
|
|
502
|
+
"span",
|
|
503
|
+
{
|
|
504
|
+
className: `input-control__suffix${u ? "" : " input-control__suffix--plain"}`,
|
|
505
|
+
"aria-hidden": "true",
|
|
506
|
+
children: s
|
|
507
|
+
}
|
|
508
|
+
) : null
|
|
509
|
+
] }) : k });
|
|
510
|
+
}
|
|
511
|
+
function Ke(t = "", n) {
|
|
512
|
+
const [r, a] = E(t), l = I(null), s = () => {
|
|
513
|
+
a(""), l.current?.focus(), n?.();
|
|
514
|
+
};
|
|
515
|
+
return { value: r, setValue: a, inputRef: l, clear: s, onKeyDown: (u) => {
|
|
516
|
+
u.nativeEvent.isComposing || u.key === "Escape" && r && (u.preventDefault(), s());
|
|
517
|
+
} };
|
|
518
|
+
}
|
|
519
|
+
function ln({
|
|
520
|
+
id: t,
|
|
521
|
+
placeholder: n,
|
|
522
|
+
defaultValue: r = "",
|
|
523
|
+
disabled: a,
|
|
524
|
+
kbdHint: l,
|
|
525
|
+
onClear: s,
|
|
526
|
+
ariaLabel: o
|
|
527
|
+
}) {
|
|
528
|
+
const { value: u, setValue: c, inputRef: _, clear: d, onKeyDown: b } = Ke(r, s);
|
|
529
|
+
return /* @__PURE__ */ i("div", { className: "clearable", children: [
|
|
530
|
+
/* @__PURE__ */ e(
|
|
531
|
+
"input",
|
|
532
|
+
{
|
|
533
|
+
id: t,
|
|
534
|
+
ref: _,
|
|
535
|
+
className: "form-control clearable__input",
|
|
536
|
+
type: "text",
|
|
537
|
+
placeholder: n,
|
|
538
|
+
"aria-label": o,
|
|
539
|
+
value: u,
|
|
540
|
+
disabled: a,
|
|
541
|
+
onChange: (p) => c(p.target.value),
|
|
542
|
+
onKeyDown: b
|
|
543
|
+
}
|
|
544
|
+
),
|
|
545
|
+
u && !a ? /* @__PURE__ */ e(gt, { className: "clearable__clear", label: "清除", onClick: d }) : l ? /* @__PURE__ */ i("span", { className: "clearable__hint", "aria-hidden": "true", children: [
|
|
546
|
+
/* @__PURE__ */ e("kbd", { className: "kbd kbd--small", children: "Esc" }),
|
|
547
|
+
/* @__PURE__ */ e("kbd", { className: "kbd kbd--small", children: "⌘K" })
|
|
548
|
+
] }) : null
|
|
549
|
+
] });
|
|
550
|
+
}
|
|
551
|
+
function sn({
|
|
552
|
+
id: t,
|
|
553
|
+
ariaLabel: n,
|
|
554
|
+
placeholder: r,
|
|
555
|
+
defaultValue: a = "",
|
|
556
|
+
disabled: l,
|
|
557
|
+
loading: s,
|
|
558
|
+
kbdHint: o,
|
|
559
|
+
icon: u
|
|
560
|
+
}) {
|
|
561
|
+
const { value: c, setValue: _, inputRef: d, clear: b, onKeyDown: p } = Ke(a);
|
|
562
|
+
return /* @__PURE__ */ i("div", { className: "search-input", "aria-busy": s || void 0, children: [
|
|
563
|
+
/* @__PURE__ */ e("span", { className: "search-input__icon", "aria-hidden": "true", children: s ? /* @__PURE__ */ e(se, { className: "search-input__spinner", size: 16, strokeWidth: 2 }) : u ?? /* @__PURE__ */ e(le, { size: 16, strokeWidth: 2 }) }),
|
|
564
|
+
/* @__PURE__ */ e(
|
|
565
|
+
"input",
|
|
566
|
+
{
|
|
567
|
+
id: t,
|
|
568
|
+
ref: d,
|
|
569
|
+
className: "form-control search-input__field",
|
|
570
|
+
type: "search",
|
|
571
|
+
"aria-label": n,
|
|
572
|
+
autoComplete: "off",
|
|
573
|
+
spellCheck: !1,
|
|
574
|
+
placeholder: r,
|
|
575
|
+
value: c,
|
|
576
|
+
disabled: l,
|
|
577
|
+
onChange: (m) => _(m.target.value),
|
|
578
|
+
onKeyDown: p
|
|
579
|
+
}
|
|
580
|
+
),
|
|
581
|
+
s ? /* @__PURE__ */ e("span", { className: "sr-only", children: "加载中…" }) : null,
|
|
582
|
+
c && !l ? /* @__PURE__ */ e("button", { type: "button", className: "search-input__esc", "aria-label": "清除搜索", onClick: b, children: /* @__PURE__ */ e("kbd", { className: "kbd kbd--small", "aria-hidden": "true", children: "Esc" }) }) : o && !l ? /* @__PURE__ */ i("span", { className: "search-input__hint", "aria-hidden": "true", children: [
|
|
583
|
+
/* @__PURE__ */ e("kbd", { className: "kbd kbd--small", children: "⌘" }),
|
|
584
|
+
/* @__PURE__ */ e("kbd", { className: "kbd kbd--small", children: "K" })
|
|
585
|
+
] }) : null
|
|
586
|
+
] });
|
|
587
|
+
}
|
|
588
|
+
function on({
|
|
589
|
+
id: t,
|
|
590
|
+
label: n,
|
|
591
|
+
description: r,
|
|
592
|
+
error: a,
|
|
593
|
+
wide: l,
|
|
594
|
+
size: s = "md",
|
|
595
|
+
className: o,
|
|
596
|
+
...u
|
|
597
|
+
}) {
|
|
598
|
+
const c = [
|
|
599
|
+
"form-control",
|
|
600
|
+
"form-control--textarea",
|
|
601
|
+
s !== "md" ? `form-control--${s}` : "",
|
|
602
|
+
o ?? ""
|
|
603
|
+
].filter(Boolean).join(" ");
|
|
604
|
+
return /* @__PURE__ */ e(ye, { controlId: t, label: n, description: r, error: a, wide: l, children: /* @__PURE__ */ e(
|
|
605
|
+
"textarea",
|
|
606
|
+
{
|
|
607
|
+
id: t,
|
|
608
|
+
className: c,
|
|
609
|
+
"aria-describedby": r || a ? te(t, !!a) : void 0,
|
|
610
|
+
"aria-invalid": a ? !0 : void 0,
|
|
611
|
+
...u
|
|
612
|
+
}
|
|
613
|
+
) });
|
|
614
|
+
}
|
|
615
|
+
function cn({
|
|
616
|
+
id: t,
|
|
617
|
+
label: n,
|
|
618
|
+
description: r,
|
|
619
|
+
error: a,
|
|
620
|
+
wide: l,
|
|
621
|
+
size: s = "md",
|
|
622
|
+
prefix: o,
|
|
623
|
+
suffix: u,
|
|
624
|
+
className: c,
|
|
625
|
+
children: _,
|
|
626
|
+
...d
|
|
627
|
+
}) {
|
|
628
|
+
const b = [
|
|
629
|
+
"form-control",
|
|
630
|
+
"form-control--select",
|
|
631
|
+
s !== "md" ? `form-control--${s}` : "",
|
|
632
|
+
c ?? ""
|
|
633
|
+
].filter(Boolean).join(" "), p = [
|
|
634
|
+
"select-control",
|
|
635
|
+
o ? "select-control--prefixed" : "",
|
|
636
|
+
u ? "select-control--suffixed" : ""
|
|
637
|
+
].filter(Boolean).join(" ");
|
|
638
|
+
return /* @__PURE__ */ e(ye, { controlId: t, label: n, description: r, error: a, wide: l, children: /* @__PURE__ */ i("span", { className: p, children: [
|
|
639
|
+
o ? /* @__PURE__ */ e("span", { className: "select-control__prefix", "aria-hidden": "true", children: o }) : null,
|
|
640
|
+
/* @__PURE__ */ e(
|
|
641
|
+
"select",
|
|
642
|
+
{
|
|
643
|
+
id: t,
|
|
644
|
+
className: b,
|
|
645
|
+
"aria-describedby": r || a ? te(t, !!a) : void 0,
|
|
646
|
+
"aria-invalid": a ? !0 : void 0,
|
|
647
|
+
...d,
|
|
648
|
+
children: _
|
|
649
|
+
}
|
|
650
|
+
),
|
|
651
|
+
u ? /* @__PURE__ */ e("span", { className: "select-control__suffix", "aria-hidden": "true", children: u }) : null,
|
|
652
|
+
/* @__PURE__ */ e("span", { className: "select-control__chevron", "aria-hidden": "true", children: /* @__PURE__ */ e(K, { size: s === "xs" ? 12 : 16, strokeWidth: 1.8 }) })
|
|
653
|
+
] }) });
|
|
654
|
+
}
|
|
655
|
+
function Pe({
|
|
656
|
+
id: t,
|
|
657
|
+
label: n,
|
|
658
|
+
description: r,
|
|
659
|
+
error: a,
|
|
660
|
+
indeterminate: l,
|
|
661
|
+
type: s,
|
|
662
|
+
...o
|
|
663
|
+
}) {
|
|
664
|
+
const u = s === "radio", c = !u && (r || a) ? te(t, !!a) : void 0, _ = u ? "control-option__visual control-option__visual--radio" : "control-option__visual", d = I(null);
|
|
665
|
+
return B(() => {
|
|
666
|
+
d.current && (d.current.indeterminate = !u && !!l);
|
|
667
|
+
}, [l, u]), /* @__PURE__ */ i("label", { className: a ? "control-option control-option--error" : "control-option", htmlFor: t, children: [
|
|
668
|
+
/* @__PURE__ */ e("input", { ref: d, id: t, type: s, "aria-describedby": c, "aria-invalid": a ? !0 : void 0, ...o }),
|
|
669
|
+
/* @__PURE__ */ e("span", { className: _, "aria-hidden": "true" }),
|
|
670
|
+
/* @__PURE__ */ i("span", { className: "control-option__body", children: [
|
|
671
|
+
/* @__PURE__ */ e("span", { className: "control-option__label", children: n }),
|
|
672
|
+
a ? /* @__PURE__ */ e("span", { className: "control-option__message", id: c, children: a }) : r ? /* @__PURE__ */ e("span", { className: "control-option__description", id: c, children: r }) : null
|
|
673
|
+
] })
|
|
674
|
+
] });
|
|
675
|
+
}
|
|
676
|
+
function dn(t) {
|
|
677
|
+
return /* @__PURE__ */ e(Pe, { type: "checkbox", ...t });
|
|
678
|
+
}
|
|
679
|
+
function un(t) {
|
|
680
|
+
return /* @__PURE__ */ e(Pe, { type: "radio", ...t });
|
|
681
|
+
}
|
|
682
|
+
function mn({ type: t, label: n, description: r, extra: a, className: l, ...s }) {
|
|
683
|
+
return /* @__PURE__ */ i("label", { className: ["choicebox", `choicebox--${t}`, l].filter(Boolean).join(" "), children: [
|
|
684
|
+
/* @__PURE__ */ e("input", { type: t, className: "choicebox__input", ...s }),
|
|
685
|
+
/* @__PURE__ */ i("span", { className: "choicebox__body", children: [
|
|
686
|
+
/* @__PURE__ */ e("span", { className: "choicebox__title", children: n }),
|
|
687
|
+
r ? /* @__PURE__ */ e("span", { className: "choicebox__description", children: r }) : null,
|
|
688
|
+
a ? /* @__PURE__ */ e("span", { className: "choicebox__extra", children: a }) : null
|
|
689
|
+
] }),
|
|
690
|
+
/* @__PURE__ */ e("span", { className: "choicebox__indicator", "aria-hidden": "true", children: t === "checkbox" ? /* @__PURE__ */ e(j, { className: "choicebox__check", size: 12, strokeWidth: 3 }) : null })
|
|
691
|
+
] });
|
|
692
|
+
}
|
|
693
|
+
function hn({
|
|
694
|
+
options: t,
|
|
695
|
+
placeholder: n,
|
|
696
|
+
emptyLabel: r = "选项",
|
|
697
|
+
size: a = "md",
|
|
698
|
+
disabled: l,
|
|
699
|
+
error: s,
|
|
700
|
+
clearable: o,
|
|
701
|
+
inputId: u
|
|
702
|
+
}) {
|
|
703
|
+
const [c, _] = E(""), [d, b] = E(!1), [p, m] = E(!1), [y, k] = E(0), f = I(null), N = I(null), v = W(), D = `${v}-list`, C = `${v}-err`, h = d ? t : t.filter(($) => $.value.toLowerCase().includes(c.toLowerCase())), x = p && h[y] ? `${v}-opt-${y}` : void 0;
|
|
704
|
+
B(() => {
|
|
705
|
+
if (!p) return;
|
|
706
|
+
function $(T) {
|
|
707
|
+
f.current && !f.current.contains(T.target) && m(!1);
|
|
708
|
+
}
|
|
709
|
+
return document.addEventListener("mousedown", $), () => document.removeEventListener("mousedown", $);
|
|
710
|
+
}, [p]);
|
|
711
|
+
function g($) {
|
|
712
|
+
_($.value), b(!0), m(!1);
|
|
713
|
+
}
|
|
714
|
+
function w() {
|
|
715
|
+
_(""), b(!1), m(!1), N.current?.focus();
|
|
716
|
+
}
|
|
717
|
+
function M($) {
|
|
718
|
+
$.nativeEvent.isComposing || ($.key === "ArrowDown" ? ($.preventDefault(), p ? k((T) => Math.max(Math.min(T + 1, h.length - 1), 0)) : m(!0)) : $.key === "ArrowUp" ? ($.preventDefault(), k((T) => Math.max(T - 1, 0))) : $.key === "Home" && p ? ($.preventDefault(), k(0)) : $.key === "End" && p ? ($.preventDefault(), k(Math.max(h.length - 1, 0))) : $.key === "Enter" && p && h[y] ? ($.preventDefault(), g(h[y])) : $.key === "Escape" && (p ? ($.preventDefault(), m(!1)) : o && c && w()));
|
|
719
|
+
}
|
|
720
|
+
const S = [
|
|
721
|
+
"combobox",
|
|
722
|
+
a !== "md" ? `combobox--${a}` : "",
|
|
723
|
+
s ? "combobox--error" : "",
|
|
724
|
+
l ? "combobox--disabled" : ""
|
|
725
|
+
].filter(Boolean).join(" ");
|
|
726
|
+
return /* @__PURE__ */ i("div", { className: S, ref: f, children: [
|
|
727
|
+
/* @__PURE__ */ i("div", { className: "combobox__control", children: [
|
|
728
|
+
/* @__PURE__ */ e(le, { className: "combobox__leading", size: 16, strokeWidth: 2, "aria-hidden": "true" }),
|
|
729
|
+
/* @__PURE__ */ e(
|
|
730
|
+
"input",
|
|
731
|
+
{
|
|
732
|
+
ref: N,
|
|
733
|
+
id: u,
|
|
734
|
+
type: "text",
|
|
735
|
+
role: "combobox",
|
|
736
|
+
className: "combobox__input",
|
|
737
|
+
placeholder: n,
|
|
738
|
+
value: c,
|
|
739
|
+
disabled: l,
|
|
740
|
+
"aria-expanded": p,
|
|
741
|
+
"aria-controls": D,
|
|
742
|
+
"aria-autocomplete": "list",
|
|
743
|
+
"aria-activedescendant": x,
|
|
744
|
+
"aria-invalid": s ? !0 : void 0,
|
|
745
|
+
"aria-describedby": s ? C : void 0,
|
|
746
|
+
onChange: ($) => {
|
|
747
|
+
_($.target.value), b(!1), m(!0), k(0);
|
|
748
|
+
},
|
|
749
|
+
onFocus: () => !l && m(!0),
|
|
750
|
+
onMouseDown: () => !l && m(!0),
|
|
751
|
+
onKeyDown: M
|
|
752
|
+
}
|
|
753
|
+
),
|
|
754
|
+
o && c && !l ? /* @__PURE__ */ e("button", { type: "button", className: "combobox__clear", "aria-label": "清除选择", onClick: w, children: /* @__PURE__ */ e(q, { size: 14, strokeWidth: 2, "aria-hidden": "true" }) }) : null
|
|
755
|
+
] }),
|
|
756
|
+
p ? /* @__PURE__ */ e("ul", { className: "combobox__listbox", id: D, role: "listbox", "aria-label": n, children: h.length === 0 ? /* @__PURE__ */ e("li", { className: "combobox__empty", role: "presentation", children: `没有匹配「${c}」的${r}` }) : h.map(($, T) => /* @__PURE__ */ i(
|
|
757
|
+
"li",
|
|
758
|
+
{
|
|
759
|
+
id: `${v}-opt-${T}`,
|
|
760
|
+
role: "option",
|
|
761
|
+
"aria-selected": d && c === $.value,
|
|
762
|
+
className: `combobox__option${T === y ? " combobox__option--active" : ""}`,
|
|
763
|
+
onMouseEnter: () => k(T),
|
|
764
|
+
onMouseDown: (L) => {
|
|
765
|
+
L.preventDefault(), g($);
|
|
766
|
+
},
|
|
767
|
+
children: [
|
|
768
|
+
$.prefix ? /* @__PURE__ */ e("span", { className: "combobox__option-prefix", "aria-hidden": "true", children: $.prefix }) : null,
|
|
769
|
+
/* @__PURE__ */ e("span", { className: "combobox__option-label", children: $.value }),
|
|
770
|
+
$.suffix ? /* @__PURE__ */ e("span", { className: "combobox__option-suffix", "aria-hidden": "true", children: $.suffix }) : null
|
|
771
|
+
]
|
|
772
|
+
},
|
|
773
|
+
$.value
|
|
774
|
+
)) }) : null,
|
|
775
|
+
s ? /* @__PURE__ */ e("p", { className: "combobox__error-text", id: C, children: s }) : null
|
|
776
|
+
] });
|
|
777
|
+
}
|
|
778
|
+
function pn({
|
|
779
|
+
options: t,
|
|
780
|
+
ariaLabel: n,
|
|
781
|
+
name: r,
|
|
782
|
+
defaultValue: a,
|
|
783
|
+
onChange: l,
|
|
784
|
+
size: s = "md",
|
|
785
|
+
fullWidth: o = !1,
|
|
786
|
+
iconOnly: u = !1
|
|
787
|
+
}) {
|
|
788
|
+
const c = W();
|
|
789
|
+
if (t.length === 0) return null;
|
|
790
|
+
const _ = r ?? c, d = t.find((p) => p.value === a && !p.disabled) ?? t.find((p) => !p.disabled) ?? t[0], b = [
|
|
791
|
+
"switch-control",
|
|
792
|
+
`switch-control--${s}`,
|
|
793
|
+
o ? "switch-control--full" : ""
|
|
794
|
+
].filter(Boolean).join(" ");
|
|
795
|
+
return /* @__PURE__ */ e("div", { className: b, role: "radiogroup", "aria-label": n, children: t.map((p) => /* @__PURE__ */ i("label", { className: "switch-control__option", title: p.tooltip, children: [
|
|
796
|
+
/* @__PURE__ */ e(
|
|
797
|
+
"input",
|
|
798
|
+
{
|
|
799
|
+
type: "radio",
|
|
800
|
+
className: "sr-only",
|
|
801
|
+
name: _,
|
|
802
|
+
value: p.value,
|
|
803
|
+
defaultChecked: p.value === d.value,
|
|
804
|
+
disabled: p.disabled,
|
|
805
|
+
onChange: () => l?.(p.value)
|
|
806
|
+
}
|
|
807
|
+
),
|
|
808
|
+
p.icon ? /* @__PURE__ */ e("span", { className: "switch-control__icon", "aria-hidden": "true", children: p.icon }) : null,
|
|
809
|
+
/* @__PURE__ */ e("span", { className: u ? "sr-only" : void 0, children: p.label })
|
|
810
|
+
] }, p.value)) });
|
|
811
|
+
}
|
|
812
|
+
function fn({
|
|
813
|
+
defaultOn: t = !1,
|
|
814
|
+
disabled: n,
|
|
815
|
+
size: r = "md",
|
|
816
|
+
onColor: a,
|
|
817
|
+
label: l,
|
|
818
|
+
description: s,
|
|
819
|
+
labelSide: o = "right",
|
|
820
|
+
ariaLabel: u
|
|
821
|
+
}) {
|
|
822
|
+
const [c, _] = E(t), d = W(), b = W(), p = a ? { "--toggle-on": a } : void 0;
|
|
823
|
+
return /* @__PURE__ */ i(
|
|
824
|
+
"button",
|
|
825
|
+
{
|
|
826
|
+
type: "button",
|
|
827
|
+
role: "switch",
|
|
828
|
+
"aria-checked": c,
|
|
829
|
+
"aria-label": l ? void 0 : u,
|
|
830
|
+
"aria-labelledby": l ? d : void 0,
|
|
831
|
+
"aria-describedby": l && s ? b : void 0,
|
|
832
|
+
disabled: n,
|
|
833
|
+
className: `toggle-field toggle-field--${o}`,
|
|
834
|
+
onClick: () => _((m) => !m),
|
|
835
|
+
children: [
|
|
836
|
+
l ? /* @__PURE__ */ i("span", { className: "toggle-field__text", children: [
|
|
837
|
+
/* @__PURE__ */ e("span", { className: "toggle-field__label", id: d, children: l }),
|
|
838
|
+
s ? /* @__PURE__ */ e("span", { className: "toggle-field__description", id: b, children: s }) : null
|
|
839
|
+
] }) : null,
|
|
840
|
+
/* @__PURE__ */ e("span", { className: `toggle toggle--${r}`, style: p, "aria-hidden": "true", children: /* @__PURE__ */ e("span", { className: "toggle__thumb" }) })
|
|
841
|
+
]
|
|
842
|
+
}
|
|
843
|
+
);
|
|
844
|
+
}
|
|
845
|
+
function je({ tokens: t }) {
|
|
846
|
+
return /* @__PURE__ */ e(F, { children: t.map(
|
|
847
|
+
(n, r) => n.type ? /* @__PURE__ */ e("span", { className: `tok-${n.type}`, children: n.text }, r) : /* @__PURE__ */ e("span", { children: n.text }, r)
|
|
848
|
+
) });
|
|
849
|
+
}
|
|
850
|
+
function _n({ lines: t, ariaLabel: n }) {
|
|
851
|
+
return /* @__PURE__ */ e("pre", { className: "code-block", "aria-label": n, children: /* @__PURE__ */ e("code", { children: t.map((r, a) => /* @__PURE__ */ e("span", { className: "code-line", children: /* @__PURE__ */ e(je, { tokens: r }) }, a)) }) });
|
|
852
|
+
}
|
|
853
|
+
function bn({ children: t }) {
|
|
854
|
+
return /* @__PURE__ */ e("code", { className: "code-inline", children: t });
|
|
855
|
+
}
|
|
856
|
+
function yn(t) {
|
|
857
|
+
const { lineNumbers: n = !0 } = t, { copied: r, copy: a, reset: l } = ie(), [s, o] = E(0), u = t.tabs ? t.tabs[s] ?? t.tabs[0] : void 0, c = u ? u.lines : t.lines ?? [], _ = u ? u.filename : t.filename, d = c.map((p) => p.tokens.map((m) => m.text).join("")).join(`
|
|
858
|
+
`);
|
|
859
|
+
let b = 0;
|
|
860
|
+
return /* @__PURE__ */ i("div", { className: "codeblock", children: [
|
|
861
|
+
/* @__PURE__ */ i("header", { className: "codeblock__header", children: [
|
|
862
|
+
t.tabs ? /* @__PURE__ */ e("span", { className: "codeblock__tabs", children: t.tabs.map((p, m) => /* @__PURE__ */ e(
|
|
863
|
+
"button",
|
|
864
|
+
{
|
|
865
|
+
type: "button",
|
|
866
|
+
className: `codeblock__tab${m === s ? " codeblock__tab--active" : ""}`,
|
|
867
|
+
"aria-pressed": m === s,
|
|
868
|
+
"aria-label": `切换到 ${p.label} 示例`,
|
|
869
|
+
onClick: () => {
|
|
870
|
+
o(m), l();
|
|
871
|
+
},
|
|
872
|
+
children: p.label
|
|
873
|
+
},
|
|
874
|
+
p.label
|
|
875
|
+
)) }) : _ ? /* @__PURE__ */ i("span", { className: "codeblock__filename", children: [
|
|
876
|
+
/* @__PURE__ */ e(ve, { size: 14, strokeWidth: 2, "aria-hidden": "true" }),
|
|
877
|
+
_
|
|
878
|
+
] }) : /* @__PURE__ */ e("span", {}),
|
|
879
|
+
/* @__PURE__ */ e(
|
|
880
|
+
"button",
|
|
881
|
+
{
|
|
882
|
+
type: "button",
|
|
883
|
+
className: "codeblock__copy",
|
|
884
|
+
"aria-label": "复制代码",
|
|
885
|
+
onClick: () => a(d, "已复制代码"),
|
|
886
|
+
children: r ? /* @__PURE__ */ e(j, { size: 14, strokeWidth: 2, "aria-hidden": "true" }) : /* @__PURE__ */ e(ee, { size: 14, strokeWidth: 2, "aria-hidden": "true" })
|
|
887
|
+
}
|
|
888
|
+
)
|
|
889
|
+
] }),
|
|
890
|
+
u?.filename ? /* @__PURE__ */ i("div", { className: "codeblock__tabfile", children: [
|
|
891
|
+
/* @__PURE__ */ e(ve, { size: 14, strokeWidth: 2, "aria-hidden": "true" }),
|
|
892
|
+
u.filename
|
|
893
|
+
] }) : null,
|
|
894
|
+
/* @__PURE__ */ e("pre", { className: "codeblock__pre", children: /* @__PURE__ */ e("code", { children: c.map((p, m) => {
|
|
895
|
+
p.state !== "removed" && (b += 1);
|
|
896
|
+
const y = p.state === "added" ? "+" : p.state === "removed" ? "-" : b;
|
|
897
|
+
return /* @__PURE__ */ i(
|
|
898
|
+
"span",
|
|
899
|
+
{
|
|
900
|
+
className: `codeblock__line${p.state ? ` codeblock__line--${p.state}` : ""}`,
|
|
901
|
+
children: [
|
|
902
|
+
n ? /* @__PURE__ */ e("span", { className: "codeblock__ln", "aria-hidden": "true", children: y }) : null,
|
|
903
|
+
/* @__PURE__ */ e("span", { className: "codeblock__code", children: /* @__PURE__ */ e(je, { tokens: p.tokens }) })
|
|
904
|
+
]
|
|
905
|
+
},
|
|
906
|
+
m
|
|
907
|
+
);
|
|
908
|
+
}) }) })
|
|
909
|
+
] });
|
|
910
|
+
}
|
|
911
|
+
function gn({
|
|
912
|
+
tabs: t,
|
|
913
|
+
ariaLabel: n,
|
|
914
|
+
variant: r = "default"
|
|
915
|
+
}) {
|
|
916
|
+
const a = W(), l = t.find((d) => !d.disabled), [s, o] = E(l?.id ?? ""), u = t.find((d) => d.id === s), c = I(/* @__PURE__ */ new Map());
|
|
917
|
+
function _(d) {
|
|
918
|
+
const b = t.filter((y) => !y.disabled);
|
|
919
|
+
if (b.length === 0) return;
|
|
920
|
+
const p = b.findIndex((y) => y.id === s);
|
|
921
|
+
let m;
|
|
922
|
+
switch (d.key) {
|
|
923
|
+
case "ArrowRight":
|
|
924
|
+
case "ArrowDown":
|
|
925
|
+
m = b[(p + 1) % b.length];
|
|
926
|
+
break;
|
|
927
|
+
case "ArrowLeft":
|
|
928
|
+
case "ArrowUp":
|
|
929
|
+
m = b[(p - 1 + b.length) % b.length];
|
|
930
|
+
break;
|
|
931
|
+
case "Home":
|
|
932
|
+
m = b[0];
|
|
933
|
+
break;
|
|
934
|
+
case "End":
|
|
935
|
+
m = b[b.length - 1];
|
|
936
|
+
break;
|
|
937
|
+
default:
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
d.preventDefault(), m && (o(m.id), c.current.get(m.id)?.focus());
|
|
941
|
+
}
|
|
942
|
+
return t.length === 0 ? null : /* @__PURE__ */ i("div", { className: "tabs-specimen", children: [
|
|
943
|
+
/* @__PURE__ */ e(
|
|
944
|
+
"div",
|
|
945
|
+
{
|
|
946
|
+
className: r === "secondary" ? "tabs-control tabs-control--secondary" : "tabs-control",
|
|
947
|
+
role: "tablist",
|
|
948
|
+
"aria-label": n,
|
|
949
|
+
"aria-orientation": "horizontal",
|
|
950
|
+
onKeyDown: _,
|
|
951
|
+
children: t.map((d) => {
|
|
952
|
+
const b = d.tooltip ? `${a}-tab-${d.id}-tooltip` : void 0, p = /* @__PURE__ */ i(
|
|
953
|
+
"button",
|
|
954
|
+
{
|
|
955
|
+
"aria-controls": `${a}-panel-${d.id}`,
|
|
956
|
+
"aria-describedby": b,
|
|
957
|
+
"aria-selected": d.id === s,
|
|
958
|
+
className: "tabs-control__tab",
|
|
959
|
+
disabled: d.disabled,
|
|
960
|
+
id: `${a}-tab-${d.id}`,
|
|
961
|
+
onClick: () => o(d.id),
|
|
962
|
+
ref: (m) => {
|
|
963
|
+
m ? c.current.set(d.id, m) : c.current.delete(d.id);
|
|
964
|
+
},
|
|
965
|
+
role: "tab",
|
|
966
|
+
tabIndex: d.id === s && !d.disabled ? 0 : -1,
|
|
967
|
+
type: "button",
|
|
968
|
+
children: [
|
|
969
|
+
d.icon ? /* @__PURE__ */ e("span", { className: "tabs-control__tab-icon", "aria-hidden": "true", children: d.icon }) : null,
|
|
970
|
+
d.label
|
|
971
|
+
]
|
|
972
|
+
},
|
|
973
|
+
d.id
|
|
974
|
+
);
|
|
975
|
+
return d.tooltip ? /* @__PURE__ */ i("span", { className: "tabs-control__tab-wrapper", title: d.tooltip, children: [
|
|
976
|
+
p,
|
|
977
|
+
/* @__PURE__ */ e("span", { id: b, className: "sr-only", children: d.tooltip })
|
|
978
|
+
] }, d.id) : p;
|
|
979
|
+
})
|
|
980
|
+
}
|
|
981
|
+
),
|
|
982
|
+
u ? /* @__PURE__ */ e(
|
|
983
|
+
"div",
|
|
984
|
+
{
|
|
985
|
+
"aria-labelledby": `${a}-tab-${u.id}`,
|
|
986
|
+
className: "tabs-control__panel",
|
|
987
|
+
id: `${a}-panel-${u.id}`,
|
|
988
|
+
role: "tabpanel",
|
|
989
|
+
children: u.content
|
|
990
|
+
}
|
|
991
|
+
) : null
|
|
992
|
+
] });
|
|
993
|
+
}
|
|
994
|
+
const Oe = Ie(null);
|
|
995
|
+
function Nn({ multiple: t, children: n }) {
|
|
996
|
+
const [r, a] = E(null);
|
|
997
|
+
return /* @__PURE__ */ e("div", { className: "collapse-group", children: /* @__PURE__ */ e(Oe.Provider, { value: t ? null : { openId: r, setOpenId: a }, children: n }) });
|
|
998
|
+
}
|
|
999
|
+
function kn({
|
|
1000
|
+
title: t,
|
|
1001
|
+
defaultOpen: n,
|
|
1002
|
+
small: r,
|
|
1003
|
+
children: a
|
|
1004
|
+
}) {
|
|
1005
|
+
const l = Se(Oe), s = W(), [o, u] = E(n ?? !1);
|
|
1006
|
+
G(() => {
|
|
1007
|
+
l && n && l.setOpenId(s);
|
|
1008
|
+
}, []);
|
|
1009
|
+
const c = l ? l.openId === s : o;
|
|
1010
|
+
return /* @__PURE__ */ i("div", { className: `collapse${r ? " collapse--small" : ""}`, children: [
|
|
1011
|
+
/* @__PURE__ */ i(
|
|
1012
|
+
"button",
|
|
1013
|
+
{
|
|
1014
|
+
type: "button",
|
|
1015
|
+
className: "collapse__trigger",
|
|
1016
|
+
"aria-expanded": c,
|
|
1017
|
+
"aria-controls": s,
|
|
1018
|
+
onClick: () => {
|
|
1019
|
+
l ? l.setOpenId(c ? null : s) : u((d) => !d);
|
|
1020
|
+
},
|
|
1021
|
+
children: [
|
|
1022
|
+
/* @__PURE__ */ e("span", { className: "collapse__title", children: t }),
|
|
1023
|
+
/* @__PURE__ */ e(O, { className: "collapse__chevron", size: 16, strokeWidth: 2, "aria-hidden": "true" })
|
|
1024
|
+
]
|
|
1025
|
+
}
|
|
1026
|
+
),
|
|
1027
|
+
/* @__PURE__ */ e("div", { className: `collapse__panel${c ? " collapse__panel--open" : ""}`, id: s, children: /* @__PURE__ */ e("div", { className: "collapse__content", children: a }) })
|
|
1028
|
+
] });
|
|
1029
|
+
}
|
|
1030
|
+
function wn({ sections: t, triggerLabel: n = "打开命令面板", hotkey: r }) {
|
|
1031
|
+
const [a, l] = E(!1), [s, o] = E(""), [u, c] = E(0), _ = I(null), d = I(null), b = I(null), p = I(null), m = fe(() => {
|
|
1032
|
+
const f = s.trim().toLowerCase();
|
|
1033
|
+
let N = 0;
|
|
1034
|
+
return t.map((v) => ({
|
|
1035
|
+
heading: v.heading,
|
|
1036
|
+
items: v.items.filter((D) => f.length === 0 || D.label.toLowerCase().includes(f)).map((D) => ({ item: D, flatIndex: N++ }))
|
|
1037
|
+
})).filter((v) => v.items.length > 0);
|
|
1038
|
+
}, [t, s]), y = m.reduce((f, N) => f + N.items.length, 0);
|
|
1039
|
+
B(() => {
|
|
1040
|
+
if (!a) return;
|
|
1041
|
+
o(""), c(0);
|
|
1042
|
+
const f = document.activeElement;
|
|
1043
|
+
p.current = f && f !== document.body ? f : _.current;
|
|
1044
|
+
const N = window.setTimeout(() => b.current?.focus(), 0);
|
|
1045
|
+
return document.body.style.overflow = "hidden", () => {
|
|
1046
|
+
window.clearTimeout(N), document.body.style.overflow = "";
|
|
1047
|
+
const v = p.current;
|
|
1048
|
+
(v && document.contains(v) ? v : _.current)?.focus();
|
|
1049
|
+
};
|
|
1050
|
+
}, [a]), B(() => {
|
|
1051
|
+
if (!r) return;
|
|
1052
|
+
function f(N) {
|
|
1053
|
+
N.repeat || (N.metaKey || N.ctrlKey) && N.key.toLowerCase() === "k" && (N.preventDefault(), l((v) => !v));
|
|
1054
|
+
}
|
|
1055
|
+
return document.addEventListener("keydown", f), () => document.removeEventListener("keydown", f);
|
|
1056
|
+
}, [r]);
|
|
1057
|
+
function k(f) {
|
|
1058
|
+
if (!f.nativeEvent.isComposing) {
|
|
1059
|
+
if (f.key === "Escape")
|
|
1060
|
+
f.preventDefault(), l(!1);
|
|
1061
|
+
else if (f.key === "ArrowDown")
|
|
1062
|
+
f.preventDefault(), c((N) => Math.max(Math.min(N + 1, y - 1), 0));
|
|
1063
|
+
else if (f.key === "ArrowUp")
|
|
1064
|
+
f.preventDefault(), c((N) => Math.max(N - 1, 0));
|
|
1065
|
+
else if (f.key === "Enter" && y > 0)
|
|
1066
|
+
f.preventDefault(), l(!1);
|
|
1067
|
+
else if (f.key === "Tab") {
|
|
1068
|
+
const N = Array.from(
|
|
1069
|
+
d.current?.querySelectorAll("button:not([disabled]), input") ?? []
|
|
1070
|
+
), v = N[0], D = N[N.length - 1];
|
|
1071
|
+
f.shiftKey && document.activeElement === v ? (f.preventDefault(), D?.focus()) : !f.shiftKey && document.activeElement === D && (f.preventDefault(), v?.focus());
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
return /* @__PURE__ */ i("div", { className: "command-palette-wrap", children: [
|
|
1076
|
+
/* @__PURE__ */ i("button", { ref: _, type: "button", className: "command-palette__trigger", onClick: () => l(!0), children: [
|
|
1077
|
+
/* @__PURE__ */ e(le, { size: 16, strokeWidth: 2, "aria-hidden": "true" }),
|
|
1078
|
+
n,
|
|
1079
|
+
/* @__PURE__ */ e("kbd", { className: "command-palette__hint", children: "⌘K" })
|
|
1080
|
+
] }),
|
|
1081
|
+
a ? /* @__PURE__ */ i("div", { className: "command-palette", role: "dialog", "aria-modal": "true", "aria-label": "命令面板", onKeyDown: k, children: [
|
|
1082
|
+
/* @__PURE__ */ e(
|
|
1083
|
+
"button",
|
|
1084
|
+
{
|
|
1085
|
+
type: "button",
|
|
1086
|
+
className: "command-palette__backdrop",
|
|
1087
|
+
"aria-label": "关闭命令面板",
|
|
1088
|
+
tabIndex: -1,
|
|
1089
|
+
onClick: () => l(!1)
|
|
1090
|
+
}
|
|
1091
|
+
),
|
|
1092
|
+
/* @__PURE__ */ i("div", { className: "command-palette__panel", ref: d, children: [
|
|
1093
|
+
/* @__PURE__ */ i("div", { className: "command-palette__search", children: [
|
|
1094
|
+
/* @__PURE__ */ e(le, { size: 18, strokeWidth: 2, "aria-hidden": "true" }),
|
|
1095
|
+
/* @__PURE__ */ e(
|
|
1096
|
+
"input",
|
|
1097
|
+
{
|
|
1098
|
+
ref: b,
|
|
1099
|
+
value: s,
|
|
1100
|
+
"aria-label": "输入命令或搜索",
|
|
1101
|
+
"aria-controls": "command-palette-list",
|
|
1102
|
+
placeholder: "输入命令或搜索…",
|
|
1103
|
+
onChange: (f) => {
|
|
1104
|
+
o(f.target.value), c(0);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
),
|
|
1108
|
+
/* @__PURE__ */ e("kbd", { children: "Esc" })
|
|
1109
|
+
] }),
|
|
1110
|
+
/* @__PURE__ */ i("p", { className: "sr-only", "aria-live": "polite", children: [
|
|
1111
|
+
y,
|
|
1112
|
+
" 个结果"
|
|
1113
|
+
] }),
|
|
1114
|
+
/* @__PURE__ */ e("div", { className: "command-palette__body", id: "command-palette-list", role: "listbox", "aria-label": "命令", children: m.length > 0 ? m.map((f, N) => (
|
|
1115
|
+
// 相邻组间的分隔线由 CSS(.command-palette__group + .command-palette__group)天然提供,
|
|
1116
|
+
// heading 缺省的段即呈现为"只有分隔线、没有标题"(对标 Geist With Divider)。
|
|
1117
|
+
/* @__PURE__ */ i("section", { className: "command-palette__group", children: [
|
|
1118
|
+
f.heading ? /* @__PURE__ */ e("h2", { className: "command-palette__heading", children: f.heading }) : null,
|
|
1119
|
+
f.items.map(({ item: v, flatIndex: D }) => /* @__PURE__ */ i(
|
|
1120
|
+
"button",
|
|
1121
|
+
{
|
|
1122
|
+
type: "button",
|
|
1123
|
+
role: "option",
|
|
1124
|
+
"aria-selected": D === u,
|
|
1125
|
+
className: `command-palette__entry${D === u ? " command-palette__entry--active" : ""}`,
|
|
1126
|
+
onMouseEnter: () => c(D),
|
|
1127
|
+
onClick: () => l(!1),
|
|
1128
|
+
children: [
|
|
1129
|
+
/* @__PURE__ */ e(Te, { size: 15, strokeWidth: 2, "aria-hidden": "true" }),
|
|
1130
|
+
/* @__PURE__ */ e("span", { className: "command-palette__entry-label", children: v.label }),
|
|
1131
|
+
v.suffix ? /* @__PURE__ */ e("span", { className: "command-palette__suffix", "aria-hidden": "true", children: v.suffix }) : null,
|
|
1132
|
+
v.keybind ? /* @__PURE__ */ e("kbd", { className: "command-palette__kbd", children: v.keybind }) : null
|
|
1133
|
+
]
|
|
1134
|
+
},
|
|
1135
|
+
v.label
|
|
1136
|
+
))
|
|
1137
|
+
] }, f.heading ?? `divider-${N}`)
|
|
1138
|
+
)) : /* @__PURE__ */ e("p", { className: "command-palette__empty", children: `没有匹配「${s}」的命令` }) })
|
|
1139
|
+
] })
|
|
1140
|
+
] }) : null
|
|
1141
|
+
] });
|
|
1142
|
+
}
|
|
1143
|
+
function vn({
|
|
1144
|
+
open: t,
|
|
1145
|
+
onClose: n,
|
|
1146
|
+
title: r,
|
|
1147
|
+
description: a,
|
|
1148
|
+
confirmLabel: l,
|
|
1149
|
+
verificationLabel: s,
|
|
1150
|
+
verificationPhrase: o,
|
|
1151
|
+
irreversibleDescription: u,
|
|
1152
|
+
loading: c,
|
|
1153
|
+
onConfirm: _
|
|
1154
|
+
}) {
|
|
1155
|
+
const [d, b] = E(""), [p, m] = E(null), y = I(null), k = I(null), f = W(), N = W(), v = d === o && !c;
|
|
1156
|
+
if (B(() => {
|
|
1157
|
+
if (!t) return;
|
|
1158
|
+
b(""), m(null);
|
|
1159
|
+
const h = document.body.style.overflow;
|
|
1160
|
+
document.body.style.overflow = "hidden";
|
|
1161
|
+
const x = window.setTimeout(() => {
|
|
1162
|
+
const g = k.current;
|
|
1163
|
+
(g && !g.disabled ? g : y.current)?.focus();
|
|
1164
|
+
}, 0);
|
|
1165
|
+
return () => {
|
|
1166
|
+
window.clearTimeout(x), document.body.style.overflow = h;
|
|
1167
|
+
};
|
|
1168
|
+
}, [t]), G(() => {
|
|
1169
|
+
t && c && y.current && !y.current.contains(document.activeElement) && y.current.focus();
|
|
1170
|
+
}, [t, c]), !t) return null;
|
|
1171
|
+
function D() {
|
|
1172
|
+
if (!v) return;
|
|
1173
|
+
const h = _();
|
|
1174
|
+
h ? m(h) : n();
|
|
1175
|
+
}
|
|
1176
|
+
function C(h) {
|
|
1177
|
+
if (h.key === "Escape")
|
|
1178
|
+
h.preventDefault(), c || n();
|
|
1179
|
+
else if (h.key === "Tab") {
|
|
1180
|
+
const x = Array.from(
|
|
1181
|
+
y.current?.querySelectorAll("button:not([disabled]), input:not([disabled])") ?? []
|
|
1182
|
+
);
|
|
1183
|
+
if (x.length === 0) {
|
|
1184
|
+
h.preventDefault();
|
|
1185
|
+
return;
|
|
1186
|
+
}
|
|
1187
|
+
const g = x[0], w = x[x.length - 1];
|
|
1188
|
+
h.shiftKey && document.activeElement === g ? (h.preventDefault(), w.focus()) : !h.shiftKey && document.activeElement === w && (h.preventDefault(), g.focus());
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
return /* @__PURE__ */ i("div", { className: "modal", onKeyDown: C, children: [
|
|
1192
|
+
/* @__PURE__ */ e(
|
|
1193
|
+
"button",
|
|
1194
|
+
{
|
|
1195
|
+
type: "button",
|
|
1196
|
+
className: "modal__backdrop",
|
|
1197
|
+
"aria-label": "关闭",
|
|
1198
|
+
tabIndex: -1,
|
|
1199
|
+
onClick: () => !c && n()
|
|
1200
|
+
}
|
|
1201
|
+
),
|
|
1202
|
+
/* @__PURE__ */ i(
|
|
1203
|
+
"div",
|
|
1204
|
+
{
|
|
1205
|
+
className: "modal__dialog",
|
|
1206
|
+
role: "dialog",
|
|
1207
|
+
"aria-modal": "true",
|
|
1208
|
+
"aria-labelledby": f,
|
|
1209
|
+
"aria-busy": c || void 0,
|
|
1210
|
+
ref: y,
|
|
1211
|
+
tabIndex: -1,
|
|
1212
|
+
children: [
|
|
1213
|
+
/* @__PURE__ */ i("header", { className: "modal__header", children: [
|
|
1214
|
+
/* @__PURE__ */ e("h2", { className: "modal__title", id: f, children: r }),
|
|
1215
|
+
/* @__PURE__ */ e("button", { type: "button", className: "modal__close", "aria-label": "关闭", disabled: c, onClick: n, children: /* @__PURE__ */ e(q, { size: 16, strokeWidth: 2, "aria-hidden": "true" }) })
|
|
1216
|
+
] }),
|
|
1217
|
+
/* @__PURE__ */ i("div", { className: "modal__body", children: [
|
|
1218
|
+
/* @__PURE__ */ e("p", { children: a }),
|
|
1219
|
+
/* @__PURE__ */ i("label", { className: "destructive-modal__prompt", id: N, htmlFor: `${N}-input`, children: [
|
|
1220
|
+
"若要确认,请输入",
|
|
1221
|
+
s,
|
|
1222
|
+
"「",
|
|
1223
|
+
o,
|
|
1224
|
+
"」"
|
|
1225
|
+
] }),
|
|
1226
|
+
/* @__PURE__ */ e(
|
|
1227
|
+
"input",
|
|
1228
|
+
{
|
|
1229
|
+
ref: k,
|
|
1230
|
+
id: `${N}-input`,
|
|
1231
|
+
className: "modal-input",
|
|
1232
|
+
"aria-labelledby": N,
|
|
1233
|
+
"aria-invalid": p ? !0 : void 0,
|
|
1234
|
+
disabled: c,
|
|
1235
|
+
value: d,
|
|
1236
|
+
onChange: (h) => {
|
|
1237
|
+
b(h.target.value), m(null);
|
|
1238
|
+
},
|
|
1239
|
+
onKeyDown: (h) => {
|
|
1240
|
+
h.key === "Enter" && (h.preventDefault(), D());
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
),
|
|
1244
|
+
p ? /* @__PURE__ */ e("p", { className: "destructive-modal__error", children: p }) : null
|
|
1245
|
+
] }),
|
|
1246
|
+
/* @__PURE__ */ i("footer", { className: "modal__footer", children: [
|
|
1247
|
+
/* @__PURE__ */ e("button", { type: "button", className: "modal-btn", disabled: c, onClick: n, children: "取消" }),
|
|
1248
|
+
/* @__PURE__ */ i(
|
|
1249
|
+
"button",
|
|
1250
|
+
{
|
|
1251
|
+
type: "button",
|
|
1252
|
+
className: "modal-btn modal-btn--danger",
|
|
1253
|
+
disabled: !v,
|
|
1254
|
+
"aria-busy": c || void 0,
|
|
1255
|
+
onClick: D,
|
|
1256
|
+
children: [
|
|
1257
|
+
c ? /* @__PURE__ */ e(se, { className: "destructive-modal__spinner", size: 14, strokeWidth: 2, "aria-hidden": "true" }) : null,
|
|
1258
|
+
l
|
|
1259
|
+
]
|
|
1260
|
+
}
|
|
1261
|
+
)
|
|
1262
|
+
] }),
|
|
1263
|
+
u ? /* @__PURE__ */ i("div", { className: "destructive-modal__band", children: [
|
|
1264
|
+
/* @__PURE__ */ e(oe, { size: 15, strokeWidth: 2, "aria-hidden": "true" }),
|
|
1265
|
+
/* @__PURE__ */ e("span", { children: u })
|
|
1266
|
+
] }) : null
|
|
1267
|
+
]
|
|
1268
|
+
}
|
|
1269
|
+
)
|
|
1270
|
+
] });
|
|
1271
|
+
}
|
|
1272
|
+
function xn({
|
|
1273
|
+
open: t,
|
|
1274
|
+
onClose: n,
|
|
1275
|
+
title: r,
|
|
1276
|
+
children: a,
|
|
1277
|
+
footer: l,
|
|
1278
|
+
height: s
|
|
1279
|
+
}) {
|
|
1280
|
+
const o = I(null), u = W(), [c, _] = E(0), d = I(null), b = I(!1);
|
|
1281
|
+
if (B(() => {
|
|
1282
|
+
if (!t) return;
|
|
1283
|
+
const N = document.body.style.overflow;
|
|
1284
|
+
document.body.style.overflow = "hidden";
|
|
1285
|
+
const v = window.setTimeout(
|
|
1286
|
+
() => o.current?.querySelector("button, input, [tabindex]")?.focus(),
|
|
1287
|
+
0
|
|
1288
|
+
);
|
|
1289
|
+
return () => {
|
|
1290
|
+
window.clearTimeout(v), document.body.style.overflow = N, _(0);
|
|
1291
|
+
};
|
|
1292
|
+
}, [t]), !t) return null;
|
|
1293
|
+
function p(N) {
|
|
1294
|
+
if (N.key === "Escape")
|
|
1295
|
+
N.preventDefault(), n();
|
|
1296
|
+
else if (N.key === "Tab") {
|
|
1297
|
+
const v = Array.from(
|
|
1298
|
+
o.current?.querySelectorAll("button:not([disabled]), input:not([disabled]), select") ?? []
|
|
1299
|
+
);
|
|
1300
|
+
if (v.length === 0) return;
|
|
1301
|
+
const D = v[0], C = v[v.length - 1];
|
|
1302
|
+
N.shiftKey && document.activeElement === D ? (N.preventDefault(), C.focus()) : !N.shiftKey && document.activeElement === C && (N.preventDefault(), D.focus());
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
function m(N) {
|
|
1306
|
+
d.current = N.clientY, b.current = !1, N.target.setPointerCapture(N.pointerId);
|
|
1307
|
+
}
|
|
1308
|
+
function y(N) {
|
|
1309
|
+
if (d.current === null) return;
|
|
1310
|
+
const v = Math.max(0, N.clientY - d.current);
|
|
1311
|
+
v > 4 && (b.current = !0), _(v);
|
|
1312
|
+
}
|
|
1313
|
+
function k() {
|
|
1314
|
+
d.current !== null && c > 80 ? n() : _(0), d.current = null;
|
|
1315
|
+
}
|
|
1316
|
+
function f() {
|
|
1317
|
+
_(0), d.current = null, b.current = !1;
|
|
1318
|
+
}
|
|
1319
|
+
return /* @__PURE__ */ i("div", { className: "drawer", onKeyDown: p, children: [
|
|
1320
|
+
/* @__PURE__ */ e("button", { type: "button", className: "drawer__backdrop", "aria-label": "关闭", tabIndex: -1, onClick: n }),
|
|
1321
|
+
/* @__PURE__ */ i(
|
|
1322
|
+
"div",
|
|
1323
|
+
{
|
|
1324
|
+
ref: o,
|
|
1325
|
+
role: "dialog",
|
|
1326
|
+
"aria-modal": "true",
|
|
1327
|
+
"aria-labelledby": u,
|
|
1328
|
+
className: "drawer__panel",
|
|
1329
|
+
style: {
|
|
1330
|
+
...s ? { maxHeight: `${s}px` } : null,
|
|
1331
|
+
...c ? { transform: `translateY(${c}px)` } : null
|
|
1332
|
+
},
|
|
1333
|
+
children: [
|
|
1334
|
+
/* @__PURE__ */ e(
|
|
1335
|
+
"button",
|
|
1336
|
+
{
|
|
1337
|
+
type: "button",
|
|
1338
|
+
className: "drawer__handle",
|
|
1339
|
+
"aria-label": "关闭抽屉",
|
|
1340
|
+
onPointerDown: m,
|
|
1341
|
+
onPointerMove: y,
|
|
1342
|
+
onPointerUp: k,
|
|
1343
|
+
onPointerCancel: f,
|
|
1344
|
+
onClick: () => {
|
|
1345
|
+
b.current || n(), b.current = !1;
|
|
1346
|
+
},
|
|
1347
|
+
children: /* @__PURE__ */ e("span", { className: "drawer__grabber", "aria-hidden": "true" })
|
|
1348
|
+
}
|
|
1349
|
+
),
|
|
1350
|
+
/* @__PURE__ */ e("h2", { className: "drawer__title", id: u, children: r }),
|
|
1351
|
+
/* @__PURE__ */ e("div", { className: "drawer__body", children: a }),
|
|
1352
|
+
/* @__PURE__ */ e("footer", { className: "drawer__footer", children: l })
|
|
1353
|
+
]
|
|
1354
|
+
}
|
|
1355
|
+
)
|
|
1356
|
+
] });
|
|
1357
|
+
}
|
|
1358
|
+
function Cn({
|
|
1359
|
+
icon: t,
|
|
1360
|
+
title: n,
|
|
1361
|
+
description: r,
|
|
1362
|
+
actions: a,
|
|
1363
|
+
live: l
|
|
1364
|
+
}) {
|
|
1365
|
+
return /* @__PURE__ */ i("div", { className: "empty-state", "aria-live": l ? "polite" : void 0, children: [
|
|
1366
|
+
/* @__PURE__ */ e("span", { className: "empty-state__icon", "aria-hidden": "true", children: t }),
|
|
1367
|
+
/* @__PURE__ */ e("h3", { className: "empty-state__title", children: n }),
|
|
1368
|
+
/* @__PURE__ */ e("p", { className: "empty-state__desc", children: r }),
|
|
1369
|
+
a ? /* @__PURE__ */ e("div", { className: "empty-state__actions", children: a }) : null
|
|
1370
|
+
] });
|
|
1371
|
+
}
|
|
1372
|
+
function $n({
|
|
1373
|
+
leading: t,
|
|
1374
|
+
title: n,
|
|
1375
|
+
subtitle: r,
|
|
1376
|
+
trailing: a
|
|
1377
|
+
}) {
|
|
1378
|
+
return /* @__PURE__ */ i("div", { className: "entity", children: [
|
|
1379
|
+
/* @__PURE__ */ i("div", { className: "entity__main", children: [
|
|
1380
|
+
t ? /* @__PURE__ */ e("span", { className: "entity__leading", children: t }) : null,
|
|
1381
|
+
/* @__PURE__ */ i("span", { className: "entity__text", children: [
|
|
1382
|
+
/* @__PURE__ */ e("span", { className: "entity__title", children: n }),
|
|
1383
|
+
r ? /* @__PURE__ */ e("span", { className: "entity__subtitle", children: r }) : null
|
|
1384
|
+
] })
|
|
1385
|
+
] }),
|
|
1386
|
+
a ? /* @__PURE__ */ e("div", { className: "entity__trailing", children: a }) : null
|
|
1387
|
+
] });
|
|
1388
|
+
}
|
|
1389
|
+
function Dn({
|
|
1390
|
+
label: t,
|
|
1391
|
+
size: n = "md",
|
|
1392
|
+
action: r,
|
|
1393
|
+
children: a
|
|
1394
|
+
}) {
|
|
1395
|
+
return /* @__PURE__ */ i("div", { className: `error-msg error-msg--${n}`, children: [
|
|
1396
|
+
/* @__PURE__ */ e(be, { className: "error-msg__icon", size: 16, strokeWidth: 2, "aria-hidden": "true" }),
|
|
1397
|
+
/* @__PURE__ */ i("span", { className: "error-msg__text", children: [
|
|
1398
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: "错误:" }),
|
|
1399
|
+
t ? /* @__PURE__ */ e("strong", { className: "error-msg__label", children: t }) : null,
|
|
1400
|
+
a,
|
|
1401
|
+
r ? /* @__PURE__ */ e("span", { className: "error-msg__action", children: r }) : null
|
|
1402
|
+
] })
|
|
1403
|
+
] });
|
|
1404
|
+
}
|
|
1405
|
+
function Mn({ title: t, message: n, action: r }) {
|
|
1406
|
+
return /* @__PURE__ */ i("div", { className: "error-card", children: [
|
|
1407
|
+
/* @__PURE__ */ e(be, { className: "error-card__icon", size: 20, strokeWidth: 2, "aria-hidden": "true" }),
|
|
1408
|
+
/* @__PURE__ */ i("p", { className: "error-card__title", children: [
|
|
1409
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: "错误:" }),
|
|
1410
|
+
t
|
|
1411
|
+
] }),
|
|
1412
|
+
n ? /* @__PURE__ */ e("p", { className: "error-card__message", children: n }) : null,
|
|
1413
|
+
r ? /* @__PURE__ */ e("div", { className: "error-card__actions", children: r }) : null
|
|
1414
|
+
] });
|
|
1415
|
+
}
|
|
1416
|
+
const Q = [
|
|
1417
|
+
{ value: "bad", label: "不太清楚", Icon: st },
|
|
1418
|
+
{ value: "ok", label: "还可以", Icon: ct },
|
|
1419
|
+
{ value: "good", label: "不错", Icon: pt },
|
|
1420
|
+
{ value: "love", label: "喜欢", Icon: ot }
|
|
1421
|
+
];
|
|
1422
|
+
function En({
|
|
1423
|
+
label: t = "反馈",
|
|
1424
|
+
prompt: n = "这次体验怎么样?",
|
|
1425
|
+
placeholder: r = "你的反馈…",
|
|
1426
|
+
inline: a,
|
|
1427
|
+
topics: l
|
|
1428
|
+
}) {
|
|
1429
|
+
const [s, o] = E(!!a), [u, c] = E(null), [_, d] = E(!1), b = I(null), p = I([]), m = W(), y = W();
|
|
1430
|
+
function k() {
|
|
1431
|
+
o(!1), b.current?.focus();
|
|
1432
|
+
}
|
|
1433
|
+
function f(g) {
|
|
1434
|
+
g.preventDefault(), d(!0), a || (o(!1), b.current?.focus());
|
|
1435
|
+
}
|
|
1436
|
+
const N = Q.findIndex((g) => g.value === u), v = N === -1 ? 0 : N;
|
|
1437
|
+
function D(g) {
|
|
1438
|
+
c(g), d(!1);
|
|
1439
|
+
}
|
|
1440
|
+
function C(g, w) {
|
|
1441
|
+
const M = g.key === "ArrowRight" || g.key === "ArrowDown", S = g.key === "ArrowLeft" || g.key === "ArrowUp";
|
|
1442
|
+
if (!M && !S) return;
|
|
1443
|
+
g.preventDefault();
|
|
1444
|
+
const $ = (w + (M ? 1 : Q.length - 1)) % Q.length;
|
|
1445
|
+
D(Q[$].value), p.current[$]?.focus();
|
|
1446
|
+
}
|
|
1447
|
+
const h = /* @__PURE__ */ i(
|
|
1448
|
+
"form",
|
|
1449
|
+
{
|
|
1450
|
+
className: "feedback__panel",
|
|
1451
|
+
id: m,
|
|
1452
|
+
onSubmit: f,
|
|
1453
|
+
onKeyDown: (g) => {
|
|
1454
|
+
!a && g.key === "Escape" && k();
|
|
1455
|
+
},
|
|
1456
|
+
children: [
|
|
1457
|
+
/* @__PURE__ */ i("div", { className: "feedback__head", children: [
|
|
1458
|
+
/* @__PURE__ */ e("span", { className: "feedback__prompt", id: y, children: n }),
|
|
1459
|
+
/* @__PURE__ */ e("div", { className: "feedback__emotions", role: "radiogroup", "aria-labelledby": y, children: Q.map(({ value: g, label: w, Icon: M }, S) => /* @__PURE__ */ e(
|
|
1460
|
+
"button",
|
|
1461
|
+
{
|
|
1462
|
+
ref: ($) => {
|
|
1463
|
+
p.current[S] = $;
|
|
1464
|
+
},
|
|
1465
|
+
type: "button",
|
|
1466
|
+
role: "radio",
|
|
1467
|
+
className: "feedback__emotion",
|
|
1468
|
+
"aria-label": w,
|
|
1469
|
+
"aria-checked": u === g,
|
|
1470
|
+
tabIndex: S === v ? 0 : -1,
|
|
1471
|
+
onClick: () => D(g),
|
|
1472
|
+
onKeyDown: ($) => C($, S),
|
|
1473
|
+
children: /* @__PURE__ */ e(M, { size: 16, strokeWidth: 1.8, "aria-hidden": "true" })
|
|
1474
|
+
},
|
|
1475
|
+
g
|
|
1476
|
+
)) })
|
|
1477
|
+
] }),
|
|
1478
|
+
l ? /* @__PURE__ */ i("label", { className: "feedback__field", children: [
|
|
1479
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: "反馈主题" }),
|
|
1480
|
+
/* @__PURE__ */ i("select", { className: "feedback__select", defaultValue: "", children: [
|
|
1481
|
+
/* @__PURE__ */ e("option", { value: "", disabled: !0, children: "选择主题…" }),
|
|
1482
|
+
l.map((g) => /* @__PURE__ */ e("option", { value: g, children: g }, g))
|
|
1483
|
+
] })
|
|
1484
|
+
] }) : null,
|
|
1485
|
+
/* @__PURE__ */ i("label", { className: "feedback__field", children: [
|
|
1486
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: "反馈内容" }),
|
|
1487
|
+
/* @__PURE__ */ e("textarea", { className: "feedback__textarea", rows: 3, placeholder: r, onChange: () => d(!1) })
|
|
1488
|
+
] }),
|
|
1489
|
+
/* @__PURE__ */ i("div", { className: "feedback__footer", children: [
|
|
1490
|
+
/* @__PURE__ */ e("span", { className: "feedback__ack", "aria-hidden": "true", children: _ ? "已收到反馈" : "" }),
|
|
1491
|
+
/* @__PURE__ */ e("button", { type: "submit", className: "feedback__submit", children: "发送" })
|
|
1492
|
+
] })
|
|
1493
|
+
]
|
|
1494
|
+
}
|
|
1495
|
+
), x = /* @__PURE__ */ e("span", { className: "sr-only", role: "status", "aria-live": "polite", children: _ ? "已收到反馈" : "" });
|
|
1496
|
+
return a ? /* @__PURE__ */ i("div", { className: "feedback feedback--inline", children: [
|
|
1497
|
+
h,
|
|
1498
|
+
x
|
|
1499
|
+
] }) : /* @__PURE__ */ i("div", { className: "feedback", children: [
|
|
1500
|
+
/* @__PURE__ */ e(
|
|
1501
|
+
"button",
|
|
1502
|
+
{
|
|
1503
|
+
ref: b,
|
|
1504
|
+
type: "button",
|
|
1505
|
+
className: "feedback__trigger",
|
|
1506
|
+
"aria-expanded": s,
|
|
1507
|
+
"aria-controls": m,
|
|
1508
|
+
onClick: () => {
|
|
1509
|
+
s || d(!1), o(!s);
|
|
1510
|
+
},
|
|
1511
|
+
children: t
|
|
1512
|
+
}
|
|
1513
|
+
),
|
|
1514
|
+
s ? h : null,
|
|
1515
|
+
x
|
|
1516
|
+
] });
|
|
1517
|
+
}
|
|
1518
|
+
function In({
|
|
1519
|
+
title: t,
|
|
1520
|
+
subtitle: n,
|
|
1521
|
+
tone: r,
|
|
1522
|
+
footerStatus: a,
|
|
1523
|
+
footerAction: l,
|
|
1524
|
+
disabled: s,
|
|
1525
|
+
children: o
|
|
1526
|
+
}) {
|
|
1527
|
+
const u = ["fieldset", r ? `fieldset--${r}` : ""].filter(Boolean).join(" ");
|
|
1528
|
+
return /* @__PURE__ */ i("fieldset", { className: u, disabled: s, children: [
|
|
1529
|
+
t ? /* @__PURE__ */ e("legend", { className: "fieldset__title", children: t }) : null,
|
|
1530
|
+
/* @__PURE__ */ e("p", { className: "fieldset__subtitle", children: n }),
|
|
1531
|
+
o ? /* @__PURE__ */ e("div", { className: "fieldset__body", children: o }) : null,
|
|
1532
|
+
a || l ? /* @__PURE__ */ i("div", { className: "fieldset__footer", children: [
|
|
1533
|
+
/* @__PURE__ */ e("span", { className: "fieldset__status", children: a }),
|
|
1534
|
+
l ? /* @__PURE__ */ e("span", { className: "fieldset__actions", children: l }) : null
|
|
1535
|
+
] }) : null
|
|
1536
|
+
] });
|
|
1537
|
+
}
|
|
1538
|
+
function qe(t, n, r, a, l) {
|
|
1539
|
+
const s = t.length;
|
|
1540
|
+
t.forEach((o, u) => {
|
|
1541
|
+
const c = `${r}/${o.name}`, _ = o.type === "folder" && (o.children?.length ?? 0) > 0;
|
|
1542
|
+
l.push({ path: c, name: o.name, type: o.type, level: n, parentPath: r, hasChildren: _, setsize: s, posinset: u + 1 }), o.type === "folder" && a.has(c) && o.children && qe(o.children, n + 1, c, a, l);
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
function Sn({
|
|
1546
|
+
nodes: t,
|
|
1547
|
+
label: n = "项目目录",
|
|
1548
|
+
defaultExpanded: r = []
|
|
1549
|
+
}) {
|
|
1550
|
+
const [a, l] = E(() => new Set(r)), [s, o] = E(() => t.length ? `/${t[0].name}` : ""), u = I(/* @__PURE__ */ new Map()), c = fe(() => {
|
|
1551
|
+
const m = [];
|
|
1552
|
+
return qe(t, 1, "", a, m), m;
|
|
1553
|
+
}, [t, a]), _ = c.some((m) => m.path === s) ? s : c[0]?.path ?? "";
|
|
1554
|
+
function d(m) {
|
|
1555
|
+
o(m), window.requestAnimationFrame(() => u.current.get(m)?.focus());
|
|
1556
|
+
}
|
|
1557
|
+
function b(m, y) {
|
|
1558
|
+
l((k) => {
|
|
1559
|
+
const f = new Set(k);
|
|
1560
|
+
return y ?? !f.has(m) ? f.add(m) : f.delete(m), f;
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
function p(m) {
|
|
1564
|
+
const y = c.findIndex((f) => f.path === _);
|
|
1565
|
+
if (y === -1) return;
|
|
1566
|
+
const k = c[y];
|
|
1567
|
+
m.key === "ArrowDown" ? (m.preventDefault(), y < c.length - 1 && d(c[y + 1].path)) : m.key === "ArrowUp" ? (m.preventDefault(), y > 0 && d(c[y - 1].path)) : m.key === "ArrowRight" ? (m.preventDefault(), k.hasChildren && !a.has(k.path) ? b(k.path, !0) : k.hasChildren && y < c.length - 1 && d(c[y + 1].path)) : m.key === "ArrowLeft" ? (m.preventDefault(), k.hasChildren && a.has(k.path) ? b(k.path, !1) : k.parentPath && d(k.parentPath)) : m.key === "Home" ? (m.preventDefault(), d(c[0].path)) : m.key === "End" ? (m.preventDefault(), d(c[c.length - 1].path)) : (m.key === "Enter" || m.key === " ") && (m.preventDefault(), k.hasChildren && b(k.path));
|
|
1568
|
+
}
|
|
1569
|
+
return /* @__PURE__ */ e("ul", { className: "file-tree", role: "tree", "aria-label": n, onKeyDown: p, children: c.map((m) => {
|
|
1570
|
+
const y = a.has(m.path), k = y ? rt : lt;
|
|
1571
|
+
return /* @__PURE__ */ e(
|
|
1572
|
+
"li",
|
|
1573
|
+
{
|
|
1574
|
+
ref: (f) => {
|
|
1575
|
+
f ? u.current.set(m.path, f) : u.current.delete(m.path);
|
|
1576
|
+
},
|
|
1577
|
+
role: "treeitem",
|
|
1578
|
+
"aria-level": m.level,
|
|
1579
|
+
"aria-setsize": m.setsize,
|
|
1580
|
+
"aria-posinset": m.posinset,
|
|
1581
|
+
"aria-expanded": m.hasChildren ? y : void 0,
|
|
1582
|
+
"aria-selected": m.path === _,
|
|
1583
|
+
tabIndex: m.path === _ ? 0 : -1,
|
|
1584
|
+
className: "file-tree__item",
|
|
1585
|
+
style: { paddingLeft: `calc(${m.level} * var(--q1-space-4))` },
|
|
1586
|
+
onClick: (f) => {
|
|
1587
|
+
f.stopPropagation(), o(m.path), m.hasChildren && b(m.path);
|
|
1588
|
+
},
|
|
1589
|
+
children: /* @__PURE__ */ i("span", { className: "file-tree__row", children: [
|
|
1590
|
+
m.hasChildren ? /* @__PURE__ */ e(O, { className: `file-tree__chevron${y ? " file-tree__chevron--open" : ""}`, size: 14, strokeWidth: 2, "aria-hidden": "true" }) : /* @__PURE__ */ e("span", { className: "file-tree__chevron-spacer", "aria-hidden": "true" }),
|
|
1591
|
+
m.type === "folder" ? /* @__PURE__ */ e(k, { className: "file-tree__icon", size: 15, strokeWidth: 2, "aria-hidden": "true" }) : /* @__PURE__ */ e(at, { className: "file-tree__icon", size: 15, strokeWidth: 2, "aria-hidden": "true" }),
|
|
1592
|
+
/* @__PURE__ */ e("span", { className: "file-tree__name", children: m.name })
|
|
1593
|
+
] })
|
|
1594
|
+
},
|
|
1595
|
+
m.path
|
|
1596
|
+
);
|
|
1597
|
+
}) });
|
|
1598
|
+
}
|
|
1599
|
+
function An({
|
|
1600
|
+
orientation: t = "horizontal",
|
|
1601
|
+
decorative: n = !0,
|
|
1602
|
+
className: r
|
|
1603
|
+
}) {
|
|
1604
|
+
const a = ["separator", `separator--${t}`, r ?? ""].filter(Boolean).join(" ");
|
|
1605
|
+
return n ? /* @__PURE__ */ e("div", { className: a, "aria-hidden": "true" }) : /* @__PURE__ */ e("div", { className: a, role: "separator", "aria-orientation": t });
|
|
1606
|
+
}
|
|
1607
|
+
function Tn({
|
|
1608
|
+
htmlFor: t,
|
|
1609
|
+
required: n,
|
|
1610
|
+
children: r
|
|
1611
|
+
}) {
|
|
1612
|
+
return /* @__PURE__ */ i("label", { className: "label", htmlFor: t, children: [
|
|
1613
|
+
r,
|
|
1614
|
+
n ? /* @__PURE__ */ i(F, { children: [
|
|
1615
|
+
/* @__PURE__ */ e("span", { className: "label__required", "aria-hidden": "true", children: "*" }),
|
|
1616
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: "(必填)" })
|
|
1617
|
+
] }) : null
|
|
1618
|
+
] });
|
|
1619
|
+
}
|
|
1620
|
+
function ge({
|
|
1621
|
+
focusableIndices: t,
|
|
1622
|
+
getText: n,
|
|
1623
|
+
onClose: r
|
|
1624
|
+
}) {
|
|
1625
|
+
const [a, l] = E(-1), s = I([]), o = I({ buffer: "", timer: 0 });
|
|
1626
|
+
function u(d) {
|
|
1627
|
+
l(d), s.current[d]?.focus();
|
|
1628
|
+
}
|
|
1629
|
+
function c() {
|
|
1630
|
+
l(-1);
|
|
1631
|
+
}
|
|
1632
|
+
function _(d) {
|
|
1633
|
+
const b = t.indexOf(a);
|
|
1634
|
+
if (d.key === "ArrowDown")
|
|
1635
|
+
d.preventDefault(), u(t[(b + 1) % t.length]);
|
|
1636
|
+
else if (d.key === "ArrowUp")
|
|
1637
|
+
d.preventDefault(), u(t[(b - 1 + t.length) % t.length]);
|
|
1638
|
+
else if (d.key === "Home")
|
|
1639
|
+
d.preventDefault(), u(t[0]);
|
|
1640
|
+
else if (d.key === "End")
|
|
1641
|
+
d.preventDefault(), u(t[t.length - 1]);
|
|
1642
|
+
else if (d.key === "Escape")
|
|
1643
|
+
d.preventDefault(), r();
|
|
1644
|
+
else if (d.key.length === 1 && /\S/.test(d.key)) {
|
|
1645
|
+
window.clearTimeout(o.current.timer), o.current.buffer += d.key.toLowerCase(), o.current.timer = window.setTimeout(() => o.current.buffer = "", 500);
|
|
1646
|
+
const p = t.find(
|
|
1647
|
+
(m) => n(m).toLowerCase().startsWith(o.current.buffer)
|
|
1648
|
+
);
|
|
1649
|
+
p !== void 0 && u(p);
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
return { itemRefs: s, focusItem: u, reset: c, onMenuKeyDown: _ };
|
|
1653
|
+
}
|
|
1654
|
+
const kt = (t) => t.type === "item" && !t.disabled || t.type === "link";
|
|
1655
|
+
function zn({
|
|
1656
|
+
label: t,
|
|
1657
|
+
entries: n,
|
|
1658
|
+
children: r
|
|
1659
|
+
}) {
|
|
1660
|
+
const [a, l] = E(null), s = I(null), o = I(null), u = I(0), c = W(), _ = a !== null, d = n.flatMap((h, x) => kt(h) ? [x] : []), { itemRefs: b, focusItem: p, reset: m, onMenuKeyDown: y } = ge({
|
|
1661
|
+
focusableIndices: d,
|
|
1662
|
+
getText: (h) => {
|
|
1663
|
+
const x = n[h];
|
|
1664
|
+
return x.type === "item" || x.type === "link" ? x.label : "";
|
|
1665
|
+
},
|
|
1666
|
+
onClose: () => f()
|
|
1667
|
+
});
|
|
1668
|
+
function k(h, x) {
|
|
1669
|
+
l({ x: h, y: x }), window.requestAnimationFrame(() => p(d[0]));
|
|
1670
|
+
}
|
|
1671
|
+
function f(h = !0) {
|
|
1672
|
+
l(null), m(), h && s.current?.focus();
|
|
1673
|
+
}
|
|
1674
|
+
G(() => {
|
|
1675
|
+
if (!a || !o.current) return;
|
|
1676
|
+
const h = o.current.getBoundingClientRect();
|
|
1677
|
+
let { x, y: g } = a;
|
|
1678
|
+
x + h.width > window.innerWidth - 8 && (x = Math.max(8, x - h.width)), g + h.height > window.innerHeight - 8 && (g = Math.max(8, g - h.height)), (x !== a.x || g !== a.y) && l({ x, y: g });
|
|
1679
|
+
}, [a]), B(() => {
|
|
1680
|
+
if (!_) return;
|
|
1681
|
+
function h(x) {
|
|
1682
|
+
o.current && !o.current.contains(x.target) && f(!1);
|
|
1683
|
+
}
|
|
1684
|
+
return document.addEventListener("mousedown", h), () => document.removeEventListener("mousedown", h);
|
|
1685
|
+
}, [_]);
|
|
1686
|
+
function N(h) {
|
|
1687
|
+
h.preventDefault(), k(h.clientX, h.clientY);
|
|
1688
|
+
}
|
|
1689
|
+
function v(h) {
|
|
1690
|
+
if (h.shiftKey && h.key === "F10" || h.key === "ContextMenu") {
|
|
1691
|
+
h.preventDefault();
|
|
1692
|
+
const x = s.current.getBoundingClientRect();
|
|
1693
|
+
k(x.left + 16, x.top + 16);
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
function D(h) {
|
|
1697
|
+
const x = h.touches[0];
|
|
1698
|
+
u.current = window.setTimeout(() => {
|
|
1699
|
+
x && k(x.clientX, x.clientY);
|
|
1700
|
+
}, 500);
|
|
1701
|
+
}
|
|
1702
|
+
function C() {
|
|
1703
|
+
window.clearTimeout(u.current);
|
|
1704
|
+
}
|
|
1705
|
+
return /* @__PURE__ */ i(F, { children: [
|
|
1706
|
+
/* @__PURE__ */ e(
|
|
1707
|
+
"div",
|
|
1708
|
+
{
|
|
1709
|
+
ref: s,
|
|
1710
|
+
className: "context-menu__area",
|
|
1711
|
+
tabIndex: 0,
|
|
1712
|
+
role: "button",
|
|
1713
|
+
"aria-haspopup": "menu",
|
|
1714
|
+
"aria-label": `${t}(右键或 Shift+F10 打开菜单)`,
|
|
1715
|
+
onContextMenu: N,
|
|
1716
|
+
onKeyDown: v,
|
|
1717
|
+
onTouchStart: D,
|
|
1718
|
+
onTouchEnd: C,
|
|
1719
|
+
children: r
|
|
1720
|
+
}
|
|
1721
|
+
),
|
|
1722
|
+
_ ? /* @__PURE__ */ e(
|
|
1723
|
+
"div",
|
|
1724
|
+
{
|
|
1725
|
+
ref: o,
|
|
1726
|
+
id: c,
|
|
1727
|
+
role: "menu",
|
|
1728
|
+
"aria-label": t,
|
|
1729
|
+
className: "menu__popup context-menu__popup",
|
|
1730
|
+
style: { left: a.x, top: a.y },
|
|
1731
|
+
onKeyDown: y,
|
|
1732
|
+
children: n.map((h, x) => h.type === "separator" ? /* @__PURE__ */ e("div", { className: "menu__separator", role: "separator" }, `sep-${x}`) : h.type === "link" ? /* @__PURE__ */ i(
|
|
1733
|
+
"a",
|
|
1734
|
+
{
|
|
1735
|
+
ref: (g) => {
|
|
1736
|
+
b.current[x] = g;
|
|
1737
|
+
},
|
|
1738
|
+
role: "menuitem",
|
|
1739
|
+
tabIndex: -1,
|
|
1740
|
+
href: h.href,
|
|
1741
|
+
className: "menu__item",
|
|
1742
|
+
onClick: (g) => {
|
|
1743
|
+
g.preventDefault(), f();
|
|
1744
|
+
},
|
|
1745
|
+
children: [
|
|
1746
|
+
h.icon ? /* @__PURE__ */ e("span", { className: "menu__item-icon", children: h.icon }) : null,
|
|
1747
|
+
/* @__PURE__ */ e("span", { className: "menu__item-label", children: h.label }),
|
|
1748
|
+
h.suffix ? /* @__PURE__ */ e("span", { className: "menu__item-suffix", children: h.suffix }) : null
|
|
1749
|
+
]
|
|
1750
|
+
},
|
|
1751
|
+
h.label
|
|
1752
|
+
) : /* @__PURE__ */ i(
|
|
1753
|
+
"button",
|
|
1754
|
+
{
|
|
1755
|
+
ref: (g) => {
|
|
1756
|
+
b.current[x] = g;
|
|
1757
|
+
},
|
|
1758
|
+
type: "button",
|
|
1759
|
+
role: "menuitem",
|
|
1760
|
+
tabIndex: -1,
|
|
1761
|
+
disabled: h.disabled,
|
|
1762
|
+
"aria-disabled": h.disabled || void 0,
|
|
1763
|
+
className: `menu__item${h.danger ? " menu__item--danger" : ""}`,
|
|
1764
|
+
onClick: () => !h.disabled && f(),
|
|
1765
|
+
children: [
|
|
1766
|
+
h.icon ? /* @__PURE__ */ e("span", { className: "menu__item-icon", children: h.icon }) : null,
|
|
1767
|
+
/* @__PURE__ */ e("span", { className: "menu__item-label", children: h.label }),
|
|
1768
|
+
h.suffix ? /* @__PURE__ */ e("span", { className: "menu__item-suffix", children: h.suffix }) : null
|
|
1769
|
+
]
|
|
1770
|
+
},
|
|
1771
|
+
h.label
|
|
1772
|
+
))
|
|
1773
|
+
}
|
|
1774
|
+
) : null
|
|
1775
|
+
] });
|
|
1776
|
+
}
|
|
1777
|
+
function Wn({
|
|
1778
|
+
entries: t,
|
|
1779
|
+
size: n = "md",
|
|
1780
|
+
disabled: r,
|
|
1781
|
+
align: a = "end"
|
|
1782
|
+
}) {
|
|
1783
|
+
const [l, s] = E(!1), o = I(null), u = W(), c = t.flatMap((f, N) => f.disabled ? [] : [N]), { itemRefs: _, focusItem: d, reset: b, onMenuKeyDown: p } = ge({
|
|
1784
|
+
focusableIndices: c,
|
|
1785
|
+
getText: (f) => t[f].label,
|
|
1786
|
+
onClose: () => y()
|
|
1787
|
+
});
|
|
1788
|
+
function m(f) {
|
|
1789
|
+
s(!0);
|
|
1790
|
+
const N = f === "first" ? c[0] : c[c.length - 1];
|
|
1791
|
+
window.requestAnimationFrame(() => d(N));
|
|
1792
|
+
}
|
|
1793
|
+
function y(f = !0) {
|
|
1794
|
+
s(!1), b(), f && o.current?.focus();
|
|
1795
|
+
}
|
|
1796
|
+
B(() => {
|
|
1797
|
+
if (!l) return;
|
|
1798
|
+
function f(N) {
|
|
1799
|
+
const v = o.current?.closest(".dots-menu");
|
|
1800
|
+
v && !v.contains(N.target) && y(!1);
|
|
1801
|
+
}
|
|
1802
|
+
return document.addEventListener("mousedown", f), () => document.removeEventListener("mousedown", f);
|
|
1803
|
+
}, [l]);
|
|
1804
|
+
function k(f) {
|
|
1805
|
+
f.key === "ArrowDown" || f.key === "Enter" || f.key === " " ? (f.preventDefault(), m("first")) : f.key === "ArrowUp" && (f.preventDefault(), m("last"));
|
|
1806
|
+
}
|
|
1807
|
+
return /* @__PURE__ */ i("div", { className: "dots-menu", children: [
|
|
1808
|
+
/* @__PURE__ */ e(
|
|
1809
|
+
"button",
|
|
1810
|
+
{
|
|
1811
|
+
ref: o,
|
|
1812
|
+
type: "button",
|
|
1813
|
+
className: `dots-menu__trigger dots-menu__trigger--${n}`,
|
|
1814
|
+
"aria-label": "更多操作",
|
|
1815
|
+
"aria-haspopup": "menu",
|
|
1816
|
+
"aria-expanded": l,
|
|
1817
|
+
"aria-controls": l ? u : void 0,
|
|
1818
|
+
disabled: r,
|
|
1819
|
+
onClick: () => l ? y() : m("first"),
|
|
1820
|
+
onKeyDown: k,
|
|
1821
|
+
children: /* @__PURE__ */ e(Le, { size: n === "sm" ? 14 : n === "lg" ? 20 : 16, strokeWidth: 2, "aria-hidden": "true" })
|
|
1822
|
+
}
|
|
1823
|
+
),
|
|
1824
|
+
l ? /* @__PURE__ */ e(
|
|
1825
|
+
"div",
|
|
1826
|
+
{
|
|
1827
|
+
id: u,
|
|
1828
|
+
role: "menu",
|
|
1829
|
+
"aria-label": "更多操作",
|
|
1830
|
+
className: `menu__popup menu__popup--${a}`,
|
|
1831
|
+
onKeyDown: p,
|
|
1832
|
+
children: t.map((f, N) => /* @__PURE__ */ e(
|
|
1833
|
+
"button",
|
|
1834
|
+
{
|
|
1835
|
+
ref: (v) => {
|
|
1836
|
+
_.current[N] = v;
|
|
1837
|
+
},
|
|
1838
|
+
type: "button",
|
|
1839
|
+
role: "menuitem",
|
|
1840
|
+
tabIndex: -1,
|
|
1841
|
+
disabled: f.disabled,
|
|
1842
|
+
"aria-disabled": f.disabled || void 0,
|
|
1843
|
+
className: `menu__item${f.danger ? " menu__item--danger" : ""}`,
|
|
1844
|
+
onClick: () => !f.disabled && y(),
|
|
1845
|
+
children: /* @__PURE__ */ e("span", { className: "menu__item-label", children: f.label })
|
|
1846
|
+
},
|
|
1847
|
+
f.label
|
|
1848
|
+
))
|
|
1849
|
+
}
|
|
1850
|
+
) : null
|
|
1851
|
+
] });
|
|
1852
|
+
}
|
|
1853
|
+
function Bn({
|
|
1854
|
+
tone: t,
|
|
1855
|
+
label: n,
|
|
1856
|
+
animated: r = !1,
|
|
1857
|
+
showLabel: a = !1,
|
|
1858
|
+
titlePrefix: l
|
|
1859
|
+
}) {
|
|
1860
|
+
const s = ["status-dot", `status-dot--${t}`, r ? "status-dot--animated" : ""].filter(Boolean).join(" ");
|
|
1861
|
+
if (a)
|
|
1862
|
+
return /* @__PURE__ */ i("span", { className: "status-dot-item", children: [
|
|
1863
|
+
/* @__PURE__ */ e("span", { className: s, "aria-hidden": "true" }),
|
|
1864
|
+
/* @__PURE__ */ e("span", { className: "status-dot-item__label", children: n })
|
|
1865
|
+
] });
|
|
1866
|
+
const o = l ? `${l}:${n}` : n;
|
|
1867
|
+
return /* @__PURE__ */ e("span", { className: s, role: "img", "aria-label": o, title: o });
|
|
1868
|
+
}
|
|
1869
|
+
function Ln({
|
|
1870
|
+
tone: t = "neutral",
|
|
1871
|
+
subtle: n = !1,
|
|
1872
|
+
inverted: r = !1,
|
|
1873
|
+
size: a = "md",
|
|
1874
|
+
icon: l,
|
|
1875
|
+
count: s = !1,
|
|
1876
|
+
title: o,
|
|
1877
|
+
className: u,
|
|
1878
|
+
children: c,
|
|
1879
|
+
..._
|
|
1880
|
+
}) {
|
|
1881
|
+
const d = [
|
|
1882
|
+
"badge",
|
|
1883
|
+
r ? "badge--inverted" : `badge--${t}${n ? "-subtle" : ""}`,
|
|
1884
|
+
a === "md" ? "" : `badge--${a}`,
|
|
1885
|
+
s ? "badge--count" : "",
|
|
1886
|
+
u
|
|
1887
|
+
].filter(Boolean).join(" "), p = l != null && (c == null || c === "") ? { role: "img", "aria-label": o } : {};
|
|
1888
|
+
return /* @__PURE__ */ i("span", { className: d, title: o, ...p, ..._, children: [
|
|
1889
|
+
l ? /* @__PURE__ */ e("span", { className: "badge__icon", "aria-hidden": "true", children: l }) : null,
|
|
1890
|
+
c
|
|
1891
|
+
] });
|
|
1892
|
+
}
|
|
1893
|
+
function Rn({ href: t, size: n = "md", icon: r, title: a, className: l, children: s, ...o }) {
|
|
1894
|
+
const u = ["badge", "badge--pill", n === "md" ? "" : `badge--${n}`, l].filter(Boolean).join(" "), _ = r != null && (s == null || s === "") ? { "aria-label": a } : {};
|
|
1895
|
+
return /* @__PURE__ */ i("a", { className: u, href: t, title: a, ..._, ...o, children: [
|
|
1896
|
+
r ? /* @__PURE__ */ e("span", { className: "badge__icon", "aria-hidden": "true", children: r }) : null,
|
|
1897
|
+
s
|
|
1898
|
+
] });
|
|
1899
|
+
}
|
|
1900
|
+
function Fn({ title: t, children: n, tone: r, icon: a, action: l, onDismiss: s, progress: o, className: u, ...c }) {
|
|
1901
|
+
const _ = r === void 0 && !o, d = [
|
|
1902
|
+
"banner",
|
|
1903
|
+
_ ? "banner--announcement" : r === "neutral" ? "" : `banner--${r}`,
|
|
1904
|
+
o ? "banner--progress" : "",
|
|
1905
|
+
u
|
|
1906
|
+
].filter(Boolean).join(" "), b = /* @__PURE__ */ i("p", { className: "banner__content", children: [
|
|
1907
|
+
/* @__PURE__ */ e("span", { className: "banner__title", children: t }),
|
|
1908
|
+
n != null ? /* @__PURE__ */ i(F, { children: [
|
|
1909
|
+
" — ",
|
|
1910
|
+
n
|
|
1911
|
+
] }) : null
|
|
1912
|
+
] }), p = l ? _ ? /* @__PURE__ */ e("a", { className: "banner__cta", href: l.href, children: l.label }) : /* @__PURE__ */ i("a", { className: "banner__action", href: l.href, children: [
|
|
1913
|
+
l.label,
|
|
1914
|
+
/* @__PURE__ */ e(O, { "aria-hidden": "true", size: 16, strokeWidth: 2 })
|
|
1915
|
+
] }) : null, m = !_ && s ? /* @__PURE__ */ e("button", { className: "banner__close", type: "button", "aria-label": "关闭横幅", onClick: s, children: /* @__PURE__ */ e(q, { "aria-hidden": "true", size: 16, strokeWidth: 2 }) }) : null;
|
|
1916
|
+
if (o) {
|
|
1917
|
+
const y = Number.isFinite(o.value) ? Math.min(100, Math.max(0, o.value)) : 0;
|
|
1918
|
+
return /* @__PURE__ */ i("div", { className: d, ...c, children: [
|
|
1919
|
+
/* @__PURE__ */ i("div", { className: "banner__progress-head", children: [
|
|
1920
|
+
b,
|
|
1921
|
+
/* @__PURE__ */ i("span", { className: "banner__progress-value", children: [
|
|
1922
|
+
y,
|
|
1923
|
+
"%"
|
|
1924
|
+
] }),
|
|
1925
|
+
m
|
|
1926
|
+
] }),
|
|
1927
|
+
/* @__PURE__ */ e(
|
|
1928
|
+
"div",
|
|
1929
|
+
{
|
|
1930
|
+
className: "banner__progress",
|
|
1931
|
+
role: "progressbar",
|
|
1932
|
+
"aria-valuenow": y,
|
|
1933
|
+
"aria-valuemin": 0,
|
|
1934
|
+
"aria-valuemax": 100,
|
|
1935
|
+
"aria-label": o.label,
|
|
1936
|
+
children: /* @__PURE__ */ e("div", { className: "banner__progress-bar", style: { width: `${y}%` } })
|
|
1937
|
+
}
|
|
1938
|
+
)
|
|
1939
|
+
] });
|
|
1940
|
+
}
|
|
1941
|
+
return /* @__PURE__ */ i("div", { className: d, ...c, children: [
|
|
1942
|
+
!_ && a ? /* @__PURE__ */ e("span", { className: "banner__icon", "aria-hidden": "true", children: a }) : null,
|
|
1943
|
+
b,
|
|
1944
|
+
p && m ? /* @__PURE__ */ i("div", { className: "banner__actions", children: [
|
|
1945
|
+
p,
|
|
1946
|
+
m
|
|
1947
|
+
] }) : p ?? m
|
|
1948
|
+
] });
|
|
1949
|
+
}
|
|
1950
|
+
function wt({ hover: t, secondary: n, divided: r, direction: a, shadow: l, bordered: s, className: o }) {
|
|
1951
|
+
return [
|
|
1952
|
+
"card",
|
|
1953
|
+
t ? "card--hover" : "",
|
|
1954
|
+
n ? "card--secondary" : "",
|
|
1955
|
+
r ? "card--divided" : "",
|
|
1956
|
+
// 横向与分隔线正交:row 只管横向铺开;分隔线由 divided 决定,两者组合才在段间画左向线。
|
|
1957
|
+
a === "row" ? "card--row" : "",
|
|
1958
|
+
l ? "card--shadow" : "",
|
|
1959
|
+
// bordered 默认 true;显式 false 才降级为无框(用 === false 而非 !bordered,让 undefined 保持有框)。
|
|
1960
|
+
s === !1 ? "card--borderless" : "",
|
|
1961
|
+
o
|
|
1962
|
+
].filter(Boolean).join(" ");
|
|
1963
|
+
}
|
|
1964
|
+
function Kn(t) {
|
|
1965
|
+
const n = wt(t);
|
|
1966
|
+
if (t.href !== void 0) {
|
|
1967
|
+
const {
|
|
1968
|
+
hover: p,
|
|
1969
|
+
secondary: m,
|
|
1970
|
+
divided: y,
|
|
1971
|
+
direction: k,
|
|
1972
|
+
shadow: f,
|
|
1973
|
+
bordered: N,
|
|
1974
|
+
className: v,
|
|
1975
|
+
children: D,
|
|
1976
|
+
...C
|
|
1977
|
+
} = t;
|
|
1978
|
+
return /* @__PURE__ */ e("a", { className: n, ...C, children: D });
|
|
1979
|
+
}
|
|
1980
|
+
const {
|
|
1981
|
+
href: r,
|
|
1982
|
+
hover: a,
|
|
1983
|
+
secondary: l,
|
|
1984
|
+
divided: s,
|
|
1985
|
+
direction: o,
|
|
1986
|
+
shadow: u,
|
|
1987
|
+
bordered: c,
|
|
1988
|
+
className: _,
|
|
1989
|
+
children: d,
|
|
1990
|
+
...b
|
|
1991
|
+
} = t;
|
|
1992
|
+
return /* @__PURE__ */ e("div", { className: n, ...b, children: d });
|
|
1993
|
+
}
|
|
1994
|
+
function vt({
|
|
1995
|
+
content: t,
|
|
1996
|
+
placement: n = "top",
|
|
1997
|
+
delay: r = 150,
|
|
1998
|
+
triggerLabel: a,
|
|
1999
|
+
children: l,
|
|
2000
|
+
align: s = "center",
|
|
2001
|
+
tip: o = !0,
|
|
2002
|
+
center: u = !1
|
|
2003
|
+
}) {
|
|
2004
|
+
const [c, _] = E(!1), [d, b] = E({
|
|
2005
|
+
p: n,
|
|
2006
|
+
left: 0,
|
|
2007
|
+
top: 0,
|
|
2008
|
+
caret: 0
|
|
2009
|
+
}), p = I(null), m = I(null), y = I(null), k = W(), f = J(() => {
|
|
2010
|
+
const g = m.current, w = y.current;
|
|
2011
|
+
if (!g || !w) return;
|
|
2012
|
+
const M = 8, S = 8, $ = g.getBoundingClientRect(), T = w.offsetWidth, L = w.offsetHeight, V = document.documentElement.clientWidth, X = document.documentElement.clientHeight, Z = $.left + $.width / 2, Ne = $.top + $.height / 2;
|
|
2013
|
+
let R = n;
|
|
2014
|
+
n === "top" && $.top - S - L < M && $.bottom + S + L <= X - M ? R = "bottom" : n === "bottom" && $.bottom + S + L > X - M && $.top - S - L >= M ? R = "top" : n === "left" && $.left - S - T < M && $.right + S + T <= V - M ? R = "right" : n === "right" && $.right + S + T > V - M && $.left - S - T >= M && (R = "left");
|
|
2015
|
+
let H, U;
|
|
2016
|
+
R === "top" || R === "bottom" ? (H = s === "start" ? $.left : s === "end" ? $.right - T : Z - T / 2, U = R === "top" ? $.top - S - L : $.bottom + S) : (U = s === "start" ? $.top : s === "end" ? $.bottom - L : Ne - L / 2, H = R === "left" ? $.left - S - T : $.right + S), H = Math.max(M, Math.min(H, V - M - T)), U = Math.max(M, Math.min(U, X - M - L));
|
|
2017
|
+
const Ge = R === "top" || R === "bottom" ? Math.max(12, Math.min(T - 12, Z - H)) : Math.max(12, Math.min(L - 12, Ne - U));
|
|
2018
|
+
b({ p: R, left: H, top: U, caret: Ge });
|
|
2019
|
+
}, [n, s]);
|
|
2020
|
+
G(() => {
|
|
2021
|
+
if (c)
|
|
2022
|
+
return f(), window.addEventListener("scroll", f, !0), window.addEventListener("resize", f), () => {
|
|
2023
|
+
window.removeEventListener("scroll", f, !0), window.removeEventListener("resize", f);
|
|
2024
|
+
};
|
|
2025
|
+
}, [c, f]), B(
|
|
2026
|
+
() => () => {
|
|
2027
|
+
p.current && clearTimeout(p.current);
|
|
2028
|
+
},
|
|
2029
|
+
[]
|
|
2030
|
+
);
|
|
2031
|
+
function N() {
|
|
2032
|
+
p.current && clearTimeout(p.current), p.current = setTimeout(() => _(!0), r);
|
|
2033
|
+
}
|
|
2034
|
+
function v() {
|
|
2035
|
+
p.current && clearTimeout(p.current), _(!1);
|
|
2036
|
+
}
|
|
2037
|
+
const D = {
|
|
2038
|
+
left: d.left,
|
|
2039
|
+
top: d.top,
|
|
2040
|
+
"--tt-caret": `${d.caret}px`
|
|
2041
|
+
}, C = [
|
|
2042
|
+
"tooltip__bubble",
|
|
2043
|
+
`tooltip__bubble--${d.p}`,
|
|
2044
|
+
c ? "tooltip__bubble--open" : "",
|
|
2045
|
+
o ? "" : "tooltip__bubble--no-tip",
|
|
2046
|
+
u ? "tooltip__bubble--center" : ""
|
|
2047
|
+
].filter(Boolean).join(" ");
|
|
2048
|
+
function h(g) {
|
|
2049
|
+
g.key === "Escape" && v();
|
|
2050
|
+
}
|
|
2051
|
+
l && (!ke(l) || l.type === we) && console.warn(
|
|
2052
|
+
`Tooltip:children 必须是单个合法元素/组件(不能是纯文本、Fragment 或多个子节点),已回退为默认触发器${a ? `(文案:"${a}")` : "——但没有传 triggerLabel,会渲染成一个看不出用途的空文案按钮"}。`
|
|
2053
|
+
);
|
|
2054
|
+
const x = l && ke(l) && l.type !== we ? Ve(l, {
|
|
2055
|
+
"aria-describedby": k,
|
|
2056
|
+
onFocus: (g) => {
|
|
2057
|
+
l.props.onFocus?.(g), N();
|
|
2058
|
+
},
|
|
2059
|
+
onBlur: (g) => {
|
|
2060
|
+
l.props.onBlur?.(g), v();
|
|
2061
|
+
},
|
|
2062
|
+
onKeyDown: (g) => {
|
|
2063
|
+
l.props.onKeyDown?.(g), h(g);
|
|
2064
|
+
}
|
|
2065
|
+
}) : /* @__PURE__ */ e(
|
|
2066
|
+
"button",
|
|
2067
|
+
{
|
|
2068
|
+
type: "button",
|
|
2069
|
+
className: "tooltip__trigger",
|
|
2070
|
+
"aria-describedby": k,
|
|
2071
|
+
onFocus: N,
|
|
2072
|
+
onBlur: v,
|
|
2073
|
+
onKeyDown: h,
|
|
2074
|
+
children: a
|
|
2075
|
+
}
|
|
2076
|
+
);
|
|
2077
|
+
return /* @__PURE__ */ i("span", { ref: m, className: "tooltip", onMouseEnter: N, onMouseLeave: v, children: [
|
|
2078
|
+
x,
|
|
2079
|
+
Xe(
|
|
2080
|
+
/* @__PURE__ */ e("span", { ref: y, role: "tooltip", id: k, className: C, style: D, children: t }),
|
|
2081
|
+
document.body
|
|
2082
|
+
)
|
|
2083
|
+
] });
|
|
2084
|
+
}
|
|
2085
|
+
function Pn({
|
|
2086
|
+
title: t,
|
|
2087
|
+
tooltip: n,
|
|
2088
|
+
align: r,
|
|
2089
|
+
ellipsis: a,
|
|
2090
|
+
children: l
|
|
2091
|
+
}) {
|
|
2092
|
+
const s = ["description", r === "right" ? "description--right" : ""].filter(Boolean).join(" ");
|
|
2093
|
+
return /* @__PURE__ */ i("dl", { className: s, children: [
|
|
2094
|
+
/* @__PURE__ */ i("dt", { className: "description__title", children: [
|
|
2095
|
+
t,
|
|
2096
|
+
n ? /* @__PURE__ */ e(vt, { content: n, placement: "top", children: /* @__PURE__ */ e("button", { type: "button", className: "description__hint", "aria-label": `${t}说明`, children: /* @__PURE__ */ e(re, { size: 13, strokeWidth: 2, "aria-hidden": "true" }) }) }) : null
|
|
2097
|
+
] }),
|
|
2098
|
+
/* @__PURE__ */ e("dd", { className: `description__value${a ? " description__value--ellipsis" : ""}`, children: l })
|
|
2099
|
+
] });
|
|
2100
|
+
}
|
|
2101
|
+
function jn({
|
|
2102
|
+
name: t,
|
|
2103
|
+
identity: n,
|
|
2104
|
+
rows: r,
|
|
2105
|
+
action: a,
|
|
2106
|
+
placement: l = "bottom",
|
|
2107
|
+
align: s = "start",
|
|
2108
|
+
children: o
|
|
2109
|
+
}) {
|
|
2110
|
+
const [u, c] = E(!1), _ = [
|
|
2111
|
+
"context-card-wrap",
|
|
2112
|
+
`context-card-wrap--${l}`,
|
|
2113
|
+
s !== "start" ? `context-card-wrap--align-${s}` : "",
|
|
2114
|
+
u ? "context-card-wrap--dismissed" : ""
|
|
2115
|
+
].filter(Boolean).join(" ");
|
|
2116
|
+
return /* @__PURE__ */ i(
|
|
2117
|
+
"span",
|
|
2118
|
+
{
|
|
2119
|
+
className: _,
|
|
2120
|
+
onKeyDown: (d) => {
|
|
2121
|
+
if (d.key === "Escape" && !u) {
|
|
2122
|
+
d.preventDefault(), c(!0);
|
|
2123
|
+
const b = d.currentTarget.querySelector(".context-card");
|
|
2124
|
+
Array.from(
|
|
2125
|
+
d.currentTarget.querySelectorAll('button, a[href], [tabindex]:not([tabindex="-1"])')
|
|
2126
|
+
).find((m) => !b?.contains(m))?.focus();
|
|
2127
|
+
}
|
|
2128
|
+
},
|
|
2129
|
+
onMouseLeave: (d) => {
|
|
2130
|
+
d.currentTarget.matches(":focus-within") || c(!1);
|
|
2131
|
+
},
|
|
2132
|
+
onBlur: (d) => {
|
|
2133
|
+
!d.currentTarget.contains(d.relatedTarget) && !d.currentTarget.matches(":hover") && c(!1);
|
|
2134
|
+
},
|
|
2135
|
+
children: [
|
|
2136
|
+
o,
|
|
2137
|
+
/* @__PURE__ */ i("span", { className: "context-card", role: "group", "aria-label": `${t} 详情`, children: [
|
|
2138
|
+
/* @__PURE__ */ e("span", { className: "context-card__name", children: t }),
|
|
2139
|
+
/* @__PURE__ */ e("span", { className: "context-card__identity", children: n }),
|
|
2140
|
+
/* @__PURE__ */ e("dl", { className: "context-card__rows", children: r.map(([d, b]) => /* @__PURE__ */ i("div", { className: "context-card__row", children: [
|
|
2141
|
+
/* @__PURE__ */ e("dt", { className: "context-card__key", children: d }),
|
|
2142
|
+
/* @__PURE__ */ e("dd", { className: "context-card__value", children: b })
|
|
2143
|
+
] }, d)) }),
|
|
2144
|
+
a ? /* @__PURE__ */ e("button", { type: "button", className: "context-card__action", children: a }) : null
|
|
2145
|
+
] })
|
|
2146
|
+
]
|
|
2147
|
+
}
|
|
2148
|
+
);
|
|
2149
|
+
}
|
|
2150
|
+
function On({
|
|
2151
|
+
title: t,
|
|
2152
|
+
variant: n = "stripe",
|
|
2153
|
+
color: r,
|
|
2154
|
+
bandColor: a,
|
|
2155
|
+
textColor: l,
|
|
2156
|
+
icon: s,
|
|
2157
|
+
illustration: o,
|
|
2158
|
+
textured: u,
|
|
2159
|
+
width: c,
|
|
2160
|
+
className: _,
|
|
2161
|
+
style: d,
|
|
2162
|
+
...b
|
|
2163
|
+
}) {
|
|
2164
|
+
const p = ["book", `book--${n}`, u ? "book--textured" : "", _].filter(Boolean).join(" "), m = typeof c == "number" ? Number.isFinite(c) && c > 0 ? `${c}px` : void 0 : c, y = {
|
|
2165
|
+
...d,
|
|
2166
|
+
...r ? { "--book-cover": r } : null,
|
|
2167
|
+
...a ? { "--book-band": a } : null,
|
|
2168
|
+
...l ? { "--book-text": l } : null,
|
|
2169
|
+
...m ? { "--book-width": m } : null
|
|
2170
|
+
}, k = s ? /* @__PURE__ */ e("span", { className: "book__icon", "aria-hidden": "true", children: s }) : null;
|
|
2171
|
+
return /* @__PURE__ */ e("div", { className: p, style: y, ...b, children: /* @__PURE__ */ i("div", { className: "book__inner", children: [
|
|
2172
|
+
/* @__PURE__ */ i("div", { className: "book__cover", children: [
|
|
2173
|
+
o ? /* @__PURE__ */ e("span", { className: "book__illustration", "aria-hidden": "true", children: o }) : null,
|
|
2174
|
+
n === "stripe" && !o ? /* @__PURE__ */ e("span", { className: "book__band", "aria-hidden": "true", children: k }) : null,
|
|
2175
|
+
/* @__PURE__ */ i("span", { className: "book__label", children: [
|
|
2176
|
+
n === "simple" || o ? k : null,
|
|
2177
|
+
/* @__PURE__ */ e("span", { className: "book__title", children: t })
|
|
2178
|
+
] }),
|
|
2179
|
+
/* @__PURE__ */ e("span", { className: "book__gutter", "aria-hidden": "true" })
|
|
2180
|
+
] }),
|
|
2181
|
+
/* @__PURE__ */ e("span", { className: "book__spine", "aria-hidden": "true" }),
|
|
2182
|
+
/* @__PURE__ */ e("span", { className: "book__pages", "aria-hidden": "true" })
|
|
2183
|
+
] }) });
|
|
2184
|
+
}
|
|
2185
|
+
function xt({ className: t } = {}) {
|
|
2186
|
+
return /* @__PURE__ */ i("span", { className: ["browser__dots", t].filter(Boolean).join(" "), "aria-hidden": "true", children: [
|
|
2187
|
+
/* @__PURE__ */ e("span", { className: "browser__dot browser__dot--close" }),
|
|
2188
|
+
/* @__PURE__ */ e("span", { className: "browser__dot browser__dot--minimize" }),
|
|
2189
|
+
/* @__PURE__ */ e("span", { className: "browser__dot browser__dot--expand" })
|
|
2190
|
+
] });
|
|
2191
|
+
}
|
|
2192
|
+
function Ct({ className: t } = {}) {
|
|
2193
|
+
return /* @__PURE__ */ i("span", { className: ["browser__controls", t].filter(Boolean).join(" "), "aria-hidden": "true", children: [
|
|
2194
|
+
/* @__PURE__ */ e(et, { size: 14, strokeWidth: 2 }),
|
|
2195
|
+
/* @__PURE__ */ e(Te, { size: 14, strokeWidth: 2 }),
|
|
2196
|
+
/* @__PURE__ */ e(mt, { size: 14, strokeWidth: 2 })
|
|
2197
|
+
] });
|
|
2198
|
+
}
|
|
2199
|
+
function $t({ address: t, className: n }) {
|
|
2200
|
+
const r = t.lastIndexOf("/"), a = r > 0 ? t.slice(0, r) : t, l = r > 0 ? t.slice(r) : "", [s, o] = E(!1), u = I(void 0);
|
|
2201
|
+
B(() => () => clearTimeout(u.current), []);
|
|
2202
|
+
const c = async () => {
|
|
2203
|
+
try {
|
|
2204
|
+
await Fe(t), o(!0), clearTimeout(u.current), u.current = setTimeout(() => o(!1), 1500);
|
|
2205
|
+
} catch {
|
|
2206
|
+
}
|
|
2207
|
+
};
|
|
2208
|
+
return /* @__PURE__ */ i("span", { className: ["browser__address", n].filter(Boolean).join(" "), children: [
|
|
2209
|
+
/* @__PURE__ */ i("span", { className: "browser__url", title: t, children: [
|
|
2210
|
+
/* @__PURE__ */ e("span", { className: "browser__url-head", children: a }),
|
|
2211
|
+
l ? /* @__PURE__ */ e("span", { className: "browser__url-tail", children: l }) : null
|
|
2212
|
+
] }),
|
|
2213
|
+
/* @__PURE__ */ e("button", { type: "button", className: "browser__address-copy", onClick: c, "aria-label": "复制网址", children: s ? /* @__PURE__ */ e(j, { className: "browser__address-icon", size: 12, strokeWidth: 2, "aria-hidden": "true" }) : /* @__PURE__ */ e(ee, { className: "browser__address-icon", size: 12, strokeWidth: 2, "aria-hidden": "true" }) }),
|
|
2214
|
+
/* @__PURE__ */ e("span", { className: "sr-only", role: "status", "aria-live": "polite", children: s ? "已复制网址" : "" })
|
|
2215
|
+
] });
|
|
2216
|
+
}
|
|
2217
|
+
function Dt({ tabs: t, className: n }) {
|
|
2218
|
+
return /* @__PURE__ */ e("div", { className: ["browser__tabs", n].filter(Boolean).join(" "), "aria-hidden": "true", children: t.map((r, a) => (
|
|
2219
|
+
// key 带 index:label 是装饰文案不保证唯一,纯 label 做 key 在同名标签时会撞车。
|
|
2220
|
+
/* @__PURE__ */ e("span", { className: `browser__tab${r.isActive ? " browser__tab--active" : ""}`, children: r.label }, `${r.label}-${a}`)
|
|
2221
|
+
)) });
|
|
2222
|
+
}
|
|
2223
|
+
function qn({ address: t, variant: n = "dark", tabs: r, children: a, className: l, ...s }) {
|
|
2224
|
+
return /* @__PURE__ */ i("div", { className: ["browser", `browser--${n}`, l].filter(Boolean).join(" "), ...s, children: [
|
|
2225
|
+
/* @__PURE__ */ i("div", { className: "browser__chrome", children: [
|
|
2226
|
+
r ? /* @__PURE__ */ e(Dt, { tabs: r }) : null,
|
|
2227
|
+
/* @__PURE__ */ i("div", { className: "browser__bar", children: [
|
|
2228
|
+
/* @__PURE__ */ i("div", { className: "browser__zone browser__zone--start", children: [
|
|
2229
|
+
/* @__PURE__ */ e(xt, {}),
|
|
2230
|
+
/* @__PURE__ */ e(Ct, {})
|
|
2231
|
+
] }),
|
|
2232
|
+
/* @__PURE__ */ e("div", { className: "browser__zone browser__zone--center", children: /* @__PURE__ */ e($t, { address: t }) })
|
|
2233
|
+
] })
|
|
2234
|
+
] }),
|
|
2235
|
+
/* @__PURE__ */ e("div", { className: "browser__body", children: a })
|
|
2236
|
+
] });
|
|
2237
|
+
}
|
|
2238
|
+
function Hn() {
|
|
2239
|
+
return /* @__PURE__ */ i("div", { className: "browser__placeholder", "aria-hidden": "true", children: [
|
|
2240
|
+
/* @__PURE__ */ e("span", { className: "browser__skeleton-line browser__skeleton-line--medium" }),
|
|
2241
|
+
/* @__PURE__ */ e("span", { className: "browser__skeleton-line browser__skeleton-line--short" }),
|
|
2242
|
+
/* @__PURE__ */ e("span", { className: "browser__skeleton-line" })
|
|
2243
|
+
] });
|
|
2244
|
+
}
|
|
2245
|
+
const He = (t) => t !== void 0 && Number.isFinite(t) && t > 0 ? t : void 0, Ue = (t) => t === void 0 ? void 0 : { "--q1-avatar-size": `${t}px` }, Mt = (t) => {
|
|
2246
|
+
const n = t.trim();
|
|
2247
|
+
return n ? new RegExp("\\p{Script=Han}", "u").test(n[0]) ? n[0] : n.split(/\s+/).slice(0, 2).map((r) => r[0]).join("").toUpperCase() : "";
|
|
2248
|
+
};
|
|
2249
|
+
function Et({ title: t, src: n, letter: r, glyph: a, placeholder: l = !1, icon: s, iconColor: o, size: u, className: c }) {
|
|
2250
|
+
const [_, d] = E(null), b = He(u), p = !!n && _ !== n, m = t.trim() || "头像", y = r ? { variant: "avatar--letter", node: r } : a ? { variant: "avatar--glyph", node: a } : { variant: "avatar--letter", node: Mt(t) }, k = l ? "avatar--placeholder" : p ? "avatar--image" : y.variant, f = l ? { "aria-hidden": !0 } : p ? {} : { role: "img", "aria-label": m };
|
|
2251
|
+
return /* @__PURE__ */ i("span", { className: ["avatar", k, c].filter(Boolean).join(" "), style: Ue(b), ...f, children: [
|
|
2252
|
+
p ? /* @__PURE__ */ e(
|
|
2253
|
+
"img",
|
|
2254
|
+
{
|
|
2255
|
+
className: "avatar__img",
|
|
2256
|
+
src: n,
|
|
2257
|
+
alt: m,
|
|
2258
|
+
width: b ?? 32,
|
|
2259
|
+
height: b ?? 32,
|
|
2260
|
+
onError: () => d(n ?? null)
|
|
2261
|
+
}
|
|
2262
|
+
) : l ? null : /* @__PURE__ */ e("span", { className: "avatar__glyph", "aria-hidden": "true", children: y.node }),
|
|
2263
|
+
s ? /* @__PURE__ */ e(
|
|
2264
|
+
"span",
|
|
2265
|
+
{
|
|
2266
|
+
className: "avatar__badge",
|
|
2267
|
+
"aria-hidden": "true",
|
|
2268
|
+
style: o ? { "--q1-avatar-badge-bg": o } : void 0,
|
|
2269
|
+
children: s
|
|
2270
|
+
}
|
|
2271
|
+
) : null
|
|
2272
|
+
] });
|
|
2273
|
+
}
|
|
2274
|
+
function Un({
|
|
2275
|
+
members: t,
|
|
2276
|
+
label: n,
|
|
2277
|
+
size: r,
|
|
2278
|
+
limit: a,
|
|
2279
|
+
overlap: l = "auto",
|
|
2280
|
+
reverse: s = !1,
|
|
2281
|
+
className: o
|
|
2282
|
+
}) {
|
|
2283
|
+
const u = He(r), c = u ?? 32, _ = a !== void 0 && Number.isFinite(a) && a >= 0 ? Math.floor(a) : void 0, d = _ !== void 0 && t.length > _ ? t.slice(0, _) : t, b = t.length - d.length, p = d.length + (b > 0 ? 1 : 0), m = l !== "auto" && Number.isFinite(l) ? Math.max(0, l) : Math.round(c * 0.3), y = { ...Ue(u), "--q1-avatar-overlap": `${m}px` }, k = (N) => s ? void 0 : p - 1 - N, f = n ? { role: "group", "aria-label": n } : {};
|
|
2284
|
+
return /* @__PURE__ */ i("span", { className: ["avatar-group", o].filter(Boolean).join(" "), style: y, ...f, children: [
|
|
2285
|
+
d.map((N, v) => (
|
|
2286
|
+
// 成员不再 aria-hidden——每个 Avatar 自带 aria-label(名字),读屏逐个念(跟 Geist)。
|
|
2287
|
+
/* @__PURE__ */ e("span", { className: "avatar-group__item", style: { zIndex: k(v) }, children: /* @__PURE__ */ e(Et, { ...N, size: u }) }, `${N.title}-${v}`)
|
|
2288
|
+
)),
|
|
2289
|
+
b > 0 ? (
|
|
2290
|
+
// +N 独立可访问名「还有 N 位成员」(对齐 Geist "N more avatars in this group"),不再 aria-hidden。
|
|
2291
|
+
/* @__PURE__ */ i(
|
|
2292
|
+
"span",
|
|
2293
|
+
{
|
|
2294
|
+
className: "avatar avatar--overflow avatar-group__item",
|
|
2295
|
+
style: { zIndex: k(d.length) },
|
|
2296
|
+
role: "img",
|
|
2297
|
+
"aria-label": `还有 ${b} 位成员`,
|
|
2298
|
+
children: [
|
|
2299
|
+
"+",
|
|
2300
|
+
b
|
|
2301
|
+
]
|
|
2302
|
+
}
|
|
2303
|
+
)
|
|
2304
|
+
) : null
|
|
2305
|
+
] });
|
|
2306
|
+
}
|
|
2307
|
+
function Yn({
|
|
2308
|
+
shape: t = "rounded",
|
|
2309
|
+
animated: n = !0,
|
|
2310
|
+
show: r = !1,
|
|
2311
|
+
className: a,
|
|
2312
|
+
children: l
|
|
2313
|
+
}) {
|
|
2314
|
+
if (l && r) return /* @__PURE__ */ e(F, { children: l });
|
|
2315
|
+
const s = [
|
|
2316
|
+
"skeleton",
|
|
2317
|
+
`skeleton--${t}`,
|
|
2318
|
+
n ? "" : "skeleton--static",
|
|
2319
|
+
l ? "skeleton--wrap" : "",
|
|
2320
|
+
a ?? ""
|
|
2321
|
+
].filter(Boolean).join(" ");
|
|
2322
|
+
return l ? /* @__PURE__ */ e("span", { className: s, "aria-hidden": "true", children: /* @__PURE__ */ e("span", { className: "skeleton__content", children: l }) }) : /* @__PURE__ */ e("span", { className: s, "aria-hidden": "true" });
|
|
2323
|
+
}
|
|
2324
|
+
const It = { sm: 2, md: 3, lg: 4 };
|
|
2325
|
+
function Gn({ label: t, size: n = "md" }) {
|
|
2326
|
+
const r = typeof n == "number" ? n : It[n], a = { width: r, height: r };
|
|
2327
|
+
return /* @__PURE__ */ i("span", { className: "loading-dots-wrap", "aria-live": "polite", children: [
|
|
2328
|
+
t ? /* @__PURE__ */ e("span", { className: "loading-dots__label", children: t }) : null,
|
|
2329
|
+
/* @__PURE__ */ i("span", { className: "loading-dots", "aria-hidden": "true", children: [
|
|
2330
|
+
/* @__PURE__ */ e("span", { className: "loading-dots__dot", style: a }),
|
|
2331
|
+
/* @__PURE__ */ e("span", { className: "loading-dots__dot", style: a }),
|
|
2332
|
+
/* @__PURE__ */ e("span", { className: "loading-dots__dot", style: a })
|
|
2333
|
+
] })
|
|
2334
|
+
] });
|
|
2335
|
+
}
|
|
2336
|
+
function Vn({ text: t, tailLength: n = 8, mono: r = !1 }) {
|
|
2337
|
+
const a = Math.max(0, t.length - n), l = t.slice(0, a), s = t.slice(a);
|
|
2338
|
+
return /* @__PURE__ */ i("span", { className: `middle-truncate${r ? " middle-truncate--mono" : ""}`, title: t, "aria-label": t, children: [
|
|
2339
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: t }),
|
|
2340
|
+
/* @__PURE__ */ i("span", { className: "middle-truncate__visual", "aria-hidden": "true", children: [
|
|
2341
|
+
/* @__PURE__ */ e("span", { className: "middle-truncate__head", children: l }),
|
|
2342
|
+
/* @__PURE__ */ e("span", { className: "middle-truncate__tail", children: s })
|
|
2343
|
+
] })
|
|
2344
|
+
] });
|
|
2345
|
+
}
|
|
2346
|
+
function Xn({ screenLabel: t }) {
|
|
2347
|
+
return /* @__PURE__ */ i("div", { className: "phone", children: [
|
|
2348
|
+
/* @__PURE__ */ e("span", { className: "phone__island", "aria-hidden": "true" }),
|
|
2349
|
+
/* @__PURE__ */ e("span", { className: "phone__btn phone__btn--mute", "aria-hidden": "true" }),
|
|
2350
|
+
/* @__PURE__ */ e("span", { className: "phone__btn phone__btn--vol-up", "aria-hidden": "true" }),
|
|
2351
|
+
/* @__PURE__ */ e("span", { className: "phone__btn phone__btn--vol-down", "aria-hidden": "true" }),
|
|
2352
|
+
/* @__PURE__ */ e("span", { className: "phone__btn phone__btn--power", "aria-hidden": "true" }),
|
|
2353
|
+
/* @__PURE__ */ i("div", { className: "phone__screen", role: "img", "aria-label": t, children: [
|
|
2354
|
+
/* @__PURE__ */ i("div", { className: "phone-mock", "aria-hidden": "true", children: [
|
|
2355
|
+
/* @__PURE__ */ i("div", { className: "phone-mock__statusbar", children: [
|
|
2356
|
+
/* @__PURE__ */ e("span", { children: "9:41" }),
|
|
2357
|
+
/* @__PURE__ */ e("span", { className: "phone-mock__signal" })
|
|
2358
|
+
] }),
|
|
2359
|
+
/* @__PURE__ */ e("div", { className: "phone-mock__header", children: "订单" }),
|
|
2360
|
+
/* @__PURE__ */ i("ul", { className: "phone-mock__list", children: [
|
|
2361
|
+
/* @__PURE__ */ i("li", { className: "phone-mock__row", children: [
|
|
2362
|
+
/* @__PURE__ */ e("span", { children: "SO-0042" }),
|
|
2363
|
+
/* @__PURE__ */ e("span", { className: "phone-mock__tag", children: "待发货" })
|
|
2364
|
+
] }),
|
|
2365
|
+
/* @__PURE__ */ i("li", { className: "phone-mock__row", children: [
|
|
2366
|
+
/* @__PURE__ */ e("span", { children: "SO-0041" }),
|
|
2367
|
+
/* @__PURE__ */ e("span", { className: "phone-mock__tag", children: "已发货" })
|
|
2368
|
+
] }),
|
|
2369
|
+
/* @__PURE__ */ i("li", { className: "phone-mock__row", children: [
|
|
2370
|
+
/* @__PURE__ */ e("span", { children: "SO-0040" }),
|
|
2371
|
+
/* @__PURE__ */ e("span", { className: "phone-mock__tag phone-mock__tag--done", children: "已完成" })
|
|
2372
|
+
] }),
|
|
2373
|
+
/* @__PURE__ */ i("li", { className: "phone-mock__row", children: [
|
|
2374
|
+
/* @__PURE__ */ e("span", { children: "SO-0039" }),
|
|
2375
|
+
/* @__PURE__ */ e("span", { className: "phone-mock__tag phone-mock__tag--done", children: "已完成" })
|
|
2376
|
+
] })
|
|
2377
|
+
] })
|
|
2378
|
+
] }),
|
|
2379
|
+
/* @__PURE__ */ e("span", { className: "phone__home", "aria-hidden": "true" })
|
|
2380
|
+
] })
|
|
2381
|
+
] });
|
|
2382
|
+
}
|
|
2383
|
+
const St = {
|
|
2384
|
+
default: re,
|
|
2385
|
+
success: ht,
|
|
2386
|
+
warning: oe,
|
|
2387
|
+
error: be
|
|
2388
|
+
};
|
|
2389
|
+
function Zn({ variant: t = "default", message: n, cta: r }) {
|
|
2390
|
+
const a = St[t];
|
|
2391
|
+
return /* @__PURE__ */ i("div", { className: `project-banner project-banner--${t}`, role: "status", children: [
|
|
2392
|
+
/* @__PURE__ */ e(a, { className: "project-banner__icon", size: 15, strokeWidth: 2, "aria-hidden": "true" }),
|
|
2393
|
+
/* @__PURE__ */ e("span", { className: "project-banner__message", children: n }),
|
|
2394
|
+
/* @__PURE__ */ e("button", { type: "button", className: "project-banner__cta", children: r })
|
|
2395
|
+
] });
|
|
2396
|
+
}
|
|
2397
|
+
function Qn({
|
|
2398
|
+
text: t,
|
|
2399
|
+
copyValue: n,
|
|
2400
|
+
successMessage: r,
|
|
2401
|
+
size: a = "default"
|
|
2402
|
+
}) {
|
|
2403
|
+
const { copied: l, copy: s } = ie(), o = n ?? t;
|
|
2404
|
+
return /* @__PURE__ */ i("span", { className: `twc twc--${a}`, children: [
|
|
2405
|
+
/* @__PURE__ */ e("span", { className: "twc__text", children: t }),
|
|
2406
|
+
/* @__PURE__ */ e(
|
|
2407
|
+
"button",
|
|
2408
|
+
{
|
|
2409
|
+
type: "button",
|
|
2410
|
+
className: "twc__copy",
|
|
2411
|
+
"aria-label": `复制${t}`,
|
|
2412
|
+
onClick: () => s(o, r),
|
|
2413
|
+
children: l ? /* @__PURE__ */ e(j, { size: 14, strokeWidth: 2, "aria-hidden": "true" }) : /* @__PURE__ */ e(ee, { size: 14, strokeWidth: 2, "aria-hidden": "true" })
|
|
2414
|
+
}
|
|
2415
|
+
)
|
|
2416
|
+
] });
|
|
2417
|
+
}
|
|
2418
|
+
function Jn({
|
|
2419
|
+
text: t,
|
|
2420
|
+
prompt: n = !0,
|
|
2421
|
+
inverted: r = !1,
|
|
2422
|
+
tone: a,
|
|
2423
|
+
copyText: l,
|
|
2424
|
+
onCopy: s
|
|
2425
|
+
}) {
|
|
2426
|
+
const { copied: o, copy: u } = ie(), c = Array.isArray(t) ? t : [t], _ = ["snippet", r ? "snippet--inverted" : "", a ? `snippet--${a}` : ""].filter(Boolean).join(" ");
|
|
2427
|
+
return /* @__PURE__ */ i("div", { className: _, children: [
|
|
2428
|
+
/* @__PURE__ */ e("code", { className: "snippet__code", children: c.map((d, b) => /* @__PURE__ */ i("span", { className: "snippet__line", children: [
|
|
2429
|
+
n ? /* @__PURE__ */ i("span", { className: "snippet__prompt", "aria-hidden": "true", children: [
|
|
2430
|
+
"$",
|
|
2431
|
+
" "
|
|
2432
|
+
] }) : null,
|
|
2433
|
+
d
|
|
2434
|
+
] }, b)) }),
|
|
2435
|
+
/* @__PURE__ */ e(
|
|
2436
|
+
"button",
|
|
2437
|
+
{
|
|
2438
|
+
type: "button",
|
|
2439
|
+
className: "snippet__copy",
|
|
2440
|
+
"aria-label": "复制命令",
|
|
2441
|
+
onClick: () => {
|
|
2442
|
+
u(l ?? c.join(`
|
|
2443
|
+
`), "已复制命令"), s?.();
|
|
2444
|
+
},
|
|
2445
|
+
children: o ? /* @__PURE__ */ e(j, { size: 14, strokeWidth: 2, "aria-hidden": "true" }) : /* @__PURE__ */ e(ee, { size: 14, strokeWidth: 2, "aria-hidden": "true" })
|
|
2446
|
+
}
|
|
2447
|
+
)
|
|
2448
|
+
] });
|
|
2449
|
+
}
|
|
2450
|
+
function At(t, n) {
|
|
2451
|
+
return t >= 95 ? "danger" : t >= 80 ? "warning" : "success";
|
|
2452
|
+
}
|
|
2453
|
+
const Tt = {
|
|
2454
|
+
xs: { boxPx: 20, radius: 42.5, strokeWidth: 15, valueFontSize: null },
|
|
2455
|
+
sm: { boxPx: 32, radius: 45, strokeWidth: 10, valueFontSize: 11 },
|
|
2456
|
+
md: { boxPx: 64, radius: 45, strokeWidth: 10, valueFontSize: 18 },
|
|
2457
|
+
lg: { boxPx: 128, radius: 45, strokeWidth: 10, valueFontSize: 32 }
|
|
2458
|
+
}, zt = 10, xe = { success: 80, warning: 50 };
|
|
2459
|
+
function Wt(t, n, r) {
|
|
2460
|
+
const a = Math.min(zt, t, 100 - t);
|
|
2461
|
+
if (a <= 0) return 0;
|
|
2462
|
+
if (!(100 - t - a <= 0)) return a;
|
|
2463
|
+
const s = n / r * 100;
|
|
2464
|
+
return a < s ? 0 : a;
|
|
2465
|
+
}
|
|
2466
|
+
function Bt(t, n, r) {
|
|
2467
|
+
return r || (n === "health" ? t >= xe.success ? "success" : t >= xe.warning ? "warning" : "danger" : At(t));
|
|
2468
|
+
}
|
|
2469
|
+
function ea({
|
|
2470
|
+
value: t,
|
|
2471
|
+
size: n = "md",
|
|
2472
|
+
showValue: r = !1,
|
|
2473
|
+
tone: a,
|
|
2474
|
+
toneDirection: l = "quota",
|
|
2475
|
+
label: s,
|
|
2476
|
+
indeterminate: o = !1
|
|
2477
|
+
}) {
|
|
2478
|
+
const { boxPx: u, radius: c, strokeWidth: _, valueFontSize: d } = Tt[n], b = 2 * Math.PI * c, p = Math.min(100, Math.max(0, t ?? 0)), m = 50, y = o ? 25 : p, k = o ? 0 : Wt(p, _, b), f = o ? 0 : Math.max(0, 100 - p - k), N = -90 + (y + k / 2) / 100 * 360, v = o ? "primary" : Bt(p, l, a);
|
|
2479
|
+
return /* @__PURE__ */ i(
|
|
2480
|
+
"span",
|
|
2481
|
+
{
|
|
2482
|
+
className: `gauge gauge--${n}${o ? " gauge--indeterminate" : ""}`,
|
|
2483
|
+
role: "progressbar",
|
|
2484
|
+
"aria-label": s,
|
|
2485
|
+
"aria-valuemin": o ? void 0 : 0,
|
|
2486
|
+
"aria-valuemax": o ? void 0 : 100,
|
|
2487
|
+
"aria-valuenow": o ? void 0 : p,
|
|
2488
|
+
children: [
|
|
2489
|
+
/* @__PURE__ */ i("svg", { className: "gauge__svg", width: u, height: u, viewBox: "0 0 100 100", "aria-hidden": "true", children: [
|
|
2490
|
+
/* @__PURE__ */ e(
|
|
2491
|
+
"circle",
|
|
2492
|
+
{
|
|
2493
|
+
className: "gauge__track",
|
|
2494
|
+
cx: m,
|
|
2495
|
+
cy: m,
|
|
2496
|
+
r: c,
|
|
2497
|
+
strokeWidth: _,
|
|
2498
|
+
fill: "none",
|
|
2499
|
+
strokeLinecap: "round",
|
|
2500
|
+
strokeDasharray: `${f / 100 * b} ${b}`,
|
|
2501
|
+
transform: `rotate(${N} ${m} ${m})`
|
|
2502
|
+
}
|
|
2503
|
+
),
|
|
2504
|
+
/* @__PURE__ */ e(
|
|
2505
|
+
"circle",
|
|
2506
|
+
{
|
|
2507
|
+
className: `gauge__arc gauge__arc--${v}`,
|
|
2508
|
+
cx: m,
|
|
2509
|
+
cy: m,
|
|
2510
|
+
r: c,
|
|
2511
|
+
strokeWidth: _,
|
|
2512
|
+
fill: "none",
|
|
2513
|
+
strokeLinecap: "round",
|
|
2514
|
+
strokeDasharray: `${y / 100 * b} ${b}`,
|
|
2515
|
+
transform: `rotate(-90 ${m} ${m})`
|
|
2516
|
+
}
|
|
2517
|
+
)
|
|
2518
|
+
] }),
|
|
2519
|
+
r && d ? /* @__PURE__ */ e("span", { className: "gauge__value", style: { fontSize: d }, children: p }) : null
|
|
2520
|
+
]
|
|
2521
|
+
}
|
|
2522
|
+
);
|
|
2523
|
+
}
|
|
2524
|
+
function ta({
|
|
2525
|
+
value: t,
|
|
2526
|
+
max: n = 100,
|
|
2527
|
+
tone: r = "neutral",
|
|
2528
|
+
slim: a = !1,
|
|
2529
|
+
stops: l,
|
|
2530
|
+
label: s
|
|
2531
|
+
}) {
|
|
2532
|
+
const o = n > 0 && Number.isFinite(t) ? Math.min(n, Math.max(0, t)) : 0, u = n > 0 ? o / n * 100 : 0;
|
|
2533
|
+
return /* @__PURE__ */ i(
|
|
2534
|
+
"div",
|
|
2535
|
+
{
|
|
2536
|
+
className: `progress${a ? " progress--slim" : ""}`,
|
|
2537
|
+
role: "progressbar",
|
|
2538
|
+
"aria-label": s,
|
|
2539
|
+
"aria-valuemin": 0,
|
|
2540
|
+
"aria-valuemax": n,
|
|
2541
|
+
"aria-valuenow": o,
|
|
2542
|
+
children: [
|
|
2543
|
+
/* @__PURE__ */ e("div", { className: "progress__track", children: /* @__PURE__ */ e("div", { className: `progress__fill progress__fill--${r}`, style: { width: `${u}%` } }) }),
|
|
2544
|
+
l?.map((c) => {
|
|
2545
|
+
const _ = typeof c == "number" ? c : c.at;
|
|
2546
|
+
if (!(_ > 0 && _ < 100)) return null;
|
|
2547
|
+
const d = typeof c == "number" ? `${c}%` : c.label ?? `${c.at}%`;
|
|
2548
|
+
return /* @__PURE__ */ i("span", { className: "progress__stop", style: { left: `calc(${_}% - 7px)` }, children: [
|
|
2549
|
+
/* @__PURE__ */ e("span", { className: "progress__stop-line progress__stop-line--tick" }),
|
|
2550
|
+
/* @__PURE__ */ e("span", { className: "progress__stop-line progress__stop-line--cut" }),
|
|
2551
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: d }),
|
|
2552
|
+
/* @__PURE__ */ e("span", { className: "progress__stop-tip", "aria-hidden": "true", children: d })
|
|
2553
|
+
] }, _);
|
|
2554
|
+
})
|
|
2555
|
+
]
|
|
2556
|
+
}
|
|
2557
|
+
);
|
|
2558
|
+
}
|
|
2559
|
+
const Lt = {
|
|
2560
|
+
info: re,
|
|
2561
|
+
success: We,
|
|
2562
|
+
warning: oe,
|
|
2563
|
+
error: Be,
|
|
2564
|
+
secondary: re
|
|
2565
|
+
};
|
|
2566
|
+
function na({
|
|
2567
|
+
type: t = "info",
|
|
2568
|
+
size: n = "default",
|
|
2569
|
+
filled: r = !1,
|
|
2570
|
+
disabled: a = !1,
|
|
2571
|
+
label: l,
|
|
2572
|
+
action: s,
|
|
2573
|
+
children: o
|
|
2574
|
+
}) {
|
|
2575
|
+
const u = Lt[t], c = [
|
|
2576
|
+
"note",
|
|
2577
|
+
`note--${t}`,
|
|
2578
|
+
`note--${n}`,
|
|
2579
|
+
r ? "note--filled" : "",
|
|
2580
|
+
a ? "note--disabled" : ""
|
|
2581
|
+
].filter(Boolean).join(" ");
|
|
2582
|
+
return /* @__PURE__ */ i("div", { className: c, role: "note", children: [
|
|
2583
|
+
/* @__PURE__ */ e(u, { className: "note__icon", size: 16, strokeWidth: 2, "aria-hidden": "true" }),
|
|
2584
|
+
/* @__PURE__ */ i("p", { className: "note__body", children: [
|
|
2585
|
+
l ? /* @__PURE__ */ e("span", { className: "note__label", children: l }) : null,
|
|
2586
|
+
/* @__PURE__ */ e("span", { className: "note__text", children: o })
|
|
2587
|
+
] }),
|
|
2588
|
+
s ? /* @__PURE__ */ e("button", { type: "button", className: "note__action", disabled: a, children: s }) : null
|
|
2589
|
+
] });
|
|
2590
|
+
}
|
|
2591
|
+
function aa({ previous: t, next: n }) {
|
|
2592
|
+
const r = (a) => a.preventDefault();
|
|
2593
|
+
return /* @__PURE__ */ i("nav", { className: "pagination", "aria-label": "分页导航", children: [
|
|
2594
|
+
t ? /* @__PURE__ */ i(
|
|
2595
|
+
"a",
|
|
2596
|
+
{
|
|
2597
|
+
className: "pagination__link pagination__link--prev",
|
|
2598
|
+
href: "#",
|
|
2599
|
+
"aria-label": `前往上一页:${t.title}`,
|
|
2600
|
+
onClick: r,
|
|
2601
|
+
children: [
|
|
2602
|
+
/* @__PURE__ */ e("span", { className: "pagination__label", children: "上一页" }),
|
|
2603
|
+
/* @__PURE__ */ i("span", { className: "pagination__title-frame", children: [
|
|
2604
|
+
/* @__PURE__ */ e("span", { className: "pagination__title", children: t.title }),
|
|
2605
|
+
/* @__PURE__ */ e("span", { className: "pagination__chevron-slot", "aria-hidden": "true", children: /* @__PURE__ */ e(_e, { className: "pagination__chevron", size: 20, strokeWidth: 2 }) })
|
|
2606
|
+
] })
|
|
2607
|
+
]
|
|
2608
|
+
}
|
|
2609
|
+
) : /* @__PURE__ */ e("span", { className: "pagination__slot" }),
|
|
2610
|
+
n ? /* @__PURE__ */ i(
|
|
2611
|
+
"a",
|
|
2612
|
+
{
|
|
2613
|
+
className: "pagination__link pagination__link--next",
|
|
2614
|
+
href: "#",
|
|
2615
|
+
"aria-label": `前往下一页:${n.title}`,
|
|
2616
|
+
onClick: r,
|
|
2617
|
+
children: [
|
|
2618
|
+
/* @__PURE__ */ e("span", { className: "pagination__label", children: "下一页" }),
|
|
2619
|
+
/* @__PURE__ */ i("span", { className: "pagination__title-frame", children: [
|
|
2620
|
+
/* @__PURE__ */ e("span", { className: "pagination__title", children: n.title }),
|
|
2621
|
+
/* @__PURE__ */ e("span", { className: "pagination__chevron-slot", "aria-hidden": "true", children: /* @__PURE__ */ e(O, { className: "pagination__chevron", size: 20, strokeWidth: 2 }) })
|
|
2622
|
+
] })
|
|
2623
|
+
]
|
|
2624
|
+
}
|
|
2625
|
+
) : /* @__PURE__ */ e("span", { className: "pagination__slot" })
|
|
2626
|
+
] });
|
|
2627
|
+
}
|
|
2628
|
+
function ra({
|
|
2629
|
+
items: t,
|
|
2630
|
+
initial: n = 4,
|
|
2631
|
+
noBorder: r,
|
|
2632
|
+
initialExpanded: a = !1
|
|
2633
|
+
}) {
|
|
2634
|
+
const [l, s] = E(a), o = W(), u = l ? t : t.slice(0, n), c = t.length - n;
|
|
2635
|
+
return /* @__PURE__ */ i("div", { className: "show-more", children: [
|
|
2636
|
+
/* @__PURE__ */ e("ul", { className: "show-more__list", id: o, children: u.map((_) => /* @__PURE__ */ e("li", { className: "show-more__row", children: _ }, _)) }),
|
|
2637
|
+
c > 0 ? /* @__PURE__ */ e("div", { className: `show-more__trigger-row${r ? " show-more__trigger-row--no-border" : ""}`, children: /* @__PURE__ */ i(
|
|
2638
|
+
"button",
|
|
2639
|
+
{
|
|
2640
|
+
type: "button",
|
|
2641
|
+
className: "show-more__trigger",
|
|
2642
|
+
"aria-expanded": l,
|
|
2643
|
+
"aria-controls": o,
|
|
2644
|
+
onClick: () => s((_) => !_),
|
|
2645
|
+
children: [
|
|
2646
|
+
l ? "收起" : `显示更多 ${c} 项`,
|
|
2647
|
+
l ? /* @__PURE__ */ e(ze, { size: 14, strokeWidth: 2, "aria-hidden": "true" }) : /* @__PURE__ */ e(K, { size: 14, strokeWidth: 2, "aria-hidden": "true" })
|
|
2648
|
+
]
|
|
2649
|
+
}
|
|
2650
|
+
) }) : null
|
|
2651
|
+
] });
|
|
2652
|
+
}
|
|
2653
|
+
function la({
|
|
2654
|
+
loading: t,
|
|
2655
|
+
noGap: n,
|
|
2656
|
+
noBorderRadius: r,
|
|
2657
|
+
onClick: a,
|
|
2658
|
+
children: l
|
|
2659
|
+
}) {
|
|
2660
|
+
return /* @__PURE__ */ i(
|
|
2661
|
+
"button",
|
|
2662
|
+
{
|
|
2663
|
+
type: "button",
|
|
2664
|
+
className: [
|
|
2665
|
+
"load-more-btn",
|
|
2666
|
+
n ? "load-more-btn--no-gap" : "",
|
|
2667
|
+
r ? "load-more-btn--no-border-radius" : ""
|
|
2668
|
+
].filter(Boolean).join(" "),
|
|
2669
|
+
"aria-busy": t || void 0,
|
|
2670
|
+
disabled: t,
|
|
2671
|
+
onClick: a,
|
|
2672
|
+
children: [
|
|
2673
|
+
t ? /* @__PURE__ */ e(se, { className: "load-more-btn__spinner", size: 16, strokeWidth: 2, "aria-hidden": "true" }) : null,
|
|
2674
|
+
l
|
|
2675
|
+
]
|
|
2676
|
+
}
|
|
2677
|
+
);
|
|
2678
|
+
}
|
|
2679
|
+
function Rt(t) {
|
|
2680
|
+
const n = t.match(/([+-])(\d{2}):?(\d{2})$/);
|
|
2681
|
+
if (!n) return "UTC";
|
|
2682
|
+
const r = String(Number(n[2]));
|
|
2683
|
+
return `GMT${n[1]}${r}${n[3] !== "00" ? `:${n[3]}` : ""}`;
|
|
2684
|
+
}
|
|
2685
|
+
function sa({
|
|
2686
|
+
relative: t,
|
|
2687
|
+
relativeLong: n,
|
|
2688
|
+
iso: r,
|
|
2689
|
+
local: a,
|
|
2690
|
+
utc: l
|
|
2691
|
+
}) {
|
|
2692
|
+
const s = Rt(r);
|
|
2693
|
+
return /* @__PURE__ */ i("span", { className: "rtc-wrap", children: [
|
|
2694
|
+
/* @__PURE__ */ e("time", { className: "rtc-trigger", dateTime: r, tabIndex: 0, children: t }),
|
|
2695
|
+
/* @__PURE__ */ i("span", { className: "rtc-card", role: "group", "aria-label": `${n},UTC ${l},${s} ${a}`, children: [
|
|
2696
|
+
/* @__PURE__ */ e("span", { className: "rtc-card__relative", children: n }),
|
|
2697
|
+
/* @__PURE__ */ i("span", { className: "rtc-card__row", children: [
|
|
2698
|
+
/* @__PURE__ */ e("span", { className: "rtc-card__zone", children: "UTC" }),
|
|
2699
|
+
/* @__PURE__ */ e("span", { className: "rtc-card__value", children: l })
|
|
2700
|
+
] }),
|
|
2701
|
+
/* @__PURE__ */ i("span", { className: "rtc-card__row", children: [
|
|
2702
|
+
/* @__PURE__ */ e("span", { className: "rtc-card__zone", children: s }),
|
|
2703
|
+
/* @__PURE__ */ e("span", { className: "rtc-card__value", children: a })
|
|
2704
|
+
] })
|
|
2705
|
+
] })
|
|
2706
|
+
] });
|
|
2707
|
+
}
|
|
2708
|
+
const Ft = { sm: 10, md: 12, lg: 15, xl: 15 };
|
|
2709
|
+
function oa({
|
|
2710
|
+
size: t = "md",
|
|
2711
|
+
tone: n = "default",
|
|
2712
|
+
label: r = "加载中…"
|
|
2713
|
+
}) {
|
|
2714
|
+
const a = ["spinner", `spinner--${t}`, n !== "default" ? `spinner--${n}` : ""].filter(Boolean).join(" "), l = Ft[t];
|
|
2715
|
+
return /* @__PURE__ */ i("span", { className: a, role: "status", children: [
|
|
2716
|
+
Array.from({ length: l }, (s, o) => /* @__PURE__ */ e(
|
|
2717
|
+
"span",
|
|
2718
|
+
{
|
|
2719
|
+
className: "spinner__bar",
|
|
2720
|
+
"aria-hidden": "true",
|
|
2721
|
+
style: {
|
|
2722
|
+
transform: `rotate(${360 / l * o}deg)`,
|
|
2723
|
+
animationDelay: `${(-(l - 1 - o) * 1.2 / l).toFixed(3)}s`
|
|
2724
|
+
}
|
|
2725
|
+
},
|
|
2726
|
+
o
|
|
2727
|
+
)),
|
|
2728
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: r })
|
|
2729
|
+
] });
|
|
2730
|
+
}
|
|
2731
|
+
const Ce = "/video-sample.mp4", Kt = "/video-poster.jpg", Pt = typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2732
|
+
function ia({ controls: t = !0, loop: n = !0 }) {
|
|
2733
|
+
const r = !t;
|
|
2734
|
+
return /* @__PURE__ */ i(
|
|
2735
|
+
"video",
|
|
2736
|
+
{
|
|
2737
|
+
className: "ds-video",
|
|
2738
|
+
src: Ce,
|
|
2739
|
+
poster: Kt,
|
|
2740
|
+
width: 1280,
|
|
2741
|
+
height: 720,
|
|
2742
|
+
controls: t,
|
|
2743
|
+
loop: n,
|
|
2744
|
+
muted: !0,
|
|
2745
|
+
playsInline: !0,
|
|
2746
|
+
preload: r ? "auto" : "none",
|
|
2747
|
+
autoPlay: r && !Pt,
|
|
2748
|
+
...r ? { "aria-hidden": !0 } : { "aria-label": "产品演示视频" },
|
|
2749
|
+
children: [
|
|
2750
|
+
"您的浏览器不支持内嵌视频,",
|
|
2751
|
+
/* @__PURE__ */ e("a", { href: Ce, children: "下载视频" }),
|
|
2752
|
+
"。"
|
|
2753
|
+
]
|
|
2754
|
+
}
|
|
2755
|
+
);
|
|
2756
|
+
}
|
|
2757
|
+
const $e = /mac/i.test(navigator.platform);
|
|
2758
|
+
function ca({
|
|
2759
|
+
meta: t,
|
|
2760
|
+
shift: n,
|
|
2761
|
+
alt: r,
|
|
2762
|
+
ctrl: a,
|
|
2763
|
+
small: l,
|
|
2764
|
+
children: s
|
|
2765
|
+
}) {
|
|
2766
|
+
return /* @__PURE__ */ i("kbd", { className: `kbd${l ? " kbd--small" : ""}`, children: [
|
|
2767
|
+
t ? $e ? "⌘" : /* @__PURE__ */ e("span", { "aria-label": "Control", children: "Ctrl" }) : null,
|
|
2768
|
+
t && !$e && !!(n || r || a || s) ? /* @__PURE__ */ e("span", { "aria-hidden": "true", children: "+" }) : null,
|
|
2769
|
+
n ? "⇧" : null,
|
|
2770
|
+
r ? "⌥" : null,
|
|
2771
|
+
a ? "⌃" : null,
|
|
2772
|
+
s
|
|
2773
|
+
] });
|
|
2774
|
+
}
|
|
2775
|
+
const Ye = "q1travel-design-system-theme", ce = "q1travel-theme-change";
|
|
2776
|
+
function De() {
|
|
2777
|
+
const t = window.localStorage.getItem(Ye);
|
|
2778
|
+
return t === "light" || t === "dark" || t === "system" ? t : "system";
|
|
2779
|
+
}
|
|
2780
|
+
function de(t) {
|
|
2781
|
+
const n = document.documentElement, r = t === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : t;
|
|
2782
|
+
n.dataset.themeMode = t, n.dataset.theme = r;
|
|
2783
|
+
const a = document.querySelector("#q1-theme-color"), l = r === "dark" ? a?.dataset.dark : a?.dataset.light;
|
|
2784
|
+
a && l && a.setAttribute("content", l);
|
|
2785
|
+
}
|
|
2786
|
+
function jt() {
|
|
2787
|
+
const [t, n] = E(De);
|
|
2788
|
+
return B(() => {
|
|
2789
|
+
de(t);
|
|
2790
|
+
const a = window.matchMedia("(prefers-color-scheme: dark)"), l = () => t === "system" && de("system"), s = () => n(De());
|
|
2791
|
+
return a.addEventListener("change", l), window.addEventListener(ce, s), window.addEventListener("storage", s), () => {
|
|
2792
|
+
a.removeEventListener("change", l), window.removeEventListener(ce, s), window.removeEventListener("storage", s);
|
|
2793
|
+
};
|
|
2794
|
+
}, [t]), [t, (a) => {
|
|
2795
|
+
window.localStorage.setItem(Ye, a), de(a), n(a), window.dispatchEvent(new Event(ce));
|
|
2796
|
+
}];
|
|
2797
|
+
}
|
|
2798
|
+
const Ot = [
|
|
2799
|
+
{ mode: "system", label: "系统", Icon: dt },
|
|
2800
|
+
{ mode: "light", label: "浅色", Icon: ft },
|
|
2801
|
+
{ mode: "dark", label: "深色", Icon: ut }
|
|
2802
|
+
];
|
|
2803
|
+
function da({ small: t, disabled: n }) {
|
|
2804
|
+
const r = W(), [a, l] = jt();
|
|
2805
|
+
return /* @__PURE__ */ i(
|
|
2806
|
+
"fieldset",
|
|
2807
|
+
{
|
|
2808
|
+
className: `theme-switcher${t ? " theme-switcher--small" : ""}`,
|
|
2809
|
+
disabled: n,
|
|
2810
|
+
children: [
|
|
2811
|
+
/* @__PURE__ */ e("legend", { className: "sr-only", children: "选择显示主题" }),
|
|
2812
|
+
Ot.map(({ mode: s, label: o, Icon: u }) => /* @__PURE__ */ i("label", { className: "theme-switcher__option", children: [
|
|
2813
|
+
/* @__PURE__ */ e(
|
|
2814
|
+
"input",
|
|
2815
|
+
{
|
|
2816
|
+
type: "radio",
|
|
2817
|
+
name: r,
|
|
2818
|
+
value: s,
|
|
2819
|
+
checked: a === s,
|
|
2820
|
+
onChange: () => l(s),
|
|
2821
|
+
className: "sr-only"
|
|
2822
|
+
}
|
|
2823
|
+
),
|
|
2824
|
+
/* @__PURE__ */ e(u, { size: t ? 14 : 16, strokeWidth: 2, "aria-hidden": "true" }),
|
|
2825
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: o })
|
|
2826
|
+
] }, s))
|
|
2827
|
+
]
|
|
2828
|
+
}
|
|
2829
|
+
);
|
|
2830
|
+
}
|
|
2831
|
+
function ua({
|
|
2832
|
+
axis: t,
|
|
2833
|
+
label: n,
|
|
2834
|
+
children: r
|
|
2835
|
+
}) {
|
|
2836
|
+
return /* @__PURE__ */ e("div", { className: `scroller scroller--${t}`, children: /* @__PURE__ */ e("div", { className: "scroller__viewport", tabIndex: 0, role: "group", "aria-label": n, children: r }) });
|
|
2837
|
+
}
|
|
2838
|
+
function ma({
|
|
2839
|
+
axis: t = "horizontal",
|
|
2840
|
+
contentName: n,
|
|
2841
|
+
label: r,
|
|
2842
|
+
children: a
|
|
2843
|
+
}) {
|
|
2844
|
+
const l = I(null), s = t === "horizontal";
|
|
2845
|
+
function o(u) {
|
|
2846
|
+
const c = l.current;
|
|
2847
|
+
if (!c) return;
|
|
2848
|
+
const _ = Array.from(c.children), d = s ? c.scrollLeft : c.scrollTop, b = s ? c.clientWidth : c.clientHeight, p = d + (u === 1 ? b : 0), m = (D) => s ? D.offsetLeft : D.offsetTop, y = (D) => s ? D.offsetLeft + D.offsetWidth : D.offsetTop + D.offsetHeight, k = u === 1 ? _.find((D) => y(D) > p + 1) : [..._].reverse().find((D) => m(D) < d - 1);
|
|
2849
|
+
if (!k) return;
|
|
2850
|
+
const f = window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth";
|
|
2851
|
+
if (s) {
|
|
2852
|
+
k.scrollIntoView({ behavior: f, inline: "start", block: "nearest" });
|
|
2853
|
+
return;
|
|
2854
|
+
}
|
|
2855
|
+
const N = parseFloat(getComputedStyle(c).paddingTop) || 0, v = k.getBoundingClientRect().top - c.getBoundingClientRect().top - N;
|
|
2856
|
+
c.scrollTo({ top: c.scrollTop + v, behavior: f });
|
|
2857
|
+
}
|
|
2858
|
+
return /* @__PURE__ */ i("div", { className: s ? "scroller-buttons" : "scroller-buttons scroller-buttons--vertical", children: [
|
|
2859
|
+
/* @__PURE__ */ e(
|
|
2860
|
+
"button",
|
|
2861
|
+
{
|
|
2862
|
+
type: "button",
|
|
2863
|
+
className: "scroller-buttons__control",
|
|
2864
|
+
"aria-label": `${s ? "向左滚动" : "向上滚动"}${n}`,
|
|
2865
|
+
onClick: () => o(-1),
|
|
2866
|
+
children: s ? /* @__PURE__ */ e(_e, { size: 16, strokeWidth: 2, "aria-hidden": "true" }) : /* @__PURE__ */ e(ze, { size: 16, strokeWidth: 2, "aria-hidden": "true" })
|
|
2867
|
+
}
|
|
2868
|
+
),
|
|
2869
|
+
/* @__PURE__ */ e("div", { className: `scroller scroller--${t} scroller--flush`, children: /* @__PURE__ */ e("div", { className: "scroller__viewport", ref: l, tabIndex: 0, role: "group", "aria-label": r, children: a }) }),
|
|
2870
|
+
/* @__PURE__ */ e(
|
|
2871
|
+
"button",
|
|
2872
|
+
{
|
|
2873
|
+
type: "button",
|
|
2874
|
+
className: "scroller-buttons__control",
|
|
2875
|
+
"aria-label": `${s ? "向右滚动" : "向下滚动"}${n}`,
|
|
2876
|
+
onClick: () => o(1),
|
|
2877
|
+
children: s ? /* @__PURE__ */ e(O, { size: 16, strokeWidth: 2, "aria-hidden": "true" }) : /* @__PURE__ */ e(K, { size: 16, strokeWidth: 2, "aria-hidden": "true" })
|
|
2878
|
+
}
|
|
2879
|
+
)
|
|
2880
|
+
] });
|
|
2881
|
+
}
|
|
2882
|
+
function ha({ label: t, unit: n, min: r = 0, max: a = 100, step: l = 1, defaultValue: s }) {
|
|
2883
|
+
const [o, u] = E(s), c = W(), _ = (o - r) / (a - r) * 100;
|
|
2884
|
+
return /* @__PURE__ */ i("div", { className: "slider-field", children: [
|
|
2885
|
+
/* @__PURE__ */ i("div", { className: "slider-field__head", children: [
|
|
2886
|
+
/* @__PURE__ */ e("label", { className: "slider-field__label", htmlFor: c, children: t }),
|
|
2887
|
+
/* @__PURE__ */ i("output", { className: "slider-field__value", htmlFor: c, children: [
|
|
2888
|
+
o,
|
|
2889
|
+
n
|
|
2890
|
+
] })
|
|
2891
|
+
] }),
|
|
2892
|
+
/* @__PURE__ */ e(
|
|
2893
|
+
"input",
|
|
2894
|
+
{
|
|
2895
|
+
id: c,
|
|
2896
|
+
type: "range",
|
|
2897
|
+
className: "slider-input slider-input--filled",
|
|
2898
|
+
min: r,
|
|
2899
|
+
max: a,
|
|
2900
|
+
step: l,
|
|
2901
|
+
value: o,
|
|
2902
|
+
style: { "--slider-pct": `${_}%` },
|
|
2903
|
+
onChange: (d) => u(Number(d.target.value))
|
|
2904
|
+
}
|
|
2905
|
+
)
|
|
2906
|
+
] });
|
|
2907
|
+
}
|
|
2908
|
+
function pa({ min: t = 0, max: n = 100, step: r = 1, defaultLow: a, defaultHigh: l, disabled: s }) {
|
|
2909
|
+
const [o, u] = E(a), [c, _] = E(l), d = W(), b = W(), p = (o - t) / (n - t) * 100, m = (c - t) / (n - t) * 100, y = (f) => u(Math.min(f, c)), k = (f) => _(Math.max(f, o));
|
|
2910
|
+
return /* @__PURE__ */ i("div", { className: `range-slider${s ? " range-slider--disabled" : ""}`, children: [
|
|
2911
|
+
/* @__PURE__ */ e("label", { className: "sr-only", htmlFor: d, children: "区间下限" }),
|
|
2912
|
+
/* @__PURE__ */ e(
|
|
2913
|
+
"input",
|
|
2914
|
+
{
|
|
2915
|
+
type: "number",
|
|
2916
|
+
className: "range-slider__number",
|
|
2917
|
+
id: d,
|
|
2918
|
+
min: t,
|
|
2919
|
+
max: n,
|
|
2920
|
+
step: r,
|
|
2921
|
+
value: o,
|
|
2922
|
+
disabled: s,
|
|
2923
|
+
onChange: (f) => y(Number(f.target.value))
|
|
2924
|
+
}
|
|
2925
|
+
),
|
|
2926
|
+
/* @__PURE__ */ i("div", { className: "range-slider__track-area", style: { "--low": `${p}%`, "--high": `${m}%` }, children: [
|
|
2927
|
+
/* @__PURE__ */ e("span", { className: "range-slider__rail", "aria-hidden": "true" }),
|
|
2928
|
+
/* @__PURE__ */ e("span", { className: "range-slider__fill", "aria-hidden": "true" }),
|
|
2929
|
+
/* @__PURE__ */ e(
|
|
2930
|
+
"input",
|
|
2931
|
+
{
|
|
2932
|
+
type: "range",
|
|
2933
|
+
className: "slider-input range-slider__thumb range-slider__thumb--low",
|
|
2934
|
+
"aria-label": "区间下限",
|
|
2935
|
+
min: t,
|
|
2936
|
+
max: n,
|
|
2937
|
+
step: r,
|
|
2938
|
+
value: o,
|
|
2939
|
+
disabled: s,
|
|
2940
|
+
onChange: (f) => y(Number(f.target.value))
|
|
2941
|
+
}
|
|
2942
|
+
),
|
|
2943
|
+
/* @__PURE__ */ e(
|
|
2944
|
+
"input",
|
|
2945
|
+
{
|
|
2946
|
+
type: "range",
|
|
2947
|
+
className: "slider-input range-slider__thumb range-slider__thumb--high",
|
|
2948
|
+
"aria-label": "区间上限",
|
|
2949
|
+
min: t,
|
|
2950
|
+
max: n,
|
|
2951
|
+
step: r,
|
|
2952
|
+
value: c,
|
|
2953
|
+
disabled: s,
|
|
2954
|
+
onChange: (f) => k(Number(f.target.value))
|
|
2955
|
+
}
|
|
2956
|
+
)
|
|
2957
|
+
] }),
|
|
2958
|
+
/* @__PURE__ */ e("label", { className: "sr-only", htmlFor: b, children: "区间上限" }),
|
|
2959
|
+
/* @__PURE__ */ e(
|
|
2960
|
+
"input",
|
|
2961
|
+
{
|
|
2962
|
+
type: "number",
|
|
2963
|
+
className: "range-slider__number",
|
|
2964
|
+
id: b,
|
|
2965
|
+
min: t,
|
|
2966
|
+
max: n,
|
|
2967
|
+
step: r,
|
|
2968
|
+
value: c,
|
|
2969
|
+
disabled: s,
|
|
2970
|
+
onChange: (f) => k(Number(f.target.value))
|
|
2971
|
+
}
|
|
2972
|
+
)
|
|
2973
|
+
] });
|
|
2974
|
+
}
|
|
2975
|
+
function ne({ crumb: t }) {
|
|
2976
|
+
const n = /* @__PURE__ */ i(F, { children: [
|
|
2977
|
+
t.icon ? /* @__PURE__ */ e("span", { className: "breadcrumb__icon", "aria-hidden": "true", children: t.icon }) : null,
|
|
2978
|
+
t.label
|
|
2979
|
+
] });
|
|
2980
|
+
return t.isCurrent ? /* @__PURE__ */ e("span", { className: "breadcrumb__link breadcrumb__link--current", "aria-current": "page", children: n }) : t.isDisabled ? /* @__PURE__ */ e("span", { className: "breadcrumb__link breadcrumb__link--disabled", "aria-disabled": "true", children: n }) : /* @__PURE__ */ e("a", { className: "breadcrumb__link", href: t.href ?? "#breadcrumb", children: n });
|
|
2981
|
+
}
|
|
2982
|
+
function ae() {
|
|
2983
|
+
return /* @__PURE__ */ e(O, { className: "breadcrumb__separator", "aria-hidden": "true", size: 16, strokeWidth: 2 });
|
|
2984
|
+
}
|
|
2985
|
+
function fa({
|
|
2986
|
+
items: t,
|
|
2987
|
+
label: n,
|
|
2988
|
+
type: r = "text"
|
|
2989
|
+
}) {
|
|
2990
|
+
const a = r === "menu";
|
|
2991
|
+
return /* @__PURE__ */ e("nav", { className: ["breadcrumb", a ? "breadcrumb--menu" : ""].filter(Boolean).join(" "), "aria-label": n, children: /* @__PURE__ */ e("ol", { className: "breadcrumb__list", children: t.map((l, s) => /* @__PURE__ */ i("li", { className: "breadcrumb__item", children: [
|
|
2992
|
+
/* @__PURE__ */ e(ne, { crumb: l }),
|
|
2993
|
+
!a && s < t.length - 1 ? /* @__PURE__ */ e(ae, {}) : null
|
|
2994
|
+
] }, l.label)) }) });
|
|
2995
|
+
}
|
|
2996
|
+
function _a({ items: t, label: n }) {
|
|
2997
|
+
const [r, a] = E(!1), l = t[0], s = t[t.length - 1], o = t.slice(1, -1);
|
|
2998
|
+
return /* @__PURE__ */ e("nav", { className: "breadcrumb", "aria-label": n, "data-expanded": r ? "true" : "false", children: /* @__PURE__ */ i("ol", { className: "breadcrumb__list", children: [
|
|
2999
|
+
/* @__PURE__ */ i("li", { className: "breadcrumb__item", children: [
|
|
3000
|
+
/* @__PURE__ */ e(ne, { crumb: l }),
|
|
3001
|
+
/* @__PURE__ */ e(ae, {})
|
|
3002
|
+
] }),
|
|
3003
|
+
/* @__PURE__ */ i("li", { className: "breadcrumb__item breadcrumb__item--toggle", children: [
|
|
3004
|
+
/* @__PURE__ */ e(
|
|
3005
|
+
"button",
|
|
3006
|
+
{
|
|
3007
|
+
type: "button",
|
|
3008
|
+
className: "breadcrumb__toggle",
|
|
3009
|
+
"aria-expanded": r,
|
|
3010
|
+
"aria-label": r ? "收起中间层级" : "展开折叠的中间层级",
|
|
3011
|
+
onClick: () => a((u) => !u),
|
|
3012
|
+
children: /* @__PURE__ */ e(Le, { "aria-hidden": "true", size: 16, strokeWidth: 2 })
|
|
3013
|
+
}
|
|
3014
|
+
),
|
|
3015
|
+
/* @__PURE__ */ e(ae, {})
|
|
3016
|
+
] }),
|
|
3017
|
+
o.map((u) => /* @__PURE__ */ i("li", { className: "breadcrumb__item breadcrumb__item--middle", children: [
|
|
3018
|
+
/* @__PURE__ */ e(ne, { crumb: u }),
|
|
3019
|
+
/* @__PURE__ */ e(ae, {})
|
|
3020
|
+
] }, u.label)),
|
|
3021
|
+
/* @__PURE__ */ e("li", { className: "breadcrumb__item", children: /* @__PURE__ */ e(ne, { crumb: s }) })
|
|
3022
|
+
] }) });
|
|
3023
|
+
}
|
|
3024
|
+
function ba({ open: t, onClose: n, title: r, side: a = "right", children: l, footer: s }) {
|
|
3025
|
+
const o = I(null), u = W();
|
|
3026
|
+
if (B(() => {
|
|
3027
|
+
if (!t) return;
|
|
3028
|
+
const _ = window.setTimeout(
|
|
3029
|
+
() => o.current?.querySelector("button, input, [tabindex]")?.focus(),
|
|
3030
|
+
0
|
|
3031
|
+
);
|
|
3032
|
+
return document.body.style.overflow = "hidden", () => {
|
|
3033
|
+
window.clearTimeout(_), document.body.style.overflow = "";
|
|
3034
|
+
};
|
|
3035
|
+
}, [t]), !t) return null;
|
|
3036
|
+
function c(_) {
|
|
3037
|
+
if (_.key === "Escape")
|
|
3038
|
+
_.preventDefault(), n();
|
|
3039
|
+
else if (_.key === "Tab") {
|
|
3040
|
+
const d = Array.from(o.current?.querySelectorAll("button:not([disabled]), input:not([disabled]), a[href]") ?? []);
|
|
3041
|
+
if (d.length === 0) return;
|
|
3042
|
+
const b = d[0], p = d[d.length - 1];
|
|
3043
|
+
_.shiftKey && document.activeElement === b ? (_.preventDefault(), p.focus()) : !_.shiftKey && document.activeElement === p && (_.preventDefault(), b.focus());
|
|
3044
|
+
}
|
|
3045
|
+
}
|
|
3046
|
+
return /* @__PURE__ */ i(F, { children: [
|
|
3047
|
+
/* @__PURE__ */ e("div", { className: "sheet__backdrop", "aria-hidden": "true", onMouseDown: (_) => _.preventDefault() }),
|
|
3048
|
+
/* @__PURE__ */ i(
|
|
3049
|
+
"div",
|
|
3050
|
+
{
|
|
3051
|
+
ref: o,
|
|
3052
|
+
role: "dialog",
|
|
3053
|
+
"aria-modal": "true",
|
|
3054
|
+
"aria-labelledby": u,
|
|
3055
|
+
className: `sheet__panel sheet__panel--${a}`,
|
|
3056
|
+
onKeyDown: c,
|
|
3057
|
+
children: [
|
|
3058
|
+
/* @__PURE__ */ i("header", { className: "sheet__header", children: [
|
|
3059
|
+
/* @__PURE__ */ e("h2", { className: "sheet__title", id: u, children: r }),
|
|
3060
|
+
/* @__PURE__ */ e("button", { type: "button", className: "sheet__close", "aria-label": "关闭", onClick: n, children: /* @__PURE__ */ e(q, { size: 16, strokeWidth: 2, "aria-hidden": "true" }) })
|
|
3061
|
+
] }),
|
|
3062
|
+
/* @__PURE__ */ e("div", { className: "sheet__body", children: l }),
|
|
3063
|
+
s ? /* @__PURE__ */ e("footer", { className: "sheet__footer", children: s }) : null
|
|
3064
|
+
]
|
|
3065
|
+
}
|
|
3066
|
+
)
|
|
3067
|
+
] });
|
|
3068
|
+
}
|
|
3069
|
+
function ya({ label: t, entries: n, variant: r = "default", size: a = "md", align: l = "start", menuButtonLabel: s, icon: o }) {
|
|
3070
|
+
const [u, c] = E(!1), [_, d] = E(-1), b = I(null), p = I([]), m = I({ buffer: "", timer: 0 }), y = W(), k = n.map((h, x) => x);
|
|
3071
|
+
function f(h) {
|
|
3072
|
+
d(h), p.current[h]?.focus();
|
|
3073
|
+
}
|
|
3074
|
+
function N(h) {
|
|
3075
|
+
c(!0);
|
|
3076
|
+
const x = h === "first" ? 0 : n.length - 1;
|
|
3077
|
+
window.requestAnimationFrame(() => f(x));
|
|
3078
|
+
}
|
|
3079
|
+
function v(h = !0) {
|
|
3080
|
+
c(!1), d(-1), h && b.current?.focus();
|
|
3081
|
+
}
|
|
3082
|
+
B(() => {
|
|
3083
|
+
if (!u) return;
|
|
3084
|
+
function h(x) {
|
|
3085
|
+
const g = b.current?.closest(".split-button");
|
|
3086
|
+
g && !g.contains(x.target) && v(!1);
|
|
3087
|
+
}
|
|
3088
|
+
return document.addEventListener("mousedown", h), () => document.removeEventListener("mousedown", h);
|
|
3089
|
+
}, [u]);
|
|
3090
|
+
function D(h) {
|
|
3091
|
+
h.key === "ArrowDown" || h.key === "Enter" || h.key === " " ? (h.preventDefault(), N("first")) : h.key === "ArrowUp" && (h.preventDefault(), N("last"));
|
|
3092
|
+
}
|
|
3093
|
+
function C(h) {
|
|
3094
|
+
const x = k.indexOf(_);
|
|
3095
|
+
if (h.key === "ArrowDown")
|
|
3096
|
+
h.preventDefault(), f(k[(x + 1) % k.length]);
|
|
3097
|
+
else if (h.key === "ArrowUp")
|
|
3098
|
+
h.preventDefault(), f(k[(x - 1 + k.length) % k.length]);
|
|
3099
|
+
else if (h.key === "Home")
|
|
3100
|
+
h.preventDefault(), f(0);
|
|
3101
|
+
else if (h.key === "End")
|
|
3102
|
+
h.preventDefault(), f(n.length - 1);
|
|
3103
|
+
else if (h.key === "Escape")
|
|
3104
|
+
h.preventDefault(), v();
|
|
3105
|
+
else if (h.key.length === 1 && /\S/.test(h.key)) {
|
|
3106
|
+
window.clearTimeout(m.current.timer), m.current.buffer += h.key.toLowerCase(), m.current.timer = window.setTimeout(() => m.current.buffer = "", 500);
|
|
3107
|
+
const g = k.find((w) => n[w].label.toLowerCase().startsWith(m.current.buffer));
|
|
3108
|
+
g !== void 0 && f(g);
|
|
3109
|
+
}
|
|
3110
|
+
}
|
|
3111
|
+
return /* @__PURE__ */ i("div", { className: `split-button split-button--${r} split-button--${a}`, children: [
|
|
3112
|
+
/* @__PURE__ */ i("button", { type: "button", className: "split-button__primary", children: [
|
|
3113
|
+
o ? /* @__PURE__ */ e("span", { className: "split-button__icon", children: o }) : null,
|
|
3114
|
+
t
|
|
3115
|
+
] }),
|
|
3116
|
+
/* @__PURE__ */ e(
|
|
3117
|
+
"button",
|
|
3118
|
+
{
|
|
3119
|
+
ref: b,
|
|
3120
|
+
type: "button",
|
|
3121
|
+
className: "split-button__toggle",
|
|
3122
|
+
"aria-label": s,
|
|
3123
|
+
"aria-haspopup": "menu",
|
|
3124
|
+
"aria-expanded": u,
|
|
3125
|
+
"aria-controls": u ? y : void 0,
|
|
3126
|
+
onClick: () => u ? v() : N("first"),
|
|
3127
|
+
onKeyDown: D,
|
|
3128
|
+
children: /* @__PURE__ */ e(K, { size: a === "sm" ? 14 : 16, strokeWidth: 2, "aria-hidden": "true" })
|
|
3129
|
+
}
|
|
3130
|
+
),
|
|
3131
|
+
u ? /* @__PURE__ */ e(
|
|
3132
|
+
"div",
|
|
3133
|
+
{
|
|
3134
|
+
id: y,
|
|
3135
|
+
role: "menu",
|
|
3136
|
+
"aria-label": s,
|
|
3137
|
+
className: `menu__popup menu__popup--${l}`,
|
|
3138
|
+
onKeyDown: C,
|
|
3139
|
+
children: n.map((h, x) => /* @__PURE__ */ i(
|
|
3140
|
+
"button",
|
|
3141
|
+
{
|
|
3142
|
+
ref: (g) => {
|
|
3143
|
+
p.current[x] = g;
|
|
3144
|
+
},
|
|
3145
|
+
type: "button",
|
|
3146
|
+
role: "menuitem",
|
|
3147
|
+
tabIndex: -1,
|
|
3148
|
+
className: `menu__item${h.danger ? " menu__item--danger" : ""}`,
|
|
3149
|
+
onClick: () => v(),
|
|
3150
|
+
children: [
|
|
3151
|
+
h.icon ? /* @__PURE__ */ e("span", { className: "menu__item-icon", children: h.icon }) : null,
|
|
3152
|
+
/* @__PURE__ */ e("span", { className: "menu__item-label", children: h.label })
|
|
3153
|
+
]
|
|
3154
|
+
},
|
|
3155
|
+
h.label
|
|
3156
|
+
))
|
|
3157
|
+
}
|
|
3158
|
+
) : null
|
|
3159
|
+
] });
|
|
3160
|
+
}
|
|
3161
|
+
const qt = (t) => t.type === "item" && !t.disabled && !t.locked || t.type === "link";
|
|
3162
|
+
function ga({ label: t, entries: n, withChevron: r, align: a = "start", triggerContent: l }) {
|
|
3163
|
+
const [s, o] = E(!1), [u, c] = E({
|
|
3164
|
+
align: a,
|
|
3165
|
+
side: "bottom"
|
|
3166
|
+
}), _ = I(null), d = I(null), b = W();
|
|
3167
|
+
G(() => {
|
|
3168
|
+
if (!s) return;
|
|
3169
|
+
function C() {
|
|
3170
|
+
const g = _.current, w = d.current;
|
|
3171
|
+
if (!g || !w) return;
|
|
3172
|
+
const M = g.getBoundingClientRect(), S = w.getBoundingClientRect();
|
|
3173
|
+
let $ = a;
|
|
3174
|
+
a === "start" && M.left + S.width > window.innerWidth ? $ = "end" : a === "end" && M.right - S.width < 0 && ($ = "start");
|
|
3175
|
+
const T = M.bottom + S.height > window.innerHeight ? "top" : "bottom";
|
|
3176
|
+
c({ align: $, side: T });
|
|
3177
|
+
}
|
|
3178
|
+
let h = 0;
|
|
3179
|
+
function x() {
|
|
3180
|
+
h || (h = window.requestAnimationFrame(() => {
|
|
3181
|
+
h = 0, C();
|
|
3182
|
+
}));
|
|
3183
|
+
}
|
|
3184
|
+
return C(), window.addEventListener("resize", x), () => {
|
|
3185
|
+
window.removeEventListener("resize", x), h && window.cancelAnimationFrame(h);
|
|
3186
|
+
};
|
|
3187
|
+
}, [s, a]);
|
|
3188
|
+
const p = n.flatMap((C, h) => qt(C) ? [h] : []), { itemRefs: m, focusItem: y, reset: k, onMenuKeyDown: f } = ge({
|
|
3189
|
+
focusableIndices: p,
|
|
3190
|
+
getText: (C) => {
|
|
3191
|
+
const h = n[C];
|
|
3192
|
+
return h.type === "item" || h.type === "link" ? h.label : "";
|
|
3193
|
+
},
|
|
3194
|
+
onClose: () => v()
|
|
3195
|
+
});
|
|
3196
|
+
function N(C) {
|
|
3197
|
+
o(!0);
|
|
3198
|
+
const h = C === "first" ? p[0] : p[p.length - 1];
|
|
3199
|
+
window.requestAnimationFrame(() => y(h));
|
|
3200
|
+
}
|
|
3201
|
+
function v(C = !0) {
|
|
3202
|
+
o(!1), k(), c({ align: a, side: "bottom" }), C && _.current?.focus();
|
|
3203
|
+
}
|
|
3204
|
+
B(() => {
|
|
3205
|
+
if (!s) return;
|
|
3206
|
+
function C(h) {
|
|
3207
|
+
const x = m.current[0]?.closest(".menu");
|
|
3208
|
+
x && !x.contains(h.target) && v(!1);
|
|
3209
|
+
}
|
|
3210
|
+
return document.addEventListener("mousedown", C), () => document.removeEventListener("mousedown", C);
|
|
3211
|
+
}, [s]);
|
|
3212
|
+
function D(C) {
|
|
3213
|
+
C.key === "ArrowDown" || C.key === "Enter" || C.key === " " ? (C.preventDefault(), N("first")) : C.key === "ArrowUp" && (C.preventDefault(), N("last"));
|
|
3214
|
+
}
|
|
3215
|
+
return /* @__PURE__ */ i("div", { className: "menu", children: [
|
|
3216
|
+
/* @__PURE__ */ i(
|
|
3217
|
+
"button",
|
|
3218
|
+
{
|
|
3219
|
+
ref: _,
|
|
3220
|
+
type: "button",
|
|
3221
|
+
className: l ? "menu__trigger menu__trigger--icon" : "menu__trigger",
|
|
3222
|
+
"aria-haspopup": "menu",
|
|
3223
|
+
"aria-expanded": s,
|
|
3224
|
+
"aria-controls": s ? b : void 0,
|
|
3225
|
+
"aria-label": l ? t : void 0,
|
|
3226
|
+
onClick: () => s ? v() : N("first"),
|
|
3227
|
+
onKeyDown: D,
|
|
3228
|
+
children: [
|
|
3229
|
+
l ?? t,
|
|
3230
|
+
r ? /* @__PURE__ */ e(K, { size: 16, strokeWidth: 2, "aria-hidden": "true" }) : null
|
|
3231
|
+
]
|
|
3232
|
+
}
|
|
3233
|
+
),
|
|
3234
|
+
s ? /* @__PURE__ */ e(
|
|
3235
|
+
"div",
|
|
3236
|
+
{
|
|
3237
|
+
ref: d,
|
|
3238
|
+
id: b,
|
|
3239
|
+
role: "menu",
|
|
3240
|
+
className: `menu__popup menu__popup--${u.align} menu__popup--${u.side}`,
|
|
3241
|
+
"aria-label": t,
|
|
3242
|
+
onKeyDown: f,
|
|
3243
|
+
children: n.map((C, h) => {
|
|
3244
|
+
if (C.type === "separator")
|
|
3245
|
+
return /* @__PURE__ */ e("div", { className: "menu__separator", role: "separator" }, `sep-${h}`);
|
|
3246
|
+
if (C.type === "section")
|
|
3247
|
+
return /* @__PURE__ */ e("div", { className: "menu__section", role: "presentation", children: C.label }, `sec-${h}`);
|
|
3248
|
+
if (C.type === "link")
|
|
3249
|
+
return /* @__PURE__ */ i(
|
|
3250
|
+
"a",
|
|
3251
|
+
{
|
|
3252
|
+
ref: (w) => {
|
|
3253
|
+
m.current[h] = w;
|
|
3254
|
+
},
|
|
3255
|
+
role: "menuitem",
|
|
3256
|
+
tabIndex: -1,
|
|
3257
|
+
href: C.href,
|
|
3258
|
+
className: "menu__item",
|
|
3259
|
+
onClick: (w) => {
|
|
3260
|
+
w.preventDefault(), v();
|
|
3261
|
+
},
|
|
3262
|
+
children: [
|
|
3263
|
+
C.icon ? /* @__PURE__ */ e("span", { className: "menu__item-icon", children: C.icon }) : null,
|
|
3264
|
+
/* @__PURE__ */ e("span", { className: "menu__item-label", children: C.label }),
|
|
3265
|
+
C.suffix ? /* @__PURE__ */ e("span", { className: "menu__item-suffix", children: C.suffix }) : null
|
|
3266
|
+
]
|
|
3267
|
+
},
|
|
3268
|
+
C.label
|
|
3269
|
+
);
|
|
3270
|
+
const x = !C.disabled && !C.locked, g = C.suffix ?? (C.locked ? /* @__PURE__ */ e(it, { size: 16, strokeWidth: 2, "aria-hidden": "true" }) : null);
|
|
3271
|
+
return /* @__PURE__ */ i(
|
|
3272
|
+
"button",
|
|
3273
|
+
{
|
|
3274
|
+
ref: (w) => {
|
|
3275
|
+
m.current[h] = w;
|
|
3276
|
+
},
|
|
3277
|
+
type: "button",
|
|
3278
|
+
role: "menuitem",
|
|
3279
|
+
tabIndex: -1,
|
|
3280
|
+
disabled: !x,
|
|
3281
|
+
"aria-disabled": x ? void 0 : !0,
|
|
3282
|
+
className: `menu__item${C.danger ? " menu__item--danger" : ""}${C.locked ? " menu__item--locked" : ""}`,
|
|
3283
|
+
onClick: () => x && v(),
|
|
3284
|
+
children: [
|
|
3285
|
+
C.icon ? /* @__PURE__ */ e("span", { className: "menu__item-icon", children: C.icon }) : null,
|
|
3286
|
+
/* @__PURE__ */ e("span", { className: "menu__item-label", children: C.label }),
|
|
3287
|
+
g ? /* @__PURE__ */ e("span", { className: "menu__item-suffix", children: g }) : null
|
|
3288
|
+
]
|
|
3289
|
+
},
|
|
3290
|
+
C.label
|
|
3291
|
+
);
|
|
3292
|
+
})
|
|
3293
|
+
}
|
|
3294
|
+
) : null
|
|
3295
|
+
] });
|
|
3296
|
+
}
|
|
3297
|
+
function Na({ options: t, defaultSelected: n = [], placeholder: r, onChange: a }) {
|
|
3298
|
+
const [l, s] = E(!1), [o, u] = E(n), [c, _] = E({ row: 0, col: 0 }), d = I(null), b = I(null), p = I([]);
|
|
3299
|
+
function m(w) {
|
|
3300
|
+
u(w), a?.(w);
|
|
3301
|
+
}
|
|
3302
|
+
const y = (w) => o.includes(w);
|
|
3303
|
+
function k(w) {
|
|
3304
|
+
m(y(w) ? o.filter((M) => M !== w) : [...o, w]);
|
|
3305
|
+
}
|
|
3306
|
+
function f(w) {
|
|
3307
|
+
m([w]);
|
|
3308
|
+
}
|
|
3309
|
+
function N() {
|
|
3310
|
+
m([...t]);
|
|
3311
|
+
}
|
|
3312
|
+
function v(w) {
|
|
3313
|
+
return y(w) ? o.length === t.length ? { label: "仅选此项", run: () => f(w) } : { label: "全选", run: () => N() } : o.length === 0 ? { label: "勾选", run: () => k(w) } : { label: "仅选此项", run: () => f(w) };
|
|
3314
|
+
}
|
|
3315
|
+
function D(w, M) {
|
|
3316
|
+
_({ row: w, col: M }), window.requestAnimationFrame(() => p.current[w]?.[M]?.focus());
|
|
3317
|
+
}
|
|
3318
|
+
function C() {
|
|
3319
|
+
s(!0), window.requestAnimationFrame(() => D(0, 0));
|
|
3320
|
+
}
|
|
3321
|
+
function h(w = !0) {
|
|
3322
|
+
s(!1), w && b.current?.focus();
|
|
3323
|
+
}
|
|
3324
|
+
B(() => {
|
|
3325
|
+
if (!l) return;
|
|
3326
|
+
function w(M) {
|
|
3327
|
+
d.current && !d.current.contains(M.target) && h(!1);
|
|
3328
|
+
}
|
|
3329
|
+
return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
|
|
3330
|
+
}, [l]);
|
|
3331
|
+
function x(w) {
|
|
3332
|
+
const { row: M, col: S } = c;
|
|
3333
|
+
w.key === "ArrowDown" ? (w.preventDefault(), D(Math.min(M + 1, t.length - 1), S)) : w.key === "ArrowUp" ? (w.preventDefault(), D(Math.max(M - 1, 0), S)) : w.key === "ArrowRight" ? (w.preventDefault(), D(M, 1)) : w.key === "ArrowLeft" ? (w.preventDefault(), D(M, 0)) : w.key === "Home" ? (w.preventDefault(), D(0, S)) : w.key === "End" ? (w.preventDefault(), D(t.length - 1, S)) : w.key === "Escape" && (w.preventDefault(), h());
|
|
3334
|
+
}
|
|
3335
|
+
const g = o.length === 0 ? r : o.length === 1 ? o[0] : `已选 ${o.length} 项`;
|
|
3336
|
+
return /* @__PURE__ */ i("div", { className: "multi-select", ref: d, children: [
|
|
3337
|
+
/* @__PURE__ */ i(
|
|
3338
|
+
"button",
|
|
3339
|
+
{
|
|
3340
|
+
ref: b,
|
|
3341
|
+
type: "button",
|
|
3342
|
+
className: "multi-select__trigger",
|
|
3343
|
+
"aria-haspopup": "listbox",
|
|
3344
|
+
"aria-expanded": l,
|
|
3345
|
+
onClick: () => l ? h() : C(),
|
|
3346
|
+
children: [
|
|
3347
|
+
/* @__PURE__ */ e("span", { className: o.length === 0 ? "multi-select__placeholder" : void 0, children: g }),
|
|
3348
|
+
/* @__PURE__ */ e(K, { size: 16, strokeWidth: 2, "aria-hidden": "true" })
|
|
3349
|
+
]
|
|
3350
|
+
}
|
|
3351
|
+
),
|
|
3352
|
+
l ? /* @__PURE__ */ i("div", { className: "multi-select__menu", role: "listbox", "aria-multiselectable": "true", "aria-label": r, onKeyDown: x, children: [
|
|
3353
|
+
/* @__PURE__ */ i("div", { className: "multi-select__bulk", children: [
|
|
3354
|
+
/* @__PURE__ */ e(
|
|
3355
|
+
"button",
|
|
3356
|
+
{
|
|
3357
|
+
type: "button",
|
|
3358
|
+
className: "multi-select__bulk-button",
|
|
3359
|
+
onClick: () => o.length === t.length ? m([]) : N(),
|
|
3360
|
+
children: o.length === t.length ? "全部清除" : "全选"
|
|
3361
|
+
}
|
|
3362
|
+
),
|
|
3363
|
+
/* @__PURE__ */ i("span", { className: "multi-select__count", children: [
|
|
3364
|
+
o.length,
|
|
3365
|
+
" / ",
|
|
3366
|
+
t.length
|
|
3367
|
+
] })
|
|
3368
|
+
] }),
|
|
3369
|
+
t.map((w, M) => {
|
|
3370
|
+
p.current[M] = p.current[M] ?? [];
|
|
3371
|
+
const S = y(w), $ = v(w);
|
|
3372
|
+
return /* @__PURE__ */ i("div", { className: "multi-select__row", role: "presentation", children: [
|
|
3373
|
+
/* @__PURE__ */ i(
|
|
3374
|
+
"button",
|
|
3375
|
+
{
|
|
3376
|
+
ref: (T) => {
|
|
3377
|
+
T && (p.current[M][0] = T);
|
|
3378
|
+
},
|
|
3379
|
+
type: "button",
|
|
3380
|
+
role: "option",
|
|
3381
|
+
"aria-selected": S,
|
|
3382
|
+
"aria-label": `选择 ${w}`,
|
|
3383
|
+
tabIndex: c.row === M && c.col === 0 ? 0 : -1,
|
|
3384
|
+
className: "multi-select__option",
|
|
3385
|
+
onFocus: () => _({ row: M, col: 0 }),
|
|
3386
|
+
onClick: () => k(w),
|
|
3387
|
+
children: [
|
|
3388
|
+
/* @__PURE__ */ e("span", { className: `multi-select__check${S ? " multi-select__check--on" : ""}`, "aria-hidden": "true", children: S ? /* @__PURE__ */ e(j, { size: 12, strokeWidth: 3 }) : null }),
|
|
3389
|
+
/* @__PURE__ */ e("span", { className: "multi-select__option-label", children: w })
|
|
3390
|
+
]
|
|
3391
|
+
}
|
|
3392
|
+
),
|
|
3393
|
+
/* @__PURE__ */ e(
|
|
3394
|
+
"button",
|
|
3395
|
+
{
|
|
3396
|
+
ref: (T) => {
|
|
3397
|
+
T && (p.current[M][1] = T);
|
|
3398
|
+
},
|
|
3399
|
+
type: "button",
|
|
3400
|
+
"aria-label": `${$.label}:${w}`,
|
|
3401
|
+
tabIndex: c.row === M && c.col === 1 ? 0 : -1,
|
|
3402
|
+
className: "multi-select__only",
|
|
3403
|
+
onFocus: () => _({ row: M, col: 1 }),
|
|
3404
|
+
onClick: $.run,
|
|
3405
|
+
children: $.label
|
|
3406
|
+
}
|
|
3407
|
+
)
|
|
3408
|
+
] }, w);
|
|
3409
|
+
})
|
|
3410
|
+
] }) : null
|
|
3411
|
+
] });
|
|
3412
|
+
}
|
|
3413
|
+
function ka({ open: t, onClose: n, title: r, children: a, footer: l, initialFocusRef: s, dismissable: o = !0, sticky: u = !1 }) {
|
|
3414
|
+
const c = I(null), _ = W();
|
|
3415
|
+
if (B(() => {
|
|
3416
|
+
if (!t) return;
|
|
3417
|
+
const b = document.body.style.overflow;
|
|
3418
|
+
document.body.style.overflow = "hidden";
|
|
3419
|
+
const p = window.setTimeout(() => {
|
|
3420
|
+
(s?.current ?? c.current?.querySelector("button:not([disabled]), input:not([disabled]), [tabindex]"))?.focus();
|
|
3421
|
+
}, 0);
|
|
3422
|
+
return () => {
|
|
3423
|
+
window.clearTimeout(p), document.body.style.overflow = b;
|
|
3424
|
+
};
|
|
3425
|
+
}, [t, s]), B(() => {
|
|
3426
|
+
if (!t || !o) return;
|
|
3427
|
+
function b(p) {
|
|
3428
|
+
p.key === "Escape" && (c.current?.contains(document.activeElement) || (p.preventDefault(), n()));
|
|
3429
|
+
}
|
|
3430
|
+
return document.addEventListener("keydown", b), () => document.removeEventListener("keydown", b);
|
|
3431
|
+
}, [t, o, n]), !t) return null;
|
|
3432
|
+
function d(b) {
|
|
3433
|
+
if (b.key === "Escape" && o)
|
|
3434
|
+
b.preventDefault(), n();
|
|
3435
|
+
else if (b.key === "Tab") {
|
|
3436
|
+
const p = 'button:not([disabled]), input:not([disabled]), [tabindex="0"]', m = Array.from(c.current?.querySelectorAll(p) ?? []);
|
|
3437
|
+
if (m.length === 0) return;
|
|
3438
|
+
const y = m[0], k = m[m.length - 1], f = document.querySelector(".toast-region")?.lastElementChild, N = Array.from(f?.querySelectorAll(p) ?? []);
|
|
3439
|
+
b.shiftKey && document.activeElement === y ? (b.preventDefault(), (N.length > 0 ? N[N.length - 1] : k).focus()) : !b.shiftKey && document.activeElement === k && (b.preventDefault(), (N.length > 0 ? N[0] : y).focus());
|
|
3440
|
+
}
|
|
3441
|
+
}
|
|
3442
|
+
return /* @__PURE__ */ i("div", { className: "modal", onKeyDown: d, children: [
|
|
3443
|
+
/* @__PURE__ */ e(
|
|
3444
|
+
"button",
|
|
3445
|
+
{
|
|
3446
|
+
type: "button",
|
|
3447
|
+
className: "modal__backdrop",
|
|
3448
|
+
"aria-label": "关闭",
|
|
3449
|
+
tabIndex: -1,
|
|
3450
|
+
onClick: () => o && n()
|
|
3451
|
+
}
|
|
3452
|
+
),
|
|
3453
|
+
/* @__PURE__ */ i(
|
|
3454
|
+
"div",
|
|
3455
|
+
{
|
|
3456
|
+
className: u ? "modal__dialog modal__dialog--sticky" : "modal__dialog",
|
|
3457
|
+
role: "dialog",
|
|
3458
|
+
"aria-modal": "true",
|
|
3459
|
+
"aria-labelledby": _,
|
|
3460
|
+
ref: c,
|
|
3461
|
+
children: [
|
|
3462
|
+
/* @__PURE__ */ e("header", { className: "modal__header", children: /* @__PURE__ */ e("h2", { className: "modal__title", id: _, children: r }) }),
|
|
3463
|
+
/* @__PURE__ */ e("div", { className: "modal__body", children: a }),
|
|
3464
|
+
/* @__PURE__ */ e("footer", { className: "modal__footer", children: l })
|
|
3465
|
+
]
|
|
3466
|
+
}
|
|
3467
|
+
)
|
|
3468
|
+
] });
|
|
3469
|
+
}
|
|
3470
|
+
function wa({ children: t }) {
|
|
3471
|
+
return /* @__PURE__ */ e("div", { className: "modal__inset", children: t });
|
|
3472
|
+
}
|
|
3473
|
+
const Ht = ["日", "一", "二", "三", "四", "五", "六"];
|
|
3474
|
+
function z(t) {
|
|
3475
|
+
const n = String(t.getMonth() + 1).padStart(2, "0"), r = String(t.getDate()).padStart(2, "0");
|
|
3476
|
+
return `${t.getFullYear()}-${n}-${r}`;
|
|
3477
|
+
}
|
|
3478
|
+
function P(t, n) {
|
|
3479
|
+
return new Date(t.getFullYear(), t.getMonth(), t.getDate() + n);
|
|
3480
|
+
}
|
|
3481
|
+
function ue(t, n) {
|
|
3482
|
+
return new Date(t.getFullYear(), t.getMonth() + n, 1);
|
|
3483
|
+
}
|
|
3484
|
+
function pe(t) {
|
|
3485
|
+
return new Date(t.getFullYear(), t.getMonth(), 1);
|
|
3486
|
+
}
|
|
3487
|
+
function Y(t, n) {
|
|
3488
|
+
return !!t && !!n && z(t) === z(n);
|
|
3489
|
+
}
|
|
3490
|
+
function Ut(t, n) {
|
|
3491
|
+
return Math.round((n.getTime() - t.getTime()) / 864e5) + 1;
|
|
3492
|
+
}
|
|
3493
|
+
function Yt(t) {
|
|
3494
|
+
const n = pe(t), r = P(n, -n.getDay());
|
|
3495
|
+
return Array.from({ length: 42 }, (a, l) => {
|
|
3496
|
+
const s = P(r, l);
|
|
3497
|
+
return { date: s, inMonth: s.getMonth() === n.getMonth() };
|
|
3498
|
+
});
|
|
3499
|
+
}
|
|
3500
|
+
function me(t, n, r) {
|
|
3501
|
+
return !!(n && z(t) < z(n) || r && z(t) > z(r));
|
|
3502
|
+
}
|
|
3503
|
+
function Me(t, n, r) {
|
|
3504
|
+
return n && z(t) < z(n) ? n : r && z(t) > z(r) ? r : t;
|
|
3505
|
+
}
|
|
3506
|
+
function Gt({
|
|
3507
|
+
value: t,
|
|
3508
|
+
onChange: n,
|
|
3509
|
+
size: r = "large",
|
|
3510
|
+
minValue: a,
|
|
3511
|
+
maxValue: l,
|
|
3512
|
+
today: s = /* @__PURE__ */ new Date()
|
|
3513
|
+
}) {
|
|
3514
|
+
const [o, u] = E(
|
|
3515
|
+
() => pe(Me(t.start ?? s, a, l))
|
|
3516
|
+
), [c, _] = E(null), [d, b] = E(() => Me(t.start ?? s, a, l)), [p, m] = E(""), y = I(/* @__PURE__ */ new Map()), k = I(null), f = Yt(o);
|
|
3517
|
+
B(() => {
|
|
3518
|
+
if (!k.current) return;
|
|
3519
|
+
const g = y.current.get(k.current);
|
|
3520
|
+
k.current = null, g?.focus();
|
|
3521
|
+
});
|
|
3522
|
+
const N = t.start && !t.end && c ? z(c) < z(t.start) ? { start: c, end: t.start } : { start: t.start, end: c } : t;
|
|
3523
|
+
function v(g) {
|
|
3524
|
+
if (!t.start || t.end) {
|
|
3525
|
+
n({ start: g, end: null }), m(`开始日期 ${z(g)},请选择结束日期`);
|
|
3526
|
+
return;
|
|
3527
|
+
}
|
|
3528
|
+
const [w, M] = z(g) < z(t.start) ? [g, t.start] : [t.start, g];
|
|
3529
|
+
n({ start: w, end: M }), m(`已选择 ${z(w)} 至 ${z(M)},共 ${Ut(w, M)} 天`);
|
|
3530
|
+
}
|
|
3531
|
+
function D(g) {
|
|
3532
|
+
me(g, a, l) || ((g.getMonth() !== o.getMonth() || g.getFullYear() !== o.getFullYear()) && u(pe(g)), b(g), k.current = z(g));
|
|
3533
|
+
}
|
|
3534
|
+
function C(g) {
|
|
3535
|
+
let w = null;
|
|
3536
|
+
switch (g.key) {
|
|
3537
|
+
case "ArrowLeft":
|
|
3538
|
+
w = P(d, g.shiftKey ? -7 : -1);
|
|
3539
|
+
break;
|
|
3540
|
+
case "ArrowRight":
|
|
3541
|
+
w = P(d, g.shiftKey ? 7 : 1);
|
|
3542
|
+
break;
|
|
3543
|
+
case "ArrowUp":
|
|
3544
|
+
w = P(d, -7);
|
|
3545
|
+
break;
|
|
3546
|
+
case "ArrowDown":
|
|
3547
|
+
w = P(d, 7);
|
|
3548
|
+
break;
|
|
3549
|
+
case "Home":
|
|
3550
|
+
w = P(d, -d.getDay());
|
|
3551
|
+
break;
|
|
3552
|
+
case "End":
|
|
3553
|
+
w = P(d, 6 - d.getDay());
|
|
3554
|
+
break;
|
|
3555
|
+
case "PageUp":
|
|
3556
|
+
w = ue(d, -1);
|
|
3557
|
+
break;
|
|
3558
|
+
case "PageDown":
|
|
3559
|
+
w = ue(d, 1);
|
|
3560
|
+
break;
|
|
3561
|
+
case "Enter":
|
|
3562
|
+
case " ":
|
|
3563
|
+
g.preventDefault(), me(d, a, l) || v(d);
|
|
3564
|
+
return;
|
|
3565
|
+
default:
|
|
3566
|
+
return;
|
|
3567
|
+
}
|
|
3568
|
+
g.preventDefault(), w && D(w);
|
|
3569
|
+
}
|
|
3570
|
+
function h(g) {
|
|
3571
|
+
const w = ue(o, g);
|
|
3572
|
+
u(w), b(w);
|
|
3573
|
+
}
|
|
3574
|
+
const x = `${o.getFullYear()} 年 ${o.getMonth() + 1} 月`;
|
|
3575
|
+
return /* @__PURE__ */ i("div", { className: `calendar calendar--${r}`, children: [
|
|
3576
|
+
/* @__PURE__ */ i("div", { className: "calendar__header", children: [
|
|
3577
|
+
/* @__PURE__ */ e("span", { className: "calendar__month", children: x }),
|
|
3578
|
+
/* @__PURE__ */ i("span", { className: "calendar__nav", children: [
|
|
3579
|
+
/* @__PURE__ */ e(
|
|
3580
|
+
"button",
|
|
3581
|
+
{
|
|
3582
|
+
type: "button",
|
|
3583
|
+
className: "calendar__nav-btn",
|
|
3584
|
+
"aria-label": "上一月",
|
|
3585
|
+
onClick: () => h(-1),
|
|
3586
|
+
children: /* @__PURE__ */ e(_e, { size: 16, strokeWidth: 2 })
|
|
3587
|
+
}
|
|
3588
|
+
),
|
|
3589
|
+
/* @__PURE__ */ e(
|
|
3590
|
+
"button",
|
|
3591
|
+
{
|
|
3592
|
+
type: "button",
|
|
3593
|
+
className: "calendar__nav-btn",
|
|
3594
|
+
"aria-label": "下一月",
|
|
3595
|
+
onClick: () => h(1),
|
|
3596
|
+
children: /* @__PURE__ */ e(O, { size: 16, strokeWidth: 2 })
|
|
3597
|
+
}
|
|
3598
|
+
)
|
|
3599
|
+
] })
|
|
3600
|
+
] }),
|
|
3601
|
+
/* @__PURE__ */ e("div", { className: "calendar__weekdays", "aria-hidden": "true", children: Ht.map((g, w) => /* @__PURE__ */ e("span", { className: "calendar__weekday", children: g }, `${g}-${w}`)) }),
|
|
3602
|
+
/* @__PURE__ */ e("div", { className: "calendar__grid", role: "grid", "aria-label": x, onKeyDown: C, children: f.map(({ date: g, inMonth: w }) => {
|
|
3603
|
+
const M = !w || me(g, a, l), S = Y(g, N.start), $ = Y(g, N.end), T = !!N.start && !!N.end && !Y(N.start, N.end), V = [
|
|
3604
|
+
"calendar__cell",
|
|
3605
|
+
T && z(g) > z(N.start) && z(g) < z(N.end) ? "calendar__cell--in-range" : "",
|
|
3606
|
+
T && S ? "calendar__cell--range-start" : "",
|
|
3607
|
+
T && $ ? "calendar__cell--range-end" : ""
|
|
3608
|
+
].filter(Boolean).join(" "), X = [
|
|
3609
|
+
"calendar__day",
|
|
3610
|
+
w ? "" : "calendar__day--outside",
|
|
3611
|
+
S && N.start ? "calendar__day--start" : "",
|
|
3612
|
+
$ && T ? "calendar__day--end" : "",
|
|
3613
|
+
w && !M && Y(g, s) ? "calendar__day--today" : ""
|
|
3614
|
+
].filter(Boolean).join(" ");
|
|
3615
|
+
return /* @__PURE__ */ e("div", { className: V, role: "gridcell", children: /* @__PURE__ */ e(
|
|
3616
|
+
"button",
|
|
3617
|
+
{
|
|
3618
|
+
type: "button",
|
|
3619
|
+
ref: (Z) => {
|
|
3620
|
+
Z ? y.current.set(z(g), Z) : y.current.delete(z(g));
|
|
3621
|
+
},
|
|
3622
|
+
className: X,
|
|
3623
|
+
tabIndex: w && !M && Y(g, d) ? 0 : -1,
|
|
3624
|
+
disabled: M,
|
|
3625
|
+
"aria-disabled": M || void 0,
|
|
3626
|
+
"aria-selected": (S || $) && N.start ? !0 : void 0,
|
|
3627
|
+
"aria-current": w && Y(g, s) ? "date" : void 0,
|
|
3628
|
+
onClick: () => !M && v(g),
|
|
3629
|
+
onMouseEnter: () => _(g),
|
|
3630
|
+
onMouseLeave: () => _(null),
|
|
3631
|
+
onFocus: () => b(g),
|
|
3632
|
+
children: g.getDate()
|
|
3633
|
+
}
|
|
3634
|
+
) }, z(g));
|
|
3635
|
+
}) }),
|
|
3636
|
+
/* @__PURE__ */ e("span", { className: "sr-only", "aria-live": "polite", children: p })
|
|
3637
|
+
] });
|
|
3638
|
+
}
|
|
3639
|
+
function Vt({
|
|
3640
|
+
value: t,
|
|
3641
|
+
withTime: n,
|
|
3642
|
+
onApply: r,
|
|
3643
|
+
pinnedTimezone: a
|
|
3644
|
+
}) {
|
|
3645
|
+
return /* @__PURE__ */ i("div", { className: "cal-inputs", children: [
|
|
3646
|
+
/* @__PURE__ */ i("div", { className: "cal-inputs__field", children: [
|
|
3647
|
+
/* @__PURE__ */ e("span", { className: "cal-inputs__label", children: "开始" }),
|
|
3648
|
+
/* @__PURE__ */ i("div", { className: "cal-inputs__row", children: [
|
|
3649
|
+
/* @__PURE__ */ e("span", { className: "cal-inputs__value", children: t.start ? z(t.start) : "请选择" }),
|
|
3650
|
+
n ? /* @__PURE__ */ e("span", { className: "cal-inputs__time", children: "00:00" }) : null
|
|
3651
|
+
] })
|
|
3652
|
+
] }),
|
|
3653
|
+
/* @__PURE__ */ i("div", { className: "cal-inputs__field", children: [
|
|
3654
|
+
/* @__PURE__ */ e("span", { className: "cal-inputs__label", children: "结束" }),
|
|
3655
|
+
/* @__PURE__ */ i("div", { className: "cal-inputs__row", children: [
|
|
3656
|
+
/* @__PURE__ */ e("span", { className: "cal-inputs__value", children: t.end ? z(t.end) : "请选择" }),
|
|
3657
|
+
n ? /* @__PURE__ */ e("span", { className: "cal-inputs__time", children: "23:59" }) : null
|
|
3658
|
+
] })
|
|
3659
|
+
] }),
|
|
3660
|
+
/* @__PURE__ */ i("button", { type: "button", className: "cal-inputs__apply", onClick: r, children: [
|
|
3661
|
+
"应用 ",
|
|
3662
|
+
/* @__PURE__ */ e("kbd", { children: "↵" })
|
|
3663
|
+
] }),
|
|
3664
|
+
a ? (
|
|
3665
|
+
// 固定时区:只读文本,不可切换(Geist pinnedTimezone 实测——显为只读文本而非 select)。
|
|
3666
|
+
/* @__PURE__ */ e("span", { className: "cal-inputs__tz cal-inputs__tz--pinned", children: a })
|
|
3667
|
+
) : /* @__PURE__ */ i("button", { type: "button", className: "cal-inputs__tz", children: [
|
|
3668
|
+
"本地 (Asia/Shanghai)",
|
|
3669
|
+
/* @__PURE__ */ e(K, { size: 13, strokeWidth: 2 })
|
|
3670
|
+
] })
|
|
3671
|
+
] });
|
|
3672
|
+
}
|
|
3673
|
+
function va({
|
|
3674
|
+
layout: t = "vertical",
|
|
3675
|
+
trigger: n = "default",
|
|
3676
|
+
size: r = "large",
|
|
3677
|
+
minValue: a,
|
|
3678
|
+
maxValue: l,
|
|
3679
|
+
pinnedTimezone: s,
|
|
3680
|
+
today: o,
|
|
3681
|
+
value: u,
|
|
3682
|
+
onChange: c
|
|
3683
|
+
}) {
|
|
3684
|
+
const [_, d] = E(!1), b = I(null), p = I(null);
|
|
3685
|
+
B(() => {
|
|
3686
|
+
if (!_) return;
|
|
3687
|
+
const N = b.current?.querySelector(".cal-popover"), v = () => N ? [
|
|
3688
|
+
...N.querySelectorAll(
|
|
3689
|
+
'button:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])'
|
|
3690
|
+
)
|
|
3691
|
+
].filter((x) => x.offsetParent !== null) : [];
|
|
3692
|
+
(N?.querySelector('.calendar__day[tabindex="0"]') ?? v()[0])?.focus();
|
|
3693
|
+
function C(x) {
|
|
3694
|
+
b.current && !b.current.contains(x.target) && d(!1);
|
|
3695
|
+
}
|
|
3696
|
+
function h(x) {
|
|
3697
|
+
if (x.key === "Escape") {
|
|
3698
|
+
d(!1), p.current?.focus();
|
|
3699
|
+
return;
|
|
3700
|
+
}
|
|
3701
|
+
if (x.key === "Tab" && N) {
|
|
3702
|
+
const g = v();
|
|
3703
|
+
if (g.length === 0) return;
|
|
3704
|
+
const w = g[0], M = g[g.length - 1], S = document.activeElement;
|
|
3705
|
+
N.contains(S) ? x.shiftKey && S === w ? (x.preventDefault(), M.focus()) : !x.shiftKey && S === M && (x.preventDefault(), w.focus()) : (x.preventDefault(), (x.shiftKey ? M : w).focus());
|
|
3706
|
+
}
|
|
3707
|
+
}
|
|
3708
|
+
return document.addEventListener("mousedown", C), document.addEventListener("keydown", h), () => {
|
|
3709
|
+
document.removeEventListener("mousedown", C), document.removeEventListener("keydown", h);
|
|
3710
|
+
};
|
|
3711
|
+
}, [_]);
|
|
3712
|
+
const m = !!u.start && !!u.end, y = m ? `${z(u.start)} ~ ${z(u.end)}` : "选择日期区间", k = /* @__PURE__ */ e(Gt, { value: u, onChange: c, size: r, minValue: a, maxValue: l, today: o }), f = /* @__PURE__ */ e(
|
|
3713
|
+
Vt,
|
|
3714
|
+
{
|
|
3715
|
+
value: u,
|
|
3716
|
+
withTime: t === "vertical",
|
|
3717
|
+
onApply: () => {
|
|
3718
|
+
d(!1), p.current?.focus();
|
|
3719
|
+
},
|
|
3720
|
+
pinnedTimezone: s
|
|
3721
|
+
}
|
|
3722
|
+
);
|
|
3723
|
+
return /* @__PURE__ */ i("div", { className: "cal-field", ref: b, children: [
|
|
3724
|
+
/* @__PURE__ */ i(
|
|
3725
|
+
"span",
|
|
3726
|
+
{
|
|
3727
|
+
className: [
|
|
3728
|
+
"cal-field__control",
|
|
3729
|
+
`cal-field__control--${n}`,
|
|
3730
|
+
m ? "cal-field__control--filled" : ""
|
|
3731
|
+
].filter(Boolean).join(" "),
|
|
3732
|
+
children: [
|
|
3733
|
+
/* @__PURE__ */ i(
|
|
3734
|
+
"button",
|
|
3735
|
+
{
|
|
3736
|
+
type: "button",
|
|
3737
|
+
ref: p,
|
|
3738
|
+
className: "cal-field__trigger",
|
|
3739
|
+
"aria-haspopup": "dialog",
|
|
3740
|
+
"aria-expanded": _,
|
|
3741
|
+
onClick: () => d((N) => !N),
|
|
3742
|
+
children: [
|
|
3743
|
+
/* @__PURE__ */ e(tt, { size: 15, strokeWidth: 2, "aria-hidden": "true" }),
|
|
3744
|
+
/* @__PURE__ */ e("span", { className: "cal-field__label", children: y })
|
|
3745
|
+
]
|
|
3746
|
+
}
|
|
3747
|
+
),
|
|
3748
|
+
n === "compact" ? /* @__PURE__ */ e(
|
|
3749
|
+
"button",
|
|
3750
|
+
{
|
|
3751
|
+
type: "button",
|
|
3752
|
+
className: "cal-field__caret",
|
|
3753
|
+
"aria-label": "展开日历",
|
|
3754
|
+
onClick: () => d((N) => !N),
|
|
3755
|
+
children: /* @__PURE__ */ e(K, { size: 15, strokeWidth: 2 })
|
|
3756
|
+
}
|
|
3757
|
+
) : m ? /* @__PURE__ */ e(
|
|
3758
|
+
"button",
|
|
3759
|
+
{
|
|
3760
|
+
type: "button",
|
|
3761
|
+
className: "cal-field__clear",
|
|
3762
|
+
"aria-label": "清除已选区间",
|
|
3763
|
+
onClick: () => c({ start: null, end: null }),
|
|
3764
|
+
children: /* @__PURE__ */ e(q, { size: 14, strokeWidth: 2 })
|
|
3765
|
+
}
|
|
3766
|
+
) : null
|
|
3767
|
+
]
|
|
3768
|
+
}
|
|
3769
|
+
),
|
|
3770
|
+
_ ? /* @__PURE__ */ e(
|
|
3771
|
+
"div",
|
|
3772
|
+
{
|
|
3773
|
+
className: `cal-popover cal-popover--${t}`,
|
|
3774
|
+
role: "dialog",
|
|
3775
|
+
"aria-modal": "true",
|
|
3776
|
+
"aria-label": "选择日期区间",
|
|
3777
|
+
children: t === "horizontal" ? /* @__PURE__ */ i(F, { children: [
|
|
3778
|
+
k,
|
|
3779
|
+
f
|
|
3780
|
+
] }) : /* @__PURE__ */ i(F, { children: [
|
|
3781
|
+
f,
|
|
3782
|
+
k
|
|
3783
|
+
] })
|
|
3784
|
+
}
|
|
3785
|
+
) : null
|
|
3786
|
+
] });
|
|
3787
|
+
}
|
|
3788
|
+
const Xt = ["45m", "12 小时", "10d", "2 周", "上个月", "昨天", "今天"], Zt = ["6/1", "6/1 - 6/2", "6月1日", "6月1日 - 6月2日"];
|
|
3789
|
+
function xa({
|
|
3790
|
+
presets: t,
|
|
3791
|
+
activeLabel: n,
|
|
3792
|
+
onPick: r
|
|
3793
|
+
}) {
|
|
3794
|
+
const [a, l] = E(!1), s = I(null);
|
|
3795
|
+
return B(() => {
|
|
3796
|
+
if (!a) return;
|
|
3797
|
+
function o(u) {
|
|
3798
|
+
s.current && !s.current.contains(u.target) && l(!1);
|
|
3799
|
+
}
|
|
3800
|
+
return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
|
|
3801
|
+
}, [a]), /* @__PURE__ */ i("div", { className: "cal-period", ref: s, children: [
|
|
3802
|
+
/* @__PURE__ */ i(
|
|
3803
|
+
"button",
|
|
3804
|
+
{
|
|
3805
|
+
type: "button",
|
|
3806
|
+
className: "cal-period__trigger",
|
|
3807
|
+
"aria-haspopup": "listbox",
|
|
3808
|
+
"aria-expanded": a,
|
|
3809
|
+
onClick: () => l((o) => !o),
|
|
3810
|
+
children: [
|
|
3811
|
+
/* @__PURE__ */ e(nt, { size: 15, strokeWidth: 2, "aria-hidden": "true" }),
|
|
3812
|
+
/* @__PURE__ */ e("span", { className: "cal-period__label", children: n ?? "选择周期" }),
|
|
3813
|
+
/* @__PURE__ */ e(K, { size: 15, strokeWidth: 2, "aria-hidden": "true" })
|
|
3814
|
+
]
|
|
3815
|
+
}
|
|
3816
|
+
),
|
|
3817
|
+
a ? /* @__PURE__ */ i("div", { className: "cal-period__menu", children: [
|
|
3818
|
+
/* @__PURE__ */ e("ul", { className: "cal-period__list", role: "listbox", "aria-label": "快捷周期", children: t.map((o) => /* @__PURE__ */ e("li", { role: "option", "aria-selected": o.label === n, children: /* @__PURE__ */ e(
|
|
3819
|
+
"button",
|
|
3820
|
+
{
|
|
3821
|
+
type: "button",
|
|
3822
|
+
className: `cal-period__option${o.label === n ? " cal-period__option--active" : ""}`,
|
|
3823
|
+
onClick: () => {
|
|
3824
|
+
r(o), l(!1);
|
|
3825
|
+
},
|
|
3826
|
+
children: o.label
|
|
3827
|
+
}
|
|
3828
|
+
) }, o.label)) }),
|
|
3829
|
+
/* @__PURE__ */ i("div", { className: "cal-period__hints", "aria-hidden": "true", children: [
|
|
3830
|
+
/* @__PURE__ */ e("p", { className: "cal-period__hint-title", children: "输入相对时间" }),
|
|
3831
|
+
/* @__PURE__ */ e("div", { className: "cal-period__chips", children: Xt.map((o) => /* @__PURE__ */ e("span", { className: "cal-period__chip", children: o }, o)) }),
|
|
3832
|
+
/* @__PURE__ */ e("p", { className: "cal-period__hint-title", children: "输入固定时间" }),
|
|
3833
|
+
/* @__PURE__ */ e("div", { className: "cal-period__chips", children: Zt.map((o) => /* @__PURE__ */ e("span", { className: "cal-period__chip", children: o }, o)) })
|
|
3834
|
+
] })
|
|
3835
|
+
] }) : null
|
|
3836
|
+
] });
|
|
3837
|
+
}
|
|
3838
|
+
export {
|
|
3839
|
+
Et as Avatar,
|
|
3840
|
+
Un as AvatarGroup,
|
|
3841
|
+
Ln as Badge,
|
|
3842
|
+
Fn as Banner,
|
|
3843
|
+
On as Book,
|
|
3844
|
+
fa as Breadcrumb,
|
|
3845
|
+
qn as Browser,
|
|
3846
|
+
$t as BrowserAddress,
|
|
3847
|
+
Ct as BrowserControls,
|
|
3848
|
+
xt as BrowserDots,
|
|
3849
|
+
Hn as BrowserPlaceholder,
|
|
3850
|
+
Dt as BrowserTabs,
|
|
3851
|
+
an as Button,
|
|
3852
|
+
Gt as CalendarGrid,
|
|
3853
|
+
Kn as Card,
|
|
3854
|
+
dn as Checkbox,
|
|
3855
|
+
mn as Choicebox,
|
|
3856
|
+
gt as ClearButton,
|
|
3857
|
+
ln as ClearableInput,
|
|
3858
|
+
_n as Code,
|
|
3859
|
+
yn as CodeBlock,
|
|
3860
|
+
bn as CodeInline,
|
|
3861
|
+
je as CodeTokens,
|
|
3862
|
+
kn as Collapse,
|
|
3863
|
+
Nn as CollapseGroup,
|
|
3864
|
+
_a as CollapsibleBreadcrumb,
|
|
3865
|
+
hn as Combobox,
|
|
3866
|
+
wn as CommandMenu,
|
|
3867
|
+
jn as ContextCard,
|
|
3868
|
+
zn as ContextMenu,
|
|
3869
|
+
Pe as ControlOption,
|
|
3870
|
+
nn as CopyButton,
|
|
3871
|
+
Pn as Description,
|
|
3872
|
+
vn as DestructiveActionModal,
|
|
3873
|
+
Wn as DotsMenu,
|
|
3874
|
+
xn as Drawer,
|
|
3875
|
+
Cn as EmptyState,
|
|
3876
|
+
$n as Entity,
|
|
3877
|
+
Mn as ErrorCard,
|
|
3878
|
+
Dn as ErrorMessage,
|
|
3879
|
+
En as Feedback,
|
|
3880
|
+
In as Fieldset,
|
|
3881
|
+
Sn as FileTree,
|
|
3882
|
+
ye as FormField,
|
|
3883
|
+
ea as Gauge,
|
|
3884
|
+
rn as Input,
|
|
3885
|
+
ca as Kbd,
|
|
3886
|
+
Tn as Label,
|
|
3887
|
+
la as LoadMoreButton,
|
|
3888
|
+
Gn as LoadingDots,
|
|
3889
|
+
ga as Menu,
|
|
3890
|
+
Vn as MiddleTruncate,
|
|
3891
|
+
ka as Modal,
|
|
3892
|
+
wa as ModalInset,
|
|
3893
|
+
Na as MultiSelect,
|
|
3894
|
+
na as Note,
|
|
3895
|
+
aa as Pagination,
|
|
3896
|
+
xa as PeriodCombobox,
|
|
3897
|
+
Xn as Phone,
|
|
3898
|
+
Rn as Pill,
|
|
3899
|
+
ta as Progress,
|
|
3900
|
+
Zn as ProjectBanner,
|
|
3901
|
+
un as Radio,
|
|
3902
|
+
va as RangeField,
|
|
3903
|
+
Vt as RangeInputs,
|
|
3904
|
+
pa as RangeSlider,
|
|
3905
|
+
sa as RelativeTimeCard,
|
|
3906
|
+
ua as Scroller,
|
|
3907
|
+
ma as ScrollerWithButtons,
|
|
3908
|
+
sn as SearchInput,
|
|
3909
|
+
cn as Select,
|
|
3910
|
+
An as Separator,
|
|
3911
|
+
ba as Sheet,
|
|
3912
|
+
ra as ShowMore,
|
|
3913
|
+
Yn as Skeleton,
|
|
3914
|
+
ha as Slider,
|
|
3915
|
+
Jn as Snippet,
|
|
3916
|
+
oa as Spinner,
|
|
3917
|
+
ya as SplitButton,
|
|
3918
|
+
Bn as StatusDot,
|
|
3919
|
+
pn as Switch,
|
|
3920
|
+
gn as Tabs,
|
|
3921
|
+
Qn as TextWithCopyButton,
|
|
3922
|
+
on as Textarea,
|
|
3923
|
+
da as ThemeSwitcher,
|
|
3924
|
+
tn as ToastProvider,
|
|
3925
|
+
fn as Toggle,
|
|
3926
|
+
vt as Tooltip,
|
|
3927
|
+
ia as Video,
|
|
3928
|
+
P as addDays,
|
|
3929
|
+
ie as useCopy,
|
|
3930
|
+
bt as useToast
|
|
3931
|
+
};
|