@jc-times/business-ui 0.3.0 → 0.3.2
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 +10 -0
- package/THIRD_PARTY_NOTICES.md +5 -0
- package/assets/pdf-fonts/NotoSans-Bold.ttf +0 -0
- package/assets/pdf-fonts/NotoSans-BoldItalic.ttf +0 -0
- package/assets/pdf-fonts/NotoSans-Italic.ttf +0 -0
- package/assets/pdf-fonts/NotoSans-Regular.ttf +0 -0
- package/assets/pdf-fonts/NotoSansHans-Regular.otf +0 -0
- package/assets/pdf-fonts/OFL-CJK.txt +92 -0
- package/assets/pdf-fonts/OFL-Latin.txt +94 -0
- package/assets/pdf-fonts/README.md +11 -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/DocumentViewerV2.js +49 -48
- package/dist/document-viewer-v2/HeadlessPdfViewer.js +128 -124
- package/dist/document-viewer-v2/pdf-font-fallback.js +35 -0
- package/dist/types/document-viewer-v2/pdf-font-fallback.d.ts +2 -0
- 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/docs/agent-guide.md +2 -0
- package/docs/document-viewer-v2.md +2 -2
- package/package.json +7 -3
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
|
});
|
package/dist/MultiSelect.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import { useOverlayContainer as e } from "./OverlayContainer.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { Button as
|
|
6
|
-
import { ListLayout as
|
|
2
|
+
import { useMemo as t, useState as ee } from "react";
|
|
3
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
import { Check as a, ChevronDown as o, LoaderCircle as s } from "lucide-react";
|
|
5
|
+
import { Button as c, ComboBox as l, ComboBoxValue as te, Input as ne, Label as re, ListBox as u, ListBoxItem as d, Popover as f, Tag as p, TagGroup as m, TagList as h, Text as g } from "react-aria-components";
|
|
6
|
+
import { ListLayout as ie, Virtualizer as _ } from "react-aria-components/Virtualizer";
|
|
7
7
|
//#region src/MultiSelect.tsx
|
|
8
|
-
var
|
|
8
|
+
var v = [], y = [], b = {
|
|
9
9
|
rowSize: 48,
|
|
10
10
|
gap: 2,
|
|
11
11
|
padding: 4
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
let [q, J] =
|
|
13
|
+
function x({ values: x, defaultValues: S = y, onValuesChange: C, name: w, selectedItems: T = v, items: E, disabled: D, clearLabel: O = "清空选择", selectionLabel: k = "已选项", maxSelected: A, inputValue: j, defaultInputValue: M, onInputChange: N, required: P, label: F, placeholder: I = "搜索或选择", helpText: L, error: R, loading: z, emptyText: B = "没有匹配项", inputRef: V, inputProps: H, placement: U = "bottom start", portalContainer: W, virtualized: G = E.length > 100, className: K = "" }) {
|
|
14
|
+
let [q, J] = ee(S), Y = x ?? q, ae = e(W), X = t(() => {
|
|
15
15
|
let e = /* @__PURE__ */ new Map();
|
|
16
16
|
for (let t of T) e.set(t.id, t);
|
|
17
17
|
for (let t of E) e.set(t.id, t);
|
|
18
18
|
return e;
|
|
19
|
-
}, [T, E]), Z =
|
|
19
|
+
}, [T, E]), Z = t(() => [...Y], [Y]), oe = t(() => new Set(Y), [Y]), se = t(() => Z.map((e) => X.get(e) ?? {
|
|
20
20
|
id: e,
|
|
21
21
|
label: e
|
|
22
|
-
}), [Z, X]), ce =
|
|
22
|
+
}), [Z, X]), ce = t(() => [...E], [E]), le = A !== void 0 && Y.length >= A;
|
|
23
23
|
function Q(e) {
|
|
24
|
-
D || A !== void 0 && e.length > A && e.length > Y.length || (
|
|
24
|
+
D || A !== void 0 && e.length > A && e.length > Y.length || (x === void 0 && J(e), C?.(e));
|
|
25
25
|
}
|
|
26
|
-
let $ = /* @__PURE__ */
|
|
26
|
+
let $ = /* @__PURE__ */ r(u, {
|
|
27
27
|
items: ce,
|
|
28
28
|
className: "ui-combobox-list",
|
|
29
29
|
layout: G ? "grid" : "stack",
|
|
30
|
-
renderEmptyState: () => /* @__PURE__ */
|
|
30
|
+
renderEmptyState: () => /* @__PURE__ */ r("div", {
|
|
31
31
|
className: "ui-combobox-empty",
|
|
32
32
|
children: z ? "正在加载…" : B
|
|
33
33
|
}),
|
|
34
|
-
children: (e) => /* @__PURE__ */
|
|
34
|
+
children: (e) => /* @__PURE__ */ r(d, {
|
|
35
35
|
id: e.id,
|
|
36
36
|
textValue: e.label,
|
|
37
37
|
isDisabled: e.disabled || le && !oe.has(e.id),
|
|
38
38
|
className: "ui-combobox-item",
|
|
39
|
-
children: ({ isSelected:
|
|
39
|
+
children: ({ isSelected: t }) => /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ i("span", { children: [/* @__PURE__ */ r("strong", { children: e.label }), e.description && /* @__PURE__ */ r("small", { children: e.description })] }), t && /* @__PURE__ */ r(a, { size: 15 })] })
|
|
40
40
|
})
|
|
41
41
|
});
|
|
42
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ i(l, {
|
|
43
43
|
selectionMode: "multiple",
|
|
44
44
|
value: Z,
|
|
45
45
|
onChange: (e) => Q(e.map(String)),
|
|
@@ -54,47 +54,47 @@ function S({ values: S, defaultValues: C = x, onValuesChange: ie, name: w, selec
|
|
|
54
54
|
"aria-label": F === void 0 ? H?.["aria-label"] : void 0,
|
|
55
55
|
className: `ui-combobox ui-multi-select ${K}`.trim(),
|
|
56
56
|
children: [
|
|
57
|
-
F !== void 0 && /* @__PURE__ */
|
|
57
|
+
F !== void 0 && /* @__PURE__ */ i(re, {
|
|
58
58
|
className: "ui-form-label",
|
|
59
|
-
children: [F, P && /* @__PURE__ */
|
|
59
|
+
children: [F, P && /* @__PURE__ */ r("span", {
|
|
60
60
|
className: "ui-form-required",
|
|
61
61
|
"aria-hidden": "true",
|
|
62
62
|
children: "*"
|
|
63
63
|
})]
|
|
64
64
|
}),
|
|
65
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ i("div", {
|
|
66
66
|
className: "ui-combobox-control",
|
|
67
|
-
children: [/* @__PURE__ */
|
|
67
|
+
children: [/* @__PURE__ */ r(ne, {
|
|
68
68
|
...H,
|
|
69
69
|
ref: V,
|
|
70
70
|
className: "ui-input",
|
|
71
71
|
placeholder: I
|
|
72
|
-
}), /* @__PURE__ */
|
|
72
|
+
}), /* @__PURE__ */ r(c, {
|
|
73
73
|
className: "ui-combobox-trigger",
|
|
74
74
|
"aria-label": "展开选项",
|
|
75
|
-
children:
|
|
75
|
+
children: r(z ? s : o, { size: 16 })
|
|
76
76
|
})]
|
|
77
77
|
}),
|
|
78
|
-
/* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ r(te, { children: () => Y.length > 0 ? /* @__PURE__ */ i("div", {
|
|
79
79
|
className: "ui-multi-selection",
|
|
80
|
-
children: [/* @__PURE__ */
|
|
80
|
+
children: [/* @__PURE__ */ r(m, {
|
|
81
81
|
"aria-label": k,
|
|
82
82
|
onRemove: (e) => Q(Y.filter((t) => !e.has(t))),
|
|
83
|
-
disabledKeys: D ? Z :
|
|
84
|
-
children: /* @__PURE__ */
|
|
83
|
+
disabledKeys: D ? Z : y,
|
|
84
|
+
children: /* @__PURE__ */ r(h, {
|
|
85
85
|
items: se,
|
|
86
|
-
children: (e) => /* @__PURE__ */
|
|
86
|
+
children: (e) => /* @__PURE__ */ i(p, {
|
|
87
87
|
id: e.id,
|
|
88
88
|
textValue: e.label,
|
|
89
89
|
className: "ui-selection-tag",
|
|
90
|
-
children: [e.label, /* @__PURE__ */
|
|
90
|
+
children: [e.label, /* @__PURE__ */ r(c, {
|
|
91
91
|
slot: "remove",
|
|
92
92
|
"aria-label": `移除 ${e.label}`,
|
|
93
93
|
children: "×"
|
|
94
94
|
})]
|
|
95
95
|
})
|
|
96
96
|
})
|
|
97
|
-
}), /* @__PURE__ */
|
|
97
|
+
}), /* @__PURE__ */ r("button", {
|
|
98
98
|
type: "button",
|
|
99
99
|
disabled: D,
|
|
100
100
|
className: "ui-selection-clear",
|
|
@@ -102,31 +102,31 @@ function S({ values: S, defaultValues: C = x, onValuesChange: ie, name: w, selec
|
|
|
102
102
|
children: O
|
|
103
103
|
})]
|
|
104
104
|
}) : null }),
|
|
105
|
-
L !== void 0 && /* @__PURE__ */
|
|
105
|
+
L !== void 0 && /* @__PURE__ */ r(g, {
|
|
106
106
|
slot: "description",
|
|
107
107
|
className: "ui-form-help",
|
|
108
108
|
children: L
|
|
109
109
|
}),
|
|
110
|
-
R && /* @__PURE__ */
|
|
110
|
+
R && /* @__PURE__ */ r(g, {
|
|
111
111
|
slot: "errorMessage",
|
|
112
112
|
className: "ui-form-error",
|
|
113
113
|
children: R
|
|
114
114
|
}),
|
|
115
|
-
w && Y.map((e) => /* @__PURE__ */
|
|
115
|
+
w && Y.map((e) => /* @__PURE__ */ r("input", {
|
|
116
116
|
type: "hidden",
|
|
117
117
|
name: w,
|
|
118
118
|
value: e,
|
|
119
119
|
disabled: D
|
|
120
120
|
}, e)),
|
|
121
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ r(f, {
|
|
122
122
|
className: "ui-combobox-popover",
|
|
123
123
|
"data-ui-aria-overlay": "",
|
|
124
124
|
maxHeight: 320,
|
|
125
125
|
placement: U,
|
|
126
126
|
UNSTABLE_portalContainer: ae,
|
|
127
|
-
children: G ? /* @__PURE__ */
|
|
128
|
-
layout:
|
|
129
|
-
layoutOptions:
|
|
127
|
+
children: G ? /* @__PURE__ */ r(_, {
|
|
128
|
+
layout: ie,
|
|
129
|
+
layoutOptions: b,
|
|
130
130
|
children: $
|
|
131
131
|
}) : $
|
|
132
132
|
})
|
|
@@ -134,4 +134,4 @@ function S({ values: S, defaultValues: C = x, onValuesChange: ie, name: w, selec
|
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
//#endregion
|
|
137
|
-
export {
|
|
137
|
+
export { x as MultiSelect };
|
package/dist/Pagination.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLeft as n, ChevronRight as r } from "lucide-react";
|
|
3
3
|
//#region src/Pagination.tsx
|
|
4
4
|
function i({ totalItems: i, page: c, pageSize: l, onPageChange: u, onPageSizeChange: d, itemLabel: f = "条记录", pageSizeOptions: p = [
|
|
5
5
|
10,
|
|
@@ -7,11 +7,11 @@ function i({ totalItems: i, page: c, pageSize: l, onPageChange: u, onPageSizeCha
|
|
|
7
7
|
50
|
|
8
8
|
], compact: m = !1 }) {
|
|
9
9
|
let h = a(i, l), g = o(c, i, l), _ = i ? (g - 1) * l + 1 : 0, v = Math.min(g * l, i);
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ t("nav", {
|
|
11
11
|
className: `ui-pagination${m ? " compact" : ""}`,
|
|
12
12
|
"aria-label": "列表分页",
|
|
13
13
|
children: [
|
|
14
|
-
/* @__PURE__ */
|
|
14
|
+
/* @__PURE__ */ t("span", {
|
|
15
15
|
className: "ui-pagination-summary",
|
|
16
16
|
children: [
|
|
17
17
|
"共 ",
|
|
@@ -24,35 +24,35 @@ function i({ totalItems: i, page: c, pageSize: l, onPageChange: u, onPageSizeCha
|
|
|
24
24
|
v
|
|
25
25
|
]
|
|
26
26
|
}),
|
|
27
|
-
/* @__PURE__ */
|
|
27
|
+
/* @__PURE__ */ t("div", {
|
|
28
28
|
className: "ui-pagination-pages",
|
|
29
29
|
children: [
|
|
30
|
-
/* @__PURE__ */
|
|
30
|
+
/* @__PURE__ */ e("button", {
|
|
31
31
|
type: "button",
|
|
32
32
|
"aria-label": "上一页",
|
|
33
33
|
disabled: g <= 1,
|
|
34
34
|
onClick: () => u(g - 1),
|
|
35
|
-
children: /* @__PURE__ */ n
|
|
35
|
+
children: /* @__PURE__ */ e(n, { size: 15 })
|
|
36
36
|
}),
|
|
37
|
-
!m && s(g, h).map((
|
|
37
|
+
!m && s(g, h).map((t, n) => t === "ellipsis" ? /* @__PURE__ */ e("i", {
|
|
38
38
|
className: "ui-page-ellipsis",
|
|
39
39
|
children: "…"
|
|
40
|
-
}, `ellipsis-${
|
|
40
|
+
}, `ellipsis-${n}`) : /* @__PURE__ */ e("button", {
|
|
41
41
|
type: "button",
|
|
42
|
-
className: `ui-page-number${
|
|
43
|
-
"aria-current":
|
|
44
|
-
"aria-label": `第 ${
|
|
45
|
-
onClick: () => u(
|
|
46
|
-
children:
|
|
47
|
-
},
|
|
48
|
-
m && /* @__PURE__ */
|
|
42
|
+
className: `ui-page-number${t === g ? " active" : ""}`,
|
|
43
|
+
"aria-current": t === g ? "page" : void 0,
|
|
44
|
+
"aria-label": `第 ${t} 页`,
|
|
45
|
+
onClick: () => u(t),
|
|
46
|
+
children: t
|
|
47
|
+
}, t)),
|
|
48
|
+
m && /* @__PURE__ */ t("span", { children: [
|
|
49
49
|
"第 ",
|
|
50
50
|
g,
|
|
51
51
|
" / ",
|
|
52
52
|
h,
|
|
53
53
|
" 页"
|
|
54
54
|
] }),
|
|
55
|
-
!m && /* @__PURE__ */
|
|
55
|
+
!m && /* @__PURE__ */ t("span", {
|
|
56
56
|
className: "ui-pagination-auto-compact",
|
|
57
57
|
children: [
|
|
58
58
|
"第 ",
|
|
@@ -62,29 +62,29 @@ function i({ totalItems: i, page: c, pageSize: l, onPageChange: u, onPageSizeCha
|
|
|
62
62
|
" 页"
|
|
63
63
|
]
|
|
64
64
|
}),
|
|
65
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ e("button", {
|
|
66
66
|
type: "button",
|
|
67
67
|
"aria-label": "下一页",
|
|
68
68
|
disabled: g >= h,
|
|
69
69
|
onClick: () => u(g + 1),
|
|
70
|
-
children: /* @__PURE__ */
|
|
70
|
+
children: /* @__PURE__ */ e(r, { size: 15 })
|
|
71
71
|
})
|
|
72
72
|
]
|
|
73
73
|
}),
|
|
74
|
-
d && /* @__PURE__ */
|
|
74
|
+
d && /* @__PURE__ */ t("label", {
|
|
75
75
|
className: "ui-pagination-size",
|
|
76
76
|
children: [
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ e("span", { children: "每页" }),
|
|
78
|
+
/* @__PURE__ */ e("select", {
|
|
79
79
|
"aria-label": "每页显示数量",
|
|
80
80
|
value: l,
|
|
81
81
|
onChange: (e) => d(Number(e.target.value)),
|
|
82
|
-
children: p.map((
|
|
83
|
-
value:
|
|
84
|
-
children:
|
|
85
|
-
},
|
|
82
|
+
children: p.map((t) => /* @__PURE__ */ e("option", {
|
|
83
|
+
value: t,
|
|
84
|
+
children: t
|
|
85
|
+
}, t))
|
|
86
86
|
}),
|
|
87
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ e("span", { children: "条" })
|
|
88
88
|
]
|
|
89
89
|
})
|
|
90
90
|
]
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { Button as e } from "./Button.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import { AlertCircle as r, LoaderCircle as i, RefreshCw as a } from "lucide-react";
|
|
4
4
|
//#region src/RecoverableAsyncState.tsx
|
|
5
5
|
function o(o) {
|
|
6
6
|
let s = o.phase === "error";
|
|
7
|
-
return /* @__PURE__ */
|
|
7
|
+
return /* @__PURE__ */ n("div", {
|
|
8
8
|
className: `ui-async-state${o.compact ? " compact" : ""}`,
|
|
9
9
|
role: s ? "alert" : "status",
|
|
10
10
|
"aria-live": s ? "assertive" : "polite",
|
|
11
11
|
children: [
|
|
12
|
-
s ? /* @__PURE__ */
|
|
12
|
+
s ? /* @__PURE__ */ t(r, {
|
|
13
13
|
"aria-hidden": "true",
|
|
14
14
|
size: 18
|
|
15
|
-
}) : /* @__PURE__ */ i
|
|
15
|
+
}) : /* @__PURE__ */ t(i, {
|
|
16
16
|
"aria-hidden": "true",
|
|
17
17
|
className: "spin",
|
|
18
18
|
size: 18
|
|
19
19
|
}),
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
s && o.onRetry && /* @__PURE__ */
|
|
20
|
+
/* @__PURE__ */ n("span", { children: [/* @__PURE__ */ t("strong", { children: s ? o.errorTitle : o.loadingTitle }), o.detail && /* @__PURE__ */ t("small", { children: o.detail })] }),
|
|
21
|
+
s && o.onRetry && /* @__PURE__ */ n(e, {
|
|
22
22
|
variant: "outline",
|
|
23
23
|
size: "compact",
|
|
24
24
|
onClick: o.onRetry,
|
|
25
|
-
children: [/* @__PURE__ */
|
|
25
|
+
children: [/* @__PURE__ */ t(a, {
|
|
26
26
|
"aria-hidden": "true",
|
|
27
27
|
size: 15
|
|
28
28
|
}), o.retryLabel ?? "重新加载"]
|
package/dist/Select.js
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
1
|
import { useOverlayContainer as e } from "./OverlayContainer.js";
|
|
2
2
|
import { FormField as t } from "./FormField.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { useId as n } from "react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { Check as a, ChevronDown as o, ChevronUp as s } from "lucide-react";
|
|
6
6
|
import * as c from "@radix-ui/react-select";
|
|
7
7
|
//#region src/Select.tsx
|
|
8
8
|
function l({ value: l, defaultValue: f, onValueChange: p, options: m, label: h, placeholder: g = "请选择", helpText: _, error: v, required: y, disabled: b, name: x, id: S, className: C = "", triggerRef: w, triggerProps: T, portalContainer: E, placement: D }) {
|
|
9
|
-
let O =
|
|
9
|
+
let O = n(), k = S ?? O, A = e(E), j = /* @__PURE__ */ i(c.Root, {
|
|
10
10
|
value: l,
|
|
11
11
|
defaultValue: f,
|
|
12
12
|
onValueChange: p,
|
|
13
13
|
disabled: b,
|
|
14
14
|
name: x,
|
|
15
15
|
required: y,
|
|
16
|
-
children: [/* @__PURE__ */
|
|
16
|
+
children: [/* @__PURE__ */ i(c.Trigger, {
|
|
17
17
|
...T,
|
|
18
18
|
ref: w,
|
|
19
19
|
id: k,
|
|
20
20
|
className: `ui-select-trigger ${C}`.trim(),
|
|
21
21
|
"aria-invalid": v ? !0 : T?.["aria-invalid"],
|
|
22
22
|
"aria-describedby": d(T?.["aria-describedby"], u(k, _, v)),
|
|
23
|
-
children: [/* @__PURE__ */
|
|
24
|
-
}), /* @__PURE__ */
|
|
23
|
+
children: [/* @__PURE__ */ r(c.Value, { placeholder: g }), /* @__PURE__ */ r(c.Icon, { children: /* @__PURE__ */ r(o, { size: 16 }) })]
|
|
24
|
+
}), /* @__PURE__ */ r(c.Portal, {
|
|
25
25
|
container: A,
|
|
26
|
-
children: /* @__PURE__ */
|
|
26
|
+
children: /* @__PURE__ */ i(c.Content, {
|
|
27
27
|
className: "ui-select-content",
|
|
28
28
|
position: "popper",
|
|
29
29
|
sideOffset: 6,
|
|
30
30
|
collisionPadding: 10,
|
|
31
31
|
...D,
|
|
32
32
|
children: [
|
|
33
|
-
/* @__PURE__ */
|
|
33
|
+
/* @__PURE__ */ r(c.ScrollUpButton, {
|
|
34
34
|
className: "ui-select-scroll",
|
|
35
|
-
children: /* @__PURE__ */
|
|
35
|
+
children: /* @__PURE__ */ r(s, { size: 16 })
|
|
36
36
|
}),
|
|
37
|
-
/* @__PURE__ */
|
|
37
|
+
/* @__PURE__ */ r(c.Viewport, {
|
|
38
38
|
className: "ui-select-viewport",
|
|
39
|
-
children: m.map((e) => /* @__PURE__ */
|
|
39
|
+
children: m.map((e) => /* @__PURE__ */ i(c.Item, {
|
|
40
40
|
value: e.value,
|
|
41
41
|
disabled: e.disabled,
|
|
42
42
|
className: "ui-select-item",
|
|
43
|
-
children: [/* @__PURE__ */
|
|
43
|
+
children: [/* @__PURE__ */ r(c.ItemText, { children: e.label }), /* @__PURE__ */ r(c.ItemIndicator, {
|
|
44
44
|
className: "ui-select-indicator",
|
|
45
|
-
children: /* @__PURE__ */
|
|
45
|
+
children: /* @__PURE__ */ r(a, { size: 15 })
|
|
46
46
|
})]
|
|
47
47
|
}, e.value))
|
|
48
48
|
}),
|
|
49
|
-
/* @__PURE__ */
|
|
49
|
+
/* @__PURE__ */ r(c.ScrollDownButton, {
|
|
50
50
|
className: "ui-select-scroll",
|
|
51
|
-
children: /* @__PURE__ */ o
|
|
51
|
+
children: /* @__PURE__ */ r(o, { size: 16 })
|
|
52
52
|
})
|
|
53
53
|
]
|
|
54
54
|
})
|
|
55
55
|
})]
|
|
56
56
|
});
|
|
57
|
-
return h === void 0 && _ === void 0 && !v ? j : /* @__PURE__ */
|
|
57
|
+
return h === void 0 && _ === void 0 && !v ? j : /* @__PURE__ */ r(t, {
|
|
58
58
|
controlId: k,
|
|
59
59
|
label: h,
|
|
60
60
|
required: y,
|
package/dist/SortableList.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { activeSortableTransfer as e, beginSortableTransfer as t, consumeSortableTransfer as n, endSortableTransfer as r, hasUniqueSortableTarget as i, registerSortableTarget as a, routeSortableTarget as o, useSortableTransferScope as s } from "./sortable-transfer-scope.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useEffect as c, useLayoutEffect as l, useMemo as u, useRef as d } from "react";
|
|
3
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
4
|
+
import { GripVertical as m } from "lucide-react";
|
|
5
5
|
import { Button as h, GridList as g, GridListItem as _, useDragAndDrop as v } from "react-aria-components";
|
|
6
6
|
//#region src/SortableList.tsx
|
|
7
7
|
function y(s) {
|
|
8
|
-
let y =
|
|
9
|
-
C.current = s,
|
|
8
|
+
let y = d(/* @__PURE__ */ new Set()), x = d({ mime: `application/x-ui-sortable-${Math.random().toString(36).slice(2)}` }).current, S = s.transferScope?.mime ?? x.mime, C = d(s);
|
|
9
|
+
C.current = s, c(() => () => {
|
|
10
10
|
r(s.transferScope, x);
|
|
11
|
-
}, [s.transferScope, x]),
|
|
11
|
+
}, [s.transferScope, x]), c(() => {
|
|
12
12
|
s.disabled && (y.current.clear(), r(s.transferScope, x));
|
|
13
13
|
}, [
|
|
14
14
|
s.disabled,
|
|
15
15
|
s.transferScope,
|
|
16
16
|
x
|
|
17
17
|
]);
|
|
18
|
-
let w =
|
|
18
|
+
let w = u(() => s.items.map((e, t) => ({
|
|
19
19
|
item: e,
|
|
20
20
|
index: t,
|
|
21
21
|
key: s.getKey(e)
|
|
22
|
-
})), [s.items, s.getKey]), T =
|
|
22
|
+
})), [s.items, s.getKey]), T = u(() => {
|
|
23
23
|
let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
|
|
24
24
|
for (let n of w) e.has(n.key) && t.add(n.key), e.set(n.key, n);
|
|
25
25
|
return {
|
|
26
26
|
index: e,
|
|
27
27
|
duplicates: t
|
|
28
28
|
};
|
|
29
|
-
}, [w]), E =
|
|
29
|
+
}, [w]), E = d(T);
|
|
30
30
|
E.current = T;
|
|
31
31
|
function D(e) {
|
|
32
32
|
let t = [...e].map((e) => E.current.duplicates.has(e) ? void 0 : E.current.index.get(e));
|
|
@@ -64,8 +64,8 @@ function y(s) {
|
|
|
64
64
|
external: a
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
let M =
|
|
68
|
-
M.current = N,
|
|
67
|
+
let M = d(N);
|
|
68
|
+
M.current = N, l(() => a(s.transferScope, x, {
|
|
69
69
|
accepts: (e) => E.current.index.has(e),
|
|
70
70
|
commit: (e, t) => M.current(e, t)
|
|
71
71
|
}), [s.transferScope, x]);
|
|
@@ -109,38 +109,38 @@ function y(s) {
|
|
|
109
109
|
onInsert: s.transferScope && s.onDropBetweenItems ? (e) => N(e.target.key, e.target.dropPosition) : void 0,
|
|
110
110
|
onItemDrop: s.transferScope && s.onDropOnItem ? (e) => N(e.target.key, "on") : void 0
|
|
111
111
|
});
|
|
112
|
-
return /* @__PURE__ */
|
|
112
|
+
return /* @__PURE__ */ f(g, {
|
|
113
113
|
"aria-label": s["aria-label"],
|
|
114
114
|
items: w,
|
|
115
|
-
renderEmptyState: s.renderEmptyState ?? (() => /* @__PURE__ */
|
|
115
|
+
renderEmptyState: s.renderEmptyState ?? (() => /* @__PURE__ */ f("span", {
|
|
116
116
|
className: "ui-sortable-empty",
|
|
117
117
|
children: s.onDropOnList && !s.disabled ? "拖动项目到此处" : "暂无项目"
|
|
118
118
|
})),
|
|
119
119
|
selectionMode: "none",
|
|
120
120
|
dragAndDropHooks: F,
|
|
121
121
|
className: ["ui-sortable-list", s.className].filter(Boolean).join(" "),
|
|
122
|
-
children: ({ item: e, index: t, key: n }) => /* @__PURE__ */
|
|
122
|
+
children: ({ item: e, index: t, key: n }) => /* @__PURE__ */ p(_, {
|
|
123
123
|
id: n,
|
|
124
124
|
textValue: s.getTextValue(e, t),
|
|
125
125
|
className: "ui-sortable-item",
|
|
126
126
|
children: [
|
|
127
|
-
!s.disabled && /* @__PURE__ */
|
|
127
|
+
!s.disabled && /* @__PURE__ */ f("span", {
|
|
128
128
|
className: "ui-sortable-placeholder",
|
|
129
129
|
"aria-hidden": "true",
|
|
130
130
|
children: s.draggingLabel ?? "原位置保留,松开后移动"
|
|
131
131
|
}),
|
|
132
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ f(h, {
|
|
133
133
|
slot: "drag",
|
|
134
134
|
className: "ui-sortable-handle",
|
|
135
135
|
isDisabled: s.disabled,
|
|
136
136
|
style: s.disabled ? { display: "none" } : void 0,
|
|
137
137
|
"aria-label": s.dragLabel?.(e, t) ?? `拖动第 ${t + 1} 项排序`,
|
|
138
|
-
children: /* @__PURE__ */
|
|
138
|
+
children: /* @__PURE__ */ f(m, {
|
|
139
139
|
"aria-hidden": "true",
|
|
140
140
|
size: 18
|
|
141
141
|
})
|
|
142
142
|
}),
|
|
143
|
-
/* @__PURE__ */
|
|
143
|
+
/* @__PURE__ */ f("div", {
|
|
144
144
|
className: "ui-sortable-content",
|
|
145
145
|
style: s.disabled ? { gridColumn: "1 / -1" } : void 0,
|
|
146
146
|
children: s.renderItem(e, t)
|