@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/DateInput.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { useOverlayContainer as e } from "./OverlayContainer.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import * as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { CalendarDate as
|
|
2
|
+
import { forwardRef as t, useCallback as n, useEffect as r, useId as ee, useRef as i, useState as a } from "react";
|
|
3
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
4
|
+
import { CalendarDays as te, ChevronLeft as ne, ChevronRight as re, X as c } from "lucide-react";
|
|
5
|
+
import * as l from "@radix-ui/react-popover";
|
|
6
|
+
import { Button as u, Calendar as ie, CalendarCell as ae, CalendarGrid as oe, CalendarGridBody as se, CalendarGridHeader as ce, CalendarHeaderCell as le, Heading as ue, I18nProvider as de } from "react-aria-components";
|
|
7
|
+
import { CalendarDate as fe, getLocalTimeZone as d, parseDate as f, today as p } from "@internationalized/date";
|
|
8
8
|
//#region src/DateInput.tsx
|
|
9
|
-
var
|
|
10
|
-
let j = `ui-date-calendar-${
|
|
11
|
-
M.current = e,
|
|
12
|
-
}, [
|
|
13
|
-
|
|
14
|
-
z(
|
|
15
|
-
}, [
|
|
9
|
+
var m = "jc-business-ui-date-input-open", h = t(function({ value: t, onValueChange: f, inputRef: h, inputClassName: y, className: x = "", disabled: S, readOnly: C, required: w, inputMode: pe = "numeric", autoComplete: me = "off", onFocus: T, onBlur: he, onKeyDown: ge, min: E, max: D, minDate: _e, maxDate: ve, isDateUnavailable: O, onValidationError: ye, ...k }, A) {
|
|
10
|
+
let j = `ui-date-calendar-${ee().replaceAll(":", "")}`, be = e(), M = i(null), N = i(!1), P = i(!1), F = i(!1), [I, L] = a(!1), [R, z] = a(() => g(t)), [B, V] = a(""), H = _(t), U = _(_e ?? (E === void 0 ? "" : String(E))), W = _(ve ?? (D === void 0 ? "" : String(D))), [G, K] = a(() => H ?? p(d())), q = !!(S || C), xe = n((e) => {
|
|
11
|
+
M.current = e, b(h, e), b(A, e);
|
|
12
|
+
}, [h, A]);
|
|
13
|
+
r(() => {
|
|
14
|
+
z(g(t)), V(""), M.current?.setCustomValidity("");
|
|
15
|
+
}, [t]), r(() => {
|
|
16
16
|
q && L(!1);
|
|
17
|
-
}, [q]),
|
|
17
|
+
}, [q]), r(() => {
|
|
18
18
|
let e = (e) => {
|
|
19
19
|
e.detail !== j && L(!1);
|
|
20
20
|
};
|
|
21
|
-
return document.addEventListener(
|
|
21
|
+
return document.addEventListener(m, e), () => document.removeEventListener(m, e);
|
|
22
22
|
}, [j]);
|
|
23
23
|
function J(e) {
|
|
24
24
|
if (!(e && q)) {
|
|
25
25
|
if (e && !I) {
|
|
26
|
-
document.dispatchEvent(new CustomEvent(
|
|
27
|
-
let e = H ??
|
|
26
|
+
document.dispatchEvent(new CustomEvent(m, { detail: j }));
|
|
27
|
+
let e = H ?? p(d());
|
|
28
28
|
U && e.compare(U) < 0 && (e = U), W && e.compare(W) > 0 && (e = W), K(e);
|
|
29
29
|
}
|
|
30
30
|
L(e);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
function Y(e) {
|
|
34
|
-
if (!e) return
|
|
35
|
-
let t =
|
|
34
|
+
if (!e) return w ? "请选择日期" : "";
|
|
35
|
+
let t = _(e);
|
|
36
36
|
return t ? U && t.compare(U) < 0 ? `日期不能早于 ${U}` : W && t.compare(W) > 0 ? `日期不能晚于 ${W}` : O?.(t.toString()) ? "该日期不可选择" : "" : "请输入有效日期(YYYY/MM/DD)";
|
|
37
37
|
}
|
|
38
38
|
function X(e) {
|
|
@@ -40,33 +40,33 @@ var h = "jc-business-ui-date-input-open", g = i(function({ value: i, onValueChan
|
|
|
40
40
|
}
|
|
41
41
|
function Z() {
|
|
42
42
|
if (q) return;
|
|
43
|
-
let e = R.trim() ?
|
|
44
|
-
X(
|
|
43
|
+
let e = R.trim() ? v(R) : "", n = e === null ? "请输入有效日期(YYYY/MM/DD)" : Y(e);
|
|
44
|
+
X(n), !n && e !== null && (z(g(e)), e !== t && f(e));
|
|
45
45
|
}
|
|
46
46
|
function Q(e) {
|
|
47
47
|
if (q) return;
|
|
48
48
|
let t = Y(e);
|
|
49
|
-
X(t), !t && (F.current = !0,
|
|
49
|
+
X(t), !t && (F.current = !0, f(e), z(g(e)), L(!1));
|
|
50
50
|
}
|
|
51
|
-
let $ =
|
|
52
|
-
return /* @__PURE__ */ l
|
|
51
|
+
let $ = p(d()).toString();
|
|
52
|
+
return /* @__PURE__ */ s(l.Root, {
|
|
53
53
|
open: I && !q,
|
|
54
54
|
onOpenChange: J,
|
|
55
55
|
children: [
|
|
56
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ o(l.Anchor, {
|
|
57
57
|
asChild: !0,
|
|
58
|
-
children: /* @__PURE__ */
|
|
59
|
-
className: `ui-date-input${I ? " open" : ""}${
|
|
60
|
-
children: [/* @__PURE__ */
|
|
58
|
+
children: /* @__PURE__ */ s("span", {
|
|
59
|
+
className: `ui-date-input${I ? " open" : ""}${x ? ` ${x}` : ""}`,
|
|
60
|
+
children: [/* @__PURE__ */ o("input", {
|
|
61
61
|
...k,
|
|
62
62
|
ref: xe,
|
|
63
|
-
className:
|
|
63
|
+
className: y,
|
|
64
64
|
type: "text",
|
|
65
|
-
inputMode:
|
|
66
|
-
autoComplete:
|
|
67
|
-
disabled:
|
|
68
|
-
readOnly:
|
|
69
|
-
required:
|
|
65
|
+
inputMode: pe,
|
|
66
|
+
autoComplete: me,
|
|
67
|
+
disabled: S,
|
|
68
|
+
readOnly: C,
|
|
69
|
+
required: w,
|
|
70
70
|
value: R,
|
|
71
71
|
placeholder: k.placeholder ?? "YYYY/MM/DD",
|
|
72
72
|
"aria-haspopup": "dialog",
|
|
@@ -75,7 +75,7 @@ var h = "jc-business-ui-date-input-open", g = i(function({ value: i, onValueChan
|
|
|
75
75
|
"aria-invalid": B ? !0 : k["aria-invalid"],
|
|
76
76
|
"aria-describedby": [k["aria-describedby"], B ? `${j}-error` : ""].filter(Boolean).join(" ") || void 0,
|
|
77
77
|
onFocus: (e) => {
|
|
78
|
-
|
|
78
|
+
T?.(e), !e.defaultPrevented && !N.current && J(!0);
|
|
79
79
|
},
|
|
80
80
|
onChange: (e) => {
|
|
81
81
|
z(e.target.value), B && X("");
|
|
@@ -86,7 +86,7 @@ var h = "jc-business-ui-date-input-open", g = i(function({ value: i, onValueChan
|
|
|
86
86
|
onKeyDown: (e) => {
|
|
87
87
|
ge?.(e), !(e.defaultPrevented || e.nativeEvent.isComposing || e.keyCode === 229 || q) && (e.key === "ArrowDown" && (e.preventDefault(), P.current = !0, J(!0), I && document.getElementById(j)?.querySelector("[role=\"gridcell\"] [tabindex=\"0\"]")?.focus()), e.key === "Enter" && (e.preventDefault(), Z()));
|
|
88
88
|
}
|
|
89
|
-
}), /* @__PURE__ */
|
|
89
|
+
}), /* @__PURE__ */ o("button", {
|
|
90
90
|
type: "button",
|
|
91
91
|
className: "ui-date-trigger",
|
|
92
92
|
disabled: q,
|
|
@@ -96,22 +96,22 @@ var h = "jc-business-ui-date-input-open", g = i(function({ value: i, onValueChan
|
|
|
96
96
|
onClick: () => {
|
|
97
97
|
P.current = !0, J(!I);
|
|
98
98
|
},
|
|
99
|
-
children: /* @__PURE__ */
|
|
99
|
+
children: /* @__PURE__ */ o(te, {
|
|
100
100
|
size: 17,
|
|
101
101
|
"aria-hidden": "true"
|
|
102
102
|
})
|
|
103
103
|
})]
|
|
104
104
|
})
|
|
105
105
|
}),
|
|
106
|
-
B && /* @__PURE__ */
|
|
106
|
+
B && /* @__PURE__ */ o("span", {
|
|
107
107
|
id: `${j}-error`,
|
|
108
108
|
className: "ui-form-error",
|
|
109
109
|
role: "alert",
|
|
110
110
|
children: B
|
|
111
111
|
}),
|
|
112
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ o(l.Portal, {
|
|
113
113
|
container: be,
|
|
114
|
-
children: /* @__PURE__ */ l
|
|
114
|
+
children: /* @__PURE__ */ s(l.Content, {
|
|
115
115
|
id: j,
|
|
116
116
|
className: "ui-date-calendar",
|
|
117
117
|
"aria-label": "选择日期",
|
|
@@ -129,9 +129,9 @@ var h = "jc-business-ui-date-input-open", g = i(function({ value: i, onValueChan
|
|
|
129
129
|
onInteractOutside: (e) => {
|
|
130
130
|
M.current?.parentElement?.contains(e.target) && e.preventDefault();
|
|
131
131
|
},
|
|
132
|
-
children: [/* @__PURE__ */
|
|
132
|
+
children: [/* @__PURE__ */ o(de, {
|
|
133
133
|
locale: "zh-CN",
|
|
134
|
-
children: /* @__PURE__ */
|
|
134
|
+
children: /* @__PURE__ */ s(ie, {
|
|
135
135
|
"aria-label": "选择日期",
|
|
136
136
|
value: H,
|
|
137
137
|
onChange: (e) => Q(e.toString()),
|
|
@@ -139,51 +139,51 @@ var h = "jc-business-ui-date-input-open", g = i(function({ value: i, onValueChan
|
|
|
139
139
|
maxValue: W ?? void 0,
|
|
140
140
|
isDateUnavailable: (e) => O?.(e.toString()) ?? !1,
|
|
141
141
|
focusedValue: G,
|
|
142
|
-
onFocusChange: (e) => K(new
|
|
142
|
+
onFocusChange: (e) => K(new fe(e.year, e.month, e.day)),
|
|
143
143
|
children: [
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
/* @__PURE__ */
|
|
144
|
+
/* @__PURE__ */ s("header", { children: [
|
|
145
|
+
/* @__PURE__ */ o(u, {
|
|
146
146
|
slot: "previous",
|
|
147
147
|
"aria-label": "上个月",
|
|
148
|
-
children: /* @__PURE__ */
|
|
148
|
+
children: /* @__PURE__ */ o(ne, { size: 18 })
|
|
149
149
|
}),
|
|
150
|
-
/* @__PURE__ */
|
|
151
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ o(ue, {}),
|
|
151
|
+
/* @__PURE__ */ o(u, {
|
|
152
152
|
slot: "next",
|
|
153
153
|
"aria-label": "下个月",
|
|
154
|
-
children: /* @__PURE__ */
|
|
154
|
+
children: /* @__PURE__ */ o(re, { size: 18 })
|
|
155
155
|
})
|
|
156
156
|
] }),
|
|
157
|
-
/* @__PURE__ */
|
|
157
|
+
/* @__PURE__ */ s("label", {
|
|
158
158
|
className: "ui-date-month-jump",
|
|
159
|
-
children: ["跳转年月", /* @__PURE__ */
|
|
159
|
+
children: ["跳转年月", /* @__PURE__ */ o("input", {
|
|
160
160
|
type: "month",
|
|
161
161
|
"aria-label": "跳转年月",
|
|
162
162
|
value: `${G.year.toString().padStart(4, "0")}-${String(G.month).padStart(2, "0")}`,
|
|
163
163
|
min: U?.toString().slice(0, 7),
|
|
164
164
|
max: W?.toString().slice(0, 7),
|
|
165
165
|
onChange: (e) => {
|
|
166
|
-
let t =
|
|
166
|
+
let t = _(`${e.target.value}-01`);
|
|
167
167
|
t && K(U && t.compare(U) < 0 ? U : W && t.compare(W) > 0 ? W : t);
|
|
168
168
|
}
|
|
169
169
|
})]
|
|
170
170
|
}),
|
|
171
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ s(oe, {
|
|
172
172
|
className: "ui-aria-calendar-grid",
|
|
173
|
-
children: [/* @__PURE__ */
|
|
173
|
+
children: [/* @__PURE__ */ o(ce, { children: (e) => /* @__PURE__ */ o(le, { children: e }) }), /* @__PURE__ */ o(se, { children: (e) => /* @__PURE__ */ o(ae, {
|
|
174
174
|
date: e,
|
|
175
175
|
"data-date": e.toString()
|
|
176
176
|
}) })]
|
|
177
177
|
})
|
|
178
178
|
]
|
|
179
179
|
})
|
|
180
|
-
}), /* @__PURE__ */
|
|
180
|
+
}), /* @__PURE__ */ s("footer", { children: [/* @__PURE__ */ s("button", {
|
|
181
181
|
type: "button",
|
|
182
182
|
className: "ui-date-clear",
|
|
183
|
-
disabled: !
|
|
183
|
+
disabled: !t || w,
|
|
184
184
|
onClick: () => Q(""),
|
|
185
|
-
children: [/* @__PURE__ */ c
|
|
186
|
-
}), /* @__PURE__ */
|
|
185
|
+
children: [/* @__PURE__ */ o(c, { size: 14 }), "清除"]
|
|
186
|
+
}), /* @__PURE__ */ o("button", {
|
|
187
187
|
type: "button",
|
|
188
188
|
className: "ui-date-today",
|
|
189
189
|
disabled: !!Y($),
|
|
@@ -195,29 +195,29 @@ var h = "jc-business-ui-date-input-open", g = i(function({ value: i, onValueChan
|
|
|
195
195
|
]
|
|
196
196
|
});
|
|
197
197
|
});
|
|
198
|
-
function
|
|
198
|
+
function g(e) {
|
|
199
199
|
return /^\d{4}-\d{2}-\d{2}$/.test(e) ? e.replaceAll("-", "/") : e;
|
|
200
200
|
}
|
|
201
|
-
function
|
|
202
|
-
let t =
|
|
203
|
-
return t ?
|
|
201
|
+
function _(e) {
|
|
202
|
+
let t = v(e);
|
|
203
|
+
return t ? f(t) : null;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function v(e) {
|
|
206
206
|
let t = e.trim().match(/^(\d{4})[/.\-](\d{1,2})[/.\-](\d{1,2})$/);
|
|
207
207
|
if (!t || Number(t[1]) < 1) return null;
|
|
208
208
|
let n = `${t[1]}-${t[2].padStart(2, "0")}-${t[3].padStart(2, "0")}`;
|
|
209
209
|
try {
|
|
210
|
-
return
|
|
210
|
+
return f(n).toString();
|
|
211
211
|
} catch {
|
|
212
212
|
return null;
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function y(e, t) {
|
|
216
216
|
let n = new Date(e, t, 1), r = new Date(e, t, 1 - n.getDay());
|
|
217
217
|
return Array.from({ length: 42 }, (e, t) => ({ date: new Date(r.getFullYear(), r.getMonth(), r.getDate() + t) }));
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function b(e, t) {
|
|
220
220
|
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
221
221
|
}
|
|
222
222
|
//#endregion
|
|
223
|
-
export {
|
|
223
|
+
export { h as DateInput, y as calendarDays, v as parseDate };
|
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
|
});
|