@underverse-ui/underverse 1.0.26 → 1.0.28
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/README.md +18 -0
- package/dist/index.cjs +243 -145
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +126 -29
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -107,6 +107,7 @@ __export(index_exports, {
|
|
|
107
107
|
NotificationModal: () => NotificationModal_default,
|
|
108
108
|
NumberInput: () => NumberInput,
|
|
109
109
|
OverlayControls: () => OverlayControls,
|
|
110
|
+
OverlayScrollbarProvider: () => OverlayScrollbarProvider,
|
|
110
111
|
PageLoading: () => PageLoading,
|
|
111
112
|
Pagination: () => Pagination,
|
|
112
113
|
PasswordInput: () => PasswordInput,
|
|
@@ -421,7 +422,7 @@ var Badge = ({
|
|
|
421
422
|
onRemove?.();
|
|
422
423
|
};
|
|
423
424
|
const baseClasses = cn(
|
|
424
|
-
"inline-flex items-center border transition-all duration-200",
|
|
425
|
+
"inline-flex items-center rounded-md border transition-all duration-200 tracking-wide",
|
|
425
426
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1",
|
|
426
427
|
variantStyles[variant],
|
|
427
428
|
clickable && clickableVariantStyles[variant],
|
|
@@ -468,7 +469,7 @@ var Badge = ({
|
|
|
468
469
|
}
|
|
469
470
|
);
|
|
470
471
|
}
|
|
471
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: cn(baseClasses, "
|
|
472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: cn(baseClasses, "gap-1", sizeStyles[size], className), onClick: handleClick, role: "status", children: [
|
|
472
473
|
Icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
473
474
|
Icon,
|
|
474
475
|
{
|
|
@@ -19014,10 +19015,106 @@ var LoadingBar = ({
|
|
|
19014
19015
|
);
|
|
19015
19016
|
};
|
|
19016
19017
|
|
|
19018
|
+
// ../../components/ui/OverlayScrollbarProvider.tsx
|
|
19019
|
+
var import_react33 = require("react");
|
|
19020
|
+
var import_overlayscrollbars = require("overlayscrollbars");
|
|
19021
|
+
var SCROLLABLE_SELECTOR = [
|
|
19022
|
+
".overflow-auto",
|
|
19023
|
+
".overflow-x-auto",
|
|
19024
|
+
".overflow-y-auto",
|
|
19025
|
+
".overflow-scroll",
|
|
19026
|
+
".overflow-x-scroll",
|
|
19027
|
+
".overflow-y-scroll",
|
|
19028
|
+
".thin-scrollbar",
|
|
19029
|
+
".scrollbar-thin",
|
|
19030
|
+
".custom-scrollbar"
|
|
19031
|
+
].join(", ");
|
|
19032
|
+
var SCROLLBAR_OPTIONS = {
|
|
19033
|
+
scrollbars: {
|
|
19034
|
+
theme: "os-theme-underverse",
|
|
19035
|
+
visibility: "auto",
|
|
19036
|
+
autoHide: "leave",
|
|
19037
|
+
autoHideDelay: 600,
|
|
19038
|
+
dragScroll: true,
|
|
19039
|
+
clickScroll: false
|
|
19040
|
+
}
|
|
19041
|
+
};
|
|
19042
|
+
function OverlayScrollbarProvider() {
|
|
19043
|
+
(0, import_react33.useEffect)(() => {
|
|
19044
|
+
const bodyInstance = (0, import_overlayscrollbars.OverlayScrollbars)(document.body, SCROLLBAR_OPTIONS);
|
|
19045
|
+
const instances = /* @__PURE__ */ new Map();
|
|
19046
|
+
const shouldSkip = (element) => {
|
|
19047
|
+
if (element === document.body) return true;
|
|
19048
|
+
if (element.classList.contains("scrollbar-none")) return true;
|
|
19049
|
+
if (element.hasAttribute("data-overlayscrollbars")) return true;
|
|
19050
|
+
return false;
|
|
19051
|
+
};
|
|
19052
|
+
const initElement = (element) => {
|
|
19053
|
+
if (shouldSkip(element)) return;
|
|
19054
|
+
if (instances.has(element)) return;
|
|
19055
|
+
instances.set(element, (0, import_overlayscrollbars.OverlayScrollbars)(element, SCROLLBAR_OPTIONS));
|
|
19056
|
+
};
|
|
19057
|
+
const collectCandidates = (root) => {
|
|
19058
|
+
const candidates = [];
|
|
19059
|
+
if (root instanceof HTMLElement && root.matches(SCROLLABLE_SELECTOR)) {
|
|
19060
|
+
candidates.push(root);
|
|
19061
|
+
}
|
|
19062
|
+
if ("querySelectorAll" in root) {
|
|
19063
|
+
root.querySelectorAll(SCROLLABLE_SELECTOR).forEach((element) => {
|
|
19064
|
+
candidates.push(element);
|
|
19065
|
+
});
|
|
19066
|
+
}
|
|
19067
|
+
return candidates.filter((element, index) => candidates.indexOf(element) === index);
|
|
19068
|
+
};
|
|
19069
|
+
const scan = (root) => {
|
|
19070
|
+
const candidates = collectCandidates(root).filter((element) => !shouldSkip(element));
|
|
19071
|
+
const leafCandidates = candidates.filter((element) => !candidates.some((other) => other !== element && element.contains(other)));
|
|
19072
|
+
leafCandidates.forEach(initElement);
|
|
19073
|
+
};
|
|
19074
|
+
const cleanup = () => {
|
|
19075
|
+
instances.forEach((instance, element) => {
|
|
19076
|
+
if (!element.isConnected) {
|
|
19077
|
+
instance.destroy();
|
|
19078
|
+
instances.delete(element);
|
|
19079
|
+
}
|
|
19080
|
+
});
|
|
19081
|
+
};
|
|
19082
|
+
scan(document.body);
|
|
19083
|
+
let rafId = 0;
|
|
19084
|
+
const observer = new MutationObserver((mutations) => {
|
|
19085
|
+
if (rafId) return;
|
|
19086
|
+
rafId = window.requestAnimationFrame(() => {
|
|
19087
|
+
rafId = 0;
|
|
19088
|
+
const scanRoots = /* @__PURE__ */ new Set();
|
|
19089
|
+
mutations.forEach((mutation) => {
|
|
19090
|
+
if (mutation.target instanceof Element || mutation.target instanceof Document || mutation.target instanceof DocumentFragment) {
|
|
19091
|
+
scanRoots.add(mutation.target);
|
|
19092
|
+
}
|
|
19093
|
+
mutation.addedNodes.forEach((node) => {
|
|
19094
|
+
if (node instanceof HTMLElement) {
|
|
19095
|
+
scanRoots.add(node);
|
|
19096
|
+
}
|
|
19097
|
+
});
|
|
19098
|
+
});
|
|
19099
|
+
scanRoots.forEach(scan);
|
|
19100
|
+
cleanup();
|
|
19101
|
+
});
|
|
19102
|
+
});
|
|
19103
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
19104
|
+
return () => {
|
|
19105
|
+
if (rafId) window.cancelAnimationFrame(rafId);
|
|
19106
|
+
observer.disconnect();
|
|
19107
|
+
instances.forEach((instance) => instance.destroy());
|
|
19108
|
+
bodyInstance.destroy();
|
|
19109
|
+
};
|
|
19110
|
+
}, []);
|
|
19111
|
+
return null;
|
|
19112
|
+
}
|
|
19113
|
+
|
|
19017
19114
|
// ../../components/ui/Table.tsx
|
|
19018
|
-
var
|
|
19115
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
19019
19116
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
19020
|
-
var Table =
|
|
19117
|
+
var Table = import_react34.default.forwardRef(({ className, containerClassName, disableContainer = false, ...props }, ref) => {
|
|
19021
19118
|
if (disableContainer) {
|
|
19022
19119
|
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("table", { ref, className: cn("w-full caption-bottom text-sm", className), ...props });
|
|
19023
19120
|
}
|
|
@@ -19036,16 +19133,16 @@ var Table = import_react33.default.forwardRef(({ className, containerClassName,
|
|
|
19036
19133
|
);
|
|
19037
19134
|
});
|
|
19038
19135
|
Table.displayName = "Table";
|
|
19039
|
-
var TableHeader =
|
|
19136
|
+
var TableHeader = import_react34.default.forwardRef(({ className, children, filterRow, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("thead", { ref, className: cn("[&_tr]:border-b [&_tr]:border-border", "bg-muted", className), ...props, children: [
|
|
19040
19137
|
children,
|
|
19041
19138
|
filterRow
|
|
19042
19139
|
] }));
|
|
19043
19140
|
TableHeader.displayName = "TableHeader";
|
|
19044
|
-
var TableBody =
|
|
19141
|
+
var TableBody = import_react34.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props }));
|
|
19045
19142
|
TableBody.displayName = "TableBody";
|
|
19046
|
-
var TableFooter =
|
|
19143
|
+
var TableFooter = import_react34.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("tfoot", { ref, className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className), ...props }));
|
|
19047
19144
|
TableFooter.displayName = "TableFooter";
|
|
19048
|
-
var TableRow =
|
|
19145
|
+
var TableRow = import_react34.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
19049
19146
|
"tr",
|
|
19050
19147
|
{
|
|
19051
19148
|
ref,
|
|
@@ -19059,7 +19156,7 @@ var TableRow = import_react33.default.forwardRef(({ className, ...props }, ref)
|
|
|
19059
19156
|
}
|
|
19060
19157
|
));
|
|
19061
19158
|
TableRow.displayName = "TableRow";
|
|
19062
|
-
var TableHead =
|
|
19159
|
+
var TableHead = import_react34.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
19063
19160
|
"th",
|
|
19064
19161
|
{
|
|
19065
19162
|
ref,
|
|
@@ -19068,14 +19165,14 @@ var TableHead = import_react33.default.forwardRef(({ className, ...props }, ref)
|
|
|
19068
19165
|
}
|
|
19069
19166
|
));
|
|
19070
19167
|
TableHead.displayName = "TableHead";
|
|
19071
|
-
var TableCell =
|
|
19168
|
+
var TableCell = import_react34.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("td", { ref, className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className), ...props }));
|
|
19072
19169
|
TableCell.displayName = "TableCell";
|
|
19073
|
-
var TableCaption =
|
|
19170
|
+
var TableCaption = import_react34.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("caption", { ref, className: cn("mt-4 text-sm text-muted-foreground", className), ...props }));
|
|
19074
19171
|
TableCaption.displayName = "TableCaption";
|
|
19075
19172
|
|
|
19076
19173
|
// ../../components/ui/DataTable/DataTable.tsx
|
|
19077
19174
|
var import_lucide_react34 = require("lucide-react");
|
|
19078
|
-
var
|
|
19175
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
19079
19176
|
|
|
19080
19177
|
// ../../components/ui/DataTable/components/Pagination.tsx
|
|
19081
19178
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
@@ -19361,10 +19458,10 @@ function DataTableToolbar({
|
|
|
19361
19458
|
}
|
|
19362
19459
|
|
|
19363
19460
|
// ../../components/ui/DataTable/hooks/useDebounced.ts
|
|
19364
|
-
var
|
|
19461
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
19365
19462
|
function useDebounced(value, delay = 300) {
|
|
19366
|
-
const [debounced, setDebounced] =
|
|
19367
|
-
|
|
19463
|
+
const [debounced, setDebounced] = import_react35.default.useState(value);
|
|
19464
|
+
import_react35.default.useEffect(() => {
|
|
19368
19465
|
const id = setTimeout(() => setDebounced(value), delay);
|
|
19369
19466
|
return () => clearTimeout(id);
|
|
19370
19467
|
}, [value, delay]);
|
|
@@ -19372,10 +19469,10 @@ function useDebounced(value, delay = 300) {
|
|
|
19372
19469
|
}
|
|
19373
19470
|
|
|
19374
19471
|
// ../../components/ui/DataTable/hooks/usePageSizeStorage.ts
|
|
19375
|
-
var
|
|
19472
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
19376
19473
|
function usePageSizeStorage({ pageSize, storageKey }) {
|
|
19377
|
-
const loadedFromStorage =
|
|
19378
|
-
const [curPageSize, setCurPageSize] =
|
|
19474
|
+
const loadedFromStorage = import_react36.default.useRef(false);
|
|
19475
|
+
const [curPageSize, setCurPageSize] = import_react36.default.useState(() => {
|
|
19379
19476
|
if (typeof window === "undefined" || !storageKey) return pageSize;
|
|
19380
19477
|
try {
|
|
19381
19478
|
const saved = localStorage.getItem(`datatable_${storageKey}_pageSize`);
|
|
@@ -19390,11 +19487,11 @@ function usePageSizeStorage({ pageSize, storageKey }) {
|
|
|
19390
19487
|
}
|
|
19391
19488
|
return pageSize;
|
|
19392
19489
|
});
|
|
19393
|
-
const hasMounted =
|
|
19394
|
-
|
|
19490
|
+
const hasMounted = import_react36.default.useRef(false);
|
|
19491
|
+
import_react36.default.useEffect(() => {
|
|
19395
19492
|
hasMounted.current = true;
|
|
19396
19493
|
}, []);
|
|
19397
|
-
|
|
19494
|
+
import_react36.default.useEffect(() => {
|
|
19398
19495
|
if (typeof window === "undefined" || !storageKey) return;
|
|
19399
19496
|
if (!hasMounted.current) return;
|
|
19400
19497
|
try {
|
|
@@ -19402,7 +19499,7 @@ function usePageSizeStorage({ pageSize, storageKey }) {
|
|
|
19402
19499
|
} catch {
|
|
19403
19500
|
}
|
|
19404
19501
|
}, [curPageSize, storageKey]);
|
|
19405
|
-
|
|
19502
|
+
import_react36.default.useEffect(() => {
|
|
19406
19503
|
if (storageKey && loadedFromStorage.current) return;
|
|
19407
19504
|
setCurPageSize(pageSize);
|
|
19408
19505
|
}, [pageSize, storageKey]);
|
|
@@ -19410,7 +19507,7 @@ function usePageSizeStorage({ pageSize, storageKey }) {
|
|
|
19410
19507
|
}
|
|
19411
19508
|
|
|
19412
19509
|
// ../../components/ui/DataTable/hooks/useStickyColumns.ts
|
|
19413
|
-
var
|
|
19510
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
19414
19511
|
|
|
19415
19512
|
// ../../components/ui/DataTable/utils/columns.ts
|
|
19416
19513
|
function getColumnWidth(col, fallback = 150) {
|
|
@@ -19428,9 +19525,9 @@ function getColumnWidth(col, fallback = 150) {
|
|
|
19428
19525
|
|
|
19429
19526
|
// ../../components/ui/DataTable/hooks/useStickyColumns.ts
|
|
19430
19527
|
function useStickyColumns(columns, visibleKeys) {
|
|
19431
|
-
const visibleColumns =
|
|
19432
|
-
const leafColumns =
|
|
19433
|
-
const stickyPositions =
|
|
19528
|
+
const visibleColumns = import_react37.default.useMemo(() => filterVisibleColumns(columns, visibleKeys), [columns, visibleKeys]);
|
|
19529
|
+
const leafColumns = import_react37.default.useMemo(() => getLeafColumnsWithFixedInheritance(visibleColumns), [visibleColumns]);
|
|
19530
|
+
const stickyPositions = import_react37.default.useMemo(() => {
|
|
19434
19531
|
const positions = {};
|
|
19435
19532
|
let leftOffset = 0;
|
|
19436
19533
|
for (const col of leafColumns) {
|
|
@@ -19449,7 +19546,7 @@ function useStickyColumns(columns, visibleKeys) {
|
|
|
19449
19546
|
}
|
|
19450
19547
|
return positions;
|
|
19451
19548
|
}, [leafColumns]);
|
|
19452
|
-
const { leftBoundaryKey, rightBoundaryKey } =
|
|
19549
|
+
const { leftBoundaryKey, rightBoundaryKey } = import_react37.default.useMemo(() => {
|
|
19453
19550
|
const leftFixed = leafColumns.filter((c) => c.fixed === "left");
|
|
19454
19551
|
const rightFixed = leafColumns.filter((c) => c.fixed === "right");
|
|
19455
19552
|
return {
|
|
@@ -19457,7 +19554,7 @@ function useStickyColumns(columns, visibleKeys) {
|
|
|
19457
19554
|
rightBoundaryKey: rightFixed.length > 0 ? rightFixed[0].key : null
|
|
19458
19555
|
};
|
|
19459
19556
|
}, [leafColumns]);
|
|
19460
|
-
const getStickyColumnStyle =
|
|
19557
|
+
const getStickyColumnStyle = import_react37.default.useCallback(
|
|
19461
19558
|
(col) => {
|
|
19462
19559
|
if (!col.fixed) return {};
|
|
19463
19560
|
const pos = stickyPositions[col.key];
|
|
@@ -19468,7 +19565,7 @@ function useStickyColumns(columns, visibleKeys) {
|
|
|
19468
19565
|
},
|
|
19469
19566
|
[stickyPositions]
|
|
19470
19567
|
);
|
|
19471
|
-
const getBoundaryShadowClass =
|
|
19568
|
+
const getBoundaryShadowClass = import_react37.default.useCallback(
|
|
19472
19569
|
(col) => {
|
|
19473
19570
|
if (col.fixed === "left" && col.key === leftBoundaryKey) {
|
|
19474
19571
|
return "border-r border-border/80 shadow-[10px_0_16px_-10px_rgba(0,0,0,0.55)]";
|
|
@@ -19480,14 +19577,14 @@ function useStickyColumns(columns, visibleKeys) {
|
|
|
19480
19577
|
},
|
|
19481
19578
|
[leftBoundaryKey, rightBoundaryKey]
|
|
19482
19579
|
);
|
|
19483
|
-
const getStickyHeaderClass =
|
|
19580
|
+
const getStickyHeaderClass = import_react37.default.useCallback(
|
|
19484
19581
|
(col) => {
|
|
19485
19582
|
if (!col.fixed) return "";
|
|
19486
19583
|
return cn("sticky", col.fixed === "left" && "left-0", col.fixed === "right" && "right-0", getBoundaryShadowClass(col), "z-50 !bg-muted");
|
|
19487
19584
|
},
|
|
19488
19585
|
[getBoundaryShadowClass]
|
|
19489
19586
|
);
|
|
19490
|
-
const getStickyCellClass =
|
|
19587
|
+
const getStickyCellClass = import_react37.default.useCallback(
|
|
19491
19588
|
(col, isStripedRow) => {
|
|
19492
19589
|
if (!col.fixed) return "";
|
|
19493
19590
|
return cn(
|
|
@@ -19500,7 +19597,7 @@ function useStickyColumns(columns, visibleKeys) {
|
|
|
19500
19597
|
},
|
|
19501
19598
|
[getBoundaryShadowClass]
|
|
19502
19599
|
);
|
|
19503
|
-
const getStickyHeaderCellStyle =
|
|
19600
|
+
const getStickyHeaderCellStyle = import_react37.default.useCallback(
|
|
19504
19601
|
(headerCell) => {
|
|
19505
19602
|
const col = headerCell.column;
|
|
19506
19603
|
if (headerCell.isLeaf) {
|
|
@@ -19637,20 +19734,20 @@ function DataTable({
|
|
|
19637
19734
|
labels
|
|
19638
19735
|
}) {
|
|
19639
19736
|
const t = useTranslations("Common");
|
|
19640
|
-
const [headerAlign, setHeaderAlign] =
|
|
19641
|
-
const [visibleCols, setVisibleCols] =
|
|
19642
|
-
const [filters, setFilters] =
|
|
19643
|
-
const [sort, setSort] =
|
|
19644
|
-
const [density, setDensity] =
|
|
19645
|
-
const [curPage, setCurPage] =
|
|
19737
|
+
const [headerAlign, setHeaderAlign] = import_react38.default.useState("left");
|
|
19738
|
+
const [visibleCols, setVisibleCols] = import_react38.default.useState(() => columns.filter((c) => c.visible !== false).map((c) => c.key));
|
|
19739
|
+
const [filters, setFilters] = import_react38.default.useState({});
|
|
19740
|
+
const [sort, setSort] = import_react38.default.useState(null);
|
|
19741
|
+
const [density, setDensity] = import_react38.default.useState(() => SIZE_TO_DENSITY[size]);
|
|
19742
|
+
const [curPage, setCurPage] = import_react38.default.useState(page);
|
|
19646
19743
|
const { curPageSize, setCurPageSize } = usePageSizeStorage({ pageSize, storageKey });
|
|
19647
|
-
|
|
19744
|
+
import_react38.default.useEffect(() => {
|
|
19648
19745
|
if (process.env.NODE_ENV === "development") {
|
|
19649
19746
|
const warnings = validateColumns(columns);
|
|
19650
19747
|
warnings.forEach((w) => console.warn(`[DataTable] ${w}`));
|
|
19651
19748
|
}
|
|
19652
19749
|
}, [columns]);
|
|
19653
|
-
|
|
19750
|
+
import_react38.default.useEffect(() => {
|
|
19654
19751
|
const newColKeys = columns.filter((c) => c.visible !== false).map((c) => c.key);
|
|
19655
19752
|
setVisibleCols((prev) => {
|
|
19656
19753
|
const uniqueKeys = /* @__PURE__ */ new Set([...prev, ...newColKeys]);
|
|
@@ -19658,15 +19755,15 @@ function DataTable({
|
|
|
19658
19755
|
});
|
|
19659
19756
|
}, [columns]);
|
|
19660
19757
|
const debouncedFilters = useDebounced(filters, 350);
|
|
19661
|
-
|
|
19758
|
+
import_react38.default.useEffect(() => {
|
|
19662
19759
|
setCurPage(page);
|
|
19663
19760
|
}, [page]);
|
|
19664
|
-
|
|
19761
|
+
import_react38.default.useEffect(() => {
|
|
19665
19762
|
setDensity(SIZE_TO_DENSITY[size]);
|
|
19666
19763
|
}, [size]);
|
|
19667
19764
|
const isServerMode = Boolean(onQueryChange);
|
|
19668
|
-
const hasEmittedQuery =
|
|
19669
|
-
|
|
19765
|
+
const hasEmittedQuery = import_react38.default.useRef(false);
|
|
19766
|
+
import_react38.default.useEffect(() => {
|
|
19670
19767
|
if (!onQueryChange) return;
|
|
19671
19768
|
if (!hasEmittedQuery.current) {
|
|
19672
19769
|
hasEmittedQuery.current = true;
|
|
@@ -19679,14 +19776,14 @@ function DataTable({
|
|
|
19679
19776
|
const headerTitleClass = size === "sm" ? "text-xs" : size === "lg" ? "text-[15px]" : "text-sm";
|
|
19680
19777
|
const headerMinHeightClass = size === "sm" ? "min-h-9" : size === "lg" ? "min-h-11" : "min-h-10";
|
|
19681
19778
|
const sortIconClass = size === "sm" ? "w-3.5 h-3.5" : size === "lg" ? "w-4 h-4" : "w-3.5 h-3.5";
|
|
19682
|
-
const visibleColsSet =
|
|
19683
|
-
const visibleColumns =
|
|
19779
|
+
const visibleColsSet = import_react38.default.useMemo(() => new Set(visibleCols), [visibleCols]);
|
|
19780
|
+
const visibleColumns = import_react38.default.useMemo(() => {
|
|
19684
19781
|
return filterVisibleColumns(columns, visibleColsSet);
|
|
19685
19782
|
}, [columns, visibleColsSet]);
|
|
19686
|
-
const leafColumns =
|
|
19783
|
+
const leafColumns = import_react38.default.useMemo(() => {
|
|
19687
19784
|
return getLeafColumns(visibleColumns);
|
|
19688
19785
|
}, [visibleColumns]);
|
|
19689
|
-
const totalColumnsWidth =
|
|
19786
|
+
const totalColumnsWidth = import_react38.default.useMemo(() => {
|
|
19690
19787
|
return leafColumns.reduce((sum, col) => sum + getColumnWidth(col), 0);
|
|
19691
19788
|
}, [leafColumns]);
|
|
19692
19789
|
const { getStickyCellClass, getStickyColumnStyle, getStickyHeaderClass, getStickyHeaderCellStyle } = useStickyColumns(
|
|
@@ -19749,7 +19846,7 @@ function DataTable({
|
|
|
19749
19846
|
}
|
|
19750
19847
|
return null;
|
|
19751
19848
|
};
|
|
19752
|
-
const headerRows =
|
|
19849
|
+
const headerRows = import_react38.default.useMemo(() => buildHeaderRows(visibleColumns), [visibleColumns]);
|
|
19753
19850
|
const renderHeaderContent = (col, isLeaf) => {
|
|
19754
19851
|
if (!isLeaf) {
|
|
19755
19852
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
@@ -19895,7 +19992,7 @@ function DataTable({
|
|
|
19895
19992
|
col.key
|
|
19896
19993
|
);
|
|
19897
19994
|
}) }, `header-row-${rowIndex}`)) });
|
|
19898
|
-
const processedData =
|
|
19995
|
+
const processedData = import_react38.default.useMemo(() => {
|
|
19899
19996
|
if (isServerMode) return data;
|
|
19900
19997
|
let result = [...data];
|
|
19901
19998
|
if (Object.keys(filters).length > 0) {
|
|
@@ -19927,7 +20024,7 @@ function DataTable({
|
|
|
19927
20024
|
return result;
|
|
19928
20025
|
}, [data, isServerMode, filters, sort, columns]);
|
|
19929
20026
|
const totalItems = isServerMode ? total : processedData.length;
|
|
19930
|
-
const displayedData =
|
|
20027
|
+
const displayedData = import_react38.default.useMemo(() => {
|
|
19931
20028
|
if (isServerMode) return data;
|
|
19932
20029
|
const start = (curPage - 1) * curPageSize;
|
|
19933
20030
|
return processedData.slice(start, start + curPageSize);
|
|
@@ -20366,7 +20463,7 @@ function AccessDenied({
|
|
|
20366
20463
|
|
|
20367
20464
|
// ../../components/ui/ThemeToggleHeadless.tsx
|
|
20368
20465
|
var import_lucide_react38 = require("lucide-react");
|
|
20369
|
-
var
|
|
20466
|
+
var import_react39 = require("react");
|
|
20370
20467
|
var import_react_dom7 = require("react-dom");
|
|
20371
20468
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
20372
20469
|
function ThemeToggleHeadless({
|
|
@@ -20375,11 +20472,11 @@ function ThemeToggleHeadless({
|
|
|
20375
20472
|
labels,
|
|
20376
20473
|
className
|
|
20377
20474
|
}) {
|
|
20378
|
-
const [isOpen, setIsOpen] = (0,
|
|
20379
|
-
const [mounted, setMounted] = (0,
|
|
20380
|
-
const triggerRef = (0,
|
|
20381
|
-
const [dropdownPosition, setDropdownPosition] = (0,
|
|
20382
|
-
(0,
|
|
20475
|
+
const [isOpen, setIsOpen] = (0, import_react39.useState)(false);
|
|
20476
|
+
const [mounted, setMounted] = (0, import_react39.useState)(false);
|
|
20477
|
+
const triggerRef = (0, import_react39.useRef)(null);
|
|
20478
|
+
const [dropdownPosition, setDropdownPosition] = (0, import_react39.useState)(null);
|
|
20479
|
+
(0, import_react39.useEffect)(() => setMounted(true), []);
|
|
20383
20480
|
const themes = [
|
|
20384
20481
|
{ value: "light", label: labels?.light ?? "Light", icon: import_lucide_react38.Sun },
|
|
20385
20482
|
{ value: "dark", label: labels?.dark ?? "Dark", icon: import_lucide_react38.Moon },
|
|
@@ -20468,7 +20565,7 @@ function ThemeToggleHeadless({
|
|
|
20468
20565
|
}
|
|
20469
20566
|
|
|
20470
20567
|
// ../../components/ui/LanguageSwitcherHeadless.tsx
|
|
20471
|
-
var
|
|
20568
|
+
var import_react40 = require("react");
|
|
20472
20569
|
var import_react_dom8 = require("react-dom");
|
|
20473
20570
|
var import_lucide_react39 = require("lucide-react");
|
|
20474
20571
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
@@ -20479,9 +20576,9 @@ function LanguageSwitcherHeadless({
|
|
|
20479
20576
|
labels,
|
|
20480
20577
|
className
|
|
20481
20578
|
}) {
|
|
20482
|
-
const [isOpen, setIsOpen] = (0,
|
|
20483
|
-
const [dropdownPosition, setDropdownPosition] = (0,
|
|
20484
|
-
const triggerButtonRef = (0,
|
|
20579
|
+
const [isOpen, setIsOpen] = (0, import_react40.useState)(false);
|
|
20580
|
+
const [dropdownPosition, setDropdownPosition] = (0, import_react40.useState)(null);
|
|
20581
|
+
const triggerButtonRef = (0, import_react40.useRef)(null);
|
|
20485
20582
|
const currentLanguage = locales.find((l) => l.code === currentLocale) || locales[0];
|
|
20486
20583
|
const calculatePosition = () => {
|
|
20487
20584
|
const rect = triggerButtonRef.current?.getBoundingClientRect();
|
|
@@ -21480,9 +21577,9 @@ function useSmartLocale() {
|
|
|
21480
21577
|
}
|
|
21481
21578
|
|
|
21482
21579
|
// ../../components/ui/UEditor/UEditor.tsx
|
|
21483
|
-
var
|
|
21580
|
+
var import_react52 = __toESM(require("react"), 1);
|
|
21484
21581
|
var import_next_intl6 = require("next-intl");
|
|
21485
|
-
var
|
|
21582
|
+
var import_react53 = require("@tiptap/react");
|
|
21486
21583
|
|
|
21487
21584
|
// ../../components/ui/UEditor/extensions.ts
|
|
21488
21585
|
var import_extension_document = __toESM(require("@tiptap/extension-document"), 1);
|
|
@@ -21522,22 +21619,22 @@ var import_lowlight = require("lowlight");
|
|
|
21522
21619
|
// ../../components/ui/UEditor/slash-command.tsx
|
|
21523
21620
|
var import_core = require("@tiptap/core");
|
|
21524
21621
|
var import_suggestion = __toESM(require("@tiptap/suggestion"), 1);
|
|
21525
|
-
var
|
|
21526
|
-
var
|
|
21622
|
+
var import_react41 = require("@tiptap/react");
|
|
21623
|
+
var import_react42 = require("react");
|
|
21527
21624
|
var import_lucide_react40 = require("lucide-react");
|
|
21528
21625
|
var import_tippy = __toESM(require("tippy.js"), 1);
|
|
21529
21626
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
21530
|
-
var CommandList = (0,
|
|
21531
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
21532
|
-
const listRef = (0,
|
|
21533
|
-
(0,
|
|
21627
|
+
var CommandList = (0, import_react42.forwardRef)((props, ref) => {
|
|
21628
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react42.useState)(0);
|
|
21629
|
+
const listRef = (0, import_react42.useRef)(null);
|
|
21630
|
+
(0, import_react42.useEffect)(() => {
|
|
21534
21631
|
setSelectedIndex(0);
|
|
21535
21632
|
}, [props.items]);
|
|
21536
|
-
(0,
|
|
21633
|
+
(0, import_react42.useEffect)(() => {
|
|
21537
21634
|
const selectedElement = listRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
21538
21635
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
21539
21636
|
}, [selectedIndex, props.items]);
|
|
21540
|
-
(0,
|
|
21637
|
+
(0, import_react42.useImperativeHandle)(ref, () => ({
|
|
21541
21638
|
onKeyDown: ({ event }) => {
|
|
21542
21639
|
if (event.key === "ArrowUp") {
|
|
21543
21640
|
setSelectedIndex((prev) => (prev + props.items.length - 1) % props.items.length);
|
|
@@ -21702,7 +21799,7 @@ var SlashCommand = import_core.Extension.create({
|
|
|
21702
21799
|
let popup;
|
|
21703
21800
|
return {
|
|
21704
21801
|
onStart: (props) => {
|
|
21705
|
-
component = new
|
|
21802
|
+
component = new import_react41.ReactRenderer(CommandList, {
|
|
21706
21803
|
props,
|
|
21707
21804
|
editor: props.editor
|
|
21708
21805
|
});
|
|
@@ -21844,9 +21941,9 @@ var ClipboardImages = import_core2.Extension.create({
|
|
|
21844
21941
|
// ../../components/ui/UEditor/emoji-suggestion.tsx
|
|
21845
21942
|
var import_core3 = require("@tiptap/core");
|
|
21846
21943
|
var import_suggestion2 = __toESM(require("@tiptap/suggestion"), 1);
|
|
21847
|
-
var
|
|
21944
|
+
var import_react43 = require("@tiptap/react");
|
|
21848
21945
|
var import_state2 = require("@tiptap/pm/state");
|
|
21849
|
-
var
|
|
21946
|
+
var import_react44 = require("react");
|
|
21850
21947
|
var import_lucide_react41 = require("lucide-react");
|
|
21851
21948
|
var import_tippy2 = __toESM(require("tippy.js"), 1);
|
|
21852
21949
|
|
|
@@ -22617,12 +22714,12 @@ var EMOJI_LIST = [
|
|
|
22617
22714
|
|
|
22618
22715
|
// ../../components/ui/UEditor/emoji-suggestion.tsx
|
|
22619
22716
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
22620
|
-
var EmojiList = (0,
|
|
22621
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
22622
|
-
(0,
|
|
22717
|
+
var EmojiList = (0, import_react44.forwardRef)((props, ref) => {
|
|
22718
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react44.useState)(0);
|
|
22719
|
+
(0, import_react44.useEffect)(() => {
|
|
22623
22720
|
setSelectedIndex(0);
|
|
22624
22721
|
}, [props.items]);
|
|
22625
|
-
(0,
|
|
22722
|
+
(0, import_react44.useImperativeHandle)(ref, () => ({
|
|
22626
22723
|
onKeyDown: ({ event }) => {
|
|
22627
22724
|
if (event.key === "ArrowUp") {
|
|
22628
22725
|
setSelectedIndex((prev) => (prev + props.items.length - 1) % props.items.length);
|
|
@@ -22709,7 +22806,7 @@ var EmojiSuggestion = import_core3.Extension.create({
|
|
|
22709
22806
|
let popup;
|
|
22710
22807
|
return {
|
|
22711
22808
|
onStart: (props) => {
|
|
22712
|
-
component = new
|
|
22809
|
+
component = new import_react43.ReactRenderer(EmojiList, {
|
|
22713
22810
|
props,
|
|
22714
22811
|
editor: props.editor
|
|
22715
22812
|
});
|
|
@@ -22754,10 +22851,10 @@ var EmojiSuggestion = import_core3.Extension.create({
|
|
|
22754
22851
|
});
|
|
22755
22852
|
|
|
22756
22853
|
// ../../components/ui/UEditor/resizable-image.tsx
|
|
22757
|
-
var
|
|
22854
|
+
var import_react45 = require("react");
|
|
22758
22855
|
var import_extension_image = __toESM(require("@tiptap/extension-image"), 1);
|
|
22759
22856
|
var import_core4 = require("@tiptap/core");
|
|
22760
|
-
var
|
|
22857
|
+
var import_react46 = require("@tiptap/react");
|
|
22761
22858
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
22762
22859
|
var MIN_IMAGE_SIZE_PX = 40;
|
|
22763
22860
|
var AXIS_LOCK_THRESHOLD_PX = 4;
|
|
@@ -22774,15 +22871,15 @@ function clamp8(value, min, max) {
|
|
|
22774
22871
|
}
|
|
22775
22872
|
function ResizableImageNodeView(props) {
|
|
22776
22873
|
const { node, selected, updateAttributes, editor, getPos } = props;
|
|
22777
|
-
const wrapperRef = (0,
|
|
22778
|
-
const imgRef = (0,
|
|
22779
|
-
const [isHovered, setIsHovered] = (0,
|
|
22780
|
-
const [isResizing, setIsResizing] = (0,
|
|
22874
|
+
const wrapperRef = (0, import_react45.useRef)(null);
|
|
22875
|
+
const imgRef = (0, import_react45.useRef)(null);
|
|
22876
|
+
const [isHovered, setIsHovered] = (0, import_react45.useState)(false);
|
|
22877
|
+
const [isResizing, setIsResizing] = (0, import_react45.useState)(false);
|
|
22781
22878
|
const widthAttr = toNullableNumber(node.attrs["width"]);
|
|
22782
22879
|
const heightAttr = toNullableNumber(node.attrs["height"]);
|
|
22783
22880
|
const textAlign = String(node.attrs["textAlign"] ?? "");
|
|
22784
|
-
const dragStateRef = (0,
|
|
22785
|
-
(0,
|
|
22881
|
+
const dragStateRef = (0, import_react45.useRef)(null);
|
|
22882
|
+
(0, import_react45.useEffect)(() => {
|
|
22786
22883
|
const img = imgRef.current;
|
|
22787
22884
|
if (!img) return;
|
|
22788
22885
|
img.style.width = widthAttr ? `${widthAttr}px` : "";
|
|
@@ -22877,7 +22974,7 @@ function ResizableImageNodeView(props) {
|
|
|
22877
22974
|
const wrapperAlignClass = textAlign === "center" ? "mx-auto" : textAlign === "right" ? "ml-auto" : textAlign === "justify" ? "mx-auto" : "";
|
|
22878
22975
|
const wrapperWidthClass = "w-fit";
|
|
22879
22976
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
22880
|
-
|
|
22977
|
+
import_react46.NodeViewWrapper,
|
|
22881
22978
|
{
|
|
22882
22979
|
as: "div",
|
|
22883
22980
|
ref: wrapperRef,
|
|
@@ -22958,7 +23055,7 @@ var ResizableImage = import_extension_image.default.extend({
|
|
|
22958
23055
|
return ["img", (0, import_core4.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes2)];
|
|
22959
23056
|
},
|
|
22960
23057
|
addNodeView() {
|
|
22961
|
-
return (0,
|
|
23058
|
+
return (0, import_react46.ReactNodeViewRenderer)(ResizableImageNodeView);
|
|
22962
23059
|
}
|
|
22963
23060
|
}).configure({
|
|
22964
23061
|
allowBase64: true,
|
|
@@ -23075,18 +23172,18 @@ function buildUEditorExtensions({
|
|
|
23075
23172
|
}
|
|
23076
23173
|
|
|
23077
23174
|
// ../../components/ui/UEditor/toolbar.tsx
|
|
23078
|
-
var
|
|
23175
|
+
var import_react50 = __toESM(require("react"), 1);
|
|
23079
23176
|
var import_next_intl3 = require("next-intl");
|
|
23080
23177
|
var import_lucide_react45 = require("lucide-react");
|
|
23081
23178
|
|
|
23082
23179
|
// ../../components/ui/UEditor/colors.tsx
|
|
23083
|
-
var
|
|
23180
|
+
var import_react47 = require("react");
|
|
23084
23181
|
var import_next_intl = require("next-intl");
|
|
23085
23182
|
var import_lucide_react42 = require("lucide-react");
|
|
23086
23183
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
23087
23184
|
var useEditorColors = () => {
|
|
23088
23185
|
const t = (0, import_next_intl.useTranslations)("UEditor");
|
|
23089
|
-
const textColors = (0,
|
|
23186
|
+
const textColors = (0, import_react47.useMemo)(
|
|
23090
23187
|
() => [
|
|
23091
23188
|
{ name: t("colors.default"), color: "inherit", cssClass: "text-foreground" },
|
|
23092
23189
|
{ name: t("colors.muted"), color: "var(--muted-foreground)", cssClass: "text-muted-foreground" },
|
|
@@ -23099,7 +23196,7 @@ var useEditorColors = () => {
|
|
|
23099
23196
|
],
|
|
23100
23197
|
[t]
|
|
23101
23198
|
);
|
|
23102
|
-
const highlightColors = (0,
|
|
23199
|
+
const highlightColors = (0, import_react47.useMemo)(
|
|
23103
23200
|
() => [
|
|
23104
23201
|
{ name: t("colors.default"), color: "", cssClass: "" },
|
|
23105
23202
|
{ name: t("colors.muted"), color: "var(--muted)", cssClass: "bg-muted" },
|
|
@@ -23144,7 +23241,7 @@ var EditorColorPalette = ({
|
|
|
23144
23241
|
] });
|
|
23145
23242
|
|
|
23146
23243
|
// ../../components/ui/UEditor/inputs.tsx
|
|
23147
|
-
var
|
|
23244
|
+
var import_react48 = require("react");
|
|
23148
23245
|
var import_next_intl2 = require("next-intl");
|
|
23149
23246
|
var import_lucide_react43 = require("lucide-react");
|
|
23150
23247
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
@@ -23161,9 +23258,9 @@ var LinkInput = ({
|
|
|
23161
23258
|
initialUrl = ""
|
|
23162
23259
|
}) => {
|
|
23163
23260
|
const t = (0, import_next_intl2.useTranslations)("UEditor");
|
|
23164
|
-
const [url, setUrl] = (0,
|
|
23165
|
-
const inputRef = (0,
|
|
23166
|
-
(0,
|
|
23261
|
+
const [url, setUrl] = (0, import_react48.useState)(initialUrl);
|
|
23262
|
+
const inputRef = (0, import_react48.useRef)(null);
|
|
23263
|
+
(0, import_react48.useEffect)(() => {
|
|
23167
23264
|
inputRef.current?.focus();
|
|
23168
23265
|
inputRef.current?.select();
|
|
23169
23266
|
}, []);
|
|
@@ -23190,10 +23287,10 @@ var LinkInput = ({
|
|
|
23190
23287
|
};
|
|
23191
23288
|
var ImageInput = ({ onSubmit, onCancel }) => {
|
|
23192
23289
|
const t = (0, import_next_intl2.useTranslations)("UEditor");
|
|
23193
|
-
const [url, setUrl] = (0,
|
|
23194
|
-
const [alt, setAlt] = (0,
|
|
23195
|
-
const inputRef = (0,
|
|
23196
|
-
(0,
|
|
23290
|
+
const [url, setUrl] = (0, import_react48.useState)("");
|
|
23291
|
+
const [alt, setAlt] = (0, import_react48.useState)("");
|
|
23292
|
+
const inputRef = (0, import_react48.useRef)(null);
|
|
23293
|
+
(0, import_react48.useEffect)(() => {
|
|
23197
23294
|
inputRef.current?.focus();
|
|
23198
23295
|
}, []);
|
|
23199
23296
|
const handleSubmit = (e) => {
|
|
@@ -23246,7 +23343,7 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
23246
23343
|
};
|
|
23247
23344
|
|
|
23248
23345
|
// ../../components/ui/UEditor/emoji-picker.tsx
|
|
23249
|
-
var
|
|
23346
|
+
var import_react49 = require("react");
|
|
23250
23347
|
var import_lucide_react44 = require("lucide-react");
|
|
23251
23348
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
23252
23349
|
var CATEGORY_ICONS = {
|
|
@@ -23259,12 +23356,12 @@ var CATEGORY_ICONS = {
|
|
|
23259
23356
|
"flags": import_lucide_react44.Flag
|
|
23260
23357
|
};
|
|
23261
23358
|
var EmojiPicker = ({ onSelect, onClose }) => {
|
|
23262
|
-
const [search, setSearch] = (0,
|
|
23263
|
-
const [activeCategory, setActiveCategory] = (0,
|
|
23264
|
-
const scrollContainerRef = (0,
|
|
23265
|
-
const categoryRefs = (0,
|
|
23266
|
-
const isUserScrolling = (0,
|
|
23267
|
-
const filteredCategories = (0,
|
|
23359
|
+
const [search, setSearch] = (0, import_react49.useState)("");
|
|
23360
|
+
const [activeCategory, setActiveCategory] = (0, import_react49.useState)(EMOJI_LIST[0]?.id || "");
|
|
23361
|
+
const scrollContainerRef = (0, import_react49.useRef)(null);
|
|
23362
|
+
const categoryRefs = (0, import_react49.useRef)({});
|
|
23363
|
+
const isUserScrolling = (0, import_react49.useRef)(false);
|
|
23364
|
+
const filteredCategories = (0, import_react49.useMemo)(() => {
|
|
23268
23365
|
if (!search.trim()) return EMOJI_LIST;
|
|
23269
23366
|
const query = search.toLowerCase();
|
|
23270
23367
|
return EMOJI_LIST.map((category) => ({
|
|
@@ -23278,7 +23375,7 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
23278
23375
|
onSelect(emoji);
|
|
23279
23376
|
setSearch("");
|
|
23280
23377
|
};
|
|
23281
|
-
(0,
|
|
23378
|
+
(0, import_react49.useEffect)(() => {
|
|
23282
23379
|
if (search) return;
|
|
23283
23380
|
const container = scrollContainerRef.current;
|
|
23284
23381
|
if (!container) return;
|
|
@@ -23318,7 +23415,7 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
23318
23415
|
isUserScrolling.current = true;
|
|
23319
23416
|
}, 500);
|
|
23320
23417
|
};
|
|
23321
|
-
(0,
|
|
23418
|
+
(0, import_react49.useEffect)(() => {
|
|
23322
23419
|
isUserScrolling.current = true;
|
|
23323
23420
|
}, []);
|
|
23324
23421
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "w-96 bg-card border border-border rounded-2xl shadow-xl overflow-hidden flex flex-col max-h-128", children: [
|
|
@@ -23437,7 +23534,7 @@ function fileToDataUrl2(file) {
|
|
|
23437
23534
|
reader.readAsDataURL(file);
|
|
23438
23535
|
});
|
|
23439
23536
|
}
|
|
23440
|
-
var ToolbarButton =
|
|
23537
|
+
var ToolbarButton = import_react50.default.forwardRef(({ onClick, onMouseDown, active, disabled, children, title, className }, ref) => {
|
|
23441
23538
|
const button = /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23442
23539
|
"button",
|
|
23443
23540
|
{
|
|
@@ -23475,10 +23572,10 @@ var EditorToolbar = ({
|
|
|
23475
23572
|
}) => {
|
|
23476
23573
|
const t = (0, import_next_intl3.useTranslations)("UEditor");
|
|
23477
23574
|
const { textColors, highlightColors } = useEditorColors();
|
|
23478
|
-
const [showImageInput, setShowImageInput] = (0,
|
|
23479
|
-
const fileInputRef = (0,
|
|
23480
|
-
const [isUploadingImage, setIsUploadingImage] = (0,
|
|
23481
|
-
const [imageUploadError, setImageUploadError] = (0,
|
|
23575
|
+
const [showImageInput, setShowImageInput] = (0, import_react50.useState)(false);
|
|
23576
|
+
const fileInputRef = (0, import_react50.useRef)(null);
|
|
23577
|
+
const [isUploadingImage, setIsUploadingImage] = (0, import_react50.useState)(false);
|
|
23578
|
+
const [imageUploadError, setImageUploadError] = (0, import_react50.useState)(null);
|
|
23482
23579
|
const insertImageFiles = async (files) => {
|
|
23483
23580
|
if (files.length === 0) return;
|
|
23484
23581
|
setIsUploadingImage(true);
|
|
@@ -23926,16 +24023,16 @@ var EditorToolbar = ({
|
|
|
23926
24023
|
};
|
|
23927
24024
|
|
|
23928
24025
|
// ../../components/ui/UEditor/menus.tsx
|
|
23929
|
-
var
|
|
24026
|
+
var import_react51 = require("react");
|
|
23930
24027
|
var import_react_dom9 = require("react-dom");
|
|
23931
24028
|
var import_next_intl4 = require("next-intl");
|
|
23932
24029
|
var import_lucide_react46 = require("lucide-react");
|
|
23933
24030
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
23934
24031
|
var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
23935
24032
|
const t = (0, import_next_intl4.useTranslations)("UEditor");
|
|
23936
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
23937
|
-
const menuRef = (0,
|
|
23938
|
-
const allCommands = (0,
|
|
24033
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react51.useState)(0);
|
|
24034
|
+
const menuRef = (0, import_react51.useRef)(null);
|
|
24035
|
+
const allCommands = (0, import_react51.useMemo)(
|
|
23939
24036
|
() => [
|
|
23940
24037
|
{
|
|
23941
24038
|
icon: import_lucide_react46.Type,
|
|
@@ -24006,19 +24103,19 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
24006
24103
|
],
|
|
24007
24104
|
[editor, t]
|
|
24008
24105
|
);
|
|
24009
|
-
const commands = (0,
|
|
24106
|
+
const commands = (0, import_react51.useMemo)(() => {
|
|
24010
24107
|
if (!filterText) return allCommands;
|
|
24011
24108
|
const lowerFilter = filterText.toLowerCase();
|
|
24012
24109
|
return allCommands.filter((cmd) => cmd.label.toLowerCase().includes(lowerFilter) || cmd.description.toLowerCase().includes(lowerFilter));
|
|
24013
24110
|
}, [allCommands, filterText]);
|
|
24014
|
-
(0,
|
|
24111
|
+
(0, import_react51.useEffect)(() => {
|
|
24015
24112
|
setSelectedIndex(0);
|
|
24016
24113
|
}, [filterText]);
|
|
24017
|
-
(0,
|
|
24114
|
+
(0, import_react51.useEffect)(() => {
|
|
24018
24115
|
const selectedElement = menuRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
24019
24116
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
24020
24117
|
}, [selectedIndex]);
|
|
24021
|
-
const selectCommand = (0,
|
|
24118
|
+
const selectCommand = (0, import_react51.useCallback)(
|
|
24022
24119
|
(index) => {
|
|
24023
24120
|
const command = commands[index];
|
|
24024
24121
|
if (command) {
|
|
@@ -24028,7 +24125,7 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
24028
24125
|
},
|
|
24029
24126
|
[commands, onClose]
|
|
24030
24127
|
);
|
|
24031
|
-
(0,
|
|
24128
|
+
(0, import_react51.useEffect)(() => {
|
|
24032
24129
|
const handleKeyDown = (e) => {
|
|
24033
24130
|
if (commands.length === 0) return;
|
|
24034
24131
|
if (e.key === "ArrowDown") {
|
|
@@ -24088,7 +24185,7 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
24088
24185
|
};
|
|
24089
24186
|
var FloatingMenuContent = ({ editor }) => {
|
|
24090
24187
|
const t = (0, import_next_intl4.useTranslations)("UEditor");
|
|
24091
|
-
const [showCommands, setShowCommands] = (0,
|
|
24188
|
+
const [showCommands, setShowCommands] = (0, import_react51.useState)(false);
|
|
24092
24189
|
if (showCommands) {
|
|
24093
24190
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(SlashCommandMenu, { editor, onClose: () => setShowCommands(false) });
|
|
24094
24191
|
}
|
|
@@ -24111,12 +24208,12 @@ var BubbleMenuContent = ({
|
|
|
24111
24208
|
}) => {
|
|
24112
24209
|
const t = (0, import_next_intl4.useTranslations)("UEditor");
|
|
24113
24210
|
const { textColors, highlightColors } = useEditorColors();
|
|
24114
|
-
const [showLinkInput, setShowLinkInput] = (0,
|
|
24115
|
-
const [showEditorColorPalette, setShowEditorColorPalette] = (0,
|
|
24116
|
-
(0,
|
|
24211
|
+
const [showLinkInput, setShowLinkInput] = (0, import_react51.useState)(false);
|
|
24212
|
+
const [showEditorColorPalette, setShowEditorColorPalette] = (0, import_react51.useState)(false);
|
|
24213
|
+
(0, import_react51.useEffect)(() => {
|
|
24117
24214
|
onKeepOpenChange?.(showLinkInput);
|
|
24118
24215
|
}, [onKeepOpenChange, showLinkInput]);
|
|
24119
|
-
(0,
|
|
24216
|
+
(0, import_react51.useEffect)(() => {
|
|
24120
24217
|
if (!showLinkInput) return;
|
|
24121
24218
|
const close = () => setShowLinkInput(false);
|
|
24122
24219
|
editor.on("selectionUpdate", close);
|
|
@@ -24239,15 +24336,15 @@ var BubbleMenuContent = ({
|
|
|
24239
24336
|
] });
|
|
24240
24337
|
};
|
|
24241
24338
|
var CustomBubbleMenu = ({ editor }) => {
|
|
24242
|
-
const [isVisible, setIsVisible] = (0,
|
|
24243
|
-
const [position, setPosition] = (0,
|
|
24244
|
-
const menuRef = (0,
|
|
24245
|
-
const keepOpenRef = (0,
|
|
24246
|
-
const setKeepOpen = (0,
|
|
24339
|
+
const [isVisible, setIsVisible] = (0, import_react51.useState)(false);
|
|
24340
|
+
const [position, setPosition] = (0, import_react51.useState)({ top: 0, left: 0 });
|
|
24341
|
+
const menuRef = (0, import_react51.useRef)(null);
|
|
24342
|
+
const keepOpenRef = (0, import_react51.useRef)(false);
|
|
24343
|
+
const setKeepOpen = (0, import_react51.useCallback)((next) => {
|
|
24247
24344
|
keepOpenRef.current = next;
|
|
24248
24345
|
if (next) setIsVisible(true);
|
|
24249
24346
|
}, []);
|
|
24250
|
-
(0,
|
|
24347
|
+
(0, import_react51.useEffect)(() => {
|
|
24251
24348
|
const updatePosition = () => {
|
|
24252
24349
|
const { state, view } = editor;
|
|
24253
24350
|
const { from, to, empty } = state.selection;
|
|
@@ -24300,9 +24397,9 @@ var CustomBubbleMenu = ({ editor }) => {
|
|
|
24300
24397
|
);
|
|
24301
24398
|
};
|
|
24302
24399
|
var CustomFloatingMenu = ({ editor }) => {
|
|
24303
|
-
const [isVisible, setIsVisible] = (0,
|
|
24304
|
-
const [position, setPosition] = (0,
|
|
24305
|
-
(0,
|
|
24400
|
+
const [isVisible, setIsVisible] = (0, import_react51.useState)(false);
|
|
24401
|
+
const [position, setPosition] = (0, import_react51.useState)({ top: 0, left: 0 });
|
|
24402
|
+
(0, import_react51.useEffect)(() => {
|
|
24306
24403
|
const updatePosition = () => {
|
|
24307
24404
|
const { state, view } = editor;
|
|
24308
24405
|
const { $from, empty } = state.selection;
|
|
@@ -24622,7 +24719,7 @@ async function prepareUEditorContentForSave({
|
|
|
24622
24719
|
|
|
24623
24720
|
// ../../components/ui/UEditor/UEditor.tsx
|
|
24624
24721
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
24625
|
-
var UEditor =
|
|
24722
|
+
var UEditor = import_react52.default.forwardRef(({
|
|
24626
24723
|
content = "",
|
|
24627
24724
|
onChange,
|
|
24628
24725
|
onHtmlChange,
|
|
@@ -24645,12 +24742,12 @@ var UEditor = import_react51.default.forwardRef(({
|
|
|
24645
24742
|
}, ref) => {
|
|
24646
24743
|
const t = (0, import_next_intl6.useTranslations)("UEditor");
|
|
24647
24744
|
const effectivePlaceholder = placeholder ?? t("placeholder");
|
|
24648
|
-
const inFlightPrepareRef = (0,
|
|
24649
|
-
const extensions = (0,
|
|
24745
|
+
const inFlightPrepareRef = (0, import_react52.useRef)(null);
|
|
24746
|
+
const extensions = (0, import_react52.useMemo)(
|
|
24650
24747
|
() => buildUEditorExtensions({ placeholder: effectivePlaceholder, maxCharacters, uploadImage, imageInsertMode, editable }),
|
|
24651
24748
|
[effectivePlaceholder, maxCharacters, uploadImage, imageInsertMode, editable]
|
|
24652
24749
|
);
|
|
24653
|
-
const editor = (0,
|
|
24750
|
+
const editor = (0, import_react53.useEditor)({
|
|
24654
24751
|
immediatelyRender: false,
|
|
24655
24752
|
extensions,
|
|
24656
24753
|
content,
|
|
@@ -24755,7 +24852,7 @@ var UEditor = import_react51.default.forwardRef(({
|
|
|
24755
24852
|
onJsonChange?.(editor2.getJSON());
|
|
24756
24853
|
}
|
|
24757
24854
|
});
|
|
24758
|
-
(0,
|
|
24855
|
+
(0, import_react52.useImperativeHandle)(
|
|
24759
24856
|
ref,
|
|
24760
24857
|
() => ({
|
|
24761
24858
|
prepareContentForSave: async ({ throwOnError = false } = {}) => {
|
|
@@ -24777,7 +24874,7 @@ var UEditor = import_react51.default.forwardRef(({
|
|
|
24777
24874
|
}),
|
|
24778
24875
|
[content, editor, uploadImageForSave]
|
|
24779
24876
|
);
|
|
24780
|
-
(0,
|
|
24877
|
+
(0, import_react52.useEffect)(() => {
|
|
24781
24878
|
if (editor && content !== editor.getHTML()) {
|
|
24782
24879
|
if (editor.isEmpty && content) {
|
|
24783
24880
|
editor.commands.setContent(content);
|
|
@@ -24810,7 +24907,7 @@ var UEditor = import_react51.default.forwardRef(({
|
|
|
24810
24907
|
editable && showBubbleMenu && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(CustomBubbleMenu, { editor }),
|
|
24811
24908
|
editable && showFloatingMenu && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(CustomFloatingMenu, { editor }),
|
|
24812
24909
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
24813
|
-
|
|
24910
|
+
import_react53.EditorContent,
|
|
24814
24911
|
{
|
|
24815
24912
|
editor,
|
|
24816
24913
|
className: "flex-1 overflow-y-auto",
|
|
@@ -24912,6 +25009,7 @@ function getUnderverseMessages(locale = "en") {
|
|
|
24912
25009
|
NotificationModal,
|
|
24913
25010
|
NumberInput,
|
|
24914
25011
|
OverlayControls,
|
|
25012
|
+
OverlayScrollbarProvider,
|
|
24915
25013
|
PageLoading,
|
|
24916
25014
|
Pagination,
|
|
24917
25015
|
PasswordInput,
|