@jc-times/business-ui 0.3.0 → 0.3.1
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/CHANGELOG.md +4 -0
- package/dist/Alert.js +5 -1
- package/dist/Button.js +1 -1
- package/dist/Cascader.js +19 -19
- package/dist/Combobox.js +38 -38
- package/dist/DataTableIcons.js +25 -25
- package/dist/DateInput.js +67 -67
- package/dist/DropdownMenu.js +35 -35
- package/dist/EmptyState.js +8 -8
- package/dist/ExplainableButton.js +11 -11
- package/dist/FloatingControls.js +31 -31
- package/dist/ModalShell.js +32 -32
- package/dist/MultiSelect.js +37 -37
- package/dist/Pagination.js +27 -27
- package/dist/RecoverableAsyncState.js +8 -8
- package/dist/Select.js +17 -17
- package/dist/SortableList.js +18 -18
- package/dist/Toast.js +30 -30
- package/dist/TreeSelect.js +107 -107
- package/dist/data-table.js +71 -71
- package/dist/document-viewer/PdfToolbar.js +12 -12
- package/dist/document-viewer/PdfWorkspace.js +15 -15
- package/dist/document-viewer-v2/HeadlessPdfViewer.js +6 -6
- package/dist/vendor/embedpdf-zoom-react.js +3 -186
- package/dist/vendor/embedpdf-zoom-react10.js +6 -0
- package/dist/vendor/embedpdf-zoom-react11.js +30 -0
- package/dist/vendor/embedpdf-zoom-react12.js +16 -0
- package/dist/vendor/embedpdf-zoom-react13.js +15 -0
- package/dist/vendor/embedpdf-zoom-react14.js +33 -0
- package/dist/vendor/embedpdf-zoom-react15.js +20 -0
- package/dist/vendor/embedpdf-zoom-react16.js +26 -0
- package/dist/vendor/embedpdf-zoom-react17.js +25 -0
- package/dist/vendor/embedpdf-zoom-react18.js +17 -0
- package/dist/vendor/embedpdf-zoom-react19.js +187 -0
- package/dist/vendor/embedpdf-zoom-react2.js +13 -0
- package/dist/vendor/embedpdf-zoom-react3.js +14 -0
- package/dist/vendor/embedpdf-zoom-react4.js +8 -0
- package/dist/vendor/embedpdf-zoom-react5.js +4 -0
- package/dist/vendor/embedpdf-zoom-react6.js +14 -0
- package/dist/vendor/embedpdf-zoom-react7.js +40 -0
- package/dist/vendor/embedpdf-zoom-react8.js +17 -0
- package/dist/vendor/embedpdf-zoom-react9.js +7 -0
- package/package.json +1 -1
package/dist/DropdownMenu.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
import { buttonClassName as e } from "./Button.js";
|
|
2
2
|
import { useOverlayContainer as t } from "./OverlayContainer.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { createElement as n, useId as r } from "react";
|
|
4
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
|
+
import { Check as s, ChevronRight as c } from "lucide-react";
|
|
6
6
|
import { Button as l, Header as u, Menu as d, MenuItem as f, MenuSection as p, MenuTrigger as m, Popover as h, Separator as g, SubmenuTrigger as _ } from "react-aria-components";
|
|
7
7
|
//#region src/DropdownMenu.tsx
|
|
8
|
-
function v({ trigger: n, triggerLabel:
|
|
9
|
-
let k = v?.["aria-label"] ?? f, A = t(S), j =
|
|
8
|
+
function v({ trigger: n, triggerLabel: i, triggerVariant: s = "secondary", triggerSize: c = "default", items: u, menuLabel: f, triggerRef: p, triggerProps: g, menuRef: _, menuProps: v, placement: b = "bottom start", portalContainer: S, disabled: C = !1, className: w = "", selectionMode: T = "none", selectedKeys: E, defaultSelectedKeys: D, onSelectionChange: O }) {
|
|
9
|
+
let k = v?.["aria-label"] ?? f, A = t(S), j = r(), M = T === "none" ? { selectionMode: T } : {
|
|
10
10
|
selectionMode: T,
|
|
11
11
|
selectedKeys: E,
|
|
12
12
|
defaultSelectedKeys: D,
|
|
13
13
|
onSelectionChange: O ? (e) => O(x(e)) : void 0
|
|
14
14
|
};
|
|
15
|
-
return /* @__PURE__ */
|
|
15
|
+
return /* @__PURE__ */ o(m, { children: [/* @__PURE__ */ a(l, {
|
|
16
16
|
...g,
|
|
17
17
|
ref: p,
|
|
18
18
|
className: e({
|
|
19
|
-
variant:
|
|
20
|
-
size:
|
|
19
|
+
variant: s,
|
|
20
|
+
size: c
|
|
21
21
|
}),
|
|
22
|
-
"aria-label": g?.["aria-label"] ??
|
|
22
|
+
"aria-label": g?.["aria-label"] ?? i,
|
|
23
23
|
isDisabled: C,
|
|
24
24
|
children: n
|
|
25
|
-
}), /* @__PURE__ */
|
|
25
|
+
}), /* @__PURE__ */ o(h, {
|
|
26
26
|
className: `ui-dropdown-popover ${w}`.trim(),
|
|
27
27
|
"data-ui-aria-overlay": "",
|
|
28
28
|
placement: b,
|
|
29
29
|
UNSTABLE_portalContainer: A,
|
|
30
|
-
children: [k === void 0 ? null : /* @__PURE__ */
|
|
30
|
+
children: [k === void 0 ? null : /* @__PURE__ */ a("span", {
|
|
31
31
|
id: j,
|
|
32
32
|
className: "ui-visually-hidden",
|
|
33
33
|
children: k
|
|
34
|
-
}), /* @__PURE__ */
|
|
34
|
+
}), /* @__PURE__ */ a(d, {
|
|
35
35
|
...v,
|
|
36
36
|
...M,
|
|
37
37
|
ref: _,
|
|
38
38
|
className: "ui-dropdown-menu",
|
|
39
|
-
"aria-label": k === void 0 ?
|
|
39
|
+
"aria-label": k === void 0 ? i ?? "操作菜单" : void 0,
|
|
40
40
|
"aria-labelledby": k === void 0 ? v?.["aria-labelledby"] : j,
|
|
41
41
|
children: y(u, M, A)
|
|
42
42
|
})]
|
|
43
43
|
})] });
|
|
44
44
|
}
|
|
45
|
-
function y(e, t,
|
|
46
|
-
return e.map((e) => e.type === "separator" ? /* @__PURE__ */
|
|
45
|
+
function y(e, t, r) {
|
|
46
|
+
return e.map((e) => e.type === "separator" ? /* @__PURE__ */ a(g, { className: "ui-dropdown-separator" }, e.id) : e.type === "group" ? /* @__PURE__ */ o(p, {
|
|
47
47
|
className: "ui-dropdown-group",
|
|
48
|
-
children: [e.label === void 0 ? null : /* @__PURE__ */
|
|
48
|
+
children: [e.label === void 0 ? null : /* @__PURE__ */ a(u, {
|
|
49
49
|
className: "ui-dropdown-header",
|
|
50
50
|
children: e.label
|
|
51
|
-
}), y(e.items, t,
|
|
52
|
-
}, e.id) : e.type === "submenu" ? /* @__PURE__ */
|
|
51
|
+
}), y(e.items, t, r)]
|
|
52
|
+
}, e.id) : e.type === "submenu" ? /* @__PURE__ */ o(_, { children: [/* @__PURE__ */ a(f, {
|
|
53
53
|
...e.itemProps,
|
|
54
54
|
ref: S(e.current, e.itemRef),
|
|
55
55
|
id: e.id,
|
|
@@ -57,26 +57,26 @@ function y(e, t, n) {
|
|
|
57
57
|
isDisabled: e.disabled,
|
|
58
58
|
"aria-current": e.current,
|
|
59
59
|
className: "ui-dropdown-item",
|
|
60
|
-
children: (t) => /* @__PURE__ */
|
|
60
|
+
children: (t) => /* @__PURE__ */ a(b, {
|
|
61
61
|
item: e,
|
|
62
62
|
selected: t.isSelected,
|
|
63
|
-
fallbackEnd: /* @__PURE__ */
|
|
63
|
+
fallbackEnd: /* @__PURE__ */ a(c, {
|
|
64
64
|
size: 15,
|
|
65
65
|
"aria-hidden": "true"
|
|
66
66
|
})
|
|
67
67
|
})
|
|
68
|
-
}), /* @__PURE__ */
|
|
68
|
+
}), /* @__PURE__ */ a(h, {
|
|
69
69
|
className: "ui-dropdown-popover",
|
|
70
70
|
"data-ui-aria-overlay": "",
|
|
71
71
|
placement: "right top",
|
|
72
|
-
UNSTABLE_portalContainer:
|
|
73
|
-
children: /* @__PURE__ */
|
|
72
|
+
UNSTABLE_portalContainer: r,
|
|
73
|
+
children: /* @__PURE__ */ a(d, {
|
|
74
74
|
...t,
|
|
75
75
|
className: "ui-dropdown-menu",
|
|
76
76
|
"aria-label": e.textValue,
|
|
77
|
-
children: y(e.items, t,
|
|
77
|
+
children: y(e.items, t, r)
|
|
78
78
|
})
|
|
79
|
-
})] }, e.id) : /* @__PURE__ */
|
|
79
|
+
})] }, e.id) : /* @__PURE__ */ n(f, {
|
|
80
80
|
...e.itemProps,
|
|
81
81
|
key: e.id,
|
|
82
82
|
ref: S(e.current, e.itemRef),
|
|
@@ -86,35 +86,35 @@ function y(e, t, n) {
|
|
|
86
86
|
"aria-current": e.current,
|
|
87
87
|
onAction: e.onAction,
|
|
88
88
|
className: `ui-dropdown-item${e.dangerous ? " dangerous" : ""}`
|
|
89
|
-
}, (t) => /* @__PURE__ */
|
|
89
|
+
}, (t) => /* @__PURE__ */ a(b, {
|
|
90
90
|
item: e,
|
|
91
91
|
selected: t.isSelected
|
|
92
92
|
})));
|
|
93
93
|
}
|
|
94
|
-
function b({ item: e, selected: t, fallbackEnd:
|
|
95
|
-
let
|
|
94
|
+
function b({ item: e, selected: t, fallbackEnd: n }) {
|
|
95
|
+
let r = e.selectedIcon ?? /* @__PURE__ */ a(s, {
|
|
96
96
|
size: 15,
|
|
97
97
|
"aria-hidden": "true"
|
|
98
98
|
});
|
|
99
|
-
return /* @__PURE__ */
|
|
100
|
-
e.startIcon === void 0 ? null : /* @__PURE__ */
|
|
99
|
+
return /* @__PURE__ */ o(i, { children: [
|
|
100
|
+
e.startIcon === void 0 ? null : /* @__PURE__ */ a("span", {
|
|
101
101
|
className: "ui-dropdown-item-icon",
|
|
102
102
|
"aria-hidden": "true",
|
|
103
103
|
children: e.startIcon
|
|
104
104
|
}),
|
|
105
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ a("span", {
|
|
106
106
|
className: "ui-dropdown-item-label",
|
|
107
107
|
children: e.label
|
|
108
108
|
}),
|
|
109
|
-
e.endSlot === void 0 ? null : /* @__PURE__ */
|
|
109
|
+
e.endSlot === void 0 ? null : /* @__PURE__ */ a("span", {
|
|
110
110
|
className: "ui-dropdown-item-status",
|
|
111
111
|
children: e.endSlot
|
|
112
112
|
}),
|
|
113
|
-
t ? /* @__PURE__ */
|
|
113
|
+
t ? /* @__PURE__ */ a("span", {
|
|
114
114
|
className: "ui-dropdown-item-selected",
|
|
115
115
|
"aria-hidden": "true",
|
|
116
|
-
children:
|
|
117
|
-
}) :
|
|
116
|
+
children: r
|
|
117
|
+
}) : n
|
|
118
118
|
] });
|
|
119
119
|
}
|
|
120
120
|
function x(e) {
|
package/dist/EmptyState.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { Inbox as n } from "lucide-react";
|
|
3
3
|
//#region src/EmptyState.tsx
|
|
4
4
|
function r({ icon: r, title: i, description: a, action: o, compact: s = !1, className: c = "", ...l }) {
|
|
5
|
-
return /* @__PURE__ */
|
|
5
|
+
return /* @__PURE__ */ t("div", {
|
|
6
6
|
...l,
|
|
7
7
|
className: `ui-empty-state${s ? " compact" : ""} ${c}`.trim(),
|
|
8
8
|
children: [
|
|
9
|
-
/* @__PURE__ */
|
|
9
|
+
/* @__PURE__ */ e("div", {
|
|
10
10
|
className: "ui-empty-icon",
|
|
11
11
|
"aria-hidden": "true",
|
|
12
|
-
children: r ?? /* @__PURE__ */
|
|
12
|
+
children: r ?? /* @__PURE__ */ e(n, { size: 24 })
|
|
13
13
|
}),
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
a === void 0 ? null : /* @__PURE__ */
|
|
14
|
+
/* @__PURE__ */ e("strong", { children: i }),
|
|
15
|
+
a === void 0 ? null : /* @__PURE__ */ e("div", {
|
|
16
16
|
className: "ui-empty-description",
|
|
17
17
|
children: a
|
|
18
18
|
}),
|
|
19
|
-
o === void 0 ? null : /* @__PURE__ */
|
|
19
|
+
o === void 0 ? null : /* @__PURE__ */ e("div", {
|
|
20
20
|
className: "ui-empty-action",
|
|
21
21
|
children: o
|
|
22
22
|
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Button as e } from "./Button.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useEffect as t, useId as n, useRef as r, useState as i } from "react";
|
|
3
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
|
+
import { CircleHelp as s } from "lucide-react";
|
|
5
5
|
//#region src/ExplainableButton.tsx
|
|
6
6
|
function c({ disabled: c = !1, disabledReason: l, reasonPresentation: u = "inline", onClick: d, onFocus: f, onBlur: p, onKeyDown: m, children: h, ...g }) {
|
|
7
|
-
let _ = `ui-action-reason-${
|
|
8
|
-
|
|
7
|
+
let _ = `ui-action-reason-${n().replace(/:/g, "")}`, v = c && !!l, y = v && u === "popover", [b, x] = i(!1), S = r(null), C = [g["aria-describedby"], v ? _ : void 0].filter(Boolean).join(" ") || void 0;
|
|
8
|
+
t(() => {
|
|
9
9
|
if (!y || !b) return;
|
|
10
10
|
let e = (e) => {
|
|
11
11
|
S.current?.contains(e.target) || x(!1);
|
|
@@ -15,7 +15,7 @@ function c({ disabled: c = !1, disabledReason: l, reasonPresentation: u = "inlin
|
|
|
15
15
|
return window.addEventListener("pointerdown", e), window.addEventListener("keydown", t), () => {
|
|
16
16
|
window.removeEventListener("pointerdown", e), window.removeEventListener("keydown", t);
|
|
17
17
|
};
|
|
18
|
-
}, [y, b]),
|
|
18
|
+
}, [y, b]), t(() => {
|
|
19
19
|
y || x(!1);
|
|
20
20
|
}, [y]);
|
|
21
21
|
function w(e) {
|
|
@@ -46,21 +46,21 @@ function c({ disabled: c = !1, disabledReason: l, reasonPresentation: u = "inlin
|
|
|
46
46
|
onBlur: E,
|
|
47
47
|
onKeyDown: D
|
|
48
48
|
};
|
|
49
|
-
return /* @__PURE__ */
|
|
49
|
+
return /* @__PURE__ */ o("span", {
|
|
50
50
|
ref: S,
|
|
51
51
|
className: `ui-explainable-action${v ? " is-blocked" : ""}${y ? " reason-popover" : ""}${b ? " reason-open" : ""}`,
|
|
52
|
-
children: [/* @__PURE__ */
|
|
52
|
+
children: [/* @__PURE__ */ a(e, {
|
|
53
53
|
...O,
|
|
54
54
|
children: h
|
|
55
|
-
}), v && /* @__PURE__ */
|
|
55
|
+
}), v && /* @__PURE__ */ o("small", {
|
|
56
56
|
className: "ui-explainable-reason",
|
|
57
57
|
id: _,
|
|
58
58
|
role: y ? "tooltip" : "note",
|
|
59
59
|
"aria-live": y ? "polite" : void 0,
|
|
60
|
-
children: [/* @__PURE__ */
|
|
60
|
+
children: [/* @__PURE__ */ a(s, {
|
|
61
61
|
"aria-hidden": "true",
|
|
62
62
|
size: 14
|
|
63
|
-
}), /* @__PURE__ */
|
|
63
|
+
}), /* @__PURE__ */ a("span", { children: l })]
|
|
64
64
|
})]
|
|
65
65
|
});
|
|
66
66
|
}
|
package/dist/FloatingControls.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { Button as e } from "./Button.js";
|
|
2
2
|
import { useOverlayContainer as t } from "./OverlayContainer.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { useId as n, useState as r } from "react";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
import { X as o } from "lucide-react";
|
|
6
6
|
import * as s from "@radix-ui/react-popover";
|
|
7
7
|
import * as c from "@radix-ui/react-tooltip";
|
|
8
8
|
//#region src/FloatingControls.tsx
|
|
9
|
-
function l({ children: e, content: n, side: r = "top", delayDuration:
|
|
9
|
+
function l({ children: e, content: n, side: r = "top", delayDuration: o = 450, disabled: s = !1, contentClassName: l = "" }) {
|
|
10
10
|
let u = t();
|
|
11
|
-
return s ? e : /* @__PURE__ */
|
|
12
|
-
delayDuration:
|
|
11
|
+
return s ? e : /* @__PURE__ */ i(c.Provider, {
|
|
12
|
+
delayDuration: o,
|
|
13
13
|
skipDelayDuration: 250,
|
|
14
|
-
children: /* @__PURE__ */
|
|
14
|
+
children: /* @__PURE__ */ a(c.Root, { children: [/* @__PURE__ */ i(c.Trigger, {
|
|
15
15
|
asChild: !0,
|
|
16
16
|
children: e
|
|
17
|
-
}), /* @__PURE__ */
|
|
17
|
+
}), /* @__PURE__ */ i(c.Portal, {
|
|
18
18
|
container: u,
|
|
19
|
-
children: /* @__PURE__ */
|
|
19
|
+
children: /* @__PURE__ */ a(c.Content, {
|
|
20
20
|
className: `ui-tooltip ${l}`.trim(),
|
|
21
21
|
side: r,
|
|
22
22
|
sideOffset: 7,
|
|
23
23
|
collisionPadding: 10,
|
|
24
|
-
children: [n, /* @__PURE__ */
|
|
24
|
+
children: [n, /* @__PURE__ */ i(c.Arrow, {
|
|
25
25
|
className: "ui-floating-arrow",
|
|
26
26
|
width: 10,
|
|
27
27
|
height: 5
|
|
@@ -30,19 +30,19 @@ function l({ children: e, content: n, side: r = "top", delayDuration: i = 450, d
|
|
|
30
30
|
})] })
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
function u({ trigger: e, children:
|
|
34
|
-
let v = t(), y = `ui-popover-title-${
|
|
35
|
-
return /* @__PURE__ */
|
|
33
|
+
function u({ trigger: e, children: r, title: c, contentLabel: l, closeLabel: u = "关闭", side: d = "bottom", align: f = "start", open: p, defaultOpen: m, modal: h = !1, onOpenChange: g, contentClassName: _ = "" }) {
|
|
34
|
+
let v = t(), y = `ui-popover-title-${n().replaceAll(":", "")}`;
|
|
35
|
+
return /* @__PURE__ */ a(s.Root, {
|
|
36
36
|
open: p,
|
|
37
37
|
defaultOpen: m,
|
|
38
38
|
modal: h,
|
|
39
39
|
onOpenChange: g,
|
|
40
|
-
children: [/* @__PURE__ */
|
|
40
|
+
children: [/* @__PURE__ */ i(s.Trigger, {
|
|
41
41
|
asChild: !0,
|
|
42
42
|
children: e
|
|
43
|
-
}), /* @__PURE__ */
|
|
43
|
+
}), /* @__PURE__ */ i(s.Portal, {
|
|
44
44
|
container: v,
|
|
45
|
-
children: /* @__PURE__ */
|
|
45
|
+
children: /* @__PURE__ */ a(s.Content, {
|
|
46
46
|
className: `ui-popover ${_}`.trim(),
|
|
47
47
|
side: d,
|
|
48
48
|
align: f,
|
|
@@ -51,22 +51,22 @@ function u({ trigger: e, children: i, title: c, contentLabel: l, closeLabel: u =
|
|
|
51
51
|
"aria-label": l,
|
|
52
52
|
"aria-labelledby": c === void 0 ? void 0 : y,
|
|
53
53
|
children: [
|
|
54
|
-
c === void 0 ? null : /* @__PURE__ */
|
|
54
|
+
c === void 0 ? null : /* @__PURE__ */ a("div", {
|
|
55
55
|
className: "ui-popover-heading",
|
|
56
|
-
children: [/* @__PURE__ */
|
|
56
|
+
children: [/* @__PURE__ */ i("strong", {
|
|
57
57
|
id: y,
|
|
58
58
|
children: c
|
|
59
|
-
}), /* @__PURE__ */
|
|
59
|
+
}), /* @__PURE__ */ i(s.Close, {
|
|
60
60
|
className: "ui-floating-close",
|
|
61
61
|
"aria-label": u,
|
|
62
|
-
children: /* @__PURE__ */
|
|
62
|
+
children: /* @__PURE__ */ i(o, { size: 16 })
|
|
63
63
|
})]
|
|
64
64
|
}),
|
|
65
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ i("div", {
|
|
66
66
|
className: "ui-popover-body",
|
|
67
|
-
children:
|
|
67
|
+
children: r
|
|
68
68
|
}),
|
|
69
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ i(s.Arrow, {
|
|
70
70
|
className: "ui-floating-arrow",
|
|
71
71
|
width: 12,
|
|
72
72
|
height: 6
|
|
@@ -76,8 +76,8 @@ function u({ trigger: e, children: i, title: c, contentLabel: l, closeLabel: u =
|
|
|
76
76
|
})]
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
function d({ title: t, description: n, confirmLabel:
|
|
80
|
-
let [g, _] =
|
|
79
|
+
function d({ title: t, description: n, confirmLabel: o = "确认", cancelLabel: s = "取消", confirmVariant: c = "danger", onConfirm: l, onConfirmError: d, open: f, defaultOpen: p, onOpenChange: m, ...h }) {
|
|
80
|
+
let [g, _] = r(p ?? !1), [v, y] = r(!1), b = f ?? g, x = (e) => {
|
|
81
81
|
v || (_(e), m?.(e));
|
|
82
82
|
};
|
|
83
83
|
async function S() {
|
|
@@ -90,29 +90,29 @@ function d({ title: t, description: n, confirmLabel: r = "确认", cancelLabel:
|
|
|
90
90
|
y(!1);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
return /* @__PURE__ */
|
|
93
|
+
return /* @__PURE__ */ a(u, {
|
|
94
94
|
...h,
|
|
95
95
|
open: b,
|
|
96
96
|
onOpenChange: x,
|
|
97
97
|
title: t,
|
|
98
|
-
children: [n === void 0 ? null : /* @__PURE__ */
|
|
98
|
+
children: [n === void 0 ? null : /* @__PURE__ */ i("div", {
|
|
99
99
|
className: "ui-popconfirm-description",
|
|
100
100
|
children: n
|
|
101
|
-
}), /* @__PURE__ */
|
|
101
|
+
}), /* @__PURE__ */ a("div", {
|
|
102
102
|
className: "ui-popconfirm-actions",
|
|
103
|
-
children: [/* @__PURE__ */
|
|
103
|
+
children: [/* @__PURE__ */ i(e, {
|
|
104
104
|
size: "compact",
|
|
105
105
|
variant: "outline",
|
|
106
106
|
disabled: v,
|
|
107
107
|
onClick: () => x(!1),
|
|
108
108
|
children: s
|
|
109
|
-
}), /* @__PURE__ */
|
|
109
|
+
}), /* @__PURE__ */ i(e, {
|
|
110
110
|
size: "compact",
|
|
111
111
|
variant: c,
|
|
112
112
|
busy: v,
|
|
113
113
|
busyLabel: "处理中",
|
|
114
114
|
onClick: S,
|
|
115
|
-
children:
|
|
115
|
+
children: o
|
|
116
116
|
})]
|
|
117
117
|
})]
|
|
118
118
|
});
|
package/dist/ModalShell.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { Button as e } from "./Button.js";
|
|
2
2
|
import { OverlayContainerContext as t } from "./OverlayContainer.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { Children as n, Fragment as r, isValidElement as i, useCallback as a, useEffect as o, useRef as s, useState as c } from "react";
|
|
4
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
5
|
+
import { X as d } from "lucide-react";
|
|
6
6
|
import * as f from "@radix-ui/react-dialog";
|
|
7
7
|
//#region src/ModalShell.tsx
|
|
8
|
-
function p({ backdropClassName: e = "", panelClassName: n = "", titleId: r, eyebrow: i, title:
|
|
9
|
-
let I =
|
|
8
|
+
function p({ backdropClassName: e = "", panelClassName: n = "", titleId: r, eyebrow: i, title: d, description: p, closeLabel: _, onClose: b, closeDisabled: x = !1, showCloseButton: S = !0, closeIconSize: C = 20, closeOnBackdrop: w = !1, rootRef: T, closeOnEscape: E = !0, initialFocus: D, returnFocus: O, role: k = "dialog", describedBy: A, children: j, footer: M, contentClassName: N = "", contentProps: P, footerClassName: F = "" }) {
|
|
9
|
+
let I = s(null), [L, R] = c(null), z = s(typeof document > "u" ? null : document.activeElement), B = a((e) => {
|
|
10
10
|
I.current = e, v(T, e);
|
|
11
|
-
}, [T]), V =
|
|
11
|
+
}, [T]), V = s(!1), { ref: H, ...U } = P ?? {};
|
|
12
12
|
function W() {
|
|
13
13
|
return [...document.querySelectorAll("[role='dialog'][aria-modal='true'],[role='alertdialog'][aria-modal='true']")].at(-1) === I.current;
|
|
14
14
|
}
|
|
15
15
|
function G() {
|
|
16
16
|
!x && W() && b();
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
o(() => {
|
|
19
19
|
h() && M === void 0 && !V.current && m(j) && (V.current = !0, console.warn("[business-ui] ModalShell 的直接 <footer> child 会位于可滚动正文区。固定底栏请改用 footer 属性,并用 footerClassName 定制样式;组件不会自动搬运 children。"));
|
|
20
20
|
}, [j, M]);
|
|
21
21
|
function K(e) {
|
|
22
22
|
w && e.target === e.currentTarget && G(), e.target.closest("button,a[href],input,select,textarea,[tabindex]") || e.preventDefault();
|
|
23
23
|
}
|
|
24
|
-
return /* @__PURE__ */
|
|
24
|
+
return /* @__PURE__ */ l(f.Root, {
|
|
25
25
|
open: !0,
|
|
26
26
|
onOpenChange: (e) => {
|
|
27
27
|
e || G();
|
|
28
28
|
},
|
|
29
|
-
children: /* @__PURE__ */
|
|
29
|
+
children: /* @__PURE__ */ l(f.Overlay, {
|
|
30
30
|
asChild: !0,
|
|
31
|
-
children: /* @__PURE__ */
|
|
31
|
+
children: /* @__PURE__ */ l(f.Content, {
|
|
32
32
|
asChild: !0,
|
|
33
33
|
onEscapeKeyDown: (e) => {
|
|
34
34
|
(x || !E || I.current?.querySelector("[data-ui-aria-overlay]")) && e.preventDefault();
|
|
@@ -44,7 +44,7 @@ function p({ backdropClassName: e = "", panelClassName: n = "", titleId: r, eyeb
|
|
|
44
44
|
e?.isConnected && e.focus();
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
|
-
children: /* @__PURE__ */
|
|
47
|
+
children: /* @__PURE__ */ l("div", {
|
|
48
48
|
ref: B,
|
|
49
49
|
"data-ui-focus-managed": "radix",
|
|
50
50
|
className: `ui-modal-backdrop ${e}`.trim(),
|
|
@@ -54,51 +54,51 @@ function p({ backdropClassName: e = "", panelClassName: n = "", titleId: r, eyeb
|
|
|
54
54
|
"aria-describedby": A ?? (p === void 0 ? void 0 : `${r}-description`),
|
|
55
55
|
onMouseDown: K,
|
|
56
56
|
tabIndex: -1,
|
|
57
|
-
children: /* @__PURE__ */
|
|
57
|
+
children: /* @__PURE__ */ u(t.Provider, {
|
|
58
58
|
value: L,
|
|
59
|
-
children: [/* @__PURE__ */
|
|
59
|
+
children: [/* @__PURE__ */ u("section", {
|
|
60
60
|
className: `ui-modal ${n}`.trim(),
|
|
61
61
|
children: [
|
|
62
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ u("header", {
|
|
63
63
|
className: "ui-modal-header",
|
|
64
|
-
children: [/* @__PURE__ */
|
|
65
|
-
i === void 0 ? null : /* @__PURE__ */
|
|
64
|
+
children: [/* @__PURE__ */ u("div", { children: [
|
|
65
|
+
i === void 0 ? null : /* @__PURE__ */ l("span", {
|
|
66
66
|
className: "ui-modal-eyebrow",
|
|
67
67
|
children: i
|
|
68
68
|
}),
|
|
69
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ l(f.Title, {
|
|
70
70
|
asChild: !0,
|
|
71
|
-
children: /* @__PURE__ */
|
|
71
|
+
children: /* @__PURE__ */ l("h2", {
|
|
72
72
|
id: r,
|
|
73
|
-
children:
|
|
73
|
+
children: d
|
|
74
74
|
})
|
|
75
75
|
}),
|
|
76
|
-
p === void 0 ? null : /* @__PURE__ */
|
|
76
|
+
p === void 0 ? null : /* @__PURE__ */ l(f.Description, {
|
|
77
77
|
asChild: !0,
|
|
78
|
-
children: /* @__PURE__ */
|
|
78
|
+
children: /* @__PURE__ */ l("p", {
|
|
79
79
|
id: `${r}-description`,
|
|
80
80
|
children: p
|
|
81
81
|
})
|
|
82
82
|
})
|
|
83
|
-
] }), S && /* @__PURE__ */
|
|
83
|
+
] }), S && /* @__PURE__ */ l(g, {
|
|
84
84
|
label: _,
|
|
85
85
|
disabled: x,
|
|
86
86
|
size: C,
|
|
87
87
|
onClose: G
|
|
88
88
|
})]
|
|
89
89
|
}),
|
|
90
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ l("div", {
|
|
91
91
|
...U,
|
|
92
92
|
ref: H,
|
|
93
93
|
className: `ui-modal-content ${N}`.trim(),
|
|
94
94
|
children: j
|
|
95
95
|
}),
|
|
96
|
-
M === void 0 ? null : /* @__PURE__ */
|
|
96
|
+
M === void 0 ? null : /* @__PURE__ */ l("footer", {
|
|
97
97
|
className: `ui-modal-footer ${F}`.trim(),
|
|
98
98
|
children: M
|
|
99
99
|
})
|
|
100
100
|
]
|
|
101
|
-
}), /* @__PURE__ */
|
|
101
|
+
}), /* @__PURE__ */ l("div", {
|
|
102
102
|
ref: R,
|
|
103
103
|
className: "ui-overlay-container"
|
|
104
104
|
})]
|
|
@@ -109,21 +109,21 @@ function p({ backdropClassName: e = "", panelClassName: n = "", titleId: r, eyeb
|
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
function m(e) {
|
|
112
|
-
return
|
|
112
|
+
return n.toArray(e).some((e) => i(e) ? e.type === "footer" || e.type === r && m(e.props.children) : !1);
|
|
113
113
|
}
|
|
114
114
|
function h() {
|
|
115
115
|
return typeof process < "u" && process.env.NODE_ENV !== "production";
|
|
116
116
|
}
|
|
117
|
-
function g({ label: t, disabled:
|
|
118
|
-
return /* @__PURE__ */
|
|
117
|
+
function g({ label: t, disabled: n, size: r, onClose: i }) {
|
|
118
|
+
return /* @__PURE__ */ l(e, {
|
|
119
119
|
className: "ui-modal-close",
|
|
120
120
|
variant: "ghost",
|
|
121
121
|
iconOnly: !0,
|
|
122
122
|
"aria-label": t,
|
|
123
|
-
onClick:
|
|
124
|
-
disabled:
|
|
125
|
-
children: /* @__PURE__ */
|
|
126
|
-
size:
|
|
123
|
+
onClick: i,
|
|
124
|
+
disabled: n,
|
|
125
|
+
children: /* @__PURE__ */ l(d, {
|
|
126
|
+
size: r,
|
|
127
127
|
"aria-hidden": "true"
|
|
128
128
|
})
|
|
129
129
|
});
|