@q1travel/design-system 0.14.1 → 0.15.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/contracts/overlay-foundation.md +5 -1
- package/dist-pkg/design-system.d.ts +5 -1
- package/dist-pkg/design-system.js +106 -106
- package/dist-pkg/style.css +13 -1
- package/package.json +2 -2
|
@@ -156,7 +156,7 @@ type OverlayRecord = {
|
|
|
156
156
|
| --- | --- | --- | --- |
|
|
157
157
|
| Modal | 公开 props、尺寸/布局、关闭策略、文档示例 | portal、stack、focus、blocking lock、统一 Escape/outside ownership | Foundation |
|
|
158
158
|
| DestructiveActionModal | destructive/loading/confirm 语义与提交状态 | 同上;loading 时由 policy 禁止关闭 | Foundation |
|
|
159
|
-
| Sheet |
|
|
159
|
+
| Sheet | side、persistent-context 语义;blocking=true、outside pointer=false;dismissable 默认 true,false 禁用 Escape 并隐藏内置关闭按钮 | 同上;不能让 CSS 注释与 ARIA 语义继续冲突 | Foundation |
|
|
160
160
|
| Drawer | mobile bottom、gesture、outside/Escape 语义 | 同上;gesture 关闭仍必须服从 top-most 与 loading policy | Foundation |
|
|
161
161
|
|
|
162
162
|
组件接入不得一次性重写四个组件,也不得在未有单独 contract 的情况下改变公开 DOM、默认 dismissal 或 accessibility tier。
|
|
@@ -259,3 +259,7 @@ D7 q1travel-web adoption/migration
|
|
|
259
259
|
- 宿主每次 open 对应一次登记/释放;改变 blocking 策略应重新登记。idempotent disposer 支持 StrictMode 清理。不同 document 完全隔离。
|
|
260
260
|
|
|
261
261
|
回归入口:`node --test scripts/check-overlay-coordination.test.mjs`;真实跨 root 的 Escape、焦点、快捷键与滚动锁由 Web consumer 浏览器测试验证。
|
|
262
|
+
|
|
263
|
+
### Sheet sizing and dismissal
|
|
264
|
+
|
|
265
|
+
Sheet accepts optional `size: 'sm' | 'md' | 'lg' | 'xl'` for left/right panel widths of 360/480/640/860px, capped by the existing viewport gutters. Omitting size retains 512px. Top/bottom geometry, `title: string`, children, footer, and side remain unchanged. Dismissal policy updates take effect in the same commit as visible close controls, before consumer layout effects. `dismissable=false` retains its blocking coordinator entry, focus trap, inert background, and scroll lock; Escape cannot dismiss it or the underlying host overlay. Outside pointer never closes Sheet. Consumers retain ownership of controlled open and footer actions and restore dismissal when the temporary busy state ends.
|
|
@@ -1392,17 +1392,21 @@ export declare function Separator({ orientation, decorative, className, }: {
|
|
|
1392
1392
|
|
|
1393
1393
|
export declare type SeparatorOrientation = 'horizontal' | 'vertical';
|
|
1394
1394
|
|
|
1395
|
-
export declare function Sheet({ open, onClose, title, side, children, footer }: {
|
|
1395
|
+
export declare function Sheet({ open, onClose, title, side, size, dismissable, children, footer }: {
|
|
1396
1396
|
open: boolean;
|
|
1397
1397
|
onClose: () => void;
|
|
1398
1398
|
title: string;
|
|
1399
1399
|
side?: SheetSide;
|
|
1400
|
+
size?: SheetSize;
|
|
1401
|
+
dismissable?: boolean;
|
|
1400
1402
|
children: ReactNode;
|
|
1401
1403
|
footer?: ReactNode;
|
|
1402
1404
|
}): ReactNode;
|
|
1403
1405
|
|
|
1404
1406
|
export declare type SheetSide = 'top' | 'right' | 'bottom' | 'left';
|
|
1405
1407
|
|
|
1408
|
+
export declare type SheetSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
1409
|
+
|
|
1406
1410
|
export declare function ShowMore({ items, initial, noBorder, initialExpanded, }: {
|
|
1407
1411
|
items: string[];
|
|
1408
1412
|
initial?: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as l, jsx as t, Fragment as ae } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as Kt, createElement as
|
|
3
|
-
import { createPortal as
|
|
2
|
+
import { forwardRef as Kt, createElement as ct, useState as H, useRef as A, useEffect as G, useCallback as se, useLayoutEffect as ce, useMemo as oe, useContext as mt, createContext as pt, useId as te, useReducer as wn, Fragment as He, isValidElement as Nt, cloneElement as Nn, useImperativeHandle as vn } from "react";
|
|
3
|
+
import { createPortal as bt } from "react-dom";
|
|
4
4
|
const kn = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Ot = (...e) => e.filter((n, r, a) => !!n && n.trim() !== "" && a.indexOf(n) === r).join(" ").trim();
|
|
5
5
|
var xn = {
|
|
6
6
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -23,7 +23,7 @@ const Cn = Kt(
|
|
|
23
23
|
children: o,
|
|
24
24
|
iconNode: s,
|
|
25
25
|
...c
|
|
26
|
-
}, d) =>
|
|
26
|
+
}, d) => ct(
|
|
27
27
|
"svg",
|
|
28
28
|
{
|
|
29
29
|
ref: d,
|
|
@@ -36,14 +36,14 @@ const Cn = Kt(
|
|
|
36
36
|
...c
|
|
37
37
|
},
|
|
38
38
|
[
|
|
39
|
-
...s.map(([b, u]) =>
|
|
39
|
+
...s.map(([b, u]) => ct(b, u)),
|
|
40
40
|
...Array.isArray(o) ? o : [o]
|
|
41
41
|
]
|
|
42
42
|
)
|
|
43
43
|
);
|
|
44
44
|
const J = (e, n) => {
|
|
45
45
|
const r = Kt(
|
|
46
|
-
({ className: a, ...i }, o) =>
|
|
46
|
+
({ className: a, ...i }, o) => ct(Cn, {
|
|
47
47
|
ref: o,
|
|
48
48
|
iconNode: n,
|
|
49
49
|
className: Ot(`lucide-${kn(e)}`, a),
|
|
@@ -77,7 +77,7 @@ const me = J("ChevronRight", [
|
|
|
77
77
|
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
|
78
78
|
]);
|
|
79
79
|
const Ht = J("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
|
|
80
|
-
const
|
|
80
|
+
const _t = J("CircleAlert", [
|
|
81
81
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
82
82
|
["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
|
|
83
83
|
["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
|
|
@@ -137,7 +137,7 @@ const $n = J("Eye", [
|
|
|
137
137
|
],
|
|
138
138
|
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
139
139
|
]);
|
|
140
|
-
const
|
|
140
|
+
const vt = J("FileCode", [
|
|
141
141
|
["path", { d: "M10 12.5 8 15l2 2.5", key: "1tg20x" }],
|
|
142
142
|
["path", { d: "m14 12.5 2 2.5-2 2.5", key: "yinavb" }],
|
|
143
143
|
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
@@ -255,12 +255,12 @@ const je = J("TriangleAlert", [
|
|
|
255
255
|
const _e = J("X", [
|
|
256
256
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
257
257
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
258
|
-
]),
|
|
258
|
+
]), kt = /* @__PURE__ */ new WeakMap();
|
|
259
259
|
function ke() {
|
|
260
260
|
return typeof document > "u" ? null : document;
|
|
261
261
|
}
|
|
262
262
|
function de(e) {
|
|
263
|
-
const n =
|
|
263
|
+
const n = kt.get(e);
|
|
264
264
|
if (n) return n;
|
|
265
265
|
const r = {
|
|
266
266
|
root: null,
|
|
@@ -277,7 +277,7 @@ function de(e) {
|
|
|
277
277
|
observer: null,
|
|
278
278
|
coordinator: null
|
|
279
279
|
};
|
|
280
|
-
return
|
|
280
|
+
return kt.set(e, r), r;
|
|
281
281
|
}
|
|
282
282
|
function Vn(e) {
|
|
283
283
|
for (const n of e.listeners)
|
|
@@ -341,13 +341,13 @@ function Qn(e) {
|
|
|
341
341
|
}), a.style.position = "relative", a.style.isolation = "isolate", a.style.zIndex = `calc(var(--q1-z-overlay-root, 1300) + ${i})`;
|
|
342
342
|
});
|
|
343
343
|
}
|
|
344
|
-
function
|
|
344
|
+
function yt(e, n) {
|
|
345
345
|
const r = Gt(n);
|
|
346
346
|
for (const a of Array.from(e.body?.children ?? [])) {
|
|
347
347
|
let i = n.inertSnapshot.find((o) => o.element === a);
|
|
348
348
|
i || (i = { element: a, inert: a.inert }, n.inertSnapshot.push(i)), a.inert = r.includes(a) ? i.inert : !0;
|
|
349
349
|
}
|
|
350
|
-
n.backgroundInert = !0, !n.observer && e.defaultView?.MutationObserver && (n.observer = new e.defaultView.MutationObserver(() =>
|
|
350
|
+
n.backgroundInert = !0, !n.observer && e.defaultView?.MutationObserver && (n.observer = new e.defaultView.MutationObserver(() => yt(e, n)), n.observer.observe(e.body, { childList: !0 }));
|
|
351
351
|
}
|
|
352
352
|
function Yt(e) {
|
|
353
353
|
e.observer?.disconnect(), e.observer = null;
|
|
@@ -355,31 +355,31 @@ function Yt(e) {
|
|
|
355
355
|
n.element.inert = n.inert;
|
|
356
356
|
e.inertSnapshot = [], e.backgroundInert = !1;
|
|
357
357
|
}
|
|
358
|
-
function
|
|
358
|
+
function dt(e, n) {
|
|
359
359
|
const r = n.entries.filter((a) => a.blocking).length;
|
|
360
|
-
n.blockingCount = r, Qn(n), r > 0 ? (n.scrollLocked || Xn(e, n),
|
|
360
|
+
n.blockingCount = r, Qn(n), r > 0 ? (n.scrollLocked || Xn(e, n), yt(e, n)) : r === 0 && n.scrollLocked && (Zn(e, n), Yt(n)), Vn(n);
|
|
361
361
|
}
|
|
362
362
|
function Xt(e, n) {
|
|
363
363
|
const r = de(e);
|
|
364
364
|
if (r.entries.some((i) => i.id === n.id)) throw new Error(`Duplicate overlay id: ${n.id}`);
|
|
365
|
-
r.entries.push(n),
|
|
365
|
+
r.entries.push(n), dt(e, r);
|
|
366
366
|
let a = !0;
|
|
367
367
|
return () => {
|
|
368
368
|
if (!a) return;
|
|
369
369
|
a = !1;
|
|
370
370
|
const i = r.entries.indexOf(n);
|
|
371
|
-
i >= 0 && r.entries.splice(i, 1),
|
|
371
|
+
i >= 0 && r.entries.splice(i, 1), dt(e, r);
|
|
372
372
|
};
|
|
373
373
|
}
|
|
374
374
|
function Qe(e, n, r = "programmatic") {
|
|
375
375
|
const a = de(e), i = n.blocking && a.blockingCount === 1 && a.backgroundInert;
|
|
376
376
|
i && Yt(a), n.onClose(r), i && window.setTimeout(() => {
|
|
377
|
-
a.entries.includes(n) && a.blockingCount > 0 && !a.backgroundInert &&
|
|
377
|
+
a.entries.includes(n) && a.blockingCount > 0 && !a.backgroundInert && yt(e, a);
|
|
378
378
|
}, 0);
|
|
379
379
|
}
|
|
380
380
|
function Jn(e, n, r) {
|
|
381
381
|
const a = de(e), i = a.entries.find((o) => o.id === n);
|
|
382
|
-
i && (Object.assign(i, r),
|
|
382
|
+
i && (Object.assign(i, r), dt(e, a));
|
|
383
383
|
}
|
|
384
384
|
function Ce(e, n) {
|
|
385
385
|
return de(e).entries.at(-1)?.id === n;
|
|
@@ -440,9 +440,9 @@ const nr = {
|
|
|
440
440
|
success: Vt,
|
|
441
441
|
warning: je,
|
|
442
442
|
error: jt
|
|
443
|
-
},
|
|
443
|
+
}, xt = 3, Ct = 12, rr = 14, ar = 45, ir = 0.11, Jt = pt(null);
|
|
444
444
|
function or() {
|
|
445
|
-
const e =
|
|
445
|
+
const e = mt(Jt);
|
|
446
446
|
if (!e)
|
|
447
447
|
throw new Error("useToast 必须在 ToastProvider 内使用");
|
|
448
448
|
return e;
|
|
@@ -517,10 +517,10 @@ function Fa({ children: e }) {
|
|
|
517
517
|
let C = 0, g = 0;
|
|
518
518
|
for (let E = w.length - 1; E >= 0; E -= 1) {
|
|
519
519
|
const v = w[E], p = w.length - 1 - E, k = lr(v);
|
|
520
|
-
p === 0 && (g = k), v.style.setProperty("--depth", String(p)), v.style.setProperty("--h", `${k}px`), v.style.setProperty("--y", `${-C}px`), v.style.zIndex = String(100 + E), v.dataset.front = String(p === 0), v.dataset.visible = String(p <
|
|
520
|
+
p === 0 && (g = k), v.style.setProperty("--depth", String(p)), v.style.setProperty("--h", `${k}px`), v.style.setProperty("--y", `${-C}px`), v.style.zIndex = String(100 + E), v.dataset.front = String(p === 0), v.dataset.visible = String(p < xt), C += k + Ct;
|
|
521
521
|
}
|
|
522
522
|
h.style.setProperty("--front-h", `${g}px`);
|
|
523
|
-
const R = g + Math.min(w.length - 1,
|
|
523
|
+
const R = g + Math.min(w.length - 1, xt - 1) * rr, y = w.length === 0 ? 0 : b ? Math.max(C - Ct, 0) : R;
|
|
524
524
|
h.style.setProperty("--toast-stack-h", `${y}px`);
|
|
525
525
|
}, [n, b]), G(() => {
|
|
526
526
|
n.filter((h) => !h.removed).length <= 1 && u(!1);
|
|
@@ -722,7 +722,7 @@ function tn({
|
|
|
722
722
|
b
|
|
723
723
|
);
|
|
724
724
|
}
|
|
725
|
-
function
|
|
725
|
+
function qt(e) {
|
|
726
726
|
return e == null || e === "" || typeof e == "boolean" ? null : /* @__PURE__ */ t("span", { className: "button__affix", "aria-hidden": "true", children: e });
|
|
727
727
|
}
|
|
728
728
|
function hr({ busy: e, busyLabel: n, children: r }) {
|
|
@@ -745,9 +745,9 @@ function nn({
|
|
|
745
745
|
r || e ? r ? /* @__PURE__ */ t("span", { className: "button__spinner-slot", "aria-hidden": "true", children: /* @__PURE__ */ t(ve, { className: "button__spinner", size: 14, strokeWidth: 1.8, "aria-hidden": "true" }) }) : /* @__PURE__ */ l("span", { role: "status", children: [
|
|
746
746
|
/* @__PURE__ */ t(ve, { className: "button__spinner", size: 14, strokeWidth: 1.8, "aria-hidden": "true" }),
|
|
747
747
|
/* @__PURE__ */ t("span", { className: "q1-sr-only", children: n || "加载中…" })
|
|
748
|
-
] }) :
|
|
748
|
+
] }) : qt(i),
|
|
749
749
|
hr({ busy: r, busyLabel: a, children: o }),
|
|
750
|
-
|
|
750
|
+
qt(s),
|
|
751
751
|
c ? /* @__PURE__ */ t("kbd", { className: "button__shortcut", "aria-hidden": "true", children: c }) : null
|
|
752
752
|
] });
|
|
753
753
|
}
|
|
@@ -935,7 +935,7 @@ function mr({ "aria-label": e, ariaLabel: n, ...r }) {
|
|
|
935
935
|
const a = e ?? n;
|
|
936
936
|
return a?.trim() || console.warn("IconButton: 缺少 aria-label,纯图标按钮必须提供可访问名称。"), /* @__PURE__ */ t(an, { ...r, svgOnly: !0, "aria-label": a });
|
|
937
937
|
}
|
|
938
|
-
const on =
|
|
938
|
+
const on = pt(!1);
|
|
939
939
|
function Ne(e, n) {
|
|
940
940
|
return `${e}-${n ? "message" : "description"}`;
|
|
941
941
|
}
|
|
@@ -947,7 +947,7 @@ function Ge({
|
|
|
947
947
|
wide: i,
|
|
948
948
|
children: o
|
|
949
949
|
}) {
|
|
950
|
-
const s =
|
|
950
|
+
const s = mt(on), c = U("form-field", i ? "form-field--wide" : "", a ? "form-field--error" : ""), d = Ne(e, !!a);
|
|
951
951
|
return /* @__PURE__ */ l("div", { className: c, children: [
|
|
952
952
|
/* @__PURE__ */ t("label", { className: "form-field__label", htmlFor: e, children: n }),
|
|
953
953
|
o,
|
|
@@ -957,7 +957,7 @@ function Ge({
|
|
|
957
957
|
] }) : a ? /* @__PURE__ */ t("span", { className: "form-field__message", id: d, children: a }) : r ? /* @__PURE__ */ t("span", { className: "form-field__description", id: d, children: r }) : null
|
|
958
958
|
] });
|
|
959
959
|
}
|
|
960
|
-
function
|
|
960
|
+
function gt(...e) {
|
|
961
961
|
return e.filter(Boolean).join(" ") || void 0;
|
|
962
962
|
}
|
|
963
963
|
function Ye(...e) {
|
|
@@ -977,7 +977,7 @@ function Ye(...e) {
|
|
|
977
977
|
};
|
|
978
978
|
};
|
|
979
979
|
}
|
|
980
|
-
function
|
|
980
|
+
function wt(e, n, r) {
|
|
981
981
|
G(() => {
|
|
982
982
|
}, [n, e, r]);
|
|
983
983
|
}
|
|
@@ -1018,14 +1018,14 @@ function pr({
|
|
|
1018
1018
|
children: T ? /* @__PURE__ */ t(Dn, { "aria-hidden": "true", size: 16, strokeWidth: 1.8 }) : /* @__PURE__ */ t($n, { "aria-hidden": "true", size: 16, strokeWidth: 1.8 })
|
|
1019
1019
|
}
|
|
1020
1020
|
) : null;
|
|
1021
|
-
|
|
1021
|
+
wt("Input", v, p);
|
|
1022
1022
|
const W = r || a ? Ne(E, !!a) : void 0, O = U("form-control", m !== "md" ? `form-control--${m}` : "", N ?? ""), K = U("input-control", f ? "input-control--rounded" : ""), $ = /* @__PURE__ */ t(
|
|
1023
1023
|
"input",
|
|
1024
1024
|
{
|
|
1025
1025
|
ref: k,
|
|
1026
1026
|
id: E,
|
|
1027
1027
|
className: O,
|
|
1028
|
-
"aria-describedby":
|
|
1028
|
+
"aria-describedby": gt(o, W),
|
|
1029
1029
|
"aria-invalid": i || a ? !0 : void 0,
|
|
1030
1030
|
...R,
|
|
1031
1031
|
...x ? { type: T ? "text" : "password" } : null
|
|
@@ -1125,7 +1125,7 @@ function Ha({
|
|
|
1125
1125
|
readOnly: o,
|
|
1126
1126
|
required: s,
|
|
1127
1127
|
invalid: c || !!m || !!k,
|
|
1128
|
-
errorId:
|
|
1128
|
+
errorId: gt(d, h, F, f === void 0 && k ? K : void 0),
|
|
1129
1129
|
"aria-label": N,
|
|
1130
1130
|
"aria-labelledby": x,
|
|
1131
1131
|
onFocus: (P) => B(P.currentTarget),
|
|
@@ -1289,7 +1289,7 @@ function Ua({
|
|
|
1289
1289
|
..._
|
|
1290
1290
|
}) {
|
|
1291
1291
|
const m = te(), N = e ?? m, x = n === void 0, h = A(null), w = oe(() => Ye(h, s), [s]);
|
|
1292
|
-
|
|
1292
|
+
wt("Textarea", x, h);
|
|
1293
1293
|
const [C, g] = H(
|
|
1294
1294
|
() => typeof _.defaultValue == "string" ? _.defaultValue.length : 0
|
|
1295
1295
|
), R = typeof _.value == "string" ? _.value.length : C, y = u !== void 0, E = !x && (r || a) ? Ne(N, !!a) : void 0, v = U(
|
|
@@ -1304,7 +1304,7 @@ function Ua({
|
|
|
1304
1304
|
ref: w,
|
|
1305
1305
|
className: v,
|
|
1306
1306
|
maxLength: u,
|
|
1307
|
-
"aria-describedby":
|
|
1307
|
+
"aria-describedby": gt(o, E),
|
|
1308
1308
|
"aria-invalid": i || a ? !0 : void 0,
|
|
1309
1309
|
onInput: y ? (M) => {
|
|
1310
1310
|
g(M.currentTarget.value.length), f?.(M);
|
|
@@ -1372,7 +1372,7 @@ function ln({
|
|
|
1372
1372
|
...c
|
|
1373
1373
|
}) {
|
|
1374
1374
|
const d = te(), b = e ?? d, u = n === void 0, f = s === "radio", _ = !f && (r || a) ? Ne(b, !!a) : void 0, m = f ? "control-option__visual control-option__visual--radio" : "control-option__visual", N = A(null), x = oe(() => Ye(N, o), [o]);
|
|
1375
|
-
|
|
1375
|
+
wt(f ? "Radio" : "Checkbox", u, N), G(() => {
|
|
1376
1376
|
N.current && (N.current.indeterminate = !f && !!i);
|
|
1377
1377
|
}, [i, f]);
|
|
1378
1378
|
const h = /* @__PURE__ */ t(
|
|
@@ -1773,7 +1773,7 @@ function ai(e) {
|
|
|
1773
1773
|
},
|
|
1774
1774
|
_.label
|
|
1775
1775
|
)) }) : b ? /* @__PURE__ */ l("span", { className: "codeblock__filename", children: [
|
|
1776
|
-
/* @__PURE__ */ t(
|
|
1776
|
+
/* @__PURE__ */ t(vt, { size: 14, strokeWidth: 2, "aria-hidden": "true" }),
|
|
1777
1777
|
b
|
|
1778
1778
|
] }) : /* @__PURE__ */ t("span", {}),
|
|
1779
1779
|
/* @__PURE__ */ t(
|
|
@@ -1788,7 +1788,7 @@ function ai(e) {
|
|
|
1788
1788
|
)
|
|
1789
1789
|
] }),
|
|
1790
1790
|
c?.filename ? /* @__PURE__ */ l("div", { className: "codeblock__tabfile", children: [
|
|
1791
|
-
/* @__PURE__ */ t(
|
|
1791
|
+
/* @__PURE__ */ t(vt, { size: 14, strokeWidth: 2, "aria-hidden": "true" }),
|
|
1792
1792
|
c.filename
|
|
1793
1793
|
] }) : null,
|
|
1794
1794
|
/* @__PURE__ */ t("pre", { className: "codeblock__pre", children: /* @__PURE__ */ t("code", { children: d.map((_, m) => {
|
|
@@ -1891,7 +1891,7 @@ function ii({
|
|
|
1891
1891
|
) : null
|
|
1892
1892
|
] });
|
|
1893
1893
|
}
|
|
1894
|
-
const dn =
|
|
1894
|
+
const dn = pt(null);
|
|
1895
1895
|
function oi({ multiple: e, children: n }) {
|
|
1896
1896
|
const [r, a] = H(null);
|
|
1897
1897
|
return /* @__PURE__ */ t("div", { className: "collapse-group", children: /* @__PURE__ */ t(dn.Provider, { value: e ? null : { openId: r, setOpenId: a }, children: n }) });
|
|
@@ -1902,7 +1902,7 @@ function si({
|
|
|
1902
1902
|
small: r,
|
|
1903
1903
|
children: a
|
|
1904
1904
|
}) {
|
|
1905
|
-
const i =
|
|
1905
|
+
const i = mt(dn), o = te(), [s, c] = H(n ?? !1);
|
|
1906
1906
|
ce(() => {
|
|
1907
1907
|
i && n && i.setOpenId(o);
|
|
1908
1908
|
}, []);
|
|
@@ -2040,10 +2040,10 @@ function li({ sections: e, triggerLabel: n = "打开命令面板", hotkey: r })
|
|
|
2040
2040
|
] }) : null
|
|
2041
2041
|
] });
|
|
2042
2042
|
}
|
|
2043
|
-
function
|
|
2043
|
+
function Et(e, n) {
|
|
2044
2044
|
return `${e}:${n}`;
|
|
2045
2045
|
}
|
|
2046
|
-
function
|
|
2046
|
+
function It(e, n, r) {
|
|
2047
2047
|
return `${e}-option-${n}-${r}`;
|
|
2048
2048
|
}
|
|
2049
2049
|
function ci({
|
|
@@ -2062,7 +2062,7 @@ function ci({
|
|
|
2062
2062
|
const f = te(), _ = `${f}-dialog`, m = `${f}-listbox`, N = A(null), x = A(null), h = A(null), w = A(null), C = A(null), g = oe(
|
|
2063
2063
|
() => i.flatMap(
|
|
2064
2064
|
(I, W) => I.items.flatMap(
|
|
2065
|
-
(O, K) => O.disabled ? [] : [{ key:
|
|
2065
|
+
(O, K) => O.disabled ? [] : [{ key: Et(W, K), optionId: It(f, W, K), item: O }]
|
|
2066
2066
|
)
|
|
2067
2067
|
),
|
|
2068
2068
|
[f, i]
|
|
@@ -2197,13 +2197,13 @@ function ci({
|
|
|
2197
2197
|
children: [
|
|
2198
2198
|
I.heading ? /* @__PURE__ */ t("div", { className: "search-dialog__heading", id: O, children: I.heading }) : null,
|
|
2199
2199
|
I.items.map((K, $) => {
|
|
2200
|
-
const F =
|
|
2200
|
+
const F = Et(W, $), B = v?.key === F;
|
|
2201
2201
|
return /* @__PURE__ */ l(
|
|
2202
2202
|
"button",
|
|
2203
2203
|
{
|
|
2204
2204
|
type: "button",
|
|
2205
2205
|
className: `search-dialog__option${B ? " search-dialog__option--active" : ""}${K.disabled ? " search-dialog__option--disabled" : ""}`,
|
|
2206
|
-
id:
|
|
2206
|
+
id: It(f, W, $),
|
|
2207
2207
|
role: "option",
|
|
2208
2208
|
"aria-selected": B,
|
|
2209
2209
|
"aria-disabled": K.disabled || void 0,
|
|
@@ -2255,7 +2255,7 @@ const yr = [
|
|
|
2255
2255
|
"textarea:not([disabled])",
|
|
2256
2256
|
'[contenteditable="true"]',
|
|
2257
2257
|
'[tabindex]:not([tabindex="-1"])'
|
|
2258
|
-
].join(","), et = /* @__PURE__ */ new WeakMap(),
|
|
2258
|
+
].join(","), et = /* @__PURE__ */ new WeakMap(), tt = typeof document > "u" ? G : ce;
|
|
2259
2259
|
function un(e) {
|
|
2260
2260
|
return e ? Array.from(e.querySelectorAll(yr)).filter(
|
|
2261
2261
|
(n) => (!n.hasAttribute("tabindex") || n.tabIndex >= 0) && Xe(n)
|
|
@@ -2292,7 +2292,7 @@ function St(e, n, r) {
|
|
|
2292
2292
|
const o = i[0], s = i.at(-1);
|
|
2293
2293
|
!a?.contains(n.activeElement) || n.activeElement === a ? (e.preventDefault(), (e.shiftKey ? s : o).focus()) : e.shiftKey && n.activeElement === o ? (e.preventDefault(), s.focus()) : !e.shiftKey && n.activeElement === s && (e.preventDefault(), o.focus());
|
|
2294
2294
|
}
|
|
2295
|
-
function
|
|
2295
|
+
function nt(e, n) {
|
|
2296
2296
|
if (!e) return;
|
|
2297
2297
|
const r = n?.current;
|
|
2298
2298
|
(r && e.contains(r) && Xe(r) ? r : un(e)[0] ?? e).focus();
|
|
@@ -2369,23 +2369,23 @@ function De({
|
|
|
2369
2369
|
y.current = null, h(null);
|
|
2370
2370
|
};
|
|
2371
2371
|
}, [o, e, i, p]);
|
|
2372
|
-
|
|
2372
|
+
tt(() => {
|
|
2373
2373
|
if (d === "layout")
|
|
2374
2374
|
return k();
|
|
2375
2375
|
}, [k, d]), G(() => {
|
|
2376
2376
|
if (d === "deferred")
|
|
2377
2377
|
return k();
|
|
2378
|
-
}, [k, d]),
|
|
2378
|
+
}, [k, d]), tt(() => {
|
|
2379
2379
|
!e || typeof document > "u" || !E.current || Jn(document, E.current.id, {
|
|
2380
2380
|
blocking: n,
|
|
2381
2381
|
escape: _ ? !_.busy : r,
|
|
2382
2382
|
outsidePointer: a
|
|
2383
2383
|
});
|
|
2384
|
-
}, [n, r, _, e, a]),
|
|
2385
|
-
!e || !b || c !== "layout" ||
|
|
2384
|
+
}, [n, r, _, e, a]), tt(() => {
|
|
2385
|
+
!e || !b || c !== "layout" || nt(o.current, s);
|
|
2386
2386
|
}, [o, b, s, c, e, x]), G(() => {
|
|
2387
2387
|
if (!e || !b || c !== "deferred") return;
|
|
2388
|
-
const I = window.setTimeout(() =>
|
|
2388
|
+
const I = window.setTimeout(() => nt(o.current, s), 0);
|
|
2389
2389
|
return () => window.clearTimeout(I);
|
|
2390
2390
|
}, [o, b, s, c, e, x]);
|
|
2391
2391
|
const M = se((I) => {
|
|
@@ -2409,9 +2409,9 @@ function De({
|
|
|
2409
2409
|
const I = E.current;
|
|
2410
2410
|
if (!I || !Ce(document, I.id)) return !1;
|
|
2411
2411
|
const W = I.getContainer();
|
|
2412
|
-
return W?.isConnected ? (
|
|
2412
|
+
return W?.isConnected ? (nt(W, s), W.contains(document.activeElement)) : !1;
|
|
2413
2413
|
}, [s]), z = se(
|
|
2414
|
-
(I) => x ?
|
|
2414
|
+
(I) => x ? bt(I, x) : u ? null : I,
|
|
2415
2415
|
[u, x]
|
|
2416
2416
|
);
|
|
2417
2417
|
return { focusInitialIfTopMost: T, onKeyDown: M, portal: z, portalRoot: x, requestClose: S };
|
|
@@ -2647,7 +2647,7 @@ function mi({
|
|
|
2647
2647
|
children: a
|
|
2648
2648
|
}) {
|
|
2649
2649
|
return /* @__PURE__ */ l("div", { className: `error-msg error-msg--${n}`, role: "alert", "aria-live": "assertive", children: [
|
|
2650
|
-
/* @__PURE__ */ t(
|
|
2650
|
+
/* @__PURE__ */ t(_t, { className: "error-msg__icon", size: 16, strokeWidth: 2, "aria-hidden": "true" }),
|
|
2651
2651
|
/* @__PURE__ */ l("span", { className: "error-msg__text", children: [
|
|
2652
2652
|
/* @__PURE__ */ t("span", { className: "q1-sr-only", children: "错误:" }),
|
|
2653
2653
|
e ? /* @__PURE__ */ t("strong", { className: "error-msg__label", children: e }) : null,
|
|
@@ -2658,7 +2658,7 @@ function mi({
|
|
|
2658
2658
|
}
|
|
2659
2659
|
function pi({ title: e, message: n, action: r }) {
|
|
2660
2660
|
return /* @__PURE__ */ l("div", { className: "error-card", role: "alert", "aria-live": "assertive", children: [
|
|
2661
|
-
/* @__PURE__ */ t(
|
|
2661
|
+
/* @__PURE__ */ t(_t, { className: "error-card__icon", size: 20, strokeWidth: 2, "aria-hidden": "true" }),
|
|
2662
2662
|
/* @__PURE__ */ l("p", { className: "error-card__title", children: [
|
|
2663
2663
|
/* @__PURE__ */ t("span", { className: "q1-sr-only", children: "错误:" }),
|
|
2664
2664
|
e
|
|
@@ -3495,18 +3495,18 @@ const fn = {
|
|
|
3495
3495
|
attemptedScopeId: null,
|
|
3496
3496
|
restoreFocusId: null
|
|
3497
3497
|
};
|
|
3498
|
-
function
|
|
3498
|
+
function rt() {
|
|
3499
3499
|
return { ...fn };
|
|
3500
3500
|
}
|
|
3501
3501
|
function Dr(e, n) {
|
|
3502
3502
|
switch (n.type) {
|
|
3503
3503
|
case "open":
|
|
3504
3504
|
case "close":
|
|
3505
|
-
return
|
|
3505
|
+
return rt();
|
|
3506
3506
|
case "openScope":
|
|
3507
3507
|
return { ...e, view: "scope", query: "", activeId: null, restoreFocusId: null };
|
|
3508
3508
|
case "selectCurrentScope":
|
|
3509
|
-
return
|
|
3509
|
+
return rt();
|
|
3510
3510
|
case "attemptScope":
|
|
3511
3511
|
return {
|
|
3512
3512
|
...e,
|
|
@@ -3523,7 +3523,7 @@ function Dr(e, n) {
|
|
|
3523
3523
|
return { ...e, restoreFocusId: null };
|
|
3524
3524
|
case "reconcileScope": {
|
|
3525
3525
|
const r = e.attemptedScopeId;
|
|
3526
|
-
return r !== null && n.previousPendingId === r && !n.pendingId ? !n.hasError && n.selectedId === r ?
|
|
3526
|
+
return r !== null && n.previousPendingId === r && !n.pendingId ? !n.hasError && n.selectedId === r ? rt() : {
|
|
3527
3527
|
...e,
|
|
3528
3528
|
view: "scope",
|
|
3529
3529
|
activeId: r,
|
|
@@ -3533,7 +3533,7 @@ function Dr(e, n) {
|
|
|
3533
3533
|
}
|
|
3534
3534
|
}
|
|
3535
3535
|
}
|
|
3536
|
-
const
|
|
3536
|
+
const at = typeof document > "u" ? G : ce, $r = 500;
|
|
3537
3537
|
function We(e) {
|
|
3538
3538
|
return e.trim().toLocaleLowerCase();
|
|
3539
3539
|
}
|
|
@@ -3598,16 +3598,16 @@ function Lr({
|
|
|
3598
3598
|
selectedId: a.selectedId,
|
|
3599
3599
|
hasError: !!o
|
|
3600
3600
|
}), M.current = i;
|
|
3601
|
-
}, [o, i, a.selectedId, g.attemptedScopeId]),
|
|
3601
|
+
}, [o, i, a.selectedId, g.attemptedScopeId]), at(() => {
|
|
3602
3602
|
if (!g.restoreFocusId) return;
|
|
3603
3603
|
const q = E.current[g.restoreFocusId];
|
|
3604
3604
|
q ? q.focus() : g.view === "scope" && p.current ? p.current.focus() : k.current?.focus(), R({ type: "restoreFocusHandled" });
|
|
3605
|
-
}, [g.restoreFocusId]),
|
|
3605
|
+
}, [g.restoreFocusId]), at(() => {
|
|
3606
3606
|
if (!f || S.current) return;
|
|
3607
3607
|
S.current = !0;
|
|
3608
3608
|
const q = F.find((L) => L.id === B) ?? F[0];
|
|
3609
3609
|
q ? E.current[q.id]?.focus() : P ? v.current?.focus() : k.current?.focus();
|
|
3610
|
-
}, [P, F, f, B]),
|
|
3610
|
+
}, [P, F, f, B]), at(() => {
|
|
3611
3611
|
T.current !== g.view && (T.current = g.view, g.view === "scope" ? p.current?.focus() : v.current?.focus());
|
|
3612
3612
|
}, [g.view]);
|
|
3613
3613
|
function D(q) {
|
|
@@ -4194,17 +4194,17 @@ function Kr({
|
|
|
4194
4194
|
);
|
|
4195
4195
|
}
|
|
4196
4196
|
const be = 8, Dt = 4, $t = typeof document > "u" ? G : ce;
|
|
4197
|
-
let ge = null, Ke = 0,
|
|
4197
|
+
let ge = null, Ke = 0, ut = !1;
|
|
4198
4198
|
function Or() {
|
|
4199
4199
|
if (typeof document > "u") return null;
|
|
4200
4200
|
if (!ge || ge.parentElement !== document.body) {
|
|
4201
4201
|
const e = document.body.querySelector(':scope > [data-q1-portal="context-switcher"]');
|
|
4202
|
-
ge = e ?? document.createElement("div"),
|
|
4202
|
+
ge = e ?? document.createElement("div"), ut = !e, e || (ge.setAttribute("data-q1-portal", "context-switcher"), document.body.append(ge));
|
|
4203
4203
|
}
|
|
4204
4204
|
return Ke += 1, ge;
|
|
4205
4205
|
}
|
|
4206
4206
|
function Br() {
|
|
4207
|
-
Ke = Math.max(0, Ke - 1), !(Ke > 0) && (
|
|
4207
|
+
Ke = Math.max(0, Ke - 1), !(Ke > 0) && (ut && ge?.remove(), ge = null, ut = !1);
|
|
4208
4208
|
}
|
|
4209
4209
|
function Hr({
|
|
4210
4210
|
controlled: e,
|
|
@@ -4513,7 +4513,7 @@ function Ti({
|
|
|
4513
4513
|
onClose: ee,
|
|
4514
4514
|
onOverlayKeyDown: P.onKeyDown
|
|
4515
4515
|
}
|
|
4516
|
-
), Ie = w ? z ? D.portalRoot ?
|
|
4516
|
+
), Ie = w ? z ? D.portalRoot ? bt(xe, D.portalRoot) : null : P.portal(xe) : null;
|
|
4517
4517
|
return /* @__PURE__ */ l(
|
|
4518
4518
|
"div",
|
|
4519
4519
|
{
|
|
@@ -4607,10 +4607,10 @@ function Yr({
|
|
|
4607
4607
|
function E(p) {
|
|
4608
4608
|
p.key === "Escape" && g();
|
|
4609
4609
|
}
|
|
4610
|
-
i && (!
|
|
4610
|
+
i && (!Nt(i) || i.type === He) && console.warn(
|
|
4611
4611
|
`Tooltip:children 必须是单个合法元素/组件(不能是纯文本、Fragment 或多个子节点),已回退为默认触发器${a ? `(文案:"${a}")` : "——但没有传 triggerLabel,会渲染成一个看不出用途的空文案按钮"}。`
|
|
4612
4612
|
);
|
|
4613
|
-
const v = i &&
|
|
4613
|
+
const v = i && Nt(i) && i.type !== He ? Nn(i, {
|
|
4614
4614
|
"aria-describedby": x,
|
|
4615
4615
|
onFocus: (p) => {
|
|
4616
4616
|
i.props.onFocus?.(p), C();
|
|
@@ -4635,7 +4635,7 @@ function Yr({
|
|
|
4635
4635
|
);
|
|
4636
4636
|
return /* @__PURE__ */ l("span", { ref: m, className: "q1-tooltip", onMouseEnter: C, onMouseLeave: g, children: [
|
|
4637
4637
|
v,
|
|
4638
|
-
h ?
|
|
4638
|
+
h ? bt(
|
|
4639
4639
|
/* @__PURE__ */ t("span", { ref: N, role: "tooltip", id: x, className: y, style: R, children: e }),
|
|
4640
4640
|
h
|
|
4641
4641
|
) : null
|
|
@@ -4943,7 +4943,7 @@ const ra = {
|
|
|
4943
4943
|
default: Ve,
|
|
4944
4944
|
success: On,
|
|
4945
4945
|
warning: je,
|
|
4946
|
-
error:
|
|
4946
|
+
error: _t
|
|
4947
4947
|
};
|
|
4948
4948
|
function Hi({ variant: e = "default", message: n, cta: r }) {
|
|
4949
4949
|
const a = ra[e];
|
|
@@ -5630,12 +5630,12 @@ function _n({ value: e, depth: n, path: r, collapsedDepth: a, highlight: i, seen
|
|
|
5630
5630
|
/* @__PURE__ */ t("span", { className: "q1-json-view__punct q1-json-view__closer", children: _ })
|
|
5631
5631
|
] });
|
|
5632
5632
|
}
|
|
5633
|
-
function
|
|
5633
|
+
function ht(e, n) {
|
|
5634
5634
|
if (typeof e == "string") return `"${e}"`;
|
|
5635
5635
|
if (e === null || typeof e != "object") return String(e);
|
|
5636
5636
|
if (n.has(e)) return "<循环引用>";
|
|
5637
5637
|
const r = new Set(n).add(e);
|
|
5638
|
-
return Array.isArray(e) ? `[${e.map((i) =>
|
|
5638
|
+
return Array.isArray(e) ? `[${e.map((i) => ht(i, r)).join(", ")}]` : `{${Object.entries(e).map(([i, o]) => `"${i}": ${ht(o, r)}`).join(", ")}}`;
|
|
5639
5639
|
}
|
|
5640
5640
|
function no({
|
|
5641
5641
|
value: e,
|
|
@@ -5654,7 +5654,7 @@ function no({
|
|
|
5654
5654
|
n && "q1-json-view--single-line",
|
|
5655
5655
|
c
|
|
5656
5656
|
);
|
|
5657
|
-
return /* @__PURE__ */ t("div", { className: b, role: "group", "aria-label": s, children: n ? /* @__PURE__ */ t("span", { className: "q1-json-view__single", children:
|
|
5657
|
+
return /* @__PURE__ */ t("div", { className: b, role: "group", "aria-label": s, children: n ? /* @__PURE__ */ t("span", { className: "q1-json-view__single", children: ht(e, /* @__PURE__ */ new Set()) }) : /* @__PURE__ */ t(
|
|
5658
5658
|
_n,
|
|
5659
5659
|
{
|
|
5660
5660
|
value: e,
|
|
@@ -5732,12 +5732,12 @@ function ao({
|
|
|
5732
5732
|
o
|
|
5733
5733
|
] });
|
|
5734
5734
|
}
|
|
5735
|
-
const gn = "q1travel-design-system-theme",
|
|
5735
|
+
const gn = "q1travel-design-system-theme", it = "q1travel-theme-change";
|
|
5736
5736
|
function Ft() {
|
|
5737
5737
|
const e = window.localStorage.getItem(gn);
|
|
5738
5738
|
return e === "light" || e === "dark" || e === "system" ? e : "system";
|
|
5739
5739
|
}
|
|
5740
|
-
function
|
|
5740
|
+
function ot(e) {
|
|
5741
5741
|
const n = document.documentElement, r = e === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : e;
|
|
5742
5742
|
n.dataset.themeMode = e, n.dataset.theme = r;
|
|
5743
5743
|
const a = document.querySelector("#q1-theme-color"), i = r === "dark" ? a?.dataset.dark : a?.dataset.light;
|
|
@@ -5746,13 +5746,13 @@ function it(e) {
|
|
|
5746
5746
|
function va() {
|
|
5747
5747
|
const [e, n] = H(Ft);
|
|
5748
5748
|
return G(() => {
|
|
5749
|
-
|
|
5750
|
-
const a = window.matchMedia("(prefers-color-scheme: dark)"), i = () => e === "system" &&
|
|
5751
|
-
return a.addEventListener("change", i), window.addEventListener(
|
|
5752
|
-
a.removeEventListener("change", i), window.removeEventListener(
|
|
5749
|
+
ot(e);
|
|
5750
|
+
const a = window.matchMedia("(prefers-color-scheme: dark)"), i = () => e === "system" && ot("system"), o = () => n(Ft());
|
|
5751
|
+
return a.addEventListener("change", i), window.addEventListener(it, o), window.addEventListener("storage", o), () => {
|
|
5752
|
+
a.removeEventListener("change", i), window.removeEventListener(it, o), window.removeEventListener("storage", o);
|
|
5753
5753
|
};
|
|
5754
5754
|
}, [e]), [e, (a) => {
|
|
5755
|
-
window.localStorage.setItem(gn, a),
|
|
5755
|
+
window.localStorage.setItem(gn, a), ot(a), n(a), window.dispatchEvent(new Event(it));
|
|
5756
5756
|
}];
|
|
5757
5757
|
}
|
|
5758
5758
|
const ka = [
|
|
@@ -5981,35 +5981,35 @@ function ho({ items: e, label: n }) {
|
|
|
5981
5981
|
/* @__PURE__ */ t("li", { className: "breadcrumb__item", children: /* @__PURE__ */ t(Oe, { crumb: o }) })
|
|
5982
5982
|
] }) });
|
|
5983
5983
|
}
|
|
5984
|
-
function fo({ open: e, onClose: n, title: r, side: a = "right",
|
|
5985
|
-
const
|
|
5984
|
+
function fo({ open: e, onClose: n, title: r, side: a = "right", size: i, dismissable: o = !0, children: s, footer: c }) {
|
|
5985
|
+
const d = A(null), b = te(), { onKeyDown: u, portal: f } = De({
|
|
5986
5986
|
open: e,
|
|
5987
5987
|
blocking: !0,
|
|
5988
|
-
dismissable:
|
|
5988
|
+
dismissable: o,
|
|
5989
5989
|
outsidePointer: !1,
|
|
5990
|
-
containerRef:
|
|
5990
|
+
containerRef: d,
|
|
5991
5991
|
onClose: n
|
|
5992
5992
|
});
|
|
5993
|
-
return e ?
|
|
5993
|
+
return e ? f(
|
|
5994
5994
|
/* @__PURE__ */ l(ae, { children: [
|
|
5995
|
-
/* @__PURE__ */ t("div", { className: "sheet__backdrop", "aria-hidden": "true", onMouseDown: (
|
|
5995
|
+
/* @__PURE__ */ t("div", { className: "sheet__backdrop", "aria-hidden": "true", onMouseDown: (_) => _.preventDefault() }),
|
|
5996
5996
|
/* @__PURE__ */ l(
|
|
5997
5997
|
"div",
|
|
5998
5998
|
{
|
|
5999
|
-
ref:
|
|
5999
|
+
ref: d,
|
|
6000
6000
|
role: "dialog",
|
|
6001
6001
|
"aria-modal": "true",
|
|
6002
|
-
"aria-labelledby":
|
|
6003
|
-
className: `sheet__panel sheet__panel--${a}`,
|
|
6002
|
+
"aria-labelledby": b,
|
|
6003
|
+
className: `sheet__panel sheet__panel--${a}${i ? ` sheet__panel--${i}` : ""}`,
|
|
6004
6004
|
tabIndex: -1,
|
|
6005
|
-
onKeyDown:
|
|
6005
|
+
onKeyDown: u,
|
|
6006
6006
|
children: [
|
|
6007
6007
|
/* @__PURE__ */ l("header", { className: "sheet__header", children: [
|
|
6008
|
-
/* @__PURE__ */ t("h2", { className: "sheet__title", id:
|
|
6009
|
-
/* @__PURE__ */ t("button", { type: "button", className: "sheet__close", "aria-label": "关闭", onClick: n, children: /* @__PURE__ */ t(_e, { size: 16, strokeWidth: 2, "aria-hidden": "true" }) })
|
|
6008
|
+
/* @__PURE__ */ t("h2", { className: "sheet__title", id: b, children: r }),
|
|
6009
|
+
o ? /* @__PURE__ */ t("button", { type: "button", className: "sheet__close", "aria-label": "关闭", onClick: n, children: /* @__PURE__ */ t(_e, { size: 16, strokeWidth: 2, "aria-hidden": "true" }) }) : null
|
|
6010
6010
|
] }),
|
|
6011
|
-
/* @__PURE__ */ t("div", { className: "sheet__body", children:
|
|
6012
|
-
|
|
6011
|
+
/* @__PURE__ */ t("div", { className: "sheet__body", children: s }),
|
|
6012
|
+
c ? /* @__PURE__ */ t("footer", { className: "sheet__footer", children: c }) : null
|
|
6013
6013
|
]
|
|
6014
6014
|
}
|
|
6015
6015
|
)
|
|
@@ -6483,10 +6483,10 @@ function ne(e) {
|
|
|
6483
6483
|
function we(e, n) {
|
|
6484
6484
|
return new Date(e.getFullYear(), e.getMonth(), e.getDate() + n);
|
|
6485
6485
|
}
|
|
6486
|
-
function
|
|
6486
|
+
function st(e, n) {
|
|
6487
6487
|
return new Date(e.getFullYear(), e.getMonth() + n, 1);
|
|
6488
6488
|
}
|
|
6489
|
-
function
|
|
6489
|
+
function ft(e) {
|
|
6490
6490
|
return new Date(e.getFullYear(), e.getMonth(), 1);
|
|
6491
6491
|
}
|
|
6492
6492
|
function Se(e, n) {
|
|
@@ -6496,13 +6496,13 @@ function Ea(e, n) {
|
|
|
6496
6496
|
return Math.round((n.getTime() - e.getTime()) / 864e5) + 1;
|
|
6497
6497
|
}
|
|
6498
6498
|
function Ia(e) {
|
|
6499
|
-
const n =
|
|
6499
|
+
const n = ft(e), r = we(n, -n.getDay());
|
|
6500
6500
|
return Array.from({ length: 42 }, (a, i) => {
|
|
6501
6501
|
const o = we(r, i);
|
|
6502
6502
|
return { date: o, inMonth: o.getMonth() === n.getMonth() };
|
|
6503
6503
|
});
|
|
6504
6504
|
}
|
|
6505
|
-
function
|
|
6505
|
+
function lt(e, n, r) {
|
|
6506
6506
|
return !!(n && ne(e) < ne(n) || r && ne(e) > ne(r));
|
|
6507
6507
|
}
|
|
6508
6508
|
function Wt(e, n, r) {
|
|
@@ -6517,7 +6517,7 @@ function Sa({
|
|
|
6517
6517
|
today: o = /* @__PURE__ */ new Date()
|
|
6518
6518
|
}) {
|
|
6519
6519
|
const [s, c] = H(
|
|
6520
|
-
() =>
|
|
6520
|
+
() => ft(Wt(e.start ?? o, a, i))
|
|
6521
6521
|
), [d, b] = H(null), [u, f] = H(() => Wt(e.start ?? o, a, i)), [_, m] = H(""), N = A(/* @__PURE__ */ new Map()), x = A(null), h = Ia(s);
|
|
6522
6522
|
G(() => {
|
|
6523
6523
|
if (!x.current) return;
|
|
@@ -6534,7 +6534,7 @@ function Sa({
|
|
|
6534
6534
|
n({ start: p, end: k }), m(`已选择 ${ne(p)} 至 ${ne(k)},共 ${Ea(p, k)} 天`);
|
|
6535
6535
|
}
|
|
6536
6536
|
function g(v) {
|
|
6537
|
-
|
|
6537
|
+
lt(v, a, i) || ((v.getMonth() !== s.getMonth() || v.getFullYear() !== s.getFullYear()) && c(ft(v)), f(v), x.current = ne(v));
|
|
6538
6538
|
}
|
|
6539
6539
|
function R(v) {
|
|
6540
6540
|
let p = null;
|
|
@@ -6558,14 +6558,14 @@ function Sa({
|
|
|
6558
6558
|
p = we(u, 6 - u.getDay());
|
|
6559
6559
|
break;
|
|
6560
6560
|
case "PageUp":
|
|
6561
|
-
p =
|
|
6561
|
+
p = st(u, -1);
|
|
6562
6562
|
break;
|
|
6563
6563
|
case "PageDown":
|
|
6564
|
-
p =
|
|
6564
|
+
p = st(u, 1);
|
|
6565
6565
|
break;
|
|
6566
6566
|
case "Enter":
|
|
6567
6567
|
case " ":
|
|
6568
|
-
v.preventDefault(),
|
|
6568
|
+
v.preventDefault(), lt(u, a, i) || C(u);
|
|
6569
6569
|
return;
|
|
6570
6570
|
default:
|
|
6571
6571
|
return;
|
|
@@ -6573,7 +6573,7 @@ function Sa({
|
|
|
6573
6573
|
v.preventDefault(), p && g(p);
|
|
6574
6574
|
}
|
|
6575
6575
|
function y(v) {
|
|
6576
|
-
const p =
|
|
6576
|
+
const p = st(s, v);
|
|
6577
6577
|
c(p), f(p);
|
|
6578
6578
|
}
|
|
6579
6579
|
const E = `${s.getFullYear()} 年 ${s.getMonth() + 1} 月`;
|
|
@@ -6605,7 +6605,7 @@ function Sa({
|
|
|
6605
6605
|
] }),
|
|
6606
6606
|
/* @__PURE__ */ t("div", { className: "calendar__weekdays", "aria-hidden": "true", children: qa.map((v, p) => /* @__PURE__ */ t("span", { className: "calendar__weekday", children: v }, `${v}-${p}`)) }),
|
|
6607
6607
|
/* @__PURE__ */ t("div", { className: "calendar__grid", role: "grid", "aria-label": E, onKeyDown: R, children: h.map(({ date: v, inMonth: p }) => {
|
|
6608
|
-
const k = !p ||
|
|
6608
|
+
const k = !p || lt(v, a, i), M = Se(v, w.start), S = Se(v, w.end), T = !!w.start && !!w.end && !Se(w.start, w.end), z = T && ne(v) > ne(w.start) && ne(v) < ne(w.end), I = U(
|
|
6609
6609
|
"calendar__cell",
|
|
6610
6610
|
z ? "calendar__cell--in-range" : "",
|
|
6611
6611
|
T && M ? "calendar__cell--range-start" : "",
|
package/dist-pkg/style.css
CHANGED
|
@@ -7751,11 +7751,23 @@ a.q1-card:focus-visible {
|
|
|
7751
7751
|
0 2px 6px color-mix(in srgb, var(--q1-color-shadow) 12%, transparent),
|
|
7752
7752
|
0 8px 40px color-mix(in srgb, var(--q1-color-shadow) 28%, transparent);
|
|
7753
7753
|
}
|
|
7754
|
+
.sheet__panel--sm {
|
|
7755
|
+
--q1-sheet-width: 360px;
|
|
7756
|
+
}
|
|
7757
|
+
.sheet__panel--md {
|
|
7758
|
+
--q1-sheet-width: 480px;
|
|
7759
|
+
}
|
|
7760
|
+
.sheet__panel--lg {
|
|
7761
|
+
--q1-sheet-width: 640px;
|
|
7762
|
+
}
|
|
7763
|
+
.sheet__panel--xl {
|
|
7764
|
+
--q1-sheet-width: 860px;
|
|
7765
|
+
}
|
|
7754
7766
|
.sheet__panel--right,
|
|
7755
7767
|
.sheet__panel--left {
|
|
7756
7768
|
top: calc(var(--q1-space-3) + env(safe-area-inset-top, 0px));
|
|
7757
7769
|
bottom: calc(var(--q1-space-3) + env(safe-area-inset-bottom, 0px));
|
|
7758
|
-
width: min(512px, calc(100vw - 2 * var(--q1-space-3)));
|
|
7770
|
+
width: min(var(--q1-sheet-width, 512px), calc(100vw - 2 * var(--q1-space-3)));
|
|
7759
7771
|
}
|
|
7760
7772
|
.sheet__panel--right {
|
|
7761
7773
|
right: calc(var(--q1-space-3) + env(safe-area-inset-right, 0px));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@q1travel/design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist-pkg/design-system.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"check:shell": "npm run sync:contracts && node scripts/check-shell.mjs && node scripts/check-token-package.mjs && npm run check:release-provenance",
|
|
38
38
|
"check:browser:strictmode": "node scripts/check-browser.mjs --strictmode-ref",
|
|
39
39
|
"check:browser": "npm run check:browser:strictmode && node scripts/check-browser.mjs",
|
|
40
|
-
"check:package-api": "node scripts/check-package-api.mjs && node --test scripts/check-q1-design-lint.test.mjs && node --test scripts/check-json-view-contract.test.mjs && node --test scripts/check-verification-code-input.test.mjs && node --test scripts/check-controls-contract.test.mjs && node --test scripts/check-pagination-contract.test.mjs && node --test scripts/check-table-core.test.mjs scripts/check-table-interaction.test.mjs scripts/check-table-layout.test.mjs && node --test scripts/check-overlay-coordination.test.mjs",
|
|
40
|
+
"check:package-api": "node scripts/check-package-api.mjs && node --test scripts/check-q1-design-lint.test.mjs && node --test scripts/check-json-view-contract.test.mjs && node --test scripts/check-verification-code-input.test.mjs && node --test scripts/check-controls-contract.test.mjs && node --test scripts/check-pagination-contract.test.mjs && node --test scripts/check-table-core.test.mjs scripts/check-table-interaction.test.mjs scripts/check-table-layout.test.mjs && node --test scripts/check-overlay-coordination.test.mjs scripts/check-sheet-contract.test.mjs",
|
|
41
41
|
"check:release-provenance": "node --test scripts/check-release-provenance.test.mjs && node scripts/check-release-provenance.mjs",
|
|
42
42
|
"check:release-sync": "node --test scripts/release-npm.test.mjs",
|
|
43
43
|
"release:npm": "node scripts/release-npm.mjs",
|