@wisdomgarden/torque 0.2.1 → 0.2.3
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/dist/common/is-dev.d.ts +1 -0
- package/dist/common/is-dev.js +5 -0
- package/dist/components/_inner/drawer/base-bottom-drawer.d.ts +1 -1
- package/dist/components/_inner/drawer/base-bottom-drawer.js +52 -44
- package/dist/components/_inner/menu/_web/menu.web.js +83 -72
- package/dist/components/_inner/portal/index.d.ts +1 -0
- package/dist/components/_inner/portal/index.js +5 -0
- package/dist/components/_inner/portal/portal.d.ts +14 -0
- package/dist/components/_inner/portal/portal.js +19 -0
- package/dist/components/button/styles/button-variables.module.css.js +1 -1
- package/dist/components/drawer/drawer.d.ts +1 -1
- package/dist/components/drawer/drawer.js +42 -34
- package/dist/components/modal/index.d.ts +1 -1
- package/dist/components/modal/modal.d.ts +7 -4
- package/dist/components/modal/modal.js +191 -44
- package/dist/components/modal/modal.module.css.js +20 -6
- package/dist/components/modal/modal.types.d.ts +96 -0
- package/dist/components/modal-deprecated/index.d.ts +2 -0
- package/dist/components/modal-deprecated/index.js +5 -0
- package/dist/components/modal-deprecated/modal-deprecated.d.ts +11 -0
- package/dist/components/modal-deprecated/modal-deprecated.js +70 -0
- package/dist/components/modal-deprecated/modal-deprecated.module.css.js +10 -0
- package/dist/components/notifications/index.d.ts +2 -0
- package/dist/components/notifications/index.js +4 -2
- package/dist/components/notifications/notifications-container.d.ts +9 -0
- package/dist/components/notifications/notifications-container.js +22 -0
- package/dist/components/overlay-layer/constants.d.ts +14 -0
- package/dist/components/overlay-layer/constants.js +8 -0
- package/dist/components/overlay-layer/index.d.ts +5 -0
- package/dist/components/overlay-layer/index.js +10 -0
- package/dist/components/overlay-layer/overlay-parent-context.d.ts +6 -0
- package/dist/components/overlay-layer/overlay-parent-context.js +18 -0
- package/dist/components/overlay-layer/overlay-stack-debug.d.ts +24 -0
- package/dist/components/overlay-layer/overlay-stack-debug.js +151 -0
- package/dist/components/overlay-layer/overlay-stack.d.ts +38 -0
- package/dist/components/overlay-layer/overlay-stack.js +137 -0
- package/dist/components/overlay-layer/overlay-tier-scope.d.ts +12 -0
- package/dist/components/overlay-layer/overlay-tier-scope.js +16 -0
- package/dist/components/overlay-layer/types.d.ts +63 -0
- package/dist/components/overlay-layer/use-mantine-overlay-layer.d.ts +21 -0
- package/dist/components/overlay-layer/use-mantine-overlay-layer.js +24 -0
- package/dist/components/overlay-layer/use-overlay-layer.d.ts +26 -0
- package/dist/components/overlay-layer/use-overlay-layer.js +77 -0
- package/dist/components/popover/hooks.d.ts +0 -1
- package/dist/components/popover/hooks.js +69 -83
- package/dist/components/popover/popover-context.d.ts +0 -1
- package/dist/components/popover/popover-context.js +3 -4
- package/dist/components/popover/popover-dropdown.js +110 -91
- package/dist/components/popover/popover.js +120 -129
- package/dist/components/popover/popover.types.d.ts +18 -5
- package/dist/components/tooltip/index.d.ts +10 -2
- package/dist/components/tooltip/index.js +100 -92
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +193 -182
- package/dist/provider/hooks.js +12 -11
- package/dist/provider/ui-context.d.ts +10 -0
- package/dist/provider/ui-context.js +8 -7
- package/dist/provider/ui-provider.d.ts +23 -1
- package/dist/provider/ui-provider.js +17 -10
- package/package.json +3 -3
- package/dist/components/popover/popover-stack.d.ts +0 -10
- package/dist/components/popover/popover-stack.js +0 -24
|
@@ -1,51 +1,198 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
3
|
+
import { RemoveScroll as rt } from "@mantine/core";
|
|
4
|
+
import { useMergedRef as nt, useIsomorphicEffect as at } from "@mantine/hooks";
|
|
5
|
+
import { clsx as i } from "clsx";
|
|
6
|
+
import { useId as ot, useRef as l, useEffect as f, useCallback as st } from "react";
|
|
5
7
|
import "../../provider/ui-context.js";
|
|
6
|
-
import "
|
|
7
|
-
import {
|
|
8
|
-
import { IconButton as
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
8
|
+
import { useLocale as ct } from "../../provider/hooks.js";
|
|
9
|
+
import { Portal as it } from "../_inner/portal/portal.js";
|
|
10
|
+
import { IconButton as lt } from "../icon-button/icon-button.js";
|
|
11
|
+
import { OverlayParentProvider as dt } from "../overlay-layer/overlay-parent-context.js";
|
|
12
|
+
import { useOverlayLayerInternal as ut } from "../overlay-layer/use-overlay-layer.js";
|
|
13
|
+
import { useAnimatedMount as mt, getFocusableElements as M } from "../popover/hooks.js";
|
|
14
|
+
import n from "./modal.module.css.js";
|
|
15
|
+
const z = 200, ft = z + 100, xt = {
|
|
16
|
+
xs: "320px",
|
|
17
|
+
sm: "380px",
|
|
18
|
+
md: "440px",
|
|
19
|
+
lg: "620px",
|
|
20
|
+
xl: "780px"
|
|
21
|
+
}, vt = {
|
|
22
|
+
xs: "var(--t-space-mini)",
|
|
23
|
+
sm: "var(--t-space-xs)",
|
|
24
|
+
md: "var(--t-space-lg)",
|
|
25
|
+
lg: "var(--t-space-xl)",
|
|
26
|
+
xl: "var(--t-space-xxl)"
|
|
27
|
+
}, gt = {
|
|
28
|
+
xs: "2px",
|
|
29
|
+
sm: "var(--t-radius-xs)",
|
|
30
|
+
md: "var(--t-radius-sm)",
|
|
31
|
+
lg: "var(--t-radius-lg)",
|
|
32
|
+
xl: "var(--t-radius-lg)"
|
|
33
|
+
}, ht = /^\d+(\.\d+)?$/, b = (t) => typeof t == "number" || ht.test(t) ? `${t}px` : t, E = (t, o) => typeof o == "string" && o in t ? t[o] : b(o), Lt = ({
|
|
34
|
+
opened: t,
|
|
35
|
+
onClose: o,
|
|
36
|
+
title: s,
|
|
37
|
+
children: D,
|
|
38
|
+
centered: U = !0,
|
|
39
|
+
size: I = "md",
|
|
40
|
+
classNames: d,
|
|
41
|
+
className: _,
|
|
42
|
+
zIndex: $,
|
|
43
|
+
padding: j = "xl",
|
|
44
|
+
radius: P = "lg",
|
|
45
|
+
withCloseButton: T = !0,
|
|
46
|
+
closeOnClickOutside: q = !1,
|
|
47
|
+
closeOnEscape: G = !0,
|
|
48
|
+
closeButtonProps: x,
|
|
49
|
+
onExitTransitionEnd: R,
|
|
50
|
+
transitionProps: N,
|
|
51
|
+
overlayProps: S,
|
|
52
|
+
onClick: H,
|
|
53
|
+
keepMounted: K = !1,
|
|
54
|
+
yOffset: X = "5dvh",
|
|
55
|
+
xOffset: Y = "5vw",
|
|
56
|
+
"aria-label": A
|
|
32
57
|
}) => {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
58
|
+
const Z = ct(), C = ot(), c = l(null), { mounted: v, animState: O, handleTransitionEnd: w } = mt(
|
|
59
|
+
t,
|
|
60
|
+
K
|
|
61
|
+
), g = ut({
|
|
62
|
+
opened: t,
|
|
63
|
+
zIndex: $,
|
|
64
|
+
close: () => o(),
|
|
65
|
+
closeOnEscape: G,
|
|
66
|
+
closeOnClickOutside: q,
|
|
67
|
+
name: "modal"
|
|
68
|
+
}), J = nt(c, g.ref), u = l(!1), h = l(t), L = l({
|
|
69
|
+
handleTransitionEnd: w,
|
|
70
|
+
onExitTransitionEnd: R,
|
|
71
|
+
onExited: N?.onExited
|
|
72
|
+
});
|
|
73
|
+
f(() => {
|
|
74
|
+
L.current = {
|
|
75
|
+
handleTransitionEnd: w,
|
|
76
|
+
onExitTransitionEnd: R,
|
|
77
|
+
onExited: N?.onExited
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
const y = st(() => {
|
|
81
|
+
if (!u.current) return;
|
|
82
|
+
u.current = !1;
|
|
83
|
+
const e = L.current;
|
|
84
|
+
e.onExitTransitionEnd?.(), e.onExited?.(), e.handleTransitionEnd();
|
|
85
|
+
}, []);
|
|
86
|
+
f(() => {
|
|
87
|
+
if (t) {
|
|
88
|
+
h.current = !0, u.current = !1;
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (!h.current) return;
|
|
92
|
+
h.current = !1, u.current = !0;
|
|
93
|
+
const e = window.setTimeout(y, ft);
|
|
94
|
+
return () => window.clearTimeout(e);
|
|
95
|
+
}, [t, y]);
|
|
96
|
+
const Q = (e) => {
|
|
97
|
+
e.target === e.currentTarget && O === "closing" && y();
|
|
98
|
+
}, m = l(null);
|
|
99
|
+
at(() => {
|
|
100
|
+
t && !m.current && (m.current = document.activeElement);
|
|
101
|
+
}, [t]), f(() => {
|
|
102
|
+
if (!t || !v) return;
|
|
103
|
+
const e = c.current;
|
|
104
|
+
if (!e || e.contains(document.activeElement)) return;
|
|
105
|
+
(e.querySelector("[data-autofocus]") ?? M([e])[0] ?? e).focus();
|
|
106
|
+
}, [t, v]), f(() => {
|
|
107
|
+
if (t) return;
|
|
108
|
+
const e = m.current;
|
|
109
|
+
if (m.current = null, !e?.isConnected) return;
|
|
110
|
+
const a = document.activeElement;
|
|
111
|
+
(!a || a === document.body || c.current?.contains(a)) && e.focus();
|
|
112
|
+
}, [t]);
|
|
113
|
+
const k = (e) => /* @__PURE__ */ r(
|
|
114
|
+
"span",
|
|
115
|
+
{
|
|
116
|
+
tabIndex: 0,
|
|
117
|
+
"data-focus-sentinel": e,
|
|
118
|
+
"aria-hidden": "true",
|
|
119
|
+
className: n.sentinel,
|
|
120
|
+
onFocus: () => {
|
|
121
|
+
const a = M([c.current]);
|
|
122
|
+
((e === "start" ? a[a.length - 1] : a[0]) ?? c.current)?.focus();
|
|
45
123
|
}
|
|
46
|
-
|
|
47
|
-
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
if (!v) return null;
|
|
127
|
+
const F = s != null && s !== !1, V = F || T, W = S?.backgroundOpacity ?? S?.opacity ?? 0.6, B = typeof s == "string" ? "h2" : "div", tt = {
|
|
128
|
+
zIndex: g.zIndex,
|
|
129
|
+
"--modal-size": I === "auto" ? "auto" : E(xt, I),
|
|
130
|
+
"--modal-padding": E(vt, j),
|
|
131
|
+
"--modal-radius": E(gt, P),
|
|
132
|
+
"--modal-y-offset": b(X),
|
|
133
|
+
"--modal-x-offset": b(Y),
|
|
134
|
+
"--modal-overlay-opacity": W,
|
|
135
|
+
"--modal-duration": `${z}ms`
|
|
136
|
+
};
|
|
137
|
+
return /* @__PURE__ */ r(it, { children: /* @__PURE__ */ r(rt, { enabled: t, children: /* @__PURE__ */ p(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
className: i(n.root, _),
|
|
141
|
+
style: tt,
|
|
142
|
+
"data-state": O,
|
|
143
|
+
"data-centered": U || void 0,
|
|
144
|
+
"aria-hidden": t ? void 0 : !0,
|
|
145
|
+
inert: t ? void 0 : !0,
|
|
146
|
+
children: [
|
|
147
|
+
/* @__PURE__ */ r("div", { className: n.overlay, "aria-hidden": "true" }),
|
|
148
|
+
/* @__PURE__ */ r("div", { className: n.inner, children: /* @__PURE__ */ p(
|
|
149
|
+
"div",
|
|
150
|
+
{
|
|
151
|
+
ref: J,
|
|
152
|
+
role: "dialog",
|
|
153
|
+
"aria-modal": "true",
|
|
154
|
+
"aria-label": A,
|
|
155
|
+
"aria-labelledby": !A && F ? C : void 0,
|
|
156
|
+
tabIndex: -1,
|
|
157
|
+
className: i(n.content, d?.content),
|
|
158
|
+
onClick: H,
|
|
159
|
+
onTransitionEnd: Q,
|
|
160
|
+
children: [
|
|
161
|
+
k("start"),
|
|
162
|
+
V && /* @__PURE__ */ p("div", { className: i(n.header, d?.header), children: [
|
|
163
|
+
/* @__PURE__ */ r(
|
|
164
|
+
B,
|
|
165
|
+
{
|
|
166
|
+
id: C,
|
|
167
|
+
className: i(n.title, d?.title),
|
|
168
|
+
children: s
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
T && /* @__PURE__ */ r(
|
|
172
|
+
lt,
|
|
173
|
+
{
|
|
174
|
+
variant: "text",
|
|
175
|
+
color: "regular",
|
|
176
|
+
size: "lg",
|
|
177
|
+
iconName: "close",
|
|
178
|
+
className: n.close,
|
|
179
|
+
disabled: x?.disabled,
|
|
180
|
+
"aria-label": x?.["aria-label"] ?? Z.close,
|
|
181
|
+
onClick: (e) => {
|
|
182
|
+
x?.onClick?.(e), o();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
] }),
|
|
187
|
+
/* @__PURE__ */ r("div", { className: i(n.body, d?.body), children: /* @__PURE__ */ r(dt, { id: g.id, children: D }) }),
|
|
188
|
+
k("end")
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
) })
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
) }) });
|
|
48
195
|
};
|
|
49
196
|
export {
|
|
50
|
-
|
|
197
|
+
Lt as Modal
|
|
51
198
|
};
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e = "
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const e = "_root_pliga_3", t = "_overlay_pliga_12", n = "_inner_pliga_13", o = "_content_pliga_42", _ = "_header_pliga_67", l = "_title_pliga_81", s = "_close_pliga_92", i = "_body_pliga_97", a = "_sentinel_pliga_105", c = {
|
|
3
|
+
root: e,
|
|
4
|
+
overlay: t,
|
|
5
|
+
inner: n,
|
|
6
|
+
content: o,
|
|
7
|
+
header: _,
|
|
8
|
+
title: l,
|
|
9
|
+
close: s,
|
|
10
|
+
body: i,
|
|
11
|
+
sentinel: a
|
|
5
12
|
};
|
|
6
13
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
i as body,
|
|
15
|
+
s as close,
|
|
16
|
+
o as content,
|
|
17
|
+
c as default,
|
|
18
|
+
_ as header,
|
|
19
|
+
n as inner,
|
|
20
|
+
t as overlay,
|
|
21
|
+
e as root,
|
|
22
|
+
a as sentinel,
|
|
23
|
+
l as title
|
|
10
24
|
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export type ModalSizePreset = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
+
export type ModalSpacingPreset = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
|
+
export type ModalClassNames = Partial<Record<'header' | 'title' | 'body' | 'content', string>>;
|
|
5
|
+
export interface ModalCloseButtonProps {
|
|
6
|
+
/** 覆盖关闭按钮默认的可访问名(默认取 locale 的「关闭」) */
|
|
7
|
+
'aria-label'?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/** 点击关闭按钮时先调它,再调 `onClose` */
|
|
10
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
11
|
+
}
|
|
12
|
+
export interface ModalOverlayProps {
|
|
13
|
+
/** 遮罩不透明度,与 `backgroundOpacity` 等价 */
|
|
14
|
+
opacity?: number;
|
|
15
|
+
/** 遮罩不透明度 */
|
|
16
|
+
backgroundOpacity?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ModalProps {
|
|
19
|
+
/** 是否打开(受控) */
|
|
20
|
+
opened: boolean;
|
|
21
|
+
/** 关闭回调:点关闭按钮、按 Escape、点遮罩(`closeOnClickOutside` 为 true 时)都会触发 */
|
|
22
|
+
onClose: () => void;
|
|
23
|
+
/** 标题。字符串会作为对话框的可访问名;传 `null` / 不传且 `withCloseButton={false}` 时不渲染头部 */
|
|
24
|
+
title?: React.ReactNode;
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* 是否垂直居中
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
centered?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 宽度:预设名、数字(px)、纯数字字符串(当 px,如 `"800"`)、`'auto'` 或带单位的 CSS 值(`'30rem'`、`'50%'`)
|
|
33
|
+
* @default 'md'
|
|
34
|
+
*/
|
|
35
|
+
size?: ModalSizePreset | number | string;
|
|
36
|
+
/** 槽位类名:头部 / 标题 / 内容区 / 面板 */
|
|
37
|
+
classNames?: ModalClassNames;
|
|
38
|
+
/** 根节点类名 */
|
|
39
|
+
className?: string;
|
|
40
|
+
/** 显式层级。不传则由层级模块按打开顺序计算(普通层从 200 起) */
|
|
41
|
+
zIndex?: number;
|
|
42
|
+
/**
|
|
43
|
+
* 面板内边距(头部与内容区共用):`'xl'` = 24px、`'lg'` = 20px,或数字(px)
|
|
44
|
+
* @default 'xl'
|
|
45
|
+
*/
|
|
46
|
+
padding?: ModalSpacingPreset | number | string;
|
|
47
|
+
/**
|
|
48
|
+
* 面板圆角:预设名、数字(px)或 CSS 值(如 `'var(--t-radius-lg)'`)
|
|
49
|
+
* @default 'lg'
|
|
50
|
+
*/
|
|
51
|
+
radius?: ModalSpacingPreset | number | string;
|
|
52
|
+
/**
|
|
53
|
+
* 是否显示右上角关闭按钮
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
withCloseButton?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* 点遮罩是否关闭
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
closeOnClickOutside?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* 本弹窗是参与关闭的最上层时,按 Escape 是否关闭
|
|
64
|
+
* @default true
|
|
65
|
+
*/
|
|
66
|
+
closeOnEscape?: boolean;
|
|
67
|
+
/** 关闭按钮的少量属性 */
|
|
68
|
+
closeButtonProps?: ModalCloseButtonProps;
|
|
69
|
+
/** 关闭动画结束后调用(只认面板的过渡,恰好一次) */
|
|
70
|
+
onExitTransitionEnd?: () => void;
|
|
71
|
+
/** 兼容写法:`transitionProps.onExited` 等同 `onExitTransitionEnd` */
|
|
72
|
+
transitionProps?: {
|
|
73
|
+
onExited?: () => void;
|
|
74
|
+
};
|
|
75
|
+
/** 遮罩属性,只支持不透明度 */
|
|
76
|
+
overlayProps?: ModalOverlayProps;
|
|
77
|
+
/** 面板上的点击 */
|
|
78
|
+
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
79
|
+
/**
|
|
80
|
+
* 关闭后保留 DOM(隐藏且不可交互,不占层级栈)
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
keepMounted?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* 面板与视口上下边缘的最小距离:数字(px)或 CSS 值
|
|
86
|
+
* @default '5dvh'
|
|
87
|
+
*/
|
|
88
|
+
yOffset?: number | string;
|
|
89
|
+
/**
|
|
90
|
+
* 面板与视口左右边缘的最小距离:数字(px)或 CSS 值
|
|
91
|
+
* @default '5vw'
|
|
92
|
+
*/
|
|
93
|
+
xOffset?: number | string;
|
|
94
|
+
/** 对话框的可访问名;不传时用 `title` */
|
|
95
|
+
'aria-label'?: string;
|
|
96
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Modal as MModal } from '@mantine/core';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated 用 `Modal`。只给暂时迁不了的调用点(`fullScreen` 等新 Modal 还没覆盖的能力)使用,迁完即删。
|
|
4
|
+
*/
|
|
5
|
+
export type ModalDeprecatedProps = Omit<Parameters<typeof MModal>[0], 'closeButtonProps'>;
|
|
6
|
+
/**
|
|
7
|
+
* Pc端弹窗组件(Mantine 薄封装的旧实现)
|
|
8
|
+
*
|
|
9
|
+
* @deprecated 用 `Modal`。只给暂时迁不了的调用点(`fullScreen` 等新 Modal 还没覆盖的能力)使用,迁完即删。
|
|
10
|
+
*/
|
|
11
|
+
export declare const ModalDeprecated: ({ children, withCloseButton, title, ref, ...props }: ModalDeprecatedProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as a, jsxs as m } from "react/jsx-runtime";
|
|
3
|
+
import { Modal as p } from "@mantine/core";
|
|
4
|
+
import { useMergedRef as u } from "@mantine/hooks";
|
|
5
|
+
import { clsx as n } from "clsx";
|
|
6
|
+
import "../../provider/ui-context.js";
|
|
7
|
+
import "react";
|
|
8
|
+
import { useLocale as g } from "../../provider/hooks.js";
|
|
9
|
+
import { IconButton as v } from "../icon-button/icon-button.js";
|
|
10
|
+
import { OverlayParentProvider as x } from "../overlay-layer/overlay-parent-context.js";
|
|
11
|
+
import { useMantineOverlayLayer as h } from "../overlay-layer/use-mantine-overlay-layer.js";
|
|
12
|
+
import { Text as y } from "../text/text.js";
|
|
13
|
+
import c from "./modal-deprecated.module.css.js";
|
|
14
|
+
const d = (e, o) => e && typeof e == "object" ? e[o] : void 0, P = ({
|
|
15
|
+
children: e,
|
|
16
|
+
withCloseButton: o = !0,
|
|
17
|
+
title: t,
|
|
18
|
+
ref: i,
|
|
19
|
+
...r
|
|
20
|
+
}) => {
|
|
21
|
+
const l = h("Modal", r, "modal-deprecated"), s = u(l.rootRef, i), f = t || o;
|
|
22
|
+
return /* @__PURE__ */ a(
|
|
23
|
+
p,
|
|
24
|
+
{
|
|
25
|
+
...r,
|
|
26
|
+
ref: s,
|
|
27
|
+
zIndex: l.zIndex,
|
|
28
|
+
closeOnEscape: !1,
|
|
29
|
+
closeOnClickOutside: !1,
|
|
30
|
+
title: void 0,
|
|
31
|
+
withCloseButton: !1,
|
|
32
|
+
children: /* @__PURE__ */ m(x, { id: l.id, children: [
|
|
33
|
+
f && /* @__PURE__ */ a(
|
|
34
|
+
C,
|
|
35
|
+
{
|
|
36
|
+
title: t,
|
|
37
|
+
withCloseButton: o,
|
|
38
|
+
onClose: r.onClose,
|
|
39
|
+
classNames: r.classNames
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
e
|
|
43
|
+
] })
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}, C = ({
|
|
47
|
+
title: e,
|
|
48
|
+
withCloseButton: o,
|
|
49
|
+
onClose: t,
|
|
50
|
+
classNames: i
|
|
51
|
+
}) => {
|
|
52
|
+
const r = g(), s = typeof e == "string" ? y : "div";
|
|
53
|
+
return /* @__PURE__ */ m("div", { className: n(c.header, d(i, "header")), children: [
|
|
54
|
+
/* @__PURE__ */ a(s, { className: n(c.title, d(i, "title")), children: e }),
|
|
55
|
+
o && /* @__PURE__ */ a(
|
|
56
|
+
v,
|
|
57
|
+
{
|
|
58
|
+
variant: "text",
|
|
59
|
+
color: "regular",
|
|
60
|
+
size: "lg",
|
|
61
|
+
iconName: "close",
|
|
62
|
+
onClick: () => t?.(),
|
|
63
|
+
"aria-label": r.close
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] });
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
P as ModalDeprecated
|
|
70
|
+
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { notifications } from './notifications';
|
|
2
2
|
export { Notification } from './notification';
|
|
3
|
+
export { NotificationsContainer } from './notifications-container';
|
|
4
|
+
export type { NotificationsContainerProps } from './notifications-container';
|
|
3
5
|
export type { NotificationOption } from './notification.types';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { notifications as t } from "./notifications.js";
|
|
3
|
-
import { Notification as
|
|
3
|
+
import { Notification as r } from "./notification.js";
|
|
4
|
+
import { NotificationsContainer as f } from "./notifications-container.js";
|
|
4
5
|
export {
|
|
5
|
-
|
|
6
|
+
r as Notification,
|
|
7
|
+
f as NotificationsContainer,
|
|
6
8
|
t as notifications
|
|
7
9
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type NotificationsProps as MNotificationsProps } from '@mantine/notifications';
|
|
2
|
+
export type NotificationsContainerProps = Omit<MNotificationsProps, 'zIndex'>;
|
|
3
|
+
/**
|
|
4
|
+
* 通知与消息的渲染容器,应用根部挂一次即可。
|
|
5
|
+
*
|
|
6
|
+
* `notifications.showXxx()` 和 `messages.showXxx()` 都渲染在这里。层级固定为组件库保留的通知档
|
|
7
|
+
* (在引导层之下、其余所有浮层之上),不接受 `zIndex`,业务不需要也不能决定它。
|
|
8
|
+
*/
|
|
9
|
+
export declare function NotificationsContainer({ position, limit, ...props }: NotificationsContainerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { Notifications as n } from "@mantine/notifications";
|
|
4
|
+
import { OVERLAY_TIER_NOTIFICATION as e } from "../overlay-layer/constants.js";
|
|
5
|
+
function I({
|
|
6
|
+
position: o = "top-right",
|
|
7
|
+
limit: t = 5,
|
|
8
|
+
...i
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ r(
|
|
11
|
+
n,
|
|
12
|
+
{
|
|
13
|
+
position: o,
|
|
14
|
+
limit: t,
|
|
15
|
+
...i,
|
|
16
|
+
zIndex: e
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
I as NotificationsContainer
|
|
22
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** 普通层的基准层级:所有普通浮层(弹窗、下拉、抽屉、提示)都从这里起算。 */
|
|
2
|
+
export declare const OVERLAY_BASE = 200;
|
|
3
|
+
/**
|
|
4
|
+
* 顶层档位的下限。小于它的层级都归普通层;10000 – 15999 按千位分档,
|
|
5
|
+
* 由业务在自己的档位表里声明(悬浮按钮、AI 侧边栏、引导层……)。
|
|
6
|
+
*/
|
|
7
|
+
export declare const OVERLAY_TOP_MIN = 10000;
|
|
8
|
+
/**
|
|
9
|
+
* 组件库保留给通知 / 消息的一档,不对外导出:由 `NotificationsContainer` 直接用作显式层级,不进栈。
|
|
10
|
+
* 它不是最高档:引导层(15000)要盖住通知。
|
|
11
|
+
*/
|
|
12
|
+
export declare const OVERLAY_TIER_NOTIFICATION = 14000;
|
|
13
|
+
/** 顶层档位的上限(不含),只用于开发环境校验 */
|
|
14
|
+
export declare const OVERLAY_TOP_MAX = 16000;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { useOverlayLayer } from './use-overlay-layer';
|
|
2
|
+
export { OverlayTierScope } from './overlay-tier-scope';
|
|
3
|
+
export type { OverlayTierScopeProps } from './overlay-tier-scope';
|
|
4
|
+
export { OVERLAY_BASE, OVERLAY_TOP_MIN } from './constants';
|
|
5
|
+
export type { OverlayCloseReason, OverlayLayerOptions, OverlayLayerResult, } from './types';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useOverlayLayer as o } from "./use-overlay-layer.js";
|
|
3
|
+
import { OverlayTierScope as p } from "./overlay-tier-scope.js";
|
|
4
|
+
import { OVERLAY_BASE as a, OVERLAY_TOP_MIN as f } from "./constants.js";
|
|
5
|
+
export {
|
|
6
|
+
a as OVERLAY_BASE,
|
|
7
|
+
f as OVERLAY_TOP_MIN,
|
|
8
|
+
p as OverlayTierScope,
|
|
9
|
+
o as useOverlayLayer
|
|
10
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
3
|
+
import { useContext as n, useMemo as u, createContext as a } from "react";
|
|
4
|
+
const i = [], e = a(i);
|
|
5
|
+
function m() {
|
|
6
|
+
return n(e);
|
|
7
|
+
}
|
|
8
|
+
function x({
|
|
9
|
+
id: t,
|
|
10
|
+
children: o
|
|
11
|
+
}) {
|
|
12
|
+
const r = n(e), s = u(() => [...r, t], [r, t]);
|
|
13
|
+
return /* @__PURE__ */ c(e.Provider, { value: s, children: o });
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
x as OverlayParentProvider,
|
|
17
|
+
m as useOverlayAncestors
|
|
18
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { OverlayStackDebugEntry } from './types';
|
|
2
|
+
/** 面板根节点上的标记:层级模块的全局监听看到它就跳过,调试面板不参与 Escape / 点外面 */
|
|
3
|
+
export declare const OVERLAY_DEBUG_ATTRIBUTE = "data-torque-overlay-debug";
|
|
4
|
+
export declare const OVERLAY_DEBUG_GLOBAL = "torqueOverlayStack";
|
|
5
|
+
interface DebugDeps {
|
|
6
|
+
subscribe: (listener: () => void) => () => void;
|
|
7
|
+
getSnapshot: () => readonly OverlayStackDebugEntry[];
|
|
8
|
+
}
|
|
9
|
+
export interface OverlayStackDebugApi {
|
|
10
|
+
/** 打开层级栈调试面板 */
|
|
11
|
+
open: () => void;
|
|
12
|
+
/** 关闭面板,停止订阅栈 */
|
|
13
|
+
close: () => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 开发环境的层级栈调试面板。原生 DOM 实现,不依赖宿主的 React 树。
|
|
17
|
+
*
|
|
18
|
+
* 只在打开期间订阅栈、生成快照;关闭后退订并移除节点,栈那边不再为它做任何事。
|
|
19
|
+
* 打开状态和位置记在 sessionStorage,刷新页面后保持。
|
|
20
|
+
*/
|
|
21
|
+
export declare function createOverlayStackDebug({ subscribe, getSnapshot, }: DebugDeps): OverlayStackDebugApi;
|
|
22
|
+
/** 开发环境:把调试入口挂到 window 上;上次刷新前开着的话直接恢复 */
|
|
23
|
+
export declare function installOverlayStackDebug(deps: DebugDeps): void;
|
|
24
|
+
export {};
|