@underverse-ui/underverse 1.0.53 → 1.0.54
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 +398 -408
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -13
- package/dist/index.d.ts +0 -13
- package/dist/index.js +186 -196
- 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;
|
|
@@ -4691,7 +4697,7 @@ var Alert = ({ title, description, variant = "default", className, icon, dismiss
|
|
|
4691
4697
|
var Alert_default = Alert;
|
|
4692
4698
|
|
|
4693
4699
|
// src/components/GlobalLoading.tsx
|
|
4694
|
-
import React17, { useEffect as
|
|
4700
|
+
import React17, { useEffect as useEffect7, useState as useState12 } from "react";
|
|
4695
4701
|
import { Activity as Activity2 } from "lucide-react";
|
|
4696
4702
|
|
|
4697
4703
|
// src/utils/loading.ts
|
|
@@ -4739,7 +4745,7 @@ var loading = new LoadingManager();
|
|
|
4739
4745
|
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4740
4746
|
var GlobalLoading = ({ className, backdrop = true, position = "fixed", size = "lg" }) => {
|
|
4741
4747
|
const [state, setState] = useState12(() => loading.getState());
|
|
4742
|
-
|
|
4748
|
+
useEffect7(() => {
|
|
4743
4749
|
const unsubscribe = loading.subscribe(setState);
|
|
4744
4750
|
return unsubscribe;
|
|
4745
4751
|
}, []);
|
|
@@ -5363,7 +5369,7 @@ import { useId as useId3 } from "react";
|
|
|
5363
5369
|
import { ChevronDown, Search as Search3, SearchX, Check as Check3, X as X8 } from "lucide-react";
|
|
5364
5370
|
|
|
5365
5371
|
// src/components/OverlayScrollbarProvider.tsx
|
|
5366
|
-
import { createContext as createContext4, useContext as useContext4, useEffect as
|
|
5372
|
+
import { createContext as createContext4, useContext as useContext4, useEffect as useEffect10, useMemo as useMemo4 } from "react";
|
|
5367
5373
|
import { OverlayScrollbars } from "overlayscrollbars";
|
|
5368
5374
|
|
|
5369
5375
|
// src/utils/overlay-scrollbar-controller.ts
|
|
@@ -5565,26 +5571,9 @@ function useOverlayScrollbarTarget(targetRef, options = {}) {
|
|
|
5565
5571
|
...inherited,
|
|
5566
5572
|
...options
|
|
5567
5573
|
}),
|
|
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
|
-
]
|
|
5574
|
+
[inherited, options]
|
|
5586
5575
|
);
|
|
5587
|
-
|
|
5576
|
+
useEffect10(() => {
|
|
5588
5577
|
if (typeof window === "undefined") return;
|
|
5589
5578
|
const target = targetRef.current;
|
|
5590
5579
|
if (!target) return;
|
|
@@ -5598,17 +5587,7 @@ function useOverlayScrollbarTarget(targetRef, options = {}) {
|
|
|
5598
5587
|
return () => {
|
|
5599
5588
|
controller.destroy();
|
|
5600
5589
|
};
|
|
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
|
-
]);
|
|
5590
|
+
}, [targetRef, resolved]);
|
|
5612
5591
|
}
|
|
5613
5592
|
var OverlayScrollbarProvider_default = OverlayScrollbarProvider;
|
|
5614
5593
|
|
|
@@ -11679,6 +11658,7 @@ function useSlotMetrics(args) {
|
|
|
11679
11658
|
}, [
|
|
11680
11659
|
activeView,
|
|
11681
11660
|
adaptiveSlotWidths,
|
|
11661
|
+
bodyClientWidth,
|
|
11682
11662
|
dayHeaderMarks,
|
|
11683
11663
|
dayHeaderSmart,
|
|
11684
11664
|
daySlotCompression,
|
|
@@ -12064,7 +12044,7 @@ function CalendarTimeline({
|
|
|
12064
12044
|
});
|
|
12065
12045
|
React36.useEffect(() => {
|
|
12066
12046
|
onRangeChange?.(range);
|
|
12067
|
-
}, [range
|
|
12047
|
+
}, [range, onRangeChange]);
|
|
12068
12048
|
const leftRef = React36.useRef(null);
|
|
12069
12049
|
const bodyRef = React36.useRef(null);
|
|
12070
12050
|
const headerRef = React36.useRef(null);
|
|
@@ -12376,7 +12356,7 @@ function CalendarTimeline({
|
|
|
12376
12356
|
}
|
|
12377
12357
|
return dayFmt.format(d);
|
|
12378
12358
|
};
|
|
12379
|
-
}, [activeView, dueDateSprint, l.sprint, resolvedLocale, resolvedTimeZone, slotStarts
|
|
12359
|
+
}, [activeView, dueDateSprint, l.sprint, resolvedLocale, resolvedTimeZone, slotStarts]);
|
|
12380
12360
|
const openCreate = React36.useCallback(() => {
|
|
12381
12361
|
if (!canCreate) return;
|
|
12382
12362
|
if (activeEventSheetOpen) setEventSheetOpen(false);
|
|
@@ -12539,7 +12519,7 @@ function CalendarTimeline({
|
|
|
12539
12519
|
return;
|
|
12540
12520
|
}
|
|
12541
12521
|
},
|
|
12542
|
-
[getPointerContext, range.end, range.start, slotToDate, slots.length]
|
|
12522
|
+
[getPointerContext, range.end, range.start, setPreview, slotToDate, slots.length]
|
|
12543
12523
|
);
|
|
12544
12524
|
const flushDragPreview = React36.useCallback(() => {
|
|
12545
12525
|
dragPreviewRafRef.current = null;
|
|
@@ -14092,7 +14072,10 @@ var Slider = React39.forwardRef(
|
|
|
14092
14072
|
const currentRange = isRangeControlled ? rangeValue : internalRange;
|
|
14093
14073
|
const rangeMin = clamp6(currentRange[0] ?? min, min, max);
|
|
14094
14074
|
const rangeMax = clamp6(currentRange[1] ?? max, min, max);
|
|
14095
|
-
const normalizedRange =
|
|
14075
|
+
const normalizedRange = React39.useMemo(
|
|
14076
|
+
() => rangeMin <= rangeMax ? [rangeMin, rangeMax] : [rangeMax, rangeMin],
|
|
14077
|
+
[rangeMax, rangeMin]
|
|
14078
|
+
);
|
|
14096
14079
|
const handleSingleChange = React39.useCallback(
|
|
14097
14080
|
(e) => {
|
|
14098
14081
|
const newValue = Number(e.target.value);
|
|
@@ -14480,21 +14463,21 @@ function OverlayControls({
|
|
|
14480
14463
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
14481
14464
|
};
|
|
14482
14465
|
}, [autoHide, autoHideDelay, showOnHover]);
|
|
14483
|
-
const showFeedback = (type, value2) => {
|
|
14466
|
+
const showFeedback = React40.useCallback((type, value2) => {
|
|
14484
14467
|
if (feedbackTimerRef.current) clearTimeout(feedbackTimerRef.current);
|
|
14485
14468
|
setKeyboardFeedback({ type, value: value2 });
|
|
14486
14469
|
feedbackTimerRef.current = setTimeout(() => {
|
|
14487
14470
|
setKeyboardFeedback(null);
|
|
14488
14471
|
}, 800);
|
|
14489
|
-
};
|
|
14490
|
-
const accumulateSeek = (seconds) => {
|
|
14472
|
+
}, []);
|
|
14473
|
+
const accumulateSeek = React40.useCallback((seconds) => {
|
|
14491
14474
|
if (seekAccumulatorTimerRef.current) clearTimeout(seekAccumulatorTimerRef.current);
|
|
14492
14475
|
seekAccumulatorRef.current += seconds;
|
|
14493
14476
|
showFeedback("seek", seekAccumulatorRef.current);
|
|
14494
14477
|
seekAccumulatorTimerRef.current = setTimeout(() => {
|
|
14495
14478
|
seekAccumulatorRef.current = 0;
|
|
14496
14479
|
}, 1e3);
|
|
14497
|
-
};
|
|
14480
|
+
}, [showFeedback]);
|
|
14498
14481
|
React40.useEffect(() => {
|
|
14499
14482
|
if (!enableKeyboardShortcuts) return;
|
|
14500
14483
|
const handleKeyDown = (e) => {
|
|
@@ -14593,6 +14576,7 @@ function OverlayControls({
|
|
|
14593
14576
|
onSkip,
|
|
14594
14577
|
skipSeconds,
|
|
14595
14578
|
onChange,
|
|
14579
|
+
onCommit,
|
|
14596
14580
|
value,
|
|
14597
14581
|
max,
|
|
14598
14582
|
onVolumeChange,
|
|
@@ -14600,7 +14584,9 @@ function OverlayControls({
|
|
|
14600
14584
|
onToggleFullscreen,
|
|
14601
14585
|
onToggleMute,
|
|
14602
14586
|
playing,
|
|
14603
|
-
muted
|
|
14587
|
+
muted,
|
|
14588
|
+
accumulateSeek,
|
|
14589
|
+
showFeedback
|
|
14604
14590
|
]);
|
|
14605
14591
|
const formatTime3 = (sec) => {
|
|
14606
14592
|
if (!isFinite(sec) || sec < 0) return "0:00";
|
|
@@ -14830,7 +14816,7 @@ function OverlayControls({
|
|
|
14830
14816
|
}
|
|
14831
14817
|
|
|
14832
14818
|
// src/components/CategoryTreeSelect.tsx
|
|
14833
|
-
import { useEffect as
|
|
14819
|
+
import { useEffect as useEffect23, useId as useId7, useMemo as useMemo17, useRef as useRef17, useState as useState29 } from "react";
|
|
14834
14820
|
import { ChevronRight as ChevronRight6, ChevronDown as ChevronDown5, FolderTree, Layers, Search as Search5, SearchX as SearchX3, X as X13 } from "lucide-react";
|
|
14835
14821
|
import { jsx as jsx46, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
14836
14822
|
var defaultLabels = {
|
|
@@ -14876,7 +14862,10 @@ function CategoryTreeSelect(props) {
|
|
|
14876
14862
|
const errorId = error ? `${resolvedId}-error` : void 0;
|
|
14877
14863
|
const describedBy = errorId || helperId;
|
|
14878
14864
|
const mergedLabels = { ...defaultLabels, ...labels };
|
|
14879
|
-
const valueArray =
|
|
14865
|
+
const valueArray = useMemo17(
|
|
14866
|
+
() => singleSelect ? props.value != null ? [props.value] : [] : props.value ?? [],
|
|
14867
|
+
[props.value, singleSelect]
|
|
14868
|
+
);
|
|
14880
14869
|
const selectedIds = useMemo17(() => new Set(valueArray), [valueArray]);
|
|
14881
14870
|
const { parentCategories, childrenMap, byId } = useMemo17(() => {
|
|
14882
14871
|
const byId2 = /* @__PURE__ */ new Map();
|
|
@@ -14935,21 +14924,21 @@ function CategoryTreeSelect(props) {
|
|
|
14935
14924
|
}
|
|
14936
14925
|
return visible;
|
|
14937
14926
|
}, [byId, categories, childrenMap, isSearchMode, normalizedQuery]);
|
|
14938
|
-
|
|
14927
|
+
useEffect23(() => {
|
|
14939
14928
|
if (!isOpen) setQuery("");
|
|
14940
14929
|
}, [isOpen]);
|
|
14941
|
-
|
|
14930
|
+
useEffect23(() => {
|
|
14942
14931
|
if (!isOpen) return;
|
|
14943
14932
|
if (!isSearchEnabled) return;
|
|
14944
14933
|
const t = setTimeout(() => searchInputRef.current?.focus(), 50);
|
|
14945
14934
|
return () => clearTimeout(t);
|
|
14946
14935
|
}, [isOpen, isSearchEnabled]);
|
|
14947
|
-
|
|
14936
|
+
useEffect23(() => {
|
|
14948
14937
|
if ((viewOnly || inline) && defaultExpanded) {
|
|
14949
14938
|
const allParentIds = categories.filter((c) => childrenMap.has(c.id)).map((c) => c.id);
|
|
14950
14939
|
setExpandedNodes(new Set(allParentIds));
|
|
14951
14940
|
}
|
|
14952
|
-
}, [viewOnly, inline, defaultExpanded, categories]);
|
|
14941
|
+
}, [viewOnly, inline, defaultExpanded, categories, childrenMap]);
|
|
14953
14942
|
const toggleExpand = (id2) => {
|
|
14954
14943
|
if (isSearchMode) return;
|
|
14955
14944
|
const newExpanded = new Set(expandedNodes);
|
|
@@ -15281,6 +15270,7 @@ function CategoryTreeSelect(props) {
|
|
|
15281
15270
|
disabled,
|
|
15282
15271
|
role: "combobox",
|
|
15283
15272
|
"aria-haspopup": "tree",
|
|
15273
|
+
"aria-expanded": isOpen,
|
|
15284
15274
|
"aria-controls": `${resolvedId}-tree`,
|
|
15285
15275
|
"aria-labelledby": labelId,
|
|
15286
15276
|
"aria-describedby": describedBy,
|
|
@@ -15894,10 +15884,7 @@ function FileUpload({
|
|
|
15894
15884
|
"bg-linear-to-br from-muted/50 to-muted",
|
|
15895
15885
|
currentSize.fileIconSize
|
|
15896
15886
|
),
|
|
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) })
|
|
15887
|
+
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
15888
|
}
|
|
15902
15889
|
),
|
|
15903
15890
|
/* @__PURE__ */ jsxs40("div", { className: "flex-1 min-w-0", children: [
|
|
@@ -16489,10 +16476,14 @@ function FallingIcons({
|
|
|
16489
16476
|
};
|
|
16490
16477
|
}, [glow, glowColor, glowIntensity]);
|
|
16491
16478
|
const FallbackIcon = React43.useMemo(
|
|
16492
|
-
() => (props)
|
|
16479
|
+
() => function FallingIconsFallbackIcon(props) {
|
|
16480
|
+
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" }) });
|
|
16481
|
+
},
|
|
16493
16482
|
[]
|
|
16494
16483
|
);
|
|
16495
|
-
const TheIcon = imageUrl ? ({ className: imgClassName })
|
|
16484
|
+
const TheIcon = imageUrl ? function FallingIconsImage({ className: imgClassName }) {
|
|
16485
|
+
return /* @__PURE__ */ jsx50("img", { src: imageUrl, alt: "", className: cn("w-full h-full object-cover rounded-lg", imgClassName), draggable: false });
|
|
16486
|
+
} : Icon || FallbackIcon;
|
|
16496
16487
|
return /* @__PURE__ */ jsxs42(
|
|
16497
16488
|
"div",
|
|
16498
16489
|
{
|
|
@@ -17953,7 +17944,7 @@ function ColorPicker({
|
|
|
17953
17944
|
}
|
|
17954
17945
|
|
|
17955
17946
|
// src/components/MusicPlayer.tsx
|
|
17956
|
-
import { useState as useState37, useRef as useRef21, useEffect as
|
|
17947
|
+
import { useState as useState37, useRef as useRef21, useEffect as useEffect27 } from "react";
|
|
17957
17948
|
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
17949
|
import { jsx as jsx55, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
17959
17950
|
var DEFAULT_PLAYLIST = [
|
|
@@ -18083,12 +18074,12 @@ var MusicPlayer = ({
|
|
|
18083
18074
|
const [showPlaylist, setShowPlaylist] = useState37(initialShowPlaylist);
|
|
18084
18075
|
const audioRef = useRef21(null);
|
|
18085
18076
|
const currentSong = playlist[currentSongIndex];
|
|
18086
|
-
|
|
18077
|
+
useEffect27(() => {
|
|
18087
18078
|
if (audioRef.current) {
|
|
18088
18079
|
audioRef.current.volume = volume;
|
|
18089
18080
|
}
|
|
18090
18081
|
}, [volume]);
|
|
18091
|
-
|
|
18082
|
+
useEffect27(() => {
|
|
18092
18083
|
if (autoPlay && audioRef.current) {
|
|
18093
18084
|
audioRef.current.play().catch(() => {
|
|
18094
18085
|
setIsPlaying(false);
|
|
@@ -18164,7 +18155,7 @@ var MusicPlayer = ({
|
|
|
18164
18155
|
setCurrentSongIndex(index);
|
|
18165
18156
|
setIsPlaying(true);
|
|
18166
18157
|
};
|
|
18167
|
-
|
|
18158
|
+
useEffect27(() => {
|
|
18168
18159
|
if (audioRef.current) {
|
|
18169
18160
|
if (currentSong.startTime !== void 0) {
|
|
18170
18161
|
audioRef.current.currentTime = currentSong.startTime;
|
|
@@ -18497,7 +18488,7 @@ var Grid_default = Grid;
|
|
|
18497
18488
|
import { useMemo as useMemo19, useState as useState39, useRef as useRef23, useCallback as useCallback16 } from "react";
|
|
18498
18489
|
|
|
18499
18490
|
// src/components/ChartTooltip.tsx
|
|
18500
|
-
import { useEffect as
|
|
18491
|
+
import { useEffect as useEffect28, useState as useState38, useRef as useRef22 } from "react";
|
|
18501
18492
|
import { createPortal as createPortal6 } from "react-dom";
|
|
18502
18493
|
import { Fragment as Fragment21, jsx as jsx57, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
18503
18494
|
function ChartTooltip({
|
|
@@ -18516,10 +18507,10 @@ function ChartTooltip({
|
|
|
18516
18507
|
const [isMounted, setIsMounted] = useState38(false);
|
|
18517
18508
|
const [position, setPosition] = useState38(null);
|
|
18518
18509
|
const tooltipRef = useRef22(null);
|
|
18519
|
-
|
|
18510
|
+
useEffect28(() => {
|
|
18520
18511
|
setIsMounted(true);
|
|
18521
18512
|
}, []);
|
|
18522
|
-
|
|
18513
|
+
useEffect28(() => {
|
|
18523
18514
|
if (visible && containerRef?.current) {
|
|
18524
18515
|
const rect = containerRef.current.getBoundingClientRect();
|
|
18525
18516
|
const tw = tooltipRef.current?.offsetWidth ?? 160;
|
|
@@ -18596,6 +18587,7 @@ function ChartTooltip({
|
|
|
18596
18587
|
}
|
|
18597
18588
|
|
|
18598
18589
|
// src/utils/chart-utils.ts
|
|
18590
|
+
import * as React51 from "react";
|
|
18599
18591
|
function getCatmullRomSpline(points, tension = 0.5) {
|
|
18600
18592
|
if (points.length < 2) return "";
|
|
18601
18593
|
if (points.length === 2) {
|
|
@@ -18919,7 +18911,10 @@ function BarChart({
|
|
|
18919
18911
|
className = ""
|
|
18920
18912
|
}) {
|
|
18921
18913
|
const svgRef = useRef24(null);
|
|
18922
|
-
const padding =
|
|
18914
|
+
const padding = useMemo20(
|
|
18915
|
+
() => horizontal ? { top: 20, right: 40, bottom: 20, left: 80 } : { top: 20, right: 20, bottom: 40, left: 40 },
|
|
18916
|
+
[horizontal]
|
|
18917
|
+
);
|
|
18923
18918
|
const chartWidth = width - padding.left - padding.right;
|
|
18924
18919
|
const chartHeight = height - padding.top - padding.bottom;
|
|
18925
18920
|
const [hoveredBar, setHoveredBar] = useState40(null);
|
|
@@ -19373,7 +19368,7 @@ function AreaChart({
|
|
|
19373
19368
|
}) {
|
|
19374
19369
|
const containerRef = useRef26(null);
|
|
19375
19370
|
const clipId = useRef26(`area-clip-${Math.random().toString(36).slice(2, 8)}`).current;
|
|
19376
|
-
const padding = { top: 20, right: 20, bottom: 40, left: 50 };
|
|
19371
|
+
const padding = useMemo22(() => ({ top: 20, right: 20, bottom: 40, left: 50 }), []);
|
|
19377
19372
|
const chartWidth = width - padding.left - padding.right;
|
|
19378
19373
|
const chartHeight = height - padding.top - padding.bottom;
|
|
19379
19374
|
const [hoveredPoint, setHoveredPoint] = useState42(null);
|
|
@@ -20142,11 +20137,11 @@ function GaugeChart({
|
|
|
20142
20137
|
}
|
|
20143
20138
|
|
|
20144
20139
|
// src/components/ClientOnly.tsx
|
|
20145
|
-
import { useEffect as
|
|
20140
|
+
import { useEffect as useEffect29, useState as useState44 } from "react";
|
|
20146
20141
|
import { Fragment as Fragment24, jsx as jsx65 } from "react/jsx-runtime";
|
|
20147
20142
|
function ClientOnly({ children, fallback = null }) {
|
|
20148
20143
|
const [hasMounted, setHasMounted] = useState44(false);
|
|
20149
|
-
|
|
20144
|
+
useEffect29(() => {
|
|
20150
20145
|
setHasMounted(true);
|
|
20151
20146
|
}, []);
|
|
20152
20147
|
if (!hasMounted) {
|
|
@@ -20242,7 +20237,7 @@ var LoadingBar = ({
|
|
|
20242
20237
|
};
|
|
20243
20238
|
|
|
20244
20239
|
// src/components/Table.tsx
|
|
20245
|
-
import
|
|
20240
|
+
import React59 from "react";
|
|
20246
20241
|
import { jsx as jsx67, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
20247
20242
|
var TABLE_BASE_CLASS = "w-full caption-bottom text-sm";
|
|
20248
20243
|
var TABLE_CONTAINER_BASE_CLASS = [
|
|
@@ -20260,8 +20255,8 @@ function assignRef3(ref, value) {
|
|
|
20260
20255
|
ref.current = value;
|
|
20261
20256
|
}
|
|
20262
20257
|
}
|
|
20263
|
-
var TableContainer =
|
|
20264
|
-
const containerRef =
|
|
20258
|
+
var TableContainer = React59.forwardRef(({ className, useOverlayScrollbar = false, ...props }, ref) => {
|
|
20259
|
+
const containerRef = React59.useRef(null);
|
|
20265
20260
|
useOverlayScrollbarTarget(containerRef, { enabled: useOverlayScrollbar });
|
|
20266
20261
|
return /* @__PURE__ */ jsx67(
|
|
20267
20262
|
"div",
|
|
@@ -20276,7 +20271,7 @@ var TableContainer = React58.forwardRef(({ className, useOverlayScrollbar = fals
|
|
|
20276
20271
|
);
|
|
20277
20272
|
});
|
|
20278
20273
|
TableContainer.displayName = "TableContainer";
|
|
20279
|
-
var Table =
|
|
20274
|
+
var Table = React59.forwardRef(
|
|
20280
20275
|
({ className, containerClassName, disableContainer = false, useOverlayScrollbar = false, ...props }, ref) => {
|
|
20281
20276
|
if (disableContainer) {
|
|
20282
20277
|
return /* @__PURE__ */ jsx67("table", { ref, className: cn(TABLE_BASE_CLASS, className), ...props });
|
|
@@ -20285,16 +20280,16 @@ var Table = React58.forwardRef(
|
|
|
20285
20280
|
}
|
|
20286
20281
|
);
|
|
20287
20282
|
Table.displayName = "Table";
|
|
20288
|
-
var TableHeader =
|
|
20283
|
+
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
20284
|
children,
|
|
20290
20285
|
filterRow
|
|
20291
20286
|
] }));
|
|
20292
20287
|
TableHeader.displayName = "TableHeader";
|
|
20293
|
-
var TableBody =
|
|
20288
|
+
var TableBody = React59.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx67("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props }));
|
|
20294
20289
|
TableBody.displayName = "TableBody";
|
|
20295
|
-
var TableFooter =
|
|
20290
|
+
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
20291
|
TableFooter.displayName = "TableFooter";
|
|
20297
|
-
var TableRow =
|
|
20292
|
+
var TableRow = React59.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx67(
|
|
20298
20293
|
"tr",
|
|
20299
20294
|
{
|
|
20300
20295
|
ref,
|
|
@@ -20308,7 +20303,7 @@ var TableRow = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
20308
20303
|
}
|
|
20309
20304
|
));
|
|
20310
20305
|
TableRow.displayName = "TableRow";
|
|
20311
|
-
var TableHead =
|
|
20306
|
+
var TableHead = React59.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx67(
|
|
20312
20307
|
"th",
|
|
20313
20308
|
{
|
|
20314
20309
|
ref,
|
|
@@ -20317,13 +20312,13 @@ var TableHead = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
20317
20312
|
}
|
|
20318
20313
|
));
|
|
20319
20314
|
TableHead.displayName = "TableHead";
|
|
20320
|
-
var TableCell =
|
|
20315
|
+
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
20316
|
TableCell.displayName = "TableCell";
|
|
20322
|
-
var TableCaption =
|
|
20317
|
+
var TableCaption = React59.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx67("caption", { ref, className: cn("mt-4 text-sm text-muted-foreground", className), ...props }));
|
|
20323
20318
|
TableCaption.displayName = "TableCaption";
|
|
20324
20319
|
|
|
20325
20320
|
// src/components/DataTable/DataTable.tsx
|
|
20326
|
-
import
|
|
20321
|
+
import React68 from "react";
|
|
20327
20322
|
|
|
20328
20323
|
// src/components/DataTable/components/DataTableBody.tsx
|
|
20329
20324
|
import { jsx as jsx68, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
@@ -20395,7 +20390,7 @@ function DataTableBodyRows({
|
|
|
20395
20390
|
}
|
|
20396
20391
|
|
|
20397
20392
|
// src/components/DataTable/components/DataTableHeader.tsx
|
|
20398
|
-
import
|
|
20393
|
+
import React60 from "react";
|
|
20399
20394
|
import { Filter as FilterIcon } from "lucide-react";
|
|
20400
20395
|
import { Fragment as Fragment25, jsx as jsx69, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
20401
20396
|
function DataTableHeader({
|
|
@@ -20415,7 +20410,7 @@ function DataTableHeader({
|
|
|
20415
20410
|
getStickyHeaderCellStyle,
|
|
20416
20411
|
t
|
|
20417
20412
|
}) {
|
|
20418
|
-
const renderFilterControl =
|
|
20413
|
+
const renderFilterControl = React60.useCallback(
|
|
20419
20414
|
(col) => {
|
|
20420
20415
|
if (!col.filter) return null;
|
|
20421
20416
|
const key = col.key;
|
|
@@ -20468,7 +20463,7 @@ function DataTableHeader({
|
|
|
20468
20463
|
},
|
|
20469
20464
|
[filters, setCurPage, setFilters, size]
|
|
20470
20465
|
);
|
|
20471
|
-
const renderHeaderContent =
|
|
20466
|
+
const renderHeaderContent = React60.useCallback(
|
|
20472
20467
|
(col, isLeaf) => {
|
|
20473
20468
|
if (!isLeaf) {
|
|
20474
20469
|
return /* @__PURE__ */ jsx69(
|
|
@@ -20631,7 +20626,7 @@ function DataTableHeader({
|
|
|
20631
20626
|
}
|
|
20632
20627
|
|
|
20633
20628
|
// src/components/DataTable/components/Pagination.tsx
|
|
20634
|
-
import
|
|
20629
|
+
import React61 from "react";
|
|
20635
20630
|
import { jsx as jsx70, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
20636
20631
|
function DataTablePagination({
|
|
20637
20632
|
totalItems,
|
|
@@ -20643,14 +20638,7 @@ function DataTablePagination({
|
|
|
20643
20638
|
size
|
|
20644
20639
|
}) {
|
|
20645
20640
|
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(() => {
|
|
20641
|
+
const pages = React61.useMemo(() => {
|
|
20654
20642
|
const result = [];
|
|
20655
20643
|
if (totalPages <= 5) {
|
|
20656
20644
|
for (let i = 1; i <= totalPages; i++) result.push(i);
|
|
@@ -20665,6 +20653,13 @@ function DataTablePagination({
|
|
|
20665
20653
|
result.push(totalPages);
|
|
20666
20654
|
return result;
|
|
20667
20655
|
}, [curPage, totalPages]);
|
|
20656
|
+
if (!(totalItems > 0 && totalPages > 1)) return null;
|
|
20657
|
+
const controlButtonSize = size === "lg" ? "md" : "sm";
|
|
20658
|
+
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";
|
|
20659
|
+
const navIconClass = size === "sm" ? "h-3.5 w-3.5" : size === "lg" ? "h-5 w-5" : "h-4 w-4";
|
|
20660
|
+
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";
|
|
20661
|
+
const containerTextClass = size === "sm" ? "text-[11px]" : size === "lg" ? "text-sm" : "text-xs";
|
|
20662
|
+
const pageSizeClass = size === "sm" ? "w-16" : size === "lg" ? "w-24" : "w-20";
|
|
20668
20663
|
return /* @__PURE__ */ jsxs61("div", { className: cn("flex items-center justify-between gap-2 px-1 pt-3 text-muted-foreground", containerTextClass), children: [
|
|
20669
20664
|
/* @__PURE__ */ jsxs61("div", { className: "tabular-nums", children: [
|
|
20670
20665
|
(curPage - 1) * curPageSize + 1,
|
|
@@ -20725,7 +20720,7 @@ function DataTablePagination({
|
|
|
20725
20720
|
}
|
|
20726
20721
|
|
|
20727
20722
|
// src/components/DataTable/components/Toolbar.tsx
|
|
20728
|
-
import
|
|
20723
|
+
import React62 from "react";
|
|
20729
20724
|
|
|
20730
20725
|
// src/components/DataTable/utils/headers.ts
|
|
20731
20726
|
function isLeafColumn(col) {
|
|
@@ -20846,7 +20841,7 @@ function DataTableToolbar({
|
|
|
20846
20841
|
const controlButtonClass = size === "sm" ? "h-7 px-2 text-xs" : size === "lg" ? "h-9 px-3 text-sm" : "h-8 px-2";
|
|
20847
20842
|
const iconClass = size === "sm" ? "w-3.5 h-3.5 mr-1" : "w-4 h-4 mr-1";
|
|
20848
20843
|
const captionClass = size === "sm" ? "text-xs" : size === "lg" ? "text-sm" : "text-sm";
|
|
20849
|
-
const leafCols =
|
|
20844
|
+
const leafCols = React62.useMemo(() => getLeafColumns(columns), [columns]);
|
|
20850
20845
|
return /* @__PURE__ */ jsxs62("div", { className: "flex items-center justify-between gap-4 mb-1", children: [
|
|
20851
20846
|
/* @__PURE__ */ jsx71("div", { className: captionClass + " text-muted-foreground", children: caption }),
|
|
20852
20847
|
/* @__PURE__ */ jsxs62("div", { className: "flex items-center gap-2", children: [
|
|
@@ -20914,10 +20909,10 @@ function DataTableToolbar({
|
|
|
20914
20909
|
}
|
|
20915
20910
|
|
|
20916
20911
|
// src/components/DataTable/hooks/useDebounced.ts
|
|
20917
|
-
import
|
|
20912
|
+
import React63 from "react";
|
|
20918
20913
|
function useDebounced(value, delay = 300) {
|
|
20919
|
-
const [debounced, setDebounced] =
|
|
20920
|
-
|
|
20914
|
+
const [debounced, setDebounced] = React63.useState(value);
|
|
20915
|
+
React63.useEffect(() => {
|
|
20921
20916
|
const id = setTimeout(() => setDebounced(value), delay);
|
|
20922
20917
|
return () => clearTimeout(id);
|
|
20923
20918
|
}, [value, delay]);
|
|
@@ -20925,7 +20920,7 @@ function useDebounced(value, delay = 300) {
|
|
|
20925
20920
|
}
|
|
20926
20921
|
|
|
20927
20922
|
// src/components/DataTable/hooks/useDataTableModel.ts
|
|
20928
|
-
import
|
|
20923
|
+
import React64 from "react";
|
|
20929
20924
|
|
|
20930
20925
|
// src/components/DataTable/utils/columns.ts
|
|
20931
20926
|
function getColumnWidth(col, fallback = 150) {
|
|
@@ -20953,22 +20948,22 @@ function useDataTableModel({
|
|
|
20953
20948
|
isServerMode,
|
|
20954
20949
|
total
|
|
20955
20950
|
}) {
|
|
20956
|
-
const visibleColsSet =
|
|
20957
|
-
const allLeafColumns =
|
|
20958
|
-
const columnMap =
|
|
20951
|
+
const visibleColsSet = React64.useMemo(() => new Set(visibleCols), [visibleCols]);
|
|
20952
|
+
const allLeafColumns = React64.useMemo(() => getLeafColumns(columns), [columns]);
|
|
20953
|
+
const columnMap = React64.useMemo(() => {
|
|
20959
20954
|
return new Map(allLeafColumns.map((column) => [column.key, column]));
|
|
20960
20955
|
}, [allLeafColumns]);
|
|
20961
|
-
const visibleColumns =
|
|
20956
|
+
const visibleColumns = React64.useMemo(() => {
|
|
20962
20957
|
return filterVisibleColumns(columns, visibleColsSet);
|
|
20963
20958
|
}, [columns, visibleColsSet]);
|
|
20964
|
-
const leafColumns =
|
|
20959
|
+
const leafColumns = React64.useMemo(() => {
|
|
20965
20960
|
return getLeafColumnsWithFixedInheritance(visibleColumns);
|
|
20966
20961
|
}, [visibleColumns]);
|
|
20967
|
-
const headerRows =
|
|
20968
|
-
const totalColumnsWidth =
|
|
20962
|
+
const headerRows = React64.useMemo(() => buildHeaderRows(visibleColumns), [visibleColumns]);
|
|
20963
|
+
const totalColumnsWidth = React64.useMemo(() => {
|
|
20969
20964
|
return leafColumns.reduce((sum, column) => sum + getColumnWidth(column), 0);
|
|
20970
20965
|
}, [leafColumns]);
|
|
20971
|
-
const processedData =
|
|
20966
|
+
const processedData = React64.useMemo(() => {
|
|
20972
20967
|
if (isServerMode) return data;
|
|
20973
20968
|
let result = [...data];
|
|
20974
20969
|
if (Object.keys(filters).length > 0) {
|
|
@@ -21000,7 +20995,7 @@ function useDataTableModel({
|
|
|
21000
20995
|
return result;
|
|
21001
20996
|
}, [columnMap, data, filters, isServerMode, sort]);
|
|
21002
20997
|
const totalItems = isServerMode ? total : processedData.length;
|
|
21003
|
-
const displayedData =
|
|
20998
|
+
const displayedData = React64.useMemo(() => {
|
|
21004
20999
|
if (isServerMode) return data;
|
|
21005
21000
|
const start = (curPage - 1) * curPageSize;
|
|
21006
21001
|
return processedData.slice(start, start + curPageSize);
|
|
@@ -21016,13 +21011,13 @@ function useDataTableModel({
|
|
|
21016
21011
|
}
|
|
21017
21012
|
|
|
21018
21013
|
// src/components/DataTable/hooks/useDataTableState.ts
|
|
21019
|
-
import
|
|
21014
|
+
import React66 from "react";
|
|
21020
21015
|
|
|
21021
21016
|
// src/components/DataTable/hooks/usePageSizeStorage.ts
|
|
21022
|
-
import
|
|
21017
|
+
import React65 from "react";
|
|
21023
21018
|
function usePageSizeStorage({ pageSize, storageKey }) {
|
|
21024
|
-
const loadedFromStorage =
|
|
21025
|
-
const [curPageSize, setCurPageSize] =
|
|
21019
|
+
const loadedFromStorage = React65.useRef(false);
|
|
21020
|
+
const [curPageSize, setCurPageSize] = React65.useState(() => {
|
|
21026
21021
|
if (typeof window === "undefined" || !storageKey) return pageSize;
|
|
21027
21022
|
try {
|
|
21028
21023
|
const saved = localStorage.getItem(`datatable_${storageKey}_pageSize`);
|
|
@@ -21037,11 +21032,11 @@ function usePageSizeStorage({ pageSize, storageKey }) {
|
|
|
21037
21032
|
}
|
|
21038
21033
|
return pageSize;
|
|
21039
21034
|
});
|
|
21040
|
-
const hasMounted =
|
|
21041
|
-
|
|
21035
|
+
const hasMounted = React65.useRef(false);
|
|
21036
|
+
React65.useEffect(() => {
|
|
21042
21037
|
hasMounted.current = true;
|
|
21043
21038
|
}, []);
|
|
21044
|
-
|
|
21039
|
+
React65.useEffect(() => {
|
|
21045
21040
|
if (typeof window === "undefined" || !storageKey) return;
|
|
21046
21041
|
if (!hasMounted.current) return;
|
|
21047
21042
|
try {
|
|
@@ -21049,7 +21044,7 @@ function usePageSizeStorage({ pageSize, storageKey }) {
|
|
|
21049
21044
|
} catch {
|
|
21050
21045
|
}
|
|
21051
21046
|
}, [curPageSize, storageKey]);
|
|
21052
|
-
|
|
21047
|
+
React65.useEffect(() => {
|
|
21053
21048
|
if (storageKey && loadedFromStorage.current) return;
|
|
21054
21049
|
setCurPageSize(pageSize);
|
|
21055
21050
|
}, [pageSize, storageKey]);
|
|
@@ -21069,17 +21064,17 @@ function useDataTableState({
|
|
|
21069
21064
|
size,
|
|
21070
21065
|
storageKey
|
|
21071
21066
|
}) {
|
|
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] =
|
|
21067
|
+
const allLeafColumns = React66.useMemo(() => getLeafColumns(columns), [columns]);
|
|
21068
|
+
const defaultVisibleLeafKeys = React66.useMemo(() => allLeafColumns.filter((column) => column.visible !== false).map((column) => column.key), [allLeafColumns]);
|
|
21069
|
+
const knownLeafKeysRef = React66.useRef(new Set(defaultVisibleLeafKeys));
|
|
21070
|
+
const [headerAlign, setHeaderAlign] = React66.useState("left");
|
|
21071
|
+
const [visibleCols, setVisibleCols] = React66.useState(defaultVisibleLeafKeys);
|
|
21072
|
+
const [filters, setFilters] = React66.useState({});
|
|
21073
|
+
const [sort, setSort] = React66.useState(null);
|
|
21074
|
+
const [density, setDensity] = React66.useState(() => SIZE_TO_DENSITY[size]);
|
|
21075
|
+
const [curPage, setCurPage] = React66.useState(page);
|
|
21081
21076
|
const { curPageSize, setCurPageSize } = usePageSizeStorage({ pageSize, storageKey });
|
|
21082
|
-
|
|
21077
|
+
React66.useEffect(() => {
|
|
21083
21078
|
const knownLeafKeys = knownLeafKeysRef.current;
|
|
21084
21079
|
setVisibleCols((prev) => {
|
|
21085
21080
|
const prevSet = new Set(prev);
|
|
@@ -21087,10 +21082,10 @@ function useDataTableState({
|
|
|
21087
21082
|
});
|
|
21088
21083
|
knownLeafKeysRef.current = new Set(allLeafColumns.map((column) => column.key));
|
|
21089
21084
|
}, [allLeafColumns]);
|
|
21090
|
-
|
|
21085
|
+
React66.useEffect(() => {
|
|
21091
21086
|
setCurPage(page);
|
|
21092
21087
|
}, [page]);
|
|
21093
|
-
|
|
21088
|
+
React66.useEffect(() => {
|
|
21094
21089
|
setDensity(SIZE_TO_DENSITY[size]);
|
|
21095
21090
|
}, [size]);
|
|
21096
21091
|
return {
|
|
@@ -21112,7 +21107,7 @@ function useDataTableState({
|
|
|
21112
21107
|
}
|
|
21113
21108
|
|
|
21114
21109
|
// src/components/DataTable/hooks/useStickyColumns.ts
|
|
21115
|
-
import
|
|
21110
|
+
import React67 from "react";
|
|
21116
21111
|
|
|
21117
21112
|
// src/components/DataTable/utils/sticky.ts
|
|
21118
21113
|
function buildStickyLayout(visibleColumns) {
|
|
@@ -21159,8 +21154,8 @@ function resolveGroupStickyPosition(column, positions) {
|
|
|
21159
21154
|
|
|
21160
21155
|
// src/components/DataTable/hooks/useStickyColumns.ts
|
|
21161
21156
|
function useStickyColumns(visibleColumns) {
|
|
21162
|
-
const { positions, leftBoundaryKey, rightBoundaryKey } =
|
|
21163
|
-
const getStickyColumnStyle =
|
|
21157
|
+
const { positions, leftBoundaryKey, rightBoundaryKey } = React67.useMemo(() => buildStickyLayout(visibleColumns), [visibleColumns]);
|
|
21158
|
+
const getStickyColumnStyle = React67.useCallback(
|
|
21164
21159
|
(col) => {
|
|
21165
21160
|
const pos = resolveStickyPosition(col, positions);
|
|
21166
21161
|
if (!pos) return {};
|
|
@@ -21171,7 +21166,7 @@ function useStickyColumns(visibleColumns) {
|
|
|
21171
21166
|
},
|
|
21172
21167
|
[positions]
|
|
21173
21168
|
);
|
|
21174
|
-
const getBoundaryShadowClass =
|
|
21169
|
+
const getBoundaryShadowClass = React67.useCallback(
|
|
21175
21170
|
(col) => {
|
|
21176
21171
|
if (col.fixed === "left" && col.key === leftBoundaryKey) {
|
|
21177
21172
|
return "border-r border-border/80 shadow-[10px_0_16px_-10px_rgba(0,0,0,0.55)]";
|
|
@@ -21183,14 +21178,14 @@ function useStickyColumns(visibleColumns) {
|
|
|
21183
21178
|
},
|
|
21184
21179
|
[leftBoundaryKey, rightBoundaryKey]
|
|
21185
21180
|
);
|
|
21186
|
-
const getStickyHeaderClass =
|
|
21181
|
+
const getStickyHeaderClass = React67.useCallback(
|
|
21187
21182
|
(col) => {
|
|
21188
21183
|
if (!col.fixed) return "";
|
|
21189
21184
|
return cn("sticky", col.fixed === "left" && "left-0", col.fixed === "right" && "right-0", getBoundaryShadowClass(col), "z-50 !bg-muted");
|
|
21190
21185
|
},
|
|
21191
21186
|
[getBoundaryShadowClass]
|
|
21192
21187
|
);
|
|
21193
|
-
const getStickyCellClass =
|
|
21188
|
+
const getStickyCellClass = React67.useCallback(
|
|
21194
21189
|
(col, isStripedRow) => {
|
|
21195
21190
|
if (!col.fixed) return "";
|
|
21196
21191
|
return cn(
|
|
@@ -21203,7 +21198,7 @@ function useStickyColumns(visibleColumns) {
|
|
|
21203
21198
|
},
|
|
21204
21199
|
[getBoundaryShadowClass]
|
|
21205
21200
|
);
|
|
21206
|
-
const getStickyHeaderCellStyle =
|
|
21201
|
+
const getStickyHeaderCellStyle = React67.useCallback(
|
|
21207
21202
|
(headerCell) => {
|
|
21208
21203
|
const col = headerCell.column;
|
|
21209
21204
|
if (headerCell.isLeaf) {
|
|
@@ -21350,7 +21345,7 @@ function DataTable({
|
|
|
21350
21345
|
size,
|
|
21351
21346
|
storageKey
|
|
21352
21347
|
});
|
|
21353
|
-
|
|
21348
|
+
React68.useEffect(() => {
|
|
21354
21349
|
if (process.env.NODE_ENV === "development") {
|
|
21355
21350
|
const warnings = validateColumns(columns);
|
|
21356
21351
|
warnings.forEach((w) => console.warn(`[DataTable] ${w}`));
|
|
@@ -21358,8 +21353,8 @@ function DataTable({
|
|
|
21358
21353
|
}, [columns]);
|
|
21359
21354
|
const debouncedFilters = useDebounced(filters, 350);
|
|
21360
21355
|
const isServerMode = Boolean(onQueryChange);
|
|
21361
|
-
const hasEmittedQuery =
|
|
21362
|
-
|
|
21356
|
+
const hasEmittedQuery = React68.useRef(false);
|
|
21357
|
+
React68.useEffect(() => {
|
|
21363
21358
|
if (!onQueryChange) return;
|
|
21364
21359
|
if (!hasEmittedQuery.current) {
|
|
21365
21360
|
hasEmittedQuery.current = true;
|
|
@@ -21367,7 +21362,7 @@ function DataTable({
|
|
|
21367
21362
|
}
|
|
21368
21363
|
onQueryChange({ filters: debouncedFilters, sort, page: curPage, pageSize: curPageSize });
|
|
21369
21364
|
}, [debouncedFilters, sort, curPage, curPageSize, onQueryChange]);
|
|
21370
|
-
|
|
21365
|
+
React68.useEffect(() => {
|
|
21371
21366
|
if (process.env.NODE_ENV !== "development" || rowKey) return;
|
|
21372
21367
|
const hasQueryFeatures = columns.some((column) => column.sortable || column.filter) || Boolean(pageSizeOptions?.length) || isServerMode;
|
|
21373
21368
|
if (!hasQueryFeatures) return;
|
|
@@ -21395,7 +21390,7 @@ function DataTable({
|
|
|
21395
21390
|
if (typeof rowKey === "function") return String(rowKey(row));
|
|
21396
21391
|
return String(row[rowKey]);
|
|
21397
21392
|
};
|
|
21398
|
-
const viewportRef =
|
|
21393
|
+
const viewportRef = React68.useRef(null);
|
|
21399
21394
|
useOverlayScrollbarTarget(viewportRef, { enabled: useOverlayScrollbar });
|
|
21400
21395
|
return /* @__PURE__ */ jsxs63("div", { className: cn("space-y-2", className), children: [
|
|
21401
21396
|
/* @__PURE__ */ jsx72(
|
|
@@ -21501,10 +21496,10 @@ function DataTable({
|
|
|
21501
21496
|
var DataTable_default = DataTable;
|
|
21502
21497
|
|
|
21503
21498
|
// src/components/Form.tsx
|
|
21504
|
-
import * as
|
|
21499
|
+
import * as React69 from "react";
|
|
21505
21500
|
import { Controller, FormProvider, useFormContext, useForm } from "react-hook-form";
|
|
21506
21501
|
import { jsx as jsx73, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
21507
|
-
var FormConfigContext =
|
|
21502
|
+
var FormConfigContext = React69.createContext({ size: "md" });
|
|
21508
21503
|
var FormWrapper = ({
|
|
21509
21504
|
children,
|
|
21510
21505
|
onSubmit,
|
|
@@ -21517,7 +21512,7 @@ var FormWrapper = ({
|
|
|
21517
21512
|
const methods = useForm({
|
|
21518
21513
|
defaultValues: initialValues
|
|
21519
21514
|
});
|
|
21520
|
-
|
|
21515
|
+
React69.useEffect(() => {
|
|
21521
21516
|
if (initialValues) {
|
|
21522
21517
|
methods.reset(initialValues);
|
|
21523
21518
|
}
|
|
@@ -21526,23 +21521,18 @@ var FormWrapper = ({
|
|
|
21526
21521
|
return /* @__PURE__ */ jsx73(FormProvider, { ...methods, children: /* @__PURE__ */ jsx73(FormConfigContext.Provider, { value: { size }, children: /* @__PURE__ */ jsx73("form", { onSubmit: methods.handleSubmit(onSubmit), className, ...formProps, children }) }) });
|
|
21527
21522
|
};
|
|
21528
21523
|
var Form = FormWrapper;
|
|
21529
|
-
var FormFieldContext =
|
|
21524
|
+
var FormFieldContext = React69.createContext({});
|
|
21530
21525
|
var FormField = ({
|
|
21531
21526
|
...props
|
|
21532
21527
|
}) => {
|
|
21533
21528
|
return /* @__PURE__ */ jsx73(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx73(Controller, { ...props }) });
|
|
21534
21529
|
};
|
|
21535
21530
|
var useFormField = () => {
|
|
21536
|
-
const fieldContext =
|
|
21537
|
-
const itemContext =
|
|
21531
|
+
const fieldContext = React69.useContext(FormFieldContext);
|
|
21532
|
+
const itemContext = React69.useContext(FormItemContext);
|
|
21538
21533
|
const { getFieldState, formState } = useFormContext();
|
|
21539
21534
|
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
|
-
}
|
|
21535
|
+
throw new Error("useFormField must be used within FormField");
|
|
21546
21536
|
}
|
|
21547
21537
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
21548
21538
|
const { id } = itemContext;
|
|
@@ -21555,16 +21545,16 @@ var useFormField = () => {
|
|
|
21555
21545
|
...fieldState
|
|
21556
21546
|
};
|
|
21557
21547
|
};
|
|
21558
|
-
var FormItemContext =
|
|
21559
|
-
var FormItem =
|
|
21560
|
-
const id =
|
|
21548
|
+
var FormItemContext = React69.createContext({});
|
|
21549
|
+
var FormItem = React69.forwardRef(({ className, ...props }, ref) => {
|
|
21550
|
+
const id = React69.useId();
|
|
21561
21551
|
return /* @__PURE__ */ jsx73(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx73("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
21562
21552
|
});
|
|
21563
21553
|
FormItem.displayName = "FormItem";
|
|
21564
|
-
var FormLabel =
|
|
21554
|
+
var FormLabel = React69.forwardRef(
|
|
21565
21555
|
({ className, children, required, ...props }, ref) => {
|
|
21566
21556
|
const { error, formItemId } = useFormField();
|
|
21567
|
-
const config =
|
|
21557
|
+
const config = React69.useContext(FormConfigContext);
|
|
21568
21558
|
const sizeClass = config.size === "sm" ? "text-xs" : config.size === "lg" ? "text-base" : "text-sm";
|
|
21569
21559
|
return /* @__PURE__ */ jsxs64(Label, { ref, className: cn(sizeClass, error && "text-destructive", className), htmlFor: formItemId, ...props, children: [
|
|
21570
21560
|
children,
|
|
@@ -21573,7 +21563,7 @@ var FormLabel = React68.forwardRef(
|
|
|
21573
21563
|
}
|
|
21574
21564
|
);
|
|
21575
21565
|
FormLabel.displayName = "FormLabel";
|
|
21576
|
-
var FormControl =
|
|
21566
|
+
var FormControl = React69.forwardRef(({ ...props }, ref) => {
|
|
21577
21567
|
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
21578
21568
|
return /* @__PURE__ */ jsx73(
|
|
21579
21569
|
"div",
|
|
@@ -21587,12 +21577,12 @@ var FormControl = React68.forwardRef(({ ...props }, ref) => {
|
|
|
21587
21577
|
);
|
|
21588
21578
|
});
|
|
21589
21579
|
FormControl.displayName = "FormControl";
|
|
21590
|
-
var FormDescription =
|
|
21580
|
+
var FormDescription = React69.forwardRef(({ className, ...props }, ref) => {
|
|
21591
21581
|
const { formDescriptionId } = useFormField();
|
|
21592
21582
|
return /* @__PURE__ */ jsx73("p", { ref, id: formDescriptionId, className: cn("text-sm text-muted-foreground", className), ...props });
|
|
21593
21583
|
});
|
|
21594
21584
|
FormDescription.displayName = "FormDescription";
|
|
21595
|
-
var FormMessage =
|
|
21585
|
+
var FormMessage = React69.forwardRef(({ className, children, ...props }, ref) => {
|
|
21596
21586
|
const { error, formMessageId } = useFormField();
|
|
21597
21587
|
const body = error ? String(error?.message) : children;
|
|
21598
21588
|
if (!body) {
|
|
@@ -21601,7 +21591,7 @@ var FormMessage = React68.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
21601
21591
|
return /* @__PURE__ */ jsx73("p", { ref, id: formMessageId, className: cn("text-sm font-medium text-destructive", className), ...props, children: body });
|
|
21602
21592
|
});
|
|
21603
21593
|
FormMessage.displayName = "FormMessage";
|
|
21604
|
-
var FormInput =
|
|
21594
|
+
var FormInput = React69.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ jsx73(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ jsx73(
|
|
21605
21595
|
FormField,
|
|
21606
21596
|
{
|
|
21607
21597
|
name,
|
|
@@ -21612,7 +21602,7 @@ var FormInput = React68.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */
|
|
|
21612
21602
|
}
|
|
21613
21603
|
) }));
|
|
21614
21604
|
FormInput.displayName = "FormInput";
|
|
21615
|
-
var FormCheckbox =
|
|
21605
|
+
var FormCheckbox = React69.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ jsx73(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ jsx73(
|
|
21616
21606
|
FormField,
|
|
21617
21607
|
{
|
|
21618
21608
|
name,
|
|
@@ -21636,9 +21626,9 @@ var FormCheckbox = React68.forwardRef(({ name, ...props }, ref) => /* @__PURE__
|
|
|
21636
21626
|
}
|
|
21637
21627
|
) }));
|
|
21638
21628
|
FormCheckbox.displayName = "FormCheckbox";
|
|
21639
|
-
var FormActions =
|
|
21629
|
+
var FormActions = React69.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx73("div", { ref, className: cn("flex gap-2 justify-end", className), ...props }));
|
|
21640
21630
|
FormActions.displayName = "FormActions";
|
|
21641
|
-
var FormSubmitButton =
|
|
21631
|
+
var FormSubmitButton = React69.forwardRef(
|
|
21642
21632
|
({ 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
21633
|
);
|
|
21644
21634
|
FormSubmitButton.displayName = "FormSubmitButton";
|
|
@@ -21720,7 +21710,7 @@ function AccessDenied({
|
|
|
21720
21710
|
|
|
21721
21711
|
// src/components/ThemeToggleHeadless.tsx
|
|
21722
21712
|
import { Moon as Moon2, Sun as Sun2, Monitor } from "lucide-react";
|
|
21723
|
-
import { useEffect as
|
|
21713
|
+
import { useEffect as useEffect31, useRef as useRef28, useState as useState45 } from "react";
|
|
21724
21714
|
import { createPortal as createPortal7 } from "react-dom";
|
|
21725
21715
|
import { Fragment as Fragment26, jsx as jsx76, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
21726
21716
|
function ThemeToggleHeadless({
|
|
@@ -21733,7 +21723,7 @@ function ThemeToggleHeadless({
|
|
|
21733
21723
|
const [mounted, setMounted] = useState45(false);
|
|
21734
21724
|
const triggerRef = useRef28(null);
|
|
21735
21725
|
const [dropdownPosition, setDropdownPosition] = useState45(null);
|
|
21736
|
-
|
|
21726
|
+
useEffect31(() => setMounted(true), []);
|
|
21737
21727
|
const themes = [
|
|
21738
21728
|
{ value: "light", label: labels?.light ?? "Light", icon: Sun2 },
|
|
21739
21729
|
{ value: "dark", label: labels?.dark ?? "Dark", icon: Moon2 },
|
|
@@ -21929,7 +21919,7 @@ var VARIANT_STYLES_ALERT = {
|
|
|
21929
21919
|
};
|
|
21930
21920
|
|
|
21931
21921
|
// ../../lib/i18n/translation-adapter.tsx
|
|
21932
|
-
import * as
|
|
21922
|
+
import * as React71 from "react";
|
|
21933
21923
|
import { jsx as jsx78 } from "react/jsx-runtime";
|
|
21934
21924
|
var defaultTranslations2 = {
|
|
21935
21925
|
en: {
|
|
@@ -22294,9 +22284,9 @@ function resolveTranslationValue2(translations, namespace, key) {
|
|
|
22294
22284
|
const value = resolveObjectPath2(namespaceValue, key);
|
|
22295
22285
|
return typeof value === "string" ? value : null;
|
|
22296
22286
|
}
|
|
22297
|
-
var TranslationContext2 =
|
|
22287
|
+
var TranslationContext2 = React71.createContext(null);
|
|
22298
22288
|
var UnderverseProvider = ({ children, locale = "en", translations }) => {
|
|
22299
|
-
const t =
|
|
22289
|
+
const t = React71.useCallback(
|
|
22300
22290
|
(namespace) => {
|
|
22301
22291
|
return (key) => {
|
|
22302
22292
|
const mergedTranslations = {
|
|
@@ -22337,7 +22327,7 @@ function getInternalTranslation(namespace, locale) {
|
|
|
22337
22327
|
};
|
|
22338
22328
|
}
|
|
22339
22329
|
function useTranslations(namespace) {
|
|
22340
|
-
const underverseContext =
|
|
22330
|
+
const underverseContext = React71.useContext(TranslationContext2);
|
|
22341
22331
|
if (underverseContext) {
|
|
22342
22332
|
return (key, params) => {
|
|
22343
22333
|
const result = underverseContext.t(namespace)(key);
|
|
@@ -22354,7 +22344,7 @@ function useTranslations(namespace) {
|
|
|
22354
22344
|
return getInternalTranslation(namespace, "en");
|
|
22355
22345
|
}
|
|
22356
22346
|
function useLocale() {
|
|
22357
|
-
const underverseContext =
|
|
22347
|
+
const underverseContext = React71.useContext(TranslationContext2);
|
|
22358
22348
|
if (underverseContext) {
|
|
22359
22349
|
return underverseContext.locale;
|
|
22360
22350
|
}
|
|
@@ -22373,7 +22363,7 @@ function useLocale() {
|
|
|
22373
22363
|
}
|
|
22374
22364
|
|
|
22375
22365
|
// src/components/UEditor/UEditor.tsx
|
|
22376
|
-
import
|
|
22366
|
+
import React80, { useEffect as useEffect38, useImperativeHandle as useImperativeHandle3, useMemo as useMemo29, useRef as useRef36 } from "react";
|
|
22377
22367
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
22378
22368
|
|
|
22379
22369
|
// src/components/UEditor/extensions.ts
|
|
@@ -22414,7 +22404,7 @@ import { common, createLowlight } from "lowlight";
|
|
|
22414
22404
|
import { Extension } from "@tiptap/core";
|
|
22415
22405
|
import Suggestion from "@tiptap/suggestion";
|
|
22416
22406
|
import { ReactRenderer } from "@tiptap/react";
|
|
22417
|
-
import { forwardRef as forwardRef13, useEffect as
|
|
22407
|
+
import { forwardRef as forwardRef13, useEffect as useEffect32, useImperativeHandle, useRef as useRef30, useState as useState47 } from "react";
|
|
22418
22408
|
import {
|
|
22419
22409
|
FileCode as FileCode2,
|
|
22420
22410
|
Heading1,
|
|
@@ -22459,10 +22449,10 @@ var DEFAULT_MESSAGES = {
|
|
|
22459
22449
|
var CommandList = forwardRef13((props, ref) => {
|
|
22460
22450
|
const [selectedIndex, setSelectedIndex] = useState47(0);
|
|
22461
22451
|
const listRef = useRef30(null);
|
|
22462
|
-
|
|
22452
|
+
useEffect32(() => {
|
|
22463
22453
|
setSelectedIndex(0);
|
|
22464
22454
|
}, [props.items]);
|
|
22465
|
-
|
|
22455
|
+
useEffect32(() => {
|
|
22466
22456
|
const selectedElement = listRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
22467
22457
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
22468
22458
|
}, [selectedIndex, props.items]);
|
|
@@ -22787,7 +22777,7 @@ import { Extension as Extension3 } from "@tiptap/core";
|
|
|
22787
22777
|
import Suggestion2 from "@tiptap/suggestion";
|
|
22788
22778
|
import { ReactRenderer as ReactRenderer2 } from "@tiptap/react";
|
|
22789
22779
|
import { PluginKey } from "@tiptap/pm/state";
|
|
22790
|
-
import { forwardRef as forwardRef14, useEffect as
|
|
22780
|
+
import { forwardRef as forwardRef14, useEffect as useEffect33, useImperativeHandle as useImperativeHandle2, useState as useState48 } from "react";
|
|
22791
22781
|
import { Smile } from "lucide-react";
|
|
22792
22782
|
import tippy2 from "tippy.js";
|
|
22793
22783
|
|
|
@@ -23560,7 +23550,7 @@ var EMOJI_LIST = [
|
|
|
23560
23550
|
import { jsx as jsx80, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
23561
23551
|
var EmojiList = forwardRef14((props, ref) => {
|
|
23562
23552
|
const [selectedIndex, setSelectedIndex] = useState48(0);
|
|
23563
|
-
|
|
23553
|
+
useEffect33(() => {
|
|
23564
23554
|
setSelectedIndex(0);
|
|
23565
23555
|
}, [props.items]);
|
|
23566
23556
|
useImperativeHandle2(ref, () => ({
|
|
@@ -23768,7 +23758,7 @@ var UEditorPlaceholder = Extension4.create({
|
|
|
23768
23758
|
});
|
|
23769
23759
|
|
|
23770
23760
|
// src/components/UEditor/resizable-image.tsx
|
|
23771
|
-
import { useEffect as
|
|
23761
|
+
import { useEffect as useEffect34, useRef as useRef31, useState as useState49 } from "react";
|
|
23772
23762
|
import Image3 from "@tiptap/extension-image";
|
|
23773
23763
|
import { mergeAttributes } from "@tiptap/core";
|
|
23774
23764
|
import { NodeViewWrapper, ReactNodeViewRenderer } from "@tiptap/react";
|
|
@@ -23796,7 +23786,7 @@ function ResizableImageNodeView(props) {
|
|
|
23796
23786
|
const heightAttr = toNullableNumber(node.attrs["height"]);
|
|
23797
23787
|
const textAlign = String(node.attrs["textAlign"] ?? "");
|
|
23798
23788
|
const dragStateRef = useRef31(null);
|
|
23799
|
-
|
|
23789
|
+
useEffect34(() => {
|
|
23800
23790
|
const img = imgRef.current;
|
|
23801
23791
|
if (!img) return;
|
|
23802
23792
|
img.style.width = widthAttr ? `${widthAttr}px` : "";
|
|
@@ -24127,7 +24117,7 @@ function buildUEditorExtensions({
|
|
|
24127
24117
|
}
|
|
24128
24118
|
|
|
24129
24119
|
// src/components/UEditor/toolbar.tsx
|
|
24130
|
-
import
|
|
24120
|
+
import React78, { useRef as useRef34, useState as useState52 } from "react";
|
|
24131
24121
|
import {
|
|
24132
24122
|
AlignCenter,
|
|
24133
24123
|
AlignJustify,
|
|
@@ -24228,7 +24218,7 @@ var EditorColorPalette = ({
|
|
|
24228
24218
|
] });
|
|
24229
24219
|
|
|
24230
24220
|
// src/components/UEditor/inputs.tsx
|
|
24231
|
-
import { useEffect as
|
|
24221
|
+
import { useEffect as useEffect35, useRef as useRef32, useState as useState50 } from "react";
|
|
24232
24222
|
import { Check as Check10, X as X18 } from "lucide-react";
|
|
24233
24223
|
import { jsx as jsx83, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
24234
24224
|
function normalizeUrl(raw) {
|
|
@@ -24246,7 +24236,7 @@ var LinkInput = ({
|
|
|
24246
24236
|
const t = useSmartTranslations("UEditor");
|
|
24247
24237
|
const [url, setUrl] = useState50(initialUrl);
|
|
24248
24238
|
const inputRef = useRef32(null);
|
|
24249
|
-
|
|
24239
|
+
useEffect35(() => {
|
|
24250
24240
|
inputRef.current?.focus();
|
|
24251
24241
|
inputRef.current?.select();
|
|
24252
24242
|
}, []);
|
|
@@ -24276,7 +24266,7 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
24276
24266
|
const [url, setUrl] = useState50("");
|
|
24277
24267
|
const [alt, setAlt] = useState50("");
|
|
24278
24268
|
const inputRef = useRef32(null);
|
|
24279
|
-
|
|
24269
|
+
useEffect35(() => {
|
|
24280
24270
|
inputRef.current?.focus();
|
|
24281
24271
|
}, []);
|
|
24282
24272
|
const handleSubmit = (e) => {
|
|
@@ -24329,7 +24319,7 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
24329
24319
|
};
|
|
24330
24320
|
|
|
24331
24321
|
// src/components/UEditor/emoji-picker.tsx
|
|
24332
|
-
import { useState as useState51, useMemo as useMemo27, useRef as useRef33, useEffect as
|
|
24322
|
+
import { useState as useState51, useMemo as useMemo27, useRef as useRef33, useEffect as useEffect36 } from "react";
|
|
24333
24323
|
import { Search as Search6, X as X19, Smile as Smile2, Leaf, Utensils, Dumbbell, Lightbulb, Hash, Flag } from "lucide-react";
|
|
24334
24324
|
import { jsx as jsx84, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
24335
24325
|
var CATEGORY_ICONS = {
|
|
@@ -24362,7 +24352,7 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
24362
24352
|
onSelect(emoji);
|
|
24363
24353
|
setSearch("");
|
|
24364
24354
|
};
|
|
24365
|
-
|
|
24355
|
+
useEffect36(() => {
|
|
24366
24356
|
if (search) return;
|
|
24367
24357
|
const container = scrollContainerRef.current;
|
|
24368
24358
|
if (!container) return;
|
|
@@ -24402,7 +24392,7 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
24402
24392
|
isUserScrolling.current = true;
|
|
24403
24393
|
}, 500);
|
|
24404
24394
|
};
|
|
24405
|
-
|
|
24395
|
+
useEffect36(() => {
|
|
24406
24396
|
isUserScrolling.current = true;
|
|
24407
24397
|
}, []);
|
|
24408
24398
|
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 +24511,7 @@ function fileToDataUrl2(file) {
|
|
|
24521
24511
|
reader.readAsDataURL(file);
|
|
24522
24512
|
});
|
|
24523
24513
|
}
|
|
24524
|
-
var ToolbarButton =
|
|
24514
|
+
var ToolbarButton = React78.forwardRef(({ onClick, onMouseDown, active, disabled, children, title, className }, ref) => {
|
|
24525
24515
|
const button = /* @__PURE__ */ jsx85(
|
|
24526
24516
|
"button",
|
|
24527
24517
|
{
|
|
@@ -25010,7 +25000,7 @@ var EditorToolbar = ({
|
|
|
25010
25000
|
};
|
|
25011
25001
|
|
|
25012
25002
|
// src/components/UEditor/menus.tsx
|
|
25013
|
-
import { useCallback as useCallback21, useEffect as
|
|
25003
|
+
import { useCallback as useCallback21, useEffect as useEffect37, useMemo as useMemo28, useRef as useRef35, useState as useState53 } from "react";
|
|
25014
25004
|
import { createPortal as createPortal9 } from "react-dom";
|
|
25015
25005
|
import {
|
|
25016
25006
|
Bold as BoldIcon2,
|
|
@@ -25116,10 +25106,10 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
25116
25106
|
const lowerFilter = filterText.toLowerCase();
|
|
25117
25107
|
return allCommands.filter((cmd) => cmd.label.toLowerCase().includes(lowerFilter) || cmd.description.toLowerCase().includes(lowerFilter));
|
|
25118
25108
|
}, [allCommands, filterText]);
|
|
25119
|
-
|
|
25109
|
+
useEffect37(() => {
|
|
25120
25110
|
setSelectedIndex(0);
|
|
25121
25111
|
}, [filterText]);
|
|
25122
|
-
|
|
25112
|
+
useEffect37(() => {
|
|
25123
25113
|
const selectedElement = menuRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
25124
25114
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
25125
25115
|
}, [selectedIndex]);
|
|
@@ -25133,7 +25123,7 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
25133
25123
|
},
|
|
25134
25124
|
[commands, onClose]
|
|
25135
25125
|
);
|
|
25136
|
-
|
|
25126
|
+
useEffect37(() => {
|
|
25137
25127
|
const handleKeyDown = (e) => {
|
|
25138
25128
|
if (commands.length === 0) return;
|
|
25139
25129
|
if (e.key === "ArrowDown") {
|
|
@@ -25218,10 +25208,10 @@ var BubbleMenuContent = ({
|
|
|
25218
25208
|
const { textColors, highlightColors } = useEditorColors();
|
|
25219
25209
|
const [showLinkInput, setShowLinkInput] = useState53(false);
|
|
25220
25210
|
const [showEditorColorPalette, setShowEditorColorPalette] = useState53(false);
|
|
25221
|
-
|
|
25211
|
+
useEffect37(() => {
|
|
25222
25212
|
onKeepOpenChange?.(showLinkInput);
|
|
25223
25213
|
}, [onKeepOpenChange, showLinkInput]);
|
|
25224
|
-
|
|
25214
|
+
useEffect37(() => {
|
|
25225
25215
|
if (!showLinkInput) return;
|
|
25226
25216
|
const close = () => setShowLinkInput(false);
|
|
25227
25217
|
editor.on("selectionUpdate", close);
|
|
@@ -25352,7 +25342,7 @@ var CustomBubbleMenu = ({ editor }) => {
|
|
|
25352
25342
|
keepOpenRef.current = next;
|
|
25353
25343
|
if (next) setIsVisible(true);
|
|
25354
25344
|
}, []);
|
|
25355
|
-
|
|
25345
|
+
useEffect37(() => {
|
|
25356
25346
|
const updatePosition = () => {
|
|
25357
25347
|
const { state, view } = editor;
|
|
25358
25348
|
const { from, to, empty } = state.selection;
|
|
@@ -25407,7 +25397,7 @@ var CustomBubbleMenu = ({ editor }) => {
|
|
|
25407
25397
|
var CustomFloatingMenu = ({ editor }) => {
|
|
25408
25398
|
const [isVisible, setIsVisible] = useState53(false);
|
|
25409
25399
|
const [position, setPosition] = useState53({ top: 0, left: 0 });
|
|
25410
|
-
|
|
25400
|
+
useEffect37(() => {
|
|
25411
25401
|
const updatePosition = () => {
|
|
25412
25402
|
const { state, view } = editor;
|
|
25413
25403
|
const { $from, empty } = state.selection;
|
|
@@ -25726,7 +25716,7 @@ async function prepareUEditorContentForSave({
|
|
|
25726
25716
|
|
|
25727
25717
|
// src/components/UEditor/UEditor.tsx
|
|
25728
25718
|
import { jsx as jsx87, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
25729
|
-
var UEditor =
|
|
25719
|
+
var UEditor = React80.forwardRef(({
|
|
25730
25720
|
content = "",
|
|
25731
25721
|
onChange,
|
|
25732
25722
|
onHtmlChange,
|
|
@@ -25890,7 +25880,7 @@ var UEditor = React79.forwardRef(({
|
|
|
25890
25880
|
}),
|
|
25891
25881
|
[content, editor, uploadImageForSave]
|
|
25892
25882
|
);
|
|
25893
|
-
|
|
25883
|
+
useEffect38(() => {
|
|
25894
25884
|
if (editor && content !== editor.getHTML()) {
|
|
25895
25885
|
if (editor.isEmpty && content) {
|
|
25896
25886
|
editor.commands.setContent(content);
|