@underverse-ui/underverse 1.0.59 → 1.0.60
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 +444 -339
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +379 -274
- 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;
|
|
@@ -3823,6 +3822,18 @@ var Toast_default = ToastProvider;
|
|
|
3823
3822
|
// src/components/Tooltip.tsx
|
|
3824
3823
|
var React14 = __toESM(require("react"), 1);
|
|
3825
3824
|
var import_react_dom2 = require("react-dom");
|
|
3825
|
+
|
|
3826
|
+
// src/hooks/useHydrated.ts
|
|
3827
|
+
var import_react8 = require("react");
|
|
3828
|
+
var subscribe = () => () => {
|
|
3829
|
+
};
|
|
3830
|
+
var getSnapshot = () => true;
|
|
3831
|
+
var getServerSnapshot = () => false;
|
|
3832
|
+
function useHydrated() {
|
|
3833
|
+
return (0, import_react8.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
3834
|
+
}
|
|
3835
|
+
|
|
3836
|
+
// src/components/Tooltip.tsx
|
|
3826
3837
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3827
3838
|
var variantStyles3 = {
|
|
3828
3839
|
default: "bg-popover text-popover-foreground border-border/50",
|
|
@@ -3831,17 +3842,6 @@ var variantStyles3 = {
|
|
|
3831
3842
|
error: "bg-destructive text-destructive-foreground border-destructive/20",
|
|
3832
3843
|
success: "bg-success text-success-foreground border-success/20"
|
|
3833
3844
|
};
|
|
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
3845
|
var clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
3846
3846
|
function getTransformOrigin(side) {
|
|
3847
3847
|
switch (side) {
|
|
@@ -3897,19 +3897,24 @@ var Tooltip = ({
|
|
|
3897
3897
|
variant = "default"
|
|
3898
3898
|
}) => {
|
|
3899
3899
|
const [isOpen, setIsOpen] = React14.useState(false);
|
|
3900
|
-
const
|
|
3900
|
+
const isMounted = useHydrated();
|
|
3901
3901
|
const triggerRef = React14.useRef(null);
|
|
3902
3902
|
const positionerRef = React14.useRef(null);
|
|
3903
3903
|
const panelRef = React14.useRef(null);
|
|
3904
3904
|
const timeoutRef = React14.useRef(void 0);
|
|
3905
3905
|
const lastAppliedRef = React14.useRef(null);
|
|
3906
|
-
React14.
|
|
3907
|
-
setIsMounted(true);
|
|
3908
|
-
}, []);
|
|
3906
|
+
const triggerSelector = React14.useId();
|
|
3909
3907
|
const delayOpen = typeof delay === "object" ? delay.open || 700 : delay;
|
|
3910
3908
|
const delayClose = typeof delay === "object" ? delay.close || 300 : delay;
|
|
3911
3909
|
const offset = 8;
|
|
3912
3910
|
const padding = 8;
|
|
3911
|
+
React14.useLayoutEffect(() => {
|
|
3912
|
+
if (typeof document === "undefined") return;
|
|
3913
|
+
const triggerEl = document.querySelector(`[data-underverse-tooltip-trigger="${triggerSelector}"]`);
|
|
3914
|
+
if (triggerEl) {
|
|
3915
|
+
triggerRef.current = triggerEl;
|
|
3916
|
+
}
|
|
3917
|
+
}, [children, triggerSelector]);
|
|
3913
3918
|
const updatePosition = React14.useCallback(() => {
|
|
3914
3919
|
const triggerEl = triggerRef.current;
|
|
3915
3920
|
const positionerEl = positionerRef.current;
|
|
@@ -4009,28 +4014,36 @@ var Tooltip = ({
|
|
|
4009
4014
|
return children;
|
|
4010
4015
|
}
|
|
4011
4016
|
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
|
-
|
|
4017
|
+
(() => {
|
|
4018
|
+
const TriggerComponent = children.type;
|
|
4019
|
+
const triggerProps = children.props;
|
|
4020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4021
|
+
TriggerComponent,
|
|
4022
|
+
{
|
|
4023
|
+
...triggerProps,
|
|
4024
|
+
"data-underverse-tooltip-trigger": triggerSelector,
|
|
4025
|
+
onMouseEnter: (e) => {
|
|
4026
|
+
triggerRef.current = e.currentTarget;
|
|
4027
|
+
handleMouseEnter();
|
|
4028
|
+
if (typeof triggerProps.onMouseEnter === "function") triggerProps.onMouseEnter(e);
|
|
4029
|
+
},
|
|
4030
|
+
onMouseLeave: (e) => {
|
|
4031
|
+
triggerRef.current = e.currentTarget;
|
|
4032
|
+
handleMouseLeave();
|
|
4033
|
+
if (typeof triggerProps.onMouseLeave === "function") triggerProps.onMouseLeave(e);
|
|
4034
|
+
},
|
|
4035
|
+
onFocus: (e) => {
|
|
4036
|
+
triggerRef.current = e.currentTarget;
|
|
4037
|
+
handleFocus();
|
|
4038
|
+
if (typeof triggerProps.onFocus === "function") triggerProps.onFocus(e);
|
|
4039
|
+
},
|
|
4040
|
+
onBlur: (e) => {
|
|
4041
|
+
handleBlur();
|
|
4042
|
+
if (typeof triggerProps.onBlur === "function") triggerProps.onBlur(e);
|
|
4043
|
+
}
|
|
4044
|
+
}
|
|
4045
|
+
);
|
|
4046
|
+
})(),
|
|
4034
4047
|
isMounted && isOpen && (0, import_react_dom2.createPortal)(
|
|
4035
4048
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4036
4049
|
"div",
|
|
@@ -4077,7 +4090,7 @@ var React15 = __toESM(require("react"), 1);
|
|
|
4077
4090
|
var import_react_dom3 = require("react-dom");
|
|
4078
4091
|
|
|
4079
4092
|
// src/utils/animations.ts
|
|
4080
|
-
var
|
|
4093
|
+
var import_react9 = require("react");
|
|
4081
4094
|
var shadcnAnimationStyles = `
|
|
4082
4095
|
/* ============================================
|
|
4083
4096
|
* DROPDOWN / POPOVER ANIMATIONS
|
|
@@ -4255,7 +4268,7 @@ function ensureAnimationStylesInjected() {
|
|
|
4255
4268
|
}
|
|
4256
4269
|
}
|
|
4257
4270
|
function useShadCNAnimations() {
|
|
4258
|
-
(0,
|
|
4271
|
+
(0, import_react9.useEffect)(() => {
|
|
4259
4272
|
ensureAnimationStylesInjected();
|
|
4260
4273
|
}, []);
|
|
4261
4274
|
}
|
|
@@ -4268,17 +4281,6 @@ function getAnimationStyles() {
|
|
|
4268
4281
|
|
|
4269
4282
|
// src/components/Popover.tsx
|
|
4270
4283
|
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
4284
|
function getTransformOrigin2(side, align) {
|
|
4283
4285
|
if (side === "top") return `${align === "end" ? "right" : "left"} bottom`;
|
|
4284
4286
|
if (side === "bottom") return `${align === "end" ? "right" : "left"} top`;
|
|
@@ -4390,7 +4392,15 @@ var Popover = ({
|
|
|
4390
4392
|
);
|
|
4391
4393
|
const offset = 4;
|
|
4392
4394
|
const padding = 8;
|
|
4395
|
+
const triggerSelector = React15.useId();
|
|
4393
4396
|
const initialPlacement = React15.useMemo(() => normalizePlacement(placement), [placement]);
|
|
4397
|
+
React15.useLayoutEffect(() => {
|
|
4398
|
+
if (typeof document === "undefined") return;
|
|
4399
|
+
const triggerEl = document.querySelector(`[data-underverse-popover-trigger="${triggerSelector}"]`);
|
|
4400
|
+
if (triggerEl) {
|
|
4401
|
+
triggerRef.current = triggerEl;
|
|
4402
|
+
}
|
|
4403
|
+
}, [triggerSelector, trigger]);
|
|
4394
4404
|
const updatePosition = React15.useCallback(() => {
|
|
4395
4405
|
const triggerEl = triggerRef.current;
|
|
4396
4406
|
const positionerEl = positionerRef.current;
|
|
@@ -4568,27 +4578,36 @@ var Popover = ({
|
|
|
4568
4578
|
) : null;
|
|
4569
4579
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
4570
4580
|
(() => {
|
|
4571
|
-
const
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
e
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4581
|
+
const TriggerComponent = trigger.type;
|
|
4582
|
+
const triggerProps = trigger.props;
|
|
4583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4584
|
+
TriggerComponent,
|
|
4585
|
+
{
|
|
4586
|
+
...triggerProps,
|
|
4587
|
+
"data-underverse-popover-trigger": triggerSelector,
|
|
4588
|
+
onClick: (e) => {
|
|
4589
|
+
triggerRef.current = e.currentTarget;
|
|
4590
|
+
e.preventDefault();
|
|
4591
|
+
e.stopPropagation();
|
|
4592
|
+
handleTriggerClick();
|
|
4593
|
+
if (typeof triggerProps.onClick === "function") {
|
|
4594
|
+
triggerProps.onClick(e);
|
|
4595
|
+
}
|
|
4596
|
+
},
|
|
4597
|
+
onFocus: (e) => {
|
|
4598
|
+
triggerRef.current = e.currentTarget;
|
|
4599
|
+
if (typeof triggerProps.onFocus === "function") {
|
|
4600
|
+
triggerProps.onFocus(e);
|
|
4601
|
+
}
|
|
4602
|
+
},
|
|
4603
|
+
"aria-expanded": isOpen,
|
|
4604
|
+
"aria-haspopup": triggerProps["aria-haspopup"] ?? "dialog",
|
|
4605
|
+
className: cn(
|
|
4606
|
+
triggerProps.className,
|
|
4607
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
4608
|
+
)
|
|
4609
|
+
}
|
|
4610
|
+
);
|
|
4592
4611
|
})(),
|
|
4593
4612
|
popoverContent
|
|
4594
4613
|
] });
|
|
@@ -4804,7 +4823,7 @@ var SidebarSheet = ({ navigation, children, ...props }) => {
|
|
|
4804
4823
|
};
|
|
4805
4824
|
|
|
4806
4825
|
// src/components/Alert.tsx
|
|
4807
|
-
var
|
|
4826
|
+
var import_react10 = require("react");
|
|
4808
4827
|
var import_lucide_react9 = require("lucide-react");
|
|
4809
4828
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
4810
4829
|
var variantConfig = {
|
|
@@ -4845,7 +4864,7 @@ var variantConfig = {
|
|
|
4845
4864
|
}
|
|
4846
4865
|
};
|
|
4847
4866
|
var Alert = ({ title, description, variant = "default", className, icon, dismissible = false, onClose, actions, closeAriaLabel }) => {
|
|
4848
|
-
const [open, setOpen] = (0,
|
|
4867
|
+
const [open, setOpen] = (0, import_react10.useState)(true);
|
|
4849
4868
|
const t = useSmartTranslations("Common");
|
|
4850
4869
|
if (!open) return null;
|
|
4851
4870
|
const handleClose = () => {
|
|
@@ -4890,7 +4909,7 @@ var Alert = ({ title, description, variant = "default", className, icon, dismiss
|
|
|
4890
4909
|
var Alert_default = Alert;
|
|
4891
4910
|
|
|
4892
4911
|
// src/components/GlobalLoading.tsx
|
|
4893
|
-
var
|
|
4912
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
4894
4913
|
var import_lucide_react10 = require("lucide-react");
|
|
4895
4914
|
|
|
4896
4915
|
// src/utils/loading.ts
|
|
@@ -4937,8 +4956,8 @@ var loading = new LoadingManager();
|
|
|
4937
4956
|
// src/components/GlobalLoading.tsx
|
|
4938
4957
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4939
4958
|
var GlobalLoading = ({ className, backdrop = true, position = "fixed", size = "lg" }) => {
|
|
4940
|
-
const [state, setState] = (0,
|
|
4941
|
-
(0,
|
|
4959
|
+
const [state, setState] = (0, import_react11.useState)(() => loading.getState());
|
|
4960
|
+
(0, import_react11.useEffect)(() => {
|
|
4942
4961
|
const unsubscribe = loading.subscribe(setState);
|
|
4943
4962
|
return unsubscribe;
|
|
4944
4963
|
}, []);
|
|
@@ -4995,7 +5014,7 @@ var InlineLoading = ({ isLoading, text, className, size = "md" }) => {
|
|
|
4995
5014
|
] });
|
|
4996
5015
|
};
|
|
4997
5016
|
var ButtonLoading = ({ isLoading, children, className, disabled, loadingText }) => {
|
|
4998
|
-
const child =
|
|
5017
|
+
const child = import_react11.default.isValidElement(children) ? import_react11.default.cloneElement(children, {
|
|
4999
5018
|
disabled: (children.props?.disabled ?? false) || disabled || isLoading,
|
|
5000
5019
|
"aria-busy": isLoading || void 0
|
|
5001
5020
|
}) : children;
|
|
@@ -5345,8 +5364,22 @@ var VerticalTabs = ({ sidebarWidth = "w-48", className, ...props }) => {
|
|
|
5345
5364
|
};
|
|
5346
5365
|
|
|
5347
5366
|
// src/components/DropdownMenu.tsx
|
|
5348
|
-
var
|
|
5367
|
+
var import_react12 = __toESM(require("react"), 1);
|
|
5349
5368
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
5369
|
+
function useResettingIndex(resetToken) {
|
|
5370
|
+
const [state, setState] = import_react12.default.useState({ resetToken, index: -1 });
|
|
5371
|
+
const activeIndex = Object.is(state.resetToken, resetToken) ? state.index : -1;
|
|
5372
|
+
const setActiveIndex = import_react12.default.useCallback((nextIndex) => {
|
|
5373
|
+
setState((prev) => {
|
|
5374
|
+
const prevIndex = Object.is(prev.resetToken, resetToken) ? prev.index : -1;
|
|
5375
|
+
return {
|
|
5376
|
+
resetToken,
|
|
5377
|
+
index: typeof nextIndex === "function" ? nextIndex(prevIndex) : nextIndex
|
|
5378
|
+
};
|
|
5379
|
+
});
|
|
5380
|
+
}, [resetToken]);
|
|
5381
|
+
return [activeIndex, setActiveIndex];
|
|
5382
|
+
}
|
|
5350
5383
|
var DropdownMenu = ({
|
|
5351
5384
|
trigger,
|
|
5352
5385
|
children,
|
|
@@ -5359,18 +5392,15 @@ var DropdownMenu = ({
|
|
|
5359
5392
|
onOpenChange,
|
|
5360
5393
|
items
|
|
5361
5394
|
}) => {
|
|
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();
|
|
5395
|
+
const [internalOpen, setInternalOpen] = (0, import_react12.useState)(false);
|
|
5368
5396
|
const open = isOpen !== void 0 ? isOpen : internalOpen;
|
|
5369
5397
|
const setOpen = onOpenChange || setInternalOpen;
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5398
|
+
const triggerRef = import_react12.default.useRef(null);
|
|
5399
|
+
const menuRef = import_react12.default.useRef(null);
|
|
5400
|
+
const itemsRef = import_react12.default.useRef([]);
|
|
5401
|
+
const [activeIndex, setActiveIndex] = useResettingIndex(open);
|
|
5402
|
+
useShadCNAnimations();
|
|
5403
|
+
import_react12.default.useEffect(() => {
|
|
5374
5404
|
if (!open) return;
|
|
5375
5405
|
const handleKeyNav = (e) => {
|
|
5376
5406
|
const active = document.activeElement;
|
|
@@ -5406,7 +5436,7 @@ var DropdownMenu = ({
|
|
|
5406
5436
|
return () => {
|
|
5407
5437
|
document.removeEventListener("keydown", handleKeyNav);
|
|
5408
5438
|
};
|
|
5409
|
-
}, [open, activeIndex]);
|
|
5439
|
+
}, [open, activeIndex, setActiveIndex]);
|
|
5410
5440
|
const handleItemClick = (itemOnClick) => {
|
|
5411
5441
|
itemOnClick();
|
|
5412
5442
|
if (closeOnSelect) {
|
|
@@ -5444,36 +5474,48 @@ var DropdownMenu = ({
|
|
|
5444
5474
|
index
|
|
5445
5475
|
);
|
|
5446
5476
|
}) : 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
|
-
|
|
5477
|
+
const TriggerComponent = trigger.type;
|
|
5478
|
+
const triggerProps = trigger.props;
|
|
5479
|
+
const enhancedTrigger = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5480
|
+
TriggerComponent,
|
|
5481
|
+
{
|
|
5482
|
+
...triggerProps,
|
|
5483
|
+
"aria-haspopup": "menu",
|
|
5484
|
+
"aria-expanded": open,
|
|
5485
|
+
onKeyDown: (e) => {
|
|
5486
|
+
triggerRef.current = e.currentTarget;
|
|
5487
|
+
if (disabled) return;
|
|
5488
|
+
if (e.key === "ArrowDown") {
|
|
5489
|
+
e.preventDefault();
|
|
5490
|
+
setOpen(true);
|
|
5491
|
+
requestAnimationFrame(() => itemsRef.current.find((el) => el && !el.disabled)?.focus());
|
|
5492
|
+
} else if (e.key === "ArrowUp") {
|
|
5493
|
+
e.preventDefault();
|
|
5494
|
+
setOpen(true);
|
|
5495
|
+
requestAnimationFrame(() => {
|
|
5496
|
+
const enabled = itemsRef.current.filter((el) => el && !el.disabled);
|
|
5497
|
+
enabled[enabled.length - 1]?.focus();
|
|
5498
|
+
});
|
|
5499
|
+
} else if (e.key === "Escape") {
|
|
5500
|
+
e.preventDefault();
|
|
5501
|
+
setOpen(false);
|
|
5502
|
+
}
|
|
5503
|
+
if (typeof triggerProps.onKeyDown === "function") {
|
|
5504
|
+
triggerProps.onKeyDown(e);
|
|
5505
|
+
}
|
|
5506
|
+
},
|
|
5507
|
+
onFocus: (e) => {
|
|
5508
|
+
triggerRef.current = e.currentTarget;
|
|
5509
|
+
if (typeof triggerProps.onFocus === "function") {
|
|
5510
|
+
triggerProps.onFocus(e);
|
|
5511
|
+
}
|
|
5512
|
+
},
|
|
5513
|
+
className: cn(
|
|
5514
|
+
triggerProps.className,
|
|
5515
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
5516
|
+
)
|
|
5517
|
+
}
|
|
5518
|
+
);
|
|
5477
5519
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5478
5520
|
Popover,
|
|
5479
5521
|
{
|
|
@@ -5558,11 +5600,11 @@ var import_lucide_react13 = require("lucide-react");
|
|
|
5558
5600
|
|
|
5559
5601
|
// src/components/Combobox.tsx
|
|
5560
5602
|
var React22 = __toESM(require("react"), 1);
|
|
5561
|
-
var
|
|
5603
|
+
var import_react14 = require("react");
|
|
5562
5604
|
var import_lucide_react12 = require("lucide-react");
|
|
5563
5605
|
|
|
5564
5606
|
// src/components/OverlayScrollbarProvider.tsx
|
|
5565
|
-
var
|
|
5607
|
+
var import_react13 = require("react");
|
|
5566
5608
|
var import_overlayscrollbars = require("overlayscrollbars");
|
|
5567
5609
|
|
|
5568
5610
|
// src/utils/overlay-scrollbar-controller.ts
|
|
@@ -5728,7 +5770,7 @@ function createOverlayScrollbarController({
|
|
|
5728
5770
|
|
|
5729
5771
|
// src/components/OverlayScrollbarProvider.tsx
|
|
5730
5772
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5731
|
-
var OverlayScrollbarConfigContext = (0,
|
|
5773
|
+
var OverlayScrollbarConfigContext = (0, import_react13.createContext)(DEFAULT_OVERLAY_SCROLLBAR_BEHAVIOR);
|
|
5732
5774
|
function OverlayScrollbarProvider({
|
|
5733
5775
|
enabled = DEFAULT_OVERLAY_SCROLLBAR_BEHAVIOR.enabled,
|
|
5734
5776
|
theme = DEFAULT_OVERLAY_SCROLLBAR_BEHAVIOR.theme,
|
|
@@ -5741,7 +5783,7 @@ function OverlayScrollbarProvider({
|
|
|
5741
5783
|
selector,
|
|
5742
5784
|
children
|
|
5743
5785
|
} = {}) {
|
|
5744
|
-
const value = (0,
|
|
5786
|
+
const value = (0, import_react13.useMemo)(
|
|
5745
5787
|
() => resolveOverlayScrollbarBehavior({
|
|
5746
5788
|
enabled,
|
|
5747
5789
|
theme,
|
|
@@ -5758,15 +5800,15 @@ function OverlayScrollbarProvider({
|
|
|
5758
5800
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(OverlayScrollbarConfigContext.Provider, { value, children: children ?? null });
|
|
5759
5801
|
}
|
|
5760
5802
|
function useOverlayScrollbarTarget(targetRef, options = {}) {
|
|
5761
|
-
const inherited = (0,
|
|
5762
|
-
const resolved = (0,
|
|
5803
|
+
const inherited = (0, import_react13.useContext)(OverlayScrollbarConfigContext);
|
|
5804
|
+
const resolved = (0, import_react13.useMemo)(
|
|
5763
5805
|
() => resolveOverlayScrollbarBehavior({
|
|
5764
5806
|
...inherited,
|
|
5765
5807
|
...options
|
|
5766
5808
|
}),
|
|
5767
5809
|
[inherited, options]
|
|
5768
5810
|
);
|
|
5769
|
-
(0,
|
|
5811
|
+
(0, import_react13.useEffect)(() => {
|
|
5770
5812
|
if (typeof window === "undefined") return;
|
|
5771
5813
|
const target = targetRef.current;
|
|
5772
5814
|
if (!target) return;
|
|
@@ -5841,7 +5883,7 @@ var Combobox = ({
|
|
|
5841
5883
|
const inputRef = React22.useRef(null);
|
|
5842
5884
|
const optionsViewportRef = React22.useRef(null);
|
|
5843
5885
|
useOverlayScrollbarTarget(optionsViewportRef, { enabled: useOverlayScrollbar });
|
|
5844
|
-
const autoId = (0,
|
|
5886
|
+
const autoId = (0, import_react14.useId)();
|
|
5845
5887
|
const resolvedId = id ? String(id) : `combobox-${autoId}`;
|
|
5846
5888
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
5847
5889
|
const enableSearch = options.length > 10;
|
|
@@ -6526,7 +6568,7 @@ var CompactPagination = ({ page, totalPages, onChange, className, disabled = fal
|
|
|
6526
6568
|
};
|
|
6527
6569
|
|
|
6528
6570
|
// src/components/Section.tsx
|
|
6529
|
-
var
|
|
6571
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
6530
6572
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
6531
6573
|
var gradientDirectionMap = {
|
|
6532
6574
|
"to-r": "to right",
|
|
@@ -6559,7 +6601,7 @@ var variantClasses = {
|
|
|
6559
6601
|
accent: "bg-accent/10",
|
|
6560
6602
|
gradient: ""
|
|
6561
6603
|
};
|
|
6562
|
-
var Section =
|
|
6604
|
+
var Section = import_react15.default.forwardRef(
|
|
6563
6605
|
({
|
|
6564
6606
|
children,
|
|
6565
6607
|
className,
|
|
@@ -6599,7 +6641,7 @@ Section.displayName = "Section";
|
|
|
6599
6641
|
var Section_default = Section;
|
|
6600
6642
|
|
|
6601
6643
|
// src/components/ScrollArea.tsx
|
|
6602
|
-
var
|
|
6644
|
+
var import_react16 = require("react");
|
|
6603
6645
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
6604
6646
|
var variantClasses2 = {
|
|
6605
6647
|
default: "bg-background",
|
|
@@ -6607,9 +6649,9 @@ var variantClasses2 = {
|
|
|
6607
6649
|
primary: "bg-primary/5",
|
|
6608
6650
|
accent: "bg-accent/10"
|
|
6609
6651
|
};
|
|
6610
|
-
var ScrollArea = (0,
|
|
6652
|
+
var ScrollArea = (0, import_react16.forwardRef)(
|
|
6611
6653
|
({ className, contentClassName, children, variant = "default", outlined = false, useOverlayScrollbar = false, ...props }, ref) => {
|
|
6612
|
-
const viewportRef = (0,
|
|
6654
|
+
const viewportRef = (0, import_react16.useRef)(null);
|
|
6613
6655
|
useOverlayScrollbarTarget(viewportRef, { enabled: useOverlayScrollbar });
|
|
6614
6656
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
6615
6657
|
"div",
|
|
@@ -6630,11 +6672,11 @@ var ScrollArea = (0, import_react15.forwardRef)(
|
|
|
6630
6672
|
ScrollArea.displayName = "ScrollArea";
|
|
6631
6673
|
|
|
6632
6674
|
// src/components/OverlayScrollArea.tsx
|
|
6633
|
-
var
|
|
6675
|
+
var import_react17 = require("react");
|
|
6634
6676
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
6635
|
-
var OverlayScrollArea = (0,
|
|
6677
|
+
var OverlayScrollArea = (0, import_react17.forwardRef)(
|
|
6636
6678
|
({ className, viewportClassName, viewportProps, enabled = true, overlayScrollbarOptions, children, ...props }, ref) => {
|
|
6637
|
-
const viewportRef = (0,
|
|
6679
|
+
const viewportRef = (0, import_react17.useRef)(null);
|
|
6638
6680
|
useOverlayScrollbarTarget(viewportRef, {
|
|
6639
6681
|
enabled,
|
|
6640
6682
|
...overlayScrollbarOptions
|
|
@@ -6869,7 +6911,7 @@ function formatDateSmart(date, locale = "en") {
|
|
|
6869
6911
|
// src/components/DatePicker.tsx
|
|
6870
6912
|
var import_lucide_react14 = require("lucide-react");
|
|
6871
6913
|
var React26 = __toESM(require("react"), 1);
|
|
6872
|
-
var
|
|
6914
|
+
var import_react18 = require("react");
|
|
6873
6915
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
6874
6916
|
var DatePicker = ({
|
|
6875
6917
|
id,
|
|
@@ -7268,7 +7310,7 @@ var DatePicker = ({
|
|
|
7268
7310
|
)
|
|
7269
7311
|
] })
|
|
7270
7312
|
] });
|
|
7271
|
-
const autoId = (0,
|
|
7313
|
+
const autoId = (0, import_react18.useId)();
|
|
7272
7314
|
const resolvedId = id ? String(id) : `datepicker-${autoId}`;
|
|
7273
7315
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
7274
7316
|
const labelSize = sizeStyles8[size].label;
|
|
@@ -7955,10 +7997,8 @@ function WheelColumn({
|
|
|
7955
7997
|
};
|
|
7956
7998
|
const currentVirtual = React27.useMemo(() => {
|
|
7957
7999
|
if (!loop || items.length <= 0) return valueIndex;
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
return getNearestVirtualIndex(valueIndex, from);
|
|
7961
|
-
}, [baseOffset, getNearestVirtualIndex, items.length, loop, valueIndex]);
|
|
8000
|
+
return baseOffset + valueIndex;
|
|
8001
|
+
}, [baseOffset, items.length, loop, valueIndex]);
|
|
7962
8002
|
const commitFromScrollTop = React27.useCallback(
|
|
7963
8003
|
(behavior) => {
|
|
7964
8004
|
const el = scrollRef.current;
|
|
@@ -9395,10 +9435,8 @@ function WheelColumn2({
|
|
|
9395
9435
|
};
|
|
9396
9436
|
const currentVirtual = React29.useMemo(() => {
|
|
9397
9437
|
if (!loop || items.length <= 0) return valueIndex;
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
return getNearestVirtualIndex(valueIndex, from);
|
|
9401
|
-
}, [baseOffset, getNearestVirtualIndex, items.length, loop, valueIndex]);
|
|
9438
|
+
return baseOffset + valueIndex;
|
|
9439
|
+
}, [baseOffset, items.length, loop, valueIndex]);
|
|
9402
9440
|
const commitFromScrollTop = React29.useCallback(
|
|
9403
9441
|
(behavior) => {
|
|
9404
9442
|
const el = scrollRef.current;
|
|
@@ -13458,7 +13496,7 @@ function CalendarTimeline({
|
|
|
13458
13496
|
|
|
13459
13497
|
// src/components/MultiCombobox.tsx
|
|
13460
13498
|
var React37 = __toESM(require("react"), 1);
|
|
13461
|
-
var
|
|
13499
|
+
var import_react19 = require("react");
|
|
13462
13500
|
var import_lucide_react23 = require("lucide-react");
|
|
13463
13501
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
13464
13502
|
var MultiCombobox = ({
|
|
@@ -13587,7 +13625,7 @@ var MultiCombobox = ({
|
|
|
13587
13625
|
outline: "border-2 border-input bg-transparent hover:border-primary",
|
|
13588
13626
|
ghost: "border border-transparent bg-muted/50 hover:bg-muted"
|
|
13589
13627
|
};
|
|
13590
|
-
const autoId = (0,
|
|
13628
|
+
const autoId = (0, import_react19.useId)();
|
|
13591
13629
|
const resolvedId = id ? String(id) : `multicombobox-${autoId}`;
|
|
13592
13630
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
13593
13631
|
const labelSize = size === "sm" ? "text-xs" : size === "lg" ? "text-base" : "text-sm";
|
|
@@ -14215,6 +14253,36 @@ var SIZE_STYLES = {
|
|
|
14215
14253
|
}
|
|
14216
14254
|
};
|
|
14217
14255
|
var clamp6 = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
14256
|
+
function SliderTooltip({
|
|
14257
|
+
displayValue,
|
|
14258
|
+
position,
|
|
14259
|
+
visible,
|
|
14260
|
+
sizeClassName,
|
|
14261
|
+
tooltipClassName
|
|
14262
|
+
}) {
|
|
14263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
14264
|
+
"div",
|
|
14265
|
+
{
|
|
14266
|
+
className: cn(
|
|
14267
|
+
"absolute pointer-events-none transition-all duration-200 ease-out",
|
|
14268
|
+
"bg-popover text-popover-foreground rounded-lg shadow-lg border border-border/50",
|
|
14269
|
+
"whitespace-nowrap font-medium -translate-x-1/2 z-50",
|
|
14270
|
+
sizeClassName,
|
|
14271
|
+
visible ? "opacity-100 -translate-y-10 scale-100" : "opacity-0 -translate-y-8 scale-95",
|
|
14272
|
+
tooltipClassName
|
|
14273
|
+
),
|
|
14274
|
+
style: {
|
|
14275
|
+
left: `${position}%`,
|
|
14276
|
+
bottom: "100%"
|
|
14277
|
+
},
|
|
14278
|
+
children: [
|
|
14279
|
+
displayValue,
|
|
14280
|
+
/* @__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" }),
|
|
14281
|
+
/* @__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" })
|
|
14282
|
+
]
|
|
14283
|
+
}
|
|
14284
|
+
);
|
|
14285
|
+
}
|
|
14218
14286
|
var Slider = React39.forwardRef(
|
|
14219
14287
|
({
|
|
14220
14288
|
className,
|
|
@@ -14304,6 +14372,7 @@ var Slider = React39.forwardRef(
|
|
|
14304
14372
|
const rangeStartPct = (normalizedRange[0] - min) / denom * 100;
|
|
14305
14373
|
const rangeEndPct = (normalizedRange[1] - min) / denom * 100;
|
|
14306
14374
|
const sizeStyles8 = SIZE_STYLES[size];
|
|
14375
|
+
const tooltipVisible = showTooltip && !disabled && (isHovering || isDragging);
|
|
14307
14376
|
const displayValue = React39.useMemo(() => {
|
|
14308
14377
|
if (isRange) {
|
|
14309
14378
|
const a = formatValue ? formatValue(normalizedRange[0]) : normalizedRange[0].toString();
|
|
@@ -14377,32 +14446,6 @@ var Slider = React39.forwardRef(
|
|
|
14377
14446
|
};
|
|
14378
14447
|
if (orientation === "vertical") {
|
|
14379
14448
|
}
|
|
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
14449
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: cn("w-full space-y-2", containerClassName), children: [
|
|
14407
14450
|
(label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
14408
14451
|
label && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("label", { className: cn("text-sm font-medium text-foreground", labelClassName), children: label }),
|
|
@@ -14435,10 +14478,37 @@ var Slider = React39.forwardRef(
|
|
|
14435
14478
|
style: { width: `${percentage}%` }
|
|
14436
14479
|
}
|
|
14437
14480
|
) }),
|
|
14438
|
-
!isRange && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
14481
|
+
!isRange && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
14482
|
+
SliderTooltip,
|
|
14483
|
+
{
|
|
14484
|
+
displayValue: formatValue ? formatValue(currentValue) : currentValue.toString(),
|
|
14485
|
+
position: percentage,
|
|
14486
|
+
visible: tooltipVisible,
|
|
14487
|
+
sizeClassName: sizeStyles8.tooltip,
|
|
14488
|
+
tooltipClassName
|
|
14489
|
+
}
|
|
14490
|
+
),
|
|
14439
14491
|
isRange && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
14440
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
14441
|
-
|
|
14492
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
14493
|
+
SliderTooltip,
|
|
14494
|
+
{
|
|
14495
|
+
displayValue: formatValue ? formatValue(normalizedRange[0]) : normalizedRange[0].toString(),
|
|
14496
|
+
position: rangeStartPct,
|
|
14497
|
+
visible: tooltipVisible,
|
|
14498
|
+
sizeClassName: sizeStyles8.tooltip,
|
|
14499
|
+
tooltipClassName
|
|
14500
|
+
}
|
|
14501
|
+
),
|
|
14502
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
14503
|
+
SliderTooltip,
|
|
14504
|
+
{
|
|
14505
|
+
displayValue: formatValue ? formatValue(normalizedRange[1]) : normalizedRange[1].toString(),
|
|
14506
|
+
position: rangeEndPct,
|
|
14507
|
+
visible: tooltipVisible,
|
|
14508
|
+
sizeClassName: sizeStyles8.tooltip,
|
|
14509
|
+
tooltipClassName
|
|
14510
|
+
}
|
|
14511
|
+
)
|
|
14442
14512
|
] }),
|
|
14443
14513
|
(() => {
|
|
14444
14514
|
const baseInputClassName = cn(
|
|
@@ -14576,7 +14646,7 @@ Slider.displayName = "Slider";
|
|
|
14576
14646
|
|
|
14577
14647
|
// src/components/OverlayControls.tsx
|
|
14578
14648
|
var import_lucide_react24 = require("lucide-react");
|
|
14579
|
-
var
|
|
14649
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
14580
14650
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
14581
14651
|
function OverlayControls({
|
|
14582
14652
|
mode,
|
|
@@ -14607,24 +14677,24 @@ function OverlayControls({
|
|
|
14607
14677
|
}) {
|
|
14608
14678
|
const hoverClasses = showOnHover ? "opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto" : "opacity-100 pointer-events-auto";
|
|
14609
14679
|
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
|
-
|
|
14680
|
+
const [rateOpen, setRateOpen] = import_react20.default.useState(false);
|
|
14681
|
+
const rateWrapRef = import_react20.default.useRef(null);
|
|
14682
|
+
const [controlsVisible, setControlsVisible] = import_react20.default.useState(true);
|
|
14683
|
+
const hideTimerRef = import_react20.default.useRef(null);
|
|
14684
|
+
const [previewData, setPreviewData] = import_react20.default.useState(null);
|
|
14685
|
+
const sliderRef = import_react20.default.useRef(null);
|
|
14686
|
+
const [isDragging, setIsDragging] = import_react20.default.useState(false);
|
|
14687
|
+
const [dragValue, setDragValue] = import_react20.default.useState(value);
|
|
14688
|
+
import_react20.default.useEffect(() => {
|
|
14619
14689
|
if (!isDragging) {
|
|
14620
14690
|
setDragValue(value);
|
|
14621
14691
|
}
|
|
14622
14692
|
}, [value, isDragging]);
|
|
14623
|
-
const [keyboardFeedback, setKeyboardFeedback] =
|
|
14624
|
-
const feedbackTimerRef =
|
|
14625
|
-
const seekAccumulatorRef =
|
|
14626
|
-
const seekAccumulatorTimerRef =
|
|
14627
|
-
|
|
14693
|
+
const [keyboardFeedback, setKeyboardFeedback] = import_react20.default.useState(null);
|
|
14694
|
+
const feedbackTimerRef = import_react20.default.useRef(null);
|
|
14695
|
+
const seekAccumulatorRef = import_react20.default.useRef(0);
|
|
14696
|
+
const seekAccumulatorTimerRef = import_react20.default.useRef(null);
|
|
14697
|
+
import_react20.default.useEffect(() => {
|
|
14628
14698
|
const onDocDown = (e) => {
|
|
14629
14699
|
if (!rateOpen) return;
|
|
14630
14700
|
const wrap = rateWrapRef.current;
|
|
@@ -14635,7 +14705,7 @@ function OverlayControls({
|
|
|
14635
14705
|
document.addEventListener("mousedown", onDocDown);
|
|
14636
14706
|
return () => document.removeEventListener("mousedown", onDocDown);
|
|
14637
14707
|
}, [rateOpen]);
|
|
14638
|
-
|
|
14708
|
+
import_react20.default.useEffect(() => {
|
|
14639
14709
|
if (!autoHide || showOnHover) return;
|
|
14640
14710
|
const resetTimer = () => {
|
|
14641
14711
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
@@ -14658,14 +14728,14 @@ function OverlayControls({
|
|
|
14658
14728
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
14659
14729
|
};
|
|
14660
14730
|
}, [autoHide, autoHideDelay, showOnHover]);
|
|
14661
|
-
const showFeedback =
|
|
14731
|
+
const showFeedback = import_react20.default.useCallback((type, value2) => {
|
|
14662
14732
|
if (feedbackTimerRef.current) clearTimeout(feedbackTimerRef.current);
|
|
14663
14733
|
setKeyboardFeedback({ type, value: value2 });
|
|
14664
14734
|
feedbackTimerRef.current = setTimeout(() => {
|
|
14665
14735
|
setKeyboardFeedback(null);
|
|
14666
14736
|
}, 800);
|
|
14667
14737
|
}, []);
|
|
14668
|
-
const accumulateSeek =
|
|
14738
|
+
const accumulateSeek = import_react20.default.useCallback((seconds) => {
|
|
14669
14739
|
if (seekAccumulatorTimerRef.current) clearTimeout(seekAccumulatorTimerRef.current);
|
|
14670
14740
|
seekAccumulatorRef.current += seconds;
|
|
14671
14741
|
showFeedback("seek", seekAccumulatorRef.current);
|
|
@@ -14673,7 +14743,7 @@ function OverlayControls({
|
|
|
14673
14743
|
seekAccumulatorRef.current = 0;
|
|
14674
14744
|
}, 1e3);
|
|
14675
14745
|
}, [showFeedback]);
|
|
14676
|
-
|
|
14746
|
+
import_react20.default.useEffect(() => {
|
|
14677
14747
|
if (!enableKeyboardShortcuts) return;
|
|
14678
14748
|
const handleKeyDown = (e) => {
|
|
14679
14749
|
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return;
|
|
@@ -15011,7 +15081,7 @@ function OverlayControls({
|
|
|
15011
15081
|
}
|
|
15012
15082
|
|
|
15013
15083
|
// src/components/CategoryTreeSelect.tsx
|
|
15014
|
-
var
|
|
15084
|
+
var import_react21 = require("react");
|
|
15015
15085
|
var import_lucide_react25 = require("lucide-react");
|
|
15016
15086
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
15017
15087
|
var defaultLabels = {
|
|
@@ -15020,6 +15090,16 @@ var defaultLabels = {
|
|
|
15020
15090
|
searchPlaceholder: "Search...",
|
|
15021
15091
|
noResultsText: "No results found"
|
|
15022
15092
|
};
|
|
15093
|
+
function getInitialExpandedNodes(categories, defaultExpanded, viewOnly, inline) {
|
|
15094
|
+
if (!(viewOnly || inline) || !defaultExpanded) return /* @__PURE__ */ new Set();
|
|
15095
|
+
const parentIds = /* @__PURE__ */ new Set();
|
|
15096
|
+
for (const category of categories) {
|
|
15097
|
+
if (typeof category.parent_id === "number") {
|
|
15098
|
+
parentIds.add(category.parent_id);
|
|
15099
|
+
}
|
|
15100
|
+
}
|
|
15101
|
+
return parentIds;
|
|
15102
|
+
}
|
|
15023
15103
|
function CategoryTreeSelect(props) {
|
|
15024
15104
|
const {
|
|
15025
15105
|
id,
|
|
@@ -15044,25 +15124,25 @@ function CategoryTreeSelect(props) {
|
|
|
15044
15124
|
useOverlayScrollbar = false,
|
|
15045
15125
|
singleSelect = false
|
|
15046
15126
|
} = props;
|
|
15047
|
-
const [isOpen, setIsOpen] = (0,
|
|
15048
|
-
const [expandedNodes, setExpandedNodes] = (0,
|
|
15049
|
-
const [query, setQuery] = (0,
|
|
15050
|
-
const searchInputRef = (0,
|
|
15051
|
-
const dropdownViewportRef = (0,
|
|
15127
|
+
const [isOpen, setIsOpen] = (0, import_react21.useState)(false);
|
|
15128
|
+
const [expandedNodes, setExpandedNodes] = (0, import_react21.useState)(() => getInitialExpandedNodes(categories, defaultExpanded, viewOnly, inline));
|
|
15129
|
+
const [query, setQuery] = (0, import_react21.useState)("");
|
|
15130
|
+
const searchInputRef = (0, import_react21.useRef)(null);
|
|
15131
|
+
const dropdownViewportRef = (0, import_react21.useRef)(null);
|
|
15052
15132
|
useOverlayScrollbarTarget(dropdownViewportRef, { enabled: useOverlayScrollbar });
|
|
15053
|
-
const autoId = (0,
|
|
15133
|
+
const autoId = (0, import_react21.useId)();
|
|
15054
15134
|
const resolvedId = id ? String(id) : `category-tree-select-${autoId}`;
|
|
15055
15135
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
15056
15136
|
const helperId = helperText && !error ? `${resolvedId}-helper` : void 0;
|
|
15057
15137
|
const errorId = error ? `${resolvedId}-error` : void 0;
|
|
15058
15138
|
const describedBy = errorId || helperId;
|
|
15059
15139
|
const mergedLabels = { ...defaultLabels, ...labels };
|
|
15060
|
-
const valueArray = (0,
|
|
15140
|
+
const valueArray = (0, import_react21.useMemo)(
|
|
15061
15141
|
() => singleSelect ? props.value != null ? [props.value] : [] : props.value ?? [],
|
|
15062
15142
|
[props.value, singleSelect]
|
|
15063
15143
|
);
|
|
15064
|
-
const selectedIds = (0,
|
|
15065
|
-
const { parentCategories, childrenMap, byId } = (0,
|
|
15144
|
+
const selectedIds = (0, import_react21.useMemo)(() => new Set(valueArray), [valueArray]);
|
|
15145
|
+
const { parentCategories, childrenMap, byId } = (0, import_react21.useMemo)(() => {
|
|
15066
15146
|
const byId2 = /* @__PURE__ */ new Map();
|
|
15067
15147
|
const childrenMap2 = /* @__PURE__ */ new Map();
|
|
15068
15148
|
const parentCategories2 = [];
|
|
@@ -15077,10 +15157,10 @@ function CategoryTreeSelect(props) {
|
|
|
15077
15157
|
}
|
|
15078
15158
|
return { parentCategories: parentCategories2, childrenMap: childrenMap2, byId: byId2 };
|
|
15079
15159
|
}, [categories]);
|
|
15080
|
-
const isSearchEnabled = (0,
|
|
15081
|
-
const normalizedQuery = (0,
|
|
15160
|
+
const isSearchEnabled = (0, import_react21.useMemo)(() => enableSearch ?? categories.length > 10, [enableSearch, categories.length]);
|
|
15161
|
+
const normalizedQuery = (0, import_react21.useMemo)(() => query.trim().toLowerCase(), [query]);
|
|
15082
15162
|
const isSearchMode = isSearchEnabled && normalizedQuery.length > 0;
|
|
15083
|
-
const visibleIds = (0,
|
|
15163
|
+
const visibleIds = (0, import_react21.useMemo)(() => {
|
|
15084
15164
|
if (!isSearchMode) return null;
|
|
15085
15165
|
const matches = categories.filter((c) => c.name.toLowerCase().includes(normalizedQuery));
|
|
15086
15166
|
if (matches.length === 0) return /* @__PURE__ */ new Set();
|
|
@@ -15119,21 +15199,12 @@ function CategoryTreeSelect(props) {
|
|
|
15119
15199
|
}
|
|
15120
15200
|
return visible;
|
|
15121
15201
|
}, [byId, categories, childrenMap, isSearchMode, normalizedQuery]);
|
|
15122
|
-
(0,
|
|
15123
|
-
if (!isOpen) setQuery("");
|
|
15124
|
-
}, [isOpen]);
|
|
15125
|
-
(0, import_react20.useEffect)(() => {
|
|
15202
|
+
(0, import_react21.useEffect)(() => {
|
|
15126
15203
|
if (!isOpen) return;
|
|
15127
15204
|
if (!isSearchEnabled) return;
|
|
15128
15205
|
const t = setTimeout(() => searchInputRef.current?.focus(), 50);
|
|
15129
15206
|
return () => clearTimeout(t);
|
|
15130
15207
|
}, [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
15208
|
const toggleExpand = (id2) => {
|
|
15138
15209
|
if (isSearchMode) return;
|
|
15139
15210
|
const newExpanded = new Set(expandedNodes);
|
|
@@ -15157,7 +15228,7 @@ function CategoryTreeSelect(props) {
|
|
|
15157
15228
|
onChange(categoryId);
|
|
15158
15229
|
}
|
|
15159
15230
|
if (!inline) {
|
|
15160
|
-
|
|
15231
|
+
handleOpenChange(false);
|
|
15161
15232
|
}
|
|
15162
15233
|
} else {
|
|
15163
15234
|
const onChange = props.onChange;
|
|
@@ -15291,21 +15362,20 @@ function CategoryTreeSelect(props) {
|
|
|
15291
15362
|
)
|
|
15292
15363
|
] }) });
|
|
15293
15364
|
};
|
|
15294
|
-
const effectiveParentCategories = (0,
|
|
15365
|
+
const effectiveParentCategories = (0, import_react21.useMemo)(() => {
|
|
15295
15366
|
if (!isSearchMode) return parentCategories;
|
|
15296
15367
|
return parentCategories.filter((c) => visibleIds?.has(c.id));
|
|
15297
15368
|
}, [isSearchMode, parentCategories, visibleIds]);
|
|
15298
|
-
|
|
15299
|
-
|
|
15300
|
-
|
|
15369
|
+
let effectiveChildrenMap = childrenMap;
|
|
15370
|
+
if (isSearchMode && visibleIds) {
|
|
15371
|
+
effectiveChildrenMap = /* @__PURE__ */ new Map();
|
|
15301
15372
|
for (const [parentId, children] of childrenMap.entries()) {
|
|
15302
|
-
|
|
15373
|
+
effectiveChildrenMap.set(
|
|
15303
15374
|
parentId,
|
|
15304
15375
|
children.filter((child) => visibleIds.has(child.id))
|
|
15305
15376
|
);
|
|
15306
15377
|
}
|
|
15307
|
-
|
|
15308
|
-
}, [childrenMap, isSearchMode, visibleIds]);
|
|
15378
|
+
}
|
|
15309
15379
|
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
15380
|
/* @__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
15381
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-sm text-muted-foreground", children: isSearchMode ? mergedLabels.noResultsText : mergedLabels.emptyText })
|
|
@@ -15414,7 +15484,13 @@ function CategoryTreeSelect(props) {
|
|
|
15414
15484
|
event.preventDefault();
|
|
15415
15485
|
event.stopPropagation();
|
|
15416
15486
|
clearSelection();
|
|
15417
|
-
|
|
15487
|
+
handleOpenChange(false);
|
|
15488
|
+
};
|
|
15489
|
+
const handleOpenChange = (nextOpen) => {
|
|
15490
|
+
setIsOpen(nextOpen);
|
|
15491
|
+
if (!nextOpen) {
|
|
15492
|
+
setQuery("");
|
|
15493
|
+
}
|
|
15418
15494
|
};
|
|
15419
15495
|
let displayText;
|
|
15420
15496
|
if (singleSelect) {
|
|
@@ -15447,7 +15523,7 @@ function CategoryTreeSelect(props) {
|
|
|
15447
15523
|
Popover,
|
|
15448
15524
|
{
|
|
15449
15525
|
open: isOpen,
|
|
15450
|
-
onOpenChange:
|
|
15526
|
+
onOpenChange: handleOpenChange,
|
|
15451
15527
|
disabled,
|
|
15452
15528
|
placement: "bottom-start",
|
|
15453
15529
|
matchTriggerWidth: true,
|
|
@@ -15537,7 +15613,7 @@ function CategoryTreeSelect(props) {
|
|
|
15537
15613
|
}
|
|
15538
15614
|
|
|
15539
15615
|
// src/components/ImageUpload.tsx
|
|
15540
|
-
var
|
|
15616
|
+
var import_react22 = require("react");
|
|
15541
15617
|
var import_lucide_react26 = require("lucide-react");
|
|
15542
15618
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
15543
15619
|
function ImageUpload({
|
|
@@ -15555,10 +15631,10 @@ function ImageUpload({
|
|
|
15555
15631
|
browseText,
|
|
15556
15632
|
supportedFormatsText
|
|
15557
15633
|
}) {
|
|
15558
|
-
const [isDragging, setIsDragging] = (0,
|
|
15559
|
-
const [uploading, setUploading] = (0,
|
|
15560
|
-
const [uploadedImages, setUploadedImages] = (0,
|
|
15561
|
-
const fileInputRef = (0,
|
|
15634
|
+
const [isDragging, setIsDragging] = (0, import_react22.useState)(false);
|
|
15635
|
+
const [uploading, setUploading] = (0, import_react22.useState)(false);
|
|
15636
|
+
const [uploadedImages, setUploadedImages] = (0, import_react22.useState)([]);
|
|
15637
|
+
const fileInputRef = (0, import_react22.useRef)(null);
|
|
15562
15638
|
const { addToast } = useToast();
|
|
15563
15639
|
const t = useSmartTranslations("OCR.imageUpload");
|
|
15564
15640
|
const previewSizes = {
|
|
@@ -15566,7 +15642,7 @@ function ImageUpload({
|
|
|
15566
15642
|
md: "w-24 h-24",
|
|
15567
15643
|
lg: "w-32 h-32"
|
|
15568
15644
|
};
|
|
15569
|
-
const handleDragOver = (0,
|
|
15645
|
+
const handleDragOver = (0, import_react22.useCallback)(
|
|
15570
15646
|
(e) => {
|
|
15571
15647
|
e.preventDefault();
|
|
15572
15648
|
if (!disabled) {
|
|
@@ -15575,11 +15651,11 @@ function ImageUpload({
|
|
|
15575
15651
|
},
|
|
15576
15652
|
[disabled]
|
|
15577
15653
|
);
|
|
15578
|
-
const handleDragLeave = (0,
|
|
15654
|
+
const handleDragLeave = (0, import_react22.useCallback)((e) => {
|
|
15579
15655
|
e.preventDefault();
|
|
15580
15656
|
setIsDragging(false);
|
|
15581
15657
|
}, []);
|
|
15582
|
-
const handleFiles = (0,
|
|
15658
|
+
const handleFiles = (0, import_react22.useCallback)(
|
|
15583
15659
|
async (files) => {
|
|
15584
15660
|
if (files.length === 0) return;
|
|
15585
15661
|
const validFiles = files.filter((file) => {
|
|
@@ -15646,7 +15722,7 @@ function ImageUpload({
|
|
|
15646
15722
|
},
|
|
15647
15723
|
[maxSize, addToast, onUpload]
|
|
15648
15724
|
);
|
|
15649
|
-
const handleDrop = (0,
|
|
15725
|
+
const handleDrop = (0, import_react22.useCallback)(
|
|
15650
15726
|
(e) => {
|
|
15651
15727
|
e.preventDefault();
|
|
15652
15728
|
setIsDragging(false);
|
|
@@ -15656,7 +15732,7 @@ function ImageUpload({
|
|
|
15656
15732
|
},
|
|
15657
15733
|
[disabled, handleFiles]
|
|
15658
15734
|
);
|
|
15659
|
-
const handleFileSelect = (0,
|
|
15735
|
+
const handleFileSelect = (0, import_react22.useCallback)(
|
|
15660
15736
|
(e) => {
|
|
15661
15737
|
const files = Array.from(e.target.files || []);
|
|
15662
15738
|
handleFiles(files);
|
|
@@ -15760,7 +15836,7 @@ function ImageUpload({
|
|
|
15760
15836
|
|
|
15761
15837
|
// src/components/FileUpload.tsx
|
|
15762
15838
|
var import_lucide_react27 = require("lucide-react");
|
|
15763
|
-
var
|
|
15839
|
+
var import_react23 = require("react");
|
|
15764
15840
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
15765
15841
|
var formatFileSize = (bytes) => {
|
|
15766
15842
|
if (bytes === 0) return "0 Bytes";
|
|
@@ -15867,12 +15943,12 @@ function FileUpload({
|
|
|
15867
15943
|
allowPreview = true,
|
|
15868
15944
|
initialFiles = []
|
|
15869
15945
|
}) {
|
|
15870
|
-
const [isDragging, setIsDragging] = (0,
|
|
15871
|
-
const [files, setFiles] = (0,
|
|
15872
|
-
const fileInputRef = (0,
|
|
15946
|
+
const [isDragging, setIsDragging] = (0, import_react23.useState)(false);
|
|
15947
|
+
const [files, setFiles] = (0, import_react23.useState)(initialFiles);
|
|
15948
|
+
const fileInputRef = (0, import_react23.useRef)(null);
|
|
15873
15949
|
const { addToast } = useToast();
|
|
15874
15950
|
const t = useSmartTranslations("FileUpload");
|
|
15875
|
-
const sizeConfig = (0,
|
|
15951
|
+
const sizeConfig = (0, import_react23.useMemo)(
|
|
15876
15952
|
() => ({
|
|
15877
15953
|
sm: {
|
|
15878
15954
|
padding: "p-4",
|
|
@@ -15905,7 +15981,7 @@ function FileUpload({
|
|
|
15905
15981
|
[]
|
|
15906
15982
|
);
|
|
15907
15983
|
const currentSize = sizeConfig[size];
|
|
15908
|
-
const handleDragOver = (0,
|
|
15984
|
+
const handleDragOver = (0, import_react23.useCallback)(
|
|
15909
15985
|
(e) => {
|
|
15910
15986
|
e.preventDefault();
|
|
15911
15987
|
e.stopPropagation();
|
|
@@ -15915,12 +15991,12 @@ function FileUpload({
|
|
|
15915
15991
|
},
|
|
15916
15992
|
[disabled]
|
|
15917
15993
|
);
|
|
15918
|
-
const handleDragLeave = (0,
|
|
15994
|
+
const handleDragLeave = (0, import_react23.useCallback)((e) => {
|
|
15919
15995
|
e.preventDefault();
|
|
15920
15996
|
e.stopPropagation();
|
|
15921
15997
|
setIsDragging(false);
|
|
15922
15998
|
}, []);
|
|
15923
|
-
const processFiles = (0,
|
|
15999
|
+
const processFiles = (0, import_react23.useCallback)(
|
|
15924
16000
|
async (fileList) => {
|
|
15925
16001
|
if (fileList.length === 0) return;
|
|
15926
16002
|
const remainingSlots = maxFiles - files.length;
|
|
@@ -15993,7 +16069,7 @@ function FileUpload({
|
|
|
15993
16069
|
},
|
|
15994
16070
|
[files, maxFiles, maxSize, uploadHandler, onUpload, onChange, addToast, t]
|
|
15995
16071
|
);
|
|
15996
|
-
const handleDrop = (0,
|
|
16072
|
+
const handleDrop = (0, import_react23.useCallback)(
|
|
15997
16073
|
(e) => {
|
|
15998
16074
|
e.preventDefault();
|
|
15999
16075
|
e.stopPropagation();
|
|
@@ -16004,7 +16080,7 @@ function FileUpload({
|
|
|
16004
16080
|
},
|
|
16005
16081
|
[disabled, processFiles]
|
|
16006
16082
|
);
|
|
16007
|
-
const handleFileSelect = (0,
|
|
16083
|
+
const handleFileSelect = (0, import_react23.useCallback)(
|
|
16008
16084
|
(e) => {
|
|
16009
16085
|
const selectedFiles = Array.from(e.target.files || []);
|
|
16010
16086
|
processFiles(selectedFiles);
|
|
@@ -16014,7 +16090,7 @@ function FileUpload({
|
|
|
16014
16090
|
},
|
|
16015
16091
|
[processFiles]
|
|
16016
16092
|
);
|
|
16017
|
-
const handleRemove = (0,
|
|
16093
|
+
const handleRemove = (0, import_react23.useCallback)(
|
|
16018
16094
|
(fileId) => {
|
|
16019
16095
|
setFiles((prev) => {
|
|
16020
16096
|
const fileToRemove = prev.find((f) => f.id === fileId);
|
|
@@ -16032,7 +16108,7 @@ function FileUpload({
|
|
|
16032
16108
|
const handleBrowseClick = () => {
|
|
16033
16109
|
fileInputRef.current?.click();
|
|
16034
16110
|
};
|
|
16035
|
-
const handleRetry = (0,
|
|
16111
|
+
const handleRetry = (0, import_react23.useCallback)(
|
|
16036
16112
|
(fileEntry) => {
|
|
16037
16113
|
if (!uploadHandler || !fileEntry.file) return;
|
|
16038
16114
|
processFiles([fileEntry.file]);
|
|
@@ -16558,7 +16634,7 @@ function Carousel({
|
|
|
16558
16634
|
}
|
|
16559
16635
|
|
|
16560
16636
|
// src/components/FallingIcons.tsx
|
|
16561
|
-
var
|
|
16637
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
16562
16638
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
16563
16639
|
var DEFAULT_COUNT = 24;
|
|
16564
16640
|
var DEFAULT_SPEED_RANGE = [6, 14];
|
|
@@ -16586,10 +16662,10 @@ function FallingIcons({
|
|
|
16586
16662
|
physics,
|
|
16587
16663
|
easingFunction = "linear"
|
|
16588
16664
|
}) {
|
|
16589
|
-
const uid =
|
|
16590
|
-
const containerRef =
|
|
16591
|
-
const [fallDist, setFallDist] =
|
|
16592
|
-
const idRef =
|
|
16665
|
+
const uid = import_react24.default.useId().replace(/[:]/g, "");
|
|
16666
|
+
const containerRef = import_react24.default.useRef(null);
|
|
16667
|
+
const [fallDist, setFallDist] = import_react24.default.useState(null);
|
|
16668
|
+
const idRef = import_react24.default.useRef(1);
|
|
16593
16669
|
const gravity = physics?.gravity ?? 1;
|
|
16594
16670
|
const windDirection = physics?.windDirection ?? 0;
|
|
16595
16671
|
const windStrength = physics?.windStrength ?? 0;
|
|
@@ -16603,7 +16679,7 @@ function FallingIcons({
|
|
|
16603
16679
|
bounce: "cubic-bezier(0.68, -0.55, 0.265, 1.55)",
|
|
16604
16680
|
elastic: "cubic-bezier(0.175, 0.885, 0.32, 1.275)"
|
|
16605
16681
|
};
|
|
16606
|
-
const makeParticle =
|
|
16682
|
+
const makeParticle = import_react24.default.useCallback(() => {
|
|
16607
16683
|
const rnd = (min, max) => min + Math.random() * (max - min);
|
|
16608
16684
|
return {
|
|
16609
16685
|
leftPct: rnd(0, 100),
|
|
@@ -16617,12 +16693,12 @@ function FallingIcons({
|
|
|
16617
16693
|
key: idRef.current++
|
|
16618
16694
|
};
|
|
16619
16695
|
}, [sizeRange, speedRange, horizontalDrift, gravity, windDirection, windStrength]);
|
|
16620
|
-
const [particles, setParticles] =
|
|
16621
|
-
|
|
16696
|
+
const [particles, setParticles] = import_react24.default.useState([]);
|
|
16697
|
+
import_react24.default.useEffect(() => {
|
|
16622
16698
|
const arr = Array.from({ length: Math.max(0, count) }).map(() => makeParticle());
|
|
16623
16699
|
setParticles(arr);
|
|
16624
16700
|
}, [count, makeParticle]);
|
|
16625
|
-
|
|
16701
|
+
import_react24.default.useEffect(() => {
|
|
16626
16702
|
if (fullScreen) {
|
|
16627
16703
|
const measure2 = () => setFallDist(window.innerHeight + 200);
|
|
16628
16704
|
measure2();
|
|
@@ -16647,14 +16723,14 @@ function FallingIcons({
|
|
|
16647
16723
|
const SpinName = `uv-spin-${uid}`;
|
|
16648
16724
|
const PopName = `uv-pop-${uid}`;
|
|
16649
16725
|
const PhysicsSpinName = `uv-physics-spin-${uid}`;
|
|
16650
|
-
const glowStyles =
|
|
16726
|
+
const glowStyles = import_react24.default.useMemo(() => {
|
|
16651
16727
|
if (!glow) return {};
|
|
16652
16728
|
const intensity = Math.max(0, Math.min(1, glowIntensity));
|
|
16653
16729
|
return {
|
|
16654
16730
|
filter: `drop-shadow(0 0 ${4 * intensity}px ${glowColor}) drop-shadow(0 0 ${8 * intensity}px ${glowColor})`
|
|
16655
16731
|
};
|
|
16656
16732
|
}, [glow, glowColor, glowIntensity]);
|
|
16657
|
-
const FallbackIcon =
|
|
16733
|
+
const FallbackIcon = import_react24.default.useMemo(
|
|
16658
16734
|
() => function FallingIconsFallbackIcon(props) {
|
|
16659
16735
|
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
16736
|
},
|
|
@@ -16716,7 +16792,7 @@ function FallingIcons({
|
|
|
16716
16792
|
});
|
|
16717
16793
|
};
|
|
16718
16794
|
const trailParticles = trail ? Array.from({ length: Math.min(5, Math.max(1, trailLength)) }) : [];
|
|
16719
|
-
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
16795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_react24.default.Fragment, { children: [
|
|
16720
16796
|
trail && trailParticles.map((_, trailIndex) => {
|
|
16721
16797
|
const trailDelay = p.delay - (trailIndex + 1) * 0.15;
|
|
16722
16798
|
const trailOpacity = 1 - (trailIndex + 1) * (1 / (trailParticles.length + 1));
|
|
@@ -18123,7 +18199,7 @@ function ColorPicker({
|
|
|
18123
18199
|
}
|
|
18124
18200
|
|
|
18125
18201
|
// src/components/MusicPlayer.tsx
|
|
18126
|
-
var
|
|
18202
|
+
var import_react25 = require("react");
|
|
18127
18203
|
var import_lucide_react32 = require("lucide-react");
|
|
18128
18204
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
18129
18205
|
var DEFAULT_PLAYLIST = [
|
|
@@ -18244,21 +18320,21 @@ var MusicPlayer = ({
|
|
|
18244
18320
|
showPlaylist: initialShowPlaylist = true,
|
|
18245
18321
|
className = ""
|
|
18246
18322
|
}) => {
|
|
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,
|
|
18323
|
+
const [currentSongIndex, setCurrentSongIndex] = (0, import_react25.useState)(0);
|
|
18324
|
+
const [isPlaying, setIsPlaying] = (0, import_react25.useState)(false);
|
|
18325
|
+
const [currentTime, setCurrentTime] = (0, import_react25.useState)(0);
|
|
18326
|
+
const [duration, setDuration] = (0, import_react25.useState)(0);
|
|
18327
|
+
const [volume, setVolume] = (0, import_react25.useState)(1);
|
|
18328
|
+
const [isMuted, setIsMuted] = (0, import_react25.useState)(false);
|
|
18329
|
+
const [showPlaylist, setShowPlaylist] = (0, import_react25.useState)(initialShowPlaylist);
|
|
18330
|
+
const audioRef = (0, import_react25.useRef)(null);
|
|
18255
18331
|
const currentSong = playlist[currentSongIndex];
|
|
18256
|
-
(0,
|
|
18332
|
+
(0, import_react25.useEffect)(() => {
|
|
18257
18333
|
if (audioRef.current) {
|
|
18258
18334
|
audioRef.current.volume = volume;
|
|
18259
18335
|
}
|
|
18260
18336
|
}, [volume]);
|
|
18261
|
-
(0,
|
|
18337
|
+
(0, import_react25.useEffect)(() => {
|
|
18262
18338
|
if (autoPlay && audioRef.current) {
|
|
18263
18339
|
audioRef.current.play().catch(() => {
|
|
18264
18340
|
setIsPlaying(false);
|
|
@@ -18334,7 +18410,7 @@ var MusicPlayer = ({
|
|
|
18334
18410
|
setCurrentSongIndex(index);
|
|
18335
18411
|
setIsPlaying(true);
|
|
18336
18412
|
};
|
|
18337
|
-
(0,
|
|
18413
|
+
(0, import_react25.useEffect)(() => {
|
|
18338
18414
|
if (audioRef.current) {
|
|
18339
18415
|
if (currentSong.startTime !== void 0) {
|
|
18340
18416
|
audioRef.current.currentTime = currentSong.startTime;
|
|
@@ -18476,7 +18552,7 @@ var MusicPlayer = ({
|
|
|
18476
18552
|
var MusicPlayer_default = MusicPlayer;
|
|
18477
18553
|
|
|
18478
18554
|
// src/components/Grid.tsx
|
|
18479
|
-
var
|
|
18555
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
18480
18556
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
18481
18557
|
var BP_MIN = {
|
|
18482
18558
|
sm: 640,
|
|
@@ -18516,7 +18592,7 @@ function getVariantClasses(variant = "default", outlined) {
|
|
|
18516
18592
|
};
|
|
18517
18593
|
return variants[variant] || "";
|
|
18518
18594
|
}
|
|
18519
|
-
var GridRoot =
|
|
18595
|
+
var GridRoot = import_react26.default.forwardRef(
|
|
18520
18596
|
({
|
|
18521
18597
|
columns,
|
|
18522
18598
|
rows,
|
|
@@ -18541,7 +18617,7 @@ var GridRoot = import_react25.default.forwardRef(
|
|
|
18541
18617
|
children,
|
|
18542
18618
|
...rest
|
|
18543
18619
|
}, ref) => {
|
|
18544
|
-
const id = (0,
|
|
18620
|
+
const id = (0, import_react26.useId)().replace(/[:]/g, "");
|
|
18545
18621
|
const baseClass = `uv-grid-${id}`;
|
|
18546
18622
|
const baseCols = toTemplateCols(columns, minColumnWidth);
|
|
18547
18623
|
const baseRows = toTemplateRows(rows);
|
|
@@ -18600,7 +18676,7 @@ var GridRoot = import_react25.default.forwardRef(
|
|
|
18600
18676
|
}
|
|
18601
18677
|
);
|
|
18602
18678
|
GridRoot.displayName = "Grid";
|
|
18603
|
-
var GridItem =
|
|
18679
|
+
var GridItem = import_react26.default.forwardRef(
|
|
18604
18680
|
({
|
|
18605
18681
|
colSpan,
|
|
18606
18682
|
rowSpan,
|
|
@@ -18664,13 +18740,9 @@ var Grid = Object.assign(GridRoot, { Item: GridItem });
|
|
|
18664
18740
|
var Grid_default = Grid;
|
|
18665
18741
|
|
|
18666
18742
|
// src/components/ClientOnly.tsx
|
|
18667
|
-
var import_react26 = require("react");
|
|
18668
18743
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
18669
18744
|
function ClientOnly({ children, fallback = null }) {
|
|
18670
|
-
const
|
|
18671
|
-
(0, import_react26.useEffect)(() => {
|
|
18672
|
-
setHasMounted(true);
|
|
18673
|
-
}, []);
|
|
18745
|
+
const hasMounted = useHydrated();
|
|
18674
18746
|
if (!hasMounted) {
|
|
18675
18747
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children: fallback });
|
|
18676
18748
|
}
|
|
@@ -18773,7 +18845,7 @@ var TABLE_CONTAINER_BASE_CLASS = [
|
|
|
18773
18845
|
"bg-card text-card-foreground shadow-sm",
|
|
18774
18846
|
"backdrop-blur-sm transition-all duration-300"
|
|
18775
18847
|
].join(" ");
|
|
18776
|
-
function
|
|
18848
|
+
function assignRef(ref, value) {
|
|
18777
18849
|
if (typeof ref === "function") {
|
|
18778
18850
|
ref(value);
|
|
18779
18851
|
return;
|
|
@@ -18790,7 +18862,7 @@ var TableContainer = import_react27.default.forwardRef(({ className, useOverlayS
|
|
|
18790
18862
|
{
|
|
18791
18863
|
ref: (node) => {
|
|
18792
18864
|
containerRef.current = node;
|
|
18793
|
-
|
|
18865
|
+
assignRef(ref, node);
|
|
18794
18866
|
},
|
|
18795
18867
|
className: cn(TABLE_CONTAINER_BASE_CLASS, className),
|
|
18796
18868
|
...props
|
|
@@ -19542,39 +19614,40 @@ var import_react34 = __toESM(require("react"), 1);
|
|
|
19542
19614
|
|
|
19543
19615
|
// src/components/DataTable/hooks/usePageSizeStorage.ts
|
|
19544
19616
|
var import_react33 = __toESM(require("react"), 1);
|
|
19617
|
+
function readStoredPageSize(storageKey) {
|
|
19618
|
+
if (typeof window === "undefined" || !storageKey) return null;
|
|
19619
|
+
try {
|
|
19620
|
+
const saved = localStorage.getItem(`datatable_${storageKey}_pageSize`);
|
|
19621
|
+
if (!saved) return null;
|
|
19622
|
+
const parsed = parseInt(saved, 10);
|
|
19623
|
+
return !isNaN(parsed) && parsed > 0 ? parsed : null;
|
|
19624
|
+
} catch {
|
|
19625
|
+
return null;
|
|
19626
|
+
}
|
|
19627
|
+
}
|
|
19545
19628
|
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;
|
|
19629
|
+
const storedPageSize = import_react33.default.useMemo(() => readStoredPageSize(storageKey), [storageKey]);
|
|
19630
|
+
const [overrideState, setOverrideState] = import_react33.default.useState({
|
|
19631
|
+
storageKey,
|
|
19632
|
+
pageSize: null
|
|
19561
19633
|
});
|
|
19562
|
-
const
|
|
19563
|
-
|
|
19564
|
-
|
|
19565
|
-
|
|
19566
|
-
import_react33.default.
|
|
19567
|
-
|
|
19568
|
-
|
|
19569
|
-
|
|
19570
|
-
|
|
19571
|
-
|
|
19572
|
-
|
|
19573
|
-
|
|
19574
|
-
|
|
19575
|
-
|
|
19576
|
-
|
|
19577
|
-
|
|
19634
|
+
const overridePageSize = overrideState.storageKey === storageKey ? overrideState.pageSize : null;
|
|
19635
|
+
const persistedPageSize = storageKey ? overridePageSize ?? storedPageSize : null;
|
|
19636
|
+
const loadedFromStorage = persistedPageSize != null;
|
|
19637
|
+
const curPageSize = storageKey ? persistedPageSize ?? pageSize : overridePageSize ?? pageSize;
|
|
19638
|
+
const setCurPageSize = import_react33.default.useCallback(
|
|
19639
|
+
(nextPageSize) => {
|
|
19640
|
+
const baseValue = storageKey ? persistedPageSize ?? pageSize : overridePageSize ?? pageSize;
|
|
19641
|
+
const resolved = typeof nextPageSize === "function" ? nextPageSize(baseValue) : nextPageSize;
|
|
19642
|
+
setOverrideState({ storageKey, pageSize: resolved });
|
|
19643
|
+
if (!storageKey || typeof window === "undefined") return;
|
|
19644
|
+
try {
|
|
19645
|
+
localStorage.setItem(`datatable_${storageKey}_pageSize`, String(resolved));
|
|
19646
|
+
} catch {
|
|
19647
|
+
}
|
|
19648
|
+
},
|
|
19649
|
+
[overridePageSize, pageSize, persistedPageSize, storageKey]
|
|
19650
|
+
);
|
|
19578
19651
|
return { curPageSize, setCurPageSize, loadedFromStorage };
|
|
19579
19652
|
}
|
|
19580
19653
|
|
|
@@ -20247,16 +20320,15 @@ function ThemeToggleHeadless({
|
|
|
20247
20320
|
className
|
|
20248
20321
|
}) {
|
|
20249
20322
|
const [isOpen, setIsOpen] = (0, import_react37.useState)(false);
|
|
20250
|
-
const
|
|
20323
|
+
const isHydrated = useHydrated();
|
|
20251
20324
|
const triggerRef = (0, import_react37.useRef)(null);
|
|
20252
20325
|
const [dropdownPosition, setDropdownPosition] = (0, import_react37.useState)(null);
|
|
20253
|
-
(0, import_react37.useEffect)(() => setMounted(true), []);
|
|
20254
20326
|
const themes = [
|
|
20255
20327
|
{ value: "light", label: labels?.light ?? "Light", icon: import_lucide_react37.Sun },
|
|
20256
20328
|
{ value: "dark", label: labels?.dark ?? "Dark", icon: import_lucide_react37.Moon },
|
|
20257
20329
|
{ value: "system", label: labels?.system ?? "System", icon: import_lucide_react37.Monitor }
|
|
20258
20330
|
];
|
|
20259
|
-
const current =
|
|
20331
|
+
const current = isHydrated ? themes.find((t) => t.value === theme) || themes[2] : themes[2];
|
|
20260
20332
|
const CurrentIcon = current.icon;
|
|
20261
20333
|
const calculatePosition = () => {
|
|
20262
20334
|
const rect = triggerRef.current?.getBoundingClientRect();
|
|
@@ -20931,7 +21003,7 @@ var import_lowlight = require("lowlight");
|
|
|
20931
21003
|
var import_core = require("@tiptap/core");
|
|
20932
21004
|
var import_suggestion = __toESM(require("@tiptap/suggestion"), 1);
|
|
20933
21005
|
var import_react39 = require("@tiptap/react");
|
|
20934
|
-
var import_react40 = require("react");
|
|
21006
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
20935
21007
|
var import_lucide_react39 = require("lucide-react");
|
|
20936
21008
|
var import_tippy = __toESM(require("tippy.js"), 1);
|
|
20937
21009
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
@@ -20961,12 +21033,23 @@ var DEFAULT_MESSAGES = {
|
|
|
20961
21033
|
table: "Table",
|
|
20962
21034
|
tableDesc: "Insert a table"
|
|
20963
21035
|
};
|
|
21036
|
+
function useResettingIndex2(resetToken) {
|
|
21037
|
+
const [state, setState] = import_react40.default.useState({ resetToken, index: 0 });
|
|
21038
|
+
const selectedIndex = Object.is(state.resetToken, resetToken) ? state.index : 0;
|
|
21039
|
+
const setSelectedIndex = import_react40.default.useCallback((nextIndex) => {
|
|
21040
|
+
setState((prev) => {
|
|
21041
|
+
const prevIndex = Object.is(prev.resetToken, resetToken) ? prev.index : 0;
|
|
21042
|
+
return {
|
|
21043
|
+
resetToken,
|
|
21044
|
+
index: typeof nextIndex === "function" ? nextIndex(prevIndex) : nextIndex
|
|
21045
|
+
};
|
|
21046
|
+
});
|
|
21047
|
+
}, [resetToken]);
|
|
21048
|
+
return [selectedIndex, setSelectedIndex];
|
|
21049
|
+
}
|
|
20964
21050
|
var CommandList = (0, import_react40.forwardRef)((props, ref) => {
|
|
20965
|
-
const [selectedIndex, setSelectedIndex] = (
|
|
21051
|
+
const [selectedIndex, setSelectedIndex] = useResettingIndex2(props.items);
|
|
20966
21052
|
const listRef = (0, import_react40.useRef)(null);
|
|
20967
|
-
(0, import_react40.useEffect)(() => {
|
|
20968
|
-
setSelectedIndex(0);
|
|
20969
|
-
}, [props.items]);
|
|
20970
21053
|
(0, import_react40.useEffect)(() => {
|
|
20971
21054
|
const selectedElement = listRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
20972
21055
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
@@ -21292,7 +21375,7 @@ var import_core3 = require("@tiptap/core");
|
|
|
21292
21375
|
var import_suggestion2 = __toESM(require("@tiptap/suggestion"), 1);
|
|
21293
21376
|
var import_react41 = require("@tiptap/react");
|
|
21294
21377
|
var import_state2 = require("@tiptap/pm/state");
|
|
21295
|
-
var import_react42 = require("react");
|
|
21378
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
21296
21379
|
var import_lucide_react40 = require("lucide-react");
|
|
21297
21380
|
var import_tippy2 = __toESM(require("tippy.js"), 1);
|
|
21298
21381
|
|
|
@@ -22063,11 +22146,22 @@ var EMOJI_LIST = [
|
|
|
22063
22146
|
|
|
22064
22147
|
// src/components/UEditor/emoji-suggestion.tsx
|
|
22065
22148
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
22149
|
+
function useResettingIndex3(resetToken) {
|
|
22150
|
+
const [state, setState] = import_react42.default.useState({ resetToken, index: 0 });
|
|
22151
|
+
const selectedIndex = Object.is(state.resetToken, resetToken) ? state.index : 0;
|
|
22152
|
+
const setSelectedIndex = import_react42.default.useCallback((nextIndex) => {
|
|
22153
|
+
setState((prev) => {
|
|
22154
|
+
const prevIndex = Object.is(prev.resetToken, resetToken) ? prev.index : 0;
|
|
22155
|
+
return {
|
|
22156
|
+
resetToken,
|
|
22157
|
+
index: typeof nextIndex === "function" ? nextIndex(prevIndex) : nextIndex
|
|
22158
|
+
};
|
|
22159
|
+
});
|
|
22160
|
+
}, [resetToken]);
|
|
22161
|
+
return [selectedIndex, setSelectedIndex];
|
|
22162
|
+
}
|
|
22066
22163
|
var EmojiList = (0, import_react42.forwardRef)((props, ref) => {
|
|
22067
|
-
const [selectedIndex, setSelectedIndex] = (
|
|
22068
|
-
(0, import_react42.useEffect)(() => {
|
|
22069
|
-
setSelectedIndex(0);
|
|
22070
|
-
}, [props.items]);
|
|
22164
|
+
const [selectedIndex, setSelectedIndex] = useResettingIndex3(props.items);
|
|
22071
22165
|
(0, import_react42.useImperativeHandle)(ref, () => ({
|
|
22072
22166
|
onKeyDown: ({ event }) => {
|
|
22073
22167
|
if (event.key === "ArrowUp") {
|
|
@@ -23481,13 +23575,27 @@ var EditorToolbar = ({
|
|
|
23481
23575
|
};
|
|
23482
23576
|
|
|
23483
23577
|
// src/components/UEditor/menus.tsx
|
|
23484
|
-
var import_react49 = require("react");
|
|
23578
|
+
var import_react49 = __toESM(require("react"), 1);
|
|
23485
23579
|
var import_react_dom8 = require("react-dom");
|
|
23486
23580
|
var import_lucide_react45 = require("lucide-react");
|
|
23487
23581
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
23582
|
+
function useResettingIndex4(resetToken) {
|
|
23583
|
+
const [state, setState] = import_react49.default.useState({ resetToken, index: 0 });
|
|
23584
|
+
const selectedIndex = Object.is(state.resetToken, resetToken) ? state.index : 0;
|
|
23585
|
+
const setSelectedIndex = import_react49.default.useCallback((nextIndex) => {
|
|
23586
|
+
setState((prev) => {
|
|
23587
|
+
const prevIndex = Object.is(prev.resetToken, resetToken) ? prev.index : 0;
|
|
23588
|
+
return {
|
|
23589
|
+
resetToken,
|
|
23590
|
+
index: typeof nextIndex === "function" ? nextIndex(prevIndex) : nextIndex
|
|
23591
|
+
};
|
|
23592
|
+
});
|
|
23593
|
+
}, [resetToken]);
|
|
23594
|
+
return [selectedIndex, setSelectedIndex];
|
|
23595
|
+
}
|
|
23488
23596
|
var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
23489
23597
|
const t = useSmartTranslations("UEditor");
|
|
23490
|
-
const [selectedIndex, setSelectedIndex] = (
|
|
23598
|
+
const [selectedIndex, setSelectedIndex] = useResettingIndex4(filterText);
|
|
23491
23599
|
const menuRef = (0, import_react49.useRef)(null);
|
|
23492
23600
|
const allCommands = (0, import_react49.useMemo)(
|
|
23493
23601
|
() => [
|
|
@@ -23565,13 +23673,10 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
23565
23673
|
const lowerFilter = filterText.toLowerCase();
|
|
23566
23674
|
return allCommands.filter((cmd) => cmd.label.toLowerCase().includes(lowerFilter) || cmd.description.toLowerCase().includes(lowerFilter));
|
|
23567
23675
|
}, [allCommands, filterText]);
|
|
23568
|
-
(0, import_react49.useEffect)(() => {
|
|
23569
|
-
setSelectedIndex(0);
|
|
23570
|
-
}, [filterText]);
|
|
23571
23676
|
(0, import_react49.useEffect)(() => {
|
|
23572
23677
|
const selectedElement = menuRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
23573
23678
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
23574
|
-
}, [selectedIndex]);
|
|
23679
|
+
}, [commands, selectedIndex, setSelectedIndex]);
|
|
23575
23680
|
const selectCommand = (0, import_react49.useCallback)(
|
|
23576
23681
|
(index) => {
|
|
23577
23682
|
const command = commands[index];
|
|
@@ -23601,7 +23706,7 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
23601
23706
|
};
|
|
23602
23707
|
document.addEventListener("keydown", handleKeyDown);
|
|
23603
23708
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
23604
|
-
}, [commands,
|
|
23709
|
+
}, [commands, onClose, selectCommand, selectedIndex, setSelectedIndex]);
|
|
23605
23710
|
if (commands.length === 0) {
|
|
23606
23711
|
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
23712
|
}
|