@underverse-ui/underverse 1.0.53 → 1.0.55
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 +404 -410
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -14
- package/dist/index.d.ts +3 -14
- package/dist/index.js +192 -198
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3667,7 +3667,7 @@ var ToastProvider = ({ children, position = "top-right", maxToasts = 5 }) => {
|
|
|
3667
3667
|
return updated.slice(0, maxToasts);
|
|
3668
3668
|
});
|
|
3669
3669
|
},
|
|
3670
|
-
[maxToasts
|
|
3670
|
+
[maxToasts]
|
|
3671
3671
|
);
|
|
3672
3672
|
const positionClasses = {
|
|
3673
3673
|
"top-right": "top-4 right-4",
|
|
@@ -4075,6 +4075,7 @@ var React15 = __toESM(require("react"), 1);
|
|
|
4075
4075
|
var import_react_dom3 = require("react-dom");
|
|
4076
4076
|
|
|
4077
4077
|
// src/utils/animations.ts
|
|
4078
|
+
var import_react8 = require("react");
|
|
4078
4079
|
var shadcnAnimationStyles = `
|
|
4079
4080
|
/* ============================================
|
|
4080
4081
|
* DROPDOWN / POPOVER ANIMATIONS
|
|
@@ -4240,7 +4241,7 @@ var shadcnAnimationStyles = `
|
|
|
4240
4241
|
transition: backdrop-filter 200ms ease, background-color 200ms ease;
|
|
4241
4242
|
}
|
|
4242
4243
|
`;
|
|
4243
|
-
function
|
|
4244
|
+
function ensureAnimationStylesInjected() {
|
|
4244
4245
|
if (typeof document !== "undefined") {
|
|
4245
4246
|
const styleId = "shadcn-animations";
|
|
4246
4247
|
if (!document.getElementById(styleId)) {
|
|
@@ -4251,8 +4252,13 @@ function useShadCNAnimations() {
|
|
|
4251
4252
|
}
|
|
4252
4253
|
}
|
|
4253
4254
|
}
|
|
4255
|
+
function useShadCNAnimations() {
|
|
4256
|
+
(0, import_react8.useEffect)(() => {
|
|
4257
|
+
ensureAnimationStylesInjected();
|
|
4258
|
+
}, []);
|
|
4259
|
+
}
|
|
4254
4260
|
function injectAnimationStyles() {
|
|
4255
|
-
|
|
4261
|
+
ensureAnimationStylesInjected();
|
|
4256
4262
|
}
|
|
4257
4263
|
function getAnimationStyles() {
|
|
4258
4264
|
return shadcnAnimationStyles;
|
|
@@ -4665,7 +4671,8 @@ var Sheet = ({
|
|
|
4665
4671
|
closeOnOutsideClick = true,
|
|
4666
4672
|
closeOnEscape = true,
|
|
4667
4673
|
header,
|
|
4668
|
-
footer
|
|
4674
|
+
footer,
|
|
4675
|
+
overlayOpacity
|
|
4669
4676
|
}) => {
|
|
4670
4677
|
const [mounted, setMounted] = React16.useState(false);
|
|
4671
4678
|
const [isAnimating, setIsAnimating] = React16.useState(true);
|
|
@@ -4724,8 +4731,9 @@ var Sheet = ({
|
|
|
4724
4731
|
className: cn(
|
|
4725
4732
|
"fixed inset-0 transition-all duration-300 ease-out",
|
|
4726
4733
|
variant === "overlay" ? "bg-background/95 backdrop-blur-sm" : "bg-background/80 backdrop-blur-sm",
|
|
4727
|
-
open && !isAnimating ? "opacity-100" : "opacity-0"
|
|
4734
|
+
overlayOpacity === void 0 && (open && !isAnimating ? "opacity-100" : "opacity-0")
|
|
4728
4735
|
),
|
|
4736
|
+
style: overlayOpacity !== void 0 ? { opacity: open && !isAnimating ? overlayOpacity : 0 } : void 0,
|
|
4729
4737
|
onClick: handleOverlayClick
|
|
4730
4738
|
}
|
|
4731
4739
|
),
|
|
@@ -4794,7 +4802,7 @@ var SidebarSheet = ({ navigation, children, ...props }) => {
|
|
|
4794
4802
|
};
|
|
4795
4803
|
|
|
4796
4804
|
// src/components/Alert.tsx
|
|
4797
|
-
var
|
|
4805
|
+
var import_react9 = require("react");
|
|
4798
4806
|
var import_lucide_react9 = require("lucide-react");
|
|
4799
4807
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
4800
4808
|
var variantConfig = {
|
|
@@ -4835,7 +4843,7 @@ var variantConfig = {
|
|
|
4835
4843
|
}
|
|
4836
4844
|
};
|
|
4837
4845
|
var Alert = ({ title, description, variant = "default", className, icon, dismissible = false, onClose, actions, closeAriaLabel }) => {
|
|
4838
|
-
const [open, setOpen] = (0,
|
|
4846
|
+
const [open, setOpen] = (0, import_react9.useState)(true);
|
|
4839
4847
|
const t = useSmartTranslations("Common");
|
|
4840
4848
|
if (!open) return null;
|
|
4841
4849
|
const handleClose = () => {
|
|
@@ -4880,7 +4888,7 @@ var Alert = ({ title, description, variant = "default", className, icon, dismiss
|
|
|
4880
4888
|
var Alert_default = Alert;
|
|
4881
4889
|
|
|
4882
4890
|
// src/components/GlobalLoading.tsx
|
|
4883
|
-
var
|
|
4891
|
+
var import_react10 = __toESM(require("react"), 1);
|
|
4884
4892
|
var import_lucide_react10 = require("lucide-react");
|
|
4885
4893
|
|
|
4886
4894
|
// src/utils/loading.ts
|
|
@@ -4927,8 +4935,8 @@ var loading = new LoadingManager();
|
|
|
4927
4935
|
// src/components/GlobalLoading.tsx
|
|
4928
4936
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4929
4937
|
var GlobalLoading = ({ className, backdrop = true, position = "fixed", size = "lg" }) => {
|
|
4930
|
-
const [state, setState] = (0,
|
|
4931
|
-
(0,
|
|
4938
|
+
const [state, setState] = (0, import_react10.useState)(() => loading.getState());
|
|
4939
|
+
(0, import_react10.useEffect)(() => {
|
|
4932
4940
|
const unsubscribe = loading.subscribe(setState);
|
|
4933
4941
|
return unsubscribe;
|
|
4934
4942
|
}, []);
|
|
@@ -4985,7 +4993,7 @@ var InlineLoading = ({ isLoading, text, className, size = "md" }) => {
|
|
|
4985
4993
|
] });
|
|
4986
4994
|
};
|
|
4987
4995
|
var ButtonLoading = ({ isLoading, children, className, disabled, loadingText }) => {
|
|
4988
|
-
const child =
|
|
4996
|
+
const child = import_react10.default.isValidElement(children) ? import_react10.default.cloneElement(children, {
|
|
4989
4997
|
disabled: (children.props?.disabled ?? false) || disabled || isLoading,
|
|
4990
4998
|
"aria-busy": isLoading || void 0
|
|
4991
4999
|
}) : children;
|
|
@@ -5335,7 +5343,7 @@ var VerticalTabs = ({ sidebarWidth = "w-48", className, ...props }) => {
|
|
|
5335
5343
|
};
|
|
5336
5344
|
|
|
5337
5345
|
// src/components/DropdownMenu.tsx
|
|
5338
|
-
var
|
|
5346
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
5339
5347
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
5340
5348
|
var DropdownMenu = ({
|
|
5341
5349
|
trigger,
|
|
@@ -5349,18 +5357,18 @@ var DropdownMenu = ({
|
|
|
5349
5357
|
onOpenChange,
|
|
5350
5358
|
items
|
|
5351
5359
|
}) => {
|
|
5352
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
5353
|
-
const triggerRef =
|
|
5354
|
-
const menuRef =
|
|
5355
|
-
const itemsRef =
|
|
5356
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
5360
|
+
const [internalOpen, setInternalOpen] = (0, import_react11.useState)(false);
|
|
5361
|
+
const triggerRef = import_react11.default.useRef(null);
|
|
5362
|
+
const menuRef = import_react11.default.useRef(null);
|
|
5363
|
+
const itemsRef = import_react11.default.useRef([]);
|
|
5364
|
+
const [activeIndex, setActiveIndex] = (0, import_react11.useState)(-1);
|
|
5357
5365
|
useShadCNAnimations();
|
|
5358
5366
|
const open = isOpen !== void 0 ? isOpen : internalOpen;
|
|
5359
5367
|
const setOpen = onOpenChange || setInternalOpen;
|
|
5360
|
-
|
|
5368
|
+
import_react11.default.useEffect(() => {
|
|
5361
5369
|
if (open) setActiveIndex(-1);
|
|
5362
5370
|
}, [open]);
|
|
5363
|
-
|
|
5371
|
+
import_react11.default.useEffect(() => {
|
|
5364
5372
|
if (!open) return;
|
|
5365
5373
|
const handleKeyNav = (e) => {
|
|
5366
5374
|
const active = document.activeElement;
|
|
@@ -5434,7 +5442,7 @@ var DropdownMenu = ({
|
|
|
5434
5442
|
index
|
|
5435
5443
|
);
|
|
5436
5444
|
}) : children });
|
|
5437
|
-
const enhancedTrigger =
|
|
5445
|
+
const enhancedTrigger = import_react11.default.cloneElement(trigger, {
|
|
5438
5446
|
ref: triggerRef,
|
|
5439
5447
|
"aria-haspopup": "menu",
|
|
5440
5448
|
"aria-expanded": open,
|
|
@@ -5548,11 +5556,11 @@ var import_lucide_react13 = require("lucide-react");
|
|
|
5548
5556
|
|
|
5549
5557
|
// src/components/Combobox.tsx
|
|
5550
5558
|
var React22 = __toESM(require("react"), 1);
|
|
5551
|
-
var
|
|
5559
|
+
var import_react13 = require("react");
|
|
5552
5560
|
var import_lucide_react12 = require("lucide-react");
|
|
5553
5561
|
|
|
5554
5562
|
// src/components/OverlayScrollbarProvider.tsx
|
|
5555
|
-
var
|
|
5563
|
+
var import_react12 = require("react");
|
|
5556
5564
|
var import_overlayscrollbars = require("overlayscrollbars");
|
|
5557
5565
|
|
|
5558
5566
|
// src/utils/overlay-scrollbar-controller.ts
|
|
@@ -5718,7 +5726,7 @@ function createOverlayScrollbarController({
|
|
|
5718
5726
|
|
|
5719
5727
|
// src/components/OverlayScrollbarProvider.tsx
|
|
5720
5728
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5721
|
-
var OverlayScrollbarConfigContext = (0,
|
|
5729
|
+
var OverlayScrollbarConfigContext = (0, import_react12.createContext)(DEFAULT_OVERLAY_SCROLLBAR_BEHAVIOR);
|
|
5722
5730
|
function OverlayScrollbarProvider({
|
|
5723
5731
|
enabled = DEFAULT_OVERLAY_SCROLLBAR_BEHAVIOR.enabled,
|
|
5724
5732
|
theme = DEFAULT_OVERLAY_SCROLLBAR_BEHAVIOR.theme,
|
|
@@ -5731,7 +5739,7 @@ function OverlayScrollbarProvider({
|
|
|
5731
5739
|
selector,
|
|
5732
5740
|
children
|
|
5733
5741
|
} = {}) {
|
|
5734
|
-
const value = (0,
|
|
5742
|
+
const value = (0, import_react12.useMemo)(
|
|
5735
5743
|
() => resolveOverlayScrollbarBehavior({
|
|
5736
5744
|
enabled,
|
|
5737
5745
|
theme,
|
|
@@ -5748,32 +5756,15 @@ function OverlayScrollbarProvider({
|
|
|
5748
5756
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(OverlayScrollbarConfigContext.Provider, { value, children: children ?? null });
|
|
5749
5757
|
}
|
|
5750
5758
|
function useOverlayScrollbarTarget(targetRef, options = {}) {
|
|
5751
|
-
const inherited = (0,
|
|
5752
|
-
const resolved = (0,
|
|
5759
|
+
const inherited = (0, import_react12.useContext)(OverlayScrollbarConfigContext);
|
|
5760
|
+
const resolved = (0, import_react12.useMemo)(
|
|
5753
5761
|
() => resolveOverlayScrollbarBehavior({
|
|
5754
5762
|
...inherited,
|
|
5755
5763
|
...options
|
|
5756
5764
|
}),
|
|
5757
|
-
[
|
|
5758
|
-
inherited.enabled,
|
|
5759
|
-
inherited.theme,
|
|
5760
|
-
inherited.visibility,
|
|
5761
|
-
inherited.autoHide,
|
|
5762
|
-
inherited.autoHideDelay,
|
|
5763
|
-
inherited.dragScroll,
|
|
5764
|
-
inherited.clickScroll,
|
|
5765
|
-
inherited.exclude,
|
|
5766
|
-
options.enabled,
|
|
5767
|
-
options.theme,
|
|
5768
|
-
options.visibility,
|
|
5769
|
-
options.autoHide,
|
|
5770
|
-
options.autoHideDelay,
|
|
5771
|
-
options.dragScroll,
|
|
5772
|
-
options.clickScroll,
|
|
5773
|
-
options.exclude
|
|
5774
|
-
]
|
|
5765
|
+
[inherited, options]
|
|
5775
5766
|
);
|
|
5776
|
-
(0,
|
|
5767
|
+
(0, import_react12.useEffect)(() => {
|
|
5777
5768
|
if (typeof window === "undefined") return;
|
|
5778
5769
|
const target = targetRef.current;
|
|
5779
5770
|
if (!target) return;
|
|
@@ -5787,17 +5778,7 @@ function useOverlayScrollbarTarget(targetRef, options = {}) {
|
|
|
5787
5778
|
return () => {
|
|
5788
5779
|
controller.destroy();
|
|
5789
5780
|
};
|
|
5790
|
-
}, [
|
|
5791
|
-
targetRef,
|
|
5792
|
-
resolved.enabled,
|
|
5793
|
-
resolved.theme,
|
|
5794
|
-
resolved.visibility,
|
|
5795
|
-
resolved.autoHide,
|
|
5796
|
-
resolved.autoHideDelay,
|
|
5797
|
-
resolved.dragScroll,
|
|
5798
|
-
resolved.clickScroll,
|
|
5799
|
-
resolved.exclude
|
|
5800
|
-
]);
|
|
5781
|
+
}, [targetRef, resolved]);
|
|
5801
5782
|
}
|
|
5802
5783
|
var OverlayScrollbarProvider_default = OverlayScrollbarProvider;
|
|
5803
5784
|
|
|
@@ -5858,7 +5839,7 @@ var Combobox = ({
|
|
|
5858
5839
|
const inputRef = React22.useRef(null);
|
|
5859
5840
|
const optionsViewportRef = React22.useRef(null);
|
|
5860
5841
|
useOverlayScrollbarTarget(optionsViewportRef, { enabled: useOverlayScrollbar });
|
|
5861
|
-
const autoId = (0,
|
|
5842
|
+
const autoId = (0, import_react13.useId)();
|
|
5862
5843
|
const resolvedId = id ? String(id) : `combobox-${autoId}`;
|
|
5863
5844
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
5864
5845
|
const enableSearch = options.length > 10;
|
|
@@ -6543,7 +6524,7 @@ var CompactPagination = ({ page, totalPages, onChange, className, disabled = fal
|
|
|
6543
6524
|
};
|
|
6544
6525
|
|
|
6545
6526
|
// src/components/Section.tsx
|
|
6546
|
-
var
|
|
6527
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
6547
6528
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
6548
6529
|
var gradientDirectionMap = {
|
|
6549
6530
|
"to-r": "to right",
|
|
@@ -6576,7 +6557,7 @@ var variantClasses = {
|
|
|
6576
6557
|
accent: "bg-accent/10",
|
|
6577
6558
|
gradient: ""
|
|
6578
6559
|
};
|
|
6579
|
-
var Section =
|
|
6560
|
+
var Section = import_react14.default.forwardRef(
|
|
6580
6561
|
({
|
|
6581
6562
|
children,
|
|
6582
6563
|
className,
|
|
@@ -6616,7 +6597,7 @@ Section.displayName = "Section";
|
|
|
6616
6597
|
var Section_default = Section;
|
|
6617
6598
|
|
|
6618
6599
|
// src/components/ScrollArea.tsx
|
|
6619
|
-
var
|
|
6600
|
+
var import_react15 = require("react");
|
|
6620
6601
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
6621
6602
|
var variantClasses2 = {
|
|
6622
6603
|
default: "bg-background",
|
|
@@ -6624,9 +6605,9 @@ var variantClasses2 = {
|
|
|
6624
6605
|
primary: "bg-primary/5",
|
|
6625
6606
|
accent: "bg-accent/10"
|
|
6626
6607
|
};
|
|
6627
|
-
var ScrollArea = (0,
|
|
6608
|
+
var ScrollArea = (0, import_react15.forwardRef)(
|
|
6628
6609
|
({ className, contentClassName, children, variant = "default", outlined = false, useOverlayScrollbar = false, ...props }, ref) => {
|
|
6629
|
-
const viewportRef = (0,
|
|
6610
|
+
const viewportRef = (0, import_react15.useRef)(null);
|
|
6630
6611
|
useOverlayScrollbarTarget(viewportRef, { enabled: useOverlayScrollbar });
|
|
6631
6612
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
6632
6613
|
"div",
|
|
@@ -6647,11 +6628,11 @@ var ScrollArea = (0, import_react14.forwardRef)(
|
|
|
6647
6628
|
ScrollArea.displayName = "ScrollArea";
|
|
6648
6629
|
|
|
6649
6630
|
// src/components/OverlayScrollArea.tsx
|
|
6650
|
-
var
|
|
6631
|
+
var import_react16 = require("react");
|
|
6651
6632
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
6652
|
-
var OverlayScrollArea = (0,
|
|
6633
|
+
var OverlayScrollArea = (0, import_react16.forwardRef)(
|
|
6653
6634
|
({ className, viewportClassName, viewportProps, enabled = true, overlayScrollbarOptions, children, ...props }, ref) => {
|
|
6654
|
-
const viewportRef = (0,
|
|
6635
|
+
const viewportRef = (0, import_react16.useRef)(null);
|
|
6655
6636
|
useOverlayScrollbarTarget(viewportRef, {
|
|
6656
6637
|
enabled,
|
|
6657
6638
|
...overlayScrollbarOptions
|
|
@@ -6886,7 +6867,7 @@ function formatDateSmart(date, locale = "en") {
|
|
|
6886
6867
|
// src/components/DatePicker.tsx
|
|
6887
6868
|
var import_lucide_react14 = require("lucide-react");
|
|
6888
6869
|
var React26 = __toESM(require("react"), 1);
|
|
6889
|
-
var
|
|
6870
|
+
var import_react17 = require("react");
|
|
6890
6871
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
6891
6872
|
var DatePicker = ({
|
|
6892
6873
|
id,
|
|
@@ -7285,7 +7266,7 @@ var DatePicker = ({
|
|
|
7285
7266
|
)
|
|
7286
7267
|
] })
|
|
7287
7268
|
] });
|
|
7288
|
-
const autoId = (0,
|
|
7269
|
+
const autoId = (0, import_react17.useId)();
|
|
7289
7270
|
const resolvedId = id ? String(id) : `datepicker-${autoId}`;
|
|
7290
7271
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
7291
7272
|
const labelSize = sizeStyles8[size].label;
|
|
@@ -11868,6 +11849,7 @@ function useSlotMetrics(args) {
|
|
|
11868
11849
|
}, [
|
|
11869
11850
|
activeView,
|
|
11870
11851
|
adaptiveSlotWidths,
|
|
11852
|
+
bodyClientWidth,
|
|
11871
11853
|
dayHeaderMarks,
|
|
11872
11854
|
dayHeaderSmart,
|
|
11873
11855
|
daySlotCompression,
|
|
@@ -11980,6 +11962,7 @@ function CalendarTimeline({
|
|
|
11980
11962
|
size = "md",
|
|
11981
11963
|
enableEventSheet,
|
|
11982
11964
|
eventSheetSize = "md",
|
|
11965
|
+
eventSheetOverlayOpacity,
|
|
11983
11966
|
renderEventSheet,
|
|
11984
11967
|
selectedEventId,
|
|
11985
11968
|
defaultSelectedEventId,
|
|
@@ -12253,7 +12236,7 @@ function CalendarTimeline({
|
|
|
12253
12236
|
});
|
|
12254
12237
|
React36.useEffect(() => {
|
|
12255
12238
|
onRangeChange?.(range);
|
|
12256
|
-
}, [range
|
|
12239
|
+
}, [range, onRangeChange]);
|
|
12257
12240
|
const leftRef = React36.useRef(null);
|
|
12258
12241
|
const bodyRef = React36.useRef(null);
|
|
12259
12242
|
const headerRef = React36.useRef(null);
|
|
@@ -12565,7 +12548,7 @@ function CalendarTimeline({
|
|
|
12565
12548
|
}
|
|
12566
12549
|
return dayFmt.format(d);
|
|
12567
12550
|
};
|
|
12568
|
-
}, [activeView, dueDateSprint, l.sprint, resolvedLocale, resolvedTimeZone, slotStarts
|
|
12551
|
+
}, [activeView, dueDateSprint, l.sprint, resolvedLocale, resolvedTimeZone, slotStarts]);
|
|
12569
12552
|
const openCreate = React36.useCallback(() => {
|
|
12570
12553
|
if (!canCreate) return;
|
|
12571
12554
|
if (activeEventSheetOpen) setEventSheetOpen(false);
|
|
@@ -12728,7 +12711,7 @@ function CalendarTimeline({
|
|
|
12728
12711
|
return;
|
|
12729
12712
|
}
|
|
12730
12713
|
},
|
|
12731
|
-
[getPointerContext, range.end, range.start, slotToDate, slots.length]
|
|
12714
|
+
[getPointerContext, range.end, range.start, setPreview, slotToDate, slots.length]
|
|
12732
12715
|
);
|
|
12733
12716
|
const flushDragPreview = React36.useCallback(() => {
|
|
12734
12717
|
dragPreviewRafRef.current = null;
|
|
@@ -13396,6 +13379,7 @@ function CalendarTimeline({
|
|
|
13396
13379
|
onOpenChange: setEventSheetOpen,
|
|
13397
13380
|
side: "right",
|
|
13398
13381
|
size: eventSheetSize,
|
|
13382
|
+
overlayOpacity: eventSheetOverlayOpacity,
|
|
13399
13383
|
title: selectedEvent.title ?? "Event",
|
|
13400
13384
|
description: selectedTimeText || void 0,
|
|
13401
13385
|
children: renderEventSheet ? renderEventSheet({
|
|
@@ -13472,7 +13456,7 @@ function CalendarTimeline({
|
|
|
13472
13456
|
|
|
13473
13457
|
// src/components/MultiCombobox.tsx
|
|
13474
13458
|
var React37 = __toESM(require("react"), 1);
|
|
13475
|
-
var
|
|
13459
|
+
var import_react18 = require("react");
|
|
13476
13460
|
var import_lucide_react23 = require("lucide-react");
|
|
13477
13461
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
13478
13462
|
var MultiCombobox = ({
|
|
@@ -13601,7 +13585,7 @@ var MultiCombobox = ({
|
|
|
13601
13585
|
outline: "border-2 border-input bg-transparent hover:border-primary",
|
|
13602
13586
|
ghost: "border border-transparent bg-muted/50 hover:bg-muted"
|
|
13603
13587
|
};
|
|
13604
|
-
const autoId = (0,
|
|
13588
|
+
const autoId = (0, import_react18.useId)();
|
|
13605
13589
|
const resolvedId = id ? String(id) : `multicombobox-${autoId}`;
|
|
13606
13590
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
13607
13591
|
const labelSize = size === "sm" ? "text-xs" : size === "lg" ? "text-base" : "text-sm";
|
|
@@ -14281,7 +14265,10 @@ var Slider = React39.forwardRef(
|
|
|
14281
14265
|
const currentRange = isRangeControlled ? rangeValue : internalRange;
|
|
14282
14266
|
const rangeMin = clamp6(currentRange[0] ?? min, min, max);
|
|
14283
14267
|
const rangeMax = clamp6(currentRange[1] ?? max, min, max);
|
|
14284
|
-
const normalizedRange =
|
|
14268
|
+
const normalizedRange = React39.useMemo(
|
|
14269
|
+
() => rangeMin <= rangeMax ? [rangeMin, rangeMax] : [rangeMax, rangeMin],
|
|
14270
|
+
[rangeMax, rangeMin]
|
|
14271
|
+
);
|
|
14285
14272
|
const handleSingleChange = React39.useCallback(
|
|
14286
14273
|
(e) => {
|
|
14287
14274
|
const newValue = Number(e.target.value);
|
|
@@ -14587,7 +14574,7 @@ Slider.displayName = "Slider";
|
|
|
14587
14574
|
|
|
14588
14575
|
// src/components/OverlayControls.tsx
|
|
14589
14576
|
var import_lucide_react24 = require("lucide-react");
|
|
14590
|
-
var
|
|
14577
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
14591
14578
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
14592
14579
|
function OverlayControls({
|
|
14593
14580
|
mode,
|
|
@@ -14618,24 +14605,24 @@ function OverlayControls({
|
|
|
14618
14605
|
}) {
|
|
14619
14606
|
const hoverClasses = showOnHover ? "opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto" : "opacity-100 pointer-events-auto";
|
|
14620
14607
|
const showControlsBar = mode === "review";
|
|
14621
|
-
const [rateOpen, setRateOpen] =
|
|
14622
|
-
const rateWrapRef =
|
|
14623
|
-
const [controlsVisible, setControlsVisible] =
|
|
14624
|
-
const hideTimerRef =
|
|
14625
|
-
const [previewData, setPreviewData] =
|
|
14626
|
-
const sliderRef =
|
|
14627
|
-
const [isDragging, setIsDragging] =
|
|
14628
|
-
const [dragValue, setDragValue] =
|
|
14629
|
-
|
|
14608
|
+
const [rateOpen, setRateOpen] = import_react19.default.useState(false);
|
|
14609
|
+
const rateWrapRef = import_react19.default.useRef(null);
|
|
14610
|
+
const [controlsVisible, setControlsVisible] = import_react19.default.useState(true);
|
|
14611
|
+
const hideTimerRef = import_react19.default.useRef(null);
|
|
14612
|
+
const [previewData, setPreviewData] = import_react19.default.useState(null);
|
|
14613
|
+
const sliderRef = import_react19.default.useRef(null);
|
|
14614
|
+
const [isDragging, setIsDragging] = import_react19.default.useState(false);
|
|
14615
|
+
const [dragValue, setDragValue] = import_react19.default.useState(value);
|
|
14616
|
+
import_react19.default.useEffect(() => {
|
|
14630
14617
|
if (!isDragging) {
|
|
14631
14618
|
setDragValue(value);
|
|
14632
14619
|
}
|
|
14633
14620
|
}, [value, isDragging]);
|
|
14634
|
-
const [keyboardFeedback, setKeyboardFeedback] =
|
|
14635
|
-
const feedbackTimerRef =
|
|
14636
|
-
const seekAccumulatorRef =
|
|
14637
|
-
const seekAccumulatorTimerRef =
|
|
14638
|
-
|
|
14621
|
+
const [keyboardFeedback, setKeyboardFeedback] = import_react19.default.useState(null);
|
|
14622
|
+
const feedbackTimerRef = import_react19.default.useRef(null);
|
|
14623
|
+
const seekAccumulatorRef = import_react19.default.useRef(0);
|
|
14624
|
+
const seekAccumulatorTimerRef = import_react19.default.useRef(null);
|
|
14625
|
+
import_react19.default.useEffect(() => {
|
|
14639
14626
|
const onDocDown = (e) => {
|
|
14640
14627
|
if (!rateOpen) return;
|
|
14641
14628
|
const wrap = rateWrapRef.current;
|
|
@@ -14646,7 +14633,7 @@ function OverlayControls({
|
|
|
14646
14633
|
document.addEventListener("mousedown", onDocDown);
|
|
14647
14634
|
return () => document.removeEventListener("mousedown", onDocDown);
|
|
14648
14635
|
}, [rateOpen]);
|
|
14649
|
-
|
|
14636
|
+
import_react19.default.useEffect(() => {
|
|
14650
14637
|
if (!autoHide || showOnHover) return;
|
|
14651
14638
|
const resetTimer = () => {
|
|
14652
14639
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
@@ -14669,22 +14656,22 @@ function OverlayControls({
|
|
|
14669
14656
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
14670
14657
|
};
|
|
14671
14658
|
}, [autoHide, autoHideDelay, showOnHover]);
|
|
14672
|
-
const showFeedback = (type, value2) => {
|
|
14659
|
+
const showFeedback = import_react19.default.useCallback((type, value2) => {
|
|
14673
14660
|
if (feedbackTimerRef.current) clearTimeout(feedbackTimerRef.current);
|
|
14674
14661
|
setKeyboardFeedback({ type, value: value2 });
|
|
14675
14662
|
feedbackTimerRef.current = setTimeout(() => {
|
|
14676
14663
|
setKeyboardFeedback(null);
|
|
14677
14664
|
}, 800);
|
|
14678
|
-
};
|
|
14679
|
-
const accumulateSeek = (seconds) => {
|
|
14665
|
+
}, []);
|
|
14666
|
+
const accumulateSeek = import_react19.default.useCallback((seconds) => {
|
|
14680
14667
|
if (seekAccumulatorTimerRef.current) clearTimeout(seekAccumulatorTimerRef.current);
|
|
14681
14668
|
seekAccumulatorRef.current += seconds;
|
|
14682
14669
|
showFeedback("seek", seekAccumulatorRef.current);
|
|
14683
14670
|
seekAccumulatorTimerRef.current = setTimeout(() => {
|
|
14684
14671
|
seekAccumulatorRef.current = 0;
|
|
14685
14672
|
}, 1e3);
|
|
14686
|
-
};
|
|
14687
|
-
|
|
14673
|
+
}, [showFeedback]);
|
|
14674
|
+
import_react19.default.useEffect(() => {
|
|
14688
14675
|
if (!enableKeyboardShortcuts) return;
|
|
14689
14676
|
const handleKeyDown = (e) => {
|
|
14690
14677
|
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return;
|
|
@@ -14782,6 +14769,7 @@ function OverlayControls({
|
|
|
14782
14769
|
onSkip,
|
|
14783
14770
|
skipSeconds,
|
|
14784
14771
|
onChange,
|
|
14772
|
+
onCommit,
|
|
14785
14773
|
value,
|
|
14786
14774
|
max,
|
|
14787
14775
|
onVolumeChange,
|
|
@@ -14789,7 +14777,9 @@ function OverlayControls({
|
|
|
14789
14777
|
onToggleFullscreen,
|
|
14790
14778
|
onToggleMute,
|
|
14791
14779
|
playing,
|
|
14792
|
-
muted
|
|
14780
|
+
muted,
|
|
14781
|
+
accumulateSeek,
|
|
14782
|
+
showFeedback
|
|
14793
14783
|
]);
|
|
14794
14784
|
const formatTime3 = (sec) => {
|
|
14795
14785
|
if (!isFinite(sec) || sec < 0) return "0:00";
|
|
@@ -15019,7 +15009,7 @@ function OverlayControls({
|
|
|
15019
15009
|
}
|
|
15020
15010
|
|
|
15021
15011
|
// src/components/CategoryTreeSelect.tsx
|
|
15022
|
-
var
|
|
15012
|
+
var import_react20 = require("react");
|
|
15023
15013
|
var import_lucide_react25 = require("lucide-react");
|
|
15024
15014
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
15025
15015
|
var defaultLabels = {
|
|
@@ -15052,22 +15042,25 @@ function CategoryTreeSelect(props) {
|
|
|
15052
15042
|
useOverlayScrollbar = false,
|
|
15053
15043
|
singleSelect = false
|
|
15054
15044
|
} = props;
|
|
15055
|
-
const [isOpen, setIsOpen] = (0,
|
|
15056
|
-
const [expandedNodes, setExpandedNodes] = (0,
|
|
15057
|
-
const [query, setQuery] = (0,
|
|
15058
|
-
const searchInputRef = (0,
|
|
15059
|
-
const dropdownViewportRef = (0,
|
|
15045
|
+
const [isOpen, setIsOpen] = (0, import_react20.useState)(false);
|
|
15046
|
+
const [expandedNodes, setExpandedNodes] = (0, import_react20.useState)(/* @__PURE__ */ new Set());
|
|
15047
|
+
const [query, setQuery] = (0, import_react20.useState)("");
|
|
15048
|
+
const searchInputRef = (0, import_react20.useRef)(null);
|
|
15049
|
+
const dropdownViewportRef = (0, import_react20.useRef)(null);
|
|
15060
15050
|
useOverlayScrollbarTarget(dropdownViewportRef, { enabled: useOverlayScrollbar });
|
|
15061
|
-
const autoId = (0,
|
|
15051
|
+
const autoId = (0, import_react20.useId)();
|
|
15062
15052
|
const resolvedId = id ? String(id) : `category-tree-select-${autoId}`;
|
|
15063
15053
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
15064
15054
|
const helperId = helperText && !error ? `${resolvedId}-helper` : void 0;
|
|
15065
15055
|
const errorId = error ? `${resolvedId}-error` : void 0;
|
|
15066
15056
|
const describedBy = errorId || helperId;
|
|
15067
15057
|
const mergedLabels = { ...defaultLabels, ...labels };
|
|
15068
|
-
const valueArray =
|
|
15069
|
-
|
|
15070
|
-
|
|
15058
|
+
const valueArray = (0, import_react20.useMemo)(
|
|
15059
|
+
() => singleSelect ? props.value != null ? [props.value] : [] : props.value ?? [],
|
|
15060
|
+
[props.value, singleSelect]
|
|
15061
|
+
);
|
|
15062
|
+
const selectedIds = (0, import_react20.useMemo)(() => new Set(valueArray), [valueArray]);
|
|
15063
|
+
const { parentCategories, childrenMap, byId } = (0, import_react20.useMemo)(() => {
|
|
15071
15064
|
const byId2 = /* @__PURE__ */ new Map();
|
|
15072
15065
|
const childrenMap2 = /* @__PURE__ */ new Map();
|
|
15073
15066
|
const parentCategories2 = [];
|
|
@@ -15082,10 +15075,10 @@ function CategoryTreeSelect(props) {
|
|
|
15082
15075
|
}
|
|
15083
15076
|
return { parentCategories: parentCategories2, childrenMap: childrenMap2, byId: byId2 };
|
|
15084
15077
|
}, [categories]);
|
|
15085
|
-
const isSearchEnabled = (0,
|
|
15086
|
-
const normalizedQuery = (0,
|
|
15078
|
+
const isSearchEnabled = (0, import_react20.useMemo)(() => enableSearch ?? categories.length > 10, [enableSearch, categories.length]);
|
|
15079
|
+
const normalizedQuery = (0, import_react20.useMemo)(() => query.trim().toLowerCase(), [query]);
|
|
15087
15080
|
const isSearchMode = isSearchEnabled && normalizedQuery.length > 0;
|
|
15088
|
-
const visibleIds = (0,
|
|
15081
|
+
const visibleIds = (0, import_react20.useMemo)(() => {
|
|
15089
15082
|
if (!isSearchMode) return null;
|
|
15090
15083
|
const matches = categories.filter((c) => c.name.toLowerCase().includes(normalizedQuery));
|
|
15091
15084
|
if (matches.length === 0) return /* @__PURE__ */ new Set();
|
|
@@ -15124,21 +15117,21 @@ function CategoryTreeSelect(props) {
|
|
|
15124
15117
|
}
|
|
15125
15118
|
return visible;
|
|
15126
15119
|
}, [byId, categories, childrenMap, isSearchMode, normalizedQuery]);
|
|
15127
|
-
(0,
|
|
15120
|
+
(0, import_react20.useEffect)(() => {
|
|
15128
15121
|
if (!isOpen) setQuery("");
|
|
15129
15122
|
}, [isOpen]);
|
|
15130
|
-
(0,
|
|
15123
|
+
(0, import_react20.useEffect)(() => {
|
|
15131
15124
|
if (!isOpen) return;
|
|
15132
15125
|
if (!isSearchEnabled) return;
|
|
15133
15126
|
const t = setTimeout(() => searchInputRef.current?.focus(), 50);
|
|
15134
15127
|
return () => clearTimeout(t);
|
|
15135
15128
|
}, [isOpen, isSearchEnabled]);
|
|
15136
|
-
(0,
|
|
15129
|
+
(0, import_react20.useEffect)(() => {
|
|
15137
15130
|
if ((viewOnly || inline) && defaultExpanded) {
|
|
15138
15131
|
const allParentIds = categories.filter((c) => childrenMap.has(c.id)).map((c) => c.id);
|
|
15139
15132
|
setExpandedNodes(new Set(allParentIds));
|
|
15140
15133
|
}
|
|
15141
|
-
}, [viewOnly, inline, defaultExpanded, categories]);
|
|
15134
|
+
}, [viewOnly, inline, defaultExpanded, categories, childrenMap]);
|
|
15142
15135
|
const toggleExpand = (id2) => {
|
|
15143
15136
|
if (isSearchMode) return;
|
|
15144
15137
|
const newExpanded = new Set(expandedNodes);
|
|
@@ -15296,11 +15289,11 @@ function CategoryTreeSelect(props) {
|
|
|
15296
15289
|
)
|
|
15297
15290
|
] }) });
|
|
15298
15291
|
};
|
|
15299
|
-
const effectiveParentCategories = (0,
|
|
15292
|
+
const effectiveParentCategories = (0, import_react20.useMemo)(() => {
|
|
15300
15293
|
if (!isSearchMode) return parentCategories;
|
|
15301
15294
|
return parentCategories.filter((c) => visibleIds?.has(c.id));
|
|
15302
15295
|
}, [isSearchMode, parentCategories, visibleIds]);
|
|
15303
|
-
const effectiveChildrenMap = (0,
|
|
15296
|
+
const effectiveChildrenMap = (0, import_react20.useMemo)(() => {
|
|
15304
15297
|
if (!isSearchMode || !visibleIds) return childrenMap;
|
|
15305
15298
|
const next = /* @__PURE__ */ new Map();
|
|
15306
15299
|
for (const [parentId, children] of childrenMap.entries()) {
|
|
@@ -15470,6 +15463,7 @@ function CategoryTreeSelect(props) {
|
|
|
15470
15463
|
disabled,
|
|
15471
15464
|
role: "combobox",
|
|
15472
15465
|
"aria-haspopup": "tree",
|
|
15466
|
+
"aria-expanded": isOpen,
|
|
15473
15467
|
"aria-controls": `${resolvedId}-tree`,
|
|
15474
15468
|
"aria-labelledby": labelId,
|
|
15475
15469
|
"aria-describedby": describedBy,
|
|
@@ -15541,7 +15535,7 @@ function CategoryTreeSelect(props) {
|
|
|
15541
15535
|
}
|
|
15542
15536
|
|
|
15543
15537
|
// src/components/ImageUpload.tsx
|
|
15544
|
-
var
|
|
15538
|
+
var import_react21 = require("react");
|
|
15545
15539
|
var import_lucide_react26 = require("lucide-react");
|
|
15546
15540
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
15547
15541
|
function ImageUpload({
|
|
@@ -15559,10 +15553,10 @@ function ImageUpload({
|
|
|
15559
15553
|
browseText,
|
|
15560
15554
|
supportedFormatsText
|
|
15561
15555
|
}) {
|
|
15562
|
-
const [isDragging, setIsDragging] = (0,
|
|
15563
|
-
const [uploading, setUploading] = (0,
|
|
15564
|
-
const [uploadedImages, setUploadedImages] = (0,
|
|
15565
|
-
const fileInputRef = (0,
|
|
15556
|
+
const [isDragging, setIsDragging] = (0, import_react21.useState)(false);
|
|
15557
|
+
const [uploading, setUploading] = (0, import_react21.useState)(false);
|
|
15558
|
+
const [uploadedImages, setUploadedImages] = (0, import_react21.useState)([]);
|
|
15559
|
+
const fileInputRef = (0, import_react21.useRef)(null);
|
|
15566
15560
|
const { addToast } = useToast();
|
|
15567
15561
|
const t = useSmartTranslations("OCR.imageUpload");
|
|
15568
15562
|
const previewSizes = {
|
|
@@ -15570,7 +15564,7 @@ function ImageUpload({
|
|
|
15570
15564
|
md: "w-24 h-24",
|
|
15571
15565
|
lg: "w-32 h-32"
|
|
15572
15566
|
};
|
|
15573
|
-
const handleDragOver = (0,
|
|
15567
|
+
const handleDragOver = (0, import_react21.useCallback)(
|
|
15574
15568
|
(e) => {
|
|
15575
15569
|
e.preventDefault();
|
|
15576
15570
|
if (!disabled) {
|
|
@@ -15579,11 +15573,11 @@ function ImageUpload({
|
|
|
15579
15573
|
},
|
|
15580
15574
|
[disabled]
|
|
15581
15575
|
);
|
|
15582
|
-
const handleDragLeave = (0,
|
|
15576
|
+
const handleDragLeave = (0, import_react21.useCallback)((e) => {
|
|
15583
15577
|
e.preventDefault();
|
|
15584
15578
|
setIsDragging(false);
|
|
15585
15579
|
}, []);
|
|
15586
|
-
const handleFiles = (0,
|
|
15580
|
+
const handleFiles = (0, import_react21.useCallback)(
|
|
15587
15581
|
async (files) => {
|
|
15588
15582
|
if (files.length === 0) return;
|
|
15589
15583
|
const validFiles = files.filter((file) => {
|
|
@@ -15650,7 +15644,7 @@ function ImageUpload({
|
|
|
15650
15644
|
},
|
|
15651
15645
|
[maxSize, addToast, onUpload]
|
|
15652
15646
|
);
|
|
15653
|
-
const handleDrop = (0,
|
|
15647
|
+
const handleDrop = (0, import_react21.useCallback)(
|
|
15654
15648
|
(e) => {
|
|
15655
15649
|
e.preventDefault();
|
|
15656
15650
|
setIsDragging(false);
|
|
@@ -15660,7 +15654,7 @@ function ImageUpload({
|
|
|
15660
15654
|
},
|
|
15661
15655
|
[disabled, handleFiles]
|
|
15662
15656
|
);
|
|
15663
|
-
const handleFileSelect = (0,
|
|
15657
|
+
const handleFileSelect = (0, import_react21.useCallback)(
|
|
15664
15658
|
(e) => {
|
|
15665
15659
|
const files = Array.from(e.target.files || []);
|
|
15666
15660
|
handleFiles(files);
|
|
@@ -15764,11 +15758,8 @@ function ImageUpload({
|
|
|
15764
15758
|
|
|
15765
15759
|
// src/components/FileUpload.tsx
|
|
15766
15760
|
var import_lucide_react27 = require("lucide-react");
|
|
15767
|
-
var
|
|
15768
|
-
var import_jsx_runtime48 = (
|
|
15769
|
-
// eslint-disable-next-line @next/next/no-img-element
|
|
15770
|
-
require("react/jsx-runtime")
|
|
15771
|
-
);
|
|
15761
|
+
var import_react22 = require("react");
|
|
15762
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
15772
15763
|
var formatFileSize = (bytes) => {
|
|
15773
15764
|
if (bytes === 0) return "0 Bytes";
|
|
15774
15765
|
const k = 1024;
|
|
@@ -15874,12 +15865,12 @@ function FileUpload({
|
|
|
15874
15865
|
allowPreview = true,
|
|
15875
15866
|
initialFiles = []
|
|
15876
15867
|
}) {
|
|
15877
|
-
const [isDragging, setIsDragging] = (0,
|
|
15878
|
-
const [files, setFiles] = (0,
|
|
15879
|
-
const fileInputRef = (0,
|
|
15868
|
+
const [isDragging, setIsDragging] = (0, import_react22.useState)(false);
|
|
15869
|
+
const [files, setFiles] = (0, import_react22.useState)(initialFiles);
|
|
15870
|
+
const fileInputRef = (0, import_react22.useRef)(null);
|
|
15880
15871
|
const { addToast } = useToast();
|
|
15881
15872
|
const t = useSmartTranslations("FileUpload");
|
|
15882
|
-
const sizeConfig = (0,
|
|
15873
|
+
const sizeConfig = (0, import_react22.useMemo)(
|
|
15883
15874
|
() => ({
|
|
15884
15875
|
sm: {
|
|
15885
15876
|
padding: "p-4",
|
|
@@ -15912,7 +15903,7 @@ function FileUpload({
|
|
|
15912
15903
|
[]
|
|
15913
15904
|
);
|
|
15914
15905
|
const currentSize = sizeConfig[size];
|
|
15915
|
-
const handleDragOver = (0,
|
|
15906
|
+
const handleDragOver = (0, import_react22.useCallback)(
|
|
15916
15907
|
(e) => {
|
|
15917
15908
|
e.preventDefault();
|
|
15918
15909
|
e.stopPropagation();
|
|
@@ -15922,12 +15913,12 @@ function FileUpload({
|
|
|
15922
15913
|
},
|
|
15923
15914
|
[disabled]
|
|
15924
15915
|
);
|
|
15925
|
-
const handleDragLeave = (0,
|
|
15916
|
+
const handleDragLeave = (0, import_react22.useCallback)((e) => {
|
|
15926
15917
|
e.preventDefault();
|
|
15927
15918
|
e.stopPropagation();
|
|
15928
15919
|
setIsDragging(false);
|
|
15929
15920
|
}, []);
|
|
15930
|
-
const processFiles = (0,
|
|
15921
|
+
const processFiles = (0, import_react22.useCallback)(
|
|
15931
15922
|
async (fileList) => {
|
|
15932
15923
|
if (fileList.length === 0) return;
|
|
15933
15924
|
const remainingSlots = maxFiles - files.length;
|
|
@@ -16000,7 +15991,7 @@ function FileUpload({
|
|
|
16000
15991
|
},
|
|
16001
15992
|
[files, maxFiles, maxSize, uploadHandler, onUpload, onChange, addToast, t]
|
|
16002
15993
|
);
|
|
16003
|
-
const handleDrop = (0,
|
|
15994
|
+
const handleDrop = (0, import_react22.useCallback)(
|
|
16004
15995
|
(e) => {
|
|
16005
15996
|
e.preventDefault();
|
|
16006
15997
|
e.stopPropagation();
|
|
@@ -16011,7 +16002,7 @@ function FileUpload({
|
|
|
16011
16002
|
},
|
|
16012
16003
|
[disabled, processFiles]
|
|
16013
16004
|
);
|
|
16014
|
-
const handleFileSelect = (0,
|
|
16005
|
+
const handleFileSelect = (0, import_react22.useCallback)(
|
|
16015
16006
|
(e) => {
|
|
16016
16007
|
const selectedFiles = Array.from(e.target.files || []);
|
|
16017
16008
|
processFiles(selectedFiles);
|
|
@@ -16021,7 +16012,7 @@ function FileUpload({
|
|
|
16021
16012
|
},
|
|
16022
16013
|
[processFiles]
|
|
16023
16014
|
);
|
|
16024
|
-
const handleRemove = (0,
|
|
16015
|
+
const handleRemove = (0, import_react22.useCallback)(
|
|
16025
16016
|
(fileId) => {
|
|
16026
16017
|
setFiles((prev) => {
|
|
16027
16018
|
const fileToRemove = prev.find((f) => f.id === fileId);
|
|
@@ -16039,7 +16030,7 @@ function FileUpload({
|
|
|
16039
16030
|
const handleBrowseClick = () => {
|
|
16040
16031
|
fileInputRef.current?.click();
|
|
16041
16032
|
};
|
|
16042
|
-
const handleRetry = (0,
|
|
16033
|
+
const handleRetry = (0, import_react22.useCallback)(
|
|
16043
16034
|
(fileEntry) => {
|
|
16044
16035
|
if (!uploadHandler || !fileEntry.file) return;
|
|
16045
16036
|
processFiles([fileEntry.file]);
|
|
@@ -16565,7 +16556,7 @@ function Carousel({
|
|
|
16565
16556
|
}
|
|
16566
16557
|
|
|
16567
16558
|
// src/components/FallingIcons.tsx
|
|
16568
|
-
var
|
|
16559
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
16569
16560
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
16570
16561
|
var DEFAULT_COUNT = 24;
|
|
16571
16562
|
var DEFAULT_SPEED_RANGE = [6, 14];
|
|
@@ -16593,10 +16584,10 @@ function FallingIcons({
|
|
|
16593
16584
|
physics,
|
|
16594
16585
|
easingFunction = "linear"
|
|
16595
16586
|
}) {
|
|
16596
|
-
const uid =
|
|
16597
|
-
const containerRef =
|
|
16598
|
-
const [fallDist, setFallDist] =
|
|
16599
|
-
const idRef =
|
|
16587
|
+
const uid = import_react23.default.useId().replace(/[:]/g, "");
|
|
16588
|
+
const containerRef = import_react23.default.useRef(null);
|
|
16589
|
+
const [fallDist, setFallDist] = import_react23.default.useState(null);
|
|
16590
|
+
const idRef = import_react23.default.useRef(1);
|
|
16600
16591
|
const gravity = physics?.gravity ?? 1;
|
|
16601
16592
|
const windDirection = physics?.windDirection ?? 0;
|
|
16602
16593
|
const windStrength = physics?.windStrength ?? 0;
|
|
@@ -16610,7 +16601,7 @@ function FallingIcons({
|
|
|
16610
16601
|
bounce: "cubic-bezier(0.68, -0.55, 0.265, 1.55)",
|
|
16611
16602
|
elastic: "cubic-bezier(0.175, 0.885, 0.32, 1.275)"
|
|
16612
16603
|
};
|
|
16613
|
-
const makeParticle =
|
|
16604
|
+
const makeParticle = import_react23.default.useCallback(() => {
|
|
16614
16605
|
const rnd = (min, max) => min + Math.random() * (max - min);
|
|
16615
16606
|
return {
|
|
16616
16607
|
leftPct: rnd(0, 100),
|
|
@@ -16624,12 +16615,12 @@ function FallingIcons({
|
|
|
16624
16615
|
key: idRef.current++
|
|
16625
16616
|
};
|
|
16626
16617
|
}, [sizeRange, speedRange, horizontalDrift, gravity, windDirection, windStrength]);
|
|
16627
|
-
const [particles, setParticles] =
|
|
16628
|
-
|
|
16618
|
+
const [particles, setParticles] = import_react23.default.useState([]);
|
|
16619
|
+
import_react23.default.useEffect(() => {
|
|
16629
16620
|
const arr = Array.from({ length: Math.max(0, count) }).map(() => makeParticle());
|
|
16630
16621
|
setParticles(arr);
|
|
16631
16622
|
}, [count, makeParticle]);
|
|
16632
|
-
|
|
16623
|
+
import_react23.default.useEffect(() => {
|
|
16633
16624
|
if (fullScreen) {
|
|
16634
16625
|
const measure2 = () => setFallDist(window.innerHeight + 200);
|
|
16635
16626
|
measure2();
|
|
@@ -16654,18 +16645,22 @@ function FallingIcons({
|
|
|
16654
16645
|
const SpinName = `uv-spin-${uid}`;
|
|
16655
16646
|
const PopName = `uv-pop-${uid}`;
|
|
16656
16647
|
const PhysicsSpinName = `uv-physics-spin-${uid}`;
|
|
16657
|
-
const glowStyles =
|
|
16648
|
+
const glowStyles = import_react23.default.useMemo(() => {
|
|
16658
16649
|
if (!glow) return {};
|
|
16659
16650
|
const intensity = Math.max(0, Math.min(1, glowIntensity));
|
|
16660
16651
|
return {
|
|
16661
16652
|
filter: `drop-shadow(0 0 ${4 * intensity}px ${glowColor}) drop-shadow(0 0 ${8 * intensity}px ${glowColor})`
|
|
16662
16653
|
};
|
|
16663
16654
|
}, [glow, glowColor, glowIntensity]);
|
|
16664
|
-
const FallbackIcon =
|
|
16665
|
-
() =>
|
|
16655
|
+
const FallbackIcon = import_react23.default.useMemo(
|
|
16656
|
+
() => function FallingIconsFallbackIcon(props) {
|
|
16657
|
+
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" }) });
|
|
16658
|
+
},
|
|
16666
16659
|
[]
|
|
16667
16660
|
);
|
|
16668
|
-
const TheIcon = imageUrl ? ({ className: imgClassName })
|
|
16661
|
+
const TheIcon = imageUrl ? function FallingIconsImage({ className: imgClassName }) {
|
|
16662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("img", { src: imageUrl, alt: "", className: cn("w-full h-full object-cover rounded-lg", imgClassName), draggable: false });
|
|
16663
|
+
} : Icon || FallbackIcon;
|
|
16669
16664
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
16670
16665
|
"div",
|
|
16671
16666
|
{
|
|
@@ -16719,7 +16714,7 @@ function FallingIcons({
|
|
|
16719
16714
|
});
|
|
16720
16715
|
};
|
|
16721
16716
|
const trailParticles = trail ? Array.from({ length: Math.min(5, Math.max(1, trailLength)) }) : [];
|
|
16722
|
-
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
16717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_react23.default.Fragment, { children: [
|
|
16723
16718
|
trail && trailParticles.map((_, trailIndex) => {
|
|
16724
16719
|
const trailDelay = p.delay - (trailIndex + 1) * 0.15;
|
|
16725
16720
|
const trailOpacity = 1 - (trailIndex + 1) * (1 / (trailParticles.length + 1));
|
|
@@ -18126,7 +18121,7 @@ function ColorPicker({
|
|
|
18126
18121
|
}
|
|
18127
18122
|
|
|
18128
18123
|
// src/components/MusicPlayer.tsx
|
|
18129
|
-
var
|
|
18124
|
+
var import_react24 = require("react");
|
|
18130
18125
|
var import_lucide_react32 = require("lucide-react");
|
|
18131
18126
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
18132
18127
|
var DEFAULT_PLAYLIST = [
|
|
@@ -18247,21 +18242,21 @@ var MusicPlayer = ({
|
|
|
18247
18242
|
showPlaylist: initialShowPlaylist = true,
|
|
18248
18243
|
className = ""
|
|
18249
18244
|
}) => {
|
|
18250
|
-
const [currentSongIndex, setCurrentSongIndex] = (0,
|
|
18251
|
-
const [isPlaying, setIsPlaying] = (0,
|
|
18252
|
-
const [currentTime, setCurrentTime] = (0,
|
|
18253
|
-
const [duration, setDuration] = (0,
|
|
18254
|
-
const [volume, setVolume] = (0,
|
|
18255
|
-
const [isMuted, setIsMuted] = (0,
|
|
18256
|
-
const [showPlaylist, setShowPlaylist] = (0,
|
|
18257
|
-
const audioRef = (0,
|
|
18245
|
+
const [currentSongIndex, setCurrentSongIndex] = (0, import_react24.useState)(0);
|
|
18246
|
+
const [isPlaying, setIsPlaying] = (0, import_react24.useState)(false);
|
|
18247
|
+
const [currentTime, setCurrentTime] = (0, import_react24.useState)(0);
|
|
18248
|
+
const [duration, setDuration] = (0, import_react24.useState)(0);
|
|
18249
|
+
const [volume, setVolume] = (0, import_react24.useState)(1);
|
|
18250
|
+
const [isMuted, setIsMuted] = (0, import_react24.useState)(false);
|
|
18251
|
+
const [showPlaylist, setShowPlaylist] = (0, import_react24.useState)(initialShowPlaylist);
|
|
18252
|
+
const audioRef = (0, import_react24.useRef)(null);
|
|
18258
18253
|
const currentSong = playlist[currentSongIndex];
|
|
18259
|
-
(0,
|
|
18254
|
+
(0, import_react24.useEffect)(() => {
|
|
18260
18255
|
if (audioRef.current) {
|
|
18261
18256
|
audioRef.current.volume = volume;
|
|
18262
18257
|
}
|
|
18263
18258
|
}, [volume]);
|
|
18264
|
-
(0,
|
|
18259
|
+
(0, import_react24.useEffect)(() => {
|
|
18265
18260
|
if (autoPlay && audioRef.current) {
|
|
18266
18261
|
audioRef.current.play().catch(() => {
|
|
18267
18262
|
setIsPlaying(false);
|
|
@@ -18337,7 +18332,7 @@ var MusicPlayer = ({
|
|
|
18337
18332
|
setCurrentSongIndex(index);
|
|
18338
18333
|
setIsPlaying(true);
|
|
18339
18334
|
};
|
|
18340
|
-
(0,
|
|
18335
|
+
(0, import_react24.useEffect)(() => {
|
|
18341
18336
|
if (audioRef.current) {
|
|
18342
18337
|
if (currentSong.startTime !== void 0) {
|
|
18343
18338
|
audioRef.current.currentTime = currentSong.startTime;
|
|
@@ -18479,7 +18474,7 @@ var MusicPlayer = ({
|
|
|
18479
18474
|
var MusicPlayer_default = MusicPlayer;
|
|
18480
18475
|
|
|
18481
18476
|
// src/components/Grid.tsx
|
|
18482
|
-
var
|
|
18477
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
18483
18478
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
18484
18479
|
var BP_MIN = {
|
|
18485
18480
|
sm: 640,
|
|
@@ -18519,7 +18514,7 @@ function getVariantClasses(variant = "default", outlined) {
|
|
|
18519
18514
|
};
|
|
18520
18515
|
return variants[variant] || "";
|
|
18521
18516
|
}
|
|
18522
|
-
var GridRoot =
|
|
18517
|
+
var GridRoot = import_react25.default.forwardRef(
|
|
18523
18518
|
({
|
|
18524
18519
|
columns,
|
|
18525
18520
|
rows,
|
|
@@ -18544,7 +18539,7 @@ var GridRoot = import_react24.default.forwardRef(
|
|
|
18544
18539
|
children,
|
|
18545
18540
|
...rest
|
|
18546
18541
|
}, ref) => {
|
|
18547
|
-
const id = (0,
|
|
18542
|
+
const id = (0, import_react25.useId)().replace(/[:]/g, "");
|
|
18548
18543
|
const baseClass = `uv-grid-${id}`;
|
|
18549
18544
|
const baseCols = toTemplateCols(columns, minColumnWidth);
|
|
18550
18545
|
const baseRows = toTemplateRows(rows);
|
|
@@ -18603,7 +18598,7 @@ var GridRoot = import_react24.default.forwardRef(
|
|
|
18603
18598
|
}
|
|
18604
18599
|
);
|
|
18605
18600
|
GridRoot.displayName = "Grid";
|
|
18606
|
-
var GridItem =
|
|
18601
|
+
var GridItem = import_react25.default.forwardRef(
|
|
18607
18602
|
({
|
|
18608
18603
|
colSpan,
|
|
18609
18604
|
rowSpan,
|
|
@@ -18667,10 +18662,10 @@ var Grid = Object.assign(GridRoot, { Item: GridItem });
|
|
|
18667
18662
|
var Grid_default = Grid;
|
|
18668
18663
|
|
|
18669
18664
|
// src/components/LineChart.tsx
|
|
18670
|
-
var
|
|
18665
|
+
var import_react27 = require("react");
|
|
18671
18666
|
|
|
18672
18667
|
// src/components/ChartTooltip.tsx
|
|
18673
|
-
var
|
|
18668
|
+
var import_react26 = require("react");
|
|
18674
18669
|
var import_react_dom6 = require("react-dom");
|
|
18675
18670
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
18676
18671
|
function ChartTooltip({
|
|
@@ -18686,13 +18681,13 @@ function ChartTooltip({
|
|
|
18686
18681
|
containerRef,
|
|
18687
18682
|
formatter
|
|
18688
18683
|
}) {
|
|
18689
|
-
const [isMounted, setIsMounted] = (0,
|
|
18690
|
-
const [position, setPosition] = (0,
|
|
18691
|
-
const tooltipRef = (0,
|
|
18692
|
-
(0,
|
|
18684
|
+
const [isMounted, setIsMounted] = (0, import_react26.useState)(false);
|
|
18685
|
+
const [position, setPosition] = (0, import_react26.useState)(null);
|
|
18686
|
+
const tooltipRef = (0, import_react26.useRef)(null);
|
|
18687
|
+
(0, import_react26.useEffect)(() => {
|
|
18693
18688
|
setIsMounted(true);
|
|
18694
18689
|
}, []);
|
|
18695
|
-
(0,
|
|
18690
|
+
(0, import_react26.useEffect)(() => {
|
|
18696
18691
|
if (visible && containerRef?.current) {
|
|
18697
18692
|
const rect = containerRef.current.getBoundingClientRect();
|
|
18698
18693
|
const tw = tooltipRef.current?.offsetWidth ?? 160;
|
|
@@ -18769,6 +18764,7 @@ function ChartTooltip({
|
|
|
18769
18764
|
}
|
|
18770
18765
|
|
|
18771
18766
|
// src/utils/chart-utils.ts
|
|
18767
|
+
var React51 = __toESM(require("react"), 1);
|
|
18772
18768
|
function getCatmullRomSpline(points, tension = 0.5) {
|
|
18773
18769
|
if (points.length < 2) return "";
|
|
18774
18770
|
if (points.length === 2) {
|
|
@@ -18817,14 +18813,14 @@ function LineChart({
|
|
|
18817
18813
|
labelClassName,
|
|
18818
18814
|
className = ""
|
|
18819
18815
|
}) {
|
|
18820
|
-
const svgRef = (0,
|
|
18821
|
-
const clipId = (0,
|
|
18816
|
+
const svgRef = (0, import_react27.useRef)(null);
|
|
18817
|
+
const clipId = (0, import_react27.useRef)(`line-clip-${Math.random().toString(36).slice(2, 8)}`).current;
|
|
18822
18818
|
const padding = { top: 20, right: 20, bottom: 40, left: 40 };
|
|
18823
18819
|
const chartWidth = width - padding.left - padding.right;
|
|
18824
18820
|
const chartHeight = height - padding.top - padding.bottom;
|
|
18825
|
-
const [hoveredPoint, setHoveredPoint] = (0,
|
|
18826
|
-
const [hiddenSeries, setHiddenSeries] = (0,
|
|
18827
|
-
const toggleSeries = (0,
|
|
18821
|
+
const [hoveredPoint, setHoveredPoint] = (0, import_react27.useState)(null);
|
|
18822
|
+
const [hiddenSeries, setHiddenSeries] = (0, import_react27.useState)(/* @__PURE__ */ new Set());
|
|
18823
|
+
const toggleSeries = (0, import_react27.useCallback)((name) => {
|
|
18828
18824
|
setHiddenSeries((prev) => {
|
|
18829
18825
|
const next = new Set(prev);
|
|
18830
18826
|
if (next.has(name)) next.delete(name);
|
|
@@ -18832,13 +18828,13 @@ function LineChart({
|
|
|
18832
18828
|
return next;
|
|
18833
18829
|
});
|
|
18834
18830
|
}, []);
|
|
18835
|
-
const normalizedSeries = (0,
|
|
18831
|
+
const normalizedSeries = (0, import_react27.useMemo)(() => {
|
|
18836
18832
|
if (series && series.length > 0) return series;
|
|
18837
18833
|
if (data && data.length > 0) return [{ name: "", data, color, fillColor }];
|
|
18838
18834
|
return [];
|
|
18839
18835
|
}, [series, data, color, fillColor]);
|
|
18840
18836
|
const isMultiSeries = normalizedSeries.length > 1;
|
|
18841
|
-
const { minValue, maxValue, processedSeries, labels } = (0,
|
|
18837
|
+
const { minValue, maxValue, processedSeries, labels } = (0, import_react27.useMemo)(() => {
|
|
18842
18838
|
if (!normalizedSeries.length || !normalizedSeries[0]?.data?.length) {
|
|
18843
18839
|
return { minValue: 0, maxValue: 0, processedSeries: [], labels: [] };
|
|
18844
18840
|
}
|
|
@@ -18867,7 +18863,7 @@ function LineChart({
|
|
|
18867
18863
|
});
|
|
18868
18864
|
return { minValue: min, maxValue: max, processedSeries: processed, labels: allLabels };
|
|
18869
18865
|
}, [normalizedSeries, chartWidth, chartHeight, curved, padding.left, padding.top]);
|
|
18870
|
-
const gridLines = (0,
|
|
18866
|
+
const gridLines = (0, import_react27.useMemo)(() => {
|
|
18871
18867
|
const lines = [];
|
|
18872
18868
|
const steps = 5;
|
|
18873
18869
|
for (let i = 0; i <= steps; i++) {
|
|
@@ -19070,7 +19066,7 @@ function LineChart({
|
|
|
19070
19066
|
}
|
|
19071
19067
|
|
|
19072
19068
|
// src/components/BarChart.tsx
|
|
19073
|
-
var
|
|
19069
|
+
var import_react28 = require("react");
|
|
19074
19070
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
19075
19071
|
function BarChart({
|
|
19076
19072
|
data,
|
|
@@ -19091,18 +19087,21 @@ function BarChart({
|
|
|
19091
19087
|
labelClassName,
|
|
19092
19088
|
className = ""
|
|
19093
19089
|
}) {
|
|
19094
|
-
const svgRef = (0,
|
|
19095
|
-
const padding =
|
|
19090
|
+
const svgRef = (0, import_react28.useRef)(null);
|
|
19091
|
+
const padding = (0, import_react28.useMemo)(
|
|
19092
|
+
() => horizontal ? { top: 20, right: 40, bottom: 20, left: 80 } : { top: 20, right: 20, bottom: 40, left: 40 },
|
|
19093
|
+
[horizontal]
|
|
19094
|
+
);
|
|
19096
19095
|
const chartWidth = width - padding.left - padding.right;
|
|
19097
19096
|
const chartHeight = height - padding.top - padding.bottom;
|
|
19098
|
-
const [hoveredBar, setHoveredBar] = (0,
|
|
19099
|
-
const normalizedSeries = (0,
|
|
19097
|
+
const [hoveredBar, setHoveredBar] = (0, import_react28.useState)(null);
|
|
19098
|
+
const normalizedSeries = (0, import_react28.useMemo)(() => {
|
|
19100
19099
|
if (series && series.length > 0) return series;
|
|
19101
19100
|
if (data && data.length > 0) return [{ name: "", data, color }];
|
|
19102
19101
|
return [];
|
|
19103
19102
|
}, [series, data, color]);
|
|
19104
19103
|
const isMultiSeries = normalizedSeries.length > 1;
|
|
19105
|
-
const { maxValue, barGroups, gridLines } = (0,
|
|
19104
|
+
const { maxValue, barGroups, gridLines } = (0, import_react28.useMemo)(() => {
|
|
19106
19105
|
if (!normalizedSeries.length || !normalizedSeries[0]?.data?.length) {
|
|
19107
19106
|
return { maxValue: 0, barGroups: [], gridLines: [] };
|
|
19108
19107
|
}
|
|
@@ -19358,7 +19357,7 @@ function BarChart({
|
|
|
19358
19357
|
}
|
|
19359
19358
|
|
|
19360
19359
|
// src/components/PieChart.tsx
|
|
19361
|
-
var
|
|
19360
|
+
var import_react29 = require("react");
|
|
19362
19361
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
19363
19362
|
function PieChart({
|
|
19364
19363
|
data,
|
|
@@ -19375,11 +19374,11 @@ function PieChart({
|
|
|
19375
19374
|
labelClassName,
|
|
19376
19375
|
className = ""
|
|
19377
19376
|
}) {
|
|
19378
|
-
const containerRef = (0,
|
|
19377
|
+
const containerRef = (0, import_react29.useRef)(null);
|
|
19379
19378
|
const center = size / 2;
|
|
19380
19379
|
const radius = size / 2 - 10;
|
|
19381
19380
|
const innerRadius = donut ? radius - donutWidth : 0;
|
|
19382
|
-
const { segments, total } = (0,
|
|
19381
|
+
const { segments, total } = (0, import_react29.useMemo)(() => {
|
|
19383
19382
|
if (!data.length) return { segments: [], total: 0 };
|
|
19384
19383
|
const sum = data.reduce((acc, d) => acc + d.value, 0);
|
|
19385
19384
|
let currentAngle = startAngle;
|
|
@@ -19425,7 +19424,7 @@ function PieChart({
|
|
|
19425
19424
|
});
|
|
19426
19425
|
return { segments: segs, total: sum };
|
|
19427
19426
|
}, [data, center, radius, innerRadius, donut, startAngle]);
|
|
19428
|
-
const [hoveredSegment, setHoveredSegment] = (0,
|
|
19427
|
+
const [hoveredSegment, setHoveredSegment] = (0, import_react29.useState)(null);
|
|
19429
19428
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { ref: containerRef, className: `relative flex items-center gap-6 ${className}`, children: [
|
|
19430
19429
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("svg", { width: size + 40, height: size + 40, className: "overflow-visible", style: { fontFamily: "inherit" }, children: [
|
|
19431
19430
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("g", { transform: `translate(20, 20)`, children: [
|
|
@@ -19526,7 +19525,7 @@ function PieChart({
|
|
|
19526
19525
|
}
|
|
19527
19526
|
|
|
19528
19527
|
// src/components/AreaChart.tsx
|
|
19529
|
-
var
|
|
19528
|
+
var import_react30 = require("react");
|
|
19530
19529
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
19531
19530
|
function AreaChart({
|
|
19532
19531
|
series,
|
|
@@ -19544,14 +19543,14 @@ function AreaChart({
|
|
|
19544
19543
|
labelClassName,
|
|
19545
19544
|
className = ""
|
|
19546
19545
|
}) {
|
|
19547
|
-
const containerRef = (0,
|
|
19548
|
-
const clipId = (0,
|
|
19549
|
-
const padding = { top: 20, right: 20, bottom: 40, left: 50 };
|
|
19546
|
+
const containerRef = (0, import_react30.useRef)(null);
|
|
19547
|
+
const clipId = (0, import_react30.useRef)(`area-clip-${Math.random().toString(36).slice(2, 8)}`).current;
|
|
19548
|
+
const padding = (0, import_react30.useMemo)(() => ({ top: 20, right: 20, bottom: 40, left: 50 }), []);
|
|
19550
19549
|
const chartWidth = width - padding.left - padding.right;
|
|
19551
19550
|
const chartHeight = height - padding.top - padding.bottom;
|
|
19552
|
-
const [hoveredPoint, setHoveredPoint] = (0,
|
|
19553
|
-
const [hiddenSeries, setHiddenSeries] = (0,
|
|
19554
|
-
const toggleSeries = (0,
|
|
19551
|
+
const [hoveredPoint, setHoveredPoint] = (0, import_react30.useState)(null);
|
|
19552
|
+
const [hiddenSeries, setHiddenSeries] = (0, import_react30.useState)(/* @__PURE__ */ new Set());
|
|
19553
|
+
const toggleSeries = (0, import_react30.useCallback)((name) => {
|
|
19555
19554
|
setHiddenSeries((prev) => {
|
|
19556
19555
|
const next = new Set(prev);
|
|
19557
19556
|
if (next.has(name)) next.delete(name);
|
|
@@ -19559,7 +19558,7 @@ function AreaChart({
|
|
|
19559
19558
|
return next;
|
|
19560
19559
|
});
|
|
19561
19560
|
}, []);
|
|
19562
|
-
const { processedSeries, gridLines, maxValue, labels } = (0,
|
|
19561
|
+
const { processedSeries, gridLines, maxValue, labels } = (0, import_react30.useMemo)(() => {
|
|
19563
19562
|
if (!series.length || !series[0]?.data?.length) {
|
|
19564
19563
|
return { processedSeries: [], gridLines: [], maxValue: 0, labels: [] };
|
|
19565
19564
|
}
|
|
@@ -19794,7 +19793,7 @@ function AreaChart({
|
|
|
19794
19793
|
}
|
|
19795
19794
|
|
|
19796
19795
|
// src/components/Sparkline.tsx
|
|
19797
|
-
var
|
|
19796
|
+
var import_react31 = require("react");
|
|
19798
19797
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
19799
19798
|
function Sparkline({
|
|
19800
19799
|
data,
|
|
@@ -19813,7 +19812,7 @@ function Sparkline({
|
|
|
19813
19812
|
const padding = 4;
|
|
19814
19813
|
const chartWidth = width - padding * 2;
|
|
19815
19814
|
const chartHeight = height - padding * 2;
|
|
19816
|
-
const { points, linePath, areaPath, lineLength, trend } = (0,
|
|
19815
|
+
const { points, linePath, areaPath, lineLength, trend } = (0, import_react31.useMemo)(() => {
|
|
19817
19816
|
const normalizedData = data.map((d) => typeof d === "number" ? d : d.value);
|
|
19818
19817
|
if (!normalizedData.length) {
|
|
19819
19818
|
return { points: [], linePath: "", areaPath: "", lineLength: 0, trend: 0 };
|
|
@@ -19917,7 +19916,7 @@ function Sparkline({
|
|
|
19917
19916
|
}
|
|
19918
19917
|
|
|
19919
19918
|
// src/components/RadarChart.tsx
|
|
19920
|
-
var
|
|
19919
|
+
var import_react32 = require("react");
|
|
19921
19920
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
19922
19921
|
function RadarChart({
|
|
19923
19922
|
series,
|
|
@@ -19931,12 +19930,12 @@ function RadarChart({
|
|
|
19931
19930
|
labelClassName,
|
|
19932
19931
|
className = ""
|
|
19933
19932
|
}) {
|
|
19934
|
-
const containerRef = (0,
|
|
19933
|
+
const containerRef = (0, import_react32.useRef)(null);
|
|
19935
19934
|
const center = size / 2;
|
|
19936
19935
|
const radius = size / 2 - 40;
|
|
19937
|
-
const [hoveredPoint, setHoveredPoint] = (0,
|
|
19938
|
-
const [hiddenSeries, setHiddenSeries] = (0,
|
|
19939
|
-
const toggleSeries = (0,
|
|
19936
|
+
const [hoveredPoint, setHoveredPoint] = (0, import_react32.useState)(null);
|
|
19937
|
+
const [hiddenSeries, setHiddenSeries] = (0, import_react32.useState)(/* @__PURE__ */ new Set());
|
|
19938
|
+
const toggleSeries = (0, import_react32.useCallback)((name) => {
|
|
19940
19939
|
setHiddenSeries((prev) => {
|
|
19941
19940
|
const next = new Set(prev);
|
|
19942
19941
|
if (next.has(name)) next.delete(name);
|
|
@@ -19944,7 +19943,7 @@ function RadarChart({
|
|
|
19944
19943
|
return next;
|
|
19945
19944
|
});
|
|
19946
19945
|
}, []);
|
|
19947
|
-
const { axes, processedSeries, levelPaths } = (0,
|
|
19946
|
+
const { axes, processedSeries, levelPaths } = (0, import_react32.useMemo)(() => {
|
|
19948
19947
|
if (!series.length || !series[0]?.data?.length) {
|
|
19949
19948
|
return { axes: [], processedSeries: [], levelPaths: [] };
|
|
19950
19949
|
}
|
|
@@ -20137,7 +20136,7 @@ function RadarChart({
|
|
|
20137
20136
|
}
|
|
20138
20137
|
|
|
20139
20138
|
// src/components/GaugeChart.tsx
|
|
20140
|
-
var
|
|
20139
|
+
var import_react33 = require("react");
|
|
20141
20140
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
20142
20141
|
function GaugeChart({
|
|
20143
20142
|
value,
|
|
@@ -20160,7 +20159,7 @@ function GaugeChart({
|
|
|
20160
20159
|
}) {
|
|
20161
20160
|
const center = size / 2;
|
|
20162
20161
|
const radius = center - thickness / 2 - 10;
|
|
20163
|
-
const { backgroundPath, valuePath, percentage, needleAngle, zonePaths } = (0,
|
|
20162
|
+
const { backgroundPath, valuePath, percentage, needleAngle, zonePaths } = (0, import_react33.useMemo)(() => {
|
|
20164
20163
|
const normalizedValue = Math.min(Math.max(value, min), max);
|
|
20165
20164
|
const pct = (normalizedValue - min) / (max - min);
|
|
20166
20165
|
const totalAngle = endAngle - startAngle;
|
|
@@ -20315,11 +20314,11 @@ function GaugeChart({
|
|
|
20315
20314
|
}
|
|
20316
20315
|
|
|
20317
20316
|
// src/components/ClientOnly.tsx
|
|
20318
|
-
var
|
|
20317
|
+
var import_react34 = require("react");
|
|
20319
20318
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
20320
20319
|
function ClientOnly({ children, fallback = null }) {
|
|
20321
|
-
const [hasMounted, setHasMounted] = (0,
|
|
20322
|
-
(0,
|
|
20320
|
+
const [hasMounted, setHasMounted] = (0, import_react34.useState)(false);
|
|
20321
|
+
(0, import_react34.useEffect)(() => {
|
|
20323
20322
|
setHasMounted(true);
|
|
20324
20323
|
}, []);
|
|
20325
20324
|
if (!hasMounted) {
|
|
@@ -20415,7 +20414,7 @@ var LoadingBar = ({
|
|
|
20415
20414
|
};
|
|
20416
20415
|
|
|
20417
20416
|
// src/components/Table.tsx
|
|
20418
|
-
var
|
|
20417
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
20419
20418
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
20420
20419
|
var TABLE_BASE_CLASS = "w-full caption-bottom text-sm";
|
|
20421
20420
|
var TABLE_CONTAINER_BASE_CLASS = [
|
|
@@ -20433,8 +20432,8 @@ function assignRef3(ref, value) {
|
|
|
20433
20432
|
ref.current = value;
|
|
20434
20433
|
}
|
|
20435
20434
|
}
|
|
20436
|
-
var TableContainer =
|
|
20437
|
-
const containerRef =
|
|
20435
|
+
var TableContainer = import_react35.default.forwardRef(({ className, useOverlayScrollbar = false, ...props }, ref) => {
|
|
20436
|
+
const containerRef = import_react35.default.useRef(null);
|
|
20438
20437
|
useOverlayScrollbarTarget(containerRef, { enabled: useOverlayScrollbar });
|
|
20439
20438
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
20440
20439
|
"div",
|
|
@@ -20449,7 +20448,7 @@ var TableContainer = import_react34.default.forwardRef(({ className, useOverlayS
|
|
|
20449
20448
|
);
|
|
20450
20449
|
});
|
|
20451
20450
|
TableContainer.displayName = "TableContainer";
|
|
20452
|
-
var Table =
|
|
20451
|
+
var Table = import_react35.default.forwardRef(
|
|
20453
20452
|
({ className, containerClassName, disableContainer = false, useOverlayScrollbar = false, ...props }, ref) => {
|
|
20454
20453
|
if (disableContainer) {
|
|
20455
20454
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("table", { ref, className: cn(TABLE_BASE_CLASS, className), ...props });
|
|
@@ -20458,16 +20457,16 @@ var Table = import_react34.default.forwardRef(
|
|
|
20458
20457
|
}
|
|
20459
20458
|
);
|
|
20460
20459
|
Table.displayName = "Table";
|
|
20461
|
-
var TableHeader =
|
|
20460
|
+
var TableHeader = import_react35.default.forwardRef(({ className, children, filterRow, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("thead", { ref, className: cn("[&_tr]:border-b [&_tr]:border-border", "bg-muted", className), ...props, children: [
|
|
20462
20461
|
children,
|
|
20463
20462
|
filterRow
|
|
20464
20463
|
] }));
|
|
20465
20464
|
TableHeader.displayName = "TableHeader";
|
|
20466
|
-
var TableBody =
|
|
20465
|
+
var TableBody = import_react35.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props }));
|
|
20467
20466
|
TableBody.displayName = "TableBody";
|
|
20468
|
-
var TableFooter =
|
|
20467
|
+
var TableFooter = import_react35.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("tfoot", { ref, className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className), ...props }));
|
|
20469
20468
|
TableFooter.displayName = "TableFooter";
|
|
20470
|
-
var TableRow =
|
|
20469
|
+
var TableRow = import_react35.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
20471
20470
|
"tr",
|
|
20472
20471
|
{
|
|
20473
20472
|
ref,
|
|
@@ -20481,7 +20480,7 @@ var TableRow = import_react34.default.forwardRef(({ className, ...props }, ref)
|
|
|
20481
20480
|
}
|
|
20482
20481
|
));
|
|
20483
20482
|
TableRow.displayName = "TableRow";
|
|
20484
|
-
var TableHead =
|
|
20483
|
+
var TableHead = import_react35.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
20485
20484
|
"th",
|
|
20486
20485
|
{
|
|
20487
20486
|
ref,
|
|
@@ -20490,13 +20489,13 @@ var TableHead = import_react34.default.forwardRef(({ className, ...props }, ref)
|
|
|
20490
20489
|
}
|
|
20491
20490
|
));
|
|
20492
20491
|
TableHead.displayName = "TableHead";
|
|
20493
|
-
var TableCell =
|
|
20492
|
+
var TableCell = import_react35.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("td", { ref, className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className), ...props }));
|
|
20494
20493
|
TableCell.displayName = "TableCell";
|
|
20495
|
-
var TableCaption =
|
|
20494
|
+
var TableCaption = import_react35.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("caption", { ref, className: cn("mt-4 text-sm text-muted-foreground", className), ...props }));
|
|
20496
20495
|
TableCaption.displayName = "TableCaption";
|
|
20497
20496
|
|
|
20498
20497
|
// src/components/DataTable/DataTable.tsx
|
|
20499
|
-
var
|
|
20498
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
20500
20499
|
|
|
20501
20500
|
// src/components/DataTable/components/DataTableBody.tsx
|
|
20502
20501
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
@@ -20568,7 +20567,7 @@ function DataTableBodyRows({
|
|
|
20568
20567
|
}
|
|
20569
20568
|
|
|
20570
20569
|
// src/components/DataTable/components/DataTableHeader.tsx
|
|
20571
|
-
var
|
|
20570
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
20572
20571
|
var import_lucide_react34 = require("lucide-react");
|
|
20573
20572
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
20574
20573
|
function DataTableHeader({
|
|
@@ -20588,7 +20587,7 @@ function DataTableHeader({
|
|
|
20588
20587
|
getStickyHeaderCellStyle,
|
|
20589
20588
|
t
|
|
20590
20589
|
}) {
|
|
20591
|
-
const renderFilterControl =
|
|
20590
|
+
const renderFilterControl = import_react36.default.useCallback(
|
|
20592
20591
|
(col) => {
|
|
20593
20592
|
if (!col.filter) return null;
|
|
20594
20593
|
const key = col.key;
|
|
@@ -20641,7 +20640,7 @@ function DataTableHeader({
|
|
|
20641
20640
|
},
|
|
20642
20641
|
[filters, setCurPage, setFilters, size]
|
|
20643
20642
|
);
|
|
20644
|
-
const renderHeaderContent =
|
|
20643
|
+
const renderHeaderContent = import_react36.default.useCallback(
|
|
20645
20644
|
(col, isLeaf) => {
|
|
20646
20645
|
if (!isLeaf) {
|
|
20647
20646
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
@@ -20804,7 +20803,7 @@ function DataTableHeader({
|
|
|
20804
20803
|
}
|
|
20805
20804
|
|
|
20806
20805
|
// src/components/DataTable/components/Pagination.tsx
|
|
20807
|
-
var
|
|
20806
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
20808
20807
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
20809
20808
|
function DataTablePagination({
|
|
20810
20809
|
totalItems,
|
|
@@ -20816,14 +20815,7 @@ function DataTablePagination({
|
|
|
20816
20815
|
size
|
|
20817
20816
|
}) {
|
|
20818
20817
|
const totalPages = Math.ceil(totalItems / curPageSize);
|
|
20819
|
-
|
|
20820
|
-
const controlButtonSize = size === "lg" ? "md" : "sm";
|
|
20821
|
-
const navBtnClass = size === "sm" ? "h-6 w-6 p-0 rounded-full" : size === "lg" ? "h-8 w-8 p-0 rounded-full" : "h-7 w-7 p-0 rounded-full";
|
|
20822
|
-
const navIconClass = size === "sm" ? "h-3.5 w-3.5" : size === "lg" ? "h-5 w-5" : "h-4 w-4";
|
|
20823
|
-
const pageBtnClass = size === "sm" ? "h-6 min-w-6 px-1.5 rounded-full text-[11px] font-medium transition-colors" : size === "lg" ? "h-8 min-w-8 px-2.5 rounded-full text-sm font-medium transition-colors" : "h-7 min-w-7 px-2 rounded-full text-xs font-medium transition-colors";
|
|
20824
|
-
const containerTextClass = size === "sm" ? "text-[11px]" : size === "lg" ? "text-sm" : "text-xs";
|
|
20825
|
-
const pageSizeClass = size === "sm" ? "w-16" : size === "lg" ? "w-24" : "w-20";
|
|
20826
|
-
const pages = import_react36.default.useMemo(() => {
|
|
20818
|
+
const pages = import_react37.default.useMemo(() => {
|
|
20827
20819
|
const result = [];
|
|
20828
20820
|
if (totalPages <= 5) {
|
|
20829
20821
|
for (let i = 1; i <= totalPages; i++) result.push(i);
|
|
@@ -20838,6 +20830,13 @@ function DataTablePagination({
|
|
|
20838
20830
|
result.push(totalPages);
|
|
20839
20831
|
return result;
|
|
20840
20832
|
}, [curPage, totalPages]);
|
|
20833
|
+
if (!(totalItems > 0 && totalPages > 1)) return null;
|
|
20834
|
+
const controlButtonSize = size === "lg" ? "md" : "sm";
|
|
20835
|
+
const navBtnClass = size === "sm" ? "h-6 w-6 p-0 rounded-full" : size === "lg" ? "h-8 w-8 p-0 rounded-full" : "h-7 w-7 p-0 rounded-full";
|
|
20836
|
+
const navIconClass = size === "sm" ? "h-3.5 w-3.5" : size === "lg" ? "h-5 w-5" : "h-4 w-4";
|
|
20837
|
+
const pageBtnClass = size === "sm" ? "h-6 min-w-6 px-1.5 rounded-full text-[11px] font-medium transition-colors" : size === "lg" ? "h-8 min-w-8 px-2.5 rounded-full text-sm font-medium transition-colors" : "h-7 min-w-7 px-2 rounded-full text-xs font-medium transition-colors";
|
|
20838
|
+
const containerTextClass = size === "sm" ? "text-[11px]" : size === "lg" ? "text-sm" : "text-xs";
|
|
20839
|
+
const pageSizeClass = size === "sm" ? "w-16" : size === "lg" ? "w-24" : "w-20";
|
|
20841
20840
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: cn("flex items-center justify-between gap-2 px-1 pt-3 text-muted-foreground", containerTextClass), children: [
|
|
20842
20841
|
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "tabular-nums", children: [
|
|
20843
20842
|
(curPage - 1) * curPageSize + 1,
|
|
@@ -20898,7 +20897,7 @@ function DataTablePagination({
|
|
|
20898
20897
|
}
|
|
20899
20898
|
|
|
20900
20899
|
// src/components/DataTable/components/Toolbar.tsx
|
|
20901
|
-
var
|
|
20900
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
20902
20901
|
|
|
20903
20902
|
// src/components/DataTable/utils/headers.ts
|
|
20904
20903
|
function isLeafColumn(col) {
|
|
@@ -21019,7 +21018,7 @@ function DataTableToolbar({
|
|
|
21019
21018
|
const controlButtonClass = size === "sm" ? "h-7 px-2 text-xs" : size === "lg" ? "h-9 px-3 text-sm" : "h-8 px-2";
|
|
21020
21019
|
const iconClass = size === "sm" ? "w-3.5 h-3.5 mr-1" : "w-4 h-4 mr-1";
|
|
21021
21020
|
const captionClass = size === "sm" ? "text-xs" : size === "lg" ? "text-sm" : "text-sm";
|
|
21022
|
-
const leafCols =
|
|
21021
|
+
const leafCols = import_react38.default.useMemo(() => getLeafColumns(columns), [columns]);
|
|
21023
21022
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center justify-between gap-4 mb-1", children: [
|
|
21024
21023
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: captionClass + " text-muted-foreground", children: caption }),
|
|
21025
21024
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
@@ -21087,10 +21086,10 @@ function DataTableToolbar({
|
|
|
21087
21086
|
}
|
|
21088
21087
|
|
|
21089
21088
|
// src/components/DataTable/hooks/useDebounced.ts
|
|
21090
|
-
var
|
|
21089
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
21091
21090
|
function useDebounced(value, delay = 300) {
|
|
21092
|
-
const [debounced, setDebounced] =
|
|
21093
|
-
|
|
21091
|
+
const [debounced, setDebounced] = import_react39.default.useState(value);
|
|
21092
|
+
import_react39.default.useEffect(() => {
|
|
21094
21093
|
const id = setTimeout(() => setDebounced(value), delay);
|
|
21095
21094
|
return () => clearTimeout(id);
|
|
21096
21095
|
}, [value, delay]);
|
|
@@ -21098,7 +21097,7 @@ function useDebounced(value, delay = 300) {
|
|
|
21098
21097
|
}
|
|
21099
21098
|
|
|
21100
21099
|
// src/components/DataTable/hooks/useDataTableModel.ts
|
|
21101
|
-
var
|
|
21100
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
21102
21101
|
|
|
21103
21102
|
// src/components/DataTable/utils/columns.ts
|
|
21104
21103
|
function getColumnWidth(col, fallback = 150) {
|
|
@@ -21126,22 +21125,22 @@ function useDataTableModel({
|
|
|
21126
21125
|
isServerMode,
|
|
21127
21126
|
total
|
|
21128
21127
|
}) {
|
|
21129
|
-
const visibleColsSet =
|
|
21130
|
-
const allLeafColumns =
|
|
21131
|
-
const columnMap =
|
|
21128
|
+
const visibleColsSet = import_react40.default.useMemo(() => new Set(visibleCols), [visibleCols]);
|
|
21129
|
+
const allLeafColumns = import_react40.default.useMemo(() => getLeafColumns(columns), [columns]);
|
|
21130
|
+
const columnMap = import_react40.default.useMemo(() => {
|
|
21132
21131
|
return new Map(allLeafColumns.map((column) => [column.key, column]));
|
|
21133
21132
|
}, [allLeafColumns]);
|
|
21134
|
-
const visibleColumns =
|
|
21133
|
+
const visibleColumns = import_react40.default.useMemo(() => {
|
|
21135
21134
|
return filterVisibleColumns(columns, visibleColsSet);
|
|
21136
21135
|
}, [columns, visibleColsSet]);
|
|
21137
|
-
const leafColumns =
|
|
21136
|
+
const leafColumns = import_react40.default.useMemo(() => {
|
|
21138
21137
|
return getLeafColumnsWithFixedInheritance(visibleColumns);
|
|
21139
21138
|
}, [visibleColumns]);
|
|
21140
|
-
const headerRows =
|
|
21141
|
-
const totalColumnsWidth =
|
|
21139
|
+
const headerRows = import_react40.default.useMemo(() => buildHeaderRows(visibleColumns), [visibleColumns]);
|
|
21140
|
+
const totalColumnsWidth = import_react40.default.useMemo(() => {
|
|
21142
21141
|
return leafColumns.reduce((sum, column) => sum + getColumnWidth(column), 0);
|
|
21143
21142
|
}, [leafColumns]);
|
|
21144
|
-
const processedData =
|
|
21143
|
+
const processedData = import_react40.default.useMemo(() => {
|
|
21145
21144
|
if (isServerMode) return data;
|
|
21146
21145
|
let result = [...data];
|
|
21147
21146
|
if (Object.keys(filters).length > 0) {
|
|
@@ -21173,7 +21172,7 @@ function useDataTableModel({
|
|
|
21173
21172
|
return result;
|
|
21174
21173
|
}, [columnMap, data, filters, isServerMode, sort]);
|
|
21175
21174
|
const totalItems = isServerMode ? total : processedData.length;
|
|
21176
|
-
const displayedData =
|
|
21175
|
+
const displayedData = import_react40.default.useMemo(() => {
|
|
21177
21176
|
if (isServerMode) return data;
|
|
21178
21177
|
const start = (curPage - 1) * curPageSize;
|
|
21179
21178
|
return processedData.slice(start, start + curPageSize);
|
|
@@ -21189,13 +21188,13 @@ function useDataTableModel({
|
|
|
21189
21188
|
}
|
|
21190
21189
|
|
|
21191
21190
|
// src/components/DataTable/hooks/useDataTableState.ts
|
|
21192
|
-
var
|
|
21191
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
21193
21192
|
|
|
21194
21193
|
// src/components/DataTable/hooks/usePageSizeStorage.ts
|
|
21195
|
-
var
|
|
21194
|
+
var import_react41 = __toESM(require("react"), 1);
|
|
21196
21195
|
function usePageSizeStorage({ pageSize, storageKey }) {
|
|
21197
|
-
const loadedFromStorage =
|
|
21198
|
-
const [curPageSize, setCurPageSize] =
|
|
21196
|
+
const loadedFromStorage = import_react41.default.useRef(false);
|
|
21197
|
+
const [curPageSize, setCurPageSize] = import_react41.default.useState(() => {
|
|
21199
21198
|
if (typeof window === "undefined" || !storageKey) return pageSize;
|
|
21200
21199
|
try {
|
|
21201
21200
|
const saved = localStorage.getItem(`datatable_${storageKey}_pageSize`);
|
|
@@ -21210,11 +21209,11 @@ function usePageSizeStorage({ pageSize, storageKey }) {
|
|
|
21210
21209
|
}
|
|
21211
21210
|
return pageSize;
|
|
21212
21211
|
});
|
|
21213
|
-
const hasMounted =
|
|
21214
|
-
|
|
21212
|
+
const hasMounted = import_react41.default.useRef(false);
|
|
21213
|
+
import_react41.default.useEffect(() => {
|
|
21215
21214
|
hasMounted.current = true;
|
|
21216
21215
|
}, []);
|
|
21217
|
-
|
|
21216
|
+
import_react41.default.useEffect(() => {
|
|
21218
21217
|
if (typeof window === "undefined" || !storageKey) return;
|
|
21219
21218
|
if (!hasMounted.current) return;
|
|
21220
21219
|
try {
|
|
@@ -21222,7 +21221,7 @@ function usePageSizeStorage({ pageSize, storageKey }) {
|
|
|
21222
21221
|
} catch {
|
|
21223
21222
|
}
|
|
21224
21223
|
}, [curPageSize, storageKey]);
|
|
21225
|
-
|
|
21224
|
+
import_react41.default.useEffect(() => {
|
|
21226
21225
|
if (storageKey && loadedFromStorage.current) return;
|
|
21227
21226
|
setCurPageSize(pageSize);
|
|
21228
21227
|
}, [pageSize, storageKey]);
|
|
@@ -21242,17 +21241,17 @@ function useDataTableState({
|
|
|
21242
21241
|
size,
|
|
21243
21242
|
storageKey
|
|
21244
21243
|
}) {
|
|
21245
|
-
const allLeafColumns =
|
|
21246
|
-
const defaultVisibleLeafKeys =
|
|
21247
|
-
const knownLeafKeysRef =
|
|
21248
|
-
const [headerAlign, setHeaderAlign] =
|
|
21249
|
-
const [visibleCols, setVisibleCols] =
|
|
21250
|
-
const [filters, setFilters] =
|
|
21251
|
-
const [sort, setSort] =
|
|
21252
|
-
const [density, setDensity] =
|
|
21253
|
-
const [curPage, setCurPage] =
|
|
21244
|
+
const allLeafColumns = import_react42.default.useMemo(() => getLeafColumns(columns), [columns]);
|
|
21245
|
+
const defaultVisibleLeafKeys = import_react42.default.useMemo(() => allLeafColumns.filter((column) => column.visible !== false).map((column) => column.key), [allLeafColumns]);
|
|
21246
|
+
const knownLeafKeysRef = import_react42.default.useRef(new Set(defaultVisibleLeafKeys));
|
|
21247
|
+
const [headerAlign, setHeaderAlign] = import_react42.default.useState("left");
|
|
21248
|
+
const [visibleCols, setVisibleCols] = import_react42.default.useState(defaultVisibleLeafKeys);
|
|
21249
|
+
const [filters, setFilters] = import_react42.default.useState({});
|
|
21250
|
+
const [sort, setSort] = import_react42.default.useState(null);
|
|
21251
|
+
const [density, setDensity] = import_react42.default.useState(() => SIZE_TO_DENSITY[size]);
|
|
21252
|
+
const [curPage, setCurPage] = import_react42.default.useState(page);
|
|
21254
21253
|
const { curPageSize, setCurPageSize } = usePageSizeStorage({ pageSize, storageKey });
|
|
21255
|
-
|
|
21254
|
+
import_react42.default.useEffect(() => {
|
|
21256
21255
|
const knownLeafKeys = knownLeafKeysRef.current;
|
|
21257
21256
|
setVisibleCols((prev) => {
|
|
21258
21257
|
const prevSet = new Set(prev);
|
|
@@ -21260,10 +21259,10 @@ function useDataTableState({
|
|
|
21260
21259
|
});
|
|
21261
21260
|
knownLeafKeysRef.current = new Set(allLeafColumns.map((column) => column.key));
|
|
21262
21261
|
}, [allLeafColumns]);
|
|
21263
|
-
|
|
21262
|
+
import_react42.default.useEffect(() => {
|
|
21264
21263
|
setCurPage(page);
|
|
21265
21264
|
}, [page]);
|
|
21266
|
-
|
|
21265
|
+
import_react42.default.useEffect(() => {
|
|
21267
21266
|
setDensity(SIZE_TO_DENSITY[size]);
|
|
21268
21267
|
}, [size]);
|
|
21269
21268
|
return {
|
|
@@ -21285,7 +21284,7 @@ function useDataTableState({
|
|
|
21285
21284
|
}
|
|
21286
21285
|
|
|
21287
21286
|
// src/components/DataTable/hooks/useStickyColumns.ts
|
|
21288
|
-
var
|
|
21287
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
21289
21288
|
|
|
21290
21289
|
// src/components/DataTable/utils/sticky.ts
|
|
21291
21290
|
function buildStickyLayout(visibleColumns) {
|
|
@@ -21332,8 +21331,8 @@ function resolveGroupStickyPosition(column, positions) {
|
|
|
21332
21331
|
|
|
21333
21332
|
// src/components/DataTable/hooks/useStickyColumns.ts
|
|
21334
21333
|
function useStickyColumns(visibleColumns) {
|
|
21335
|
-
const { positions, leftBoundaryKey, rightBoundaryKey } =
|
|
21336
|
-
const getStickyColumnStyle =
|
|
21334
|
+
const { positions, leftBoundaryKey, rightBoundaryKey } = import_react43.default.useMemo(() => buildStickyLayout(visibleColumns), [visibleColumns]);
|
|
21335
|
+
const getStickyColumnStyle = import_react43.default.useCallback(
|
|
21337
21336
|
(col) => {
|
|
21338
21337
|
const pos = resolveStickyPosition(col, positions);
|
|
21339
21338
|
if (!pos) return {};
|
|
@@ -21344,7 +21343,7 @@ function useStickyColumns(visibleColumns) {
|
|
|
21344
21343
|
},
|
|
21345
21344
|
[positions]
|
|
21346
21345
|
);
|
|
21347
|
-
const getBoundaryShadowClass =
|
|
21346
|
+
const getBoundaryShadowClass = import_react43.default.useCallback(
|
|
21348
21347
|
(col) => {
|
|
21349
21348
|
if (col.fixed === "left" && col.key === leftBoundaryKey) {
|
|
21350
21349
|
return "border-r border-border/80 shadow-[10px_0_16px_-10px_rgba(0,0,0,0.55)]";
|
|
@@ -21356,14 +21355,14 @@ function useStickyColumns(visibleColumns) {
|
|
|
21356
21355
|
},
|
|
21357
21356
|
[leftBoundaryKey, rightBoundaryKey]
|
|
21358
21357
|
);
|
|
21359
|
-
const getStickyHeaderClass =
|
|
21358
|
+
const getStickyHeaderClass = import_react43.default.useCallback(
|
|
21360
21359
|
(col) => {
|
|
21361
21360
|
if (!col.fixed) return "";
|
|
21362
21361
|
return cn("sticky", col.fixed === "left" && "left-0", col.fixed === "right" && "right-0", getBoundaryShadowClass(col), "z-50 !bg-muted");
|
|
21363
21362
|
},
|
|
21364
21363
|
[getBoundaryShadowClass]
|
|
21365
21364
|
);
|
|
21366
|
-
const getStickyCellClass =
|
|
21365
|
+
const getStickyCellClass = import_react43.default.useCallback(
|
|
21367
21366
|
(col, isStripedRow) => {
|
|
21368
21367
|
if (!col.fixed) return "";
|
|
21369
21368
|
return cn(
|
|
@@ -21376,7 +21375,7 @@ function useStickyColumns(visibleColumns) {
|
|
|
21376
21375
|
},
|
|
21377
21376
|
[getBoundaryShadowClass]
|
|
21378
21377
|
);
|
|
21379
|
-
const getStickyHeaderCellStyle =
|
|
21378
|
+
const getStickyHeaderCellStyle = import_react43.default.useCallback(
|
|
21380
21379
|
(headerCell) => {
|
|
21381
21380
|
const col = headerCell.column;
|
|
21382
21381
|
if (headerCell.isLeaf) {
|
|
@@ -21523,7 +21522,7 @@ function DataTable({
|
|
|
21523
21522
|
size,
|
|
21524
21523
|
storageKey
|
|
21525
21524
|
});
|
|
21526
|
-
|
|
21525
|
+
import_react44.default.useEffect(() => {
|
|
21527
21526
|
if (process.env.NODE_ENV === "development") {
|
|
21528
21527
|
const warnings = validateColumns(columns);
|
|
21529
21528
|
warnings.forEach((w) => console.warn(`[DataTable] ${w}`));
|
|
@@ -21531,8 +21530,8 @@ function DataTable({
|
|
|
21531
21530
|
}, [columns]);
|
|
21532
21531
|
const debouncedFilters = useDebounced(filters, 350);
|
|
21533
21532
|
const isServerMode = Boolean(onQueryChange);
|
|
21534
|
-
const hasEmittedQuery =
|
|
21535
|
-
|
|
21533
|
+
const hasEmittedQuery = import_react44.default.useRef(false);
|
|
21534
|
+
import_react44.default.useEffect(() => {
|
|
21536
21535
|
if (!onQueryChange) return;
|
|
21537
21536
|
if (!hasEmittedQuery.current) {
|
|
21538
21537
|
hasEmittedQuery.current = true;
|
|
@@ -21540,7 +21539,7 @@ function DataTable({
|
|
|
21540
21539
|
}
|
|
21541
21540
|
onQueryChange({ filters: debouncedFilters, sort, page: curPage, pageSize: curPageSize });
|
|
21542
21541
|
}, [debouncedFilters, sort, curPage, curPageSize, onQueryChange]);
|
|
21543
|
-
|
|
21542
|
+
import_react44.default.useEffect(() => {
|
|
21544
21543
|
if (process.env.NODE_ENV !== "development" || rowKey) return;
|
|
21545
21544
|
const hasQueryFeatures = columns.some((column) => column.sortable || column.filter) || Boolean(pageSizeOptions?.length) || isServerMode;
|
|
21546
21545
|
if (!hasQueryFeatures) return;
|
|
@@ -21568,7 +21567,7 @@ function DataTable({
|
|
|
21568
21567
|
if (typeof rowKey === "function") return String(rowKey(row));
|
|
21569
21568
|
return String(row[rowKey]);
|
|
21570
21569
|
};
|
|
21571
|
-
const viewportRef =
|
|
21570
|
+
const viewportRef = import_react44.default.useRef(null);
|
|
21572
21571
|
useOverlayScrollbarTarget(viewportRef, { enabled: useOverlayScrollbar });
|
|
21573
21572
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: cn("space-y-2", className), children: [
|
|
21574
21573
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
@@ -21674,10 +21673,10 @@ function DataTable({
|
|
|
21674
21673
|
var DataTable_default = DataTable;
|
|
21675
21674
|
|
|
21676
21675
|
// src/components/Form.tsx
|
|
21677
|
-
var
|
|
21676
|
+
var React69 = __toESM(require("react"), 1);
|
|
21678
21677
|
var import_react_hook_form = require("react-hook-form");
|
|
21679
21678
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
21680
|
-
var FormConfigContext =
|
|
21679
|
+
var FormConfigContext = React69.createContext({ size: "md" });
|
|
21681
21680
|
var FormWrapper = ({
|
|
21682
21681
|
children,
|
|
21683
21682
|
onSubmit,
|
|
@@ -21690,7 +21689,7 @@ var FormWrapper = ({
|
|
|
21690
21689
|
const methods = (0, import_react_hook_form.useForm)({
|
|
21691
21690
|
defaultValues: initialValues
|
|
21692
21691
|
});
|
|
21693
|
-
|
|
21692
|
+
React69.useEffect(() => {
|
|
21694
21693
|
if (initialValues) {
|
|
21695
21694
|
methods.reset(initialValues);
|
|
21696
21695
|
}
|
|
@@ -21699,23 +21698,18 @@ var FormWrapper = ({
|
|
|
21699
21698
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_react_hook_form.FormProvider, { ...methods, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(FormConfigContext.Provider, { value: { size }, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("form", { onSubmit: methods.handleSubmit(onSubmit), className, ...formProps, children }) }) });
|
|
21700
21699
|
};
|
|
21701
21700
|
var Form = FormWrapper;
|
|
21702
|
-
var FormFieldContext =
|
|
21701
|
+
var FormFieldContext = React69.createContext({});
|
|
21703
21702
|
var FormField = ({
|
|
21704
21703
|
...props
|
|
21705
21704
|
}) => {
|
|
21706
21705
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_react_hook_form.Controller, { ...props }) });
|
|
21707
21706
|
};
|
|
21708
21707
|
var useFormField = () => {
|
|
21709
|
-
const fieldContext =
|
|
21710
|
-
const itemContext =
|
|
21708
|
+
const fieldContext = React69.useContext(FormFieldContext);
|
|
21709
|
+
const itemContext = React69.useContext(FormItemContext);
|
|
21711
21710
|
const { getFieldState, formState } = (0, import_react_hook_form.useFormContext)();
|
|
21712
21711
|
if (!fieldContext) {
|
|
21713
|
-
|
|
21714
|
-
const t = useSmartTranslations("Form");
|
|
21715
|
-
throw new Error(t("validation.mustBeUsedWithinForm"));
|
|
21716
|
-
} catch {
|
|
21717
|
-
throw new Error("useFormField must be used within FormField");
|
|
21718
|
-
}
|
|
21712
|
+
throw new Error("useFormField must be used within FormField");
|
|
21719
21713
|
}
|
|
21720
21714
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
21721
21715
|
const { id } = itemContext;
|
|
@@ -21728,16 +21722,16 @@ var useFormField = () => {
|
|
|
21728
21722
|
...fieldState
|
|
21729
21723
|
};
|
|
21730
21724
|
};
|
|
21731
|
-
var FormItemContext =
|
|
21732
|
-
var FormItem =
|
|
21733
|
-
const id =
|
|
21725
|
+
var FormItemContext = React69.createContext({});
|
|
21726
|
+
var FormItem = React69.forwardRef(({ className, ...props }, ref) => {
|
|
21727
|
+
const id = React69.useId();
|
|
21734
21728
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
21735
21729
|
});
|
|
21736
21730
|
FormItem.displayName = "FormItem";
|
|
21737
|
-
var FormLabel =
|
|
21731
|
+
var FormLabel = React69.forwardRef(
|
|
21738
21732
|
({ className, children, required, ...props }, ref) => {
|
|
21739
21733
|
const { error, formItemId } = useFormField();
|
|
21740
|
-
const config =
|
|
21734
|
+
const config = React69.useContext(FormConfigContext);
|
|
21741
21735
|
const sizeClass = config.size === "sm" ? "text-xs" : config.size === "lg" ? "text-base" : "text-sm";
|
|
21742
21736
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(Label, { ref, className: cn(sizeClass, error && "text-destructive", className), htmlFor: formItemId, ...props, children: [
|
|
21743
21737
|
children,
|
|
@@ -21746,7 +21740,7 @@ var FormLabel = React68.forwardRef(
|
|
|
21746
21740
|
}
|
|
21747
21741
|
);
|
|
21748
21742
|
FormLabel.displayName = "FormLabel";
|
|
21749
|
-
var FormControl =
|
|
21743
|
+
var FormControl = React69.forwardRef(({ ...props }, ref) => {
|
|
21750
21744
|
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
21751
21745
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
21752
21746
|
"div",
|
|
@@ -21760,12 +21754,12 @@ var FormControl = React68.forwardRef(({ ...props }, ref) => {
|
|
|
21760
21754
|
);
|
|
21761
21755
|
});
|
|
21762
21756
|
FormControl.displayName = "FormControl";
|
|
21763
|
-
var FormDescription =
|
|
21757
|
+
var FormDescription = React69.forwardRef(({ className, ...props }, ref) => {
|
|
21764
21758
|
const { formDescriptionId } = useFormField();
|
|
21765
21759
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { ref, id: formDescriptionId, className: cn("text-sm text-muted-foreground", className), ...props });
|
|
21766
21760
|
});
|
|
21767
21761
|
FormDescription.displayName = "FormDescription";
|
|
21768
|
-
var FormMessage =
|
|
21762
|
+
var FormMessage = React69.forwardRef(({ className, children, ...props }, ref) => {
|
|
21769
21763
|
const { error, formMessageId } = useFormField();
|
|
21770
21764
|
const body = error ? String(error?.message) : children;
|
|
21771
21765
|
if (!body) {
|
|
@@ -21774,7 +21768,7 @@ var FormMessage = React68.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
21774
21768
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { ref, id: formMessageId, className: cn("text-sm font-medium text-destructive", className), ...props, children: body });
|
|
21775
21769
|
});
|
|
21776
21770
|
FormMessage.displayName = "FormMessage";
|
|
21777
|
-
var FormInput =
|
|
21771
|
+
var FormInput = React69.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
21778
21772
|
FormField,
|
|
21779
21773
|
{
|
|
21780
21774
|
name,
|
|
@@ -21785,7 +21779,7 @@ var FormInput = React68.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */
|
|
|
21785
21779
|
}
|
|
21786
21780
|
) }));
|
|
21787
21781
|
FormInput.displayName = "FormInput";
|
|
21788
|
-
var FormCheckbox =
|
|
21782
|
+
var FormCheckbox = React69.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
21789
21783
|
FormField,
|
|
21790
21784
|
{
|
|
21791
21785
|
name,
|
|
@@ -21809,9 +21803,9 @@ var FormCheckbox = React68.forwardRef(({ name, ...props }, ref) => /* @__PURE__
|
|
|
21809
21803
|
}
|
|
21810
21804
|
) }));
|
|
21811
21805
|
FormCheckbox.displayName = "FormCheckbox";
|
|
21812
|
-
var FormActions =
|
|
21806
|
+
var FormActions = React69.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { ref, className: cn("flex gap-2 justify-end", className), ...props }));
|
|
21813
21807
|
FormActions.displayName = "FormActions";
|
|
21814
|
-
var FormSubmitButton =
|
|
21808
|
+
var FormSubmitButton = React69.forwardRef(
|
|
21815
21809
|
({ children, loading: loading2, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Button_default, { ref, type: "submit", size: props.size ?? size, disabled: loading2, ...props, children }) })
|
|
21816
21810
|
);
|
|
21817
21811
|
FormSubmitButton.displayName = "FormSubmitButton";
|
|
@@ -21893,7 +21887,7 @@ function AccessDenied({
|
|
|
21893
21887
|
|
|
21894
21888
|
// src/components/ThemeToggleHeadless.tsx
|
|
21895
21889
|
var import_lucide_react37 = require("lucide-react");
|
|
21896
|
-
var
|
|
21890
|
+
var import_react45 = require("react");
|
|
21897
21891
|
var import_react_dom7 = require("react-dom");
|
|
21898
21892
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
21899
21893
|
function ThemeToggleHeadless({
|
|
@@ -21902,11 +21896,11 @@ function ThemeToggleHeadless({
|
|
|
21902
21896
|
labels,
|
|
21903
21897
|
className
|
|
21904
21898
|
}) {
|
|
21905
|
-
const [isOpen, setIsOpen] = (0,
|
|
21906
|
-
const [mounted, setMounted] = (0,
|
|
21907
|
-
const triggerRef = (0,
|
|
21908
|
-
const [dropdownPosition, setDropdownPosition] = (0,
|
|
21909
|
-
(0,
|
|
21899
|
+
const [isOpen, setIsOpen] = (0, import_react45.useState)(false);
|
|
21900
|
+
const [mounted, setMounted] = (0, import_react45.useState)(false);
|
|
21901
|
+
const triggerRef = (0, import_react45.useRef)(null);
|
|
21902
|
+
const [dropdownPosition, setDropdownPosition] = (0, import_react45.useState)(null);
|
|
21903
|
+
(0, import_react45.useEffect)(() => setMounted(true), []);
|
|
21910
21904
|
const themes = [
|
|
21911
21905
|
{ value: "light", label: labels?.light ?? "Light", icon: import_lucide_react37.Sun },
|
|
21912
21906
|
{ value: "dark", label: labels?.dark ?? "Dark", icon: import_lucide_react37.Moon },
|
|
@@ -21995,7 +21989,7 @@ function ThemeToggleHeadless({
|
|
|
21995
21989
|
}
|
|
21996
21990
|
|
|
21997
21991
|
// src/components/LanguageSwitcherHeadless.tsx
|
|
21998
|
-
var
|
|
21992
|
+
var import_react46 = require("react");
|
|
21999
21993
|
var import_react_dom8 = require("react-dom");
|
|
22000
21994
|
var import_lucide_react38 = require("lucide-react");
|
|
22001
21995
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
@@ -22006,9 +22000,9 @@ function LanguageSwitcherHeadless({
|
|
|
22006
22000
|
labels,
|
|
22007
22001
|
className
|
|
22008
22002
|
}) {
|
|
22009
|
-
const [isOpen, setIsOpen] = (0,
|
|
22010
|
-
const [dropdownPosition, setDropdownPosition] = (0,
|
|
22011
|
-
const triggerButtonRef = (0,
|
|
22003
|
+
const [isOpen, setIsOpen] = (0, import_react46.useState)(false);
|
|
22004
|
+
const [dropdownPosition, setDropdownPosition] = (0, import_react46.useState)(null);
|
|
22005
|
+
const triggerButtonRef = (0, import_react46.useRef)(null);
|
|
22012
22006
|
const currentLanguage = locales.find((l) => l.code === currentLocale) || locales[0];
|
|
22013
22007
|
const calculatePosition = () => {
|
|
22014
22008
|
const rect = triggerButtonRef.current?.getBoundingClientRect();
|
|
@@ -22102,7 +22096,7 @@ var VARIANT_STYLES_ALERT = {
|
|
|
22102
22096
|
};
|
|
22103
22097
|
|
|
22104
22098
|
// ../../lib/i18n/translation-adapter.tsx
|
|
22105
|
-
var
|
|
22099
|
+
var React71 = __toESM(require("react"), 1);
|
|
22106
22100
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
22107
22101
|
var defaultTranslations2 = {
|
|
22108
22102
|
en: {
|
|
@@ -22467,9 +22461,9 @@ function resolveTranslationValue2(translations, namespace, key) {
|
|
|
22467
22461
|
const value = resolveObjectPath2(namespaceValue, key);
|
|
22468
22462
|
return typeof value === "string" ? value : null;
|
|
22469
22463
|
}
|
|
22470
|
-
var TranslationContext2 =
|
|
22464
|
+
var TranslationContext2 = React71.createContext(null);
|
|
22471
22465
|
var UnderverseProvider = ({ children, locale = "en", translations }) => {
|
|
22472
|
-
const t =
|
|
22466
|
+
const t = React71.useCallback(
|
|
22473
22467
|
(namespace) => {
|
|
22474
22468
|
return (key) => {
|
|
22475
22469
|
const mergedTranslations = {
|
|
@@ -22510,7 +22504,7 @@ function getInternalTranslation(namespace, locale) {
|
|
|
22510
22504
|
};
|
|
22511
22505
|
}
|
|
22512
22506
|
function useTranslations(namespace) {
|
|
22513
|
-
const underverseContext =
|
|
22507
|
+
const underverseContext = React71.useContext(TranslationContext2);
|
|
22514
22508
|
if (underverseContext) {
|
|
22515
22509
|
return (key, params) => {
|
|
22516
22510
|
const result = underverseContext.t(namespace)(key);
|
|
@@ -22527,7 +22521,7 @@ function useTranslations(namespace) {
|
|
|
22527
22521
|
return getInternalTranslation(namespace, "en");
|
|
22528
22522
|
}
|
|
22529
22523
|
function useLocale() {
|
|
22530
|
-
const underverseContext =
|
|
22524
|
+
const underverseContext = React71.useContext(TranslationContext2);
|
|
22531
22525
|
if (underverseContext) {
|
|
22532
22526
|
return underverseContext.locale;
|
|
22533
22527
|
}
|
|
@@ -22546,8 +22540,8 @@ function useLocale() {
|
|
|
22546
22540
|
}
|
|
22547
22541
|
|
|
22548
22542
|
// src/components/UEditor/UEditor.tsx
|
|
22549
|
-
var
|
|
22550
|
-
var
|
|
22543
|
+
var import_react58 = __toESM(require("react"), 1);
|
|
22544
|
+
var import_react59 = require("@tiptap/react");
|
|
22551
22545
|
|
|
22552
22546
|
// src/components/UEditor/extensions.ts
|
|
22553
22547
|
var import_extension_document = __toESM(require("@tiptap/extension-document"), 1);
|
|
@@ -22586,8 +22580,8 @@ var import_lowlight = require("lowlight");
|
|
|
22586
22580
|
// src/components/UEditor/slash-command.tsx
|
|
22587
22581
|
var import_core = require("@tiptap/core");
|
|
22588
22582
|
var import_suggestion = __toESM(require("@tiptap/suggestion"), 1);
|
|
22589
|
-
var
|
|
22590
|
-
var
|
|
22583
|
+
var import_react47 = require("@tiptap/react");
|
|
22584
|
+
var import_react48 = require("react");
|
|
22591
22585
|
var import_lucide_react39 = require("lucide-react");
|
|
22592
22586
|
var import_tippy = __toESM(require("tippy.js"), 1);
|
|
22593
22587
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
@@ -22617,17 +22611,17 @@ var DEFAULT_MESSAGES = {
|
|
|
22617
22611
|
table: "Table",
|
|
22618
22612
|
tableDesc: "Insert a table"
|
|
22619
22613
|
};
|
|
22620
|
-
var CommandList = (0,
|
|
22621
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
22622
|
-
const listRef = (0,
|
|
22623
|
-
(0,
|
|
22614
|
+
var CommandList = (0, import_react48.forwardRef)((props, ref) => {
|
|
22615
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react48.useState)(0);
|
|
22616
|
+
const listRef = (0, import_react48.useRef)(null);
|
|
22617
|
+
(0, import_react48.useEffect)(() => {
|
|
22624
22618
|
setSelectedIndex(0);
|
|
22625
22619
|
}, [props.items]);
|
|
22626
|
-
(0,
|
|
22620
|
+
(0, import_react48.useEffect)(() => {
|
|
22627
22621
|
const selectedElement = listRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
22628
22622
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
22629
22623
|
}, [selectedIndex, props.items]);
|
|
22630
|
-
(0,
|
|
22624
|
+
(0, import_react48.useImperativeHandle)(ref, () => ({
|
|
22631
22625
|
onKeyDown: ({ event }) => {
|
|
22632
22626
|
if (event.key === "ArrowUp") {
|
|
22633
22627
|
setSelectedIndex((prev) => (prev + props.items.length - 1) % props.items.length);
|
|
@@ -22798,7 +22792,7 @@ var SlashCommand = import_core.Extension.create({
|
|
|
22798
22792
|
let popup;
|
|
22799
22793
|
return {
|
|
22800
22794
|
onStart: (props) => {
|
|
22801
|
-
component = new
|
|
22795
|
+
component = new import_react47.ReactRenderer(CommandList, {
|
|
22802
22796
|
props: {
|
|
22803
22797
|
...props,
|
|
22804
22798
|
messages
|
|
@@ -22946,9 +22940,9 @@ var ClipboardImages = import_core2.Extension.create({
|
|
|
22946
22940
|
// src/components/UEditor/emoji-suggestion.tsx
|
|
22947
22941
|
var import_core3 = require("@tiptap/core");
|
|
22948
22942
|
var import_suggestion2 = __toESM(require("@tiptap/suggestion"), 1);
|
|
22949
|
-
var
|
|
22943
|
+
var import_react49 = require("@tiptap/react");
|
|
22950
22944
|
var import_state2 = require("@tiptap/pm/state");
|
|
22951
|
-
var
|
|
22945
|
+
var import_react50 = require("react");
|
|
22952
22946
|
var import_lucide_react40 = require("lucide-react");
|
|
22953
22947
|
var import_tippy2 = __toESM(require("tippy.js"), 1);
|
|
22954
22948
|
|
|
@@ -23719,12 +23713,12 @@ var EMOJI_LIST = [
|
|
|
23719
23713
|
|
|
23720
23714
|
// src/components/UEditor/emoji-suggestion.tsx
|
|
23721
23715
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
23722
|
-
var EmojiList = (0,
|
|
23723
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
23724
|
-
(0,
|
|
23716
|
+
var EmojiList = (0, import_react50.forwardRef)((props, ref) => {
|
|
23717
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react50.useState)(0);
|
|
23718
|
+
(0, import_react50.useEffect)(() => {
|
|
23725
23719
|
setSelectedIndex(0);
|
|
23726
23720
|
}, [props.items]);
|
|
23727
|
-
(0,
|
|
23721
|
+
(0, import_react50.useImperativeHandle)(ref, () => ({
|
|
23728
23722
|
onKeyDown: ({ event }) => {
|
|
23729
23723
|
if (event.key === "ArrowUp") {
|
|
23730
23724
|
setSelectedIndex((prev) => (prev + props.items.length - 1) % props.items.length);
|
|
@@ -23811,7 +23805,7 @@ var EmojiSuggestion = import_core3.Extension.create({
|
|
|
23811
23805
|
let popup;
|
|
23812
23806
|
return {
|
|
23813
23807
|
onStart: (props) => {
|
|
23814
|
-
component = new
|
|
23808
|
+
component = new import_react49.ReactRenderer(EmojiList, {
|
|
23815
23809
|
props,
|
|
23816
23810
|
editor: props.editor
|
|
23817
23811
|
});
|
|
@@ -23929,10 +23923,10 @@ var UEditorPlaceholder = import_core4.Extension.create({
|
|
|
23929
23923
|
});
|
|
23930
23924
|
|
|
23931
23925
|
// src/components/UEditor/resizable-image.tsx
|
|
23932
|
-
var
|
|
23926
|
+
var import_react51 = require("react");
|
|
23933
23927
|
var import_extension_image = __toESM(require("@tiptap/extension-image"), 1);
|
|
23934
23928
|
var import_core5 = require("@tiptap/core");
|
|
23935
|
-
var
|
|
23929
|
+
var import_react52 = require("@tiptap/react");
|
|
23936
23930
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
23937
23931
|
var MIN_IMAGE_SIZE_PX = 40;
|
|
23938
23932
|
var AXIS_LOCK_THRESHOLD_PX = 4;
|
|
@@ -23949,15 +23943,15 @@ function clamp8(value, min, max) {
|
|
|
23949
23943
|
}
|
|
23950
23944
|
function ResizableImageNodeView(props) {
|
|
23951
23945
|
const { node, selected, updateAttributes, editor, getPos } = props;
|
|
23952
|
-
const wrapperRef = (0,
|
|
23953
|
-
const imgRef = (0,
|
|
23954
|
-
const [isHovered, setIsHovered] = (0,
|
|
23955
|
-
const [isResizing, setIsResizing] = (0,
|
|
23946
|
+
const wrapperRef = (0, import_react51.useRef)(null);
|
|
23947
|
+
const imgRef = (0, import_react51.useRef)(null);
|
|
23948
|
+
const [isHovered, setIsHovered] = (0, import_react51.useState)(false);
|
|
23949
|
+
const [isResizing, setIsResizing] = (0, import_react51.useState)(false);
|
|
23956
23950
|
const widthAttr = toNullableNumber(node.attrs["width"]);
|
|
23957
23951
|
const heightAttr = toNullableNumber(node.attrs["height"]);
|
|
23958
23952
|
const textAlign = String(node.attrs["textAlign"] ?? "");
|
|
23959
|
-
const dragStateRef = (0,
|
|
23960
|
-
(0,
|
|
23953
|
+
const dragStateRef = (0, import_react51.useRef)(null);
|
|
23954
|
+
(0, import_react51.useEffect)(() => {
|
|
23961
23955
|
const img = imgRef.current;
|
|
23962
23956
|
if (!img) return;
|
|
23963
23957
|
img.style.width = widthAttr ? `${widthAttr}px` : "";
|
|
@@ -24052,7 +24046,7 @@ function ResizableImageNodeView(props) {
|
|
|
24052
24046
|
const wrapperAlignClass = textAlign === "center" ? "mx-auto" : textAlign === "right" ? "ml-auto" : textAlign === "justify" ? "mx-auto" : "";
|
|
24053
24047
|
const wrapperWidthClass = "w-fit";
|
|
24054
24048
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
24055
|
-
|
|
24049
|
+
import_react52.NodeViewWrapper,
|
|
24056
24050
|
{
|
|
24057
24051
|
as: "div",
|
|
24058
24052
|
ref: wrapperRef,
|
|
@@ -24133,7 +24127,7 @@ var ResizableImage = import_extension_image.default.extend({
|
|
|
24133
24127
|
return ["img", (0, import_core5.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)];
|
|
24134
24128
|
},
|
|
24135
24129
|
addNodeView() {
|
|
24136
|
-
return (0,
|
|
24130
|
+
return (0, import_react52.ReactNodeViewRenderer)(ResizableImageNodeView);
|
|
24137
24131
|
}
|
|
24138
24132
|
}).configure({
|
|
24139
24133
|
allowBase64: true,
|
|
@@ -24288,16 +24282,16 @@ function buildUEditorExtensions({
|
|
|
24288
24282
|
}
|
|
24289
24283
|
|
|
24290
24284
|
// src/components/UEditor/toolbar.tsx
|
|
24291
|
-
var
|
|
24285
|
+
var import_react56 = __toESM(require("react"), 1);
|
|
24292
24286
|
var import_lucide_react44 = require("lucide-react");
|
|
24293
24287
|
|
|
24294
24288
|
// src/components/UEditor/colors.tsx
|
|
24295
|
-
var
|
|
24289
|
+
var import_react53 = require("react");
|
|
24296
24290
|
var import_lucide_react41 = require("lucide-react");
|
|
24297
24291
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
24298
24292
|
var useEditorColors = () => {
|
|
24299
24293
|
const t = useSmartTranslations("UEditor");
|
|
24300
|
-
const textColors = (0,
|
|
24294
|
+
const textColors = (0, import_react53.useMemo)(
|
|
24301
24295
|
() => [
|
|
24302
24296
|
{ name: t("colors.default"), color: "inherit", cssClass: "text-foreground" },
|
|
24303
24297
|
{ name: t("colors.muted"), color: "var(--muted-foreground)", cssClass: "text-muted-foreground" },
|
|
@@ -24310,7 +24304,7 @@ var useEditorColors = () => {
|
|
|
24310
24304
|
],
|
|
24311
24305
|
[t]
|
|
24312
24306
|
);
|
|
24313
|
-
const highlightColors = (0,
|
|
24307
|
+
const highlightColors = (0, import_react53.useMemo)(
|
|
24314
24308
|
() => [
|
|
24315
24309
|
{ name: t("colors.default"), color: "", cssClass: "" },
|
|
24316
24310
|
{ name: t("colors.muted"), color: "var(--muted)", cssClass: "bg-muted" },
|
|
@@ -24355,7 +24349,7 @@ var EditorColorPalette = ({
|
|
|
24355
24349
|
] });
|
|
24356
24350
|
|
|
24357
24351
|
// src/components/UEditor/inputs.tsx
|
|
24358
|
-
var
|
|
24352
|
+
var import_react54 = require("react");
|
|
24359
24353
|
var import_lucide_react42 = require("lucide-react");
|
|
24360
24354
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
24361
24355
|
function normalizeUrl(raw) {
|
|
@@ -24371,9 +24365,9 @@ var LinkInput = ({
|
|
|
24371
24365
|
initialUrl = ""
|
|
24372
24366
|
}) => {
|
|
24373
24367
|
const t = useSmartTranslations("UEditor");
|
|
24374
|
-
const [url, setUrl] = (0,
|
|
24375
|
-
const inputRef = (0,
|
|
24376
|
-
(0,
|
|
24368
|
+
const [url, setUrl] = (0, import_react54.useState)(initialUrl);
|
|
24369
|
+
const inputRef = (0, import_react54.useRef)(null);
|
|
24370
|
+
(0, import_react54.useEffect)(() => {
|
|
24377
24371
|
inputRef.current?.focus();
|
|
24378
24372
|
inputRef.current?.select();
|
|
24379
24373
|
}, []);
|
|
@@ -24400,10 +24394,10 @@ var LinkInput = ({
|
|
|
24400
24394
|
};
|
|
24401
24395
|
var ImageInput = ({ onSubmit, onCancel }) => {
|
|
24402
24396
|
const t = useSmartTranslations("UEditor");
|
|
24403
|
-
const [url, setUrl] = (0,
|
|
24404
|
-
const [alt, setAlt] = (0,
|
|
24405
|
-
const inputRef = (0,
|
|
24406
|
-
(0,
|
|
24397
|
+
const [url, setUrl] = (0, import_react54.useState)("");
|
|
24398
|
+
const [alt, setAlt] = (0, import_react54.useState)("");
|
|
24399
|
+
const inputRef = (0, import_react54.useRef)(null);
|
|
24400
|
+
(0, import_react54.useEffect)(() => {
|
|
24407
24401
|
inputRef.current?.focus();
|
|
24408
24402
|
}, []);
|
|
24409
24403
|
const handleSubmit = (e) => {
|
|
@@ -24456,7 +24450,7 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
24456
24450
|
};
|
|
24457
24451
|
|
|
24458
24452
|
// src/components/UEditor/emoji-picker.tsx
|
|
24459
|
-
var
|
|
24453
|
+
var import_react55 = require("react");
|
|
24460
24454
|
var import_lucide_react43 = require("lucide-react");
|
|
24461
24455
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
24462
24456
|
var CATEGORY_ICONS = {
|
|
@@ -24470,12 +24464,12 @@ var CATEGORY_ICONS = {
|
|
|
24470
24464
|
};
|
|
24471
24465
|
var EmojiPicker = ({ onSelect, onClose }) => {
|
|
24472
24466
|
const t = useSmartTranslations("UEditor");
|
|
24473
|
-
const [search, setSearch] = (0,
|
|
24474
|
-
const [activeCategory, setActiveCategory] = (0,
|
|
24475
|
-
const scrollContainerRef = (0,
|
|
24476
|
-
const categoryRefs = (0,
|
|
24477
|
-
const isUserScrolling = (0,
|
|
24478
|
-
const filteredCategories = (0,
|
|
24467
|
+
const [search, setSearch] = (0, import_react55.useState)("");
|
|
24468
|
+
const [activeCategory, setActiveCategory] = (0, import_react55.useState)(EMOJI_LIST[0]?.id || "");
|
|
24469
|
+
const scrollContainerRef = (0, import_react55.useRef)(null);
|
|
24470
|
+
const categoryRefs = (0, import_react55.useRef)({});
|
|
24471
|
+
const isUserScrolling = (0, import_react55.useRef)(false);
|
|
24472
|
+
const filteredCategories = (0, import_react55.useMemo)(() => {
|
|
24479
24473
|
if (!search.trim()) return EMOJI_LIST;
|
|
24480
24474
|
const query = search.toLowerCase();
|
|
24481
24475
|
return EMOJI_LIST.map((category) => ({
|
|
@@ -24489,7 +24483,7 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
24489
24483
|
onSelect(emoji);
|
|
24490
24484
|
setSearch("");
|
|
24491
24485
|
};
|
|
24492
|
-
(0,
|
|
24486
|
+
(0, import_react55.useEffect)(() => {
|
|
24493
24487
|
if (search) return;
|
|
24494
24488
|
const container = scrollContainerRef.current;
|
|
24495
24489
|
if (!container) return;
|
|
@@ -24529,7 +24523,7 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
24529
24523
|
isUserScrolling.current = true;
|
|
24530
24524
|
}, 500);
|
|
24531
24525
|
};
|
|
24532
|
-
(0,
|
|
24526
|
+
(0, import_react55.useEffect)(() => {
|
|
24533
24527
|
isUserScrolling.current = true;
|
|
24534
24528
|
}, []);
|
|
24535
24529
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "w-96 bg-card border border-border rounded-2xl shadow-xl overflow-hidden flex flex-col max-h-128", children: [
|
|
@@ -24648,7 +24642,7 @@ function fileToDataUrl2(file) {
|
|
|
24648
24642
|
reader.readAsDataURL(file);
|
|
24649
24643
|
});
|
|
24650
24644
|
}
|
|
24651
|
-
var ToolbarButton =
|
|
24645
|
+
var ToolbarButton = import_react56.default.forwardRef(({ onClick, onMouseDown, active, disabled, children, title, className }, ref) => {
|
|
24652
24646
|
const button = /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
24653
24647
|
"button",
|
|
24654
24648
|
{
|
|
@@ -24686,10 +24680,10 @@ var EditorToolbar = ({
|
|
|
24686
24680
|
}) => {
|
|
24687
24681
|
const t = useSmartTranslations("UEditor");
|
|
24688
24682
|
const { textColors, highlightColors } = useEditorColors();
|
|
24689
|
-
const [showImageInput, setShowImageInput] = (0,
|
|
24690
|
-
const fileInputRef = (0,
|
|
24691
|
-
const [isUploadingImage, setIsUploadingImage] = (0,
|
|
24692
|
-
const [imageUploadError, setImageUploadError] = (0,
|
|
24683
|
+
const [showImageInput, setShowImageInput] = (0, import_react56.useState)(false);
|
|
24684
|
+
const fileInputRef = (0, import_react56.useRef)(null);
|
|
24685
|
+
const [isUploadingImage, setIsUploadingImage] = (0, import_react56.useState)(false);
|
|
24686
|
+
const [imageUploadError, setImageUploadError] = (0, import_react56.useState)(null);
|
|
24693
24687
|
const insertImageFiles = async (files) => {
|
|
24694
24688
|
if (files.length === 0) return;
|
|
24695
24689
|
setIsUploadingImage(true);
|
|
@@ -25137,15 +25131,15 @@ var EditorToolbar = ({
|
|
|
25137
25131
|
};
|
|
25138
25132
|
|
|
25139
25133
|
// src/components/UEditor/menus.tsx
|
|
25140
|
-
var
|
|
25134
|
+
var import_react57 = require("react");
|
|
25141
25135
|
var import_react_dom9 = require("react-dom");
|
|
25142
25136
|
var import_lucide_react45 = require("lucide-react");
|
|
25143
25137
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
25144
25138
|
var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
25145
25139
|
const t = useSmartTranslations("UEditor");
|
|
25146
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
25147
|
-
const menuRef = (0,
|
|
25148
|
-
const allCommands = (0,
|
|
25140
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react57.useState)(0);
|
|
25141
|
+
const menuRef = (0, import_react57.useRef)(null);
|
|
25142
|
+
const allCommands = (0, import_react57.useMemo)(
|
|
25149
25143
|
() => [
|
|
25150
25144
|
{
|
|
25151
25145
|
icon: import_lucide_react45.Type,
|
|
@@ -25216,19 +25210,19 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
25216
25210
|
],
|
|
25217
25211
|
[editor, t]
|
|
25218
25212
|
);
|
|
25219
|
-
const commands = (0,
|
|
25213
|
+
const commands = (0, import_react57.useMemo)(() => {
|
|
25220
25214
|
if (!filterText) return allCommands;
|
|
25221
25215
|
const lowerFilter = filterText.toLowerCase();
|
|
25222
25216
|
return allCommands.filter((cmd) => cmd.label.toLowerCase().includes(lowerFilter) || cmd.description.toLowerCase().includes(lowerFilter));
|
|
25223
25217
|
}, [allCommands, filterText]);
|
|
25224
|
-
(0,
|
|
25218
|
+
(0, import_react57.useEffect)(() => {
|
|
25225
25219
|
setSelectedIndex(0);
|
|
25226
25220
|
}, [filterText]);
|
|
25227
|
-
(0,
|
|
25221
|
+
(0, import_react57.useEffect)(() => {
|
|
25228
25222
|
const selectedElement = menuRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
25229
25223
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
25230
25224
|
}, [selectedIndex]);
|
|
25231
|
-
const selectCommand = (0,
|
|
25225
|
+
const selectCommand = (0, import_react57.useCallback)(
|
|
25232
25226
|
(index) => {
|
|
25233
25227
|
const command = commands[index];
|
|
25234
25228
|
if (command) {
|
|
@@ -25238,7 +25232,7 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
25238
25232
|
},
|
|
25239
25233
|
[commands, onClose]
|
|
25240
25234
|
);
|
|
25241
|
-
(0,
|
|
25235
|
+
(0, import_react57.useEffect)(() => {
|
|
25242
25236
|
const handleKeyDown = (e) => {
|
|
25243
25237
|
if (commands.length === 0) return;
|
|
25244
25238
|
if (e.key === "ArrowDown") {
|
|
@@ -25298,7 +25292,7 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
25298
25292
|
};
|
|
25299
25293
|
var FloatingMenuContent = ({ editor }) => {
|
|
25300
25294
|
const t = useSmartTranslations("UEditor");
|
|
25301
|
-
const [showCommands, setShowCommands] = (0,
|
|
25295
|
+
const [showCommands, setShowCommands] = (0, import_react57.useState)(false);
|
|
25302
25296
|
if (showCommands) {
|
|
25303
25297
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(SlashCommandMenu, { editor, onClose: () => setShowCommands(false) });
|
|
25304
25298
|
}
|
|
@@ -25321,12 +25315,12 @@ var BubbleMenuContent = ({
|
|
|
25321
25315
|
}) => {
|
|
25322
25316
|
const t = useSmartTranslations("UEditor");
|
|
25323
25317
|
const { textColors, highlightColors } = useEditorColors();
|
|
25324
|
-
const [showLinkInput, setShowLinkInput] = (0,
|
|
25325
|
-
const [showEditorColorPalette, setShowEditorColorPalette] = (0,
|
|
25326
|
-
(0,
|
|
25318
|
+
const [showLinkInput, setShowLinkInput] = (0, import_react57.useState)(false);
|
|
25319
|
+
const [showEditorColorPalette, setShowEditorColorPalette] = (0, import_react57.useState)(false);
|
|
25320
|
+
(0, import_react57.useEffect)(() => {
|
|
25327
25321
|
onKeepOpenChange?.(showLinkInput);
|
|
25328
25322
|
}, [onKeepOpenChange, showLinkInput]);
|
|
25329
|
-
(0,
|
|
25323
|
+
(0, import_react57.useEffect)(() => {
|
|
25330
25324
|
if (!showLinkInput) return;
|
|
25331
25325
|
const close = () => setShowLinkInput(false);
|
|
25332
25326
|
editor.on("selectionUpdate", close);
|
|
@@ -25449,15 +25443,15 @@ var BubbleMenuContent = ({
|
|
|
25449
25443
|
] });
|
|
25450
25444
|
};
|
|
25451
25445
|
var CustomBubbleMenu = ({ editor }) => {
|
|
25452
|
-
const [isVisible, setIsVisible] = (0,
|
|
25453
|
-
const [position, setPosition] = (0,
|
|
25454
|
-
const menuRef = (0,
|
|
25455
|
-
const keepOpenRef = (0,
|
|
25456
|
-
const setKeepOpen = (0,
|
|
25446
|
+
const [isVisible, setIsVisible] = (0, import_react57.useState)(false);
|
|
25447
|
+
const [position, setPosition] = (0, import_react57.useState)({ top: 0, left: 0 });
|
|
25448
|
+
const menuRef = (0, import_react57.useRef)(null);
|
|
25449
|
+
const keepOpenRef = (0, import_react57.useRef)(false);
|
|
25450
|
+
const setKeepOpen = (0, import_react57.useCallback)((next) => {
|
|
25457
25451
|
keepOpenRef.current = next;
|
|
25458
25452
|
if (next) setIsVisible(true);
|
|
25459
25453
|
}, []);
|
|
25460
|
-
(0,
|
|
25454
|
+
(0, import_react57.useEffect)(() => {
|
|
25461
25455
|
const updatePosition = () => {
|
|
25462
25456
|
const { state, view } = editor;
|
|
25463
25457
|
const { from, to, empty } = state.selection;
|
|
@@ -25510,9 +25504,9 @@ var CustomBubbleMenu = ({ editor }) => {
|
|
|
25510
25504
|
);
|
|
25511
25505
|
};
|
|
25512
25506
|
var CustomFloatingMenu = ({ editor }) => {
|
|
25513
|
-
const [isVisible, setIsVisible] = (0,
|
|
25514
|
-
const [position, setPosition] = (0,
|
|
25515
|
-
(0,
|
|
25507
|
+
const [isVisible, setIsVisible] = (0, import_react57.useState)(false);
|
|
25508
|
+
const [position, setPosition] = (0, import_react57.useState)({ top: 0, left: 0 });
|
|
25509
|
+
(0, import_react57.useEffect)(() => {
|
|
25516
25510
|
const updatePosition = () => {
|
|
25517
25511
|
const { state, view } = editor;
|
|
25518
25512
|
const { $from, empty } = state.selection;
|
|
@@ -25831,7 +25825,7 @@ async function prepareUEditorContentForSave({
|
|
|
25831
25825
|
|
|
25832
25826
|
// src/components/UEditor/UEditor.tsx
|
|
25833
25827
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
25834
|
-
var UEditor =
|
|
25828
|
+
var UEditor = import_react58.default.forwardRef(({
|
|
25835
25829
|
content = "",
|
|
25836
25830
|
onChange,
|
|
25837
25831
|
onHtmlChange,
|
|
@@ -25854,12 +25848,12 @@ var UEditor = import_react57.default.forwardRef(({
|
|
|
25854
25848
|
}, ref) => {
|
|
25855
25849
|
const t = useSmartTranslations("UEditor");
|
|
25856
25850
|
const effectivePlaceholder = placeholder ?? t("placeholder");
|
|
25857
|
-
const inFlightPrepareRef = (0,
|
|
25858
|
-
const extensions = (0,
|
|
25851
|
+
const inFlightPrepareRef = (0, import_react58.useRef)(null);
|
|
25852
|
+
const extensions = (0, import_react58.useMemo)(
|
|
25859
25853
|
() => buildUEditorExtensions({ placeholder: effectivePlaceholder, translate: t, maxCharacters, uploadImage, imageInsertMode, editable }),
|
|
25860
25854
|
[effectivePlaceholder, t, maxCharacters, uploadImage, imageInsertMode, editable]
|
|
25861
25855
|
);
|
|
25862
|
-
const editor = (0,
|
|
25856
|
+
const editor = (0, import_react59.useEditor)({
|
|
25863
25857
|
immediatelyRender: false,
|
|
25864
25858
|
extensions,
|
|
25865
25859
|
content,
|
|
@@ -25973,7 +25967,7 @@ var UEditor = import_react57.default.forwardRef(({
|
|
|
25973
25967
|
onJsonChange?.(editor2.getJSON());
|
|
25974
25968
|
}
|
|
25975
25969
|
});
|
|
25976
|
-
(0,
|
|
25970
|
+
(0, import_react58.useImperativeHandle)(
|
|
25977
25971
|
ref,
|
|
25978
25972
|
() => ({
|
|
25979
25973
|
prepareContentForSave: async ({ throwOnError = false } = {}) => {
|
|
@@ -25995,7 +25989,7 @@ var UEditor = import_react57.default.forwardRef(({
|
|
|
25995
25989
|
}),
|
|
25996
25990
|
[content, editor, uploadImageForSave]
|
|
25997
25991
|
);
|
|
25998
|
-
(0,
|
|
25992
|
+
(0, import_react58.useEffect)(() => {
|
|
25999
25993
|
if (editor && content !== editor.getHTML()) {
|
|
26000
25994
|
if (editor.isEmpty && content) {
|
|
26001
25995
|
editor.commands.setContent(content);
|
|
@@ -26028,7 +26022,7 @@ var UEditor = import_react57.default.forwardRef(({
|
|
|
26028
26022
|
editable && showBubbleMenu && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(CustomBubbleMenu, { editor }),
|
|
26029
26023
|
editable && showFloatingMenu && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(CustomFloatingMenu, { editor }),
|
|
26030
26024
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
26031
|
-
|
|
26025
|
+
import_react59.EditorContent,
|
|
26032
26026
|
{
|
|
26033
26027
|
editor,
|
|
26034
26028
|
className: "flex-1 overflow-y-auto",
|