@sia.soul/sia-react-ui 0.1.165 → 0.1.166
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/{chunk-WR5YBY2A.js → chunk-T2F6X3LA.js} +31 -21
- package/dist/{core-r-smfiNN.d.cts → core-Cnt8r6pj.d.cts} +5 -3
- package/dist/{core-XtqUDbbD.d.ts → core-Dy8NWJ1b.d.ts} +5 -3
- package/dist/core.cjs +210 -200
- package/dist/core.css +3 -0
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.cjs +538 -528
- package/dist/index.css +3 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/core.cjs
CHANGED
|
@@ -3315,7 +3315,15 @@ function Card({
|
|
|
3315
3315
|
}
|
|
3316
3316
|
|
|
3317
3317
|
// src/components/Tag.tsx
|
|
3318
|
+
var import_react16 = require("react");
|
|
3318
3319
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3320
|
+
function hasTagContent(content) {
|
|
3321
|
+
return import_react16.Children.toArray(content).some((node) => {
|
|
3322
|
+
if (typeof node === "string") return node.trim().length > 0;
|
|
3323
|
+
if ((0, import_react16.isValidElement)(node) && node.type === import_react16.Fragment) return hasTagContent(node.props.children);
|
|
3324
|
+
return true;
|
|
3325
|
+
});
|
|
3326
|
+
}
|
|
3319
3327
|
function Tag({
|
|
3320
3328
|
size: sizeProp,
|
|
3321
3329
|
color,
|
|
@@ -3333,6 +3341,8 @@ function Tag({
|
|
|
3333
3341
|
...props
|
|
3334
3342
|
}) {
|
|
3335
3343
|
const size = useControlSize(sizeProp ?? (compact ? "small" : void 0));
|
|
3344
|
+
const hasIcon = hasTagContent(icon);
|
|
3345
|
+
if (!hasTagContent(children) && !hasIcon) return null;
|
|
3336
3346
|
const customColor = color?.trim() ? variant === "outlined" ? { borderColor: color, color, backgroundColor: "transparent" } : variant === "filled" ? { backgroundColor: color, color: "#fff", borderColor: "transparent" } : { color, backgroundColor: `color-mix(in srgb, ${color} 10%, transparent)`, borderColor: `color-mix(in srgb, ${color} 35%, transparent)` } : void 0;
|
|
3337
3347
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3338
3348
|
"span",
|
|
@@ -3342,7 +3352,7 @@ function Tag({
|
|
|
3342
3352
|
style: customColor ? { ...customColor, ...style } : style,
|
|
3343
3353
|
...withTitleTooltip(props),
|
|
3344
3354
|
children: [
|
|
3345
|
-
|
|
3355
|
+
hasIcon ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sia-tag__icon", children: icon }) : null,
|
|
3346
3356
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children }),
|
|
3347
3357
|
closable ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3348
3358
|
"button",
|
|
@@ -3364,9 +3374,9 @@ function Tag({
|
|
|
3364
3374
|
}
|
|
3365
3375
|
|
|
3366
3376
|
// src/components/Tabs.tsx
|
|
3367
|
-
var import_react16 = require("react");
|
|
3368
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3369
3377
|
var import_react17 = require("react");
|
|
3378
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3379
|
+
var import_react18 = require("react");
|
|
3370
3380
|
function Tabs({
|
|
3371
3381
|
items,
|
|
3372
3382
|
activeKey,
|
|
@@ -3393,25 +3403,25 @@ function Tabs({
|
|
|
3393
3403
|
...props
|
|
3394
3404
|
}) {
|
|
3395
3405
|
const firstEnabledKey = items.find((item) => !item.disabled)?.key ?? "";
|
|
3396
|
-
const [internalActiveKey, setInternalActiveKey] = (0,
|
|
3406
|
+
const [internalActiveKey, setInternalActiveKey] = (0, import_react17.useState)(defaultActiveKey ?? firstEnabledKey);
|
|
3397
3407
|
const currentKey = activeKey ?? internalActiveKey;
|
|
3398
3408
|
const selectedKey = items.some((item) => item.key === currentKey && !item.disabled) ? currentKey : firstEnabledKey;
|
|
3399
|
-
const baseId = (0,
|
|
3400
|
-
const enabledItems = (0,
|
|
3409
|
+
const baseId = (0, import_react17.useId)().replace(/:/g, "");
|
|
3410
|
+
const enabledItems = (0, import_react17.useMemo)(() => items.filter((item) => !item.disabled), [items]);
|
|
3401
3411
|
const resolvedPosition = tabPosition ?? (orientation === "vertical" ? "left" : "top");
|
|
3402
3412
|
const resolvedOrientation = resolvedPosition === "left" || resolvedPosition === "right" ? "vertical" : "horizontal";
|
|
3403
3413
|
const defaultIndicatorPosition = { top: "bottom", bottom: "top", left: "right", right: "left" }[resolvedPosition];
|
|
3404
3414
|
const resolvedIndicatorPosition = indicatorPosition && (resolvedOrientation === "vertical" ? ["left", "right"] : ["top", "bottom"]).includes(indicatorPosition) ? indicatorPosition : defaultIndicatorPosition;
|
|
3405
3415
|
const sliding = ["capsule", "line", "underline", "rounded", "tech", "tech-line"].includes(type);
|
|
3406
|
-
const listRef = (0,
|
|
3407
|
-
const indicatorRef = (0,
|
|
3408
|
-
const indicatorTargetRef = (0,
|
|
3409
|
-
const moreRef = (0,
|
|
3410
|
-
const [overflow, setOverflow] = (0,
|
|
3411
|
-
const [moreOpen, setMoreOpen] = (0,
|
|
3416
|
+
const listRef = (0, import_react17.useRef)(null);
|
|
3417
|
+
const indicatorRef = (0, import_react17.useRef)(null);
|
|
3418
|
+
const indicatorTargetRef = (0, import_react17.useRef)();
|
|
3419
|
+
const moreRef = (0, import_react17.useRef)(null);
|
|
3420
|
+
const [overflow, setOverflow] = (0, import_react17.useState)({ count: items.length, width: 0 });
|
|
3421
|
+
const [moreOpen, setMoreOpen] = (0, import_react17.useState)(false);
|
|
3412
3422
|
const visibleCount = resolvedOrientation === "horizontal" ? overflow.count : items.length;
|
|
3413
3423
|
const hiddenItems = items.slice(visibleCount);
|
|
3414
|
-
(0,
|
|
3424
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
3415
3425
|
const list = listRef.current;
|
|
3416
3426
|
if (!list || resolvedOrientation !== "horizontal") return;
|
|
3417
3427
|
const entries = Array.from(list.children).filter((node) => node instanceof HTMLElement && node.hasAttribute("data-tab-entry"));
|
|
@@ -3442,14 +3452,14 @@ function Tabs({
|
|
|
3442
3452
|
entries.forEach((entry) => observer.observe(entry));
|
|
3443
3453
|
return () => observer.disconnect();
|
|
3444
3454
|
}, [items, type, size, closable, resolvedOrientation, tabBarTitle, tabBarExtraContent]);
|
|
3445
|
-
const [settledContentKey, setSettledContentKey] = (0,
|
|
3446
|
-
const [visitedKeys, setVisitedKeys] = (0,
|
|
3447
|
-
const settledKeyRef = (0,
|
|
3448
|
-
const afterChangeRef = (0,
|
|
3449
|
-
(0,
|
|
3455
|
+
const [settledContentKey, setSettledContentKey] = (0, import_react17.useState)(selectedKey);
|
|
3456
|
+
const [visitedKeys, setVisitedKeys] = (0, import_react17.useState)(() => /* @__PURE__ */ new Set([selectedKey]));
|
|
3457
|
+
const settledKeyRef = (0, import_react17.useRef)(selectedKey);
|
|
3458
|
+
const afterChangeRef = (0, import_react17.useRef)(onAfterChange);
|
|
3459
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
3450
3460
|
afterChangeRef.current = onAfterChange;
|
|
3451
3461
|
}, [onAfterChange]);
|
|
3452
|
-
(0,
|
|
3462
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
3453
3463
|
if (!sliding) return;
|
|
3454
3464
|
const list = listRef.current;
|
|
3455
3465
|
const indicator = indicatorRef.current;
|
|
@@ -3511,7 +3521,7 @@ function Tabs({
|
|
|
3511
3521
|
motionPreference.removeEventListener("change", stopMotion);
|
|
3512
3522
|
};
|
|
3513
3523
|
}, [sliding, type, selectedKey, items, size, resolvedPosition, centered, closable, visibleCount, indicatorMotion]);
|
|
3514
|
-
(0,
|
|
3524
|
+
(0, import_react17.useEffect)(() => {
|
|
3515
3525
|
let cancelled = false;
|
|
3516
3526
|
let frame = 0;
|
|
3517
3527
|
frame = requestAnimationFrame(() => {
|
|
@@ -3537,7 +3547,7 @@ function Tabs({
|
|
|
3537
3547
|
};
|
|
3538
3548
|
}, [selectedKey, type, deferContent, indicatorMotion]);
|
|
3539
3549
|
const contentKey = deferContent && items.some((item) => item.key === settledContentKey) ? settledContentKey : selectedKey;
|
|
3540
|
-
(0,
|
|
3550
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
3541
3551
|
if (deferContent && contentKey !== settledContentKey) setSettledContentKey(contentKey);
|
|
3542
3552
|
setVisitedKeys((previous) => {
|
|
3543
3553
|
const next = new Set(items.filter((item) => item.key === contentKey || !destroyInactiveTabPane && previous.has(item.key)).map((item) => item.key));
|
|
@@ -3585,7 +3595,7 @@ function Tabs({
|
|
|
3585
3595
|
const canClose = item.closable ?? closable;
|
|
3586
3596
|
const contextMenuItems = typeof tabContextMenu === "function" ? tabContextMenu(item) : tabContextMenu;
|
|
3587
3597
|
const entryProps = { "data-tab-entry": "", "data-tab-hidden": index >= visibleCount, "aria-hidden": index >= visibleCount || void 0 };
|
|
3588
|
-
const tabNode = /* @__PURE__ */ (0,
|
|
3598
|
+
const tabNode = /* @__PURE__ */ (0, import_react18.createElement)("span", { ...!contextMenuItems?.length ? entryProps : {}, className: `sia-tabs__tab-wrap${canClose ? " is-closable" : ""}`, key: item.key }, /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3589
3599
|
"button",
|
|
3590
3600
|
{
|
|
3591
3601
|
id: `${baseId}-tab-${item.key}`,
|
|
@@ -3616,7 +3626,7 @@ function Tabs({
|
|
|
3616
3626
|
}
|
|
3617
3627
|
) : null);
|
|
3618
3628
|
if (!contextMenuItems?.length) return tabNode;
|
|
3619
|
-
return /* @__PURE__ */ (0,
|
|
3629
|
+
return /* @__PURE__ */ (0, import_react18.createElement)(
|
|
3620
3630
|
Dropdown,
|
|
3621
3631
|
{
|
|
3622
3632
|
...entryProps,
|
|
@@ -3679,20 +3689,20 @@ function Tabs({
|
|
|
3679
3689
|
}
|
|
3680
3690
|
|
|
3681
3691
|
// src/components/Feedback.tsx
|
|
3682
|
-
var
|
|
3692
|
+
var import_react23 = require("react");
|
|
3683
3693
|
var import_react_dom4 = require("react-dom");
|
|
3684
3694
|
var import_client2 = require("react-dom/client");
|
|
3685
3695
|
|
|
3686
3696
|
// src/components/FloatingDisplay.tsx
|
|
3687
|
-
var
|
|
3697
|
+
var import_react22 = require("react");
|
|
3688
3698
|
var import_react_dom3 = require("react-dom");
|
|
3689
3699
|
|
|
3690
3700
|
// src/components/usePressFeedback.ts
|
|
3691
|
-
var
|
|
3701
|
+
var import_react19 = require("react");
|
|
3692
3702
|
function usePressFeedback() {
|
|
3693
|
-
const running = (0,
|
|
3694
|
-
const cleanup2 = (0,
|
|
3695
|
-
(0,
|
|
3703
|
+
const running = (0, import_react19.useRef)();
|
|
3704
|
+
const cleanup2 = (0, import_react19.useRef)();
|
|
3705
|
+
(0, import_react19.useEffect)(() => () => cleanup2.current?.(), []);
|
|
3696
3706
|
return (node, compact = true) => {
|
|
3697
3707
|
if (!node?.animate) return;
|
|
3698
3708
|
const media = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
@@ -3724,20 +3734,20 @@ function usePressFeedback() {
|
|
|
3724
3734
|
}
|
|
3725
3735
|
|
|
3726
3736
|
// src/components/Checkbox.tsx
|
|
3727
|
-
var
|
|
3737
|
+
var import_react20 = require("react");
|
|
3728
3738
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3729
|
-
var CheckboxGroupContext = (0,
|
|
3730
|
-
var CheckboxRoot = (0,
|
|
3739
|
+
var CheckboxGroupContext = (0, import_react20.createContext)(null);
|
|
3740
|
+
var CheckboxRoot = (0, import_react20.forwardRef)(function Checkbox({ value, size: sizeProp, shape: shapeProp, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
|
|
3731
3741
|
const size = useControlSize(sizeProp);
|
|
3732
|
-
const group = (0,
|
|
3742
|
+
const group = (0, import_react20.useContext)(CheckboxGroupContext);
|
|
3733
3743
|
const shape = shapeProp ?? group?.shape ?? "square";
|
|
3734
|
-
const localRef = (0,
|
|
3735
|
-
const controlRef = (0,
|
|
3744
|
+
const localRef = (0, import_react20.useRef)(null);
|
|
3745
|
+
const controlRef = (0, import_react20.useRef)(null);
|
|
3736
3746
|
const press = usePressFeedback();
|
|
3737
|
-
const fallbackId = (0,
|
|
3747
|
+
const fallbackId = (0, import_react20.useId)();
|
|
3738
3748
|
const grouped = group !== null && value !== void 0;
|
|
3739
3749
|
const currentChecked = grouped ? group.values.includes(value) : checked;
|
|
3740
|
-
(0,
|
|
3750
|
+
(0, import_react20.useEffect)(() => {
|
|
3741
3751
|
if (localRef.current) localRef.current.indeterminate = indeterminate;
|
|
3742
3752
|
}, [indeterminate]);
|
|
3743
3753
|
function setRef(node) {
|
|
@@ -3795,7 +3805,7 @@ function CheckboxGroup({
|
|
|
3795
3805
|
gap: gap === void 0 ? void 0 : typeof gap === "number" ? Math.max(0, gap) : `${Math.max(0, gap[0])}px ${Math.max(0, gap[1])}px`
|
|
3796
3806
|
};
|
|
3797
3807
|
const [values, setValues] = useControllableState({ value, defaultValue, onChange });
|
|
3798
|
-
const context = (0,
|
|
3808
|
+
const context = (0, import_react20.useMemo)(() => ({
|
|
3799
3809
|
shape,
|
|
3800
3810
|
values,
|
|
3801
3811
|
disabled,
|
|
@@ -3819,7 +3829,7 @@ var Checkbox2 = Object.assign(CheckboxRoot, {
|
|
|
3819
3829
|
});
|
|
3820
3830
|
|
|
3821
3831
|
// src/components/Overlay.tsx
|
|
3822
|
-
var
|
|
3832
|
+
var import_react21 = require("react");
|
|
3823
3833
|
var import_react_dom2 = require("react-dom");
|
|
3824
3834
|
var bodyLockCount = 0;
|
|
3825
3835
|
var previousBodyOverflow = "";
|
|
@@ -3863,10 +3873,10 @@ function firstModalInput(panel) {
|
|
|
3863
3873
|
return [...candidates ?? []].find((element) => (element.tabIndex >= 0 || element.isContentEditable && !element.hasAttribute("tabindex")) && !element.matches(":disabled, [readonly], [aria-readonly='true']") && !element.closest('[hidden], [inert], [aria-hidden="true"], [aria-disabled="true"]') && element.getClientRects().length > 0 && getComputedStyle(element).visibility === "visible");
|
|
3864
3874
|
}
|
|
3865
3875
|
function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true, autoFocusInput = false, contentReady = true) {
|
|
3866
|
-
const overlayIdRef = (0,
|
|
3867
|
-
const closeRef = (0,
|
|
3876
|
+
const overlayIdRef = (0, import_react21.useRef)(/* @__PURE__ */ Symbol("sia-overlay"));
|
|
3877
|
+
const closeRef = (0, import_react21.useRef)(onRequestClose);
|
|
3868
3878
|
closeRef.current = onRequestClose;
|
|
3869
|
-
(0,
|
|
3879
|
+
(0, import_react21.useEffect)(() => {
|
|
3870
3880
|
if (!open || typeof document === "undefined") return void 0;
|
|
3871
3881
|
const overlayId = overlayIdRef.current;
|
|
3872
3882
|
const previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
@@ -3909,7 +3919,7 @@ function useOverlayLifecycle(open, panelRef, onRequestClose, keyboard = true, au
|
|
|
3909
3919
|
previouslyFocused?.focus({ preventScroll: true });
|
|
3910
3920
|
};
|
|
3911
3921
|
}, [keyboard, open, panelRef, autoFocusInput]);
|
|
3912
|
-
(0,
|
|
3922
|
+
(0, import_react21.useEffect)(() => {
|
|
3913
3923
|
if (!open) return;
|
|
3914
3924
|
const timer = window.setTimeout(() => {
|
|
3915
3925
|
const panel = panelRef.current;
|
|
@@ -4013,25 +4023,25 @@ function Floating({
|
|
|
4013
4023
|
role = "tooltip",
|
|
4014
4024
|
onOpenChange
|
|
4015
4025
|
}) {
|
|
4016
|
-
const rootRef = (0,
|
|
4017
|
-
const triggerElementRef = (0,
|
|
4018
|
-
const overlayRef = (0,
|
|
4019
|
-
const enterTimer = (0,
|
|
4020
|
-
const leaveTimer = (0,
|
|
4021
|
-
const contentId = (0,
|
|
4026
|
+
const rootRef = (0, import_react22.useRef)(null);
|
|
4027
|
+
const triggerElementRef = (0, import_react22.useRef)(null);
|
|
4028
|
+
const overlayRef = (0, import_react22.useRef)(null);
|
|
4029
|
+
const enterTimer = (0, import_react22.useRef)();
|
|
4030
|
+
const leaveTimer = (0, import_react22.useRef)();
|
|
4031
|
+
const contentId = (0, import_react22.useId)();
|
|
4022
4032
|
const triggers = Array.isArray(trigger) ? trigger : [trigger];
|
|
4023
4033
|
const hasContent = content !== null && content !== void 0 && typeof content !== "boolean" && !(typeof content === "string" && content.trim() === "");
|
|
4024
4034
|
const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
|
|
4025
|
-
const [position, setPosition] = (0,
|
|
4035
|
+
const [position, setPosition] = (0, import_react22.useState)();
|
|
4026
4036
|
const motion = useOverlayMotion(!!visible && hasContent, overlayRef, "tooltip", "bottom", !!position, void 0, !overlayClassName.includes("sia-form-item__error-popover"));
|
|
4027
|
-
const [portalContainer, setPortalContainer] = (0,
|
|
4028
|
-
(0,
|
|
4037
|
+
const [portalContainer, setPortalContainer] = (0, import_react22.useState)(null);
|
|
4038
|
+
(0, import_react22.useLayoutEffect)(() => {
|
|
4029
4039
|
if (!motion.present) return;
|
|
4030
4040
|
setPortalContainer(rootRef.current?.closest(".sia-modal-root, .sia-drawer-root") ?? document.body);
|
|
4031
4041
|
});
|
|
4032
|
-
const setVisibleRef = (0,
|
|
4042
|
+
const setVisibleRef = (0, import_react22.useRef)(setVisible);
|
|
4033
4043
|
setVisibleRef.current = setVisible;
|
|
4034
|
-
const closeSelfRef = (0,
|
|
4044
|
+
const closeSelfRef = (0, import_react22.useRef)();
|
|
4035
4045
|
if (!closeSelfRef.current) closeSelfRef.current = () => setVisibleRef.current(false);
|
|
4036
4046
|
const exclusiveTooltip = role === "tooltip" && triggers.includes("hover");
|
|
4037
4047
|
function openNow() {
|
|
@@ -4060,7 +4070,7 @@ function Floating({
|
|
|
4060
4070
|
if (delay <= 0) closeNow();
|
|
4061
4071
|
else leaveTimer.current = window.setTimeout(closeNow, delay * 1e3);
|
|
4062
4072
|
}
|
|
4063
|
-
(0,
|
|
4073
|
+
(0, import_react22.useEffect)(() => {
|
|
4064
4074
|
if (!visible || !triggers.includes("click")) return;
|
|
4065
4075
|
const close = (event) => {
|
|
4066
4076
|
const target = event.target;
|
|
@@ -4069,7 +4079,7 @@ function Floating({
|
|
|
4069
4079
|
document.addEventListener("pointerdown", close);
|
|
4070
4080
|
return () => document.removeEventListener("pointerdown", close);
|
|
4071
4081
|
}, [triggers.join("|"), visible]);
|
|
4072
|
-
(0,
|
|
4082
|
+
(0, import_react22.useLayoutEffect)(() => {
|
|
4073
4083
|
if (!motion.present) {
|
|
4074
4084
|
setPosition(void 0);
|
|
4075
4085
|
return;
|
|
@@ -4119,11 +4129,11 @@ function Floating({
|
|
|
4119
4129
|
unsubscribeLayers();
|
|
4120
4130
|
};
|
|
4121
4131
|
}, [children, content, placement, motion.present, portalContainer, autoAdjustOverflow, typeof arrow === "object" && arrow.pointAtCenter]);
|
|
4122
|
-
(0,
|
|
4132
|
+
(0, import_react22.useEffect)(() => () => {
|
|
4123
4133
|
clearTimers();
|
|
4124
4134
|
if (activeTooltipClose === closeSelfRef.current) activeTooltipClose = void 0;
|
|
4125
4135
|
}, []);
|
|
4126
|
-
const child = (0,
|
|
4136
|
+
const child = (0, import_react22.cloneElement)(children, {
|
|
4127
4137
|
...triggers.includes("hover") ? { onMouseEnter: (event) => {
|
|
4128
4138
|
triggerElementRef.current = event.currentTarget;
|
|
4129
4139
|
children.props.onMouseEnter?.(event);
|
|
@@ -4235,7 +4245,7 @@ function Progress({
|
|
|
4235
4245
|
}
|
|
4236
4246
|
|
|
4237
4247
|
// src/components/DataDisplay.tsx
|
|
4238
|
-
var
|
|
4248
|
+
var import_react24 = require("react");
|
|
4239
4249
|
var import_react_dom5 = require("react-dom");
|
|
4240
4250
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4241
4251
|
function BadgeRibbon({ text, color, placement = "end", className = "", children, ...props }) {
|
|
@@ -4266,8 +4276,8 @@ function CollapsePanel({
|
|
|
4266
4276
|
destroyInactivePanel = false,
|
|
4267
4277
|
children
|
|
4268
4278
|
}) {
|
|
4269
|
-
const [keepChildren, setKeepChildren] = (0,
|
|
4270
|
-
(0,
|
|
4279
|
+
const [keepChildren, setKeepChildren] = (0, import_react24.useState)(open || forceRender || !destroyInactivePanel);
|
|
4280
|
+
(0, import_react24.useEffect)(() => {
|
|
4271
4281
|
if (open || forceRender || !destroyInactivePanel) {
|
|
4272
4282
|
setKeepChildren(true);
|
|
4273
4283
|
return void 0;
|
|
@@ -4281,7 +4291,7 @@ function CollapsePanel({
|
|
|
4281
4291
|
function Collapse({ items, activeKey, defaultActiveKey = [], accordion = false, bordered = true, ghost = false, destroyInactivePanel = false, expandIconPosition = "start", onChange, className = "", ...props }) {
|
|
4282
4292
|
const normalize = (key) => Array.isArray(key) ? [...key] : key === void 0 ? [] : [key];
|
|
4283
4293
|
const controlled = activeKey !== void 0;
|
|
4284
|
-
const [internal, setInternal] = (0,
|
|
4294
|
+
const [internal, setInternal] = (0, import_react24.useState)(normalize(defaultActiveKey));
|
|
4285
4295
|
const openKeys = controlled ? normalize(activeKey) : internal;
|
|
4286
4296
|
function toggle(item) {
|
|
4287
4297
|
if (item.disabled || item.collapsible === "disabled") return;
|
|
@@ -4311,22 +4321,22 @@ function Collapse({ items, activeKey, defaultActiveKey = [], accordion = false,
|
|
|
4311
4321
|
}) });
|
|
4312
4322
|
}
|
|
4313
4323
|
function ImagePreview({ open, src, originalSrc, alt = "", onOpenChange, current = 0, count = 1, onCurrentChange }) {
|
|
4314
|
-
const previewRef = (0,
|
|
4324
|
+
const previewRef = (0, import_react24.useRef)(null);
|
|
4315
4325
|
const motion = useOverlayMotion(open, previewRef, "fade");
|
|
4316
|
-
const stageRef = (0,
|
|
4317
|
-
const [natural, setNatural] = (0,
|
|
4318
|
-
const [area, setArea] = (0,
|
|
4319
|
-
const [zoom, setZoom] = (0,
|
|
4320
|
-
const [rotation, setRotation] = (0,
|
|
4321
|
-
const [flip, setFlip] = (0,
|
|
4322
|
-
const [pan, setPan] = (0,
|
|
4323
|
-
const [failed, setFailed] = (0,
|
|
4324
|
-
const [original, setOriginal] = (0,
|
|
4326
|
+
const stageRef = (0, import_react24.useRef)(null);
|
|
4327
|
+
const [natural, setNatural] = (0, import_react24.useState)({ src: "", width: 0, height: 0 });
|
|
4328
|
+
const [area, setArea] = (0, import_react24.useState)({ width: 0, height: 0 });
|
|
4329
|
+
const [zoom, setZoom] = (0, import_react24.useState)(1);
|
|
4330
|
+
const [rotation, setRotation] = (0, import_react24.useState)(0);
|
|
4331
|
+
const [flip, setFlip] = (0, import_react24.useState)({ x: 1, y: 1 });
|
|
4332
|
+
const [pan, setPan] = (0, import_react24.useState)({ x: 0, y: 0 });
|
|
4333
|
+
const [failed, setFailed] = (0, import_react24.useState)(false);
|
|
4334
|
+
const [original, setOriginal] = (0, import_react24.useState)("preview");
|
|
4325
4335
|
const displaySrc = original === "loaded" && originalSrc ? originalSrc : src;
|
|
4326
|
-
(0,
|
|
4336
|
+
(0, import_react24.useEffect)(() => {
|
|
4327
4337
|
if (open) setOriginal("preview");
|
|
4328
4338
|
}, [open, src, originalSrc]);
|
|
4329
|
-
(0,
|
|
4339
|
+
(0, import_react24.useEffect)(() => {
|
|
4330
4340
|
if (!open || original !== "loading" || !originalSrc) return;
|
|
4331
4341
|
let active = true;
|
|
4332
4342
|
const image = new window.Image();
|
|
@@ -4343,7 +4353,7 @@ function ImagePreview({ open, src, originalSrc, alt = "", onOpenChange, current
|
|
|
4343
4353
|
image.onerror = null;
|
|
4344
4354
|
};
|
|
4345
4355
|
}, [open, original, originalSrc, src]);
|
|
4346
|
-
const drag = (0,
|
|
4356
|
+
const drag = (0, import_react24.useRef)();
|
|
4347
4357
|
useOverlayLifecycle(motion.present, previewRef, () => {
|
|
4348
4358
|
if (open) onOpenChange(false);
|
|
4349
4359
|
});
|
|
@@ -4354,13 +4364,13 @@ function ImagePreview({ open, src, originalSrc, alt = "", onOpenChange, current
|
|
|
4354
4364
|
setPan({ x: 0, y: 0 });
|
|
4355
4365
|
drag.current = void 0;
|
|
4356
4366
|
};
|
|
4357
|
-
(0,
|
|
4367
|
+
(0, import_react24.useEffect)(() => {
|
|
4358
4368
|
if (open) {
|
|
4359
4369
|
reset();
|
|
4360
4370
|
setFailed(false);
|
|
4361
4371
|
}
|
|
4362
4372
|
}, [open, displaySrc]);
|
|
4363
|
-
(0,
|
|
4373
|
+
(0, import_react24.useEffect)(() => {
|
|
4364
4374
|
if (!open || !onCurrentChange || count < 2) return;
|
|
4365
4375
|
const handleKey = (event) => {
|
|
4366
4376
|
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
@@ -4372,7 +4382,7 @@ function ImagePreview({ open, src, originalSrc, alt = "", onOpenChange, current
|
|
|
4372
4382
|
document.addEventListener("keydown", handleKey, true);
|
|
4373
4383
|
return () => document.removeEventListener("keydown", handleKey, true);
|
|
4374
4384
|
}, [open, current, count, onCurrentChange]);
|
|
4375
|
-
(0,
|
|
4385
|
+
(0, import_react24.useEffect)(() => {
|
|
4376
4386
|
const stage = stageRef.current;
|
|
4377
4387
|
if (!open || !stage) return;
|
|
4378
4388
|
const measure = () => {
|
|
@@ -4388,7 +4398,7 @@ function ImagePreview({ open, src, originalSrc, alt = "", onOpenChange, current
|
|
|
4388
4398
|
const sideways = Math.abs(rotation % 180) === 90;
|
|
4389
4399
|
const fit = ready ? Math.min(1, area.width / (sideways ? natural.height : natural.width), area.height / (sideways ? natural.width : natural.height)) : 0;
|
|
4390
4400
|
const changeZoom = (factor) => setZoom((value) => Math.max(0.25, Math.min(8, value * factor)));
|
|
4391
|
-
(0,
|
|
4401
|
+
(0, import_react24.useEffect)(() => {
|
|
4392
4402
|
const stage = stageRef.current;
|
|
4393
4403
|
if (!open || !stage) return;
|
|
4394
4404
|
const wheel = (event) => {
|
|
@@ -4468,7 +4478,7 @@ function ImagePreview({ open, src, originalSrc, alt = "", onOpenChange, current
|
|
|
4468
4478
|
] })
|
|
4469
4479
|
] }), document.body);
|
|
4470
4480
|
}
|
|
4471
|
-
var ImageGroupContext = (0,
|
|
4481
|
+
var ImageGroupContext = (0, import_react24.createContext)(null);
|
|
4472
4482
|
|
|
4473
4483
|
// src/components/FloatingPlaceholder.tsx
|
|
4474
4484
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
@@ -4482,7 +4492,7 @@ function useFloatingPlaceholder({ mode, placeholder, filled, active = false }) {
|
|
|
4482
4492
|
}
|
|
4483
4493
|
|
|
4484
4494
|
// src/components/Select.tsx
|
|
4485
|
-
var
|
|
4495
|
+
var import_react31 = require("react");
|
|
4486
4496
|
|
|
4487
4497
|
// src/components/OverlayContentSkeleton.tsx
|
|
4488
4498
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
@@ -4533,11 +4543,11 @@ function OverlayContentSkeleton({ layout }) {
|
|
|
4533
4543
|
}
|
|
4534
4544
|
|
|
4535
4545
|
// src/components/useOverlayExitPlaceholder.ts
|
|
4536
|
-
var
|
|
4546
|
+
var import_react25 = require("react");
|
|
4537
4547
|
function useOverlayExitPlaceholder(open, present, panelRef, bodyRef, captureContent) {
|
|
4538
|
-
const layout = (0,
|
|
4539
|
-
const dimensions = (0,
|
|
4540
|
-
(0,
|
|
4548
|
+
const layout = (0, import_react25.useRef)();
|
|
4549
|
+
const dimensions = (0, import_react25.useRef)({ panelHeight: 0, bodyHeight: 0 });
|
|
4550
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
4541
4551
|
if (!open || !present) {
|
|
4542
4552
|
if (present && bodyRef.current) bodyRef.current.scrollTop = bodyRef.current.scrollLeft = 0;
|
|
4543
4553
|
return;
|
|
@@ -4590,7 +4600,7 @@ function useOverlayExitPlaceholder(open, present, panelRef, bodyRef, captureCont
|
|
|
4590
4600
|
}
|
|
4591
4601
|
|
|
4592
4602
|
// src/components/Modal.tsx
|
|
4593
|
-
var
|
|
4603
|
+
var import_react26 = require("react");
|
|
4594
4604
|
var import_client3 = require("react-dom/client");
|
|
4595
4605
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4596
4606
|
var modalHandles = /* @__PURE__ */ new Set();
|
|
@@ -4601,7 +4611,7 @@ var typeIcons = {
|
|
|
4601
4611
|
error: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "circle-close", size: 23, variant: "filled" }),
|
|
4602
4612
|
confirm: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "question", size: 23, variant: "filled" })
|
|
4603
4613
|
};
|
|
4604
|
-
var ModalRoot = (0,
|
|
4614
|
+
var ModalRoot = (0, import_react26.forwardRef)(function Modal({
|
|
4605
4615
|
open,
|
|
4606
4616
|
deferContent = false,
|
|
4607
4617
|
loadingFallback,
|
|
@@ -4634,15 +4644,15 @@ var ModalRoot = (0, import_react25.forwardRef)(function Modal({
|
|
|
4634
4644
|
style,
|
|
4635
4645
|
...props
|
|
4636
4646
|
}, forwardedRef) {
|
|
4637
|
-
const localRef = (0,
|
|
4638
|
-
const bodyRef = (0,
|
|
4639
|
-
const titleId = (0,
|
|
4640
|
-
const [submitting, setSubmitting] = (0,
|
|
4647
|
+
const localRef = (0, import_react26.useRef)(null);
|
|
4648
|
+
const bodyRef = (0, import_react26.useRef)(null);
|
|
4649
|
+
const titleId = (0, import_react26.useId)();
|
|
4650
|
+
const [submitting, setSubmitting] = (0, import_react26.useState)(false);
|
|
4641
4651
|
const motion = useOverlayMotion(open, localRef, "modal", "bottom", true, afterOpenChange);
|
|
4642
4652
|
const { present: rendered, closing } = motion;
|
|
4643
4653
|
const bodyReady = !closing && (!deferContent || motion.settled);
|
|
4644
4654
|
const exitPlaceholder = useOverlayExitPlaceholder(open, rendered, localRef, bodyRef, bodyReady && loadingFallback === void 0);
|
|
4645
|
-
const submitLock = (0,
|
|
4655
|
+
const submitLock = (0, import_react26.useRef)(false);
|
|
4646
4656
|
function setRef(node) {
|
|
4647
4657
|
localRef.current = node;
|
|
4648
4658
|
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
@@ -4755,7 +4765,7 @@ function openModal(config) {
|
|
|
4755
4765
|
render();
|
|
4756
4766
|
}
|
|
4757
4767
|
function ModalInstance() {
|
|
4758
|
-
(0,
|
|
4768
|
+
(0, import_react26.useEffect)(() => {
|
|
4759
4769
|
mounted = true;
|
|
4760
4770
|
if (!currentOpen) render();
|
|
4761
4771
|
}, []);
|
|
@@ -4816,12 +4826,12 @@ var Modal2 = Object.assign(ModalRoot, {
|
|
|
4816
4826
|
});
|
|
4817
4827
|
|
|
4818
4828
|
// src/components/Input.tsx
|
|
4819
|
-
var
|
|
4829
|
+
var import_react28 = require("react");
|
|
4820
4830
|
|
|
4821
4831
|
// src/components/TextArea.tsx
|
|
4822
|
-
var
|
|
4832
|
+
var import_react27 = require("react");
|
|
4823
4833
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4824
|
-
var TextArea = (0,
|
|
4834
|
+
var TextArea = (0, import_react27.forwardRef)(function TextArea2({
|
|
4825
4835
|
label,
|
|
4826
4836
|
hint,
|
|
4827
4837
|
status = "default",
|
|
@@ -4839,9 +4849,9 @@ var TextArea = (0, import_react26.forwardRef)(function TextArea2({
|
|
|
4839
4849
|
...props
|
|
4840
4850
|
}, ref) {
|
|
4841
4851
|
const size = useControlSize(sizeProp);
|
|
4842
|
-
const fallbackId = (0,
|
|
4852
|
+
const fallbackId = (0, import_react27.useId)();
|
|
4843
4853
|
const textAreaId = id ?? fallbackId;
|
|
4844
|
-
const [uncontrolledValue, setUncontrolledValue] = (0,
|
|
4854
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react27.useState)(() => defaultValue === void 0 ? "" : String(defaultValue));
|
|
4845
4855
|
const currentText = value !== void 0 ? String(value) : uncontrolledValue;
|
|
4846
4856
|
const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: currentText.length > 0 });
|
|
4847
4857
|
const hintId = `${textAreaId}-hint`;
|
|
@@ -4884,7 +4894,7 @@ var TextArea = (0, import_react26.forwardRef)(function TextArea2({
|
|
|
4884
4894
|
|
|
4885
4895
|
// src/components/Input.tsx
|
|
4886
4896
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4887
|
-
var Input = (0,
|
|
4897
|
+
var Input = (0, import_react28.forwardRef)(function Input2({
|
|
4888
4898
|
label,
|
|
4889
4899
|
hint,
|
|
4890
4900
|
status = "default",
|
|
@@ -4907,14 +4917,14 @@ var Input = (0, import_react27.forwardRef)(function Input2({
|
|
|
4907
4917
|
...props
|
|
4908
4918
|
}, forwardedRef) {
|
|
4909
4919
|
const size = useControlSize(sizeProp);
|
|
4910
|
-
const fallbackId = (0,
|
|
4920
|
+
const fallbackId = (0, import_react28.useId)();
|
|
4911
4921
|
const inputId = id ?? fallbackId;
|
|
4912
|
-
const localRef = (0,
|
|
4913
|
-
const [uncontrolledValue, setUncontrolledValue] = (0,
|
|
4922
|
+
const localRef = (0, import_react28.useRef)(null);
|
|
4923
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react28.useState)(() => defaultValue === void 0 ? "" : String(defaultValue));
|
|
4914
4924
|
const currentText = value !== void 0 ? String(value) : uncontrolledValue;
|
|
4915
4925
|
const hasValue = currentText.length > 0;
|
|
4916
|
-
const [expanded, setExpanded] = (0,
|
|
4917
|
-
const [expandedDraft, setExpandedDraft] = (0,
|
|
4926
|
+
const [expanded, setExpanded] = (0, import_react28.useState)(false);
|
|
4927
|
+
const [expandedDraft, setExpandedDraft] = (0, import_react28.useState)("");
|
|
4918
4928
|
const floatingPlaceholder = usePlaceholderMode(placeholderMode) === "floating" && Boolean(placeholder);
|
|
4919
4929
|
const hintId = `${inputId}-hint`;
|
|
4920
4930
|
const describedBy = [props["aria-describedby"], hint ? hintId : null].filter(Boolean).join(" ") || void 0;
|
|
@@ -5047,7 +5057,7 @@ var Input = (0, import_react27.forwardRef)(function Input2({
|
|
|
5047
5057
|
});
|
|
5048
5058
|
|
|
5049
5059
|
// src/components/SelectionPanel.tsx
|
|
5050
|
-
var
|
|
5060
|
+
var import_react29 = require("react");
|
|
5051
5061
|
|
|
5052
5062
|
// src/components/selectionValues.ts
|
|
5053
5063
|
function normalizeSelectionValues(values, options) {
|
|
@@ -5078,27 +5088,27 @@ function SelectionPanel({
|
|
|
5078
5088
|
autoFocusSearch = false,
|
|
5079
5089
|
groupCheckable = false
|
|
5080
5090
|
}) {
|
|
5081
|
-
const value = (0,
|
|
5082
|
-
const [localSearch, setLocalSearch] = (0,
|
|
5091
|
+
const value = (0, import_react29.useMemo)(() => normalizeSelectionValues(rawValue, options), [rawValue, options]);
|
|
5092
|
+
const [localSearch, setLocalSearch] = (0, import_react29.useState)("");
|
|
5083
5093
|
const search = searchValue ?? localSearch;
|
|
5084
|
-
const [scrollTop, setScrollTop] = (0,
|
|
5085
|
-
const [active, setActive] = (0,
|
|
5086
|
-
const [keyboardActive, setKeyboardActive] = (0,
|
|
5087
|
-
const [deselectedHover, setDeselectedHover] = (0,
|
|
5088
|
-
const listRef = (0,
|
|
5089
|
-
const id = (0,
|
|
5090
|
-
const selected = (0,
|
|
5094
|
+
const [scrollTop, setScrollTop] = (0, import_react29.useState)(0);
|
|
5095
|
+
const [active, setActive] = (0, import_react29.useState)();
|
|
5096
|
+
const [keyboardActive, setKeyboardActive] = (0, import_react29.useState)(false);
|
|
5097
|
+
const [deselectedHover, setDeselectedHover] = (0, import_react29.useState)();
|
|
5098
|
+
const listRef = (0, import_react29.useRef)(null);
|
|
5099
|
+
const id = (0, import_react29.useId)();
|
|
5100
|
+
const selected = (0, import_react29.useMemo)(() => new Set(value), [value]);
|
|
5091
5101
|
const count = Math.max(1, Math.floor(columns));
|
|
5092
|
-
const allOptions = (0,
|
|
5102
|
+
const allOptions = (0, import_react29.useMemo)(() => {
|
|
5093
5103
|
if (!includeUnknownValues) return [...options];
|
|
5094
5104
|
const known = new Set(options.filter((option) => option.optionType !== "divider").map((option) => option.value));
|
|
5095
5105
|
return [...value.filter((item) => !known.has(item)).map((item) => ({ value: item, label: String(item), group: "\u81EA\u5B9A\u4E49\u503C" })), ...options];
|
|
5096
5106
|
}, [options, value, includeUnknownValues]);
|
|
5097
|
-
const filtered = (0,
|
|
5107
|
+
const filtered = (0, import_react29.useMemo)(
|
|
5098
5108
|
() => allOptions.filter((option) => (!selectedOnly || selected.has(option.value)) && (!search || option.optionType !== "divider" && [option.label, option.value].some((text) => String(text ?? "").toLowerCase().includes(search.toLowerCase())))),
|
|
5099
5109
|
[allOptions, selectedOnly, selected, search]
|
|
5100
5110
|
);
|
|
5101
|
-
const rows = (0,
|
|
5111
|
+
const rows = (0, import_react29.useMemo)(() => {
|
|
5102
5112
|
const groups = /* @__PURE__ */ new Map();
|
|
5103
5113
|
filtered.forEach((option) => {
|
|
5104
5114
|
const items = groups.get(option.group) ?? [];
|
|
@@ -5124,7 +5134,7 @@ function SelectionPanel({
|
|
|
5124
5134
|
const virtual = filtered.length > 100;
|
|
5125
5135
|
const renderedRows = virtual ? rows.filter((row) => row.top + row.height >= scrollTop - 100 && row.top <= scrollTop + maxHeight + 100) : rows;
|
|
5126
5136
|
const enabled = filtered.filter((option) => !option.disabled && option.optionType !== "divider");
|
|
5127
|
-
(0,
|
|
5137
|
+
(0, import_react29.useEffect)(() => {
|
|
5128
5138
|
setScrollTop(0);
|
|
5129
5139
|
if (listRef.current) listRef.current.scrollTop = 0;
|
|
5130
5140
|
setActive(void 0);
|
|
@@ -5291,14 +5301,14 @@ function SelectionPanel({
|
|
|
5291
5301
|
}
|
|
5292
5302
|
|
|
5293
5303
|
// src/components/OverflowTags.tsx
|
|
5294
|
-
var
|
|
5304
|
+
var import_react30 = require("react");
|
|
5295
5305
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5296
5306
|
function OverflowTags({ items, maxCount: maxCount2, expandToFit = false, className = "", tagClassName, restClassName = "" }) {
|
|
5297
|
-
const rootRef = (0,
|
|
5298
|
-
const measureRef = (0,
|
|
5307
|
+
const rootRef = (0, import_react30.useRef)(null);
|
|
5308
|
+
const measureRef = (0, import_react30.useRef)(null);
|
|
5299
5309
|
const limit = Math.min(items.length, Math.max(0, Math.floor(maxCount2) || 0));
|
|
5300
|
-
const [layout, setLayout] = (0,
|
|
5301
|
-
(0,
|
|
5310
|
+
const [layout, setLayout] = (0, import_react30.useState)({ count: 0, minimumWidths: [] });
|
|
5311
|
+
(0, import_react30.useLayoutEffect)(() => {
|
|
5302
5312
|
const root = rootRef.current;
|
|
5303
5313
|
const measure = measureRef.current;
|
|
5304
5314
|
if (!root || !measure) return;
|
|
@@ -5355,7 +5365,7 @@ function defaultFilterOption(query, option) {
|
|
|
5355
5365
|
const keyword = query.toLowerCase();
|
|
5356
5366
|
return [option.label, option.value].some((value) => String(value).toLowerCase().includes(keyword));
|
|
5357
5367
|
}
|
|
5358
|
-
var Select = (0,
|
|
5368
|
+
var Select = (0, import_react31.forwardRef)(function Select2({
|
|
5359
5369
|
options,
|
|
5360
5370
|
mode = "single",
|
|
5361
5371
|
popupMode: popupModeProp,
|
|
@@ -5394,27 +5404,27 @@ var Select = (0, import_react30.forwardRef)(function Select2({
|
|
|
5394
5404
|
}, forwardedRef) {
|
|
5395
5405
|
const showSearch = showSearchProp ?? options.length > 15;
|
|
5396
5406
|
const size = useControlSize(sizeProp);
|
|
5397
|
-
const fallbackId = (0,
|
|
5407
|
+
const fallbackId = (0, import_react31.useId)();
|
|
5398
5408
|
const selectId = id ?? fallbackId;
|
|
5399
5409
|
const listboxId = `${selectId}-listbox`;
|
|
5400
|
-
const rootRef = (0,
|
|
5401
|
-
const popupRef = (0,
|
|
5402
|
-
const searchRef = (0,
|
|
5403
|
-
const listRef = (0,
|
|
5404
|
-
const [open, setOpen] = (0,
|
|
5410
|
+
const rootRef = (0, import_react31.useRef)(null);
|
|
5411
|
+
const popupRef = (0, import_react31.useRef)(null);
|
|
5412
|
+
const searchRef = (0, import_react31.useRef)(null);
|
|
5413
|
+
const listRef = (0, import_react31.useRef)(null);
|
|
5414
|
+
const [open, setOpen] = (0, import_react31.useState)(false);
|
|
5405
5415
|
const automaticMode = popupModeProp ?? (options.length > modalThreshold ? "modal" : "dropdown");
|
|
5406
|
-
const [openedMode, setOpenedMode] = (0,
|
|
5416
|
+
const [openedMode, setOpenedMode] = (0, import_react31.useState)(automaticMode);
|
|
5407
5417
|
const popupMode = open ? openedMode : automaticMode;
|
|
5408
|
-
const [modalValues, setModalValues] = (0,
|
|
5409
|
-
const [modalSubmitting, setModalSubmitting] = (0,
|
|
5410
|
-
const modalSubmitLock = (0,
|
|
5411
|
-
const [selectedOnly, setSelectedOnly] = (0,
|
|
5412
|
-
const [query, setQuery] = (0,
|
|
5413
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
5414
|
-
const [scrollTop, setScrollTop] = (0,
|
|
5415
|
-
const [dropdownFontSize, setDropdownFontSize] = (0,
|
|
5416
|
-
const pendingSelectedScroll = (0,
|
|
5417
|
-
const deferredQuery = (0,
|
|
5418
|
+
const [modalValues, setModalValues] = (0, import_react31.useState)([]);
|
|
5419
|
+
const [modalSubmitting, setModalSubmitting] = (0, import_react31.useState)(false);
|
|
5420
|
+
const modalSubmitLock = (0, import_react31.useRef)(false);
|
|
5421
|
+
const [selectedOnly, setSelectedOnly] = (0, import_react31.useState)(false);
|
|
5422
|
+
const [query, setQuery] = (0, import_react31.useState)("");
|
|
5423
|
+
const [activeIndex, setActiveIndex] = (0, import_react31.useState)(-1);
|
|
5424
|
+
const [scrollTop, setScrollTop] = (0, import_react31.useState)(0);
|
|
5425
|
+
const [dropdownFontSize, setDropdownFontSize] = (0, import_react31.useState)();
|
|
5426
|
+
const pendingSelectedScroll = (0, import_react31.useRef)(false);
|
|
5427
|
+
const deferredQuery = (0, import_react31.useDeferredValue)(query.trim());
|
|
5418
5428
|
const initialValue = defaultValue === void 0 ? mode === "multiple" ? [] : null : defaultValue;
|
|
5419
5429
|
const [currentValue, setCurrentValue] = useControllableState({
|
|
5420
5430
|
value,
|
|
@@ -5429,20 +5439,20 @@ var Select = (0, import_react30.forwardRef)(function Select2({
|
|
|
5429
5439
|
}
|
|
5430
5440
|
}
|
|
5431
5441
|
});
|
|
5432
|
-
const selectedValues = (0,
|
|
5442
|
+
const selectedValues = (0, import_react31.useMemo)(() => {
|
|
5433
5443
|
if (currentValue == null || currentValue === "" && !options.some((option) => option.value === "")) return [];
|
|
5434
5444
|
if (mode === "multiple") return Array.isArray(currentValue) ? currentValue : currentValue === null ? [] : [currentValue];
|
|
5435
5445
|
return Array.isArray(currentValue) ? currentValue.slice(0, 1) : currentValue === null ? [] : [currentValue];
|
|
5436
5446
|
}, [currentValue, mode, options]);
|
|
5437
|
-
const selectedValueSet = (0,
|
|
5438
|
-
const availableOptions = (0,
|
|
5447
|
+
const selectedValueSet = (0, import_react31.useMemo)(() => new Set(selectedValues), [selectedValues]);
|
|
5448
|
+
const availableOptions = (0, import_react31.useMemo)(() => {
|
|
5439
5449
|
if (!allowInput) return options;
|
|
5440
5450
|
const optionValueSet = new Set(options.map((option) => option.value));
|
|
5441
5451
|
const selectedCustomOptions = selectedValues.filter((selectedValue) => !optionValueSet.has(selectedValue)).map((selectedValue) => ({ label: String(selectedValue), value: selectedValue }));
|
|
5442
5452
|
return selectedCustomOptions.length ? [...selectedCustomOptions, ...options] : options;
|
|
5443
5453
|
}, [allowInput, options, selectedValues]);
|
|
5444
|
-
const selectedOptions = (0,
|
|
5445
|
-
const filteredOptions = (0,
|
|
5454
|
+
const selectedOptions = (0, import_react31.useMemo)(() => selectedValues.map((selectedValue) => availableOptions.find((option) => option.value === selectedValue)).filter((option) => option !== void 0), [availableOptions, selectedValues]);
|
|
5455
|
+
const filteredOptions = (0, import_react31.useMemo)(() => deferredQuery ? availableOptions.filter((option) => filterOption(deferredQuery, option)) : availableOptions, [availableOptions, deferredQuery, filterOption]);
|
|
5446
5456
|
const inputValue = query.trim();
|
|
5447
5457
|
const exactInputOption = inputValue ? availableOptions.find((option) => String(option.value).toLowerCase() === inputValue.toLowerCase() || typeof option.label === "string" && option.label.toLowerCase() === inputValue.toLowerCase()) : void 0;
|
|
5448
5458
|
const canSubmitInput = allowInput && Boolean(inputValue) && !exactInputOption;
|
|
@@ -5456,7 +5466,7 @@ var Select = (0, import_react30.forwardRef)(function Select2({
|
|
|
5456
5466
|
const renderedOptions = virtualEnabled ? filteredOptions.slice(virtualStart, virtualEnd) : filteredOptions;
|
|
5457
5467
|
const enabledFilteredOptions = filteredOptions.filter((option) => !option.disabled);
|
|
5458
5468
|
const allFilteredSelected = enabledFilteredOptions.length > 0 && enabledFilteredOptions.every((option) => selectedValueSet.has(option.value));
|
|
5459
|
-
(0,
|
|
5469
|
+
(0, import_react31.useEffect)(() => {
|
|
5460
5470
|
if (!open || popupMode === "modal") return void 0;
|
|
5461
5471
|
function closeFromOutside(event) {
|
|
5462
5472
|
const target = event.target;
|
|
@@ -5465,15 +5475,15 @@ var Select = (0, import_react30.forwardRef)(function Select2({
|
|
|
5465
5475
|
document.addEventListener("mousedown", closeFromOutside);
|
|
5466
5476
|
return () => document.removeEventListener("mousedown", closeFromOutside);
|
|
5467
5477
|
}, [open, popupMode]);
|
|
5468
|
-
(0,
|
|
5478
|
+
(0, import_react31.useEffect)(() => {
|
|
5469
5479
|
if (!open || popupMode !== "dropdown" || !(showSearch || allowInput)) return;
|
|
5470
5480
|
const frame = requestAnimationFrame(() => searchRef.current?.focus({ preventScroll: true }));
|
|
5471
5481
|
return () => cancelAnimationFrame(frame);
|
|
5472
5482
|
}, [allowInput, open, popupMode, showSearch]);
|
|
5473
|
-
(0,
|
|
5483
|
+
(0, import_react31.useEffect)(() => {
|
|
5474
5484
|
if (disabled || loading) closeDropdown();
|
|
5475
5485
|
}, [disabled, loading]);
|
|
5476
|
-
(0,
|
|
5486
|
+
(0, import_react31.useEffect)(() => {
|
|
5477
5487
|
if (!open || popupMode !== "dropdown" || !pendingSelectedScroll.current || query) return;
|
|
5478
5488
|
const index = filteredOptions.findIndex((option) => selectedValueSet.has(option.value));
|
|
5479
5489
|
if (index < 0) return;
|
|
@@ -5488,7 +5498,7 @@ var Select = (0, import_react30.forwardRef)(function Select2({
|
|
|
5488
5498
|
});
|
|
5489
5499
|
return () => cancelAnimationFrame(frame);
|
|
5490
5500
|
}, [open, popupMode, filteredOptions, selectedValueSet, virtualEnabled, optionHeight, query]);
|
|
5491
|
-
(0,
|
|
5501
|
+
(0, import_react31.useLayoutEffect)(() => {
|
|
5492
5502
|
if (!open || popupMode !== "dropdown") return;
|
|
5493
5503
|
const trigger = rootRef.current?.querySelector(".sia-select__trigger");
|
|
5494
5504
|
if (trigger) setDropdownFontSize(getComputedStyle(trigger).fontSize);
|
|
@@ -5837,7 +5847,7 @@ var Select = (0, import_react30.forwardRef)(function Select2({
|
|
|
5837
5847
|
});
|
|
5838
5848
|
|
|
5839
5849
|
// src/components/Upload.tsx
|
|
5840
|
-
var
|
|
5850
|
+
var import_react33 = require("react");
|
|
5841
5851
|
|
|
5842
5852
|
// src/components/uploadFiles.ts
|
|
5843
5853
|
function acceptsUploadFile(file, accept) {
|
|
@@ -5968,7 +5978,7 @@ function isUploadImage(file, accept) {
|
|
|
5968
5978
|
}
|
|
5969
5979
|
|
|
5970
5980
|
// src/components/Message.tsx
|
|
5971
|
-
var
|
|
5981
|
+
var import_react32 = require("react");
|
|
5972
5982
|
var import_client4 = require("react-dom/client");
|
|
5973
5983
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5974
5984
|
var messageSeed = 0;
|
|
@@ -5996,13 +6006,13 @@ function ensureMessageRoot() {
|
|
|
5996
6006
|
return true;
|
|
5997
6007
|
}
|
|
5998
6008
|
function MessageView({ item }) {
|
|
5999
|
-
const ref = (0,
|
|
6009
|
+
const ref = (0, import_react32.useRef)(null);
|
|
6000
6010
|
const motion = useOverlayMotion(!item.closing, ref, "toast", "bottom", true, (open) => {
|
|
6001
6011
|
if (open) return;
|
|
6002
6012
|
messageItems = messageItems.filter((candidate) => candidate.key !== item.key || !candidate.closing);
|
|
6003
6013
|
renderMessages();
|
|
6004
6014
|
});
|
|
6005
|
-
(0,
|
|
6015
|
+
(0, import_react32.useEffect)(() => {
|
|
6006
6016
|
if (motion.present || !item.closing) return;
|
|
6007
6017
|
messageItems = messageItems.filter((candidate) => candidate.key !== item.key || !candidate.closing);
|
|
6008
6018
|
renderMessages();
|
|
@@ -6094,8 +6104,8 @@ var message = {
|
|
|
6094
6104
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
6095
6105
|
var LIST_IGNORE = /* @__PURE__ */ Symbol("SIA_UPLOAD_LIST_IGNORE");
|
|
6096
6106
|
function useThumbnail(file, accept) {
|
|
6097
|
-
const [local, setLocal] = (0,
|
|
6098
|
-
(0,
|
|
6107
|
+
const [local, setLocal] = (0, import_react33.useState)();
|
|
6108
|
+
(0, import_react33.useEffect)(() => {
|
|
6099
6109
|
if (!file?.thumbUrl && file?.originFileObj instanceof Blob && file.originFileObj.type.startsWith("image/")) {
|
|
6100
6110
|
const url = URL.createObjectURL(file.originFileObj);
|
|
6101
6111
|
setLocal(url);
|
|
@@ -6107,9 +6117,9 @@ function useThumbnail(file, accept) {
|
|
|
6107
6117
|
}
|
|
6108
6118
|
function UploadItem({ file, files, props, actions }) {
|
|
6109
6119
|
const source = useThumbnail(file, props.accept);
|
|
6110
|
-
const [failed, setFailed] = (0,
|
|
6111
|
-
const [downloading, setDownloading] = (0,
|
|
6112
|
-
const downloadingRef = (0,
|
|
6120
|
+
const [failed, setFailed] = (0, import_react33.useState)(false);
|
|
6121
|
+
const [downloading, setDownloading] = (0, import_react33.useState)(false);
|
|
6122
|
+
const downloadingRef = (0, import_react33.useRef)(false);
|
|
6113
6123
|
const canPreview = !!(source || file.url || file.originFileObj || props.onPreview);
|
|
6114
6124
|
const canDownload = !!(file.url || file.originFileObj || props.downloadRequest);
|
|
6115
6125
|
async function download() {
|
|
@@ -6125,7 +6135,7 @@ function UploadItem({ file, files, props, actions }) {
|
|
|
6125
6135
|
setDownloading(false);
|
|
6126
6136
|
}
|
|
6127
6137
|
}
|
|
6128
|
-
(0,
|
|
6138
|
+
(0, import_react33.useEffect)(() => setFailed(false), [source]);
|
|
6129
6139
|
const node = /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: `sia-upload__item sia-upload__item--${file.status ?? "ready"}`, children: [
|
|
6130
6140
|
props.listType !== "text" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Button, { variant: "text", className: "sia-upload__thumbnail", "aria-label": `\u9884\u89C8\u7F29\u7565\u56FE ${file.name}`, onClick: actions.preview, disabled: !canPreview, children: source && !failed ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { src: source, alt: file.name, onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: file.type?.startsWith("image/") ? "image" : "file", size: 28 }) }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "sia-upload__file-icon", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: file.status === "done" ? "circle-check" : "file", size: 24 }) }),
|
|
6131
6141
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "sia-upload__name", ...withTitleTooltip({ title: file.relativePath || file.name }), children: file.url ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("a", { href: file.url, target: "_blank", rel: "noreferrer", children: file.name }) : file.name }),
|
|
@@ -6147,7 +6157,7 @@ function UploadItem({ file, files, props, actions }) {
|
|
|
6147
6157
|
] });
|
|
6148
6158
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: props.itemRender ? props.itemRender(node, file, files, actions) : node });
|
|
6149
6159
|
}
|
|
6150
|
-
var UploadRoot = (0,
|
|
6160
|
+
var UploadRoot = (0, import_react33.forwardRef)(function UploadRoot2({
|
|
6151
6161
|
accept,
|
|
6152
6162
|
acceptMode = "validate",
|
|
6153
6163
|
multiple = false,
|
|
@@ -6187,19 +6197,19 @@ var UploadRoot = (0, import_react32.forwardRef)(function UploadRoot2({
|
|
|
6187
6197
|
const cardWidth = cardDimension(typeof cardSize === "number" ? cardSize : cardSize?.width);
|
|
6188
6198
|
const cardHeight = cardDimension(typeof cardSize === "number" ? cardSize : cardSize?.height);
|
|
6189
6199
|
const compactCard = listType === "picture-card" && (cardWidth < 88 || cardHeight < 88);
|
|
6190
|
-
const inputRef = (0,
|
|
6191
|
-
const [internalFiles, setInternalFiles] = (0,
|
|
6200
|
+
const inputRef = (0, import_react33.useRef)(null);
|
|
6201
|
+
const [internalFiles, setInternalFiles] = (0, import_react33.useState)(defaultFileList);
|
|
6192
6202
|
const files = fileList ?? internalFiles;
|
|
6193
|
-
const filesRef = (0,
|
|
6203
|
+
const filesRef = (0, import_react33.useRef)(files);
|
|
6194
6204
|
filesRef.current = files;
|
|
6195
|
-
const tasks = (0,
|
|
6196
|
-
const mounted = (0,
|
|
6197
|
-
const [dragging, setDragging] = (0,
|
|
6198
|
-
const [preview, setPreview] = (0,
|
|
6205
|
+
const tasks = (0, import_react33.useRef)(/* @__PURE__ */ new Map());
|
|
6206
|
+
const mounted = (0, import_react33.useRef)(true);
|
|
6207
|
+
const [dragging, setDragging] = (0, import_react33.useState)(false);
|
|
6208
|
+
const [preview, setPreview] = (0, import_react33.useState)();
|
|
6199
6209
|
const previewSource = useThumbnail(preview, accept);
|
|
6200
6210
|
const limit = maxCount2 === void 0 || !Number.isFinite(maxCount2) ? Infinity : Math.max(0, Math.floor(maxCount2));
|
|
6201
6211
|
const full = files.length >= limit;
|
|
6202
|
-
const current = (0,
|
|
6212
|
+
const current = (0, import_react33.useRef)({ disabled, directory, recursive });
|
|
6203
6213
|
current.current = { disabled, directory, recursive };
|
|
6204
6214
|
function cancel(uid) {
|
|
6205
6215
|
const task = tasks.current.get(uid);
|
|
@@ -6211,14 +6221,14 @@ var UploadRoot = (0, import_react32.forwardRef)(function UploadRoot2({
|
|
|
6211
6221
|
}
|
|
6212
6222
|
task?.finish();
|
|
6213
6223
|
}
|
|
6214
|
-
(0,
|
|
6224
|
+
(0, import_react33.useEffect)(() => {
|
|
6215
6225
|
mounted.current = true;
|
|
6216
6226
|
return () => {
|
|
6217
6227
|
mounted.current = false;
|
|
6218
6228
|
[...tasks.current.keys()].forEach(cancel);
|
|
6219
6229
|
};
|
|
6220
6230
|
}, []);
|
|
6221
|
-
(0,
|
|
6231
|
+
(0, import_react33.useEffect)(() => {
|
|
6222
6232
|
for (const uid of tasks.current.keys()) if (!files.some((file) => file.uid === uid)) cancel(uid);
|
|
6223
6233
|
if (preview && !files.some((file) => file.uid === preview.uid)) setPreview(void 0);
|
|
6224
6234
|
}, [files, preview]);
|
|
@@ -6324,7 +6334,7 @@ var UploadRoot = (0, import_react32.forwardRef)(function UploadRoot2({
|
|
|
6324
6334
|
} catch {
|
|
6325
6335
|
}
|
|
6326
6336
|
}
|
|
6327
|
-
(0,
|
|
6337
|
+
(0, import_react33.useImperativeHandle)(ref, () => ({
|
|
6328
6338
|
upload: async (uid) => {
|
|
6329
6339
|
await Promise.all(filesRef.current.filter((file) => (!uid || file.uid === uid) && file.status !== "done").map(start));
|
|
6330
6340
|
},
|
|
@@ -6452,7 +6462,7 @@ var UploadRoot = (0, import_react32.forwardRef)(function UploadRoot2({
|
|
|
6452
6462
|
}
|
|
6453
6463
|
);
|
|
6454
6464
|
});
|
|
6455
|
-
var UploadDragger = (0,
|
|
6465
|
+
var UploadDragger = (0, import_react33.forwardRef)(function UploadDragger2({ hint = "\u652F\u6301\u5355\u4E2A\u6216\u6279\u91CF\u4E0A\u4F20", children, className = "", ...props }, ref) {
|
|
6456
6466
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(UploadRoot, { ...props, ref, className: `sia-upload-dragger ${className}`.trim(), children: children ?? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "sia-upload-dragger__content", children: [
|
|
6457
6467
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: "upload", size: 32 }),
|
|
6458
6468
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("strong", { children: [
|
|
@@ -6493,7 +6503,7 @@ function Breadcrumb({ items, separator = "/", itemRender, className = "", ...pro
|
|
|
6493
6503
|
}
|
|
6494
6504
|
|
|
6495
6505
|
// src/components/Typography.tsx
|
|
6496
|
-
var
|
|
6506
|
+
var import_react34 = require("react");
|
|
6497
6507
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
6498
6508
|
function TypographyContent({
|
|
6499
6509
|
as: Tag2 = "span",
|
|
@@ -6513,26 +6523,26 @@ function TypographyContent({
|
|
|
6513
6523
|
className = "",
|
|
6514
6524
|
...props
|
|
6515
6525
|
}) {
|
|
6516
|
-
const contentRef = (0,
|
|
6517
|
-
const editRef = (0,
|
|
6518
|
-
const timer = (0,
|
|
6519
|
-
const [localText, setLocalText] = (0,
|
|
6520
|
-
const [draft, setDraft] = (0,
|
|
6521
|
-
const [editing, setEditing] = (0,
|
|
6522
|
-
const [copied, setCopied] = (0,
|
|
6523
|
-
const [copyError, setCopyError] = (0,
|
|
6524
|
-
const [expanded, setExpanded] = (0,
|
|
6525
|
-
const [overflow, setOverflow] = (0,
|
|
6526
|
+
const contentRef = (0, import_react34.useRef)(null);
|
|
6527
|
+
const editRef = (0, import_react34.useRef)(null);
|
|
6528
|
+
const timer = (0, import_react34.useRef)();
|
|
6529
|
+
const [localText, setLocalText] = (0, import_react34.useState)();
|
|
6530
|
+
const [draft, setDraft] = (0, import_react34.useState)("");
|
|
6531
|
+
const [editing, setEditing] = (0, import_react34.useState)(false);
|
|
6532
|
+
const [copied, setCopied] = (0, import_react34.useState)(false);
|
|
6533
|
+
const [copyError, setCopyError] = (0, import_react34.useState)(false);
|
|
6534
|
+
const [expanded, setExpanded] = (0, import_react34.useState)(false);
|
|
6535
|
+
const [overflow, setOverflow] = (0, import_react34.useState)(false);
|
|
6526
6536
|
const editConfig = typeof editable === "object" ? editable : void 0;
|
|
6527
6537
|
const content = editConfig?.text ?? localText ?? children;
|
|
6528
6538
|
const requestedRows = typeof ellipsis === "object" ? ellipsis.rows ?? 1 : 1;
|
|
6529
6539
|
const rows = Number.isFinite(requestedRows) ? Math.max(1, Math.floor(requestedRows)) : 1;
|
|
6530
6540
|
const expandable = typeof ellipsis === "object" && ellipsis.expandable;
|
|
6531
|
-
(0,
|
|
6541
|
+
(0, import_react34.useEffect)(() => {
|
|
6532
6542
|
setLocalText(void 0);
|
|
6533
6543
|
}, [children]);
|
|
6534
|
-
(0,
|
|
6535
|
-
(0,
|
|
6544
|
+
(0, import_react34.useEffect)(() => () => clearTimeout(timer.current), []);
|
|
6545
|
+
(0, import_react34.useLayoutEffect)(() => {
|
|
6536
6546
|
const element = contentRef.current;
|
|
6537
6547
|
if (!element || !ellipsis || !expandable || editing || expanded) return;
|
|
6538
6548
|
const measure = () => setOverflow(element.scrollHeight > element.clientHeight + 1 || element.scrollWidth > element.clientWidth + 1);
|
|
@@ -6650,10 +6660,10 @@ var Typography = Object.assign(TypographyRoot, {
|
|
|
6650
6660
|
});
|
|
6651
6661
|
|
|
6652
6662
|
// src/components/FloatButton.tsx
|
|
6653
|
-
var
|
|
6663
|
+
var import_react35 = require("react");
|
|
6654
6664
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6655
|
-
var GroupShape = (0,
|
|
6656
|
-
var FloatButtonRoot = (0,
|
|
6665
|
+
var GroupShape = (0, import_react35.createContext)(void 0);
|
|
6666
|
+
var FloatButtonRoot = (0, import_react35.forwardRef)(function FloatButton({
|
|
6657
6667
|
icon,
|
|
6658
6668
|
description,
|
|
6659
6669
|
tooltip,
|
|
@@ -6666,7 +6676,7 @@ var FloatButtonRoot = (0, import_react34.forwardRef)(function FloatButton({
|
|
|
6666
6676
|
children,
|
|
6667
6677
|
...props
|
|
6668
6678
|
}, ref) {
|
|
6669
|
-
const groupShape = (0,
|
|
6679
|
+
const groupShape = (0, import_react35.useContext)(GroupShape);
|
|
6670
6680
|
const label = props["aria-label"] ?? (typeof tooltip === "string" ? tooltip : typeof description === "string" ? description : "\u60AC\u6D6E\u64CD\u4F5C");
|
|
6671
6681
|
const button = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6672
6682
|
"button",
|
|
@@ -6704,12 +6714,12 @@ function FloatButtonGroup({
|
|
|
6704
6714
|
...props
|
|
6705
6715
|
}) {
|
|
6706
6716
|
const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
|
|
6707
|
-
const rootRef = (0,
|
|
6708
|
-
const triggerRef = (0,
|
|
6709
|
-
const listRef = (0,
|
|
6717
|
+
const rootRef = (0, import_react35.useRef)(null);
|
|
6718
|
+
const triggerRef = (0, import_react35.useRef)(null);
|
|
6719
|
+
const listRef = (0, import_react35.useRef)(null);
|
|
6710
6720
|
const motion = useOverlayMotion(!trigger || visible, listRef, "popup", placement, true, void 0, !!trigger);
|
|
6711
|
-
const id = (0,
|
|
6712
|
-
(0,
|
|
6721
|
+
const id = (0, import_react35.useId)();
|
|
6722
|
+
(0, import_react35.useEffect)(() => {
|
|
6713
6723
|
if (!trigger || !visible) return;
|
|
6714
6724
|
const close = (event) => {
|
|
6715
6725
|
if (!rootRef.current?.contains(event.target)) setVisible(false);
|
|
@@ -6763,10 +6773,10 @@ function FloatButtonGroup({
|
|
|
6763
6773
|
) });
|
|
6764
6774
|
}
|
|
6765
6775
|
function FloatButtonBackTop({ target, visibilityHeight = 400, behavior = "smooth", onClick, icon, tooltip = "\u8FD4\u56DE\u9876\u90E8", ...props }) {
|
|
6766
|
-
const [visible, setVisible] = (0,
|
|
6767
|
-
const buttonRef = (0,
|
|
6776
|
+
const [visible, setVisible] = (0, import_react35.useState)(false);
|
|
6777
|
+
const buttonRef = (0, import_react35.useRef)(null);
|
|
6768
6778
|
const motion = useOverlayMotion(visible, buttonRef, "fade");
|
|
6769
|
-
(0,
|
|
6779
|
+
(0, import_react35.useEffect)(() => {
|
|
6770
6780
|
const element = target ? target() : window;
|
|
6771
6781
|
if (!element) return;
|
|
6772
6782
|
const update = () => setVisible((element === window ? window.scrollY : element.scrollTop) >= visibilityHeight);
|