@sia.soul/sia-react-ui 0.1.23 → 0.1.24
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/{Select-BoVx-D0D.d.ts → Select-O_yY51vc.d.ts} +4 -2
- package/dist/{Select-BO3VyE2n.d.cts → Select-W_xpkpOW.d.cts} +4 -2
- package/dist/chart.cjs +1401 -1160
- package/dist/chart.css +21 -0
- package/dist/chart.js +4 -4
- package/dist/{chunk-VX2JECOU.js → chunk-6R7JY7IY.js} +20 -16
- package/dist/{chunk-TZGUBGA4.js → chunk-6WBABNAX.js} +4 -3
- package/dist/{chunk-OKP4DIQH.js → chunk-GUXAWU63.js} +29 -26
- package/dist/{chunk-QJ4OQNQ4.js → chunk-LA7O3PN4.js} +4 -3
- package/dist/{chunk-NPB33IXJ.js → chunk-LIYCU2GU.js} +349 -278
- package/dist/{chunk-KLI65JVD.js → chunk-LRPQ5FGE.js} +68 -186
- package/dist/chunk-NSSPGXNM.js +284 -0
- package/dist/{chunk-YT6E3X2K.js → chunk-OH6YILJW.js} +4 -3
- package/dist/{chunk-RWGSZW32.js → chunk-RGXVPS37.js} +7 -6
- package/dist/{chunk-GM47DAAN.js → chunk-T2QIW4OO.js} +8 -7
- package/dist/{core-Cqgl6Z7h.d.ts → core-BOzLwiXG.d.ts} +44 -5
- package/dist/{core-DF0pknX6.d.cts → core-tbb9ZiBY.d.cts} +44 -5
- package/dist/core.cjs +1637 -1443
- package/dist/core.css +52 -0
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +8 -6
- package/dist/index.cjs +3705 -3505
- package/dist/index.css +52 -0
- package/dist/index.d.cts +28 -15
- package/dist/index.d.ts +28 -15
- package/dist/index.js +90 -83
- package/dist/markdown-editor.cjs +269 -28
- package/dist/markdown-editor.css +20 -0
- package/dist/markdown-editor.js +2 -2
- package/dist/rich-text-editor.cjs +1156 -1031
- package/dist/rich-text-editor.css +20 -0
- package/dist/rich-text-editor.js +4 -4
- package/dist/{select-date-range-a6nzK7Wu.d.ts → select-date-range-BjqFUeU6.d.ts} +1 -1
- package/dist/{select-date-range-IOe6MMqu.d.cts → select-date-range-C9w8z3G8.d.cts} +1 -1
- package/dist/select-date-range.cjs +1188 -1059
- package/dist/select-date-range.css +20 -0
- package/dist/select-date-range.d.cts +2 -2
- package/dist/select-date-range.d.ts +2 -2
- package/dist/select-date-range.js +5 -5
- package/package.json +2 -2
- package/dist/chunk-3VJ4CZDQ.js +0 -43
|
@@ -1,26 +1,96 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TextArea
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OH6YILJW.js";
|
|
4
4
|
import {
|
|
5
5
|
Popover,
|
|
6
6
|
Tooltip,
|
|
7
7
|
useOverlayLifecycle
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6R7JY7IY.js";
|
|
9
9
|
import {
|
|
10
10
|
Dropdown,
|
|
11
11
|
Icon
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LRPQ5FGE.js";
|
|
13
13
|
import {
|
|
14
14
|
Button
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-6WBABNAX.js";
|
|
16
16
|
import {
|
|
17
17
|
useControlSize,
|
|
18
|
-
useControllableState
|
|
19
|
-
|
|
18
|
+
useControllableState,
|
|
19
|
+
withTitleTooltip
|
|
20
|
+
} from "./chunk-NSSPGXNM.js";
|
|
21
|
+
|
|
22
|
+
// src/components/Toolbar.tsx
|
|
23
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
24
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
25
|
+
function Toolbar({ items, onAction, disabled = false, size = "small", variant = "link", overflowLabel = "\u66F4\u591A\u64CD\u4F5C" }) {
|
|
26
|
+
const root = useRef(null);
|
|
27
|
+
const [visibleCount, setVisibleCount] = useState(Number.MAX_SAFE_INTEGER);
|
|
28
|
+
const visibleItems = items.filter((item) => !item.hidden);
|
|
29
|
+
useLayoutEffect(() => {
|
|
30
|
+
const element = root.current;
|
|
31
|
+
if (!element) return;
|
|
32
|
+
const buttons = Array.from(element.querySelectorAll("[data-sia-toolbar-item]"));
|
|
33
|
+
const more = element.querySelector("[data-sia-toolbar-more]");
|
|
34
|
+
const measure = () => {
|
|
35
|
+
const gap = parseFloat(getComputedStyle(element).columnGap) || 0;
|
|
36
|
+
const widths = buttons.map((button) => button.getBoundingClientRect().width);
|
|
37
|
+
const total = widths.reduce((sum, width) => sum + width, 0) + Math.max(0, widths.length - 1) * gap;
|
|
38
|
+
let count = widths.length;
|
|
39
|
+
if (total > element.clientWidth) {
|
|
40
|
+
const budget = element.clientWidth - (more?.getBoundingClientRect().width ?? 30);
|
|
41
|
+
let used = 0;
|
|
42
|
+
count = 0;
|
|
43
|
+
for (const width of widths) {
|
|
44
|
+
if (used + width + gap > budget) break;
|
|
45
|
+
used += width + gap;
|
|
46
|
+
count++;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
setVisibleCount((previous) => previous === count ? previous : count);
|
|
50
|
+
};
|
|
51
|
+
measure();
|
|
52
|
+
const observer = new ResizeObserver(measure);
|
|
53
|
+
observer.observe(element);
|
|
54
|
+
buttons.forEach((button) => observer.observe(button));
|
|
55
|
+
return () => observer.disconnect();
|
|
56
|
+
}, [items, size, variant]);
|
|
57
|
+
const blocked = (item) => disabled || Boolean(item.disabled || item.loading);
|
|
58
|
+
const invoke = (key) => {
|
|
59
|
+
const find = (entries) => {
|
|
60
|
+
for (const item of entries) {
|
|
61
|
+
if (item.hidden || blocked(item)) continue;
|
|
62
|
+
if (item.key === key) return item;
|
|
63
|
+
const child = item.children && find(item.children);
|
|
64
|
+
if (child) return child;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
if (find(items)) void onAction?.(key);
|
|
68
|
+
};
|
|
69
|
+
const menuItems = (entries) => entries.filter((item) => !item.hidden).map((item) => ({
|
|
70
|
+
key: item.children?.length ? `toolbar-menu:${item.key}` : item.key,
|
|
71
|
+
label: item.label,
|
|
72
|
+
icon: item.icon,
|
|
73
|
+
disabled: blocked(item),
|
|
74
|
+
danger: item.danger,
|
|
75
|
+
children: item.children?.length ? [
|
|
76
|
+
...item.split ? [{ key: item.key, label: item.label, icon: item.icon, disabled: blocked(item) }] : [],
|
|
77
|
+
...menuItems(item.children)
|
|
78
|
+
] : void 0
|
|
79
|
+
}));
|
|
80
|
+
const overflow = visibleItems.slice(visibleCount);
|
|
81
|
+
return /* @__PURE__ */ jsxs("div", { ref: root, className: "sia-toolbar", role: "toolbar", children: [
|
|
82
|
+
visibleItems.map((item, index) => {
|
|
83
|
+
const buttonProps = { size, variant, icon: item.icon, disabled: blocked(item), loading: item.loading, danger: item.danger };
|
|
84
|
+
const menu = { items: menuItems(item.children ?? []), onClick: ({ key }) => invoke(key) };
|
|
85
|
+
return /* @__PURE__ */ jsx("span", { "data-sia-toolbar-item": true, className: `sia-toolbar__item${index >= visibleCount ? " sia-toolbar__item--hidden" : ""}`, "aria-hidden": index >= visibleCount || void 0, children: item.children?.length ? item.split ? /* @__PURE__ */ jsx(Dropdown.Button, { trigger: ["hover"], menu, disabled: blocked(item), buttonProps, onClick: () => invoke(item.key), children: item.label }) : /* @__PURE__ */ jsx(Dropdown, { trigger: ["hover"], menu, children: /* @__PURE__ */ jsx(Button, { ...buttonProps, children: item.label }) }) : /* @__PURE__ */ jsx(Button, { ...buttonProps, onClick: () => invoke(item.key), children: item.label }) }, item.key);
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ jsx("span", { "data-sia-toolbar-more": true, className: `sia-toolbar__item${overflow.length ? "" : " sia-toolbar__item--hidden"}`, "aria-hidden": !overflow.length || void 0, children: /* @__PURE__ */ jsx(Dropdown, { trigger: ["hover"], menu: { items: menuItems(overflow), onClick: ({ key }) => invoke(key) }, children: /* @__PURE__ */ jsx(Button, { size, variant, disabled, "aria-label": overflowLabel, title: overflowLabel, icon: /* @__PURE__ */ jsx(Icon, { name: "more-horizontal", size: 16 }) }) }) })
|
|
88
|
+
] });
|
|
89
|
+
}
|
|
20
90
|
|
|
21
91
|
// src/components/Card.tsx
|
|
22
|
-
import { useState } from "react";
|
|
23
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
92
|
+
import { useState as useState2 } from "react";
|
|
93
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
24
94
|
function Card({
|
|
25
95
|
title,
|
|
26
96
|
description,
|
|
@@ -39,7 +109,7 @@ function Card({
|
|
|
39
109
|
children,
|
|
40
110
|
...props
|
|
41
111
|
}) {
|
|
42
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
112
|
+
const [internalCollapsed, setInternalCollapsed] = useState2(defaultCollapsed);
|
|
43
113
|
const isCollapsed = collapsed ?? internalCollapsed;
|
|
44
114
|
const hasHeader = title || extra || collapsible;
|
|
45
115
|
const mergedStyle = accentColor ? { "--sia-card-accent": accentColor, ...style } : style;
|
|
@@ -49,27 +119,27 @@ function Card({
|
|
|
49
119
|
if (collapsed === void 0) setInternalCollapsed(nextCollapsed);
|
|
50
120
|
onCollapsedChange?.(nextCollapsed);
|
|
51
121
|
}
|
|
52
|
-
const heading = /* @__PURE__ */
|
|
53
|
-
accent || accentColor ? /* @__PURE__ */
|
|
54
|
-
title ? /* @__PURE__ */
|
|
122
|
+
const heading = /* @__PURE__ */ jsxs2("span", { className: "sia-card__heading", children: [
|
|
123
|
+
accent || accentColor ? /* @__PURE__ */ jsx2("span", { className: `sia-card__accent${accent ? ` sia-card__accent--${accent}` : ""}`, "aria-hidden": "true" }) : null,
|
|
124
|
+
title ? /* @__PURE__ */ jsx2("h3", { className: "sia-card__title", children: title }) : null
|
|
55
125
|
] });
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
hasHeader ? /* @__PURE__ */
|
|
58
|
-
collapsible ? /* @__PURE__ */
|
|
126
|
+
return /* @__PURE__ */ jsxs2("section", { className: `sia-card${isCollapsed ? " sia-card--collapsed" : ""} ${className}`.trim(), style: mergedStyle, ...withTitleTooltip(props), children: [
|
|
127
|
+
hasHeader ? /* @__PURE__ */ jsxs2("header", { className: "sia-card__header", children: [
|
|
128
|
+
collapsible ? /* @__PURE__ */ jsxs2("button", { type: "button", className: "sia-card__collapse-trigger", "aria-expanded": !isCollapsed, onClick: toggleCollapsed, children: [
|
|
59
129
|
heading,
|
|
60
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ jsx2(Icon, { name: isCollapsed ? "chevron-down" : "chevron-up", size: 16 })
|
|
61
131
|
] }) : heading,
|
|
62
|
-
extra ? /* @__PURE__ */
|
|
132
|
+
extra ? /* @__PURE__ */ jsx2("div", { className: "sia-card__extra", children: extra }) : null
|
|
63
133
|
] }) : null,
|
|
64
|
-
!isCollapsed ? /* @__PURE__ */
|
|
65
|
-
description ? /* @__PURE__ */
|
|
66
|
-
/* @__PURE__ */
|
|
134
|
+
!isCollapsed ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
135
|
+
description ? /* @__PURE__ */ jsx2("p", { className: "sia-card__description", children: description }) : null,
|
|
136
|
+
/* @__PURE__ */ jsx2("div", { className: `sia-card__body ${bodyClassName}`.trim(), style: mergedBodyStyle, children })
|
|
67
137
|
] }) : null
|
|
68
138
|
] });
|
|
69
139
|
}
|
|
70
140
|
|
|
71
141
|
// src/components/Tag.tsx
|
|
72
|
-
import { jsx as
|
|
142
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
73
143
|
function Tag({
|
|
74
144
|
status = "default",
|
|
75
145
|
compact = false,
|
|
@@ -83,16 +153,16 @@ function Tag({
|
|
|
83
153
|
children,
|
|
84
154
|
...props
|
|
85
155
|
}) {
|
|
86
|
-
return /* @__PURE__ */
|
|
156
|
+
return /* @__PURE__ */ jsxs3(
|
|
87
157
|
"span",
|
|
88
158
|
{
|
|
89
159
|
className: `sia-tag${closable && closeOnHover ? " sia-tag--close-on-hover" : ""} sia-tag--${status} sia-tag--${variant}${compact ? " sia-tag--compact" : ""}${disabled ? " sia-tag--disabled" : ""} ${className}`.trim(),
|
|
90
160
|
"aria-disabled": disabled || void 0,
|
|
91
|
-
...props,
|
|
161
|
+
...withTitleTooltip(props),
|
|
92
162
|
children: [
|
|
93
|
-
icon ? /* @__PURE__ */
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
closable ? /* @__PURE__ */
|
|
163
|
+
icon ? /* @__PURE__ */ jsx3("span", { className: "sia-tag__icon", children: icon }) : null,
|
|
164
|
+
/* @__PURE__ */ jsx3("span", { children }),
|
|
165
|
+
closable ? /* @__PURE__ */ jsx3(
|
|
96
166
|
"button",
|
|
97
167
|
{
|
|
98
168
|
type: "button",
|
|
@@ -103,7 +173,7 @@ function Tag({
|
|
|
103
173
|
event.stopPropagation();
|
|
104
174
|
onClose?.(event);
|
|
105
175
|
},
|
|
106
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ jsx3(Icon, { name: "close", size: 12 })
|
|
107
177
|
}
|
|
108
178
|
) : null
|
|
109
179
|
]
|
|
@@ -112,8 +182,8 @@ function Tag({
|
|
|
112
182
|
}
|
|
113
183
|
|
|
114
184
|
// src/components/Tabs.tsx
|
|
115
|
-
import { useId, useLayoutEffect, useMemo, useRef, useState as
|
|
116
|
-
import { jsx as
|
|
185
|
+
import { useId, useLayoutEffect as useLayoutEffect2, useMemo, useRef as useRef2, useState as useState3 } from "react";
|
|
186
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
117
187
|
function Tabs({
|
|
118
188
|
items,
|
|
119
189
|
activeKey,
|
|
@@ -135,7 +205,7 @@ function Tabs({
|
|
|
135
205
|
...props
|
|
136
206
|
}) {
|
|
137
207
|
const firstEnabledKey = items.find((item) => !item.disabled)?.key ?? "";
|
|
138
|
-
const [internalActiveKey, setInternalActiveKey] =
|
|
208
|
+
const [internalActiveKey, setInternalActiveKey] = useState3(defaultActiveKey ?? firstEnabledKey);
|
|
139
209
|
const currentKey = activeKey ?? internalActiveKey;
|
|
140
210
|
const selectedKey = items.some((item) => item.key === currentKey && !item.disabled) ? currentKey : firstEnabledKey;
|
|
141
211
|
const baseId = useId().replace(/:/g, "");
|
|
@@ -143,9 +213,9 @@ function Tabs({
|
|
|
143
213
|
const resolvedPosition = tabPosition ?? (orientation === "vertical" ? "left" : "top");
|
|
144
214
|
const resolvedOrientation = resolvedPosition === "left" || resolvedPosition === "right" ? "vertical" : "horizontal";
|
|
145
215
|
const sliding = ["capsule", "line", "underline", "tech", "tech-line"].includes(type);
|
|
146
|
-
const listRef =
|
|
147
|
-
const indicatorRef =
|
|
148
|
-
|
|
216
|
+
const listRef = useRef2(null);
|
|
217
|
+
const indicatorRef = useRef2(null);
|
|
218
|
+
useLayoutEffect2(() => {
|
|
149
219
|
if (!sliding) return;
|
|
150
220
|
const list = listRef.current;
|
|
151
221
|
const indicator = indicatorRef.current;
|
|
@@ -196,25 +266,25 @@ function Tabs({
|
|
|
196
266
|
focusAndSelect(enabledItems[nextIndex].key);
|
|
197
267
|
}
|
|
198
268
|
const hasPanels = items.some((item) => item.children !== void 0);
|
|
199
|
-
return /* @__PURE__ */
|
|
269
|
+
return /* @__PURE__ */ jsxs4(
|
|
200
270
|
"div",
|
|
201
271
|
{
|
|
202
272
|
className: `sia-tabs sia-tabs--${type}${type === "underline" ? " sia-tabs--line" : ""} sia-tabs--${size} sia-tabs--${resolvedOrientation} sia-tabs--${resolvedPosition}${centered ? " sia-tabs--centered" : ""} ${className}`.trim(),
|
|
203
|
-
...props,
|
|
273
|
+
...withTitleTooltip(props),
|
|
204
274
|
children: [
|
|
205
|
-
/* @__PURE__ */
|
|
206
|
-
tabBarTitle ? /* @__PURE__ */
|
|
275
|
+
/* @__PURE__ */ jsxs4("div", { className: "sia-tabs__header", children: [
|
|
276
|
+
tabBarTitle ? /* @__PURE__ */ jsxs4("div", { className: "sia-tabs__title", children: [
|
|
207
277
|
tabBarTitle,
|
|
208
|
-
type === "tech-line" ? /* @__PURE__ */
|
|
278
|
+
type === "tech-line" ? /* @__PURE__ */ jsx4("svg", { className: "sia-tabs__title-connector", viewBox: "0 0 32 40", "aria-hidden": "true", children: /* @__PURE__ */ jsx4("path", { d: "M0 39 H5 Q8 39 10 35 L28 3 Q29 1 32 1", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }) }) : null
|
|
209
279
|
] }) : null,
|
|
210
|
-
/* @__PURE__ */
|
|
211
|
-
sliding ? /* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
-
/* @__PURE__ */
|
|
215
|
-
/* @__PURE__ */
|
|
280
|
+
/* @__PURE__ */ jsxs4("div", { ref: listRef, className: `sia-tabs__list${sliding ? " sia-tabs__list--sliding" : ""}`, role: "tablist", "aria-orientation": resolvedOrientation, children: [
|
|
281
|
+
sliding ? /* @__PURE__ */ jsx4("span", { ref: indicatorRef, className: `sia-tabs__indicator${type === "capsule" ? " sia-tabs__capsule-indicator" : ""}`, "aria-hidden": "true", children: type === "tech-line" ? /* @__PURE__ */ jsxs4("svg", { className: "sia-tabs__indicator-shape", viewBox: "0 0 100 34", preserveAspectRatio: "none", "aria-hidden": "true", children: [
|
|
282
|
+
/* @__PURE__ */ jsx4("defs", { children: /* @__PURE__ */ jsxs4("linearGradient", { id: `${baseId}-tab-fill-indicator`, x1: "0", y1: "0", x2: "1", y2: "0", children: [
|
|
283
|
+
/* @__PURE__ */ jsx4("stop", { offset: "0", stopColor: "var(--sia-tabs-line-fill-edge, var(--sia-tabs-line-fill))" }),
|
|
284
|
+
/* @__PURE__ */ jsx4("stop", { offset: ".53", stopColor: "var(--sia-tabs-line-fill-center, var(--sia-tabs-line-fill))" }),
|
|
285
|
+
/* @__PURE__ */ jsx4("stop", { offset: "1", stopColor: "var(--sia-tabs-line-fill-edge, var(--sia-tabs-line-fill))" })
|
|
216
286
|
] }) }),
|
|
217
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ jsx4(
|
|
218
288
|
"path",
|
|
219
289
|
{
|
|
220
290
|
d: "M19 1 H96 Q99 1 97.5 4 L83.5 30 Q82 33 79 33 H4 Q1 33 2.5 30 L16.5 4 Q18 1 19 1 Z",
|
|
@@ -228,8 +298,8 @@ function Tabs({
|
|
|
228
298
|
items.map((item) => {
|
|
229
299
|
const selected = item.key === selectedKey;
|
|
230
300
|
const canClose = item.closable ?? closable;
|
|
231
|
-
const tabNode = /* @__PURE__ */
|
|
232
|
-
/* @__PURE__ */
|
|
301
|
+
const tabNode = /* @__PURE__ */ jsxs4("span", { className: `sia-tabs__tab-wrap${canClose ? " is-closable" : ""}`, children: [
|
|
302
|
+
/* @__PURE__ */ jsxs4(
|
|
233
303
|
"button",
|
|
234
304
|
{
|
|
235
305
|
id: `${baseId}-tab-${item.key}`,
|
|
@@ -243,13 +313,13 @@ function Tabs({
|
|
|
243
313
|
onClick: () => selectTab(item.key),
|
|
244
314
|
onKeyDown: (event) => handleKeyDown(event, item.key),
|
|
245
315
|
children: [
|
|
246
|
-
type === "tech-line" ? /* @__PURE__ */
|
|
247
|
-
/* @__PURE__ */
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
/* @__PURE__ */
|
|
316
|
+
type === "tech-line" ? /* @__PURE__ */ jsxs4("svg", { className: "sia-tabs__tab-shape", viewBox: "0 0 100 34", preserveAspectRatio: "none", "aria-hidden": "true", children: [
|
|
317
|
+
/* @__PURE__ */ jsx4("defs", { children: /* @__PURE__ */ jsxs4("linearGradient", { id: `${baseId}-tab-fill-${item.key}`, x1: "0", y1: "0", x2: "1", y2: "0", children: [
|
|
318
|
+
/* @__PURE__ */ jsx4("stop", { offset: "0", stopColor: "var(--sia-tabs-line-fill-edge, var(--sia-tabs-line-fill))" }),
|
|
319
|
+
/* @__PURE__ */ jsx4("stop", { offset: ".53", stopColor: "var(--sia-tabs-line-fill-center, var(--sia-tabs-line-fill))" }),
|
|
320
|
+
/* @__PURE__ */ jsx4("stop", { offset: "1", stopColor: "var(--sia-tabs-line-fill-edge, var(--sia-tabs-line-fill))" })
|
|
251
321
|
] }) }),
|
|
252
|
-
/* @__PURE__ */
|
|
322
|
+
/* @__PURE__ */ jsx4(
|
|
253
323
|
"path",
|
|
254
324
|
{
|
|
255
325
|
d: "M19 1 H96 Q99 1 97.5 4 L83.5 30 Q82 33 79 33 H4 Q1 33 2.5 30 L16.5 4 Q18 1 19 1 Z",
|
|
@@ -260,12 +330,12 @@ function Tabs({
|
|
|
260
330
|
}
|
|
261
331
|
)
|
|
262
332
|
] }) : null,
|
|
263
|
-
item.icon ? /* @__PURE__ */
|
|
264
|
-
/* @__PURE__ */
|
|
333
|
+
item.icon ? /* @__PURE__ */ jsx4("span", { className: "sia-tabs__icon", children: item.icon }) : null,
|
|
334
|
+
/* @__PURE__ */ jsx4("span", { children: item.label })
|
|
265
335
|
]
|
|
266
336
|
}
|
|
267
337
|
),
|
|
268
|
-
canClose ? /* @__PURE__ */
|
|
338
|
+
canClose ? /* @__PURE__ */ jsx4(
|
|
269
339
|
"button",
|
|
270
340
|
{
|
|
271
341
|
type: "button",
|
|
@@ -273,13 +343,13 @@ function Tabs({
|
|
|
273
343
|
"aria-label": `\u5173\u95ED${typeof item.label === "string" ? item.label : "\u6807\u7B7E\u9875"}`,
|
|
274
344
|
disabled: item.disabled,
|
|
275
345
|
onClick: () => onEdit?.(item.key, "remove"),
|
|
276
|
-
children: /* @__PURE__ */
|
|
346
|
+
children: /* @__PURE__ */ jsx4(Icon, { name: "close", size: 12 })
|
|
277
347
|
}
|
|
278
348
|
) : null
|
|
279
349
|
] }, item.key);
|
|
280
350
|
const contextMenuItems = typeof tabContextMenu === "function" ? tabContextMenu(item) : tabContextMenu;
|
|
281
351
|
if (!contextMenuItems?.length) return tabNode;
|
|
282
|
-
return /* @__PURE__ */
|
|
352
|
+
return /* @__PURE__ */ jsx4(
|
|
283
353
|
Dropdown,
|
|
284
354
|
{
|
|
285
355
|
className: "sia-tabs__tab-context-trigger",
|
|
@@ -297,12 +367,12 @@ function Tabs({
|
|
|
297
367
|
);
|
|
298
368
|
})
|
|
299
369
|
] }),
|
|
300
|
-
tabBarExtraContent ? /* @__PURE__ */
|
|
370
|
+
tabBarExtraContent ? /* @__PURE__ */ jsx4("div", { className: "sia-tabs__extra", children: tabBarExtraContent }) : null
|
|
301
371
|
] }),
|
|
302
|
-
hasPanels ? /* @__PURE__ */
|
|
372
|
+
hasPanels ? /* @__PURE__ */ jsx4("div", { className: "sia-tabs__panels", children: items.map((item) => {
|
|
303
373
|
const selected = item.key === selectedKey;
|
|
304
374
|
if (destroyInactiveTabPane && !selected) return null;
|
|
305
|
-
return /* @__PURE__ */
|
|
375
|
+
return /* @__PURE__ */ jsx4(
|
|
306
376
|
"div",
|
|
307
377
|
{
|
|
308
378
|
id: `${baseId}-panel-${item.key}`,
|
|
@@ -322,10 +392,10 @@ function Tabs({
|
|
|
322
392
|
}
|
|
323
393
|
|
|
324
394
|
// src/components/Feedback.tsx
|
|
325
|
-
import { useEffect, useMemo as useMemo2, useState as
|
|
395
|
+
import { useEffect, useMemo as useMemo2, useState as useState4 } from "react";
|
|
326
396
|
import { createPortal } from "react-dom";
|
|
327
397
|
import { createRoot } from "react-dom/client";
|
|
328
|
-
import { Fragment as Fragment2, jsx as
|
|
398
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
329
399
|
function Popconfirm({
|
|
330
400
|
children,
|
|
331
401
|
title,
|
|
@@ -340,28 +410,28 @@ function Popconfirm({
|
|
|
340
410
|
defaultOpen = false,
|
|
341
411
|
disabled = false,
|
|
342
412
|
showCancel = true,
|
|
343
|
-
icon = /* @__PURE__ */
|
|
413
|
+
icon = /* @__PURE__ */ jsx5(Icon, { name: "question", variant: "filled" }),
|
|
344
414
|
onConfirm,
|
|
345
415
|
onCancel,
|
|
346
416
|
onOpenChange
|
|
347
417
|
}) {
|
|
348
418
|
const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
|
|
349
|
-
const [loading, setLoading] =
|
|
350
|
-
const content = /* @__PURE__ */
|
|
351
|
-
/* @__PURE__ */
|
|
352
|
-
/* @__PURE__ */
|
|
353
|
-
/* @__PURE__ */
|
|
354
|
-
/* @__PURE__ */
|
|
355
|
-
description ? /* @__PURE__ */
|
|
419
|
+
const [loading, setLoading] = useState4(false);
|
|
420
|
+
const content = /* @__PURE__ */ jsxs5("div", { className: "sia-popconfirm", children: [
|
|
421
|
+
/* @__PURE__ */ jsxs5("div", { className: "sia-popconfirm__message", children: [
|
|
422
|
+
/* @__PURE__ */ jsx5("span", { children: icon }),
|
|
423
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
424
|
+
/* @__PURE__ */ jsx5("strong", { children: title }),
|
|
425
|
+
description ? /* @__PURE__ */ jsx5("p", { children: description }) : null
|
|
356
426
|
] })
|
|
357
427
|
] }),
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
-
showCancel ? /* @__PURE__ */
|
|
428
|
+
/* @__PURE__ */ jsxs5("div", { className: "sia-popconfirm__actions", children: [
|
|
429
|
+
showCancel ? /* @__PURE__ */ jsx5(Button, { size: "small", ...cancelButtonProps, onClick: (event) => {
|
|
360
430
|
cancelButtonProps?.onClick?.(event);
|
|
361
431
|
onCancel?.(event);
|
|
362
432
|
setVisible(false);
|
|
363
433
|
}, children: cancelText }) : null,
|
|
364
|
-
/* @__PURE__ */
|
|
434
|
+
/* @__PURE__ */ jsx5(Button, { size: "small", variant: "primary", ...okButtonProps, loading: loading || okButtonProps?.loading, onClick: async (event) => {
|
|
365
435
|
okButtonProps?.onClick?.(event);
|
|
366
436
|
const result = onConfirm?.(event);
|
|
367
437
|
if (result instanceof Promise) {
|
|
@@ -375,7 +445,7 @@ function Popconfirm({
|
|
|
375
445
|
}, children: okText })
|
|
376
446
|
] })
|
|
377
447
|
] });
|
|
378
|
-
return /* @__PURE__ */
|
|
448
|
+
return /* @__PURE__ */ jsx5(Popover, { content, placement, trigger: disabled ? [] : trigger, open: visible, onOpenChange: setVisible, children });
|
|
379
449
|
}
|
|
380
450
|
function Progress({
|
|
381
451
|
percent = 0,
|
|
@@ -398,30 +468,30 @@ function Progress({
|
|
|
398
468
|
const resolved = status ?? (safe >= 100 ? "success" : "normal");
|
|
399
469
|
const color = typeof strokeColor === "string" ? strokeColor : void 0;
|
|
400
470
|
const background = typeof strokeColor === "object" ? `linear-gradient(90deg, ${strokeColor.from}, ${strokeColor.to})` : color;
|
|
401
|
-
const label = format?.(safe, success?.percent) ?? (resolved === "exception" ? /* @__PURE__ */
|
|
471
|
+
const label = format?.(safe, success?.percent) ?? (resolved === "exception" ? /* @__PURE__ */ jsx5(Icon, { name: "close" }) : resolved === "success" ? /* @__PURE__ */ jsx5(Icon, { name: "check" }) : `${safe}%`);
|
|
402
472
|
if (type !== "line") {
|
|
403
473
|
const radius = 46;
|
|
404
474
|
const circumference = 2 * Math.PI * radius;
|
|
405
475
|
const dash = circumference * (safe / 100);
|
|
406
|
-
return /* @__PURE__ */
|
|
407
|
-
/* @__PURE__ */
|
|
408
|
-
/* @__PURE__ */
|
|
409
|
-
/* @__PURE__ */
|
|
476
|
+
return /* @__PURE__ */ jsxs5("div", { className: `sia-progress sia-progress--${type} sia-progress--${resolved} ${className}`.trim(), style: { width, height: width, ...style }, ...withTitleTooltip(props), children: [
|
|
477
|
+
/* @__PURE__ */ jsxs5("svg", { viewBox: "0 0 100 100", role: "progressbar", "aria-valuenow": safe, children: [
|
|
478
|
+
/* @__PURE__ */ jsx5("circle", { className: "sia-progress__trail", cx: "50", cy: "50", r: radius, style: { stroke: trailColor } }),
|
|
479
|
+
/* @__PURE__ */ jsx5("circle", { className: "sia-progress__circle", cx: "50", cy: "50", r: radius, style: { stroke: color, strokeDasharray: type === "dashboard" ? `${circumference * 0.75} ${circumference * 0.25}` : circumference, strokeDashoffset: (type === "dashboard" ? circumference * 0.75 : circumference) - dash * (type === "dashboard" ? 0.75 : 1), strokeWidth } })
|
|
410
480
|
] }),
|
|
411
|
-
showInfo ? /* @__PURE__ */
|
|
481
|
+
showInfo ? /* @__PURE__ */ jsx5("span", { className: "sia-progress__text", children: label }) : null
|
|
412
482
|
] });
|
|
413
483
|
}
|
|
414
484
|
const height = Array.isArray(size) ? size[1] : typeof size === "number" ? size : size === "small" ? 6 : strokeWidth;
|
|
415
|
-
return /* @__PURE__ */
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
-
/* @__PURE__ */
|
|
418
|
-
success?.percent ? /* @__PURE__ */
|
|
485
|
+
return /* @__PURE__ */ jsxs5("div", { className: `sia-progress sia-progress--line sia-progress--${resolved} ${className}`.trim(), style, ...withTitleTooltip(props), children: [
|
|
486
|
+
/* @__PURE__ */ jsx5("div", { className: "sia-progress__outer", style: { height, backgroundColor: trailColor }, children: steps ? /* @__PURE__ */ jsx5("div", { className: "sia-progress__steps", children: Array.from({ length: steps }, (_, index) => /* @__PURE__ */ jsx5("span", { className: index < Math.round(steps * safe / 100) ? "is-active" : "", style: { background: index < Math.round(steps * safe / 100) ? background : trailColor } }, index)) }) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
487
|
+
/* @__PURE__ */ jsx5("span", { className: "sia-progress__bar", style: { width: `${safe}%`, background } }),
|
|
488
|
+
success?.percent ? /* @__PURE__ */ jsx5("span", { className: "sia-progress__success", style: { width: `${success.percent}%`, background: success.strokeColor } }) : null
|
|
419
489
|
] }) }),
|
|
420
|
-
showInfo ? /* @__PURE__ */
|
|
490
|
+
showInfo ? /* @__PURE__ */ jsx5("span", { className: "sia-progress__info", children: label }) : null
|
|
421
491
|
] });
|
|
422
492
|
}
|
|
423
493
|
function Spin({ spinning = true, size = "default", tip, indicator, delay = 0, fullscreen = false, className = "", children, ...props }) {
|
|
424
|
-
const [visible, setVisible] =
|
|
494
|
+
const [visible, setVisible] = useState4(delay === 0 && spinning);
|
|
425
495
|
useEffect(() => {
|
|
426
496
|
if (!spinning) {
|
|
427
497
|
setVisible(false);
|
|
@@ -430,20 +500,20 @@ function Spin({ spinning = true, size = "default", tip, indicator, delay = 0, fu
|
|
|
430
500
|
const timer = window.setTimeout(() => setVisible(true), delay);
|
|
431
501
|
return () => window.clearTimeout(timer);
|
|
432
502
|
}, [delay, spinning]);
|
|
433
|
-
const spinner = visible ? /* @__PURE__ */
|
|
434
|
-
indicator ?? /* @__PURE__ */
|
|
435
|
-
/* @__PURE__ */
|
|
436
|
-
/* @__PURE__ */
|
|
437
|
-
/* @__PURE__ */
|
|
438
|
-
/* @__PURE__ */
|
|
503
|
+
const spinner = visible ? /* @__PURE__ */ jsxs5("div", { className: `sia-spin sia-spin--${size}`, role: "status", "aria-live": "polite", children: [
|
|
504
|
+
indicator ?? /* @__PURE__ */ jsxs5("span", { className: "sia-spin__indicator", children: [
|
|
505
|
+
/* @__PURE__ */ jsx5("i", {}),
|
|
506
|
+
/* @__PURE__ */ jsx5("i", {}),
|
|
507
|
+
/* @__PURE__ */ jsx5("i", {}),
|
|
508
|
+
/* @__PURE__ */ jsx5("i", {})
|
|
439
509
|
] }),
|
|
440
|
-
tip ? /* @__PURE__ */
|
|
510
|
+
tip ? /* @__PURE__ */ jsx5("span", { className: "sia-spin__tip", children: tip }) : null
|
|
441
511
|
] }) : null;
|
|
442
|
-
if (fullscreen) return visible && typeof document !== "undefined" ? createPortal(/* @__PURE__ */
|
|
443
|
-
if (!children) return /* @__PURE__ */
|
|
444
|
-
return /* @__PURE__ */
|
|
512
|
+
if (fullscreen) return visible && typeof document !== "undefined" ? createPortal(/* @__PURE__ */ jsx5("div", { className: "sia-spin-fullscreen", children: spinner }), document.body) : null;
|
|
513
|
+
if (!children) return /* @__PURE__ */ jsx5("div", { className: `sia-spin-wrap ${className}`.trim(), ...withTitleTooltip(props), children: spinner });
|
|
514
|
+
return /* @__PURE__ */ jsxs5("div", { className: `sia-spin-container${visible ? " is-spinning" : ""} ${className}`.trim(), ...withTitleTooltip(props), children: [
|
|
445
515
|
children,
|
|
446
|
-
visible ? /* @__PURE__ */
|
|
516
|
+
visible ? /* @__PURE__ */ jsx5("div", { className: "sia-spin-mask", children: spinner }) : null
|
|
447
517
|
] });
|
|
448
518
|
}
|
|
449
519
|
function escapeXml(value) {
|
|
@@ -458,9 +528,9 @@ function Watermark({ content = "Sia Web UI", image, width = 120, height = 64, ro
|
|
|
458
528
|
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${tileWidth}" height="${tileHeight}"><g transform="translate(${offset[0]} ${offset[1]}) rotate(${rotate} ${width / 2} ${height / 2})">${body}</g></svg>`;
|
|
459
529
|
return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
|
|
460
530
|
}, [content, font?.color, font?.fontFamily, font?.fontSize, font?.fontWeight, gap[0], gap[1], height, image, offset[0], offset[1], rotate, width]);
|
|
461
|
-
return /* @__PURE__ */
|
|
531
|
+
return /* @__PURE__ */ jsxs5("div", { className: `sia-watermark ${className}`.trim(), ...withTitleTooltip(props), children: [
|
|
462
532
|
children,
|
|
463
|
-
/* @__PURE__ */
|
|
533
|
+
/* @__PURE__ */ jsx5("div", { className: "sia-watermark__layer", "aria-hidden": "true", style: { zIndex, backgroundImage: background } })
|
|
464
534
|
] });
|
|
465
535
|
}
|
|
466
536
|
var notificationListeners = /* @__PURE__ */ new Set();
|
|
@@ -480,7 +550,7 @@ function closeNotification(key) {
|
|
|
480
550
|
entry?.onClose?.();
|
|
481
551
|
}
|
|
482
552
|
function NotificationHost() {
|
|
483
|
-
const [entries, setEntries] =
|
|
553
|
+
const [entries, setEntries] = useState4(notificationEntries);
|
|
484
554
|
useEffect(() => {
|
|
485
555
|
notificationListeners.add(setEntries);
|
|
486
556
|
return () => {
|
|
@@ -488,17 +558,17 @@ function NotificationHost() {
|
|
|
488
558
|
};
|
|
489
559
|
}, []);
|
|
490
560
|
const placements = ["topLeft", "topRight", "bottomLeft", "bottomRight"];
|
|
491
|
-
return /* @__PURE__ */
|
|
492
|
-
/* @__PURE__ */
|
|
493
|
-
/* @__PURE__ */
|
|
494
|
-
/* @__PURE__ */
|
|
495
|
-
item.description ? /* @__PURE__ */
|
|
561
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children: placements.map((placement) => /* @__PURE__ */ jsx5("div", { className: `sia-notification sia-notification--${placement}`, children: entries.filter((item) => (item.placement ?? "topRight") === placement).map((item) => /* @__PURE__ */ jsxs5("div", { className: `sia-notification__notice sia-notification__notice--${item.type ?? "info"}`, role: item.role ?? "alert", onClick: item.onClick, children: [
|
|
562
|
+
/* @__PURE__ */ jsx5("span", { className: "sia-notification__icon", children: item.icon ?? /* @__PURE__ */ jsx5(Icon, { name: item.type === "success" ? "circle-check" : item.type === "warning" ? "warning" : item.type === "error" ? "circle-close" : "info", variant: "filled" }) }),
|
|
563
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
564
|
+
/* @__PURE__ */ jsx5("strong", { children: item.message }),
|
|
565
|
+
item.description ? /* @__PURE__ */ jsx5("p", { children: item.description }) : null,
|
|
496
566
|
item.btn
|
|
497
567
|
] }),
|
|
498
|
-
/* @__PURE__ */
|
|
568
|
+
/* @__PURE__ */ jsx5("button", { type: "button", "aria-label": "\u5173\u95ED\u901A\u77E5", onClick: (event) => {
|
|
499
569
|
event.stopPropagation();
|
|
500
570
|
closeNotification(item.key);
|
|
501
|
-
}, children: item.closeIcon ?? /* @__PURE__ */
|
|
571
|
+
}, children: item.closeIcon ?? /* @__PURE__ */ jsx5(Icon, { name: "close", size: 14 }) })
|
|
502
572
|
] }, item.key)) }, placement)) });
|
|
503
573
|
}
|
|
504
574
|
function ensureNotificationHost() {
|
|
@@ -506,7 +576,7 @@ function ensureNotificationHost() {
|
|
|
506
576
|
notificationHost = document.createElement("div");
|
|
507
577
|
notificationHost.dataset.siaNotificationHost = "";
|
|
508
578
|
document.body.appendChild(notificationHost);
|
|
509
|
-
createRoot(notificationHost).render(/* @__PURE__ */
|
|
579
|
+
createRoot(notificationHost).render(/* @__PURE__ */ jsx5(NotificationHost, {}));
|
|
510
580
|
}
|
|
511
581
|
function openNotification(config) {
|
|
512
582
|
if (typeof window === "undefined" || typeof document === "undefined") return { key: config.key ?? "ssr", close: () => void 0 };
|
|
@@ -541,7 +611,7 @@ var notification = {
|
|
|
541
611
|
};
|
|
542
612
|
function Tour({ open = false, steps, current, defaultCurrent = 0, mask = true, closable = true, disabledInteraction = false, onChange, onClose, onFinish }) {
|
|
543
613
|
const [index, setIndex] = useControllableState({ value: current, defaultValue: defaultCurrent, onChange });
|
|
544
|
-
const [, force] =
|
|
614
|
+
const [, force] = useState4(0);
|
|
545
615
|
useEffect(() => {
|
|
546
616
|
if (!open) return;
|
|
547
617
|
const update = () => force((value) => value + 1);
|
|
@@ -558,23 +628,23 @@ function Tour({ open = false, steps, current, defaultCurrent = 0, mask = true, c
|
|
|
558
628
|
const rect = target?.getBoundingClientRect();
|
|
559
629
|
const placement = step.placement ?? (rect ? "bottom" : "center");
|
|
560
630
|
const panelStyle = placement === "center" || !rect ? { top: "50%", left: "50%", transform: "translate(-50%, -50%)" } : placement.startsWith("bottom") ? { top: rect.bottom + 14, left: rect.left + rect.width / 2, transform: "translateX(-50%)" } : placement.startsWith("top") ? { top: rect.top - 14, left: rect.left + rect.width / 2, transform: "translate(-50%, -100%)" } : placement === "left" ? { top: rect.top + rect.height / 2, left: rect.left - 14, transform: "translate(-100%, -50%)" } : { top: rect.top + rect.height / 2, left: rect.right + 14, transform: "translateY(-50%)" };
|
|
561
|
-
return createPortal(/* @__PURE__ */
|
|
562
|
-
mask && !rect ? /* @__PURE__ */
|
|
563
|
-
rect ? /* @__PURE__ */
|
|
564
|
-
/* @__PURE__ */
|
|
565
|
-
closable ? /* @__PURE__ */
|
|
631
|
+
return createPortal(/* @__PURE__ */ jsxs5("div", { className: "sia-tour", role: "dialog", "aria-modal": "true", children: [
|
|
632
|
+
mask && !rect ? /* @__PURE__ */ jsx5("div", { className: "sia-tour__mask" }) : null,
|
|
633
|
+
rect ? /* @__PURE__ */ jsx5("div", { className: "sia-tour__target", style: { top: rect.top - 5, left: rect.left - 5, width: rect.width + 10, height: rect.height + 10, pointerEvents: disabledInteraction ? "auto" : "none", boxShadow: mask ? "0 0 0 5px var(--sia-color-surface), 0 0 0 9999px rgb(0 0 0 / 46%)" : "0 0 0 5px var(--sia-color-surface)" } }) : null,
|
|
634
|
+
/* @__PURE__ */ jsxs5("div", { className: "sia-tour__panel", style: panelStyle, children: [
|
|
635
|
+
closable ? /* @__PURE__ */ jsx5("button", { className: "sia-tour__close", "aria-label": "\u5173\u95ED\u5F15\u5BFC", onClick: () => onClose?.(index), children: /* @__PURE__ */ jsx5(Icon, { name: "close", size: 14 }) }) : null,
|
|
566
636
|
step.cover,
|
|
567
|
-
/* @__PURE__ */
|
|
568
|
-
step.description ? /* @__PURE__ */
|
|
569
|
-
/* @__PURE__ */
|
|
570
|
-
/* @__PURE__ */
|
|
637
|
+
/* @__PURE__ */ jsx5("strong", { children: step.title }),
|
|
638
|
+
step.description ? /* @__PURE__ */ jsx5("div", { className: "sia-tour__description", children: step.description }) : null,
|
|
639
|
+
/* @__PURE__ */ jsxs5("footer", { children: [
|
|
640
|
+
/* @__PURE__ */ jsxs5("span", { children: [
|
|
571
641
|
index + 1,
|
|
572
642
|
" / ",
|
|
573
643
|
steps.length
|
|
574
644
|
] }),
|
|
575
|
-
/* @__PURE__ */
|
|
576
|
-
index > 0 ? /* @__PURE__ */
|
|
577
|
-
/* @__PURE__ */
|
|
645
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
646
|
+
index > 0 ? /* @__PURE__ */ jsx5(Button, { size: "small", ...step.prevButtonProps, onClick: () => setIndex(index - 1), children: step.prevButtonProps?.children ?? "\u4E0A\u4E00\u6B65" }) : null,
|
|
647
|
+
/* @__PURE__ */ jsx5(Button, { size: "small", variant: "primary", ...step.nextButtonProps, onClick: () => {
|
|
578
648
|
if (index >= steps.length - 1) onFinish?.();
|
|
579
649
|
else setIndex(index + 1);
|
|
580
650
|
}, children: step.nextButtonProps?.children ?? (index >= steps.length - 1 ? "\u5B8C\u6210" : "\u4E0B\u4E00\u6B65") })
|
|
@@ -585,25 +655,25 @@ function Tour({ open = false, steps, current, defaultCurrent = 0, mask = true, c
|
|
|
585
655
|
}
|
|
586
656
|
|
|
587
657
|
// src/components/DataDisplay.tsx
|
|
588
|
-
import { Children, useEffect as useEffect2, useMemo as useMemo3, useRef as
|
|
658
|
+
import { Children, useEffect as useEffect2, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
|
|
589
659
|
import { createPortal as createPortal2 } from "react-dom";
|
|
590
|
-
import { Fragment as Fragment3, jsx as
|
|
660
|
+
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
591
661
|
function Rate({ value, size: sizeProp, defaultValue = 0, count = 5, allowHalf = false, allowClear = true, disabled = false, character, tooltips, onChange, onHoverChange, className = "", ...props }) {
|
|
592
662
|
const size = useControlSize(sizeProp);
|
|
593
663
|
const [current, setCurrent] = useControllableState({ value, defaultValue, onChange });
|
|
594
|
-
const [hover, setHover] =
|
|
664
|
+
const [hover, setHover] = useState5(0);
|
|
595
665
|
const shown = hover || current;
|
|
596
666
|
function choose(next) {
|
|
597
667
|
setCurrent(allowClear && next === current ? 0 : next);
|
|
598
668
|
}
|
|
599
|
-
return /* @__PURE__ */
|
|
669
|
+
return /* @__PURE__ */ jsx6("div", { className: `sia-rate sia-rate--${size}${disabled ? " is-disabled" : ""} ${className}`.trim(), role: "radiogroup", "aria-label": "\u8BC4\u5206", onMouseLeave: () => {
|
|
600
670
|
setHover(0);
|
|
601
671
|
onHoverChange?.(0);
|
|
602
|
-
}, ...props, children: Array.from({ length: count }, (_, index) => {
|
|
672
|
+
}, ...withTitleTooltip(props), children: Array.from({ length: count }, (_, index) => {
|
|
603
673
|
const whole = index + 1;
|
|
604
674
|
const fill = Math.max(0, Math.min(1, shown - index));
|
|
605
|
-
const content = typeof character === "function" ? character(index) : character ?? /* @__PURE__ */
|
|
606
|
-
return /* @__PURE__ */
|
|
675
|
+
const content = typeof character === "function" ? character(index) : character ?? /* @__PURE__ */ jsx6(Icon, { name: "star", variant: "filled" });
|
|
676
|
+
return /* @__PURE__ */ jsx6("span", { className: "sia-rate__item", ...withTitleTooltip({ title: tooltips?.[index] }), children: /* @__PURE__ */ jsxs6("button", { type: "button", disabled, role: "radio", "aria-checked": current === whole, "aria-label": `${whole} \u661F`, onMouseMove: (event) => {
|
|
607
677
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
608
678
|
const next = allowHalf && event.clientX - rect.left < rect.width / 2 ? whole - 0.5 : whole;
|
|
609
679
|
setHover(next);
|
|
@@ -621,30 +691,30 @@ function Rate({ value, size: sizeProp, defaultValue = 0, count = 5, allowHalf =
|
|
|
621
691
|
setCurrent(Math.max(0, current - (allowHalf ? 0.5 : 1)));
|
|
622
692
|
}
|
|
623
693
|
}, children: [
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */
|
|
694
|
+
/* @__PURE__ */ jsx6("span", { className: "sia-rate__base", children: content }),
|
|
695
|
+
/* @__PURE__ */ jsx6("span", { className: "sia-rate__fill", style: { width: `${fill * 100}%` }, children: content })
|
|
626
696
|
] }) }, whole);
|
|
627
697
|
}) });
|
|
628
698
|
}
|
|
629
699
|
function BadgeRibbon({ text, color, placement = "end", className = "", children, ...props }) {
|
|
630
|
-
return /* @__PURE__ */
|
|
700
|
+
return /* @__PURE__ */ jsxs6("div", { className: `sia-ribbon-wrap ${className}`.trim(), ...withTitleTooltip(props), children: [
|
|
631
701
|
children,
|
|
632
|
-
/* @__PURE__ */
|
|
702
|
+
/* @__PURE__ */ jsx6("span", { className: `sia-ribbon sia-ribbon--${placement}`, style: { backgroundColor: color }, children: text })
|
|
633
703
|
] });
|
|
634
704
|
}
|
|
635
705
|
function Badge({ count, showZero = false, overflowCount = 99, dot = false, status, text, color, offset = [0, 0], size = "default", className = "", children, style, ...props }) {
|
|
636
706
|
const numeric = typeof count === "number";
|
|
637
707
|
const hidden = !dot && !status && (count === void 0 || count === null || count === 0 && !showZero);
|
|
638
708
|
const display = numeric && count > overflowCount ? `${overflowCount}+` : count;
|
|
639
|
-
const badge = !hidden ? /* @__PURE__ */
|
|
640
|
-
if (status && !children) return /* @__PURE__ */
|
|
709
|
+
const badge = !hidden ? /* @__PURE__ */ jsx6("sup", { className: `sia-badge__count${dot || status ? " sia-badge__dot" : ""}${status ? ` sia-badge__dot--${status}` : ""} sia-badge__count--${size}`, style: { backgroundColor: color, transform: `translate(calc(50% + ${offset[0]}px), calc(-50% + ${offset[1]}px))` }, children: dot || status ? null : display }) : null;
|
|
710
|
+
if (status && !children) return /* @__PURE__ */ jsxs6("span", { className: `sia-badge sia-badge--status ${className}`.trim(), style, ...withTitleTooltip(props), children: [
|
|
641
711
|
badge,
|
|
642
|
-
text ? /* @__PURE__ */
|
|
712
|
+
text ? /* @__PURE__ */ jsx6("span", { className: "sia-badge__text", children: text }) : null
|
|
643
713
|
] });
|
|
644
|
-
return /* @__PURE__ */
|
|
714
|
+
return /* @__PURE__ */ jsxs6("span", { className: `sia-badge ${className}`.trim(), style, ...withTitleTooltip(props), children: [
|
|
645
715
|
children,
|
|
646
716
|
badge,
|
|
647
|
-
text && !status ? /* @__PURE__ */
|
|
717
|
+
text && !status ? /* @__PURE__ */ jsx6("span", { className: "sia-badge__text", children: text }) : null
|
|
648
718
|
] });
|
|
649
719
|
}
|
|
650
720
|
Badge.Ribbon = BadgeRibbon;
|
|
@@ -662,8 +732,8 @@ var WEEK = ["\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D", "\u65E5"
|
|
|
662
732
|
var MONTHS = ["\u4E00\u6708", "\u4E8C\u6708", "\u4E09\u6708", "\u56DB\u6708", "\u4E94\u6708", "\u516D\u6708", "\u4E03\u6708", "\u516B\u6708", "\u4E5D\u6708", "\u5341\u6708", "\u5341\u4E00\u6708", "\u5341\u4E8C\u6708"];
|
|
663
733
|
function Calendar({ value, defaultValue, mode = "month", fullscreen = true, validRange, disabledDate, dateCellRender, fullCellRender, headerRender, onChange, onSelect, onPanelChange, className = "", ...props }) {
|
|
664
734
|
const [selected, setSelected] = useControllableState({ value, defaultValue: defaultValue ?? formatDate(/* @__PURE__ */ new Date()), onChange });
|
|
665
|
-
const [panelMode, setPanelMode] =
|
|
666
|
-
const [panel, setPanel] =
|
|
735
|
+
const [panelMode, setPanelMode] = useState5(mode);
|
|
736
|
+
const [panel, setPanel] = useState5(() => {
|
|
667
737
|
const date = parseDate(value ?? defaultValue);
|
|
668
738
|
return new Date(date.getFullYear(), date.getMonth(), 1);
|
|
669
739
|
});
|
|
@@ -687,34 +757,34 @@ function Calendar({ value, defaultValue, mode = "month", fullscreen = true, vali
|
|
|
687
757
|
onPanelChange?.(formatDate(panel), next);
|
|
688
758
|
}
|
|
689
759
|
const headerConfig = { value: formatDate(panel), mode: panelMode, onChange: (next) => setPanelValue(parseDate(next)), onTypeChange: setMode };
|
|
690
|
-
return /* @__PURE__ */
|
|
691
|
-
/* @__PURE__ */
|
|
692
|
-
/* @__PURE__ */
|
|
693
|
-
/* @__PURE__ */
|
|
760
|
+
return /* @__PURE__ */ jsxs6("div", { className: `sia-calendar${fullscreen ? " sia-calendar--fullscreen" : " sia-calendar--mini"} ${className}`.trim(), ...withTitleTooltip(props), children: [
|
|
761
|
+
/* @__PURE__ */ jsx6("div", { className: "sia-calendar__header", children: headerRender ? headerRender(headerConfig) : /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
762
|
+
/* @__PURE__ */ jsx6("button", { type: "button", "aria-label": "\u4E0A\u4E00\u9875", onClick: () => setPanelValue(new Date(panel.getFullYear() - (panelMode === "year" ? 1 : 0), panel.getMonth() - (panelMode === "month" ? 1 : 0), 1)), children: /* @__PURE__ */ jsx6(Icon, { name: "chevron-left" }) }),
|
|
763
|
+
/* @__PURE__ */ jsxs6("strong", { children: [
|
|
694
764
|
panel.getFullYear(),
|
|
695
765
|
" \u5E74",
|
|
696
766
|
panelMode === "month" ? ` ${panel.getMonth() + 1} \u6708` : ""
|
|
697
767
|
] }),
|
|
698
|
-
/* @__PURE__ */
|
|
699
|
-
/* @__PURE__ */
|
|
700
|
-
/* @__PURE__ */
|
|
768
|
+
/* @__PURE__ */ jsxs6("div", { className: "sia-calendar__modes", children: [
|
|
769
|
+
/* @__PURE__ */ jsx6("button", { className: panelMode === "month" ? "is-active" : "", onClick: () => setMode("month"), children: "\u6708" }),
|
|
770
|
+
/* @__PURE__ */ jsx6("button", { className: panelMode === "year" ? "is-active" : "", onClick: () => setMode("year"), children: "\u5E74" })
|
|
701
771
|
] }),
|
|
702
|
-
/* @__PURE__ */
|
|
772
|
+
/* @__PURE__ */ jsx6("button", { type: "button", "aria-label": "\u4E0B\u4E00\u9875", onClick: () => setPanelValue(new Date(panel.getFullYear() + (panelMode === "year" ? 1 : 0), panel.getMonth() + (panelMode === "month" ? 1 : 0), 1)), children: /* @__PURE__ */ jsx6(Icon, { name: "chevron-right" }) })
|
|
703
773
|
] }) }),
|
|
704
|
-
panelMode === "year" ? /* @__PURE__ */
|
|
774
|
+
panelMode === "year" ? /* @__PURE__ */ jsx6("div", { className: "sia-calendar__months", children: MONTHS.map((month, index) => /* @__PURE__ */ jsx6("button", { className: panel.getMonth() === index ? "is-selected" : "", onClick: () => {
|
|
705
775
|
setPanelValue(new Date(panel.getFullYear(), index, 1));
|
|
706
776
|
setMode("month");
|
|
707
|
-
}, children: month }, month)) }) : /* @__PURE__ */
|
|
708
|
-
/* @__PURE__ */
|
|
709
|
-
/* @__PURE__ */
|
|
777
|
+
}, children: month }, month)) }) : /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
778
|
+
/* @__PURE__ */ jsx6("div", { className: "sia-calendar__week", children: WEEK.map((day) => /* @__PURE__ */ jsx6("span", { children: day }, day)) }),
|
|
779
|
+
/* @__PURE__ */ jsx6("div", { className: "sia-calendar__grid", children: grid.map((date) => {
|
|
710
780
|
const key = formatDate(date);
|
|
711
781
|
const outside = date.getMonth() !== panel.getMonth();
|
|
712
782
|
const disabled = Boolean(disabledDate?.(key) || validRange && (key < validRange[0] || key > validRange[1]));
|
|
713
|
-
const origin = /* @__PURE__ */
|
|
714
|
-
/* @__PURE__ */
|
|
783
|
+
const origin = /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
784
|
+
/* @__PURE__ */ jsx6("span", { children: date.getDate() }),
|
|
715
785
|
dateCellRender?.(key)
|
|
716
786
|
] });
|
|
717
|
-
return /* @__PURE__ */
|
|
787
|
+
return /* @__PURE__ */ jsx6("button", { disabled, className: `${outside ? "is-outside" : ""}${selected === key ? " is-selected" : ""}${formatDate(/* @__PURE__ */ new Date()) === key ? " is-today" : ""}`, onClick: () => {
|
|
718
788
|
setSelected(key);
|
|
719
789
|
onSelect?.(key);
|
|
720
790
|
if (outside) setPanelValue(new Date(date.getFullYear(), date.getMonth(), 1));
|
|
@@ -725,8 +795,8 @@ function Calendar({ value, defaultValue, mode = "month", fullscreen = true, vali
|
|
|
725
795
|
}
|
|
726
796
|
function Carousel({ autoplay = false, autoplaySpeed = 3e3, arrows = false, dots = true, effect = "scroll", infinite = true, initialSlide = 0, pauseOnHover = true, beforeChange, afterChange, className = "", children, ...props }) {
|
|
727
797
|
const slides = Children.toArray(children);
|
|
728
|
-
const [current, setCurrent] =
|
|
729
|
-
const [paused, setPaused] =
|
|
798
|
+
const [current, setCurrent] = useState5(Math.min(initialSlide, Math.max(0, slides.length - 1)));
|
|
799
|
+
const [paused, setPaused] = useState5(false);
|
|
730
800
|
function go(next) {
|
|
731
801
|
if (!slides.length) return;
|
|
732
802
|
const resolved = infinite ? (next + slides.length) % slides.length : Math.max(0, Math.min(slides.length - 1, next));
|
|
@@ -740,13 +810,13 @@ function Carousel({ autoplay = false, autoplaySpeed = 3e3, arrows = false, dots
|
|
|
740
810
|
const timer = window.setInterval(() => go(current + 1), autoplaySpeed);
|
|
741
811
|
return () => window.clearInterval(timer);
|
|
742
812
|
}, [autoplay, autoplaySpeed, current, paused, slides.length]);
|
|
743
|
-
return /* @__PURE__ */
|
|
744
|
-
/* @__PURE__ */
|
|
745
|
-
arrows ? /* @__PURE__ */
|
|
746
|
-
/* @__PURE__ */
|
|
747
|
-
/* @__PURE__ */
|
|
813
|
+
return /* @__PURE__ */ jsxs6("div", { className: `sia-carousel sia-carousel--${effect} ${className}`.trim(), onMouseEnter: pauseOnHover ? () => setPaused(true) : void 0, onMouseLeave: pauseOnHover ? () => setPaused(false) : void 0, ...withTitleTooltip(props), children: [
|
|
814
|
+
/* @__PURE__ */ jsx6("div", { className: "sia-carousel__viewport", children: /* @__PURE__ */ jsx6("div", { className: "sia-carousel__track", style: effect === "scroll" ? { transform: `translateX(-${current * 100}%)` } : void 0, children: slides.map((slide, index) => /* @__PURE__ */ jsx6("div", { className: `sia-carousel__slide${index === current ? " is-active" : ""}`, "aria-hidden": index !== current, children: slide }, index)) }) }),
|
|
815
|
+
arrows ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
816
|
+
/* @__PURE__ */ jsx6("button", { className: "sia-carousel__arrow sia-carousel__arrow--prev", disabled: !infinite && current === 0, "aria-label": "\u4E0A\u4E00\u5F20", onClick: () => go(current - 1), children: /* @__PURE__ */ jsx6(Icon, { name: "chevron-left" }) }),
|
|
817
|
+
/* @__PURE__ */ jsx6("button", { className: "sia-carousel__arrow sia-carousel__arrow--next", disabled: !infinite && current === slides.length - 1, "aria-label": "\u4E0B\u4E00\u5F20", onClick: () => go(current + 1), children: /* @__PURE__ */ jsx6(Icon, { name: "chevron-right" }) })
|
|
748
818
|
] }) : null,
|
|
749
|
-
dots ? /* @__PURE__ */
|
|
819
|
+
dots ? /* @__PURE__ */ jsx6("div", { className: `sia-carousel__dots${typeof dots === "object" && dots.className ? ` ${dots.className}` : ""}`, children: slides.map((_, index) => /* @__PURE__ */ jsx6("button", { "aria-label": `\u5207\u6362\u5230\u7B2C ${index + 1} \u5F20`, "aria-current": index === current, onClick: () => go(index), children: /* @__PURE__ */ jsx6("span", {}) }, index)) }) : null
|
|
750
820
|
] });
|
|
751
821
|
}
|
|
752
822
|
function CollapsePanel({
|
|
@@ -755,7 +825,7 @@ function CollapsePanel({
|
|
|
755
825
|
destroyInactivePanel = false,
|
|
756
826
|
children
|
|
757
827
|
}) {
|
|
758
|
-
const [keepChildren, setKeepChildren] =
|
|
828
|
+
const [keepChildren, setKeepChildren] = useState5(open || forceRender || !destroyInactivePanel);
|
|
759
829
|
useEffect2(() => {
|
|
760
830
|
if (open || forceRender || !destroyInactivePanel) {
|
|
761
831
|
setKeepChildren(true);
|
|
@@ -765,12 +835,12 @@ function CollapsePanel({
|
|
|
765
835
|
return () => window.clearTimeout(timer);
|
|
766
836
|
}, [destroyInactivePanel, forceRender, open]);
|
|
767
837
|
const renderChildren = open || forceRender || !destroyInactivePanel || keepChildren;
|
|
768
|
-
return /* @__PURE__ */
|
|
838
|
+
return /* @__PURE__ */ jsx6("div", { className: "sia-collapse__panel", "aria-hidden": !open, children: /* @__PURE__ */ jsx6("div", { className: "sia-collapse__panel-motion", children: /* @__PURE__ */ jsx6("div", { className: "sia-collapse__panel-body", children: renderChildren ? children : null }) }) });
|
|
769
839
|
}
|
|
770
840
|
function Collapse({ items, activeKey, defaultActiveKey = [], accordion = false, bordered = true, ghost = false, destroyInactivePanel = false, expandIconPosition = "start", onChange, className = "", ...props }) {
|
|
771
841
|
const normalize = (key) => Array.isArray(key) ? [...key] : key === void 0 ? [] : [key];
|
|
772
842
|
const controlled = activeKey !== void 0;
|
|
773
|
-
const [internal, setInternal] =
|
|
843
|
+
const [internal, setInternal] = useState5(normalize(defaultActiveKey));
|
|
774
844
|
const openKeys = controlled ? normalize(activeKey) : internal;
|
|
775
845
|
function toggle(item) {
|
|
776
846
|
if (item.disabled || item.collapsible === "disabled") return;
|
|
@@ -780,41 +850,41 @@ function Collapse({ items, activeKey, defaultActiveKey = [], accordion = false,
|
|
|
780
850
|
onChange?.(accordion ? next[0] ?? "" : next);
|
|
781
851
|
}
|
|
782
852
|
const borderClassName = !bordered || ghost ? "sia-collapse--borderless" : "sia-collapse--bordered";
|
|
783
|
-
return /* @__PURE__ */
|
|
853
|
+
return /* @__PURE__ */ jsx6("div", { className: `sia-collapse ${borderClassName}${ghost ? " sia-collapse--ghost" : ""} sia-collapse--icon-${expandIconPosition} ${className}`.trim(), ...withTitleTooltip(props), children: items.map((item) => {
|
|
784
854
|
const open = openKeys.includes(item.key);
|
|
785
|
-
const arrow = item.showArrow === false ? null : /* @__PURE__ */
|
|
786
|
-
return /* @__PURE__ */
|
|
787
|
-
/* @__PURE__ */
|
|
855
|
+
const arrow = item.showArrow === false ? null : /* @__PURE__ */ jsx6("button", { type: "button", className: "sia-collapse__arrow", "aria-label": open ? "\u6536\u8D77" : "\u5C55\u5F00", onClick: item.collapsible === "icon" ? () => toggle(item) : void 0, children: /* @__PURE__ */ jsx6(Icon, { name: "chevron-right", size: 14 }) });
|
|
856
|
+
return /* @__PURE__ */ jsxs6("section", { className: `sia-collapse__item${open ? " is-open" : ""}${item.disabled ? " is-disabled" : ""} ${item.className ?? ""}`.trim(), children: [
|
|
857
|
+
/* @__PURE__ */ jsxs6("header", { className: "sia-collapse__header", role: "button", tabIndex: item.disabled ? -1 : 0, "aria-expanded": open, onClick: item.collapsible === "icon" ? void 0 : () => toggle(item), onKeyDown: (event) => {
|
|
788
858
|
if (event.key === "Enter" || event.key === " ") {
|
|
789
859
|
event.preventDefault();
|
|
790
860
|
toggle(item);
|
|
791
861
|
}
|
|
792
862
|
}, children: [
|
|
793
863
|
expandIconPosition === "start" ? arrow : null,
|
|
794
|
-
/* @__PURE__ */
|
|
795
|
-
item.extra ? /* @__PURE__ */
|
|
864
|
+
/* @__PURE__ */ jsx6("span", { className: "sia-collapse__label", children: item.label }),
|
|
865
|
+
item.extra ? /* @__PURE__ */ jsx6("span", { className: "sia-collapse__extra", onClick: (event) => event.stopPropagation(), children: item.extra }) : null,
|
|
796
866
|
expandIconPosition === "end" ? arrow : null
|
|
797
867
|
] }),
|
|
798
|
-
/* @__PURE__ */
|
|
868
|
+
/* @__PURE__ */ jsx6(CollapsePanel, { open, forceRender: item.forceRender, destroyInactivePanel, children: item.children })
|
|
799
869
|
] }, item.key);
|
|
800
870
|
}) });
|
|
801
871
|
}
|
|
802
872
|
function ImagePreview({ open, src, alt = "", onOpenChange }) {
|
|
803
|
-
const previewRef =
|
|
873
|
+
const previewRef = useRef4(null);
|
|
804
874
|
useOverlayLifecycle(open, previewRef, () => onOpenChange(false));
|
|
805
875
|
if (!open || !src || typeof document === "undefined") return null;
|
|
806
|
-
return createPortal2(/* @__PURE__ */
|
|
807
|
-
/* @__PURE__ */
|
|
808
|
-
/* @__PURE__ */
|
|
876
|
+
return createPortal2(/* @__PURE__ */ jsxs6("div", { ref: previewRef, className: "sia-image-preview", role: "dialog", "aria-modal": "true", "aria-label": "\u56FE\u7247\u9884\u89C8", tabIndex: -1, onClick: () => onOpenChange(false), children: [
|
|
877
|
+
/* @__PURE__ */ jsx6("button", { type: "button", "aria-label": "\u5173\u95ED\u9884\u89C8", onClick: () => onOpenChange(false), children: /* @__PURE__ */ jsx6(Icon, { name: "close" }) }),
|
|
878
|
+
/* @__PURE__ */ jsx6("img", { src, alt, onClick: (event) => event.stopPropagation() })
|
|
809
879
|
] }), document.body);
|
|
810
880
|
}
|
|
811
881
|
function Image({ fallback, placeholder, preview = true, rootClassName = "", className = "", src, alt = "", onError, style, ...props }) {
|
|
812
882
|
const config = typeof preview === "object" ? preview : {};
|
|
813
883
|
const controlled = typeof preview === "object" && preview.open !== void 0;
|
|
814
|
-
const [internalOpen, setInternalOpen] =
|
|
884
|
+
const [internalOpen, setInternalOpen] = useState5(false);
|
|
815
885
|
const open = controlled ? config.open : internalOpen;
|
|
816
|
-
const [loaded, setLoaded] =
|
|
817
|
-
const [failed, setFailed] =
|
|
886
|
+
const [loaded, setLoaded] = useState5(false);
|
|
887
|
+
const [failed, setFailed] = useState5(false);
|
|
818
888
|
const displaySrc = failed && fallback ? fallback : src;
|
|
819
889
|
const radius = typeof style?.borderRadius === "number" ? `${style.borderRadius}px` : style?.borderRadius;
|
|
820
890
|
const rootStyle = {
|
|
@@ -825,23 +895,23 @@ function Image({ fallback, placeholder, preview = true, rootClassName = "", clas
|
|
|
825
895
|
if (!controlled) setInternalOpen(next);
|
|
826
896
|
config.onOpenChange?.(next);
|
|
827
897
|
}
|
|
828
|
-
return /* @__PURE__ */
|
|
829
|
-
!loaded && placeholder ? /* @__PURE__ */
|
|
830
|
-
/* @__PURE__ */
|
|
898
|
+
return /* @__PURE__ */ jsxs6("span", { className: `sia-image ${rootClassName}`.trim(), style: rootStyle, children: [
|
|
899
|
+
!loaded && placeholder ? /* @__PURE__ */ jsx6("span", { className: "sia-image__placeholder", children: placeholder }) : null,
|
|
900
|
+
/* @__PURE__ */ jsx6("img", { ...withTitleTooltip(props), src: displaySrc, alt, className, onLoad: () => setLoaded(true), onError: (event) => {
|
|
831
901
|
if (!failed && fallback) setFailed(true);
|
|
832
902
|
onError?.(event);
|
|
833
903
|
} }),
|
|
834
|
-
preview ? /* @__PURE__ */
|
|
835
|
-
/* @__PURE__ */
|
|
904
|
+
preview ? /* @__PURE__ */ jsx6("button", { type: "button", className: "sia-image__mask", "aria-label": "\u9884\u89C8\u56FE\u7247", onClick: () => setOpen(true), children: config.mask ?? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
905
|
+
/* @__PURE__ */ jsx6(Icon, { name: "eye" }),
|
|
836
906
|
"\u9884\u89C8"
|
|
837
907
|
] }) }) : null,
|
|
838
|
-
/* @__PURE__ */
|
|
908
|
+
/* @__PURE__ */ jsx6(ImagePreview, { open, src: config.src ?? displaySrc, alt, onOpenChange: setOpen })
|
|
839
909
|
] });
|
|
840
910
|
}
|
|
841
911
|
|
|
842
912
|
// src/components/Upload.tsx
|
|
843
|
-
import { useId as useId2, useRef as
|
|
844
|
-
import { jsx as
|
|
913
|
+
import { useId as useId2, useRef as useRef5 } from "react";
|
|
914
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
845
915
|
var LIST_IGNORE = /* @__PURE__ */ Symbol("SIA_UPLOAD_LIST_IGNORE");
|
|
846
916
|
function UploadRoot({
|
|
847
917
|
accept,
|
|
@@ -863,8 +933,8 @@ function UploadRoot({
|
|
|
863
933
|
onDrop,
|
|
864
934
|
...props
|
|
865
935
|
}) {
|
|
866
|
-
const inputRef =
|
|
867
|
-
const filesRef =
|
|
936
|
+
const inputRef = useRef5(null);
|
|
937
|
+
const filesRef = useRef5(fileList ?? defaultFileList);
|
|
868
938
|
const id = useId2();
|
|
869
939
|
const [files, setFiles] = useControllableState({ value: fileList, defaultValue: defaultFileList });
|
|
870
940
|
filesRef.current = files;
|
|
@@ -924,7 +994,7 @@ function UploadRoot({
|
|
|
924
994
|
const next = files.filter((item) => item.uid !== file.uid);
|
|
925
995
|
emit({ ...file, status: "ready" }, next);
|
|
926
996
|
}
|
|
927
|
-
return /* @__PURE__ */
|
|
997
|
+
return /* @__PURE__ */ jsxs7(
|
|
928
998
|
"div",
|
|
929
999
|
{
|
|
930
1000
|
className: `sia-upload sia-upload--${listType} ${className}`.trim(),
|
|
@@ -933,9 +1003,9 @@ function UploadRoot({
|
|
|
933
1003
|
if (!event.defaultPrevented && !disabled) event.preventDefault();
|
|
934
1004
|
},
|
|
935
1005
|
onDrop: handleDrop,
|
|
936
|
-
...props,
|
|
1006
|
+
...withTitleTooltip(props),
|
|
937
1007
|
children: [
|
|
938
|
-
/* @__PURE__ */
|
|
1008
|
+
/* @__PURE__ */ jsx7(
|
|
939
1009
|
"input",
|
|
940
1010
|
{
|
|
941
1011
|
ref: inputRef,
|
|
@@ -945,26 +1015,26 @@ function UploadRoot({
|
|
|
945
1015
|
accept,
|
|
946
1016
|
multiple,
|
|
947
1017
|
disabled,
|
|
948
|
-
...directory ? { webkitdirectory: "", directory: "" } : {},
|
|
1018
|
+
...withTitleTooltip(directory ? { webkitdirectory: "", directory: "" } : {}),
|
|
949
1019
|
onChange: handleFiles
|
|
950
1020
|
}
|
|
951
1021
|
),
|
|
952
|
-
/* @__PURE__ */
|
|
953
|
-
showUploadList && files.length ? /* @__PURE__ */
|
|
954
|
-
/* @__PURE__ */
|
|
955
|
-
/* @__PURE__ */
|
|
956
|
-
file.status === "uploading" ? /* @__PURE__ */
|
|
957
|
-
/* @__PURE__ */
|
|
1022
|
+
/* @__PURE__ */ jsx7("div", { className: "sia-upload__trigger", onClick: () => !disabled && inputRef.current?.click(), children: children ?? /* @__PURE__ */ jsx7(Button, { icon: /* @__PURE__ */ jsx7(Icon, { name: "upload", size: 16 }), disabled, children: "\u9009\u62E9\u6587\u4EF6" }) }),
|
|
1023
|
+
showUploadList && files.length ? /* @__PURE__ */ jsx7("div", { className: "sia-upload__list", children: files.map((file) => /* @__PURE__ */ jsxs7("div", { className: `sia-upload__item sia-upload__item--${file.status ?? "ready"}`, children: [
|
|
1024
|
+
/* @__PURE__ */ jsx7(Icon, { name: file.status === "done" ? "circle-check" : "file", size: 16 }),
|
|
1025
|
+
/* @__PURE__ */ jsx7("span", { className: "sia-upload__name", ...withTitleTooltip({ title: file.name }), children: file.name }),
|
|
1026
|
+
file.status === "uploading" ? /* @__PURE__ */ jsx7("span", { className: "sia-upload__progress", children: /* @__PURE__ */ jsx7("span", { style: { width: `${file.percent ?? 0}%` } }) }) : null,
|
|
1027
|
+
/* @__PURE__ */ jsx7("button", { type: "button", "aria-label": `\u79FB\u9664 ${file.name}`, onClick: () => void remove(file), children: /* @__PURE__ */ jsx7(Icon, { name: "close", size: 14 }) })
|
|
958
1028
|
] }, file.uid)) }) : null
|
|
959
1029
|
]
|
|
960
1030
|
}
|
|
961
1031
|
);
|
|
962
1032
|
}
|
|
963
1033
|
function UploadDragger({ hint = "\u652F\u6301\u5355\u4E2A\u6216\u6279\u91CF\u4E0A\u4F20", children, className = "", ...props }) {
|
|
964
|
-
return /* @__PURE__ */
|
|
965
|
-
/* @__PURE__ */
|
|
966
|
-
/* @__PURE__ */
|
|
967
|
-
/* @__PURE__ */
|
|
1034
|
+
return /* @__PURE__ */ jsx7(UploadRoot, { ...props, className: `sia-upload-dragger ${className}`.trim(), children: children ?? /* @__PURE__ */ jsxs7("div", { className: "sia-upload-dragger__content", children: [
|
|
1035
|
+
/* @__PURE__ */ jsx7(Icon, { name: "upload", size: 28 }),
|
|
1036
|
+
/* @__PURE__ */ jsx7("strong", { children: "\u70B9\u51FB\u6216\u62D6\u62FD\u6587\u4EF6\u5230\u6B64\u533A\u57DF\u4E0A\u4F20" }),
|
|
1037
|
+
/* @__PURE__ */ jsx7("span", { children: hint })
|
|
968
1038
|
] }) });
|
|
969
1039
|
}
|
|
970
1040
|
var Upload = Object.assign(UploadRoot, {
|
|
@@ -976,7 +1046,7 @@ var Upload = Object.assign(UploadRoot, {
|
|
|
976
1046
|
|
|
977
1047
|
// src/components/Message.tsx
|
|
978
1048
|
import { createRoot as createRoot2 } from "react-dom/client";
|
|
979
|
-
import { jsx as
|
|
1049
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
980
1050
|
var messageSeed = 0;
|
|
981
1051
|
var messageRoot = null;
|
|
982
1052
|
var messageContainer = null;
|
|
@@ -985,11 +1055,11 @@ var defaultDuration = 3;
|
|
|
985
1055
|
var maxCount = 5;
|
|
986
1056
|
var messageTimers = /* @__PURE__ */ new Map();
|
|
987
1057
|
var messageIcons = {
|
|
988
|
-
info: /* @__PURE__ */
|
|
989
|
-
success: /* @__PURE__ */
|
|
990
|
-
warning: /* @__PURE__ */
|
|
991
|
-
error: /* @__PURE__ */
|
|
992
|
-
loading: /* @__PURE__ */
|
|
1058
|
+
info: /* @__PURE__ */ jsx8(Icon, { name: "info", size: 18 }),
|
|
1059
|
+
success: /* @__PURE__ */ jsx8(Icon, { name: "circle-check", size: 18 }),
|
|
1060
|
+
warning: /* @__PURE__ */ jsx8(Icon, { name: "warning", size: 18 }),
|
|
1061
|
+
error: /* @__PURE__ */ jsx8(Icon, { name: "circle-close", size: 18 }),
|
|
1062
|
+
loading: /* @__PURE__ */ jsx8(Icon, { name: "loader", size: 18, spin: true })
|
|
993
1063
|
};
|
|
994
1064
|
function ensureMessageRoot() {
|
|
995
1065
|
if (typeof document === "undefined") return false;
|
|
@@ -1003,10 +1073,10 @@ function ensureMessageRoot() {
|
|
|
1003
1073
|
}
|
|
1004
1074
|
function renderMessages() {
|
|
1005
1075
|
if (!ensureMessageRoot()) return;
|
|
1006
|
-
messageRoot.render(/* @__PURE__ */
|
|
1007
|
-
/* @__PURE__ */
|
|
1008
|
-
/* @__PURE__ */
|
|
1009
|
-
item.closable ? /* @__PURE__ */
|
|
1076
|
+
messageRoot.render(/* @__PURE__ */ jsx8("div", { className: "sia-message-list", "aria-live": "polite", children: messageItems.map((item) => /* @__PURE__ */ jsxs8("div", { className: `sia-message sia-message--${item.type}`, role: item.type === "loading" ? "status" : "alert", children: [
|
|
1077
|
+
/* @__PURE__ */ jsx8("span", { className: "sia-message__icon", "aria-hidden": "true", children: messageIcons[item.type] }),
|
|
1078
|
+
/* @__PURE__ */ jsx8("span", { className: "sia-message__content", children: item.content }),
|
|
1079
|
+
item.closable ? /* @__PURE__ */ jsx8("button", { type: "button", className: "sia-message__close", "aria-label": "\u5173\u95ED\u63D0\u793A", onClick: () => closeMessage(item.key), children: /* @__PURE__ */ jsx8(Icon, { name: "close", size: 14 }) }) : null
|
|
1010
1080
|
] }, item.key)) }));
|
|
1011
1081
|
}
|
|
1012
1082
|
function closeMessage(key) {
|
|
@@ -1080,29 +1150,29 @@ var message = {
|
|
|
1080
1150
|
};
|
|
1081
1151
|
|
|
1082
1152
|
// src/components/Breadcrumb.tsx
|
|
1083
|
-
import { Fragment as Fragment4, jsx as
|
|
1153
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1084
1154
|
function Breadcrumb({ items, separator = "/", itemRender, className = "", ...props }) {
|
|
1085
|
-
return /* @__PURE__ */
|
|
1155
|
+
return /* @__PURE__ */ jsx9("nav", { "aria-label": "\u9762\u5305\u5C51\u5BFC\u822A", ...withTitleTooltip(props), className: `sia-breadcrumb ${className}`.trim(), children: /* @__PURE__ */ jsx9("ol", { className: "sia-breadcrumb__list", children: items.map((item, index) => {
|
|
1086
1156
|
const current = index === items.length - 1;
|
|
1087
|
-
const content = /* @__PURE__ */
|
|
1088
|
-
item.icon ? /* @__PURE__ */
|
|
1089
|
-
/* @__PURE__ */
|
|
1157
|
+
const content = /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
1158
|
+
item.icon ? /* @__PURE__ */ jsx9("span", { className: "sia-breadcrumb__icon", "aria-hidden": "true", children: item.icon }) : null,
|
|
1159
|
+
/* @__PURE__ */ jsx9("span", { className: "sia-breadcrumb__title", children: item.title })
|
|
1090
1160
|
] });
|
|
1091
1161
|
const custom = itemRender?.(item, index, items);
|
|
1092
|
-
const label = item.disabled ? /* @__PURE__ */
|
|
1093
|
-
return /* @__PURE__ */
|
|
1094
|
-
/* @__PURE__ */
|
|
1162
|
+
const label = item.disabled ? /* @__PURE__ */ jsx9("span", { className: "sia-breadcrumb__label", "aria-disabled": "true", children: content }) : custom !== void 0 ? /* @__PURE__ */ jsx9("span", { className: "sia-breadcrumb__label", children: custom }) : item.href ? /* @__PURE__ */ jsx9("a", { className: "sia-breadcrumb__label", href: item.href, target: item.target, rel: item.target === "_blank" ? "noopener noreferrer" : void 0, onClick: item.onClick, children: content }) : item.onClick ? /* @__PURE__ */ jsx9(Button, { className: "sia-breadcrumb__label", variant: "text", onClick: item.onClick, children: content }) : /* @__PURE__ */ jsx9("span", { className: "sia-breadcrumb__label", children: content });
|
|
1163
|
+
return /* @__PURE__ */ jsxs9("li", { className: `sia-breadcrumb__item${current ? " is-current" : ""}${item.disabled ? " is-disabled" : ""}`, children: [
|
|
1164
|
+
/* @__PURE__ */ jsxs9("span", { className: "sia-breadcrumb__entry", "aria-current": current ? "page" : void 0, children: [
|
|
1095
1165
|
label,
|
|
1096
|
-
item.menu?.items.length ? /* @__PURE__ */
|
|
1166
|
+
item.menu?.items.length ? /* @__PURE__ */ jsx9(Dropdown, { menu: item.menu, trigger: ["click"], disabled: item.disabled, children: /* @__PURE__ */ jsx9(Button, { className: "sia-breadcrumb__menu-trigger", variant: "text", size: "small", disabled: item.disabled, "aria-label": `\u5C55\u5F00${typeof item.title === "string" ? item.title : "\u5C42\u7EA7"}\u83DC\u5355`, icon: /* @__PURE__ */ jsx9(Icon, { name: "chevron-down", size: 12 }) }) }) : null
|
|
1097
1167
|
] }),
|
|
1098
|
-
!current ? /* @__PURE__ */
|
|
1168
|
+
!current ? /* @__PURE__ */ jsx9("span", { className: "sia-breadcrumb__separator", "aria-hidden": "true", children: item.separator === void 0 ? separator : item.separator }) : null
|
|
1099
1169
|
] }, item.key ?? index);
|
|
1100
1170
|
}) }) });
|
|
1101
1171
|
}
|
|
1102
1172
|
|
|
1103
1173
|
// src/components/Typography.tsx
|
|
1104
|
-
import { useEffect as useEffect3, useLayoutEffect as
|
|
1105
|
-
import { Fragment as Fragment5, jsx as
|
|
1174
|
+
import { useEffect as useEffect3, useLayoutEffect as useLayoutEffect3, useRef as useRef6, useState as useState6 } from "react";
|
|
1175
|
+
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1106
1176
|
function TypographyContent({
|
|
1107
1177
|
as: Tag2 = "span",
|
|
1108
1178
|
type,
|
|
@@ -1121,16 +1191,16 @@ function TypographyContent({
|
|
|
1121
1191
|
className = "",
|
|
1122
1192
|
...props
|
|
1123
1193
|
}) {
|
|
1124
|
-
const contentRef =
|
|
1125
|
-
const editRef =
|
|
1126
|
-
const timer =
|
|
1127
|
-
const [localText, setLocalText] =
|
|
1128
|
-
const [draft, setDraft] =
|
|
1129
|
-
const [editing, setEditing] =
|
|
1130
|
-
const [copied, setCopied] =
|
|
1131
|
-
const [copyError, setCopyError] =
|
|
1132
|
-
const [expanded, setExpanded] =
|
|
1133
|
-
const [overflow, setOverflow] =
|
|
1194
|
+
const contentRef = useRef6(null);
|
|
1195
|
+
const editRef = useRef6(null);
|
|
1196
|
+
const timer = useRef6();
|
|
1197
|
+
const [localText, setLocalText] = useState6();
|
|
1198
|
+
const [draft, setDraft] = useState6("");
|
|
1199
|
+
const [editing, setEditing] = useState6(false);
|
|
1200
|
+
const [copied, setCopied] = useState6(false);
|
|
1201
|
+
const [copyError, setCopyError] = useState6(false);
|
|
1202
|
+
const [expanded, setExpanded] = useState6(false);
|
|
1203
|
+
const [overflow, setOverflow] = useState6(false);
|
|
1134
1204
|
const editConfig = typeof editable === "object" ? editable : void 0;
|
|
1135
1205
|
const content = editConfig?.text ?? localText ?? children;
|
|
1136
1206
|
const requestedRows = typeof ellipsis === "object" ? ellipsis.rows ?? 1 : 1;
|
|
@@ -1140,7 +1210,7 @@ function TypographyContent({
|
|
|
1140
1210
|
setLocalText(void 0);
|
|
1141
1211
|
}, [children]);
|
|
1142
1212
|
useEffect3(() => () => clearTimeout(timer.current), []);
|
|
1143
|
-
|
|
1213
|
+
useLayoutEffect3(() => {
|
|
1144
1214
|
const element = contentRef.current;
|
|
1145
1215
|
if (!element || !ellipsis || editing || expanded) return;
|
|
1146
1216
|
const measure = () => setOverflow(element.scrollHeight > element.clientHeight + 1 || element.scrollWidth > element.clientWidth + 1);
|
|
@@ -1171,15 +1241,15 @@ function TypographyContent({
|
|
|
1171
1241
|
requestAnimationFrame(() => editRef.current?.focus());
|
|
1172
1242
|
}
|
|
1173
1243
|
let formatted = content;
|
|
1174
|
-
if (strong) formatted = /* @__PURE__ */
|
|
1175
|
-
if (italic) formatted = /* @__PURE__ */
|
|
1176
|
-
if (underline) formatted = /* @__PURE__ */
|
|
1177
|
-
if (deleted) formatted = /* @__PURE__ */
|
|
1178
|
-
if (mark) formatted = /* @__PURE__ */
|
|
1179
|
-
if (code) formatted = /* @__PURE__ */
|
|
1180
|
-
if (keyboard) formatted = /* @__PURE__ */
|
|
1181
|
-
return /* @__PURE__ */
|
|
1182
|
-
/* @__PURE__ */
|
|
1244
|
+
if (strong) formatted = /* @__PURE__ */ jsx10("strong", { children: formatted });
|
|
1245
|
+
if (italic) formatted = /* @__PURE__ */ jsx10("em", { children: formatted });
|
|
1246
|
+
if (underline) formatted = /* @__PURE__ */ jsx10("u", { children: formatted });
|
|
1247
|
+
if (deleted) formatted = /* @__PURE__ */ jsx10("del", { children: formatted });
|
|
1248
|
+
if (mark) formatted = /* @__PURE__ */ jsx10("mark", { children: formatted });
|
|
1249
|
+
if (code) formatted = /* @__PURE__ */ jsx10("code", { children: formatted });
|
|
1250
|
+
if (keyboard) formatted = /* @__PURE__ */ jsx10("kbd", { children: formatted });
|
|
1251
|
+
return /* @__PURE__ */ jsx10(Tag2, { ...withTitleTooltip(props), "aria-disabled": disabled || void 0, className: `sia-typography sia-typography--${Tag2}${type ? ` sia-typography--${type}` : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), children: editing ? /* @__PURE__ */ jsxs10("span", { className: "sia-typography__editor", children: [
|
|
1252
|
+
/* @__PURE__ */ jsx10(
|
|
1183
1253
|
TextArea,
|
|
1184
1254
|
{
|
|
1185
1255
|
autoFocus: true,
|
|
@@ -1201,35 +1271,35 @@ function TypographyContent({
|
|
|
1201
1271
|
}
|
|
1202
1272
|
}
|
|
1203
1273
|
),
|
|
1204
|
-
/* @__PURE__ */
|
|
1205
|
-
/* @__PURE__ */
|
|
1206
|
-
/* @__PURE__ */
|
|
1274
|
+
/* @__PURE__ */ jsxs10("span", { className: "sia-typography__edit-actions", children: [
|
|
1275
|
+
/* @__PURE__ */ jsx10(Button, { size: "small", onClick: () => finish(false), children: "\u53D6\u6D88" }),
|
|
1276
|
+
/* @__PURE__ */ jsx10(Button, { size: "small", variant: "primary", onClick: () => finish(true), children: "\u4FDD\u5B58" })
|
|
1207
1277
|
] })
|
|
1208
|
-
] }) : /* @__PURE__ */
|
|
1209
|
-
/* @__PURE__ */
|
|
1210
|
-
expandable && (overflow || expanded) ? /* @__PURE__ */
|
|
1211
|
-
editable ? /* @__PURE__ */
|
|
1278
|
+
] }) : /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
1279
|
+
/* @__PURE__ */ jsx10("span", { ref: contentRef, className: ellipsis && !expanded ? "sia-typography__ellipsis" : void 0, style: ellipsis && !expanded ? { "--sia-typography-rows": rows } : void 0, children: formatted }),
|
|
1280
|
+
expandable && (overflow || expanded) ? /* @__PURE__ */ jsx10(Button, { variant: "link", size: "small", className: "sia-typography__action", "aria-expanded": expanded, disabled, onClick: () => setExpanded(!expanded), children: expanded ? "\u6536\u8D77" : "\u5C55\u5F00" }) : null,
|
|
1281
|
+
editable ? /* @__PURE__ */ jsx10(Button, { ref: editRef, variant: "text", size: "small", className: "sia-typography__action", "aria-label": "\u7F16\u8F91\u6587\u672C", title: "\u7F16\u8F91", disabled, icon: /* @__PURE__ */ jsx10(Icon, { name: "edit", size: 14 }), onClick: () => {
|
|
1212
1282
|
setDraft(contentRef.current?.textContent ?? "");
|
|
1213
1283
|
setEditing(true);
|
|
1214
1284
|
} }) : null,
|
|
1215
|
-
copyable ? /* @__PURE__ */
|
|
1216
|
-
copyError ? /* @__PURE__ */
|
|
1285
|
+
copyable ? /* @__PURE__ */ jsx10(Button, { variant: "text", size: "small", className: "sia-typography__action", "aria-label": copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236\u6587\u672C", title: copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236", disabled, icon: /* @__PURE__ */ jsx10(Icon, { name: copied ? "check" : "copy", size: 14 }), onClick: () => void copy() }) : null,
|
|
1286
|
+
copyError ? /* @__PURE__ */ jsx10("span", { role: "status", className: "sia-typography--danger", children: "\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u9009\u62E9\u6587\u672C\u590D\u5236\u3002" }) : null
|
|
1217
1287
|
] }) });
|
|
1218
1288
|
}
|
|
1219
1289
|
function Title({ level = 1, ...props }) {
|
|
1220
|
-
return /* @__PURE__ */
|
|
1290
|
+
return /* @__PURE__ */ jsx10(TypographyContent, { ...props, as: `h${level}` });
|
|
1221
1291
|
}
|
|
1222
1292
|
function Text(props) {
|
|
1223
|
-
return /* @__PURE__ */
|
|
1293
|
+
return /* @__PURE__ */ jsx10(TypographyContent, { ...props });
|
|
1224
1294
|
}
|
|
1225
1295
|
function Paragraph(props) {
|
|
1226
|
-
return /* @__PURE__ */
|
|
1296
|
+
return /* @__PURE__ */ jsx10(TypographyContent, { ...props, as: "p" });
|
|
1227
1297
|
}
|
|
1228
1298
|
function Link({ disabled, className = "", onClick, href, target, rel, ...props }) {
|
|
1229
|
-
return /* @__PURE__ */
|
|
1299
|
+
return /* @__PURE__ */ jsx10(
|
|
1230
1300
|
"a",
|
|
1231
1301
|
{
|
|
1232
|
-
...props,
|
|
1302
|
+
...withTitleTooltip(props),
|
|
1233
1303
|
href: disabled ? void 0 : href,
|
|
1234
1304
|
target,
|
|
1235
1305
|
rel: rel ?? (target === "_blank" ? "noopener noreferrer" : void 0),
|
|
@@ -1244,7 +1314,7 @@ function Link({ disabled, className = "", onClick, href, target, rel, ...props }
|
|
|
1244
1314
|
);
|
|
1245
1315
|
}
|
|
1246
1316
|
function TypographyRoot({ className = "", ...props }) {
|
|
1247
|
-
return /* @__PURE__ */
|
|
1317
|
+
return /* @__PURE__ */ jsx10("div", { ...withTitleTooltip(props), className: `sia-typography ${className}`.trim() });
|
|
1248
1318
|
}
|
|
1249
1319
|
var Typography = Object.assign(TypographyRoot, {
|
|
1250
1320
|
/** 语义化标题,支持标题级别、复制和编辑。 */
|
|
@@ -1258,8 +1328,8 @@ var Typography = Object.assign(TypographyRoot, {
|
|
|
1258
1328
|
});
|
|
1259
1329
|
|
|
1260
1330
|
// src/components/FloatButton.tsx
|
|
1261
|
-
import { createContext, forwardRef, useContext, useEffect as useEffect4, useId as useId3, useRef as
|
|
1262
|
-
import { jsx as
|
|
1331
|
+
import { createContext, forwardRef, useContext, useEffect as useEffect4, useId as useId3, useRef as useRef7, useState as useState7 } from "react";
|
|
1332
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1263
1333
|
var GroupShape = createContext(void 0);
|
|
1264
1334
|
var FloatButtonRoot = forwardRef(function FloatButton({
|
|
1265
1335
|
icon,
|
|
@@ -1276,21 +1346,21 @@ var FloatButtonRoot = forwardRef(function FloatButton({
|
|
|
1276
1346
|
}, ref) {
|
|
1277
1347
|
const groupShape = useContext(GroupShape);
|
|
1278
1348
|
const label = props["aria-label"] ?? (typeof tooltip === "string" ? tooltip : typeof description === "string" ? description : "\u60AC\u6D6E\u64CD\u4F5C");
|
|
1279
|
-
const button = /* @__PURE__ */
|
|
1349
|
+
const button = /* @__PURE__ */ jsx11(
|
|
1280
1350
|
"button",
|
|
1281
1351
|
{
|
|
1282
|
-
...props,
|
|
1352
|
+
...withTitleTooltip(props),
|
|
1283
1353
|
ref,
|
|
1284
1354
|
type: htmlType,
|
|
1285
1355
|
"aria-label": label,
|
|
1286
1356
|
className: `sia-float-button sia-float-button--${groupShape ?? shape} sia-float-button--${type} ${className}`.trim(),
|
|
1287
|
-
children: /* @__PURE__ */
|
|
1288
|
-
icon !== null ? /* @__PURE__ */
|
|
1289
|
-
description != null || children != null ? /* @__PURE__ */
|
|
1357
|
+
children: /* @__PURE__ */ jsx11(Badge, { ...badge, className: "sia-float-button__badge", children: /* @__PURE__ */ jsxs11("span", { className: "sia-float-button__body", children: [
|
|
1358
|
+
icon !== null ? /* @__PURE__ */ jsx11("span", { className: "sia-float-button__icon", children: icon ?? /* @__PURE__ */ jsx11(Icon, { name: "question", size: 20 }) }) : null,
|
|
1359
|
+
description != null || children != null ? /* @__PURE__ */ jsx11("span", { className: "sia-float-button__description", children: description ?? children }) : null
|
|
1290
1360
|
] }) })
|
|
1291
1361
|
}
|
|
1292
1362
|
);
|
|
1293
|
-
return /* @__PURE__ */
|
|
1363
|
+
return /* @__PURE__ */ jsx11("span", { className: "sia-float-button-root", style, children: tooltip ? /* @__PURE__ */ jsx11(Tooltip, { title: tooltip, placement: "left", children: button }) : button });
|
|
1294
1364
|
});
|
|
1295
1365
|
function FloatButtonGroup({
|
|
1296
1366
|
shape = "circle",
|
|
@@ -1312,8 +1382,8 @@ function FloatButtonGroup({
|
|
|
1312
1382
|
...props
|
|
1313
1383
|
}) {
|
|
1314
1384
|
const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
|
|
1315
|
-
const rootRef =
|
|
1316
|
-
const triggerRef =
|
|
1385
|
+
const rootRef = useRef7(null);
|
|
1386
|
+
const triggerRef = useRef7(null);
|
|
1317
1387
|
const id = useId3();
|
|
1318
1388
|
useEffect4(() => {
|
|
1319
1389
|
if (!trigger || !visible) return;
|
|
@@ -1323,10 +1393,10 @@ function FloatButtonGroup({
|
|
|
1323
1393
|
document.addEventListener("pointerdown", close);
|
|
1324
1394
|
return () => document.removeEventListener("pointerdown", close);
|
|
1325
1395
|
}, [trigger, visible, setVisible]);
|
|
1326
|
-
return /* @__PURE__ */
|
|
1396
|
+
return /* @__PURE__ */ jsx11(GroupShape.Provider, { value: shape, children: /* @__PURE__ */ jsxs11(
|
|
1327
1397
|
"div",
|
|
1328
1398
|
{
|
|
1329
|
-
...props,
|
|
1399
|
+
...withTitleTooltip(props),
|
|
1330
1400
|
ref: rootRef,
|
|
1331
1401
|
role: "group",
|
|
1332
1402
|
className: `sia-float-button-group sia-float-button-group--${shape} sia-float-button-group--${placement}${trigger ? " sia-float-button-group--menu" : ""} ${className}`.trim(),
|
|
@@ -1350,13 +1420,13 @@ function FloatButtonGroup({
|
|
|
1350
1420
|
}
|
|
1351
1421
|
},
|
|
1352
1422
|
children: [
|
|
1353
|
-
!trigger || visible ? /* @__PURE__ */
|
|
1354
|
-
trigger ? /* @__PURE__ */
|
|
1423
|
+
!trigger || visible ? /* @__PURE__ */ jsx11("div", { id, className: "sia-float-button-group__list", children }) : null,
|
|
1424
|
+
trigger ? /* @__PURE__ */ jsx11(
|
|
1355
1425
|
FloatButtonRoot,
|
|
1356
1426
|
{
|
|
1357
1427
|
ref: triggerRef,
|
|
1358
1428
|
type,
|
|
1359
|
-
icon: visible ? closeIcon ?? /* @__PURE__ */
|
|
1429
|
+
icon: visible ? closeIcon ?? /* @__PURE__ */ jsx11(Icon, { name: "close", size: 20 }) : icon ?? /* @__PURE__ */ jsx11(Icon, { name: "plus", size: 20 }),
|
|
1360
1430
|
tooltip,
|
|
1361
1431
|
"aria-label": visible ? "\u6536\u8D77\u60AC\u6D6E\u83DC\u5355" : "\u5C55\u5F00\u60AC\u6D6E\u83DC\u5355",
|
|
1362
1432
|
"aria-expanded": visible,
|
|
@@ -1369,7 +1439,7 @@ function FloatButtonGroup({
|
|
|
1369
1439
|
) });
|
|
1370
1440
|
}
|
|
1371
1441
|
function FloatButtonBackTop({ target, visibilityHeight = 400, behavior = "smooth", onClick, icon, tooltip = "\u8FD4\u56DE\u9876\u90E8", ...props }) {
|
|
1372
|
-
const [visible, setVisible] =
|
|
1442
|
+
const [visible, setVisible] = useState7(false);
|
|
1373
1443
|
useEffect4(() => {
|
|
1374
1444
|
const element = target ? target() : window;
|
|
1375
1445
|
if (!element) return;
|
|
@@ -1379,7 +1449,7 @@ function FloatButtonBackTop({ target, visibilityHeight = 400, behavior = "smooth
|
|
|
1379
1449
|
return () => element.removeEventListener("scroll", update);
|
|
1380
1450
|
}, [target, visibilityHeight]);
|
|
1381
1451
|
if (!visible) return null;
|
|
1382
|
-
return /* @__PURE__ */
|
|
1452
|
+
return /* @__PURE__ */ jsx11(FloatButtonRoot, { ...props, tooltip, icon: icon ?? /* @__PURE__ */ jsx11(Icon, { name: "arrow-up", size: 20 }), onClick: (event) => {
|
|
1383
1453
|
onClick?.(event);
|
|
1384
1454
|
if (event.defaultPrevented) return;
|
|
1385
1455
|
const element = target ? target() : window;
|
|
@@ -1394,6 +1464,7 @@ var FloatButton2 = Object.assign(FloatButtonRoot, {
|
|
|
1394
1464
|
});
|
|
1395
1465
|
|
|
1396
1466
|
export {
|
|
1467
|
+
Toolbar,
|
|
1397
1468
|
Card,
|
|
1398
1469
|
Tag,
|
|
1399
1470
|
Tabs,
|