@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.js
CHANGED
|
@@ -3478,7 +3478,7 @@ var ToastProvider = ({ children, position = "top-right", maxToasts = 5 }) => {
|
|
|
3478
3478
|
return updated.slice(0, maxToasts);
|
|
3479
3479
|
});
|
|
3480
3480
|
},
|
|
3481
|
-
[maxToasts
|
|
3481
|
+
[maxToasts]
|
|
3482
3482
|
);
|
|
3483
3483
|
const positionClasses = {
|
|
3484
3484
|
"top-right": "top-4 right-4",
|
|
@@ -3886,6 +3886,7 @@ import * as React15 from "react";
|
|
|
3886
3886
|
import { createPortal as createPortal3 } from "react-dom";
|
|
3887
3887
|
|
|
3888
3888
|
// src/utils/animations.ts
|
|
3889
|
+
import { useEffect as useEffect4 } from "react";
|
|
3889
3890
|
var shadcnAnimationStyles = `
|
|
3890
3891
|
/* ============================================
|
|
3891
3892
|
* DROPDOWN / POPOVER ANIMATIONS
|
|
@@ -4051,7 +4052,7 @@ var shadcnAnimationStyles = `
|
|
|
4051
4052
|
transition: backdrop-filter 200ms ease, background-color 200ms ease;
|
|
4052
4053
|
}
|
|
4053
4054
|
`;
|
|
4054
|
-
function
|
|
4055
|
+
function ensureAnimationStylesInjected() {
|
|
4055
4056
|
if (typeof document !== "undefined") {
|
|
4056
4057
|
const styleId = "shadcn-animations";
|
|
4057
4058
|
if (!document.getElementById(styleId)) {
|
|
@@ -4062,8 +4063,13 @@ function useShadCNAnimations() {
|
|
|
4062
4063
|
}
|
|
4063
4064
|
}
|
|
4064
4065
|
}
|
|
4066
|
+
function useShadCNAnimations() {
|
|
4067
|
+
useEffect4(() => {
|
|
4068
|
+
ensureAnimationStylesInjected();
|
|
4069
|
+
}, []);
|
|
4070
|
+
}
|
|
4065
4071
|
function injectAnimationStyles() {
|
|
4066
|
-
|
|
4072
|
+
ensureAnimationStylesInjected();
|
|
4067
4073
|
}
|
|
4068
4074
|
function getAnimationStyles() {
|
|
4069
4075
|
return shadcnAnimationStyles;
|
|
@@ -4476,7 +4482,8 @@ var Sheet = ({
|
|
|
4476
4482
|
closeOnOutsideClick = true,
|
|
4477
4483
|
closeOnEscape = true,
|
|
4478
4484
|
header,
|
|
4479
|
-
footer
|
|
4485
|
+
footer,
|
|
4486
|
+
overlayOpacity
|
|
4480
4487
|
}) => {
|
|
4481
4488
|
const [mounted, setMounted] = React16.useState(false);
|
|
4482
4489
|
const [isAnimating, setIsAnimating] = React16.useState(true);
|
|
@@ -4535,8 +4542,9 @@ var Sheet = ({
|
|
|
4535
4542
|
className: cn(
|
|
4536
4543
|
"fixed inset-0 transition-all duration-300 ease-out",
|
|
4537
4544
|
variant === "overlay" ? "bg-background/95 backdrop-blur-sm" : "bg-background/80 backdrop-blur-sm",
|
|
4538
|
-
open && !isAnimating ? "opacity-100" : "opacity-0"
|
|
4545
|
+
overlayOpacity === void 0 && (open && !isAnimating ? "opacity-100" : "opacity-0")
|
|
4539
4546
|
),
|
|
4547
|
+
style: overlayOpacity !== void 0 ? { opacity: open && !isAnimating ? overlayOpacity : 0 } : void 0,
|
|
4540
4548
|
onClick: handleOverlayClick
|
|
4541
4549
|
}
|
|
4542
4550
|
),
|
|
@@ -4691,7 +4699,7 @@ var Alert = ({ title, description, variant = "default", className, icon, dismiss
|
|
|
4691
4699
|
var Alert_default = Alert;
|
|
4692
4700
|
|
|
4693
4701
|
// src/components/GlobalLoading.tsx
|
|
4694
|
-
import React17, { useEffect as
|
|
4702
|
+
import React17, { useEffect as useEffect7, useState as useState12 } from "react";
|
|
4695
4703
|
import { Activity as Activity2 } from "lucide-react";
|
|
4696
4704
|
|
|
4697
4705
|
// src/utils/loading.ts
|
|
@@ -4739,7 +4747,7 @@ var loading = new LoadingManager();
|
|
|
4739
4747
|
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4740
4748
|
var GlobalLoading = ({ className, backdrop = true, position = "fixed", size = "lg" }) => {
|
|
4741
4749
|
const [state, setState] = useState12(() => loading.getState());
|
|
4742
|
-
|
|
4750
|
+
useEffect7(() => {
|
|
4743
4751
|
const unsubscribe = loading.subscribe(setState);
|
|
4744
4752
|
return unsubscribe;
|
|
4745
4753
|
}, []);
|
|
@@ -5363,7 +5371,7 @@ import { useId as useId3 } from "react";
|
|
|
5363
5371
|
import { ChevronDown, Search as Search3, SearchX, Check as Check3, X as X8 } from "lucide-react";
|
|
5364
5372
|
|
|
5365
5373
|
// src/components/OverlayScrollbarProvider.tsx
|
|
5366
|
-
import { createContext as createContext4, useContext as useContext4, useEffect as
|
|
5374
|
+
import { createContext as createContext4, useContext as useContext4, useEffect as useEffect10, useMemo as useMemo4 } from "react";
|
|
5367
5375
|
import { OverlayScrollbars } from "overlayscrollbars";
|
|
5368
5376
|
|
|
5369
5377
|
// src/utils/overlay-scrollbar-controller.ts
|
|
@@ -5565,26 +5573,9 @@ function useOverlayScrollbarTarget(targetRef, options = {}) {
|
|
|
5565
5573
|
...inherited,
|
|
5566
5574
|
...options
|
|
5567
5575
|
}),
|
|
5568
|
-
[
|
|
5569
|
-
inherited.enabled,
|
|
5570
|
-
inherited.theme,
|
|
5571
|
-
inherited.visibility,
|
|
5572
|
-
inherited.autoHide,
|
|
5573
|
-
inherited.autoHideDelay,
|
|
5574
|
-
inherited.dragScroll,
|
|
5575
|
-
inherited.clickScroll,
|
|
5576
|
-
inherited.exclude,
|
|
5577
|
-
options.enabled,
|
|
5578
|
-
options.theme,
|
|
5579
|
-
options.visibility,
|
|
5580
|
-
options.autoHide,
|
|
5581
|
-
options.autoHideDelay,
|
|
5582
|
-
options.dragScroll,
|
|
5583
|
-
options.clickScroll,
|
|
5584
|
-
options.exclude
|
|
5585
|
-
]
|
|
5576
|
+
[inherited, options]
|
|
5586
5577
|
);
|
|
5587
|
-
|
|
5578
|
+
useEffect10(() => {
|
|
5588
5579
|
if (typeof window === "undefined") return;
|
|
5589
5580
|
const target = targetRef.current;
|
|
5590
5581
|
if (!target) return;
|
|
@@ -5598,17 +5589,7 @@ function useOverlayScrollbarTarget(targetRef, options = {}) {
|
|
|
5598
5589
|
return () => {
|
|
5599
5590
|
controller.destroy();
|
|
5600
5591
|
};
|
|
5601
|
-
}, [
|
|
5602
|
-
targetRef,
|
|
5603
|
-
resolved.enabled,
|
|
5604
|
-
resolved.theme,
|
|
5605
|
-
resolved.visibility,
|
|
5606
|
-
resolved.autoHide,
|
|
5607
|
-
resolved.autoHideDelay,
|
|
5608
|
-
resolved.dragScroll,
|
|
5609
|
-
resolved.clickScroll,
|
|
5610
|
-
resolved.exclude
|
|
5611
|
-
]);
|
|
5592
|
+
}, [targetRef, resolved]);
|
|
5612
5593
|
}
|
|
5613
5594
|
var OverlayScrollbarProvider_default = OverlayScrollbarProvider;
|
|
5614
5595
|
|
|
@@ -11679,6 +11660,7 @@ function useSlotMetrics(args) {
|
|
|
11679
11660
|
}, [
|
|
11680
11661
|
activeView,
|
|
11681
11662
|
adaptiveSlotWidths,
|
|
11663
|
+
bodyClientWidth,
|
|
11682
11664
|
dayHeaderMarks,
|
|
11683
11665
|
dayHeaderSmart,
|
|
11684
11666
|
daySlotCompression,
|
|
@@ -11791,6 +11773,7 @@ function CalendarTimeline({
|
|
|
11791
11773
|
size = "md",
|
|
11792
11774
|
enableEventSheet,
|
|
11793
11775
|
eventSheetSize = "md",
|
|
11776
|
+
eventSheetOverlayOpacity,
|
|
11794
11777
|
renderEventSheet,
|
|
11795
11778
|
selectedEventId,
|
|
11796
11779
|
defaultSelectedEventId,
|
|
@@ -12064,7 +12047,7 @@ function CalendarTimeline({
|
|
|
12064
12047
|
});
|
|
12065
12048
|
React36.useEffect(() => {
|
|
12066
12049
|
onRangeChange?.(range);
|
|
12067
|
-
}, [range
|
|
12050
|
+
}, [range, onRangeChange]);
|
|
12068
12051
|
const leftRef = React36.useRef(null);
|
|
12069
12052
|
const bodyRef = React36.useRef(null);
|
|
12070
12053
|
const headerRef = React36.useRef(null);
|
|
@@ -12376,7 +12359,7 @@ function CalendarTimeline({
|
|
|
12376
12359
|
}
|
|
12377
12360
|
return dayFmt.format(d);
|
|
12378
12361
|
};
|
|
12379
|
-
}, [activeView, dueDateSprint, l.sprint, resolvedLocale, resolvedTimeZone, slotStarts
|
|
12362
|
+
}, [activeView, dueDateSprint, l.sprint, resolvedLocale, resolvedTimeZone, slotStarts]);
|
|
12380
12363
|
const openCreate = React36.useCallback(() => {
|
|
12381
12364
|
if (!canCreate) return;
|
|
12382
12365
|
if (activeEventSheetOpen) setEventSheetOpen(false);
|
|
@@ -12539,7 +12522,7 @@ function CalendarTimeline({
|
|
|
12539
12522
|
return;
|
|
12540
12523
|
}
|
|
12541
12524
|
},
|
|
12542
|
-
[getPointerContext, range.end, range.start, slotToDate, slots.length]
|
|
12525
|
+
[getPointerContext, range.end, range.start, setPreview, slotToDate, slots.length]
|
|
12543
12526
|
);
|
|
12544
12527
|
const flushDragPreview = React36.useCallback(() => {
|
|
12545
12528
|
dragPreviewRafRef.current = null;
|
|
@@ -13207,6 +13190,7 @@ function CalendarTimeline({
|
|
|
13207
13190
|
onOpenChange: setEventSheetOpen,
|
|
13208
13191
|
side: "right",
|
|
13209
13192
|
size: eventSheetSize,
|
|
13193
|
+
overlayOpacity: eventSheetOverlayOpacity,
|
|
13210
13194
|
title: selectedEvent.title ?? "Event",
|
|
13211
13195
|
description: selectedTimeText || void 0,
|
|
13212
13196
|
children: renderEventSheet ? renderEventSheet({
|
|
@@ -14092,7 +14076,10 @@ var Slider = React39.forwardRef(
|
|
|
14092
14076
|
const currentRange = isRangeControlled ? rangeValue : internalRange;
|
|
14093
14077
|
const rangeMin = clamp6(currentRange[0] ?? min, min, max);
|
|
14094
14078
|
const rangeMax = clamp6(currentRange[1] ?? max, min, max);
|
|
14095
|
-
const normalizedRange =
|
|
14079
|
+
const normalizedRange = React39.useMemo(
|
|
14080
|
+
() => rangeMin <= rangeMax ? [rangeMin, rangeMax] : [rangeMax, rangeMin],
|
|
14081
|
+
[rangeMax, rangeMin]
|
|
14082
|
+
);
|
|
14096
14083
|
const handleSingleChange = React39.useCallback(
|
|
14097
14084
|
(e) => {
|
|
14098
14085
|
const newValue = Number(e.target.value);
|
|
@@ -14480,21 +14467,21 @@ function OverlayControls({
|
|
|
14480
14467
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
14481
14468
|
};
|
|
14482
14469
|
}, [autoHide, autoHideDelay, showOnHover]);
|
|
14483
|
-
const showFeedback = (type, value2) => {
|
|
14470
|
+
const showFeedback = React40.useCallback((type, value2) => {
|
|
14484
14471
|
if (feedbackTimerRef.current) clearTimeout(feedbackTimerRef.current);
|
|
14485
14472
|
setKeyboardFeedback({ type, value: value2 });
|
|
14486
14473
|
feedbackTimerRef.current = setTimeout(() => {
|
|
14487
14474
|
setKeyboardFeedback(null);
|
|
14488
14475
|
}, 800);
|
|
14489
|
-
};
|
|
14490
|
-
const accumulateSeek = (seconds) => {
|
|
14476
|
+
}, []);
|
|
14477
|
+
const accumulateSeek = React40.useCallback((seconds) => {
|
|
14491
14478
|
if (seekAccumulatorTimerRef.current) clearTimeout(seekAccumulatorTimerRef.current);
|
|
14492
14479
|
seekAccumulatorRef.current += seconds;
|
|
14493
14480
|
showFeedback("seek", seekAccumulatorRef.current);
|
|
14494
14481
|
seekAccumulatorTimerRef.current = setTimeout(() => {
|
|
14495
14482
|
seekAccumulatorRef.current = 0;
|
|
14496
14483
|
}, 1e3);
|
|
14497
|
-
};
|
|
14484
|
+
}, [showFeedback]);
|
|
14498
14485
|
React40.useEffect(() => {
|
|
14499
14486
|
if (!enableKeyboardShortcuts) return;
|
|
14500
14487
|
const handleKeyDown = (e) => {
|
|
@@ -14593,6 +14580,7 @@ function OverlayControls({
|
|
|
14593
14580
|
onSkip,
|
|
14594
14581
|
skipSeconds,
|
|
14595
14582
|
onChange,
|
|
14583
|
+
onCommit,
|
|
14596
14584
|
value,
|
|
14597
14585
|
max,
|
|
14598
14586
|
onVolumeChange,
|
|
@@ -14600,7 +14588,9 @@ function OverlayControls({
|
|
|
14600
14588
|
onToggleFullscreen,
|
|
14601
14589
|
onToggleMute,
|
|
14602
14590
|
playing,
|
|
14603
|
-
muted
|
|
14591
|
+
muted,
|
|
14592
|
+
accumulateSeek,
|
|
14593
|
+
showFeedback
|
|
14604
14594
|
]);
|
|
14605
14595
|
const formatTime3 = (sec) => {
|
|
14606
14596
|
if (!isFinite(sec) || sec < 0) return "0:00";
|
|
@@ -14830,7 +14820,7 @@ function OverlayControls({
|
|
|
14830
14820
|
}
|
|
14831
14821
|
|
|
14832
14822
|
// src/components/CategoryTreeSelect.tsx
|
|
14833
|
-
import { useEffect as
|
|
14823
|
+
import { useEffect as useEffect23, useId as useId7, useMemo as useMemo17, useRef as useRef17, useState as useState29 } from "react";
|
|
14834
14824
|
import { ChevronRight as ChevronRight6, ChevronDown as ChevronDown5, FolderTree, Layers, Search as Search5, SearchX as SearchX3, X as X13 } from "lucide-react";
|
|
14835
14825
|
import { jsx as jsx46, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
14836
14826
|
var defaultLabels = {
|
|
@@ -14876,7 +14866,10 @@ function CategoryTreeSelect(props) {
|
|
|
14876
14866
|
const errorId = error ? `${resolvedId}-error` : void 0;
|
|
14877
14867
|
const describedBy = errorId || helperId;
|
|
14878
14868
|
const mergedLabels = { ...defaultLabels, ...labels };
|
|
14879
|
-
const valueArray =
|
|
14869
|
+
const valueArray = useMemo17(
|
|
14870
|
+
() => singleSelect ? props.value != null ? [props.value] : [] : props.value ?? [],
|
|
14871
|
+
[props.value, singleSelect]
|
|
14872
|
+
);
|
|
14880
14873
|
const selectedIds = useMemo17(() => new Set(valueArray), [valueArray]);
|
|
14881
14874
|
const { parentCategories, childrenMap, byId } = useMemo17(() => {
|
|
14882
14875
|
const byId2 = /* @__PURE__ */ new Map();
|
|
@@ -14935,21 +14928,21 @@ function CategoryTreeSelect(props) {
|
|
|
14935
14928
|
}
|
|
14936
14929
|
return visible;
|
|
14937
14930
|
}, [byId, categories, childrenMap, isSearchMode, normalizedQuery]);
|
|
14938
|
-
|
|
14931
|
+
useEffect23(() => {
|
|
14939
14932
|
if (!isOpen) setQuery("");
|
|
14940
14933
|
}, [isOpen]);
|
|
14941
|
-
|
|
14934
|
+
useEffect23(() => {
|
|
14942
14935
|
if (!isOpen) return;
|
|
14943
14936
|
if (!isSearchEnabled) return;
|
|
14944
14937
|
const t = setTimeout(() => searchInputRef.current?.focus(), 50);
|
|
14945
14938
|
return () => clearTimeout(t);
|
|
14946
14939
|
}, [isOpen, isSearchEnabled]);
|
|
14947
|
-
|
|
14940
|
+
useEffect23(() => {
|
|
14948
14941
|
if ((viewOnly || inline) && defaultExpanded) {
|
|
14949
14942
|
const allParentIds = categories.filter((c) => childrenMap.has(c.id)).map((c) => c.id);
|
|
14950
14943
|
setExpandedNodes(new Set(allParentIds));
|
|
14951
14944
|
}
|
|
14952
|
-
}, [viewOnly, inline, defaultExpanded, categories]);
|
|
14945
|
+
}, [viewOnly, inline, defaultExpanded, categories, childrenMap]);
|
|
14953
14946
|
const toggleExpand = (id2) => {
|
|
14954
14947
|
if (isSearchMode) return;
|
|
14955
14948
|
const newExpanded = new Set(expandedNodes);
|
|
@@ -15281,6 +15274,7 @@ function CategoryTreeSelect(props) {
|
|
|
15281
15274
|
disabled,
|
|
15282
15275
|
role: "combobox",
|
|
15283
15276
|
"aria-haspopup": "tree",
|
|
15277
|
+
"aria-expanded": isOpen,
|
|
15284
15278
|
"aria-controls": `${resolvedId}-tree`,
|
|
15285
15279
|
"aria-labelledby": labelId,
|
|
15286
15280
|
"aria-describedby": describedBy,
|
|
@@ -15894,10 +15888,7 @@ function FileUpload({
|
|
|
15894
15888
|
"bg-linear-to-br from-muted/50 to-muted",
|
|
15895
15889
|
currentSize.fileIconSize
|
|
15896
15890
|
),
|
|
15897
|
-
children: isImage && allowPreview ? (
|
|
15898
|
-
// eslint-disable-next-line @next/next/no-img-element
|
|
15899
|
-
/* @__PURE__ */ jsx48("img", { src: file.url, alt: file.name, className: "w-full h-full object-cover" })
|
|
15900
|
-
) : /* @__PURE__ */ jsx48(IconComponent, { className: cn("w-1/2 h-1/2", iconColor) })
|
|
15891
|
+
children: isImage && allowPreview ? /* @__PURE__ */ jsx48("img", { src: file.url, alt: file.name, className: "w-full h-full object-cover" }) : /* @__PURE__ */ jsx48(IconComponent, { className: cn("w-1/2 h-1/2", iconColor) })
|
|
15901
15892
|
}
|
|
15902
15893
|
),
|
|
15903
15894
|
/* @__PURE__ */ jsxs40("div", { className: "flex-1 min-w-0", children: [
|
|
@@ -16489,10 +16480,14 @@ function FallingIcons({
|
|
|
16489
16480
|
};
|
|
16490
16481
|
}, [glow, glowColor, glowIntensity]);
|
|
16491
16482
|
const FallbackIcon = React43.useMemo(
|
|
16492
|
-
() => (props)
|
|
16483
|
+
() => function FallingIconsFallbackIcon(props) {
|
|
16484
|
+
return /* @__PURE__ */ jsx50("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", ...props, children: /* @__PURE__ */ jsx50("circle", { cx: "12", cy: "12", r: "10" }) });
|
|
16485
|
+
},
|
|
16493
16486
|
[]
|
|
16494
16487
|
);
|
|
16495
|
-
const TheIcon = imageUrl ? ({ className: imgClassName })
|
|
16488
|
+
const TheIcon = imageUrl ? function FallingIconsImage({ className: imgClassName }) {
|
|
16489
|
+
return /* @__PURE__ */ jsx50("img", { src: imageUrl, alt: "", className: cn("w-full h-full object-cover rounded-lg", imgClassName), draggable: false });
|
|
16490
|
+
} : Icon || FallbackIcon;
|
|
16496
16491
|
return /* @__PURE__ */ jsxs42(
|
|
16497
16492
|
"div",
|
|
16498
16493
|
{
|
|
@@ -17953,7 +17948,7 @@ function ColorPicker({
|
|
|
17953
17948
|
}
|
|
17954
17949
|
|
|
17955
17950
|
// src/components/MusicPlayer.tsx
|
|
17956
|
-
import { useState as useState37, useRef as useRef21, useEffect as
|
|
17951
|
+
import { useState as useState37, useRef as useRef21, useEffect as useEffect27 } from "react";
|
|
17957
17952
|
import { Play as Play2, Pause as Pause2, SkipForward, SkipBack, Volume2 as Volume22, VolumeX as VolumeX2, List as List2, X as X16 } from "lucide-react";
|
|
17958
17953
|
import { jsx as jsx55, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
17959
17954
|
var DEFAULT_PLAYLIST = [
|
|
@@ -18083,12 +18078,12 @@ var MusicPlayer = ({
|
|
|
18083
18078
|
const [showPlaylist, setShowPlaylist] = useState37(initialShowPlaylist);
|
|
18084
18079
|
const audioRef = useRef21(null);
|
|
18085
18080
|
const currentSong = playlist[currentSongIndex];
|
|
18086
|
-
|
|
18081
|
+
useEffect27(() => {
|
|
18087
18082
|
if (audioRef.current) {
|
|
18088
18083
|
audioRef.current.volume = volume;
|
|
18089
18084
|
}
|
|
18090
18085
|
}, [volume]);
|
|
18091
|
-
|
|
18086
|
+
useEffect27(() => {
|
|
18092
18087
|
if (autoPlay && audioRef.current) {
|
|
18093
18088
|
audioRef.current.play().catch(() => {
|
|
18094
18089
|
setIsPlaying(false);
|
|
@@ -18164,7 +18159,7 @@ var MusicPlayer = ({
|
|
|
18164
18159
|
setCurrentSongIndex(index);
|
|
18165
18160
|
setIsPlaying(true);
|
|
18166
18161
|
};
|
|
18167
|
-
|
|
18162
|
+
useEffect27(() => {
|
|
18168
18163
|
if (audioRef.current) {
|
|
18169
18164
|
if (currentSong.startTime !== void 0) {
|
|
18170
18165
|
audioRef.current.currentTime = currentSong.startTime;
|
|
@@ -18497,7 +18492,7 @@ var Grid_default = Grid;
|
|
|
18497
18492
|
import { useMemo as useMemo19, useState as useState39, useRef as useRef23, useCallback as useCallback16 } from "react";
|
|
18498
18493
|
|
|
18499
18494
|
// src/components/ChartTooltip.tsx
|
|
18500
|
-
import { useEffect as
|
|
18495
|
+
import { useEffect as useEffect28, useState as useState38, useRef as useRef22 } from "react";
|
|
18501
18496
|
import { createPortal as createPortal6 } from "react-dom";
|
|
18502
18497
|
import { Fragment as Fragment21, jsx as jsx57, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
18503
18498
|
function ChartTooltip({
|
|
@@ -18516,10 +18511,10 @@ function ChartTooltip({
|
|
|
18516
18511
|
const [isMounted, setIsMounted] = useState38(false);
|
|
18517
18512
|
const [position, setPosition] = useState38(null);
|
|
18518
18513
|
const tooltipRef = useRef22(null);
|
|
18519
|
-
|
|
18514
|
+
useEffect28(() => {
|
|
18520
18515
|
setIsMounted(true);
|
|
18521
18516
|
}, []);
|
|
18522
|
-
|
|
18517
|
+
useEffect28(() => {
|
|
18523
18518
|
if (visible && containerRef?.current) {
|
|
18524
18519
|
const rect = containerRef.current.getBoundingClientRect();
|
|
18525
18520
|
const tw = tooltipRef.current?.offsetWidth ?? 160;
|
|
@@ -18596,6 +18591,7 @@ function ChartTooltip({
|
|
|
18596
18591
|
}
|
|
18597
18592
|
|
|
18598
18593
|
// src/utils/chart-utils.ts
|
|
18594
|
+
import * as React51 from "react";
|
|
18599
18595
|
function getCatmullRomSpline(points, tension = 0.5) {
|
|
18600
18596
|
if (points.length < 2) return "";
|
|
18601
18597
|
if (points.length === 2) {
|
|
@@ -18919,7 +18915,10 @@ function BarChart({
|
|
|
18919
18915
|
className = ""
|
|
18920
18916
|
}) {
|
|
18921
18917
|
const svgRef = useRef24(null);
|
|
18922
|
-
const padding =
|
|
18918
|
+
const padding = useMemo20(
|
|
18919
|
+
() => horizontal ? { top: 20, right: 40, bottom: 20, left: 80 } : { top: 20, right: 20, bottom: 40, left: 40 },
|
|
18920
|
+
[horizontal]
|
|
18921
|
+
);
|
|
18923
18922
|
const chartWidth = width - padding.left - padding.right;
|
|
18924
18923
|
const chartHeight = height - padding.top - padding.bottom;
|
|
18925
18924
|
const [hoveredBar, setHoveredBar] = useState40(null);
|
|
@@ -19373,7 +19372,7 @@ function AreaChart({
|
|
|
19373
19372
|
}) {
|
|
19374
19373
|
const containerRef = useRef26(null);
|
|
19375
19374
|
const clipId = useRef26(`area-clip-${Math.random().toString(36).slice(2, 8)}`).current;
|
|
19376
|
-
const padding = { top: 20, right: 20, bottom: 40, left: 50 };
|
|
19375
|
+
const padding = useMemo22(() => ({ top: 20, right: 20, bottom: 40, left: 50 }), []);
|
|
19377
19376
|
const chartWidth = width - padding.left - padding.right;
|
|
19378
19377
|
const chartHeight = height - padding.top - padding.bottom;
|
|
19379
19378
|
const [hoveredPoint, setHoveredPoint] = useState42(null);
|
|
@@ -20142,11 +20141,11 @@ function GaugeChart({
|
|
|
20142
20141
|
}
|
|
20143
20142
|
|
|
20144
20143
|
// src/components/ClientOnly.tsx
|
|
20145
|
-
import { useEffect as
|
|
20144
|
+
import { useEffect as useEffect29, useState as useState44 } from "react";
|
|
20146
20145
|
import { Fragment as Fragment24, jsx as jsx65 } from "react/jsx-runtime";
|
|
20147
20146
|
function ClientOnly({ children, fallback = null }) {
|
|
20148
20147
|
const [hasMounted, setHasMounted] = useState44(false);
|
|
20149
|
-
|
|
20148
|
+
useEffect29(() => {
|
|
20150
20149
|
setHasMounted(true);
|
|
20151
20150
|
}, []);
|
|
20152
20151
|
if (!hasMounted) {
|
|
@@ -20242,7 +20241,7 @@ var LoadingBar = ({
|
|
|
20242
20241
|
};
|
|
20243
20242
|
|
|
20244
20243
|
// src/components/Table.tsx
|
|
20245
|
-
import
|
|
20244
|
+
import React59 from "react";
|
|
20246
20245
|
import { jsx as jsx67, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
20247
20246
|
var TABLE_BASE_CLASS = "w-full caption-bottom text-sm";
|
|
20248
20247
|
var TABLE_CONTAINER_BASE_CLASS = [
|
|
@@ -20260,8 +20259,8 @@ function assignRef3(ref, value) {
|
|
|
20260
20259
|
ref.current = value;
|
|
20261
20260
|
}
|
|
20262
20261
|
}
|
|
20263
|
-
var TableContainer =
|
|
20264
|
-
const containerRef =
|
|
20262
|
+
var TableContainer = React59.forwardRef(({ className, useOverlayScrollbar = false, ...props }, ref) => {
|
|
20263
|
+
const containerRef = React59.useRef(null);
|
|
20265
20264
|
useOverlayScrollbarTarget(containerRef, { enabled: useOverlayScrollbar });
|
|
20266
20265
|
return /* @__PURE__ */ jsx67(
|
|
20267
20266
|
"div",
|
|
@@ -20276,7 +20275,7 @@ var TableContainer = React58.forwardRef(({ className, useOverlayScrollbar = fals
|
|
|
20276
20275
|
);
|
|
20277
20276
|
});
|
|
20278
20277
|
TableContainer.displayName = "TableContainer";
|
|
20279
|
-
var Table =
|
|
20278
|
+
var Table = React59.forwardRef(
|
|
20280
20279
|
({ className, containerClassName, disableContainer = false, useOverlayScrollbar = false, ...props }, ref) => {
|
|
20281
20280
|
if (disableContainer) {
|
|
20282
20281
|
return /* @__PURE__ */ jsx67("table", { ref, className: cn(TABLE_BASE_CLASS, className), ...props });
|
|
@@ -20285,16 +20284,16 @@ var Table = React58.forwardRef(
|
|
|
20285
20284
|
}
|
|
20286
20285
|
);
|
|
20287
20286
|
Table.displayName = "Table";
|
|
20288
|
-
var TableHeader =
|
|
20287
|
+
var TableHeader = React59.forwardRef(({ className, children, filterRow, ...props }, ref) => /* @__PURE__ */ jsxs58("thead", { ref, className: cn("[&_tr]:border-b [&_tr]:border-border", "bg-muted", className), ...props, children: [
|
|
20289
20288
|
children,
|
|
20290
20289
|
filterRow
|
|
20291
20290
|
] }));
|
|
20292
20291
|
TableHeader.displayName = "TableHeader";
|
|
20293
|
-
var TableBody =
|
|
20292
|
+
var TableBody = React59.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx67("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props }));
|
|
20294
20293
|
TableBody.displayName = "TableBody";
|
|
20295
|
-
var TableFooter =
|
|
20294
|
+
var TableFooter = React59.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx67("tfoot", { ref, className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className), ...props }));
|
|
20296
20295
|
TableFooter.displayName = "TableFooter";
|
|
20297
|
-
var TableRow =
|
|
20296
|
+
var TableRow = React59.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx67(
|
|
20298
20297
|
"tr",
|
|
20299
20298
|
{
|
|
20300
20299
|
ref,
|
|
@@ -20308,7 +20307,7 @@ var TableRow = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
20308
20307
|
}
|
|
20309
20308
|
));
|
|
20310
20309
|
TableRow.displayName = "TableRow";
|
|
20311
|
-
var TableHead =
|
|
20310
|
+
var TableHead = React59.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx67(
|
|
20312
20311
|
"th",
|
|
20313
20312
|
{
|
|
20314
20313
|
ref,
|
|
@@ -20317,13 +20316,13 @@ var TableHead = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
20317
20316
|
}
|
|
20318
20317
|
));
|
|
20319
20318
|
TableHead.displayName = "TableHead";
|
|
20320
|
-
var TableCell =
|
|
20319
|
+
var TableCell = React59.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx67("td", { ref, className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className), ...props }));
|
|
20321
20320
|
TableCell.displayName = "TableCell";
|
|
20322
|
-
var TableCaption =
|
|
20321
|
+
var TableCaption = React59.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx67("caption", { ref, className: cn("mt-4 text-sm text-muted-foreground", className), ...props }));
|
|
20323
20322
|
TableCaption.displayName = "TableCaption";
|
|
20324
20323
|
|
|
20325
20324
|
// src/components/DataTable/DataTable.tsx
|
|
20326
|
-
import
|
|
20325
|
+
import React68 from "react";
|
|
20327
20326
|
|
|
20328
20327
|
// src/components/DataTable/components/DataTableBody.tsx
|
|
20329
20328
|
import { jsx as jsx68, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
@@ -20395,7 +20394,7 @@ function DataTableBodyRows({
|
|
|
20395
20394
|
}
|
|
20396
20395
|
|
|
20397
20396
|
// src/components/DataTable/components/DataTableHeader.tsx
|
|
20398
|
-
import
|
|
20397
|
+
import React60 from "react";
|
|
20399
20398
|
import { Filter as FilterIcon } from "lucide-react";
|
|
20400
20399
|
import { Fragment as Fragment25, jsx as jsx69, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
20401
20400
|
function DataTableHeader({
|
|
@@ -20415,7 +20414,7 @@ function DataTableHeader({
|
|
|
20415
20414
|
getStickyHeaderCellStyle,
|
|
20416
20415
|
t
|
|
20417
20416
|
}) {
|
|
20418
|
-
const renderFilterControl =
|
|
20417
|
+
const renderFilterControl = React60.useCallback(
|
|
20419
20418
|
(col) => {
|
|
20420
20419
|
if (!col.filter) return null;
|
|
20421
20420
|
const key = col.key;
|
|
@@ -20468,7 +20467,7 @@ function DataTableHeader({
|
|
|
20468
20467
|
},
|
|
20469
20468
|
[filters, setCurPage, setFilters, size]
|
|
20470
20469
|
);
|
|
20471
|
-
const renderHeaderContent =
|
|
20470
|
+
const renderHeaderContent = React60.useCallback(
|
|
20472
20471
|
(col, isLeaf) => {
|
|
20473
20472
|
if (!isLeaf) {
|
|
20474
20473
|
return /* @__PURE__ */ jsx69(
|
|
@@ -20631,7 +20630,7 @@ function DataTableHeader({
|
|
|
20631
20630
|
}
|
|
20632
20631
|
|
|
20633
20632
|
// src/components/DataTable/components/Pagination.tsx
|
|
20634
|
-
import
|
|
20633
|
+
import React61 from "react";
|
|
20635
20634
|
import { jsx as jsx70, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
20636
20635
|
function DataTablePagination({
|
|
20637
20636
|
totalItems,
|
|
@@ -20643,14 +20642,7 @@ function DataTablePagination({
|
|
|
20643
20642
|
size
|
|
20644
20643
|
}) {
|
|
20645
20644
|
const totalPages = Math.ceil(totalItems / curPageSize);
|
|
20646
|
-
|
|
20647
|
-
const controlButtonSize = size === "lg" ? "md" : "sm";
|
|
20648
|
-
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";
|
|
20649
|
-
const navIconClass = size === "sm" ? "h-3.5 w-3.5" : size === "lg" ? "h-5 w-5" : "h-4 w-4";
|
|
20650
|
-
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";
|
|
20651
|
-
const containerTextClass = size === "sm" ? "text-[11px]" : size === "lg" ? "text-sm" : "text-xs";
|
|
20652
|
-
const pageSizeClass = size === "sm" ? "w-16" : size === "lg" ? "w-24" : "w-20";
|
|
20653
|
-
const pages = React60.useMemo(() => {
|
|
20645
|
+
const pages = React61.useMemo(() => {
|
|
20654
20646
|
const result = [];
|
|
20655
20647
|
if (totalPages <= 5) {
|
|
20656
20648
|
for (let i = 1; i <= totalPages; i++) result.push(i);
|
|
@@ -20665,6 +20657,13 @@ function DataTablePagination({
|
|
|
20665
20657
|
result.push(totalPages);
|
|
20666
20658
|
return result;
|
|
20667
20659
|
}, [curPage, totalPages]);
|
|
20660
|
+
if (!(totalItems > 0 && totalPages > 1)) return null;
|
|
20661
|
+
const controlButtonSize = size === "lg" ? "md" : "sm";
|
|
20662
|
+
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";
|
|
20663
|
+
const navIconClass = size === "sm" ? "h-3.5 w-3.5" : size === "lg" ? "h-5 w-5" : "h-4 w-4";
|
|
20664
|
+
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";
|
|
20665
|
+
const containerTextClass = size === "sm" ? "text-[11px]" : size === "lg" ? "text-sm" : "text-xs";
|
|
20666
|
+
const pageSizeClass = size === "sm" ? "w-16" : size === "lg" ? "w-24" : "w-20";
|
|
20668
20667
|
return /* @__PURE__ */ jsxs61("div", { className: cn("flex items-center justify-between gap-2 px-1 pt-3 text-muted-foreground", containerTextClass), children: [
|
|
20669
20668
|
/* @__PURE__ */ jsxs61("div", { className: "tabular-nums", children: [
|
|
20670
20669
|
(curPage - 1) * curPageSize + 1,
|
|
@@ -20725,7 +20724,7 @@ function DataTablePagination({
|
|
|
20725
20724
|
}
|
|
20726
20725
|
|
|
20727
20726
|
// src/components/DataTable/components/Toolbar.tsx
|
|
20728
|
-
import
|
|
20727
|
+
import React62 from "react";
|
|
20729
20728
|
|
|
20730
20729
|
// src/components/DataTable/utils/headers.ts
|
|
20731
20730
|
function isLeafColumn(col) {
|
|
@@ -20846,7 +20845,7 @@ function DataTableToolbar({
|
|
|
20846
20845
|
const controlButtonClass = size === "sm" ? "h-7 px-2 text-xs" : size === "lg" ? "h-9 px-3 text-sm" : "h-8 px-2";
|
|
20847
20846
|
const iconClass = size === "sm" ? "w-3.5 h-3.5 mr-1" : "w-4 h-4 mr-1";
|
|
20848
20847
|
const captionClass = size === "sm" ? "text-xs" : size === "lg" ? "text-sm" : "text-sm";
|
|
20849
|
-
const leafCols =
|
|
20848
|
+
const leafCols = React62.useMemo(() => getLeafColumns(columns), [columns]);
|
|
20850
20849
|
return /* @__PURE__ */ jsxs62("div", { className: "flex items-center justify-between gap-4 mb-1", children: [
|
|
20851
20850
|
/* @__PURE__ */ jsx71("div", { className: captionClass + " text-muted-foreground", children: caption }),
|
|
20852
20851
|
/* @__PURE__ */ jsxs62("div", { className: "flex items-center gap-2", children: [
|
|
@@ -20914,10 +20913,10 @@ function DataTableToolbar({
|
|
|
20914
20913
|
}
|
|
20915
20914
|
|
|
20916
20915
|
// src/components/DataTable/hooks/useDebounced.ts
|
|
20917
|
-
import
|
|
20916
|
+
import React63 from "react";
|
|
20918
20917
|
function useDebounced(value, delay = 300) {
|
|
20919
|
-
const [debounced, setDebounced] =
|
|
20920
|
-
|
|
20918
|
+
const [debounced, setDebounced] = React63.useState(value);
|
|
20919
|
+
React63.useEffect(() => {
|
|
20921
20920
|
const id = setTimeout(() => setDebounced(value), delay);
|
|
20922
20921
|
return () => clearTimeout(id);
|
|
20923
20922
|
}, [value, delay]);
|
|
@@ -20925,7 +20924,7 @@ function useDebounced(value, delay = 300) {
|
|
|
20925
20924
|
}
|
|
20926
20925
|
|
|
20927
20926
|
// src/components/DataTable/hooks/useDataTableModel.ts
|
|
20928
|
-
import
|
|
20927
|
+
import React64 from "react";
|
|
20929
20928
|
|
|
20930
20929
|
// src/components/DataTable/utils/columns.ts
|
|
20931
20930
|
function getColumnWidth(col, fallback = 150) {
|
|
@@ -20953,22 +20952,22 @@ function useDataTableModel({
|
|
|
20953
20952
|
isServerMode,
|
|
20954
20953
|
total
|
|
20955
20954
|
}) {
|
|
20956
|
-
const visibleColsSet =
|
|
20957
|
-
const allLeafColumns =
|
|
20958
|
-
const columnMap =
|
|
20955
|
+
const visibleColsSet = React64.useMemo(() => new Set(visibleCols), [visibleCols]);
|
|
20956
|
+
const allLeafColumns = React64.useMemo(() => getLeafColumns(columns), [columns]);
|
|
20957
|
+
const columnMap = React64.useMemo(() => {
|
|
20959
20958
|
return new Map(allLeafColumns.map((column) => [column.key, column]));
|
|
20960
20959
|
}, [allLeafColumns]);
|
|
20961
|
-
const visibleColumns =
|
|
20960
|
+
const visibleColumns = React64.useMemo(() => {
|
|
20962
20961
|
return filterVisibleColumns(columns, visibleColsSet);
|
|
20963
20962
|
}, [columns, visibleColsSet]);
|
|
20964
|
-
const leafColumns =
|
|
20963
|
+
const leafColumns = React64.useMemo(() => {
|
|
20965
20964
|
return getLeafColumnsWithFixedInheritance(visibleColumns);
|
|
20966
20965
|
}, [visibleColumns]);
|
|
20967
|
-
const headerRows =
|
|
20968
|
-
const totalColumnsWidth =
|
|
20966
|
+
const headerRows = React64.useMemo(() => buildHeaderRows(visibleColumns), [visibleColumns]);
|
|
20967
|
+
const totalColumnsWidth = React64.useMemo(() => {
|
|
20969
20968
|
return leafColumns.reduce((sum, column) => sum + getColumnWidth(column), 0);
|
|
20970
20969
|
}, [leafColumns]);
|
|
20971
|
-
const processedData =
|
|
20970
|
+
const processedData = React64.useMemo(() => {
|
|
20972
20971
|
if (isServerMode) return data;
|
|
20973
20972
|
let result = [...data];
|
|
20974
20973
|
if (Object.keys(filters).length > 0) {
|
|
@@ -21000,7 +20999,7 @@ function useDataTableModel({
|
|
|
21000
20999
|
return result;
|
|
21001
21000
|
}, [columnMap, data, filters, isServerMode, sort]);
|
|
21002
21001
|
const totalItems = isServerMode ? total : processedData.length;
|
|
21003
|
-
const displayedData =
|
|
21002
|
+
const displayedData = React64.useMemo(() => {
|
|
21004
21003
|
if (isServerMode) return data;
|
|
21005
21004
|
const start = (curPage - 1) * curPageSize;
|
|
21006
21005
|
return processedData.slice(start, start + curPageSize);
|
|
@@ -21016,13 +21015,13 @@ function useDataTableModel({
|
|
|
21016
21015
|
}
|
|
21017
21016
|
|
|
21018
21017
|
// src/components/DataTable/hooks/useDataTableState.ts
|
|
21019
|
-
import
|
|
21018
|
+
import React66 from "react";
|
|
21020
21019
|
|
|
21021
21020
|
// src/components/DataTable/hooks/usePageSizeStorage.ts
|
|
21022
|
-
import
|
|
21021
|
+
import React65 from "react";
|
|
21023
21022
|
function usePageSizeStorage({ pageSize, storageKey }) {
|
|
21024
|
-
const loadedFromStorage =
|
|
21025
|
-
const [curPageSize, setCurPageSize] =
|
|
21023
|
+
const loadedFromStorage = React65.useRef(false);
|
|
21024
|
+
const [curPageSize, setCurPageSize] = React65.useState(() => {
|
|
21026
21025
|
if (typeof window === "undefined" || !storageKey) return pageSize;
|
|
21027
21026
|
try {
|
|
21028
21027
|
const saved = localStorage.getItem(`datatable_${storageKey}_pageSize`);
|
|
@@ -21037,11 +21036,11 @@ function usePageSizeStorage({ pageSize, storageKey }) {
|
|
|
21037
21036
|
}
|
|
21038
21037
|
return pageSize;
|
|
21039
21038
|
});
|
|
21040
|
-
const hasMounted =
|
|
21041
|
-
|
|
21039
|
+
const hasMounted = React65.useRef(false);
|
|
21040
|
+
React65.useEffect(() => {
|
|
21042
21041
|
hasMounted.current = true;
|
|
21043
21042
|
}, []);
|
|
21044
|
-
|
|
21043
|
+
React65.useEffect(() => {
|
|
21045
21044
|
if (typeof window === "undefined" || !storageKey) return;
|
|
21046
21045
|
if (!hasMounted.current) return;
|
|
21047
21046
|
try {
|
|
@@ -21049,7 +21048,7 @@ function usePageSizeStorage({ pageSize, storageKey }) {
|
|
|
21049
21048
|
} catch {
|
|
21050
21049
|
}
|
|
21051
21050
|
}, [curPageSize, storageKey]);
|
|
21052
|
-
|
|
21051
|
+
React65.useEffect(() => {
|
|
21053
21052
|
if (storageKey && loadedFromStorage.current) return;
|
|
21054
21053
|
setCurPageSize(pageSize);
|
|
21055
21054
|
}, [pageSize, storageKey]);
|
|
@@ -21069,17 +21068,17 @@ function useDataTableState({
|
|
|
21069
21068
|
size,
|
|
21070
21069
|
storageKey
|
|
21071
21070
|
}) {
|
|
21072
|
-
const allLeafColumns =
|
|
21073
|
-
const defaultVisibleLeafKeys =
|
|
21074
|
-
const knownLeafKeysRef =
|
|
21075
|
-
const [headerAlign, setHeaderAlign] =
|
|
21076
|
-
const [visibleCols, setVisibleCols] =
|
|
21077
|
-
const [filters, setFilters] =
|
|
21078
|
-
const [sort, setSort] =
|
|
21079
|
-
const [density, setDensity] =
|
|
21080
|
-
const [curPage, setCurPage] =
|
|
21071
|
+
const allLeafColumns = React66.useMemo(() => getLeafColumns(columns), [columns]);
|
|
21072
|
+
const defaultVisibleLeafKeys = React66.useMemo(() => allLeafColumns.filter((column) => column.visible !== false).map((column) => column.key), [allLeafColumns]);
|
|
21073
|
+
const knownLeafKeysRef = React66.useRef(new Set(defaultVisibleLeafKeys));
|
|
21074
|
+
const [headerAlign, setHeaderAlign] = React66.useState("left");
|
|
21075
|
+
const [visibleCols, setVisibleCols] = React66.useState(defaultVisibleLeafKeys);
|
|
21076
|
+
const [filters, setFilters] = React66.useState({});
|
|
21077
|
+
const [sort, setSort] = React66.useState(null);
|
|
21078
|
+
const [density, setDensity] = React66.useState(() => SIZE_TO_DENSITY[size]);
|
|
21079
|
+
const [curPage, setCurPage] = React66.useState(page);
|
|
21081
21080
|
const { curPageSize, setCurPageSize } = usePageSizeStorage({ pageSize, storageKey });
|
|
21082
|
-
|
|
21081
|
+
React66.useEffect(() => {
|
|
21083
21082
|
const knownLeafKeys = knownLeafKeysRef.current;
|
|
21084
21083
|
setVisibleCols((prev) => {
|
|
21085
21084
|
const prevSet = new Set(prev);
|
|
@@ -21087,10 +21086,10 @@ function useDataTableState({
|
|
|
21087
21086
|
});
|
|
21088
21087
|
knownLeafKeysRef.current = new Set(allLeafColumns.map((column) => column.key));
|
|
21089
21088
|
}, [allLeafColumns]);
|
|
21090
|
-
|
|
21089
|
+
React66.useEffect(() => {
|
|
21091
21090
|
setCurPage(page);
|
|
21092
21091
|
}, [page]);
|
|
21093
|
-
|
|
21092
|
+
React66.useEffect(() => {
|
|
21094
21093
|
setDensity(SIZE_TO_DENSITY[size]);
|
|
21095
21094
|
}, [size]);
|
|
21096
21095
|
return {
|
|
@@ -21112,7 +21111,7 @@ function useDataTableState({
|
|
|
21112
21111
|
}
|
|
21113
21112
|
|
|
21114
21113
|
// src/components/DataTable/hooks/useStickyColumns.ts
|
|
21115
|
-
import
|
|
21114
|
+
import React67 from "react";
|
|
21116
21115
|
|
|
21117
21116
|
// src/components/DataTable/utils/sticky.ts
|
|
21118
21117
|
function buildStickyLayout(visibleColumns) {
|
|
@@ -21159,8 +21158,8 @@ function resolveGroupStickyPosition(column, positions) {
|
|
|
21159
21158
|
|
|
21160
21159
|
// src/components/DataTable/hooks/useStickyColumns.ts
|
|
21161
21160
|
function useStickyColumns(visibleColumns) {
|
|
21162
|
-
const { positions, leftBoundaryKey, rightBoundaryKey } =
|
|
21163
|
-
const getStickyColumnStyle =
|
|
21161
|
+
const { positions, leftBoundaryKey, rightBoundaryKey } = React67.useMemo(() => buildStickyLayout(visibleColumns), [visibleColumns]);
|
|
21162
|
+
const getStickyColumnStyle = React67.useCallback(
|
|
21164
21163
|
(col) => {
|
|
21165
21164
|
const pos = resolveStickyPosition(col, positions);
|
|
21166
21165
|
if (!pos) return {};
|
|
@@ -21171,7 +21170,7 @@ function useStickyColumns(visibleColumns) {
|
|
|
21171
21170
|
},
|
|
21172
21171
|
[positions]
|
|
21173
21172
|
);
|
|
21174
|
-
const getBoundaryShadowClass =
|
|
21173
|
+
const getBoundaryShadowClass = React67.useCallback(
|
|
21175
21174
|
(col) => {
|
|
21176
21175
|
if (col.fixed === "left" && col.key === leftBoundaryKey) {
|
|
21177
21176
|
return "border-r border-border/80 shadow-[10px_0_16px_-10px_rgba(0,0,0,0.55)]";
|
|
@@ -21183,14 +21182,14 @@ function useStickyColumns(visibleColumns) {
|
|
|
21183
21182
|
},
|
|
21184
21183
|
[leftBoundaryKey, rightBoundaryKey]
|
|
21185
21184
|
);
|
|
21186
|
-
const getStickyHeaderClass =
|
|
21185
|
+
const getStickyHeaderClass = React67.useCallback(
|
|
21187
21186
|
(col) => {
|
|
21188
21187
|
if (!col.fixed) return "";
|
|
21189
21188
|
return cn("sticky", col.fixed === "left" && "left-0", col.fixed === "right" && "right-0", getBoundaryShadowClass(col), "z-50 !bg-muted");
|
|
21190
21189
|
},
|
|
21191
21190
|
[getBoundaryShadowClass]
|
|
21192
21191
|
);
|
|
21193
|
-
const getStickyCellClass =
|
|
21192
|
+
const getStickyCellClass = React67.useCallback(
|
|
21194
21193
|
(col, isStripedRow) => {
|
|
21195
21194
|
if (!col.fixed) return "";
|
|
21196
21195
|
return cn(
|
|
@@ -21203,7 +21202,7 @@ function useStickyColumns(visibleColumns) {
|
|
|
21203
21202
|
},
|
|
21204
21203
|
[getBoundaryShadowClass]
|
|
21205
21204
|
);
|
|
21206
|
-
const getStickyHeaderCellStyle =
|
|
21205
|
+
const getStickyHeaderCellStyle = React67.useCallback(
|
|
21207
21206
|
(headerCell) => {
|
|
21208
21207
|
const col = headerCell.column;
|
|
21209
21208
|
if (headerCell.isLeaf) {
|
|
@@ -21350,7 +21349,7 @@ function DataTable({
|
|
|
21350
21349
|
size,
|
|
21351
21350
|
storageKey
|
|
21352
21351
|
});
|
|
21353
|
-
|
|
21352
|
+
React68.useEffect(() => {
|
|
21354
21353
|
if (process.env.NODE_ENV === "development") {
|
|
21355
21354
|
const warnings = validateColumns(columns);
|
|
21356
21355
|
warnings.forEach((w) => console.warn(`[DataTable] ${w}`));
|
|
@@ -21358,8 +21357,8 @@ function DataTable({
|
|
|
21358
21357
|
}, [columns]);
|
|
21359
21358
|
const debouncedFilters = useDebounced(filters, 350);
|
|
21360
21359
|
const isServerMode = Boolean(onQueryChange);
|
|
21361
|
-
const hasEmittedQuery =
|
|
21362
|
-
|
|
21360
|
+
const hasEmittedQuery = React68.useRef(false);
|
|
21361
|
+
React68.useEffect(() => {
|
|
21363
21362
|
if (!onQueryChange) return;
|
|
21364
21363
|
if (!hasEmittedQuery.current) {
|
|
21365
21364
|
hasEmittedQuery.current = true;
|
|
@@ -21367,7 +21366,7 @@ function DataTable({
|
|
|
21367
21366
|
}
|
|
21368
21367
|
onQueryChange({ filters: debouncedFilters, sort, page: curPage, pageSize: curPageSize });
|
|
21369
21368
|
}, [debouncedFilters, sort, curPage, curPageSize, onQueryChange]);
|
|
21370
|
-
|
|
21369
|
+
React68.useEffect(() => {
|
|
21371
21370
|
if (process.env.NODE_ENV !== "development" || rowKey) return;
|
|
21372
21371
|
const hasQueryFeatures = columns.some((column) => column.sortable || column.filter) || Boolean(pageSizeOptions?.length) || isServerMode;
|
|
21373
21372
|
if (!hasQueryFeatures) return;
|
|
@@ -21395,7 +21394,7 @@ function DataTable({
|
|
|
21395
21394
|
if (typeof rowKey === "function") return String(rowKey(row));
|
|
21396
21395
|
return String(row[rowKey]);
|
|
21397
21396
|
};
|
|
21398
|
-
const viewportRef =
|
|
21397
|
+
const viewportRef = React68.useRef(null);
|
|
21399
21398
|
useOverlayScrollbarTarget(viewportRef, { enabled: useOverlayScrollbar });
|
|
21400
21399
|
return /* @__PURE__ */ jsxs63("div", { className: cn("space-y-2", className), children: [
|
|
21401
21400
|
/* @__PURE__ */ jsx72(
|
|
@@ -21501,10 +21500,10 @@ function DataTable({
|
|
|
21501
21500
|
var DataTable_default = DataTable;
|
|
21502
21501
|
|
|
21503
21502
|
// src/components/Form.tsx
|
|
21504
|
-
import * as
|
|
21503
|
+
import * as React69 from "react";
|
|
21505
21504
|
import { Controller, FormProvider, useFormContext, useForm } from "react-hook-form";
|
|
21506
21505
|
import { jsx as jsx73, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
21507
|
-
var FormConfigContext =
|
|
21506
|
+
var FormConfigContext = React69.createContext({ size: "md" });
|
|
21508
21507
|
var FormWrapper = ({
|
|
21509
21508
|
children,
|
|
21510
21509
|
onSubmit,
|
|
@@ -21517,7 +21516,7 @@ var FormWrapper = ({
|
|
|
21517
21516
|
const methods = useForm({
|
|
21518
21517
|
defaultValues: initialValues
|
|
21519
21518
|
});
|
|
21520
|
-
|
|
21519
|
+
React69.useEffect(() => {
|
|
21521
21520
|
if (initialValues) {
|
|
21522
21521
|
methods.reset(initialValues);
|
|
21523
21522
|
}
|
|
@@ -21526,23 +21525,18 @@ var FormWrapper = ({
|
|
|
21526
21525
|
return /* @__PURE__ */ jsx73(FormProvider, { ...methods, children: /* @__PURE__ */ jsx73(FormConfigContext.Provider, { value: { size }, children: /* @__PURE__ */ jsx73("form", { onSubmit: methods.handleSubmit(onSubmit), className, ...formProps, children }) }) });
|
|
21527
21526
|
};
|
|
21528
21527
|
var Form = FormWrapper;
|
|
21529
|
-
var FormFieldContext =
|
|
21528
|
+
var FormFieldContext = React69.createContext({});
|
|
21530
21529
|
var FormField = ({
|
|
21531
21530
|
...props
|
|
21532
21531
|
}) => {
|
|
21533
21532
|
return /* @__PURE__ */ jsx73(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx73(Controller, { ...props }) });
|
|
21534
21533
|
};
|
|
21535
21534
|
var useFormField = () => {
|
|
21536
|
-
const fieldContext =
|
|
21537
|
-
const itemContext =
|
|
21535
|
+
const fieldContext = React69.useContext(FormFieldContext);
|
|
21536
|
+
const itemContext = React69.useContext(FormItemContext);
|
|
21538
21537
|
const { getFieldState, formState } = useFormContext();
|
|
21539
21538
|
if (!fieldContext) {
|
|
21540
|
-
|
|
21541
|
-
const t = useSmartTranslations("Form");
|
|
21542
|
-
throw new Error(t("validation.mustBeUsedWithinForm"));
|
|
21543
|
-
} catch {
|
|
21544
|
-
throw new Error("useFormField must be used within FormField");
|
|
21545
|
-
}
|
|
21539
|
+
throw new Error("useFormField must be used within FormField");
|
|
21546
21540
|
}
|
|
21547
21541
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
21548
21542
|
const { id } = itemContext;
|
|
@@ -21555,16 +21549,16 @@ var useFormField = () => {
|
|
|
21555
21549
|
...fieldState
|
|
21556
21550
|
};
|
|
21557
21551
|
};
|
|
21558
|
-
var FormItemContext =
|
|
21559
|
-
var FormItem =
|
|
21560
|
-
const id =
|
|
21552
|
+
var FormItemContext = React69.createContext({});
|
|
21553
|
+
var FormItem = React69.forwardRef(({ className, ...props }, ref) => {
|
|
21554
|
+
const id = React69.useId();
|
|
21561
21555
|
return /* @__PURE__ */ jsx73(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx73("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
21562
21556
|
});
|
|
21563
21557
|
FormItem.displayName = "FormItem";
|
|
21564
|
-
var FormLabel =
|
|
21558
|
+
var FormLabel = React69.forwardRef(
|
|
21565
21559
|
({ className, children, required, ...props }, ref) => {
|
|
21566
21560
|
const { error, formItemId } = useFormField();
|
|
21567
|
-
const config =
|
|
21561
|
+
const config = React69.useContext(FormConfigContext);
|
|
21568
21562
|
const sizeClass = config.size === "sm" ? "text-xs" : config.size === "lg" ? "text-base" : "text-sm";
|
|
21569
21563
|
return /* @__PURE__ */ jsxs64(Label, { ref, className: cn(sizeClass, error && "text-destructive", className), htmlFor: formItemId, ...props, children: [
|
|
21570
21564
|
children,
|
|
@@ -21573,7 +21567,7 @@ var FormLabel = React68.forwardRef(
|
|
|
21573
21567
|
}
|
|
21574
21568
|
);
|
|
21575
21569
|
FormLabel.displayName = "FormLabel";
|
|
21576
|
-
var FormControl =
|
|
21570
|
+
var FormControl = React69.forwardRef(({ ...props }, ref) => {
|
|
21577
21571
|
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
21578
21572
|
return /* @__PURE__ */ jsx73(
|
|
21579
21573
|
"div",
|
|
@@ -21587,12 +21581,12 @@ var FormControl = React68.forwardRef(({ ...props }, ref) => {
|
|
|
21587
21581
|
);
|
|
21588
21582
|
});
|
|
21589
21583
|
FormControl.displayName = "FormControl";
|
|
21590
|
-
var FormDescription =
|
|
21584
|
+
var FormDescription = React69.forwardRef(({ className, ...props }, ref) => {
|
|
21591
21585
|
const { formDescriptionId } = useFormField();
|
|
21592
21586
|
return /* @__PURE__ */ jsx73("p", { ref, id: formDescriptionId, className: cn("text-sm text-muted-foreground", className), ...props });
|
|
21593
21587
|
});
|
|
21594
21588
|
FormDescription.displayName = "FormDescription";
|
|
21595
|
-
var FormMessage =
|
|
21589
|
+
var FormMessage = React69.forwardRef(({ className, children, ...props }, ref) => {
|
|
21596
21590
|
const { error, formMessageId } = useFormField();
|
|
21597
21591
|
const body = error ? String(error?.message) : children;
|
|
21598
21592
|
if (!body) {
|
|
@@ -21601,7 +21595,7 @@ var FormMessage = React68.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
21601
21595
|
return /* @__PURE__ */ jsx73("p", { ref, id: formMessageId, className: cn("text-sm font-medium text-destructive", className), ...props, children: body });
|
|
21602
21596
|
});
|
|
21603
21597
|
FormMessage.displayName = "FormMessage";
|
|
21604
|
-
var FormInput =
|
|
21598
|
+
var FormInput = React69.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ jsx73(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ jsx73(
|
|
21605
21599
|
FormField,
|
|
21606
21600
|
{
|
|
21607
21601
|
name,
|
|
@@ -21612,7 +21606,7 @@ var FormInput = React68.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */
|
|
|
21612
21606
|
}
|
|
21613
21607
|
) }));
|
|
21614
21608
|
FormInput.displayName = "FormInput";
|
|
21615
|
-
var FormCheckbox =
|
|
21609
|
+
var FormCheckbox = React69.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ jsx73(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ jsx73(
|
|
21616
21610
|
FormField,
|
|
21617
21611
|
{
|
|
21618
21612
|
name,
|
|
@@ -21636,9 +21630,9 @@ var FormCheckbox = React68.forwardRef(({ name, ...props }, ref) => /* @__PURE__
|
|
|
21636
21630
|
}
|
|
21637
21631
|
) }));
|
|
21638
21632
|
FormCheckbox.displayName = "FormCheckbox";
|
|
21639
|
-
var FormActions =
|
|
21633
|
+
var FormActions = React69.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx73("div", { ref, className: cn("flex gap-2 justify-end", className), ...props }));
|
|
21640
21634
|
FormActions.displayName = "FormActions";
|
|
21641
|
-
var FormSubmitButton =
|
|
21635
|
+
var FormSubmitButton = React69.forwardRef(
|
|
21642
21636
|
({ children, loading: loading2, ...props }, ref) => /* @__PURE__ */ jsx73(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ jsx73(Button_default, { ref, type: "submit", size: props.size ?? size, disabled: loading2, ...props, children }) })
|
|
21643
21637
|
);
|
|
21644
21638
|
FormSubmitButton.displayName = "FormSubmitButton";
|
|
@@ -21720,7 +21714,7 @@ function AccessDenied({
|
|
|
21720
21714
|
|
|
21721
21715
|
// src/components/ThemeToggleHeadless.tsx
|
|
21722
21716
|
import { Moon as Moon2, Sun as Sun2, Monitor } from "lucide-react";
|
|
21723
|
-
import { useEffect as
|
|
21717
|
+
import { useEffect as useEffect31, useRef as useRef28, useState as useState45 } from "react";
|
|
21724
21718
|
import { createPortal as createPortal7 } from "react-dom";
|
|
21725
21719
|
import { Fragment as Fragment26, jsx as jsx76, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
21726
21720
|
function ThemeToggleHeadless({
|
|
@@ -21733,7 +21727,7 @@ function ThemeToggleHeadless({
|
|
|
21733
21727
|
const [mounted, setMounted] = useState45(false);
|
|
21734
21728
|
const triggerRef = useRef28(null);
|
|
21735
21729
|
const [dropdownPosition, setDropdownPosition] = useState45(null);
|
|
21736
|
-
|
|
21730
|
+
useEffect31(() => setMounted(true), []);
|
|
21737
21731
|
const themes = [
|
|
21738
21732
|
{ value: "light", label: labels?.light ?? "Light", icon: Sun2 },
|
|
21739
21733
|
{ value: "dark", label: labels?.dark ?? "Dark", icon: Moon2 },
|
|
@@ -21929,7 +21923,7 @@ var VARIANT_STYLES_ALERT = {
|
|
|
21929
21923
|
};
|
|
21930
21924
|
|
|
21931
21925
|
// ../../lib/i18n/translation-adapter.tsx
|
|
21932
|
-
import * as
|
|
21926
|
+
import * as React71 from "react";
|
|
21933
21927
|
import { jsx as jsx78 } from "react/jsx-runtime";
|
|
21934
21928
|
var defaultTranslations2 = {
|
|
21935
21929
|
en: {
|
|
@@ -22294,9 +22288,9 @@ function resolveTranslationValue2(translations, namespace, key) {
|
|
|
22294
22288
|
const value = resolveObjectPath2(namespaceValue, key);
|
|
22295
22289
|
return typeof value === "string" ? value : null;
|
|
22296
22290
|
}
|
|
22297
|
-
var TranslationContext2 =
|
|
22291
|
+
var TranslationContext2 = React71.createContext(null);
|
|
22298
22292
|
var UnderverseProvider = ({ children, locale = "en", translations }) => {
|
|
22299
|
-
const t =
|
|
22293
|
+
const t = React71.useCallback(
|
|
22300
22294
|
(namespace) => {
|
|
22301
22295
|
return (key) => {
|
|
22302
22296
|
const mergedTranslations = {
|
|
@@ -22337,7 +22331,7 @@ function getInternalTranslation(namespace, locale) {
|
|
|
22337
22331
|
};
|
|
22338
22332
|
}
|
|
22339
22333
|
function useTranslations(namespace) {
|
|
22340
|
-
const underverseContext =
|
|
22334
|
+
const underverseContext = React71.useContext(TranslationContext2);
|
|
22341
22335
|
if (underverseContext) {
|
|
22342
22336
|
return (key, params) => {
|
|
22343
22337
|
const result = underverseContext.t(namespace)(key);
|
|
@@ -22354,7 +22348,7 @@ function useTranslations(namespace) {
|
|
|
22354
22348
|
return getInternalTranslation(namespace, "en");
|
|
22355
22349
|
}
|
|
22356
22350
|
function useLocale() {
|
|
22357
|
-
const underverseContext =
|
|
22351
|
+
const underverseContext = React71.useContext(TranslationContext2);
|
|
22358
22352
|
if (underverseContext) {
|
|
22359
22353
|
return underverseContext.locale;
|
|
22360
22354
|
}
|
|
@@ -22373,7 +22367,7 @@ function useLocale() {
|
|
|
22373
22367
|
}
|
|
22374
22368
|
|
|
22375
22369
|
// src/components/UEditor/UEditor.tsx
|
|
22376
|
-
import
|
|
22370
|
+
import React80, { useEffect as useEffect38, useImperativeHandle as useImperativeHandle3, useMemo as useMemo29, useRef as useRef36 } from "react";
|
|
22377
22371
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
22378
22372
|
|
|
22379
22373
|
// src/components/UEditor/extensions.ts
|
|
@@ -22414,7 +22408,7 @@ import { common, createLowlight } from "lowlight";
|
|
|
22414
22408
|
import { Extension } from "@tiptap/core";
|
|
22415
22409
|
import Suggestion from "@tiptap/suggestion";
|
|
22416
22410
|
import { ReactRenderer } from "@tiptap/react";
|
|
22417
|
-
import { forwardRef as forwardRef13, useEffect as
|
|
22411
|
+
import { forwardRef as forwardRef13, useEffect as useEffect32, useImperativeHandle, useRef as useRef30, useState as useState47 } from "react";
|
|
22418
22412
|
import {
|
|
22419
22413
|
FileCode as FileCode2,
|
|
22420
22414
|
Heading1,
|
|
@@ -22459,10 +22453,10 @@ var DEFAULT_MESSAGES = {
|
|
|
22459
22453
|
var CommandList = forwardRef13((props, ref) => {
|
|
22460
22454
|
const [selectedIndex, setSelectedIndex] = useState47(0);
|
|
22461
22455
|
const listRef = useRef30(null);
|
|
22462
|
-
|
|
22456
|
+
useEffect32(() => {
|
|
22463
22457
|
setSelectedIndex(0);
|
|
22464
22458
|
}, [props.items]);
|
|
22465
|
-
|
|
22459
|
+
useEffect32(() => {
|
|
22466
22460
|
const selectedElement = listRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
22467
22461
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
22468
22462
|
}, [selectedIndex, props.items]);
|
|
@@ -22787,7 +22781,7 @@ import { Extension as Extension3 } from "@tiptap/core";
|
|
|
22787
22781
|
import Suggestion2 from "@tiptap/suggestion";
|
|
22788
22782
|
import { ReactRenderer as ReactRenderer2 } from "@tiptap/react";
|
|
22789
22783
|
import { PluginKey } from "@tiptap/pm/state";
|
|
22790
|
-
import { forwardRef as forwardRef14, useEffect as
|
|
22784
|
+
import { forwardRef as forwardRef14, useEffect as useEffect33, useImperativeHandle as useImperativeHandle2, useState as useState48 } from "react";
|
|
22791
22785
|
import { Smile } from "lucide-react";
|
|
22792
22786
|
import tippy2 from "tippy.js";
|
|
22793
22787
|
|
|
@@ -23560,7 +23554,7 @@ var EMOJI_LIST = [
|
|
|
23560
23554
|
import { jsx as jsx80, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
23561
23555
|
var EmojiList = forwardRef14((props, ref) => {
|
|
23562
23556
|
const [selectedIndex, setSelectedIndex] = useState48(0);
|
|
23563
|
-
|
|
23557
|
+
useEffect33(() => {
|
|
23564
23558
|
setSelectedIndex(0);
|
|
23565
23559
|
}, [props.items]);
|
|
23566
23560
|
useImperativeHandle2(ref, () => ({
|
|
@@ -23768,7 +23762,7 @@ var UEditorPlaceholder = Extension4.create({
|
|
|
23768
23762
|
});
|
|
23769
23763
|
|
|
23770
23764
|
// src/components/UEditor/resizable-image.tsx
|
|
23771
|
-
import { useEffect as
|
|
23765
|
+
import { useEffect as useEffect34, useRef as useRef31, useState as useState49 } from "react";
|
|
23772
23766
|
import Image3 from "@tiptap/extension-image";
|
|
23773
23767
|
import { mergeAttributes } from "@tiptap/core";
|
|
23774
23768
|
import { NodeViewWrapper, ReactNodeViewRenderer } from "@tiptap/react";
|
|
@@ -23796,7 +23790,7 @@ function ResizableImageNodeView(props) {
|
|
|
23796
23790
|
const heightAttr = toNullableNumber(node.attrs["height"]);
|
|
23797
23791
|
const textAlign = String(node.attrs["textAlign"] ?? "");
|
|
23798
23792
|
const dragStateRef = useRef31(null);
|
|
23799
|
-
|
|
23793
|
+
useEffect34(() => {
|
|
23800
23794
|
const img = imgRef.current;
|
|
23801
23795
|
if (!img) return;
|
|
23802
23796
|
img.style.width = widthAttr ? `${widthAttr}px` : "";
|
|
@@ -24127,7 +24121,7 @@ function buildUEditorExtensions({
|
|
|
24127
24121
|
}
|
|
24128
24122
|
|
|
24129
24123
|
// src/components/UEditor/toolbar.tsx
|
|
24130
|
-
import
|
|
24124
|
+
import React78, { useRef as useRef34, useState as useState52 } from "react";
|
|
24131
24125
|
import {
|
|
24132
24126
|
AlignCenter,
|
|
24133
24127
|
AlignJustify,
|
|
@@ -24228,7 +24222,7 @@ var EditorColorPalette = ({
|
|
|
24228
24222
|
] });
|
|
24229
24223
|
|
|
24230
24224
|
// src/components/UEditor/inputs.tsx
|
|
24231
|
-
import { useEffect as
|
|
24225
|
+
import { useEffect as useEffect35, useRef as useRef32, useState as useState50 } from "react";
|
|
24232
24226
|
import { Check as Check10, X as X18 } from "lucide-react";
|
|
24233
24227
|
import { jsx as jsx83, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
24234
24228
|
function normalizeUrl(raw) {
|
|
@@ -24246,7 +24240,7 @@ var LinkInput = ({
|
|
|
24246
24240
|
const t = useSmartTranslations("UEditor");
|
|
24247
24241
|
const [url, setUrl] = useState50(initialUrl);
|
|
24248
24242
|
const inputRef = useRef32(null);
|
|
24249
|
-
|
|
24243
|
+
useEffect35(() => {
|
|
24250
24244
|
inputRef.current?.focus();
|
|
24251
24245
|
inputRef.current?.select();
|
|
24252
24246
|
}, []);
|
|
@@ -24276,7 +24270,7 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
24276
24270
|
const [url, setUrl] = useState50("");
|
|
24277
24271
|
const [alt, setAlt] = useState50("");
|
|
24278
24272
|
const inputRef = useRef32(null);
|
|
24279
|
-
|
|
24273
|
+
useEffect35(() => {
|
|
24280
24274
|
inputRef.current?.focus();
|
|
24281
24275
|
}, []);
|
|
24282
24276
|
const handleSubmit = (e) => {
|
|
@@ -24329,7 +24323,7 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
24329
24323
|
};
|
|
24330
24324
|
|
|
24331
24325
|
// src/components/UEditor/emoji-picker.tsx
|
|
24332
|
-
import { useState as useState51, useMemo as useMemo27, useRef as useRef33, useEffect as
|
|
24326
|
+
import { useState as useState51, useMemo as useMemo27, useRef as useRef33, useEffect as useEffect36 } from "react";
|
|
24333
24327
|
import { Search as Search6, X as X19, Smile as Smile2, Leaf, Utensils, Dumbbell, Lightbulb, Hash, Flag } from "lucide-react";
|
|
24334
24328
|
import { jsx as jsx84, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
24335
24329
|
var CATEGORY_ICONS = {
|
|
@@ -24362,7 +24356,7 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
24362
24356
|
onSelect(emoji);
|
|
24363
24357
|
setSearch("");
|
|
24364
24358
|
};
|
|
24365
|
-
|
|
24359
|
+
useEffect36(() => {
|
|
24366
24360
|
if (search) return;
|
|
24367
24361
|
const container = scrollContainerRef.current;
|
|
24368
24362
|
if (!container) return;
|
|
@@ -24402,7 +24396,7 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
24402
24396
|
isUserScrolling.current = true;
|
|
24403
24397
|
}, 500);
|
|
24404
24398
|
};
|
|
24405
|
-
|
|
24399
|
+
useEffect36(() => {
|
|
24406
24400
|
isUserScrolling.current = true;
|
|
24407
24401
|
}, []);
|
|
24408
24402
|
return /* @__PURE__ */ jsxs74("div", { className: "w-96 bg-card border border-border rounded-2xl shadow-xl overflow-hidden flex flex-col max-h-128", children: [
|
|
@@ -24521,7 +24515,7 @@ function fileToDataUrl2(file) {
|
|
|
24521
24515
|
reader.readAsDataURL(file);
|
|
24522
24516
|
});
|
|
24523
24517
|
}
|
|
24524
|
-
var ToolbarButton =
|
|
24518
|
+
var ToolbarButton = React78.forwardRef(({ onClick, onMouseDown, active, disabled, children, title, className }, ref) => {
|
|
24525
24519
|
const button = /* @__PURE__ */ jsx85(
|
|
24526
24520
|
"button",
|
|
24527
24521
|
{
|
|
@@ -25010,7 +25004,7 @@ var EditorToolbar = ({
|
|
|
25010
25004
|
};
|
|
25011
25005
|
|
|
25012
25006
|
// src/components/UEditor/menus.tsx
|
|
25013
|
-
import { useCallback as useCallback21, useEffect as
|
|
25007
|
+
import { useCallback as useCallback21, useEffect as useEffect37, useMemo as useMemo28, useRef as useRef35, useState as useState53 } from "react";
|
|
25014
25008
|
import { createPortal as createPortal9 } from "react-dom";
|
|
25015
25009
|
import {
|
|
25016
25010
|
Bold as BoldIcon2,
|
|
@@ -25116,10 +25110,10 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
25116
25110
|
const lowerFilter = filterText.toLowerCase();
|
|
25117
25111
|
return allCommands.filter((cmd) => cmd.label.toLowerCase().includes(lowerFilter) || cmd.description.toLowerCase().includes(lowerFilter));
|
|
25118
25112
|
}, [allCommands, filterText]);
|
|
25119
|
-
|
|
25113
|
+
useEffect37(() => {
|
|
25120
25114
|
setSelectedIndex(0);
|
|
25121
25115
|
}, [filterText]);
|
|
25122
|
-
|
|
25116
|
+
useEffect37(() => {
|
|
25123
25117
|
const selectedElement = menuRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
25124
25118
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
25125
25119
|
}, [selectedIndex]);
|
|
@@ -25133,7 +25127,7 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
25133
25127
|
},
|
|
25134
25128
|
[commands, onClose]
|
|
25135
25129
|
);
|
|
25136
|
-
|
|
25130
|
+
useEffect37(() => {
|
|
25137
25131
|
const handleKeyDown = (e) => {
|
|
25138
25132
|
if (commands.length === 0) return;
|
|
25139
25133
|
if (e.key === "ArrowDown") {
|
|
@@ -25218,10 +25212,10 @@ var BubbleMenuContent = ({
|
|
|
25218
25212
|
const { textColors, highlightColors } = useEditorColors();
|
|
25219
25213
|
const [showLinkInput, setShowLinkInput] = useState53(false);
|
|
25220
25214
|
const [showEditorColorPalette, setShowEditorColorPalette] = useState53(false);
|
|
25221
|
-
|
|
25215
|
+
useEffect37(() => {
|
|
25222
25216
|
onKeepOpenChange?.(showLinkInput);
|
|
25223
25217
|
}, [onKeepOpenChange, showLinkInput]);
|
|
25224
|
-
|
|
25218
|
+
useEffect37(() => {
|
|
25225
25219
|
if (!showLinkInput) return;
|
|
25226
25220
|
const close = () => setShowLinkInput(false);
|
|
25227
25221
|
editor.on("selectionUpdate", close);
|
|
@@ -25352,7 +25346,7 @@ var CustomBubbleMenu = ({ editor }) => {
|
|
|
25352
25346
|
keepOpenRef.current = next;
|
|
25353
25347
|
if (next) setIsVisible(true);
|
|
25354
25348
|
}, []);
|
|
25355
|
-
|
|
25349
|
+
useEffect37(() => {
|
|
25356
25350
|
const updatePosition = () => {
|
|
25357
25351
|
const { state, view } = editor;
|
|
25358
25352
|
const { from, to, empty } = state.selection;
|
|
@@ -25407,7 +25401,7 @@ var CustomBubbleMenu = ({ editor }) => {
|
|
|
25407
25401
|
var CustomFloatingMenu = ({ editor }) => {
|
|
25408
25402
|
const [isVisible, setIsVisible] = useState53(false);
|
|
25409
25403
|
const [position, setPosition] = useState53({ top: 0, left: 0 });
|
|
25410
|
-
|
|
25404
|
+
useEffect37(() => {
|
|
25411
25405
|
const updatePosition = () => {
|
|
25412
25406
|
const { state, view } = editor;
|
|
25413
25407
|
const { $from, empty } = state.selection;
|
|
@@ -25726,7 +25720,7 @@ async function prepareUEditorContentForSave({
|
|
|
25726
25720
|
|
|
25727
25721
|
// src/components/UEditor/UEditor.tsx
|
|
25728
25722
|
import { jsx as jsx87, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
25729
|
-
var UEditor =
|
|
25723
|
+
var UEditor = React80.forwardRef(({
|
|
25730
25724
|
content = "",
|
|
25731
25725
|
onChange,
|
|
25732
25726
|
onHtmlChange,
|
|
@@ -25890,7 +25884,7 @@ var UEditor = React79.forwardRef(({
|
|
|
25890
25884
|
}),
|
|
25891
25885
|
[content, editor, uploadImageForSave]
|
|
25892
25886
|
);
|
|
25893
|
-
|
|
25887
|
+
useEffect38(() => {
|
|
25894
25888
|
if (editor && content !== editor.getHTML()) {
|
|
25895
25889
|
if (editor.isEmpty && content) {
|
|
25896
25890
|
editor.commands.setContent(content);
|