@underverse-ui/underverse 1.0.59 → 1.0.61
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/api-reference.json +1 -1
- package/dist/index.cjs +450 -350
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +385 -285
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3685,11 +3685,11 @@ var ToastProvider = ({ children, position = "top-right", maxToasts = 5 }) => {
|
|
|
3685
3685
|
] });
|
|
3686
3686
|
};
|
|
3687
3687
|
var ToastComponent = ({ toast, onRemove }) => {
|
|
3688
|
-
const [isVisible, setIsVisible] = (0, import_react7.useState)(
|
|
3688
|
+
const [isVisible, setIsVisible] = (0, import_react7.useState)(true);
|
|
3689
3689
|
const [progress, setProgress] = (0, import_react7.useState)(100);
|
|
3690
3690
|
const [paused, setPaused] = (0, import_react7.useState)(false);
|
|
3691
3691
|
const total = toast.duration && toast.duration > 0 ? toast.duration : 5e3;
|
|
3692
|
-
const endTsRef = (0, import_react7.useRef)(
|
|
3692
|
+
const endTsRef = (0, import_react7.useRef)(0);
|
|
3693
3693
|
const remainingRef = (0, import_react7.useRef)(total);
|
|
3694
3694
|
const pausedRef = (0, import_react7.useRef)(false);
|
|
3695
3695
|
const handleRemove = (0, import_react7.useCallback)(() => {
|
|
@@ -3697,7 +3697,6 @@ var ToastComponent = ({ toast, onRemove }) => {
|
|
|
3697
3697
|
setTimeout(() => onRemove(toast.id), 150);
|
|
3698
3698
|
}, [onRemove, toast.id]);
|
|
3699
3699
|
(0, import_react7.useEffect)(() => {
|
|
3700
|
-
setIsVisible(true);
|
|
3701
3700
|
if (toast.duration === 0) return;
|
|
3702
3701
|
remainingRef.current = total;
|
|
3703
3702
|
endTsRef.current = Date.now() + total;
|
|
@@ -3718,29 +3717,25 @@ var ToastComponent = ({ toast, onRemove }) => {
|
|
|
3718
3717
|
icon: import_lucide_react7.CheckCircle,
|
|
3719
3718
|
containerClassName: "bg-success/5 border-success/30",
|
|
3720
3719
|
iconClassName: "text-success",
|
|
3721
|
-
iconBgClassName: "bg-success/15"
|
|
3722
|
-
accentBarClassName: "bg-success"
|
|
3720
|
+
iconBgClassName: "bg-success/15"
|
|
3723
3721
|
},
|
|
3724
3722
|
error: {
|
|
3725
3723
|
icon: import_lucide_react7.AlertCircle,
|
|
3726
3724
|
containerClassName: "bg-destructive/5 border-destructive/30",
|
|
3727
3725
|
iconClassName: "text-destructive",
|
|
3728
|
-
iconBgClassName: "bg-destructive/15"
|
|
3729
|
-
accentBarClassName: "bg-destructive"
|
|
3726
|
+
iconBgClassName: "bg-destructive/15"
|
|
3730
3727
|
},
|
|
3731
3728
|
warning: {
|
|
3732
3729
|
icon: import_lucide_react7.AlertTriangle,
|
|
3733
3730
|
containerClassName: "bg-warning/5 border-warning/30",
|
|
3734
3731
|
iconClassName: "text-warning",
|
|
3735
|
-
iconBgClassName: "bg-warning/15"
|
|
3736
|
-
accentBarClassName: "bg-warning"
|
|
3732
|
+
iconBgClassName: "bg-warning/15"
|
|
3737
3733
|
},
|
|
3738
3734
|
info: {
|
|
3739
3735
|
icon: import_lucide_react7.Info,
|
|
3740
3736
|
containerClassName: "bg-info/5 border-info/30",
|
|
3741
3737
|
iconClassName: "text-info",
|
|
3742
|
-
iconBgClassName: "bg-info/15"
|
|
3743
|
-
accentBarClassName: "bg-info"
|
|
3738
|
+
iconBgClassName: "bg-info/15"
|
|
3744
3739
|
}
|
|
3745
3740
|
};
|
|
3746
3741
|
const config = typeConfig[toast.type];
|
|
@@ -3749,7 +3744,7 @@ var ToastComponent = ({ toast, onRemove }) => {
|
|
|
3749
3744
|
"div",
|
|
3750
3745
|
{
|
|
3751
3746
|
className: cn(
|
|
3752
|
-
"relative w-80 rounded-
|
|
3747
|
+
"relative w-80 rounded-xl border backdrop-blur-md transition-all duration-300 pointer-events-auto overflow-hidden",
|
|
3753
3748
|
"bg-card shadow-xl",
|
|
3754
3749
|
"animate-in slide-in-from-right-full",
|
|
3755
3750
|
config.containerClassName,
|
|
@@ -3770,8 +3765,7 @@ var ToastComponent = ({ toast, onRemove }) => {
|
|
|
3770
3765
|
setPaused(false);
|
|
3771
3766
|
},
|
|
3772
3767
|
children: [
|
|
3773
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.
|
|
3774
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-start gap-3 p-4 pl-5", children: [
|
|
3768
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-start gap-3 p-4", children: [
|
|
3775
3769
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: cn("flex items-center justify-center w-8 h-8 rounded-full shrink-0", config.iconBgClassName), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { className: cn("h-4 w-4", config.iconClassName) }) }),
|
|
3776
3770
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex-1 space-y-1", children: [
|
|
3777
3771
|
toast.title && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h4", { className: "font-medium text-sm leading-none", children: toast.title }),
|
|
@@ -3823,6 +3817,18 @@ var Toast_default = ToastProvider;
|
|
|
3823
3817
|
// src/components/Tooltip.tsx
|
|
3824
3818
|
var React14 = __toESM(require("react"), 1);
|
|
3825
3819
|
var import_react_dom2 = require("react-dom");
|
|
3820
|
+
|
|
3821
|
+
// src/hooks/useHydrated.ts
|
|
3822
|
+
var import_react8 = require("react");
|
|
3823
|
+
var subscribe = () => () => {
|
|
3824
|
+
};
|
|
3825
|
+
var getSnapshot = () => true;
|
|
3826
|
+
var getServerSnapshot = () => false;
|
|
3827
|
+
function useHydrated() {
|
|
3828
|
+
return (0, import_react8.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
3829
|
+
}
|
|
3830
|
+
|
|
3831
|
+
// src/components/Tooltip.tsx
|
|
3826
3832
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3827
3833
|
var variantStyles3 = {
|
|
3828
3834
|
default: "bg-popover text-popover-foreground border-border/50",
|
|
@@ -3831,17 +3837,6 @@ var variantStyles3 = {
|
|
|
3831
3837
|
error: "bg-destructive text-destructive-foreground border-destructive/20",
|
|
3832
3838
|
success: "bg-success text-success-foreground border-success/20"
|
|
3833
3839
|
};
|
|
3834
|
-
function assignRef(ref, value) {
|
|
3835
|
-
if (!ref) return;
|
|
3836
|
-
if (typeof ref === "function") {
|
|
3837
|
-
ref(value);
|
|
3838
|
-
return;
|
|
3839
|
-
}
|
|
3840
|
-
try {
|
|
3841
|
-
ref.current = value;
|
|
3842
|
-
} catch {
|
|
3843
|
-
}
|
|
3844
|
-
}
|
|
3845
3840
|
var clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
3846
3841
|
function getTransformOrigin(side) {
|
|
3847
3842
|
switch (side) {
|
|
@@ -3897,19 +3892,24 @@ var Tooltip = ({
|
|
|
3897
3892
|
variant = "default"
|
|
3898
3893
|
}) => {
|
|
3899
3894
|
const [isOpen, setIsOpen] = React14.useState(false);
|
|
3900
|
-
const
|
|
3895
|
+
const isMounted = useHydrated();
|
|
3901
3896
|
const triggerRef = React14.useRef(null);
|
|
3902
3897
|
const positionerRef = React14.useRef(null);
|
|
3903
3898
|
const panelRef = React14.useRef(null);
|
|
3904
3899
|
const timeoutRef = React14.useRef(void 0);
|
|
3905
3900
|
const lastAppliedRef = React14.useRef(null);
|
|
3906
|
-
React14.
|
|
3907
|
-
setIsMounted(true);
|
|
3908
|
-
}, []);
|
|
3901
|
+
const triggerSelector = React14.useId();
|
|
3909
3902
|
const delayOpen = typeof delay === "object" ? delay.open || 700 : delay;
|
|
3910
3903
|
const delayClose = typeof delay === "object" ? delay.close || 300 : delay;
|
|
3911
3904
|
const offset = 8;
|
|
3912
3905
|
const padding = 8;
|
|
3906
|
+
React14.useLayoutEffect(() => {
|
|
3907
|
+
if (typeof document === "undefined") return;
|
|
3908
|
+
const triggerEl = document.querySelector(`[data-underverse-tooltip-trigger="${triggerSelector}"]`);
|
|
3909
|
+
if (triggerEl) {
|
|
3910
|
+
triggerRef.current = triggerEl;
|
|
3911
|
+
}
|
|
3912
|
+
}, [children, triggerSelector]);
|
|
3913
3913
|
const updatePosition = React14.useCallback(() => {
|
|
3914
3914
|
const triggerEl = triggerRef.current;
|
|
3915
3915
|
const positionerEl = positionerRef.current;
|
|
@@ -4009,28 +4009,36 @@ var Tooltip = ({
|
|
|
4009
4009
|
return children;
|
|
4010
4010
|
}
|
|
4011
4011
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4012
|
+
(() => {
|
|
4013
|
+
const TriggerComponent = children.type;
|
|
4014
|
+
const triggerProps = children.props;
|
|
4015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4016
|
+
TriggerComponent,
|
|
4017
|
+
{
|
|
4018
|
+
...triggerProps,
|
|
4019
|
+
"data-underverse-tooltip-trigger": triggerSelector,
|
|
4020
|
+
onMouseEnter: (e) => {
|
|
4021
|
+
triggerRef.current = e.currentTarget;
|
|
4022
|
+
handleMouseEnter();
|
|
4023
|
+
if (typeof triggerProps.onMouseEnter === "function") triggerProps.onMouseEnter(e);
|
|
4024
|
+
},
|
|
4025
|
+
onMouseLeave: (e) => {
|
|
4026
|
+
triggerRef.current = e.currentTarget;
|
|
4027
|
+
handleMouseLeave();
|
|
4028
|
+
if (typeof triggerProps.onMouseLeave === "function") triggerProps.onMouseLeave(e);
|
|
4029
|
+
},
|
|
4030
|
+
onFocus: (e) => {
|
|
4031
|
+
triggerRef.current = e.currentTarget;
|
|
4032
|
+
handleFocus();
|
|
4033
|
+
if (typeof triggerProps.onFocus === "function") triggerProps.onFocus(e);
|
|
4034
|
+
},
|
|
4035
|
+
onBlur: (e) => {
|
|
4036
|
+
handleBlur();
|
|
4037
|
+
if (typeof triggerProps.onBlur === "function") triggerProps.onBlur(e);
|
|
4038
|
+
}
|
|
4039
|
+
}
|
|
4040
|
+
);
|
|
4041
|
+
})(),
|
|
4034
4042
|
isMounted && isOpen && (0, import_react_dom2.createPortal)(
|
|
4035
4043
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4036
4044
|
"div",
|
|
@@ -4077,7 +4085,7 @@ var React15 = __toESM(require("react"), 1);
|
|
|
4077
4085
|
var import_react_dom3 = require("react-dom");
|
|
4078
4086
|
|
|
4079
4087
|
// src/utils/animations.ts
|
|
4080
|
-
var
|
|
4088
|
+
var import_react9 = require("react");
|
|
4081
4089
|
var shadcnAnimationStyles = `
|
|
4082
4090
|
/* ============================================
|
|
4083
4091
|
* DROPDOWN / POPOVER ANIMATIONS
|
|
@@ -4255,7 +4263,7 @@ function ensureAnimationStylesInjected() {
|
|
|
4255
4263
|
}
|
|
4256
4264
|
}
|
|
4257
4265
|
function useShadCNAnimations() {
|
|
4258
|
-
(0,
|
|
4266
|
+
(0, import_react9.useEffect)(() => {
|
|
4259
4267
|
ensureAnimationStylesInjected();
|
|
4260
4268
|
}, []);
|
|
4261
4269
|
}
|
|
@@ -4268,17 +4276,6 @@ function getAnimationStyles() {
|
|
|
4268
4276
|
|
|
4269
4277
|
// src/components/Popover.tsx
|
|
4270
4278
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
4271
|
-
function assignRef2(ref, value) {
|
|
4272
|
-
if (!ref) return;
|
|
4273
|
-
if (typeof ref === "function") {
|
|
4274
|
-
ref(value);
|
|
4275
|
-
return;
|
|
4276
|
-
}
|
|
4277
|
-
try {
|
|
4278
|
-
ref.current = value;
|
|
4279
|
-
} catch {
|
|
4280
|
-
}
|
|
4281
|
-
}
|
|
4282
4279
|
function getTransformOrigin2(side, align) {
|
|
4283
4280
|
if (side === "top") return `${align === "end" ? "right" : "left"} bottom`;
|
|
4284
4281
|
if (side === "bottom") return `${align === "end" ? "right" : "left"} top`;
|
|
@@ -4390,7 +4387,15 @@ var Popover = ({
|
|
|
4390
4387
|
);
|
|
4391
4388
|
const offset = 4;
|
|
4392
4389
|
const padding = 8;
|
|
4390
|
+
const triggerSelector = React15.useId();
|
|
4393
4391
|
const initialPlacement = React15.useMemo(() => normalizePlacement(placement), [placement]);
|
|
4392
|
+
React15.useLayoutEffect(() => {
|
|
4393
|
+
if (typeof document === "undefined") return;
|
|
4394
|
+
const triggerEl = document.querySelector(`[data-underverse-popover-trigger="${triggerSelector}"]`);
|
|
4395
|
+
if (triggerEl) {
|
|
4396
|
+
triggerRef.current = triggerEl;
|
|
4397
|
+
}
|
|
4398
|
+
}, [triggerSelector, trigger]);
|
|
4394
4399
|
const updatePosition = React15.useCallback(() => {
|
|
4395
4400
|
const triggerEl = triggerRef.current;
|
|
4396
4401
|
const positionerEl = positionerRef.current;
|
|
@@ -4568,27 +4573,36 @@ var Popover = ({
|
|
|
4568
4573
|
) : null;
|
|
4569
4574
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
4570
4575
|
(() => {
|
|
4571
|
-
const
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
e
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4576
|
+
const TriggerComponent = trigger.type;
|
|
4577
|
+
const triggerProps = trigger.props;
|
|
4578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4579
|
+
TriggerComponent,
|
|
4580
|
+
{
|
|
4581
|
+
...triggerProps,
|
|
4582
|
+
"data-underverse-popover-trigger": triggerSelector,
|
|
4583
|
+
onClick: (e) => {
|
|
4584
|
+
triggerRef.current = e.currentTarget;
|
|
4585
|
+
e.preventDefault();
|
|
4586
|
+
e.stopPropagation();
|
|
4587
|
+
handleTriggerClick();
|
|
4588
|
+
if (typeof triggerProps.onClick === "function") {
|
|
4589
|
+
triggerProps.onClick(e);
|
|
4590
|
+
}
|
|
4591
|
+
},
|
|
4592
|
+
onFocus: (e) => {
|
|
4593
|
+
triggerRef.current = e.currentTarget;
|
|
4594
|
+
if (typeof triggerProps.onFocus === "function") {
|
|
4595
|
+
triggerProps.onFocus(e);
|
|
4596
|
+
}
|
|
4597
|
+
},
|
|
4598
|
+
"aria-expanded": isOpen,
|
|
4599
|
+
"aria-haspopup": triggerProps["aria-haspopup"] ?? "dialog",
|
|
4600
|
+
className: cn(
|
|
4601
|
+
triggerProps.className,
|
|
4602
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
4603
|
+
)
|
|
4604
|
+
}
|
|
4605
|
+
);
|
|
4592
4606
|
})(),
|
|
4593
4607
|
popoverContent
|
|
4594
4608
|
] });
|
|
@@ -4804,7 +4818,7 @@ var SidebarSheet = ({ navigation, children, ...props }) => {
|
|
|
4804
4818
|
};
|
|
4805
4819
|
|
|
4806
4820
|
// src/components/Alert.tsx
|
|
4807
|
-
var
|
|
4821
|
+
var import_react10 = require("react");
|
|
4808
4822
|
var import_lucide_react9 = require("lucide-react");
|
|
4809
4823
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
4810
4824
|
var variantConfig = {
|
|
@@ -4845,7 +4859,7 @@ var variantConfig = {
|
|
|
4845
4859
|
}
|
|
4846
4860
|
};
|
|
4847
4861
|
var Alert = ({ title, description, variant = "default", className, icon, dismissible = false, onClose, actions, closeAriaLabel }) => {
|
|
4848
|
-
const [open, setOpen] = (0,
|
|
4862
|
+
const [open, setOpen] = (0, import_react10.useState)(true);
|
|
4849
4863
|
const t = useSmartTranslations("Common");
|
|
4850
4864
|
if (!open) return null;
|
|
4851
4865
|
const handleClose = () => {
|
|
@@ -4890,7 +4904,7 @@ var Alert = ({ title, description, variant = "default", className, icon, dismiss
|
|
|
4890
4904
|
var Alert_default = Alert;
|
|
4891
4905
|
|
|
4892
4906
|
// src/components/GlobalLoading.tsx
|
|
4893
|
-
var
|
|
4907
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
4894
4908
|
var import_lucide_react10 = require("lucide-react");
|
|
4895
4909
|
|
|
4896
4910
|
// src/utils/loading.ts
|
|
@@ -4937,8 +4951,8 @@ var loading = new LoadingManager();
|
|
|
4937
4951
|
// src/components/GlobalLoading.tsx
|
|
4938
4952
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4939
4953
|
var GlobalLoading = ({ className, backdrop = true, position = "fixed", size = "lg" }) => {
|
|
4940
|
-
const [state, setState] = (0,
|
|
4941
|
-
(0,
|
|
4954
|
+
const [state, setState] = (0, import_react11.useState)(() => loading.getState());
|
|
4955
|
+
(0, import_react11.useEffect)(() => {
|
|
4942
4956
|
const unsubscribe = loading.subscribe(setState);
|
|
4943
4957
|
return unsubscribe;
|
|
4944
4958
|
}, []);
|
|
@@ -4995,7 +5009,7 @@ var InlineLoading = ({ isLoading, text, className, size = "md" }) => {
|
|
|
4995
5009
|
] });
|
|
4996
5010
|
};
|
|
4997
5011
|
var ButtonLoading = ({ isLoading, children, className, disabled, loadingText }) => {
|
|
4998
|
-
const child =
|
|
5012
|
+
const child = import_react11.default.isValidElement(children) ? import_react11.default.cloneElement(children, {
|
|
4999
5013
|
disabled: (children.props?.disabled ?? false) || disabled || isLoading,
|
|
5000
5014
|
"aria-busy": isLoading || void 0
|
|
5001
5015
|
}) : children;
|
|
@@ -5345,8 +5359,22 @@ var VerticalTabs = ({ sidebarWidth = "w-48", className, ...props }) => {
|
|
|
5345
5359
|
};
|
|
5346
5360
|
|
|
5347
5361
|
// src/components/DropdownMenu.tsx
|
|
5348
|
-
var
|
|
5362
|
+
var import_react12 = __toESM(require("react"), 1);
|
|
5349
5363
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
5364
|
+
function useResettingIndex(resetToken) {
|
|
5365
|
+
const [state, setState] = import_react12.default.useState({ resetToken, index: -1 });
|
|
5366
|
+
const activeIndex = Object.is(state.resetToken, resetToken) ? state.index : -1;
|
|
5367
|
+
const setActiveIndex = import_react12.default.useCallback((nextIndex) => {
|
|
5368
|
+
setState((prev) => {
|
|
5369
|
+
const prevIndex = Object.is(prev.resetToken, resetToken) ? prev.index : -1;
|
|
5370
|
+
return {
|
|
5371
|
+
resetToken,
|
|
5372
|
+
index: typeof nextIndex === "function" ? nextIndex(prevIndex) : nextIndex
|
|
5373
|
+
};
|
|
5374
|
+
});
|
|
5375
|
+
}, [resetToken]);
|
|
5376
|
+
return [activeIndex, setActiveIndex];
|
|
5377
|
+
}
|
|
5350
5378
|
var DropdownMenu = ({
|
|
5351
5379
|
trigger,
|
|
5352
5380
|
children,
|
|
@@ -5359,18 +5387,15 @@ var DropdownMenu = ({
|
|
|
5359
5387
|
onOpenChange,
|
|
5360
5388
|
items
|
|
5361
5389
|
}) => {
|
|
5362
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
5363
|
-
const triggerRef = import_react11.default.useRef(null);
|
|
5364
|
-
const menuRef = import_react11.default.useRef(null);
|
|
5365
|
-
const itemsRef = import_react11.default.useRef([]);
|
|
5366
|
-
const [activeIndex, setActiveIndex] = (0, import_react11.useState)(-1);
|
|
5367
|
-
useShadCNAnimations();
|
|
5390
|
+
const [internalOpen, setInternalOpen] = (0, import_react12.useState)(false);
|
|
5368
5391
|
const open = isOpen !== void 0 ? isOpen : internalOpen;
|
|
5369
5392
|
const setOpen = onOpenChange || setInternalOpen;
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5393
|
+
const triggerRef = import_react12.default.useRef(null);
|
|
5394
|
+
const menuRef = import_react12.default.useRef(null);
|
|
5395
|
+
const itemsRef = import_react12.default.useRef([]);
|
|
5396
|
+
const [activeIndex, setActiveIndex] = useResettingIndex(open);
|
|
5397
|
+
useShadCNAnimations();
|
|
5398
|
+
import_react12.default.useEffect(() => {
|
|
5374
5399
|
if (!open) return;
|
|
5375
5400
|
const handleKeyNav = (e) => {
|
|
5376
5401
|
const active = document.activeElement;
|
|
@@ -5406,7 +5431,7 @@ var DropdownMenu = ({
|
|
|
5406
5431
|
return () => {
|
|
5407
5432
|
document.removeEventListener("keydown", handleKeyNav);
|
|
5408
5433
|
};
|
|
5409
|
-
}, [open, activeIndex]);
|
|
5434
|
+
}, [open, activeIndex, setActiveIndex]);
|
|
5410
5435
|
const handleItemClick = (itemOnClick) => {
|
|
5411
5436
|
itemOnClick();
|
|
5412
5437
|
if (closeOnSelect) {
|
|
@@ -5444,36 +5469,48 @@ var DropdownMenu = ({
|
|
|
5444
5469
|
index
|
|
5445
5470
|
);
|
|
5446
5471
|
}) : children });
|
|
5447
|
-
const
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
e.
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5472
|
+
const TriggerComponent = trigger.type;
|
|
5473
|
+
const triggerProps = trigger.props;
|
|
5474
|
+
const enhancedTrigger = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5475
|
+
TriggerComponent,
|
|
5476
|
+
{
|
|
5477
|
+
...triggerProps,
|
|
5478
|
+
"aria-haspopup": "menu",
|
|
5479
|
+
"aria-expanded": open,
|
|
5480
|
+
onKeyDown: (e) => {
|
|
5481
|
+
triggerRef.current = e.currentTarget;
|
|
5482
|
+
if (disabled) return;
|
|
5483
|
+
if (e.key === "ArrowDown") {
|
|
5484
|
+
e.preventDefault();
|
|
5485
|
+
setOpen(true);
|
|
5486
|
+
requestAnimationFrame(() => itemsRef.current.find((el) => el && !el.disabled)?.focus());
|
|
5487
|
+
} else if (e.key === "ArrowUp") {
|
|
5488
|
+
e.preventDefault();
|
|
5489
|
+
setOpen(true);
|
|
5490
|
+
requestAnimationFrame(() => {
|
|
5491
|
+
const enabled = itemsRef.current.filter((el) => el && !el.disabled);
|
|
5492
|
+
enabled[enabled.length - 1]?.focus();
|
|
5493
|
+
});
|
|
5494
|
+
} else if (e.key === "Escape") {
|
|
5495
|
+
e.preventDefault();
|
|
5496
|
+
setOpen(false);
|
|
5497
|
+
}
|
|
5498
|
+
if (typeof triggerProps.onKeyDown === "function") {
|
|
5499
|
+
triggerProps.onKeyDown(e);
|
|
5500
|
+
}
|
|
5501
|
+
},
|
|
5502
|
+
onFocus: (e) => {
|
|
5503
|
+
triggerRef.current = e.currentTarget;
|
|
5504
|
+
if (typeof triggerProps.onFocus === "function") {
|
|
5505
|
+
triggerProps.onFocus(e);
|
|
5506
|
+
}
|
|
5507
|
+
},
|
|
5508
|
+
className: cn(
|
|
5509
|
+
triggerProps.className,
|
|
5510
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
5511
|
+
)
|
|
5512
|
+
}
|
|
5513
|
+
);
|
|
5477
5514
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5478
5515
|
Popover,
|
|
5479
5516
|
{
|
|
@@ -5558,11 +5595,11 @@ var import_lucide_react13 = require("lucide-react");
|
|
|
5558
5595
|
|
|
5559
5596
|
// src/components/Combobox.tsx
|
|
5560
5597
|
var React22 = __toESM(require("react"), 1);
|
|
5561
|
-
var
|
|
5598
|
+
var import_react14 = require("react");
|
|
5562
5599
|
var import_lucide_react12 = require("lucide-react");
|
|
5563
5600
|
|
|
5564
5601
|
// src/components/OverlayScrollbarProvider.tsx
|
|
5565
|
-
var
|
|
5602
|
+
var import_react13 = require("react");
|
|
5566
5603
|
var import_overlayscrollbars = require("overlayscrollbars");
|
|
5567
5604
|
|
|
5568
5605
|
// src/utils/overlay-scrollbar-controller.ts
|
|
@@ -5728,7 +5765,7 @@ function createOverlayScrollbarController({
|
|
|
5728
5765
|
|
|
5729
5766
|
// src/components/OverlayScrollbarProvider.tsx
|
|
5730
5767
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5731
|
-
var OverlayScrollbarConfigContext = (0,
|
|
5768
|
+
var OverlayScrollbarConfigContext = (0, import_react13.createContext)(DEFAULT_OVERLAY_SCROLLBAR_BEHAVIOR);
|
|
5732
5769
|
function OverlayScrollbarProvider({
|
|
5733
5770
|
enabled = DEFAULT_OVERLAY_SCROLLBAR_BEHAVIOR.enabled,
|
|
5734
5771
|
theme = DEFAULT_OVERLAY_SCROLLBAR_BEHAVIOR.theme,
|
|
@@ -5741,7 +5778,7 @@ function OverlayScrollbarProvider({
|
|
|
5741
5778
|
selector,
|
|
5742
5779
|
children
|
|
5743
5780
|
} = {}) {
|
|
5744
|
-
const value = (0,
|
|
5781
|
+
const value = (0, import_react13.useMemo)(
|
|
5745
5782
|
() => resolveOverlayScrollbarBehavior({
|
|
5746
5783
|
enabled,
|
|
5747
5784
|
theme,
|
|
@@ -5758,15 +5795,15 @@ function OverlayScrollbarProvider({
|
|
|
5758
5795
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(OverlayScrollbarConfigContext.Provider, { value, children: children ?? null });
|
|
5759
5796
|
}
|
|
5760
5797
|
function useOverlayScrollbarTarget(targetRef, options = {}) {
|
|
5761
|
-
const inherited = (0,
|
|
5762
|
-
const resolved = (0,
|
|
5798
|
+
const inherited = (0, import_react13.useContext)(OverlayScrollbarConfigContext);
|
|
5799
|
+
const resolved = (0, import_react13.useMemo)(
|
|
5763
5800
|
() => resolveOverlayScrollbarBehavior({
|
|
5764
5801
|
...inherited,
|
|
5765
5802
|
...options
|
|
5766
5803
|
}),
|
|
5767
5804
|
[inherited, options]
|
|
5768
5805
|
);
|
|
5769
|
-
(0,
|
|
5806
|
+
(0, import_react13.useEffect)(() => {
|
|
5770
5807
|
if (typeof window === "undefined") return;
|
|
5771
5808
|
const target = targetRef.current;
|
|
5772
5809
|
if (!target) return;
|
|
@@ -5841,7 +5878,7 @@ var Combobox = ({
|
|
|
5841
5878
|
const inputRef = React22.useRef(null);
|
|
5842
5879
|
const optionsViewportRef = React22.useRef(null);
|
|
5843
5880
|
useOverlayScrollbarTarget(optionsViewportRef, { enabled: useOverlayScrollbar });
|
|
5844
|
-
const autoId = (0,
|
|
5881
|
+
const autoId = (0, import_react14.useId)();
|
|
5845
5882
|
const resolvedId = id ? String(id) : `combobox-${autoId}`;
|
|
5846
5883
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
5847
5884
|
const enableSearch = options.length > 10;
|
|
@@ -6526,7 +6563,7 @@ var CompactPagination = ({ page, totalPages, onChange, className, disabled = fal
|
|
|
6526
6563
|
};
|
|
6527
6564
|
|
|
6528
6565
|
// src/components/Section.tsx
|
|
6529
|
-
var
|
|
6566
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
6530
6567
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
6531
6568
|
var gradientDirectionMap = {
|
|
6532
6569
|
"to-r": "to right",
|
|
@@ -6559,7 +6596,7 @@ var variantClasses = {
|
|
|
6559
6596
|
accent: "bg-accent/10",
|
|
6560
6597
|
gradient: ""
|
|
6561
6598
|
};
|
|
6562
|
-
var Section =
|
|
6599
|
+
var Section = import_react15.default.forwardRef(
|
|
6563
6600
|
({
|
|
6564
6601
|
children,
|
|
6565
6602
|
className,
|
|
@@ -6599,7 +6636,7 @@ Section.displayName = "Section";
|
|
|
6599
6636
|
var Section_default = Section;
|
|
6600
6637
|
|
|
6601
6638
|
// src/components/ScrollArea.tsx
|
|
6602
|
-
var
|
|
6639
|
+
var import_react16 = require("react");
|
|
6603
6640
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
6604
6641
|
var variantClasses2 = {
|
|
6605
6642
|
default: "bg-background",
|
|
@@ -6607,9 +6644,9 @@ var variantClasses2 = {
|
|
|
6607
6644
|
primary: "bg-primary/5",
|
|
6608
6645
|
accent: "bg-accent/10"
|
|
6609
6646
|
};
|
|
6610
|
-
var ScrollArea = (0,
|
|
6647
|
+
var ScrollArea = (0, import_react16.forwardRef)(
|
|
6611
6648
|
({ className, contentClassName, children, variant = "default", outlined = false, useOverlayScrollbar = false, ...props }, ref) => {
|
|
6612
|
-
const viewportRef = (0,
|
|
6649
|
+
const viewportRef = (0, import_react16.useRef)(null);
|
|
6613
6650
|
useOverlayScrollbarTarget(viewportRef, { enabled: useOverlayScrollbar });
|
|
6614
6651
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
6615
6652
|
"div",
|
|
@@ -6630,11 +6667,11 @@ var ScrollArea = (0, import_react15.forwardRef)(
|
|
|
6630
6667
|
ScrollArea.displayName = "ScrollArea";
|
|
6631
6668
|
|
|
6632
6669
|
// src/components/OverlayScrollArea.tsx
|
|
6633
|
-
var
|
|
6670
|
+
var import_react17 = require("react");
|
|
6634
6671
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
6635
|
-
var OverlayScrollArea = (0,
|
|
6672
|
+
var OverlayScrollArea = (0, import_react17.forwardRef)(
|
|
6636
6673
|
({ className, viewportClassName, viewportProps, enabled = true, overlayScrollbarOptions, children, ...props }, ref) => {
|
|
6637
|
-
const viewportRef = (0,
|
|
6674
|
+
const viewportRef = (0, import_react17.useRef)(null);
|
|
6638
6675
|
useOverlayScrollbarTarget(viewportRef, {
|
|
6639
6676
|
enabled,
|
|
6640
6677
|
...overlayScrollbarOptions
|
|
@@ -6869,7 +6906,7 @@ function formatDateSmart(date, locale = "en") {
|
|
|
6869
6906
|
// src/components/DatePicker.tsx
|
|
6870
6907
|
var import_lucide_react14 = require("lucide-react");
|
|
6871
6908
|
var React26 = __toESM(require("react"), 1);
|
|
6872
|
-
var
|
|
6909
|
+
var import_react18 = require("react");
|
|
6873
6910
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
6874
6911
|
var DatePicker = ({
|
|
6875
6912
|
id,
|
|
@@ -7268,7 +7305,7 @@ var DatePicker = ({
|
|
|
7268
7305
|
)
|
|
7269
7306
|
] })
|
|
7270
7307
|
] });
|
|
7271
|
-
const autoId = (0,
|
|
7308
|
+
const autoId = (0, import_react18.useId)();
|
|
7272
7309
|
const resolvedId = id ? String(id) : `datepicker-${autoId}`;
|
|
7273
7310
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
7274
7311
|
const labelSize = sizeStyles8[size].label;
|
|
@@ -7955,10 +7992,8 @@ function WheelColumn({
|
|
|
7955
7992
|
};
|
|
7956
7993
|
const currentVirtual = React27.useMemo(() => {
|
|
7957
7994
|
if (!loop || items.length <= 0) return valueIndex;
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
return getNearestVirtualIndex(valueIndex, from);
|
|
7961
|
-
}, [baseOffset, getNearestVirtualIndex, items.length, loop, valueIndex]);
|
|
7995
|
+
return baseOffset + valueIndex;
|
|
7996
|
+
}, [baseOffset, items.length, loop, valueIndex]);
|
|
7962
7997
|
const commitFromScrollTop = React27.useCallback(
|
|
7963
7998
|
(behavior) => {
|
|
7964
7999
|
const el = scrollRef.current;
|
|
@@ -9395,10 +9430,8 @@ function WheelColumn2({
|
|
|
9395
9430
|
};
|
|
9396
9431
|
const currentVirtual = React29.useMemo(() => {
|
|
9397
9432
|
if (!loop || items.length <= 0) return valueIndex;
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
return getNearestVirtualIndex(valueIndex, from);
|
|
9401
|
-
}, [baseOffset, getNearestVirtualIndex, items.length, loop, valueIndex]);
|
|
9433
|
+
return baseOffset + valueIndex;
|
|
9434
|
+
}, [baseOffset, items.length, loop, valueIndex]);
|
|
9402
9435
|
const commitFromScrollTop = React29.useCallback(
|
|
9403
9436
|
(behavior) => {
|
|
9404
9437
|
const el = scrollRef.current;
|
|
@@ -13458,7 +13491,7 @@ function CalendarTimeline({
|
|
|
13458
13491
|
|
|
13459
13492
|
// src/components/MultiCombobox.tsx
|
|
13460
13493
|
var React37 = __toESM(require("react"), 1);
|
|
13461
|
-
var
|
|
13494
|
+
var import_react19 = require("react");
|
|
13462
13495
|
var import_lucide_react23 = require("lucide-react");
|
|
13463
13496
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
13464
13497
|
var MultiCombobox = ({
|
|
@@ -13587,7 +13620,7 @@ var MultiCombobox = ({
|
|
|
13587
13620
|
outline: "border-2 border-input bg-transparent hover:border-primary",
|
|
13588
13621
|
ghost: "border border-transparent bg-muted/50 hover:bg-muted"
|
|
13589
13622
|
};
|
|
13590
|
-
const autoId = (0,
|
|
13623
|
+
const autoId = (0, import_react19.useId)();
|
|
13591
13624
|
const resolvedId = id ? String(id) : `multicombobox-${autoId}`;
|
|
13592
13625
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
13593
13626
|
const labelSize = size === "sm" ? "text-xs" : size === "lg" ? "text-base" : "text-sm";
|
|
@@ -14215,6 +14248,36 @@ var SIZE_STYLES = {
|
|
|
14215
14248
|
}
|
|
14216
14249
|
};
|
|
14217
14250
|
var clamp6 = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
14251
|
+
function SliderTooltip({
|
|
14252
|
+
displayValue,
|
|
14253
|
+
position,
|
|
14254
|
+
visible,
|
|
14255
|
+
sizeClassName,
|
|
14256
|
+
tooltipClassName
|
|
14257
|
+
}) {
|
|
14258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
14259
|
+
"div",
|
|
14260
|
+
{
|
|
14261
|
+
className: cn(
|
|
14262
|
+
"absolute pointer-events-none transition-all duration-200 ease-out",
|
|
14263
|
+
"bg-popover text-popover-foreground rounded-lg shadow-lg border border-border/50",
|
|
14264
|
+
"whitespace-nowrap font-medium -translate-x-1/2 z-50",
|
|
14265
|
+
sizeClassName,
|
|
14266
|
+
visible ? "opacity-100 -translate-y-10 scale-100" : "opacity-0 -translate-y-8 scale-95",
|
|
14267
|
+
tooltipClassName
|
|
14268
|
+
),
|
|
14269
|
+
style: {
|
|
14270
|
+
left: `${position}%`,
|
|
14271
|
+
bottom: "100%"
|
|
14272
|
+
},
|
|
14273
|
+
children: [
|
|
14274
|
+
displayValue,
|
|
14275
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-4 border-transparent border-t-border" }),
|
|
14276
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-[3px] border-transparent border-t-popover -mt-px" })
|
|
14277
|
+
]
|
|
14278
|
+
}
|
|
14279
|
+
);
|
|
14280
|
+
}
|
|
14218
14281
|
var Slider = React39.forwardRef(
|
|
14219
14282
|
({
|
|
14220
14283
|
className,
|
|
@@ -14304,6 +14367,7 @@ var Slider = React39.forwardRef(
|
|
|
14304
14367
|
const rangeStartPct = (normalizedRange[0] - min) / denom * 100;
|
|
14305
14368
|
const rangeEndPct = (normalizedRange[1] - min) / denom * 100;
|
|
14306
14369
|
const sizeStyles8 = SIZE_STYLES[size];
|
|
14370
|
+
const tooltipVisible = showTooltip && !disabled && (isHovering || isDragging);
|
|
14307
14371
|
const displayValue = React39.useMemo(() => {
|
|
14308
14372
|
if (isRange) {
|
|
14309
14373
|
const a = formatValue ? formatValue(normalizedRange[0]) : normalizedRange[0].toString();
|
|
@@ -14377,32 +14441,6 @@ var Slider = React39.forwardRef(
|
|
|
14377
14441
|
};
|
|
14378
14442
|
if (orientation === "vertical") {
|
|
14379
14443
|
}
|
|
14380
|
-
const Tooltip2 = ({ value: value2, position }) => {
|
|
14381
|
-
const shouldShow = showTooltip && !disabled && (isHovering || isDragging);
|
|
14382
|
-
const displayVal = formatValue ? formatValue(value2) : value2.toString();
|
|
14383
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
14384
|
-
"div",
|
|
14385
|
-
{
|
|
14386
|
-
className: cn(
|
|
14387
|
-
"absolute pointer-events-none transition-all duration-200 ease-out",
|
|
14388
|
-
"bg-popover text-popover-foreground rounded-lg shadow-lg border border-border/50",
|
|
14389
|
-
"whitespace-nowrap font-medium -translate-x-1/2 z-50",
|
|
14390
|
-
sizeStyles8.tooltip,
|
|
14391
|
-
shouldShow ? "opacity-100 -translate-y-10 scale-100" : "opacity-0 -translate-y-8 scale-95",
|
|
14392
|
-
tooltipClassName
|
|
14393
|
-
),
|
|
14394
|
-
style: {
|
|
14395
|
-
left: `${position}%`,
|
|
14396
|
-
bottom: "100%"
|
|
14397
|
-
},
|
|
14398
|
-
children: [
|
|
14399
|
-
displayVal,
|
|
14400
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-4 border-transparent border-t-border" }),
|
|
14401
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-[3px] border-transparent border-t-popover -mt-px" })
|
|
14402
|
-
]
|
|
14403
|
-
}
|
|
14404
|
-
);
|
|
14405
|
-
};
|
|
14406
14444
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: cn("w-full space-y-2", containerClassName), children: [
|
|
14407
14445
|
(label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
14408
14446
|
label && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("label", { className: cn("text-sm font-medium text-foreground", labelClassName), children: label }),
|
|
@@ -14435,10 +14473,37 @@ var Slider = React39.forwardRef(
|
|
|
14435
14473
|
style: { width: `${percentage}%` }
|
|
14436
14474
|
}
|
|
14437
14475
|
) }),
|
|
14438
|
-
!isRange && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
14476
|
+
!isRange && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
14477
|
+
SliderTooltip,
|
|
14478
|
+
{
|
|
14479
|
+
displayValue: formatValue ? formatValue(currentValue) : currentValue.toString(),
|
|
14480
|
+
position: percentage,
|
|
14481
|
+
visible: tooltipVisible,
|
|
14482
|
+
sizeClassName: sizeStyles8.tooltip,
|
|
14483
|
+
tooltipClassName
|
|
14484
|
+
}
|
|
14485
|
+
),
|
|
14439
14486
|
isRange && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
14440
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
14441
|
-
|
|
14487
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
14488
|
+
SliderTooltip,
|
|
14489
|
+
{
|
|
14490
|
+
displayValue: formatValue ? formatValue(normalizedRange[0]) : normalizedRange[0].toString(),
|
|
14491
|
+
position: rangeStartPct,
|
|
14492
|
+
visible: tooltipVisible,
|
|
14493
|
+
sizeClassName: sizeStyles8.tooltip,
|
|
14494
|
+
tooltipClassName
|
|
14495
|
+
}
|
|
14496
|
+
),
|
|
14497
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
14498
|
+
SliderTooltip,
|
|
14499
|
+
{
|
|
14500
|
+
displayValue: formatValue ? formatValue(normalizedRange[1]) : normalizedRange[1].toString(),
|
|
14501
|
+
position: rangeEndPct,
|
|
14502
|
+
visible: tooltipVisible,
|
|
14503
|
+
sizeClassName: sizeStyles8.tooltip,
|
|
14504
|
+
tooltipClassName
|
|
14505
|
+
}
|
|
14506
|
+
)
|
|
14442
14507
|
] }),
|
|
14443
14508
|
(() => {
|
|
14444
14509
|
const baseInputClassName = cn(
|
|
@@ -14576,7 +14641,7 @@ Slider.displayName = "Slider";
|
|
|
14576
14641
|
|
|
14577
14642
|
// src/components/OverlayControls.tsx
|
|
14578
14643
|
var import_lucide_react24 = require("lucide-react");
|
|
14579
|
-
var
|
|
14644
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
14580
14645
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
14581
14646
|
function OverlayControls({
|
|
14582
14647
|
mode,
|
|
@@ -14607,24 +14672,24 @@ function OverlayControls({
|
|
|
14607
14672
|
}) {
|
|
14608
14673
|
const hoverClasses = showOnHover ? "opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto" : "opacity-100 pointer-events-auto";
|
|
14609
14674
|
const showControlsBar = mode === "review";
|
|
14610
|
-
const [rateOpen, setRateOpen] =
|
|
14611
|
-
const rateWrapRef =
|
|
14612
|
-
const [controlsVisible, setControlsVisible] =
|
|
14613
|
-
const hideTimerRef =
|
|
14614
|
-
const [previewData, setPreviewData] =
|
|
14615
|
-
const sliderRef =
|
|
14616
|
-
const [isDragging, setIsDragging] =
|
|
14617
|
-
const [dragValue, setDragValue] =
|
|
14618
|
-
|
|
14675
|
+
const [rateOpen, setRateOpen] = import_react20.default.useState(false);
|
|
14676
|
+
const rateWrapRef = import_react20.default.useRef(null);
|
|
14677
|
+
const [controlsVisible, setControlsVisible] = import_react20.default.useState(true);
|
|
14678
|
+
const hideTimerRef = import_react20.default.useRef(null);
|
|
14679
|
+
const [previewData, setPreviewData] = import_react20.default.useState(null);
|
|
14680
|
+
const sliderRef = import_react20.default.useRef(null);
|
|
14681
|
+
const [isDragging, setIsDragging] = import_react20.default.useState(false);
|
|
14682
|
+
const [dragValue, setDragValue] = import_react20.default.useState(value);
|
|
14683
|
+
import_react20.default.useEffect(() => {
|
|
14619
14684
|
if (!isDragging) {
|
|
14620
14685
|
setDragValue(value);
|
|
14621
14686
|
}
|
|
14622
14687
|
}, [value, isDragging]);
|
|
14623
|
-
const [keyboardFeedback, setKeyboardFeedback] =
|
|
14624
|
-
const feedbackTimerRef =
|
|
14625
|
-
const seekAccumulatorRef =
|
|
14626
|
-
const seekAccumulatorTimerRef =
|
|
14627
|
-
|
|
14688
|
+
const [keyboardFeedback, setKeyboardFeedback] = import_react20.default.useState(null);
|
|
14689
|
+
const feedbackTimerRef = import_react20.default.useRef(null);
|
|
14690
|
+
const seekAccumulatorRef = import_react20.default.useRef(0);
|
|
14691
|
+
const seekAccumulatorTimerRef = import_react20.default.useRef(null);
|
|
14692
|
+
import_react20.default.useEffect(() => {
|
|
14628
14693
|
const onDocDown = (e) => {
|
|
14629
14694
|
if (!rateOpen) return;
|
|
14630
14695
|
const wrap = rateWrapRef.current;
|
|
@@ -14635,7 +14700,7 @@ function OverlayControls({
|
|
|
14635
14700
|
document.addEventListener("mousedown", onDocDown);
|
|
14636
14701
|
return () => document.removeEventListener("mousedown", onDocDown);
|
|
14637
14702
|
}, [rateOpen]);
|
|
14638
|
-
|
|
14703
|
+
import_react20.default.useEffect(() => {
|
|
14639
14704
|
if (!autoHide || showOnHover) return;
|
|
14640
14705
|
const resetTimer = () => {
|
|
14641
14706
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
@@ -14658,14 +14723,14 @@ function OverlayControls({
|
|
|
14658
14723
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
14659
14724
|
};
|
|
14660
14725
|
}, [autoHide, autoHideDelay, showOnHover]);
|
|
14661
|
-
const showFeedback =
|
|
14726
|
+
const showFeedback = import_react20.default.useCallback((type, value2) => {
|
|
14662
14727
|
if (feedbackTimerRef.current) clearTimeout(feedbackTimerRef.current);
|
|
14663
14728
|
setKeyboardFeedback({ type, value: value2 });
|
|
14664
14729
|
feedbackTimerRef.current = setTimeout(() => {
|
|
14665
14730
|
setKeyboardFeedback(null);
|
|
14666
14731
|
}, 800);
|
|
14667
14732
|
}, []);
|
|
14668
|
-
const accumulateSeek =
|
|
14733
|
+
const accumulateSeek = import_react20.default.useCallback((seconds) => {
|
|
14669
14734
|
if (seekAccumulatorTimerRef.current) clearTimeout(seekAccumulatorTimerRef.current);
|
|
14670
14735
|
seekAccumulatorRef.current += seconds;
|
|
14671
14736
|
showFeedback("seek", seekAccumulatorRef.current);
|
|
@@ -14673,7 +14738,7 @@ function OverlayControls({
|
|
|
14673
14738
|
seekAccumulatorRef.current = 0;
|
|
14674
14739
|
}, 1e3);
|
|
14675
14740
|
}, [showFeedback]);
|
|
14676
|
-
|
|
14741
|
+
import_react20.default.useEffect(() => {
|
|
14677
14742
|
if (!enableKeyboardShortcuts) return;
|
|
14678
14743
|
const handleKeyDown = (e) => {
|
|
14679
14744
|
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return;
|
|
@@ -15011,7 +15076,7 @@ function OverlayControls({
|
|
|
15011
15076
|
}
|
|
15012
15077
|
|
|
15013
15078
|
// src/components/CategoryTreeSelect.tsx
|
|
15014
|
-
var
|
|
15079
|
+
var import_react21 = require("react");
|
|
15015
15080
|
var import_lucide_react25 = require("lucide-react");
|
|
15016
15081
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
15017
15082
|
var defaultLabels = {
|
|
@@ -15020,6 +15085,16 @@ var defaultLabels = {
|
|
|
15020
15085
|
searchPlaceholder: "Search...",
|
|
15021
15086
|
noResultsText: "No results found"
|
|
15022
15087
|
};
|
|
15088
|
+
function getInitialExpandedNodes(categories, defaultExpanded, viewOnly, inline) {
|
|
15089
|
+
if (!(viewOnly || inline) || !defaultExpanded) return /* @__PURE__ */ new Set();
|
|
15090
|
+
const parentIds = /* @__PURE__ */ new Set();
|
|
15091
|
+
for (const category of categories) {
|
|
15092
|
+
if (typeof category.parent_id === "number") {
|
|
15093
|
+
parentIds.add(category.parent_id);
|
|
15094
|
+
}
|
|
15095
|
+
}
|
|
15096
|
+
return parentIds;
|
|
15097
|
+
}
|
|
15023
15098
|
function CategoryTreeSelect(props) {
|
|
15024
15099
|
const {
|
|
15025
15100
|
id,
|
|
@@ -15044,25 +15119,25 @@ function CategoryTreeSelect(props) {
|
|
|
15044
15119
|
useOverlayScrollbar = false,
|
|
15045
15120
|
singleSelect = false
|
|
15046
15121
|
} = props;
|
|
15047
|
-
const [isOpen, setIsOpen] = (0,
|
|
15048
|
-
const [expandedNodes, setExpandedNodes] = (0,
|
|
15049
|
-
const [query, setQuery] = (0,
|
|
15050
|
-
const searchInputRef = (0,
|
|
15051
|
-
const dropdownViewportRef = (0,
|
|
15122
|
+
const [isOpen, setIsOpen] = (0, import_react21.useState)(false);
|
|
15123
|
+
const [expandedNodes, setExpandedNodes] = (0, import_react21.useState)(() => getInitialExpandedNodes(categories, defaultExpanded, viewOnly, inline));
|
|
15124
|
+
const [query, setQuery] = (0, import_react21.useState)("");
|
|
15125
|
+
const searchInputRef = (0, import_react21.useRef)(null);
|
|
15126
|
+
const dropdownViewportRef = (0, import_react21.useRef)(null);
|
|
15052
15127
|
useOverlayScrollbarTarget(dropdownViewportRef, { enabled: useOverlayScrollbar });
|
|
15053
|
-
const autoId = (0,
|
|
15128
|
+
const autoId = (0, import_react21.useId)();
|
|
15054
15129
|
const resolvedId = id ? String(id) : `category-tree-select-${autoId}`;
|
|
15055
15130
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
15056
15131
|
const helperId = helperText && !error ? `${resolvedId}-helper` : void 0;
|
|
15057
15132
|
const errorId = error ? `${resolvedId}-error` : void 0;
|
|
15058
15133
|
const describedBy = errorId || helperId;
|
|
15059
15134
|
const mergedLabels = { ...defaultLabels, ...labels };
|
|
15060
|
-
const valueArray = (0,
|
|
15135
|
+
const valueArray = (0, import_react21.useMemo)(
|
|
15061
15136
|
() => singleSelect ? props.value != null ? [props.value] : [] : props.value ?? [],
|
|
15062
15137
|
[props.value, singleSelect]
|
|
15063
15138
|
);
|
|
15064
|
-
const selectedIds = (0,
|
|
15065
|
-
const { parentCategories, childrenMap, byId } = (0,
|
|
15139
|
+
const selectedIds = (0, import_react21.useMemo)(() => new Set(valueArray), [valueArray]);
|
|
15140
|
+
const { parentCategories, childrenMap, byId } = (0, import_react21.useMemo)(() => {
|
|
15066
15141
|
const byId2 = /* @__PURE__ */ new Map();
|
|
15067
15142
|
const childrenMap2 = /* @__PURE__ */ new Map();
|
|
15068
15143
|
const parentCategories2 = [];
|
|
@@ -15077,10 +15152,10 @@ function CategoryTreeSelect(props) {
|
|
|
15077
15152
|
}
|
|
15078
15153
|
return { parentCategories: parentCategories2, childrenMap: childrenMap2, byId: byId2 };
|
|
15079
15154
|
}, [categories]);
|
|
15080
|
-
const isSearchEnabled = (0,
|
|
15081
|
-
const normalizedQuery = (0,
|
|
15155
|
+
const isSearchEnabled = (0, import_react21.useMemo)(() => enableSearch ?? categories.length > 10, [enableSearch, categories.length]);
|
|
15156
|
+
const normalizedQuery = (0, import_react21.useMemo)(() => query.trim().toLowerCase(), [query]);
|
|
15082
15157
|
const isSearchMode = isSearchEnabled && normalizedQuery.length > 0;
|
|
15083
|
-
const visibleIds = (0,
|
|
15158
|
+
const visibleIds = (0, import_react21.useMemo)(() => {
|
|
15084
15159
|
if (!isSearchMode) return null;
|
|
15085
15160
|
const matches = categories.filter((c) => c.name.toLowerCase().includes(normalizedQuery));
|
|
15086
15161
|
if (matches.length === 0) return /* @__PURE__ */ new Set();
|
|
@@ -15119,21 +15194,12 @@ function CategoryTreeSelect(props) {
|
|
|
15119
15194
|
}
|
|
15120
15195
|
return visible;
|
|
15121
15196
|
}, [byId, categories, childrenMap, isSearchMode, normalizedQuery]);
|
|
15122
|
-
(0,
|
|
15123
|
-
if (!isOpen) setQuery("");
|
|
15124
|
-
}, [isOpen]);
|
|
15125
|
-
(0, import_react20.useEffect)(() => {
|
|
15197
|
+
(0, import_react21.useEffect)(() => {
|
|
15126
15198
|
if (!isOpen) return;
|
|
15127
15199
|
if (!isSearchEnabled) return;
|
|
15128
15200
|
const t = setTimeout(() => searchInputRef.current?.focus(), 50);
|
|
15129
15201
|
return () => clearTimeout(t);
|
|
15130
15202
|
}, [isOpen, isSearchEnabled]);
|
|
15131
|
-
(0, import_react20.useEffect)(() => {
|
|
15132
|
-
if ((viewOnly || inline) && defaultExpanded) {
|
|
15133
|
-
const allParentIds = categories.filter((c) => childrenMap.has(c.id)).map((c) => c.id);
|
|
15134
|
-
setExpandedNodes(new Set(allParentIds));
|
|
15135
|
-
}
|
|
15136
|
-
}, [viewOnly, inline, defaultExpanded, categories, childrenMap]);
|
|
15137
15203
|
const toggleExpand = (id2) => {
|
|
15138
15204
|
if (isSearchMode) return;
|
|
15139
15205
|
const newExpanded = new Set(expandedNodes);
|
|
@@ -15157,7 +15223,7 @@ function CategoryTreeSelect(props) {
|
|
|
15157
15223
|
onChange(categoryId);
|
|
15158
15224
|
}
|
|
15159
15225
|
if (!inline) {
|
|
15160
|
-
|
|
15226
|
+
handleOpenChange(false);
|
|
15161
15227
|
}
|
|
15162
15228
|
} else {
|
|
15163
15229
|
const onChange = props.onChange;
|
|
@@ -15291,21 +15357,20 @@ function CategoryTreeSelect(props) {
|
|
|
15291
15357
|
)
|
|
15292
15358
|
] }) });
|
|
15293
15359
|
};
|
|
15294
|
-
const effectiveParentCategories = (0,
|
|
15360
|
+
const effectiveParentCategories = (0, import_react21.useMemo)(() => {
|
|
15295
15361
|
if (!isSearchMode) return parentCategories;
|
|
15296
15362
|
return parentCategories.filter((c) => visibleIds?.has(c.id));
|
|
15297
15363
|
}, [isSearchMode, parentCategories, visibleIds]);
|
|
15298
|
-
|
|
15299
|
-
|
|
15300
|
-
|
|
15364
|
+
let effectiveChildrenMap = childrenMap;
|
|
15365
|
+
if (isSearchMode && visibleIds) {
|
|
15366
|
+
effectiveChildrenMap = /* @__PURE__ */ new Map();
|
|
15301
15367
|
for (const [parentId, children] of childrenMap.entries()) {
|
|
15302
|
-
|
|
15368
|
+
effectiveChildrenMap.set(
|
|
15303
15369
|
parentId,
|
|
15304
15370
|
children.filter((child) => visibleIds.has(child.id))
|
|
15305
15371
|
);
|
|
15306
15372
|
}
|
|
15307
|
-
|
|
15308
|
-
}, [childrenMap, isSearchMode, visibleIds]);
|
|
15373
|
+
}
|
|
15309
15374
|
const renderTreeContent = () => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "space-y-0.5 overflow-x-hidden", children: effectiveParentCategories.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col items-center justify-center py-8 text-center", children: [
|
|
15310
15375
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "w-12 h-12 rounded-2xl bg-muted/50 flex items-center justify-center mb-3", children: isSearchMode ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_lucide_react25.SearchX, { className: "w-6 h-6 text-muted-foreground/50" }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_lucide_react25.Layers, { className: "w-6 h-6 text-muted-foreground/50" }) }),
|
|
15311
15376
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-sm text-muted-foreground", children: isSearchMode ? mergedLabels.noResultsText : mergedLabels.emptyText })
|
|
@@ -15414,7 +15479,13 @@ function CategoryTreeSelect(props) {
|
|
|
15414
15479
|
event.preventDefault();
|
|
15415
15480
|
event.stopPropagation();
|
|
15416
15481
|
clearSelection();
|
|
15417
|
-
|
|
15482
|
+
handleOpenChange(false);
|
|
15483
|
+
};
|
|
15484
|
+
const handleOpenChange = (nextOpen) => {
|
|
15485
|
+
setIsOpen(nextOpen);
|
|
15486
|
+
if (!nextOpen) {
|
|
15487
|
+
setQuery("");
|
|
15488
|
+
}
|
|
15418
15489
|
};
|
|
15419
15490
|
let displayText;
|
|
15420
15491
|
if (singleSelect) {
|
|
@@ -15447,7 +15518,7 @@ function CategoryTreeSelect(props) {
|
|
|
15447
15518
|
Popover,
|
|
15448
15519
|
{
|
|
15449
15520
|
open: isOpen,
|
|
15450
|
-
onOpenChange:
|
|
15521
|
+
onOpenChange: handleOpenChange,
|
|
15451
15522
|
disabled,
|
|
15452
15523
|
placement: "bottom-start",
|
|
15453
15524
|
matchTriggerWidth: true,
|
|
@@ -15537,7 +15608,7 @@ function CategoryTreeSelect(props) {
|
|
|
15537
15608
|
}
|
|
15538
15609
|
|
|
15539
15610
|
// src/components/ImageUpload.tsx
|
|
15540
|
-
var
|
|
15611
|
+
var import_react22 = require("react");
|
|
15541
15612
|
var import_lucide_react26 = require("lucide-react");
|
|
15542
15613
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
15543
15614
|
function ImageUpload({
|
|
@@ -15555,10 +15626,10 @@ function ImageUpload({
|
|
|
15555
15626
|
browseText,
|
|
15556
15627
|
supportedFormatsText
|
|
15557
15628
|
}) {
|
|
15558
|
-
const [isDragging, setIsDragging] = (0,
|
|
15559
|
-
const [uploading, setUploading] = (0,
|
|
15560
|
-
const [uploadedImages, setUploadedImages] = (0,
|
|
15561
|
-
const fileInputRef = (0,
|
|
15629
|
+
const [isDragging, setIsDragging] = (0, import_react22.useState)(false);
|
|
15630
|
+
const [uploading, setUploading] = (0, import_react22.useState)(false);
|
|
15631
|
+
const [uploadedImages, setUploadedImages] = (0, import_react22.useState)([]);
|
|
15632
|
+
const fileInputRef = (0, import_react22.useRef)(null);
|
|
15562
15633
|
const { addToast } = useToast();
|
|
15563
15634
|
const t = useSmartTranslations("OCR.imageUpload");
|
|
15564
15635
|
const previewSizes = {
|
|
@@ -15566,7 +15637,7 @@ function ImageUpload({
|
|
|
15566
15637
|
md: "w-24 h-24",
|
|
15567
15638
|
lg: "w-32 h-32"
|
|
15568
15639
|
};
|
|
15569
|
-
const handleDragOver = (0,
|
|
15640
|
+
const handleDragOver = (0, import_react22.useCallback)(
|
|
15570
15641
|
(e) => {
|
|
15571
15642
|
e.preventDefault();
|
|
15572
15643
|
if (!disabled) {
|
|
@@ -15575,11 +15646,11 @@ function ImageUpload({
|
|
|
15575
15646
|
},
|
|
15576
15647
|
[disabled]
|
|
15577
15648
|
);
|
|
15578
|
-
const handleDragLeave = (0,
|
|
15649
|
+
const handleDragLeave = (0, import_react22.useCallback)((e) => {
|
|
15579
15650
|
e.preventDefault();
|
|
15580
15651
|
setIsDragging(false);
|
|
15581
15652
|
}, []);
|
|
15582
|
-
const handleFiles = (0,
|
|
15653
|
+
const handleFiles = (0, import_react22.useCallback)(
|
|
15583
15654
|
async (files) => {
|
|
15584
15655
|
if (files.length === 0) return;
|
|
15585
15656
|
const validFiles = files.filter((file) => {
|
|
@@ -15646,7 +15717,7 @@ function ImageUpload({
|
|
|
15646
15717
|
},
|
|
15647
15718
|
[maxSize, addToast, onUpload]
|
|
15648
15719
|
);
|
|
15649
|
-
const handleDrop = (0,
|
|
15720
|
+
const handleDrop = (0, import_react22.useCallback)(
|
|
15650
15721
|
(e) => {
|
|
15651
15722
|
e.preventDefault();
|
|
15652
15723
|
setIsDragging(false);
|
|
@@ -15656,7 +15727,7 @@ function ImageUpload({
|
|
|
15656
15727
|
},
|
|
15657
15728
|
[disabled, handleFiles]
|
|
15658
15729
|
);
|
|
15659
|
-
const handleFileSelect = (0,
|
|
15730
|
+
const handleFileSelect = (0, import_react22.useCallback)(
|
|
15660
15731
|
(e) => {
|
|
15661
15732
|
const files = Array.from(e.target.files || []);
|
|
15662
15733
|
handleFiles(files);
|
|
@@ -15760,7 +15831,7 @@ function ImageUpload({
|
|
|
15760
15831
|
|
|
15761
15832
|
// src/components/FileUpload.tsx
|
|
15762
15833
|
var import_lucide_react27 = require("lucide-react");
|
|
15763
|
-
var
|
|
15834
|
+
var import_react23 = require("react");
|
|
15764
15835
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
15765
15836
|
var formatFileSize = (bytes) => {
|
|
15766
15837
|
if (bytes === 0) return "0 Bytes";
|
|
@@ -15867,12 +15938,12 @@ function FileUpload({
|
|
|
15867
15938
|
allowPreview = true,
|
|
15868
15939
|
initialFiles = []
|
|
15869
15940
|
}) {
|
|
15870
|
-
const [isDragging, setIsDragging] = (0,
|
|
15871
|
-
const [files, setFiles] = (0,
|
|
15872
|
-
const fileInputRef = (0,
|
|
15941
|
+
const [isDragging, setIsDragging] = (0, import_react23.useState)(false);
|
|
15942
|
+
const [files, setFiles] = (0, import_react23.useState)(initialFiles);
|
|
15943
|
+
const fileInputRef = (0, import_react23.useRef)(null);
|
|
15873
15944
|
const { addToast } = useToast();
|
|
15874
15945
|
const t = useSmartTranslations("FileUpload");
|
|
15875
|
-
const sizeConfig = (0,
|
|
15946
|
+
const sizeConfig = (0, import_react23.useMemo)(
|
|
15876
15947
|
() => ({
|
|
15877
15948
|
sm: {
|
|
15878
15949
|
padding: "p-4",
|
|
@@ -15905,7 +15976,7 @@ function FileUpload({
|
|
|
15905
15976
|
[]
|
|
15906
15977
|
);
|
|
15907
15978
|
const currentSize = sizeConfig[size];
|
|
15908
|
-
const handleDragOver = (0,
|
|
15979
|
+
const handleDragOver = (0, import_react23.useCallback)(
|
|
15909
15980
|
(e) => {
|
|
15910
15981
|
e.preventDefault();
|
|
15911
15982
|
e.stopPropagation();
|
|
@@ -15915,12 +15986,12 @@ function FileUpload({
|
|
|
15915
15986
|
},
|
|
15916
15987
|
[disabled]
|
|
15917
15988
|
);
|
|
15918
|
-
const handleDragLeave = (0,
|
|
15989
|
+
const handleDragLeave = (0, import_react23.useCallback)((e) => {
|
|
15919
15990
|
e.preventDefault();
|
|
15920
15991
|
e.stopPropagation();
|
|
15921
15992
|
setIsDragging(false);
|
|
15922
15993
|
}, []);
|
|
15923
|
-
const processFiles = (0,
|
|
15994
|
+
const processFiles = (0, import_react23.useCallback)(
|
|
15924
15995
|
async (fileList) => {
|
|
15925
15996
|
if (fileList.length === 0) return;
|
|
15926
15997
|
const remainingSlots = maxFiles - files.length;
|
|
@@ -15993,7 +16064,7 @@ function FileUpload({
|
|
|
15993
16064
|
},
|
|
15994
16065
|
[files, maxFiles, maxSize, uploadHandler, onUpload, onChange, addToast, t]
|
|
15995
16066
|
);
|
|
15996
|
-
const handleDrop = (0,
|
|
16067
|
+
const handleDrop = (0, import_react23.useCallback)(
|
|
15997
16068
|
(e) => {
|
|
15998
16069
|
e.preventDefault();
|
|
15999
16070
|
e.stopPropagation();
|
|
@@ -16004,7 +16075,7 @@ function FileUpload({
|
|
|
16004
16075
|
},
|
|
16005
16076
|
[disabled, processFiles]
|
|
16006
16077
|
);
|
|
16007
|
-
const handleFileSelect = (0,
|
|
16078
|
+
const handleFileSelect = (0, import_react23.useCallback)(
|
|
16008
16079
|
(e) => {
|
|
16009
16080
|
const selectedFiles = Array.from(e.target.files || []);
|
|
16010
16081
|
processFiles(selectedFiles);
|
|
@@ -16014,7 +16085,7 @@ function FileUpload({
|
|
|
16014
16085
|
},
|
|
16015
16086
|
[processFiles]
|
|
16016
16087
|
);
|
|
16017
|
-
const handleRemove = (0,
|
|
16088
|
+
const handleRemove = (0, import_react23.useCallback)(
|
|
16018
16089
|
(fileId) => {
|
|
16019
16090
|
setFiles((prev) => {
|
|
16020
16091
|
const fileToRemove = prev.find((f) => f.id === fileId);
|
|
@@ -16032,7 +16103,7 @@ function FileUpload({
|
|
|
16032
16103
|
const handleBrowseClick = () => {
|
|
16033
16104
|
fileInputRef.current?.click();
|
|
16034
16105
|
};
|
|
16035
|
-
const handleRetry = (0,
|
|
16106
|
+
const handleRetry = (0, import_react23.useCallback)(
|
|
16036
16107
|
(fileEntry) => {
|
|
16037
16108
|
if (!uploadHandler || !fileEntry.file) return;
|
|
16038
16109
|
processFiles([fileEntry.file]);
|
|
@@ -16558,7 +16629,7 @@ function Carousel({
|
|
|
16558
16629
|
}
|
|
16559
16630
|
|
|
16560
16631
|
// src/components/FallingIcons.tsx
|
|
16561
|
-
var
|
|
16632
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
16562
16633
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
16563
16634
|
var DEFAULT_COUNT = 24;
|
|
16564
16635
|
var DEFAULT_SPEED_RANGE = [6, 14];
|
|
@@ -16586,10 +16657,10 @@ function FallingIcons({
|
|
|
16586
16657
|
physics,
|
|
16587
16658
|
easingFunction = "linear"
|
|
16588
16659
|
}) {
|
|
16589
|
-
const uid =
|
|
16590
|
-
const containerRef =
|
|
16591
|
-
const [fallDist, setFallDist] =
|
|
16592
|
-
const idRef =
|
|
16660
|
+
const uid = import_react24.default.useId().replace(/[:]/g, "");
|
|
16661
|
+
const containerRef = import_react24.default.useRef(null);
|
|
16662
|
+
const [fallDist, setFallDist] = import_react24.default.useState(null);
|
|
16663
|
+
const idRef = import_react24.default.useRef(1);
|
|
16593
16664
|
const gravity = physics?.gravity ?? 1;
|
|
16594
16665
|
const windDirection = physics?.windDirection ?? 0;
|
|
16595
16666
|
const windStrength = physics?.windStrength ?? 0;
|
|
@@ -16603,7 +16674,7 @@ function FallingIcons({
|
|
|
16603
16674
|
bounce: "cubic-bezier(0.68, -0.55, 0.265, 1.55)",
|
|
16604
16675
|
elastic: "cubic-bezier(0.175, 0.885, 0.32, 1.275)"
|
|
16605
16676
|
};
|
|
16606
|
-
const makeParticle =
|
|
16677
|
+
const makeParticle = import_react24.default.useCallback(() => {
|
|
16607
16678
|
const rnd = (min, max) => min + Math.random() * (max - min);
|
|
16608
16679
|
return {
|
|
16609
16680
|
leftPct: rnd(0, 100),
|
|
@@ -16617,12 +16688,12 @@ function FallingIcons({
|
|
|
16617
16688
|
key: idRef.current++
|
|
16618
16689
|
};
|
|
16619
16690
|
}, [sizeRange, speedRange, horizontalDrift, gravity, windDirection, windStrength]);
|
|
16620
|
-
const [particles, setParticles] =
|
|
16621
|
-
|
|
16691
|
+
const [particles, setParticles] = import_react24.default.useState([]);
|
|
16692
|
+
import_react24.default.useEffect(() => {
|
|
16622
16693
|
const arr = Array.from({ length: Math.max(0, count) }).map(() => makeParticle());
|
|
16623
16694
|
setParticles(arr);
|
|
16624
16695
|
}, [count, makeParticle]);
|
|
16625
|
-
|
|
16696
|
+
import_react24.default.useEffect(() => {
|
|
16626
16697
|
if (fullScreen) {
|
|
16627
16698
|
const measure2 = () => setFallDist(window.innerHeight + 200);
|
|
16628
16699
|
measure2();
|
|
@@ -16647,14 +16718,14 @@ function FallingIcons({
|
|
|
16647
16718
|
const SpinName = `uv-spin-${uid}`;
|
|
16648
16719
|
const PopName = `uv-pop-${uid}`;
|
|
16649
16720
|
const PhysicsSpinName = `uv-physics-spin-${uid}`;
|
|
16650
|
-
const glowStyles =
|
|
16721
|
+
const glowStyles = import_react24.default.useMemo(() => {
|
|
16651
16722
|
if (!glow) return {};
|
|
16652
16723
|
const intensity = Math.max(0, Math.min(1, glowIntensity));
|
|
16653
16724
|
return {
|
|
16654
16725
|
filter: `drop-shadow(0 0 ${4 * intensity}px ${glowColor}) drop-shadow(0 0 ${8 * intensity}px ${glowColor})`
|
|
16655
16726
|
};
|
|
16656
16727
|
}, [glow, glowColor, glowIntensity]);
|
|
16657
|
-
const FallbackIcon =
|
|
16728
|
+
const FallbackIcon = import_react24.default.useMemo(
|
|
16658
16729
|
() => function FallingIconsFallbackIcon(props) {
|
|
16659
16730
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("circle", { cx: "12", cy: "12", r: "10" }) });
|
|
16660
16731
|
},
|
|
@@ -16716,7 +16787,7 @@ function FallingIcons({
|
|
|
16716
16787
|
});
|
|
16717
16788
|
};
|
|
16718
16789
|
const trailParticles = trail ? Array.from({ length: Math.min(5, Math.max(1, trailLength)) }) : [];
|
|
16719
|
-
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
16790
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_react24.default.Fragment, { children: [
|
|
16720
16791
|
trail && trailParticles.map((_, trailIndex) => {
|
|
16721
16792
|
const trailDelay = p.delay - (trailIndex + 1) * 0.15;
|
|
16722
16793
|
const trailOpacity = 1 - (trailIndex + 1) * (1 / (trailParticles.length + 1));
|
|
@@ -18123,7 +18194,7 @@ function ColorPicker({
|
|
|
18123
18194
|
}
|
|
18124
18195
|
|
|
18125
18196
|
// src/components/MusicPlayer.tsx
|
|
18126
|
-
var
|
|
18197
|
+
var import_react25 = require("react");
|
|
18127
18198
|
var import_lucide_react32 = require("lucide-react");
|
|
18128
18199
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
18129
18200
|
var DEFAULT_PLAYLIST = [
|
|
@@ -18244,21 +18315,21 @@ var MusicPlayer = ({
|
|
|
18244
18315
|
showPlaylist: initialShowPlaylist = true,
|
|
18245
18316
|
className = ""
|
|
18246
18317
|
}) => {
|
|
18247
|
-
const [currentSongIndex, setCurrentSongIndex] = (0,
|
|
18248
|
-
const [isPlaying, setIsPlaying] = (0,
|
|
18249
|
-
const [currentTime, setCurrentTime] = (0,
|
|
18250
|
-
const [duration, setDuration] = (0,
|
|
18251
|
-
const [volume, setVolume] = (0,
|
|
18252
|
-
const [isMuted, setIsMuted] = (0,
|
|
18253
|
-
const [showPlaylist, setShowPlaylist] = (0,
|
|
18254
|
-
const audioRef = (0,
|
|
18318
|
+
const [currentSongIndex, setCurrentSongIndex] = (0, import_react25.useState)(0);
|
|
18319
|
+
const [isPlaying, setIsPlaying] = (0, import_react25.useState)(false);
|
|
18320
|
+
const [currentTime, setCurrentTime] = (0, import_react25.useState)(0);
|
|
18321
|
+
const [duration, setDuration] = (0, import_react25.useState)(0);
|
|
18322
|
+
const [volume, setVolume] = (0, import_react25.useState)(1);
|
|
18323
|
+
const [isMuted, setIsMuted] = (0, import_react25.useState)(false);
|
|
18324
|
+
const [showPlaylist, setShowPlaylist] = (0, import_react25.useState)(initialShowPlaylist);
|
|
18325
|
+
const audioRef = (0, import_react25.useRef)(null);
|
|
18255
18326
|
const currentSong = playlist[currentSongIndex];
|
|
18256
|
-
(0,
|
|
18327
|
+
(0, import_react25.useEffect)(() => {
|
|
18257
18328
|
if (audioRef.current) {
|
|
18258
18329
|
audioRef.current.volume = volume;
|
|
18259
18330
|
}
|
|
18260
18331
|
}, [volume]);
|
|
18261
|
-
(0,
|
|
18332
|
+
(0, import_react25.useEffect)(() => {
|
|
18262
18333
|
if (autoPlay && audioRef.current) {
|
|
18263
18334
|
audioRef.current.play().catch(() => {
|
|
18264
18335
|
setIsPlaying(false);
|
|
@@ -18334,7 +18405,7 @@ var MusicPlayer = ({
|
|
|
18334
18405
|
setCurrentSongIndex(index);
|
|
18335
18406
|
setIsPlaying(true);
|
|
18336
18407
|
};
|
|
18337
|
-
(0,
|
|
18408
|
+
(0, import_react25.useEffect)(() => {
|
|
18338
18409
|
if (audioRef.current) {
|
|
18339
18410
|
if (currentSong.startTime !== void 0) {
|
|
18340
18411
|
audioRef.current.currentTime = currentSong.startTime;
|
|
@@ -18476,7 +18547,7 @@ var MusicPlayer = ({
|
|
|
18476
18547
|
var MusicPlayer_default = MusicPlayer;
|
|
18477
18548
|
|
|
18478
18549
|
// src/components/Grid.tsx
|
|
18479
|
-
var
|
|
18550
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
18480
18551
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
18481
18552
|
var BP_MIN = {
|
|
18482
18553
|
sm: 640,
|
|
@@ -18516,7 +18587,7 @@ function getVariantClasses(variant = "default", outlined) {
|
|
|
18516
18587
|
};
|
|
18517
18588
|
return variants[variant] || "";
|
|
18518
18589
|
}
|
|
18519
|
-
var GridRoot =
|
|
18590
|
+
var GridRoot = import_react26.default.forwardRef(
|
|
18520
18591
|
({
|
|
18521
18592
|
columns,
|
|
18522
18593
|
rows,
|
|
@@ -18541,7 +18612,7 @@ var GridRoot = import_react25.default.forwardRef(
|
|
|
18541
18612
|
children,
|
|
18542
18613
|
...rest
|
|
18543
18614
|
}, ref) => {
|
|
18544
|
-
const id = (0,
|
|
18615
|
+
const id = (0, import_react26.useId)().replace(/[:]/g, "");
|
|
18545
18616
|
const baseClass = `uv-grid-${id}`;
|
|
18546
18617
|
const baseCols = toTemplateCols(columns, minColumnWidth);
|
|
18547
18618
|
const baseRows = toTemplateRows(rows);
|
|
@@ -18600,7 +18671,7 @@ var GridRoot = import_react25.default.forwardRef(
|
|
|
18600
18671
|
}
|
|
18601
18672
|
);
|
|
18602
18673
|
GridRoot.displayName = "Grid";
|
|
18603
|
-
var GridItem =
|
|
18674
|
+
var GridItem = import_react26.default.forwardRef(
|
|
18604
18675
|
({
|
|
18605
18676
|
colSpan,
|
|
18606
18677
|
rowSpan,
|
|
@@ -18664,13 +18735,9 @@ var Grid = Object.assign(GridRoot, { Item: GridItem });
|
|
|
18664
18735
|
var Grid_default = Grid;
|
|
18665
18736
|
|
|
18666
18737
|
// src/components/ClientOnly.tsx
|
|
18667
|
-
var import_react26 = require("react");
|
|
18668
18738
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
18669
18739
|
function ClientOnly({ children, fallback = null }) {
|
|
18670
|
-
const
|
|
18671
|
-
(0, import_react26.useEffect)(() => {
|
|
18672
|
-
setHasMounted(true);
|
|
18673
|
-
}, []);
|
|
18740
|
+
const hasMounted = useHydrated();
|
|
18674
18741
|
if (!hasMounted) {
|
|
18675
18742
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children: fallback });
|
|
18676
18743
|
}
|
|
@@ -18773,7 +18840,7 @@ var TABLE_CONTAINER_BASE_CLASS = [
|
|
|
18773
18840
|
"bg-card text-card-foreground shadow-sm",
|
|
18774
18841
|
"backdrop-blur-sm transition-all duration-300"
|
|
18775
18842
|
].join(" ");
|
|
18776
|
-
function
|
|
18843
|
+
function assignRef(ref, value) {
|
|
18777
18844
|
if (typeof ref === "function") {
|
|
18778
18845
|
ref(value);
|
|
18779
18846
|
return;
|
|
@@ -18790,7 +18857,7 @@ var TableContainer = import_react27.default.forwardRef(({ className, useOverlayS
|
|
|
18790
18857
|
{
|
|
18791
18858
|
ref: (node) => {
|
|
18792
18859
|
containerRef.current = node;
|
|
18793
|
-
|
|
18860
|
+
assignRef(ref, node);
|
|
18794
18861
|
},
|
|
18795
18862
|
className: cn(TABLE_CONTAINER_BASE_CLASS, className),
|
|
18796
18863
|
...props
|
|
@@ -19542,39 +19609,40 @@ var import_react34 = __toESM(require("react"), 1);
|
|
|
19542
19609
|
|
|
19543
19610
|
// src/components/DataTable/hooks/usePageSizeStorage.ts
|
|
19544
19611
|
var import_react33 = __toESM(require("react"), 1);
|
|
19612
|
+
function readStoredPageSize(storageKey) {
|
|
19613
|
+
if (typeof window === "undefined" || !storageKey) return null;
|
|
19614
|
+
try {
|
|
19615
|
+
const saved = localStorage.getItem(`datatable_${storageKey}_pageSize`);
|
|
19616
|
+
if (!saved) return null;
|
|
19617
|
+
const parsed = parseInt(saved, 10);
|
|
19618
|
+
return !isNaN(parsed) && parsed > 0 ? parsed : null;
|
|
19619
|
+
} catch {
|
|
19620
|
+
return null;
|
|
19621
|
+
}
|
|
19622
|
+
}
|
|
19545
19623
|
function usePageSizeStorage({ pageSize, storageKey }) {
|
|
19546
|
-
const
|
|
19547
|
-
const [
|
|
19548
|
-
|
|
19549
|
-
|
|
19550
|
-
const saved = localStorage.getItem(`datatable_${storageKey}_pageSize`);
|
|
19551
|
-
if (saved) {
|
|
19552
|
-
const parsed = parseInt(saved, 10);
|
|
19553
|
-
if (!isNaN(parsed) && parsed > 0) {
|
|
19554
|
-
loadedFromStorage.current = true;
|
|
19555
|
-
return parsed;
|
|
19556
|
-
}
|
|
19557
|
-
}
|
|
19558
|
-
} catch {
|
|
19559
|
-
}
|
|
19560
|
-
return pageSize;
|
|
19624
|
+
const storedPageSize = import_react33.default.useMemo(() => readStoredPageSize(storageKey), [storageKey]);
|
|
19625
|
+
const [overrideState, setOverrideState] = import_react33.default.useState({
|
|
19626
|
+
storageKey,
|
|
19627
|
+
pageSize: null
|
|
19561
19628
|
});
|
|
19562
|
-
const
|
|
19563
|
-
|
|
19564
|
-
|
|
19565
|
-
|
|
19566
|
-
import_react33.default.
|
|
19567
|
-
|
|
19568
|
-
|
|
19569
|
-
|
|
19570
|
-
|
|
19571
|
-
|
|
19572
|
-
|
|
19573
|
-
|
|
19574
|
-
|
|
19575
|
-
|
|
19576
|
-
|
|
19577
|
-
|
|
19629
|
+
const overridePageSize = overrideState.storageKey === storageKey ? overrideState.pageSize : null;
|
|
19630
|
+
const persistedPageSize = storageKey ? overridePageSize ?? storedPageSize : null;
|
|
19631
|
+
const loadedFromStorage = persistedPageSize != null;
|
|
19632
|
+
const curPageSize = storageKey ? persistedPageSize ?? pageSize : overridePageSize ?? pageSize;
|
|
19633
|
+
const setCurPageSize = import_react33.default.useCallback(
|
|
19634
|
+
(nextPageSize) => {
|
|
19635
|
+
const baseValue = storageKey ? persistedPageSize ?? pageSize : overridePageSize ?? pageSize;
|
|
19636
|
+
const resolved = typeof nextPageSize === "function" ? nextPageSize(baseValue) : nextPageSize;
|
|
19637
|
+
setOverrideState({ storageKey, pageSize: resolved });
|
|
19638
|
+
if (!storageKey || typeof window === "undefined") return;
|
|
19639
|
+
try {
|
|
19640
|
+
localStorage.setItem(`datatable_${storageKey}_pageSize`, String(resolved));
|
|
19641
|
+
} catch {
|
|
19642
|
+
}
|
|
19643
|
+
},
|
|
19644
|
+
[overridePageSize, pageSize, persistedPageSize, storageKey]
|
|
19645
|
+
);
|
|
19578
19646
|
return { curPageSize, setCurPageSize, loadedFromStorage };
|
|
19579
19647
|
}
|
|
19580
19648
|
|
|
@@ -20247,16 +20315,15 @@ function ThemeToggleHeadless({
|
|
|
20247
20315
|
className
|
|
20248
20316
|
}) {
|
|
20249
20317
|
const [isOpen, setIsOpen] = (0, import_react37.useState)(false);
|
|
20250
|
-
const
|
|
20318
|
+
const isHydrated = useHydrated();
|
|
20251
20319
|
const triggerRef = (0, import_react37.useRef)(null);
|
|
20252
20320
|
const [dropdownPosition, setDropdownPosition] = (0, import_react37.useState)(null);
|
|
20253
|
-
(0, import_react37.useEffect)(() => setMounted(true), []);
|
|
20254
20321
|
const themes = [
|
|
20255
20322
|
{ value: "light", label: labels?.light ?? "Light", icon: import_lucide_react37.Sun },
|
|
20256
20323
|
{ value: "dark", label: labels?.dark ?? "Dark", icon: import_lucide_react37.Moon },
|
|
20257
20324
|
{ value: "system", label: labels?.system ?? "System", icon: import_lucide_react37.Monitor }
|
|
20258
20325
|
];
|
|
20259
|
-
const current =
|
|
20326
|
+
const current = isHydrated ? themes.find((t) => t.value === theme) || themes[2] : themes[2];
|
|
20260
20327
|
const CurrentIcon = current.icon;
|
|
20261
20328
|
const calculatePosition = () => {
|
|
20262
20329
|
const rect = triggerRef.current?.getBoundingClientRect();
|
|
@@ -20931,7 +20998,7 @@ var import_lowlight = require("lowlight");
|
|
|
20931
20998
|
var import_core = require("@tiptap/core");
|
|
20932
20999
|
var import_suggestion = __toESM(require("@tiptap/suggestion"), 1);
|
|
20933
21000
|
var import_react39 = require("@tiptap/react");
|
|
20934
|
-
var import_react40 = require("react");
|
|
21001
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
20935
21002
|
var import_lucide_react39 = require("lucide-react");
|
|
20936
21003
|
var import_tippy = __toESM(require("tippy.js"), 1);
|
|
20937
21004
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
@@ -20961,12 +21028,23 @@ var DEFAULT_MESSAGES = {
|
|
|
20961
21028
|
table: "Table",
|
|
20962
21029
|
tableDesc: "Insert a table"
|
|
20963
21030
|
};
|
|
21031
|
+
function useResettingIndex2(resetToken) {
|
|
21032
|
+
const [state, setState] = import_react40.default.useState({ resetToken, index: 0 });
|
|
21033
|
+
const selectedIndex = Object.is(state.resetToken, resetToken) ? state.index : 0;
|
|
21034
|
+
const setSelectedIndex = import_react40.default.useCallback((nextIndex) => {
|
|
21035
|
+
setState((prev) => {
|
|
21036
|
+
const prevIndex = Object.is(prev.resetToken, resetToken) ? prev.index : 0;
|
|
21037
|
+
return {
|
|
21038
|
+
resetToken,
|
|
21039
|
+
index: typeof nextIndex === "function" ? nextIndex(prevIndex) : nextIndex
|
|
21040
|
+
};
|
|
21041
|
+
});
|
|
21042
|
+
}, [resetToken]);
|
|
21043
|
+
return [selectedIndex, setSelectedIndex];
|
|
21044
|
+
}
|
|
20964
21045
|
var CommandList = (0, import_react40.forwardRef)((props, ref) => {
|
|
20965
|
-
const [selectedIndex, setSelectedIndex] = (
|
|
21046
|
+
const [selectedIndex, setSelectedIndex] = useResettingIndex2(props.items);
|
|
20966
21047
|
const listRef = (0, import_react40.useRef)(null);
|
|
20967
|
-
(0, import_react40.useEffect)(() => {
|
|
20968
|
-
setSelectedIndex(0);
|
|
20969
|
-
}, [props.items]);
|
|
20970
21048
|
(0, import_react40.useEffect)(() => {
|
|
20971
21049
|
const selectedElement = listRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
20972
21050
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
@@ -21292,7 +21370,7 @@ var import_core3 = require("@tiptap/core");
|
|
|
21292
21370
|
var import_suggestion2 = __toESM(require("@tiptap/suggestion"), 1);
|
|
21293
21371
|
var import_react41 = require("@tiptap/react");
|
|
21294
21372
|
var import_state2 = require("@tiptap/pm/state");
|
|
21295
|
-
var import_react42 = require("react");
|
|
21373
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
21296
21374
|
var import_lucide_react40 = require("lucide-react");
|
|
21297
21375
|
var import_tippy2 = __toESM(require("tippy.js"), 1);
|
|
21298
21376
|
|
|
@@ -22063,11 +22141,22 @@ var EMOJI_LIST = [
|
|
|
22063
22141
|
|
|
22064
22142
|
// src/components/UEditor/emoji-suggestion.tsx
|
|
22065
22143
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
22144
|
+
function useResettingIndex3(resetToken) {
|
|
22145
|
+
const [state, setState] = import_react42.default.useState({ resetToken, index: 0 });
|
|
22146
|
+
const selectedIndex = Object.is(state.resetToken, resetToken) ? state.index : 0;
|
|
22147
|
+
const setSelectedIndex = import_react42.default.useCallback((nextIndex) => {
|
|
22148
|
+
setState((prev) => {
|
|
22149
|
+
const prevIndex = Object.is(prev.resetToken, resetToken) ? prev.index : 0;
|
|
22150
|
+
return {
|
|
22151
|
+
resetToken,
|
|
22152
|
+
index: typeof nextIndex === "function" ? nextIndex(prevIndex) : nextIndex
|
|
22153
|
+
};
|
|
22154
|
+
});
|
|
22155
|
+
}, [resetToken]);
|
|
22156
|
+
return [selectedIndex, setSelectedIndex];
|
|
22157
|
+
}
|
|
22066
22158
|
var EmojiList = (0, import_react42.forwardRef)((props, ref) => {
|
|
22067
|
-
const [selectedIndex, setSelectedIndex] = (
|
|
22068
|
-
(0, import_react42.useEffect)(() => {
|
|
22069
|
-
setSelectedIndex(0);
|
|
22070
|
-
}, [props.items]);
|
|
22159
|
+
const [selectedIndex, setSelectedIndex] = useResettingIndex3(props.items);
|
|
22071
22160
|
(0, import_react42.useImperativeHandle)(ref, () => ({
|
|
22072
22161
|
onKeyDown: ({ event }) => {
|
|
22073
22162
|
if (event.key === "ArrowUp") {
|
|
@@ -23481,13 +23570,27 @@ var EditorToolbar = ({
|
|
|
23481
23570
|
};
|
|
23482
23571
|
|
|
23483
23572
|
// src/components/UEditor/menus.tsx
|
|
23484
|
-
var import_react49 = require("react");
|
|
23573
|
+
var import_react49 = __toESM(require("react"), 1);
|
|
23485
23574
|
var import_react_dom8 = require("react-dom");
|
|
23486
23575
|
var import_lucide_react45 = require("lucide-react");
|
|
23487
23576
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
23577
|
+
function useResettingIndex4(resetToken) {
|
|
23578
|
+
const [state, setState] = import_react49.default.useState({ resetToken, index: 0 });
|
|
23579
|
+
const selectedIndex = Object.is(state.resetToken, resetToken) ? state.index : 0;
|
|
23580
|
+
const setSelectedIndex = import_react49.default.useCallback((nextIndex) => {
|
|
23581
|
+
setState((prev) => {
|
|
23582
|
+
const prevIndex = Object.is(prev.resetToken, resetToken) ? prev.index : 0;
|
|
23583
|
+
return {
|
|
23584
|
+
resetToken,
|
|
23585
|
+
index: typeof nextIndex === "function" ? nextIndex(prevIndex) : nextIndex
|
|
23586
|
+
};
|
|
23587
|
+
});
|
|
23588
|
+
}, [resetToken]);
|
|
23589
|
+
return [selectedIndex, setSelectedIndex];
|
|
23590
|
+
}
|
|
23488
23591
|
var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
23489
23592
|
const t = useSmartTranslations("UEditor");
|
|
23490
|
-
const [selectedIndex, setSelectedIndex] = (
|
|
23593
|
+
const [selectedIndex, setSelectedIndex] = useResettingIndex4(filterText);
|
|
23491
23594
|
const menuRef = (0, import_react49.useRef)(null);
|
|
23492
23595
|
const allCommands = (0, import_react49.useMemo)(
|
|
23493
23596
|
() => [
|
|
@@ -23565,13 +23668,10 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
23565
23668
|
const lowerFilter = filterText.toLowerCase();
|
|
23566
23669
|
return allCommands.filter((cmd) => cmd.label.toLowerCase().includes(lowerFilter) || cmd.description.toLowerCase().includes(lowerFilter));
|
|
23567
23670
|
}, [allCommands, filterText]);
|
|
23568
|
-
(0, import_react49.useEffect)(() => {
|
|
23569
|
-
setSelectedIndex(0);
|
|
23570
|
-
}, [filterText]);
|
|
23571
23671
|
(0, import_react49.useEffect)(() => {
|
|
23572
23672
|
const selectedElement = menuRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
23573
23673
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
23574
|
-
}, [selectedIndex]);
|
|
23674
|
+
}, [commands, selectedIndex, setSelectedIndex]);
|
|
23575
23675
|
const selectCommand = (0, import_react49.useCallback)(
|
|
23576
23676
|
(index) => {
|
|
23577
23677
|
const command = commands[index];
|
|
@@ -23601,7 +23701,7 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
23601
23701
|
};
|
|
23602
23702
|
document.addEventListener("keydown", handleKeyDown);
|
|
23603
23703
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
23604
|
-
}, [commands,
|
|
23704
|
+
}, [commands, onClose, selectCommand, selectedIndex, setSelectedIndex]);
|
|
23605
23705
|
if (commands.length === 0) {
|
|
23606
23706
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "w-72 p-4 text-center text-muted-foreground text-sm", children: t("slashCommand.noResults") });
|
|
23607
23707
|
}
|