@sustaina/shared-ui 1.33.1 → 1.34.0
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/dist/index.d.mts +62 -9
- package/dist/index.d.ts +62 -9
- package/dist/index.js +723 -310
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +564 -155
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
2
1
|
import clsx2, { clsx } from 'clsx';
|
|
3
2
|
import { twMerge } from 'tailwind-merge';
|
|
4
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
|
-
import * as
|
|
6
|
-
import
|
|
4
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
5
|
+
import * as React26 from 'react';
|
|
6
|
+
import React26__default, { forwardRef, useRef, useMemo, useCallback, useState, isValidElement, useEffect, useLayoutEffect, createElement } from 'react';
|
|
7
7
|
import { CircleX, Undo, Redo, Bold, Italic, Underline, Strikethrough, Code, Pilcrow, Heading1, Heading2, Heading3, List as List$1, ListOrdered, Quote, CodeSquare, Link, Link2Off, Image as Image$1, AlignLeft, AlignCenter, AlignRight, CircleHelp, ChevronDown, X, Check, XIcon, SearchIcon, ChevronRight, CheckIcon, Triangle, CalendarIcon, Search, ChevronUp, PanelLeftIcon, Minimize2, Maximize2, Plus, ChevronLeft, CircleUserRound, MoreVertical, Bug, GripVertical, Info, CircleMinus, Minus } from 'lucide-react';
|
|
8
8
|
import { createPortal } from 'react-dom';
|
|
9
9
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
@@ -737,6 +737,120 @@ var SuiWarningIcon = (props) => /* @__PURE__ */ jsxs(
|
|
|
737
737
|
}
|
|
738
738
|
);
|
|
739
739
|
var warning_default = SuiWarningIcon;
|
|
740
|
+
var TrashIcon = ({
|
|
741
|
+
size = 16,
|
|
742
|
+
color = "currentColor",
|
|
743
|
+
className,
|
|
744
|
+
...props
|
|
745
|
+
}) => /* @__PURE__ */ jsxs(
|
|
746
|
+
"svg",
|
|
747
|
+
{
|
|
748
|
+
viewBox: "0 0 17 15",
|
|
749
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
750
|
+
width: size,
|
|
751
|
+
height: size,
|
|
752
|
+
fill: "none",
|
|
753
|
+
className,
|
|
754
|
+
...props,
|
|
755
|
+
children: [
|
|
756
|
+
/* @__PURE__ */ jsxs("g", { clipPath: "url(#clip0_336_302483)", children: [
|
|
757
|
+
/* @__PURE__ */ jsx(
|
|
758
|
+
"path",
|
|
759
|
+
{
|
|
760
|
+
d: "M3.49371 2.12043C3.38318 1.44249 3.66212 0.708651 4.43068 0.529533C4.94459 0.409578 7.77168 0.42749 8.38456 0.492081C9.25207 0.583811 9.64966 1.36813 9.5125 2.12097C10.3748 2.22627 11.9484 1.85067 12.6087 2.44664C13.1053 2.89498 13.1452 3.75638 12.64 4.21232C12.2707 4.54558 12.1422 4.28179 12.0664 4.92282C11.7412 7.68938 11.6509 10.4907 11.3494 13.2605C11.2452 13.9135 10.7718 14.3401 10.0646 14.3895C7.73175 14.5534 5.1836 14.2619 2.8276 14.3873C2.09203 14.2587 1.75116 13.8364 1.64178 13.1655L0.878435 4.54558C0.710025 4.38221 0.481427 4.33281 0.310702 4.15532C-0.221151 3.60006 -0.0434807 2.66593 0.639999 2.29358C0.702502 2.25938 0.998811 2.12043 1.03411 2.12043H3.49371ZM4.30394 2.12043H8.70228C8.71964 1.8333 8.70691 1.36813 8.32321 1.30951C7.19122 1.38116 5.90586 1.20367 4.79238 1.30246C4.28831 1.34696 4.29815 1.71931 4.30394 2.12043ZM12.0415 3.0589C12.0172 3.03068 11.8812 2.9574 11.8419 2.94926L1.26329 2.93243C0.749379 2.95794 0.749379 3.72598 1.26329 3.75149H11.7429C12.1029 3.75312 12.2429 3.29338 12.0415 3.0589ZM11.2487 4.56295H1.75753L2.51508 13.1612C2.5608 13.4597 2.68754 13.5498 2.9989 13.5759C5.22817 13.762 7.7468 13.4293 10.0073 13.5759L10.3823 13.4391L11.2487 4.56295Z",
|
|
761
|
+
fill: color
|
|
762
|
+
}
|
|
763
|
+
),
|
|
764
|
+
/* @__PURE__ */ jsx(
|
|
765
|
+
"path",
|
|
766
|
+
{
|
|
767
|
+
d: "M4.22952 5.50209C4.41761 5.72137 4.34006 6.27067 4.36263 6.54477C4.51599 8.36961 4.73649 10.3719 4.77121 12.1892C4.78568 12.9404 3.98125 12.8953 3.90254 12.4047C3.84698 10.417 3.54836 8.42443 3.49164 6.43947C3.48586 6.23159 3.45576 5.67469 3.54894 5.52542C3.66411 5.34088 4.08426 5.33274 4.22952 5.50263V5.50209Z",
|
|
768
|
+
fill: color
|
|
769
|
+
}
|
|
770
|
+
),
|
|
771
|
+
/* @__PURE__ */ jsx(
|
|
772
|
+
"path",
|
|
773
|
+
{
|
|
774
|
+
d: "M9.43711 5.50146C9.55575 5.63933 9.52045 6.22879 9.51466 6.43776C9.45852 8.42272 9.15932 10.4153 9.10376 12.4029C9.02447 12.8936 8.21946 12.9381 8.23509 12.1875C8.27213 10.3681 8.48973 8.37007 8.64367 6.54306C8.67492 6.17234 8.50941 5.28598 9.18941 5.37771C9.24497 5.38531 9.40412 5.46238 9.43711 5.50092V5.50146Z",
|
|
775
|
+
fill: color
|
|
776
|
+
}
|
|
777
|
+
),
|
|
778
|
+
/* @__PURE__ */ jsx(
|
|
779
|
+
"path",
|
|
780
|
+
{
|
|
781
|
+
d: "M6.83313 5.50252C6.90547 5.58611 6.90142 5.68218 6.91068 5.78314C7.10224 7.89891 6.76253 10.266 6.90837 12.4083C6.88985 12.8822 6.11551 12.8806 6.09814 12.4083L6.15312 5.52478C6.31575 5.34783 6.6734 5.31689 6.83313 5.50252Z",
|
|
782
|
+
fill: color
|
|
783
|
+
}
|
|
784
|
+
)
|
|
785
|
+
] }),
|
|
786
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_3678_200811", children: /* @__PURE__ */ jsx("rect", { width: "17", height: "15", fill: "white", transform: "translate(0.728516 0.726562)" }) }) })
|
|
787
|
+
]
|
|
788
|
+
}
|
|
789
|
+
);
|
|
790
|
+
var trash_default = TrashIcon;
|
|
791
|
+
var AuditFooter = ({
|
|
792
|
+
createdAt,
|
|
793
|
+
createdBy,
|
|
794
|
+
updatedAt,
|
|
795
|
+
updatedBy,
|
|
796
|
+
onDelete,
|
|
797
|
+
canDelete = true,
|
|
798
|
+
emptyValue = "-",
|
|
799
|
+
labels,
|
|
800
|
+
classNames,
|
|
801
|
+
formatters,
|
|
802
|
+
deleteAriaLabel = "Delete",
|
|
803
|
+
deleteIcon
|
|
804
|
+
}) => {
|
|
805
|
+
const resolvedLabels = {
|
|
806
|
+
createdOn: "Created on :",
|
|
807
|
+
createdAtTime: "at Time :",
|
|
808
|
+
createdBy: "by :",
|
|
809
|
+
updatedOn: "Last Update :",
|
|
810
|
+
updatedAtTime: "at Time :",
|
|
811
|
+
updatedBy: "by :",
|
|
812
|
+
...labels
|
|
813
|
+
};
|
|
814
|
+
const dateFormatter = formatters?.date ?? ((value) => formatISODate(value, "DD/MM/YYYY"));
|
|
815
|
+
const timeFormatter = formatters?.time ?? ((value) => formatISODate(value, "H:i"));
|
|
816
|
+
const userFormatter = formatters?.user ?? ((value) => value ?? emptyValue);
|
|
817
|
+
const resolvedDeleteIcon = deleteIcon ?? /* @__PURE__ */ jsx(trash_default, { className: "w-5 h-5" });
|
|
818
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex w-full h-14 mt-12 justify-between items-end px-3", classNames?.root), children: [
|
|
819
|
+
/* @__PURE__ */ jsxs(
|
|
820
|
+
"div",
|
|
821
|
+
{
|
|
822
|
+
className: cn(
|
|
823
|
+
"grid grid-cols-[auto_1fr_auto_1fr] gap-x-3 gap-y-1 text-[10px]",
|
|
824
|
+
classNames?.grid
|
|
825
|
+
),
|
|
826
|
+
children: [
|
|
827
|
+
/* @__PURE__ */ jsx("p", { className: cn("font-bold italic text-[#3B4256]", classNames?.label), children: resolvedLabels.createdOn }),
|
|
828
|
+
/* @__PURE__ */ jsx("p", { className: classNames?.value, children: createdAt ? dateFormatter(createdAt) : emptyValue }),
|
|
829
|
+
/* @__PURE__ */ jsx("p", { className: cn("font-bold italic text-[#3B4256]", classNames?.label), children: resolvedLabels.createdAtTime }),
|
|
830
|
+
/* @__PURE__ */ jsx("p", { className: classNames?.value, children: createdAt ? timeFormatter(createdAt) : emptyValue }),
|
|
831
|
+
/* @__PURE__ */ jsx("p", { className: cn("font-bold italic text-[#3B4256]", classNames?.label), children: resolvedLabels.createdBy }),
|
|
832
|
+
/* @__PURE__ */ jsx("p", { className: cn("col-span-3", classNames?.value), children: userFormatter(createdBy) }),
|
|
833
|
+
/* @__PURE__ */ jsx("p", { className: cn("font-bold italic text-[#3B4256]", classNames?.label), children: resolvedLabels.updatedOn }),
|
|
834
|
+
/* @__PURE__ */ jsx("p", { className: classNames?.value, children: updatedAt ? dateFormatter(updatedAt) : emptyValue }),
|
|
835
|
+
/* @__PURE__ */ jsx("p", { className: cn("font-bold italic text-[#3B4256]", classNames?.label), children: resolvedLabels.updatedAtTime }),
|
|
836
|
+
/* @__PURE__ */ jsx("p", { className: classNames?.value, children: updatedAt ? timeFormatter(updatedAt) : emptyValue }),
|
|
837
|
+
/* @__PURE__ */ jsx("p", { className: cn("font-bold italic text-[#3B4256]", classNames?.label), children: resolvedLabels.updatedBy }),
|
|
838
|
+
/* @__PURE__ */ jsx("p", { className: cn("col-span-3", classNames?.value), children: userFormatter(updatedBy) })
|
|
839
|
+
]
|
|
840
|
+
}
|
|
841
|
+
),
|
|
842
|
+
onDelete && /* @__PURE__ */ jsx(
|
|
843
|
+
"div",
|
|
844
|
+
{
|
|
845
|
+
className: canDelete ? cn("w-5 h-5 cursor-pointer text-red-500", classNames?.deleteButton) : cn("w-5 h-5 text-gray-300 cursor-not-allowed", classNames?.deleteButtonDisabled),
|
|
846
|
+
onClick: canDelete ? onDelete : void 0,
|
|
847
|
+
"aria-label": deleteAriaLabel,
|
|
848
|
+
role: "button",
|
|
849
|
+
children: resolvedDeleteIcon
|
|
850
|
+
}
|
|
851
|
+
)
|
|
852
|
+
] });
|
|
853
|
+
};
|
|
740
854
|
function Accordion({ ...props }) {
|
|
741
855
|
return /* @__PURE__ */ jsx(AccordionPrimitive.Root, { "data-slot": "accordion", ...props });
|
|
742
856
|
}
|
|
@@ -1203,7 +1317,7 @@ var OPERATOR_LABEL = {
|
|
|
1203
1317
|
containsAll: "Contains all of"
|
|
1204
1318
|
};
|
|
1205
1319
|
var OperatorSelect = ({ row, operators, onChangeOperator, error }) => {
|
|
1206
|
-
|
|
1320
|
+
React26__default.useEffect(() => {
|
|
1207
1321
|
if (!operators.length) return;
|
|
1208
1322
|
if (!operators.includes(row.operator)) {
|
|
1209
1323
|
onChangeOperator(operators[0]);
|
|
@@ -1239,15 +1353,15 @@ function Label2({ className, ...props }) {
|
|
|
1239
1353
|
);
|
|
1240
1354
|
}
|
|
1241
1355
|
var Form = FormProvider;
|
|
1242
|
-
var FormFieldContext =
|
|
1356
|
+
var FormFieldContext = React26.createContext({});
|
|
1243
1357
|
var FormField = ({
|
|
1244
1358
|
...props
|
|
1245
1359
|
}) => {
|
|
1246
1360
|
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
1247
1361
|
};
|
|
1248
1362
|
var useFormField = () => {
|
|
1249
|
-
const fieldContext =
|
|
1250
|
-
const itemContext =
|
|
1363
|
+
const fieldContext = React26.useContext(FormFieldContext);
|
|
1364
|
+
const itemContext = React26.useContext(FormItemContext);
|
|
1251
1365
|
const { getFieldState } = useFormContext();
|
|
1252
1366
|
const formState = useFormState({ name: fieldContext.name });
|
|
1253
1367
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -1264,9 +1378,9 @@ var useFormField = () => {
|
|
|
1264
1378
|
...fieldState
|
|
1265
1379
|
};
|
|
1266
1380
|
};
|
|
1267
|
-
var FormItemContext =
|
|
1381
|
+
var FormItemContext = React26.createContext({});
|
|
1268
1382
|
function FormItem({ className, ...props }) {
|
|
1269
|
-
const id =
|
|
1383
|
+
const id = React26.useId();
|
|
1270
1384
|
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
|
|
1271
1385
|
}
|
|
1272
1386
|
function FormLabel({ className, ...props }) {
|
|
@@ -1370,7 +1484,7 @@ var Spinner = ({ className, variant, size = "default", ...props }) => /* @__PURE
|
|
|
1370
1484
|
]
|
|
1371
1485
|
}
|
|
1372
1486
|
);
|
|
1373
|
-
var InputPrimitive =
|
|
1487
|
+
var InputPrimitive = React26.forwardRef(
|
|
1374
1488
|
({ className, type = "text", ...props }, ref) => {
|
|
1375
1489
|
return /* @__PURE__ */ jsx(
|
|
1376
1490
|
"input",
|
|
@@ -1409,7 +1523,7 @@ var inputVariants = cva("", {
|
|
|
1409
1523
|
appearance: "filled"
|
|
1410
1524
|
}
|
|
1411
1525
|
});
|
|
1412
|
-
var Input =
|
|
1526
|
+
var Input = React26.forwardRef(
|
|
1413
1527
|
({
|
|
1414
1528
|
className,
|
|
1415
1529
|
wrapperClassName,
|
|
@@ -1442,8 +1556,8 @@ var Input = React4.forwardRef(
|
|
|
1442
1556
|
onChange: onChangeProp
|
|
1443
1557
|
} = rest;
|
|
1444
1558
|
const ariaInvalid = invalid ?? ariaInvalidProp;
|
|
1445
|
-
const messageId =
|
|
1446
|
-
const handleChange =
|
|
1559
|
+
const messageId = React26.useId();
|
|
1560
|
+
const handleChange = React26.useCallback(
|
|
1447
1561
|
(event) => {
|
|
1448
1562
|
onChangeProp?.(event);
|
|
1449
1563
|
onValueChange?.(event.target.value);
|
|
@@ -1786,20 +1900,20 @@ function DatePicker({
|
|
|
1786
1900
|
className,
|
|
1787
1901
|
...props
|
|
1788
1902
|
}) {
|
|
1789
|
-
const today =
|
|
1790
|
-
const [displayed, setDisplayed] =
|
|
1903
|
+
const today = React26.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
1904
|
+
const [displayed, setDisplayed] = React26.useState(
|
|
1791
1905
|
selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
|
|
1792
1906
|
);
|
|
1793
1907
|
minDate = clampToDay(minDate);
|
|
1794
1908
|
maxDate = clampToDay(maxDate);
|
|
1795
|
-
const disabledSet =
|
|
1909
|
+
const disabledSet = React26.useMemo(() => {
|
|
1796
1910
|
const s = /* @__PURE__ */ new Set();
|
|
1797
1911
|
disabledDates?.forEach((d) => s.add(startOfDay(d).toISOString()));
|
|
1798
1912
|
return s;
|
|
1799
1913
|
}, [disabledDates]);
|
|
1800
1914
|
const displayYear = displayed.getFullYear();
|
|
1801
1915
|
const displayMonth = displayed.getMonth();
|
|
1802
|
-
const weekdays =
|
|
1916
|
+
const weekdays = React26.useMemo(() => {
|
|
1803
1917
|
const labels = [];
|
|
1804
1918
|
for (let i = 0; i < 7; i++) {
|
|
1805
1919
|
const idx = i;
|
|
@@ -1808,7 +1922,7 @@ function DatePicker({
|
|
|
1808
1922
|
}
|
|
1809
1923
|
return labels;
|
|
1810
1924
|
}, [callbacks]);
|
|
1811
|
-
const grid =
|
|
1925
|
+
const grid = React26.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
|
|
1812
1926
|
const isDateDisabled = (date) => {
|
|
1813
1927
|
const d = startOfDay(date);
|
|
1814
1928
|
if (minDate && d < minDate) return true;
|
|
@@ -1818,7 +1932,7 @@ function DatePicker({
|
|
|
1818
1932
|
};
|
|
1819
1933
|
const minYear = minDate?.getFullYear();
|
|
1820
1934
|
const maxYear = maxDate?.getFullYear();
|
|
1821
|
-
const getMonthLabel =
|
|
1935
|
+
const getMonthLabel = React26.useCallback(
|
|
1822
1936
|
(year, monthIndex) => {
|
|
1823
1937
|
const label = callbacks?.monthLabel?.(year, monthIndex);
|
|
1824
1938
|
if (label === null || label === void 0) {
|
|
@@ -1828,7 +1942,7 @@ function DatePicker({
|
|
|
1828
1942
|
},
|
|
1829
1943
|
[callbacks]
|
|
1830
1944
|
);
|
|
1831
|
-
const getYearLabel =
|
|
1945
|
+
const getYearLabel = React26.useCallback(
|
|
1832
1946
|
(year) => {
|
|
1833
1947
|
const label = callbacks?.yearLabel?.(year);
|
|
1834
1948
|
if (label === null || label === void 0) return String(year);
|
|
@@ -1836,7 +1950,7 @@ function DatePicker({
|
|
|
1836
1950
|
},
|
|
1837
1951
|
[callbacks]
|
|
1838
1952
|
);
|
|
1839
|
-
const clampMonthToBounds =
|
|
1953
|
+
const clampMonthToBounds = React26.useCallback(
|
|
1840
1954
|
(year, monthIndex) => {
|
|
1841
1955
|
let output = monthIndex;
|
|
1842
1956
|
if (typeof minYear === "number" && year === minYear && minDate) {
|
|
@@ -1851,7 +1965,7 @@ function DatePicker({
|
|
|
1851
1965
|
},
|
|
1852
1966
|
[maxDate, minDate, maxYear, minYear]
|
|
1853
1967
|
);
|
|
1854
|
-
const yearOptions =
|
|
1968
|
+
const yearOptions = React26.useMemo(() => {
|
|
1855
1969
|
const fallbackWindow = 50;
|
|
1856
1970
|
const start = typeof minYear === "number" ? minYear : displayYear - fallbackWindow;
|
|
1857
1971
|
const end = typeof maxYear === "number" ? maxYear : displayYear + fallbackWindow;
|
|
@@ -1872,7 +1986,7 @@ function DatePicker({
|
|
|
1872
1986
|
}
|
|
1873
1987
|
return years;
|
|
1874
1988
|
}, [displayYear, maxYear, minYear, selectedDate]);
|
|
1875
|
-
const monthOptions =
|
|
1989
|
+
const monthOptions = React26.useMemo(() => {
|
|
1876
1990
|
const months = Array.from({ length: 12 }, (_, monthIndex) => {
|
|
1877
1991
|
const disabled = typeof minYear === "number" && displayYear === minYear && minDate && monthIndex < minDate.getMonth() || typeof maxYear === "number" && displayYear === maxYear && maxDate && monthIndex > maxDate.getMonth();
|
|
1878
1992
|
return {
|
|
@@ -1891,7 +2005,7 @@ function DatePicker({
|
|
|
1891
2005
|
}
|
|
1892
2006
|
return months.sort((a, b) => a.value - b.value).filter((option, index, arr) => index === 0 || option.value !== arr[index - 1].value);
|
|
1893
2007
|
}, [displayMonth, displayYear, getMonthLabel, maxDate, maxYear, minDate, minYear]);
|
|
1894
|
-
const handleMonthSelect =
|
|
2008
|
+
const handleMonthSelect = React26.useCallback((nextValue) => {
|
|
1895
2009
|
const nextMonth = Number.parseInt(nextValue, 10);
|
|
1896
2010
|
if (Number.isNaN(nextMonth)) return;
|
|
1897
2011
|
setDisplayed((prev) => {
|
|
@@ -1901,7 +2015,7 @@ function DatePicker({
|
|
|
1901
2015
|
return next;
|
|
1902
2016
|
});
|
|
1903
2017
|
}, []);
|
|
1904
|
-
const handleYearSelect =
|
|
2018
|
+
const handleYearSelect = React26.useCallback(
|
|
1905
2019
|
(nextValue) => {
|
|
1906
2020
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
1907
2021
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -2049,14 +2163,14 @@ var DatePicker2 = ({
|
|
|
2049
2163
|
ariaLabel,
|
|
2050
2164
|
...calendarProps
|
|
2051
2165
|
}) => {
|
|
2052
|
-
const [open, setOpen] =
|
|
2053
|
-
const parser =
|
|
2054
|
-
const outputFormatter =
|
|
2055
|
-
const labelFormatter =
|
|
2166
|
+
const [open, setOpen] = React26__default.useState(false);
|
|
2167
|
+
const parser = React26__default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
|
|
2168
|
+
const outputFormatter = React26__default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
|
|
2169
|
+
const labelFormatter = React26__default.useMemo(
|
|
2056
2170
|
() => displayFormatter ?? defaultDisplayFormatter,
|
|
2057
2171
|
[displayFormatter]
|
|
2058
2172
|
);
|
|
2059
|
-
const parsedValue =
|
|
2173
|
+
const parsedValue = React26__default.useMemo(() => {
|
|
2060
2174
|
if (value === null || value === void 0) return void 0;
|
|
2061
2175
|
if (value instanceof Date) return value;
|
|
2062
2176
|
const parsed = parser(value);
|
|
@@ -2065,26 +2179,26 @@ var DatePicker2 = ({
|
|
|
2065
2179
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
|
|
2066
2180
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change date, current selection ${labelFormatter(parsedValue)}` : "Open date picker");
|
|
2067
2181
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
2068
|
-
const handleClose =
|
|
2069
|
-
const emitChange =
|
|
2182
|
+
const handleClose = React26__default.useCallback(() => setOpen(false), []);
|
|
2183
|
+
const emitChange = React26__default.useCallback(
|
|
2070
2184
|
(next) => {
|
|
2071
2185
|
onChange?.(next);
|
|
2072
2186
|
onValueChange?.(next ? outputFormatter(next) : void 0);
|
|
2073
2187
|
},
|
|
2074
2188
|
[onChange, onValueChange, outputFormatter]
|
|
2075
2189
|
);
|
|
2076
|
-
const handleSelect =
|
|
2190
|
+
const handleSelect = React26__default.useCallback(
|
|
2077
2191
|
(next) => {
|
|
2078
2192
|
emitChange(next);
|
|
2079
2193
|
if (closeOnSelect && next) handleClose();
|
|
2080
2194
|
},
|
|
2081
2195
|
[closeOnSelect, emitChange, handleClose]
|
|
2082
2196
|
);
|
|
2083
|
-
const handleClear =
|
|
2197
|
+
const handleClear = React26__default.useCallback(() => {
|
|
2084
2198
|
emitChange(void 0);
|
|
2085
2199
|
handleClose();
|
|
2086
2200
|
}, [emitChange, handleClose]);
|
|
2087
|
-
const handleOpenChange =
|
|
2201
|
+
const handleOpenChange = React26__default.useCallback(
|
|
2088
2202
|
(nextOpen) => {
|
|
2089
2203
|
if (disabled && nextOpen) return;
|
|
2090
2204
|
setOpen(nextOpen);
|
|
@@ -2274,15 +2388,15 @@ function MonthCal({
|
|
|
2274
2388
|
onYearBackward,
|
|
2275
2389
|
onYearForward
|
|
2276
2390
|
}) {
|
|
2277
|
-
const today =
|
|
2391
|
+
const today = React26.useMemo(() => {
|
|
2278
2392
|
const now = /* @__PURE__ */ new Date();
|
|
2279
2393
|
now.setDate(1);
|
|
2280
2394
|
now.setHours(0, 0, 0, 0);
|
|
2281
2395
|
return now;
|
|
2282
2396
|
}, []);
|
|
2283
|
-
const selectedMonthDate =
|
|
2284
|
-
const min =
|
|
2285
|
-
const max =
|
|
2397
|
+
const selectedMonthDate = React26.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
|
|
2398
|
+
const min = React26.useMemo(() => normalizeMonth(minDate), [minDate]);
|
|
2399
|
+
const max = React26.useMemo(() => normalizeMonth(maxDate), [maxDate]);
|
|
2286
2400
|
let effectiveMin = min;
|
|
2287
2401
|
if (min && max && min > max) {
|
|
2288
2402
|
effectiveMin = max;
|
|
@@ -2291,10 +2405,10 @@ function MonthCal({
|
|
|
2291
2405
|
const minMonth = effectiveMin?.getMonth();
|
|
2292
2406
|
const maxYear = max?.getFullYear();
|
|
2293
2407
|
const maxMonth = max?.getMonth();
|
|
2294
|
-
const [menuYear, setMenuYear] =
|
|
2408
|
+
const [menuYear, setMenuYear] = React26.useState(
|
|
2295
2409
|
() => selectedMonthDate?.getFullYear() ?? today.getFullYear()
|
|
2296
2410
|
);
|
|
2297
|
-
|
|
2411
|
+
React26.useEffect(() => {
|
|
2298
2412
|
if (selectedMonthDate) {
|
|
2299
2413
|
const year = selectedMonthDate.getFullYear();
|
|
2300
2414
|
if (year !== menuYear) {
|
|
@@ -2302,7 +2416,7 @@ function MonthCal({
|
|
|
2302
2416
|
}
|
|
2303
2417
|
}
|
|
2304
2418
|
}, [selectedMonthDate, menuYear]);
|
|
2305
|
-
|
|
2419
|
+
React26.useEffect(() => {
|
|
2306
2420
|
if (typeof minYear === "number" && menuYear < minYear) {
|
|
2307
2421
|
setMenuYear(minYear);
|
|
2308
2422
|
return;
|
|
@@ -2313,7 +2427,7 @@ function MonthCal({
|
|
|
2313
2427
|
}, [minYear, maxYear, menuYear]);
|
|
2314
2428
|
const disablePrevYear = typeof minYear === "number" ? menuYear <= minYear : false;
|
|
2315
2429
|
const disableNextYear = typeof maxYear === "number" ? menuYear >= maxYear : false;
|
|
2316
|
-
const yearOptions =
|
|
2430
|
+
const yearOptions = React26.useMemo(() => {
|
|
2317
2431
|
const fallbackWindow = 50;
|
|
2318
2432
|
const start = typeof minYear === "number" ? minYear : menuYear - fallbackWindow;
|
|
2319
2433
|
const end = typeof maxYear === "number" ? maxYear : menuYear + fallbackWindow;
|
|
@@ -2327,7 +2441,7 @@ function MonthCal({
|
|
|
2327
2441
|
}
|
|
2328
2442
|
return years;
|
|
2329
2443
|
}, [maxYear, menuYear, minYear]);
|
|
2330
|
-
const formatYearLabel =
|
|
2444
|
+
const formatYearLabel = React26.useCallback(
|
|
2331
2445
|
(year) => {
|
|
2332
2446
|
const raw = callbacks?.yearLabel?.(year);
|
|
2333
2447
|
if (raw === null || raw === void 0) return String(year);
|
|
@@ -2335,7 +2449,7 @@ function MonthCal({
|
|
|
2335
2449
|
},
|
|
2336
2450
|
[callbacks]
|
|
2337
2451
|
);
|
|
2338
|
-
const handleYearSelect =
|
|
2452
|
+
const handleYearSelect = React26.useCallback(
|
|
2339
2453
|
(nextValue) => {
|
|
2340
2454
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
2341
2455
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -2345,7 +2459,7 @@ function MonthCal({
|
|
|
2345
2459
|
},
|
|
2346
2460
|
[maxYear, minYear]
|
|
2347
2461
|
);
|
|
2348
|
-
const disabledPairs =
|
|
2462
|
+
const disabledPairs = React26.useMemo(() => {
|
|
2349
2463
|
if (!disabledDates?.length) return [];
|
|
2350
2464
|
const pairs = [];
|
|
2351
2465
|
disabledDates.forEach((date) => {
|
|
@@ -2490,14 +2604,14 @@ var MonthPicker2 = ({
|
|
|
2490
2604
|
ariaLabel,
|
|
2491
2605
|
...calendarProps
|
|
2492
2606
|
}) => {
|
|
2493
|
-
const [open, setOpen] =
|
|
2494
|
-
const parser =
|
|
2495
|
-
const outputFormatter =
|
|
2496
|
-
const labelFormatter =
|
|
2607
|
+
const [open, setOpen] = React26__default.useState(false);
|
|
2608
|
+
const parser = React26__default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
|
|
2609
|
+
const outputFormatter = React26__default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
|
|
2610
|
+
const labelFormatter = React26__default.useMemo(
|
|
2497
2611
|
() => displayFormatter ?? defaultDisplayFormatter2,
|
|
2498
2612
|
[displayFormatter]
|
|
2499
2613
|
);
|
|
2500
|
-
const parsedValue =
|
|
2614
|
+
const parsedValue = React26__default.useMemo(() => {
|
|
2501
2615
|
if (value === null || value === void 0) return void 0;
|
|
2502
2616
|
if (value instanceof Date) return normalizeMonth2(value);
|
|
2503
2617
|
if (typeof value === "string") {
|
|
@@ -2509,8 +2623,8 @@ var MonthPicker2 = ({
|
|
|
2509
2623
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
|
|
2510
2624
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change month, current selection ${labelFormatter(parsedValue)}` : "Open month picker");
|
|
2511
2625
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
2512
|
-
const handleClose =
|
|
2513
|
-
const emitChange =
|
|
2626
|
+
const handleClose = React26__default.useCallback(() => setOpen(false), []);
|
|
2627
|
+
const emitChange = React26__default.useCallback(
|
|
2514
2628
|
(next) => {
|
|
2515
2629
|
const normalized = next ? normalizeMonth2(next) : void 0;
|
|
2516
2630
|
onChange?.(normalized);
|
|
@@ -2518,18 +2632,18 @@ var MonthPicker2 = ({
|
|
|
2518
2632
|
},
|
|
2519
2633
|
[onChange, onValueChange, outputFormatter]
|
|
2520
2634
|
);
|
|
2521
|
-
const handleSelect =
|
|
2635
|
+
const handleSelect = React26__default.useCallback(
|
|
2522
2636
|
(next) => {
|
|
2523
2637
|
emitChange(next);
|
|
2524
2638
|
if (closeOnSelect && next) handleClose();
|
|
2525
2639
|
},
|
|
2526
2640
|
[closeOnSelect, emitChange, handleClose]
|
|
2527
2641
|
);
|
|
2528
|
-
const handleClear =
|
|
2642
|
+
const handleClear = React26__default.useCallback(() => {
|
|
2529
2643
|
emitChange(void 0);
|
|
2530
2644
|
handleClose();
|
|
2531
2645
|
}, [emitChange, handleClose]);
|
|
2532
|
-
const handleOpenChange =
|
|
2646
|
+
const handleOpenChange = React26__default.useCallback(
|
|
2533
2647
|
(nextOpen) => {
|
|
2534
2648
|
if (disabled && nextOpen) return;
|
|
2535
2649
|
setOpen(nextOpen);
|
|
@@ -3799,7 +3913,7 @@ var AdvanceSearch = ({
|
|
|
3799
3913
|
defaultValues: {}
|
|
3800
3914
|
});
|
|
3801
3915
|
const { handleSubmit, unregister, resetField, getValues, clearErrors, setError } = form;
|
|
3802
|
-
const [operatorErrors, setOperatorErrors] =
|
|
3916
|
+
const [operatorErrors, setOperatorErrors] = React26__default.useState({});
|
|
3803
3917
|
const clearOperatorError = useCallback(
|
|
3804
3918
|
(rowId) => {
|
|
3805
3919
|
setOperatorErrors((prev) => {
|
|
@@ -4217,13 +4331,13 @@ var useControllableState = ({
|
|
|
4217
4331
|
defaultValue,
|
|
4218
4332
|
value
|
|
4219
4333
|
}) => {
|
|
4220
|
-
const [internalValue, setInternalValue] =
|
|
4221
|
-
|
|
4334
|
+
const [internalValue, setInternalValue] = React26.useState(value ?? defaultValue);
|
|
4335
|
+
React26.useEffect(() => {
|
|
4222
4336
|
if (value !== internalValue) {
|
|
4223
4337
|
setInternalValue(value);
|
|
4224
4338
|
}
|
|
4225
4339
|
}, [value]);
|
|
4226
|
-
const updateState =
|
|
4340
|
+
const updateState = React26.useCallback((nextValue) => {
|
|
4227
4341
|
setInternalValue(nextValue);
|
|
4228
4342
|
}, []);
|
|
4229
4343
|
return {
|
|
@@ -4232,6 +4346,7 @@ var useControllableState = ({
|
|
|
4232
4346
|
};
|
|
4233
4347
|
};
|
|
4234
4348
|
var useControllableState_default = useControllableState;
|
|
4349
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
4235
4350
|
var HeaderCell = ({
|
|
4236
4351
|
rootClassName,
|
|
4237
4352
|
labelClassName,
|
|
@@ -4429,7 +4544,7 @@ var ColumnSeparator = ({ show, className, ...props }) => {
|
|
|
4429
4544
|
}
|
|
4430
4545
|
);
|
|
4431
4546
|
};
|
|
4432
|
-
var ColumnSeparator_default =
|
|
4547
|
+
var ColumnSeparator_default = React26__default.memo(ColumnSeparator);
|
|
4433
4548
|
var StatusContentSlot = ({
|
|
4434
4549
|
content,
|
|
4435
4550
|
icon,
|
|
@@ -4448,7 +4563,7 @@ var StatusContentSlot = ({
|
|
|
4448
4563
|
content
|
|
4449
4564
|
] });
|
|
4450
4565
|
};
|
|
4451
|
-
var StatusContentSlot_default =
|
|
4566
|
+
var StatusContentSlot_default = React26__default.memo(StatusContentSlot);
|
|
4452
4567
|
var stateOptions = [
|
|
4453
4568
|
"columnFilters",
|
|
4454
4569
|
"globalFilter",
|
|
@@ -5452,9 +5567,13 @@ function DialogAlert({
|
|
|
5452
5567
|
onOpenChange(false);
|
|
5453
5568
|
}, [onCancel, onOpenChange]);
|
|
5454
5569
|
const handleConfirm = useCallback(() => {
|
|
5455
|
-
onConfirm
|
|
5570
|
+
let func = onConfirm;
|
|
5571
|
+
if (variant === "success" && showCancel === false) {
|
|
5572
|
+
func = onConfirm ?? onCancel;
|
|
5573
|
+
}
|
|
5574
|
+
func?.();
|
|
5456
5575
|
onOpenChange(false);
|
|
5457
|
-
}, [onConfirm, onOpenChange]);
|
|
5576
|
+
}, [onCancel, onConfirm, onOpenChange, showCancel, variant]);
|
|
5458
5577
|
return /* @__PURE__ */ jsx(Dialog2, { open, onOpenChange: persistent ? () => {
|
|
5459
5578
|
} : onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent2, { className: "max-w-md", showCloseButton: !persistent, children: [
|
|
5460
5579
|
/* @__PURE__ */ jsxs(DialogHeader2, { children: [
|
|
@@ -5957,8 +6076,8 @@ var DISALLOWED_MARKS = ["bold", "italic", "link"];
|
|
|
5957
6076
|
var SUGGESTION_DEBOUNCE = 200;
|
|
5958
6077
|
var DEFAULT_CHIP_CLASS = "outline-1 outline-muted bg-muted/40 text-foreground";
|
|
5959
6078
|
var TokenView = ({ node, editor, getPos }) => {
|
|
5960
|
-
const [isFocused, setIsFocused] =
|
|
5961
|
-
|
|
6079
|
+
const [isFocused, setIsFocused] = React26__default.useState(false);
|
|
6080
|
+
React26__default.useEffect(() => {
|
|
5962
6081
|
const handler = () => {
|
|
5963
6082
|
const { from, to } = editor.state.selection;
|
|
5964
6083
|
const position = getPos();
|
|
@@ -7078,7 +7197,7 @@ function ToolbarPlugin({
|
|
|
7078
7197
|
isLink: hasLink
|
|
7079
7198
|
}));
|
|
7080
7199
|
}, []);
|
|
7081
|
-
|
|
7200
|
+
React26.useEffect(() => {
|
|
7082
7201
|
return mergeRegister(
|
|
7083
7202
|
editor.registerCommand(
|
|
7084
7203
|
CAN_UNDO_COMMAND,
|
|
@@ -7664,7 +7783,7 @@ function ControlledValuePlugin({
|
|
|
7664
7783
|
trackAppliedValue
|
|
7665
7784
|
}) {
|
|
7666
7785
|
const [editor] = useLexicalComposerContext();
|
|
7667
|
-
|
|
7786
|
+
React26.useEffect(() => {
|
|
7668
7787
|
if (value == null || trackAppliedValue.current === value) {
|
|
7669
7788
|
return;
|
|
7670
7789
|
}
|
|
@@ -7688,14 +7807,14 @@ function ControlledValuePlugin({
|
|
|
7688
7807
|
}
|
|
7689
7808
|
function EditableStatePlugin({ editable }) {
|
|
7690
7809
|
const [editor] = useLexicalComposerContext();
|
|
7691
|
-
|
|
7810
|
+
React26.useEffect(() => {
|
|
7692
7811
|
editor.setEditable(editable);
|
|
7693
7812
|
}, [editor, editable]);
|
|
7694
7813
|
return null;
|
|
7695
7814
|
}
|
|
7696
7815
|
function ImagesPlugin() {
|
|
7697
7816
|
const [editor] = useLexicalComposerContext();
|
|
7698
|
-
|
|
7817
|
+
React26.useEffect(() => {
|
|
7699
7818
|
return editor.registerCommand(
|
|
7700
7819
|
INSERT_IMAGE_COMMAND,
|
|
7701
7820
|
(payload) => {
|
|
@@ -7976,9 +8095,9 @@ var SIDEBAR_WIDTH = "16rem";
|
|
|
7976
8095
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
7977
8096
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
7978
8097
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
7979
|
-
var SidebarContext =
|
|
8098
|
+
var SidebarContext = React26.createContext(null);
|
|
7980
8099
|
function useSidebar() {
|
|
7981
|
-
const context =
|
|
8100
|
+
const context = React26.useContext(SidebarContext);
|
|
7982
8101
|
if (!context) {
|
|
7983
8102
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
7984
8103
|
}
|
|
@@ -7994,10 +8113,10 @@ function SidebarProvider({
|
|
|
7994
8113
|
...props
|
|
7995
8114
|
}) {
|
|
7996
8115
|
const isMobile = useIsMobile();
|
|
7997
|
-
const [openMobile, setOpenMobile] =
|
|
7998
|
-
const [_open, _setOpen] =
|
|
8116
|
+
const [openMobile, setOpenMobile] = React26.useState(false);
|
|
8117
|
+
const [_open, _setOpen] = React26.useState(defaultOpen);
|
|
7999
8118
|
const open = openProp ?? _open;
|
|
8000
|
-
const setOpen =
|
|
8119
|
+
const setOpen = React26.useCallback(
|
|
8001
8120
|
(value) => {
|
|
8002
8121
|
const openState = typeof value === "function" ? value(open) : value;
|
|
8003
8122
|
if (setOpenProp) {
|
|
@@ -8009,10 +8128,10 @@ function SidebarProvider({
|
|
|
8009
8128
|
},
|
|
8010
8129
|
[setOpenProp, open]
|
|
8011
8130
|
);
|
|
8012
|
-
const toggleSidebar =
|
|
8131
|
+
const toggleSidebar = React26.useCallback(() => {
|
|
8013
8132
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
8014
8133
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
8015
|
-
|
|
8134
|
+
React26.useEffect(() => {
|
|
8016
8135
|
const handleKeyDown = (event) => {
|
|
8017
8136
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
8018
8137
|
event.preventDefault();
|
|
@@ -8023,7 +8142,7 @@ function SidebarProvider({
|
|
|
8023
8142
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
8024
8143
|
}, [toggleSidebar]);
|
|
8025
8144
|
const state = open ? "expanded" : "collapsed";
|
|
8026
|
-
const contextValue =
|
|
8145
|
+
const contextValue = React26.useMemo(
|
|
8027
8146
|
() => ({
|
|
8028
8147
|
state,
|
|
8029
8148
|
open,
|
|
@@ -8465,7 +8584,7 @@ function SidebarMenuSkeleton({
|
|
|
8465
8584
|
showIcon = false,
|
|
8466
8585
|
...props
|
|
8467
8586
|
}) {
|
|
8468
|
-
const width =
|
|
8587
|
+
const width = React26.useMemo(() => {
|
|
8469
8588
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
8470
8589
|
}, []);
|
|
8471
8590
|
return /* @__PURE__ */ jsxs(
|
|
@@ -8934,7 +9053,7 @@ function SortableRow({
|
|
|
8934
9053
|
id: value,
|
|
8935
9054
|
disabled: name === "columns.0.id"
|
|
8936
9055
|
});
|
|
8937
|
-
const style =
|
|
9056
|
+
const style = React26.useMemo(
|
|
8938
9057
|
() => ({
|
|
8939
9058
|
transform: CSS.Transform.toString(transform),
|
|
8940
9059
|
transition
|
|
@@ -9336,7 +9455,7 @@ function getCandidateWidths({
|
|
|
9336
9455
|
}
|
|
9337
9456
|
return DEVICE_SIZES;
|
|
9338
9457
|
}
|
|
9339
|
-
var Image2 =
|
|
9458
|
+
var Image2 = React26.forwardRef(function Image3({
|
|
9340
9459
|
src,
|
|
9341
9460
|
alt,
|
|
9342
9461
|
width,
|
|
@@ -9366,34 +9485,34 @@ var Image2 = React4.forwardRef(function Image3({
|
|
|
9366
9485
|
} = imgProps;
|
|
9367
9486
|
const widthNumber = toNumber(width);
|
|
9368
9487
|
const heightNumber = toNumber(height);
|
|
9369
|
-
|
|
9488
|
+
React26.useEffect(() => {
|
|
9370
9489
|
if (!fill && (!widthNumber || !heightNumber)) {
|
|
9371
9490
|
console.warn(
|
|
9372
9491
|
"[Image] When `fill` is false you should provide both `width` and `height` to prevent layout shifts."
|
|
9373
9492
|
);
|
|
9374
9493
|
}
|
|
9375
9494
|
}, [fill, heightNumber, widthNumber]);
|
|
9376
|
-
const candidateWidths =
|
|
9495
|
+
const candidateWidths = React26.useMemo(
|
|
9377
9496
|
() => getCandidateWidths({ width: widthNumber, sizes, fill }),
|
|
9378
9497
|
[fill, sizes, widthNumber]
|
|
9379
9498
|
);
|
|
9380
9499
|
const largestWidth = candidateWidths[candidateWidths.length - 1] ?? widthNumber ?? DEVICE_SIZES[DEVICE_SIZES.length - 1];
|
|
9381
|
-
const computedSrc =
|
|
9500
|
+
const computedSrc = React26.useMemo(() => {
|
|
9382
9501
|
if (unoptimized) {
|
|
9383
9502
|
return src;
|
|
9384
9503
|
}
|
|
9385
9504
|
return loader({ src, width: largestWidth, quality });
|
|
9386
9505
|
}, [largestWidth, loader, quality, src, unoptimized]);
|
|
9387
|
-
const computedSrcSet =
|
|
9506
|
+
const computedSrcSet = React26.useMemo(() => {
|
|
9388
9507
|
if (unoptimized) {
|
|
9389
9508
|
return void 0;
|
|
9390
9509
|
}
|
|
9391
9510
|
return candidateWidths.map((currentWidth) => `${loader({ src, width: currentWidth, quality })} ${currentWidth}w`).join(", ");
|
|
9392
9511
|
}, [candidateWidths, loader, quality, src, unoptimized]);
|
|
9393
9512
|
const sizesValue = sizes ?? (fill ? "100vw" : widthNumber ? `${widthNumber}px` : void 0);
|
|
9394
|
-
const [isLoaded, setIsLoaded] =
|
|
9395
|
-
const internalRef =
|
|
9396
|
-
const setRefs =
|
|
9513
|
+
const [isLoaded, setIsLoaded] = React26.useState(false);
|
|
9514
|
+
const internalRef = React26.useRef(null);
|
|
9515
|
+
const setRefs = React26.useCallback(
|
|
9397
9516
|
(node) => {
|
|
9398
9517
|
internalRef.current = node;
|
|
9399
9518
|
if (!ref) {
|
|
@@ -9407,7 +9526,7 @@ var Image2 = React4.forwardRef(function Image3({
|
|
|
9407
9526
|
},
|
|
9408
9527
|
[ref]
|
|
9409
9528
|
);
|
|
9410
|
-
|
|
9529
|
+
React26.useEffect(() => {
|
|
9411
9530
|
const image = internalRef.current;
|
|
9412
9531
|
if (!image) {
|
|
9413
9532
|
return;
|
|
@@ -9419,7 +9538,7 @@ var Image2 = React4.forwardRef(function Image3({
|
|
|
9419
9538
|
setIsLoaded(false);
|
|
9420
9539
|
}
|
|
9421
9540
|
}, [onLoadingComplete, src]);
|
|
9422
|
-
const handleLoad =
|
|
9541
|
+
const handleLoad = React26.useCallback(
|
|
9423
9542
|
(event) => {
|
|
9424
9543
|
setIsLoaded(true);
|
|
9425
9544
|
onLoadProp?.(event);
|
|
@@ -9431,7 +9550,7 @@ var Image2 = React4.forwardRef(function Image3({
|
|
|
9431
9550
|
const fetchPriority = priority ? "high" : fetchPriorityProp;
|
|
9432
9551
|
const decoding = decodingProp ?? "async";
|
|
9433
9552
|
const resolvedObjectFit = objectFit ?? (fill ? "cover" : void 0);
|
|
9434
|
-
const wrapperStyle =
|
|
9553
|
+
const wrapperStyle = React26.useMemo(
|
|
9435
9554
|
() => ({
|
|
9436
9555
|
position: "relative",
|
|
9437
9556
|
display: fill ? "block" : "inline-block",
|
|
@@ -9441,7 +9560,7 @@ var Image2 = React4.forwardRef(function Image3({
|
|
|
9441
9560
|
}),
|
|
9442
9561
|
[fill, height, width]
|
|
9443
9562
|
);
|
|
9444
|
-
const imageStyle =
|
|
9563
|
+
const imageStyle = React26.useMemo(
|
|
9445
9564
|
() => ({
|
|
9446
9565
|
width: fill ? "100%" : formatDimension(width) ?? void 0,
|
|
9447
9566
|
height: fill ? "100%" : formatDimension(height) ?? void 0,
|
|
@@ -9503,7 +9622,7 @@ var Image2 = React4.forwardRef(function Image3({
|
|
|
9503
9622
|
});
|
|
9504
9623
|
Image2.displayName = "Image";
|
|
9505
9624
|
var ListTable = ({ onTableReady, children }) => {
|
|
9506
|
-
|
|
9625
|
+
React26.useEffect(() => {
|
|
9507
9626
|
if (onTableReady) {
|
|
9508
9627
|
onTableReady({ ready: true });
|
|
9509
9628
|
}
|
|
@@ -9548,7 +9667,7 @@ var ListHeader = ({
|
|
|
9548
9667
|
return /* @__PURE__ */ jsx("div", { "data-testid": "list-header", className: cn("rounded-t-lg px-4 py-2", bgColor, className), children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
9549
9668
|
/* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2 text-lg", textClassName), children: [
|
|
9550
9669
|
titleIcon,
|
|
9551
|
-
|
|
9670
|
+
title
|
|
9552
9671
|
] }),
|
|
9553
9672
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: rightActions ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9554
9673
|
onSettingClick && /* @__PURE__ */ jsx(
|
|
@@ -9648,7 +9767,7 @@ var InfoIcon = (props) => {
|
|
|
9648
9767
|
}
|
|
9649
9768
|
);
|
|
9650
9769
|
};
|
|
9651
|
-
var InfoIcon_default =
|
|
9770
|
+
var InfoIcon_default = React26__default.memo(InfoIcon);
|
|
9652
9771
|
var Navbar = ({
|
|
9653
9772
|
className,
|
|
9654
9773
|
title,
|
|
@@ -9780,7 +9899,7 @@ var Navbar = ({
|
|
|
9780
9899
|
}
|
|
9781
9900
|
);
|
|
9782
9901
|
};
|
|
9783
|
-
var navbar_default =
|
|
9902
|
+
var navbar_default = React26__default.memo(Navbar);
|
|
9784
9903
|
var usePreventPageLeaveStore = create((set) => ({
|
|
9785
9904
|
isPreventing: false,
|
|
9786
9905
|
setPreventing: (value) => set({ isPreventing: value })
|
|
@@ -10056,6 +10175,231 @@ var CropperModal = ({
|
|
|
10056
10175
|
}
|
|
10057
10176
|
);
|
|
10058
10177
|
};
|
|
10178
|
+
var REACT_ELEMENT_TYPE_18 = /* @__PURE__ */ Symbol.for("react.element");
|
|
10179
|
+
var REACT_ELEMENT_TYPE_19 = /* @__PURE__ */ Symbol.for("react.transitional.element");
|
|
10180
|
+
var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
10181
|
+
function isFragment(object) {
|
|
10182
|
+
return (
|
|
10183
|
+
// Base object type
|
|
10184
|
+
object && typeof object === "object" && // React Element type
|
|
10185
|
+
(object.$$typeof === REACT_ELEMENT_TYPE_18 || object.$$typeof === REACT_ELEMENT_TYPE_19) && // React Fragment type
|
|
10186
|
+
object.type === REACT_FRAGMENT_TYPE
|
|
10187
|
+
);
|
|
10188
|
+
}
|
|
10189
|
+
var isValidText = (val) => ["string", "number"].includes(typeof val);
|
|
10190
|
+
function toArray(children, option = {}) {
|
|
10191
|
+
let ret = [];
|
|
10192
|
+
React26.Children.forEach(children, (child) => {
|
|
10193
|
+
if ((child === void 0 || child === null) && !option.keepEmpty) {
|
|
10194
|
+
return;
|
|
10195
|
+
}
|
|
10196
|
+
if (Array.isArray(child)) {
|
|
10197
|
+
ret = ret.concat(toArray(child));
|
|
10198
|
+
} else if (isFragment(child) && child.props) {
|
|
10199
|
+
ret = ret.concat(toArray(child.props.children, option));
|
|
10200
|
+
} else {
|
|
10201
|
+
ret.push(child);
|
|
10202
|
+
}
|
|
10203
|
+
});
|
|
10204
|
+
return ret;
|
|
10205
|
+
}
|
|
10206
|
+
var MeasureText = React26.forwardRef(({ style, children }, ref) => {
|
|
10207
|
+
const spanRef = React26.useRef(null);
|
|
10208
|
+
React26.useImperativeHandle(ref, () => ({
|
|
10209
|
+
isExceed: () => {
|
|
10210
|
+
const span = spanRef.current;
|
|
10211
|
+
return span.scrollHeight > span.clientHeight;
|
|
10212
|
+
},
|
|
10213
|
+
getHeight: () => spanRef.current.clientHeight
|
|
10214
|
+
}));
|
|
10215
|
+
return /* @__PURE__ */ jsx(
|
|
10216
|
+
"span",
|
|
10217
|
+
{
|
|
10218
|
+
"aria-hidden": true,
|
|
10219
|
+
ref: spanRef,
|
|
10220
|
+
style: {
|
|
10221
|
+
position: "fixed",
|
|
10222
|
+
display: "block",
|
|
10223
|
+
left: 0,
|
|
10224
|
+
top: 0,
|
|
10225
|
+
pointerEvents: "none",
|
|
10226
|
+
...style
|
|
10227
|
+
},
|
|
10228
|
+
children
|
|
10229
|
+
}
|
|
10230
|
+
);
|
|
10231
|
+
});
|
|
10232
|
+
var getNodesLen = (nodeList) => nodeList.reduce((totalLen, node) => totalLen + (isValidText(node) ? String(node).length : 1), 0);
|
|
10233
|
+
function sliceNodes(nodeList, len) {
|
|
10234
|
+
let currLen = 0;
|
|
10235
|
+
const currentNodeList = [];
|
|
10236
|
+
for (let i = 0; i < nodeList.length; i += 1) {
|
|
10237
|
+
if (currLen === len) {
|
|
10238
|
+
return currentNodeList;
|
|
10239
|
+
}
|
|
10240
|
+
const node = nodeList[i];
|
|
10241
|
+
const canCut = isValidText(node);
|
|
10242
|
+
const nodeLen = canCut ? String(node).length : 1;
|
|
10243
|
+
const nextLen = currLen + nodeLen;
|
|
10244
|
+
if (nextLen > len) {
|
|
10245
|
+
const restLen = len - currLen;
|
|
10246
|
+
currentNodeList.push(String(node).slice(0, restLen));
|
|
10247
|
+
return currentNodeList;
|
|
10248
|
+
}
|
|
10249
|
+
currentNodeList.push(node);
|
|
10250
|
+
currLen = nextLen;
|
|
10251
|
+
}
|
|
10252
|
+
return nodeList;
|
|
10253
|
+
}
|
|
10254
|
+
var STATUS_MEASURE_NONE = 0;
|
|
10255
|
+
var STATUS_MEASURE_PREPARE = 1;
|
|
10256
|
+
var STATUS_MEASURE_START = 2;
|
|
10257
|
+
var STATUS_MEASURE_NEED_ELLIPSIS = 3;
|
|
10258
|
+
var STATUS_MEASURE_NO_NEED_ELLIPSIS = 4;
|
|
10259
|
+
var lineClipStyle = {
|
|
10260
|
+
display: "-webkit-box",
|
|
10261
|
+
overflow: "hidden",
|
|
10262
|
+
WebkitBoxOrient: "vertical"
|
|
10263
|
+
};
|
|
10264
|
+
function EllipsisMeasure(props) {
|
|
10265
|
+
const { enableMeasure, width, text, children, rows, expanded, miscDeps, onEllipsis } = props;
|
|
10266
|
+
const nodeList = React26.useMemo(() => toArray(text), [text]);
|
|
10267
|
+
const nodeLen = React26.useMemo(() => getNodesLen(nodeList), [text]);
|
|
10268
|
+
const fullContent = React26.useMemo(() => children(nodeList, false), [text]);
|
|
10269
|
+
const [ellipsisCutIndex, setEllipsisCutIndex] = React26.useState(null);
|
|
10270
|
+
const cutMidRef = React26.useRef(null);
|
|
10271
|
+
const measureWhiteSpaceRef = React26.useRef(null);
|
|
10272
|
+
const needEllipsisRef = React26.useRef(null);
|
|
10273
|
+
const descRowsEllipsisRef = React26.useRef(null);
|
|
10274
|
+
const symbolRowEllipsisRef = React26.useRef(null);
|
|
10275
|
+
const [canEllipsis, setCanEllipsis] = React26.useState(false);
|
|
10276
|
+
const [needEllipsis, setNeedEllipsis] = React26.useState(STATUS_MEASURE_NONE);
|
|
10277
|
+
const [ellipsisHeight, setEllipsisHeight] = React26.useState(0);
|
|
10278
|
+
const [parentWhiteSpace, setParentWhiteSpace] = React26.useState(null);
|
|
10279
|
+
useIsomorphicLayoutEffect(() => {
|
|
10280
|
+
if (enableMeasure && width && nodeLen) {
|
|
10281
|
+
setNeedEllipsis(STATUS_MEASURE_PREPARE);
|
|
10282
|
+
} else {
|
|
10283
|
+
setNeedEllipsis(STATUS_MEASURE_NONE);
|
|
10284
|
+
}
|
|
10285
|
+
}, [width, text, rows, enableMeasure, nodeList]);
|
|
10286
|
+
useIsomorphicLayoutEffect(() => {
|
|
10287
|
+
if (needEllipsis === STATUS_MEASURE_PREPARE) {
|
|
10288
|
+
setNeedEllipsis(STATUS_MEASURE_START);
|
|
10289
|
+
const nextWhiteSpace = measureWhiteSpaceRef.current && getComputedStyle(measureWhiteSpaceRef.current).whiteSpace;
|
|
10290
|
+
setParentWhiteSpace(nextWhiteSpace);
|
|
10291
|
+
} else if (needEllipsis === STATUS_MEASURE_START) {
|
|
10292
|
+
const isOverflow = !!needEllipsisRef.current?.isExceed();
|
|
10293
|
+
setNeedEllipsis(isOverflow ? STATUS_MEASURE_NEED_ELLIPSIS : STATUS_MEASURE_NO_NEED_ELLIPSIS);
|
|
10294
|
+
setEllipsisCutIndex(isOverflow ? [0, nodeLen] : null);
|
|
10295
|
+
setCanEllipsis(isOverflow);
|
|
10296
|
+
const baseRowsEllipsisHeight = needEllipsisRef.current?.getHeight() || 0;
|
|
10297
|
+
const descRowsEllipsisHeight = rows === 1 ? 0 : descRowsEllipsisRef.current?.getHeight() || 0;
|
|
10298
|
+
const symbolRowEllipsisHeight = symbolRowEllipsisRef.current?.getHeight() || 0;
|
|
10299
|
+
const maxRowsHeight = Math.max(
|
|
10300
|
+
baseRowsEllipsisHeight,
|
|
10301
|
+
// height of rows with ellipsis
|
|
10302
|
+
descRowsEllipsisHeight + symbolRowEllipsisHeight
|
|
10303
|
+
);
|
|
10304
|
+
setEllipsisHeight(maxRowsHeight + 1);
|
|
10305
|
+
onEllipsis(isOverflow);
|
|
10306
|
+
}
|
|
10307
|
+
}, [needEllipsis]);
|
|
10308
|
+
const cutMidIndex = ellipsisCutIndex ? Math.ceil((ellipsisCutIndex[0] + ellipsisCutIndex[1]) / 2) : 0;
|
|
10309
|
+
useIsomorphicLayoutEffect(() => {
|
|
10310
|
+
const [minIndex, maxIndex] = ellipsisCutIndex || [0, 0];
|
|
10311
|
+
if (minIndex !== maxIndex) {
|
|
10312
|
+
const midHeight = cutMidRef.current?.getHeight() || 0;
|
|
10313
|
+
const isOverflow = midHeight > ellipsisHeight;
|
|
10314
|
+
let targetMidIndex = cutMidIndex;
|
|
10315
|
+
if (maxIndex - minIndex === 1) {
|
|
10316
|
+
targetMidIndex = isOverflow ? minIndex : maxIndex;
|
|
10317
|
+
}
|
|
10318
|
+
setEllipsisCutIndex(isOverflow ? [minIndex, targetMidIndex] : [targetMidIndex, maxIndex]);
|
|
10319
|
+
}
|
|
10320
|
+
}, [ellipsisCutIndex, cutMidIndex]);
|
|
10321
|
+
const finalContent = React26.useMemo(() => {
|
|
10322
|
+
if (!enableMeasure) {
|
|
10323
|
+
return children(nodeList, false);
|
|
10324
|
+
}
|
|
10325
|
+
if (needEllipsis !== STATUS_MEASURE_NEED_ELLIPSIS || !ellipsisCutIndex || ellipsisCutIndex[0] !== ellipsisCutIndex[1]) {
|
|
10326
|
+
const content = children(nodeList, false);
|
|
10327
|
+
if ([STATUS_MEASURE_NO_NEED_ELLIPSIS, STATUS_MEASURE_NONE].includes(needEllipsis)) {
|
|
10328
|
+
return content;
|
|
10329
|
+
}
|
|
10330
|
+
return /* @__PURE__ */ jsx(
|
|
10331
|
+
"span",
|
|
10332
|
+
{
|
|
10333
|
+
style: {
|
|
10334
|
+
...lineClipStyle,
|
|
10335
|
+
WebkitLineClamp: rows
|
|
10336
|
+
},
|
|
10337
|
+
children: content
|
|
10338
|
+
}
|
|
10339
|
+
);
|
|
10340
|
+
}
|
|
10341
|
+
return children(expanded ? nodeList : sliceNodes(nodeList, ellipsisCutIndex[0]), canEllipsis);
|
|
10342
|
+
}, [expanded, needEllipsis, ellipsisCutIndex, nodeList, ...miscDeps]);
|
|
10343
|
+
const measureStyle = {
|
|
10344
|
+
width,
|
|
10345
|
+
margin: 0,
|
|
10346
|
+
padding: 0,
|
|
10347
|
+
whiteSpace: parentWhiteSpace === "nowrap" ? "normal" : "inherit"
|
|
10348
|
+
};
|
|
10349
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10350
|
+
finalContent,
|
|
10351
|
+
needEllipsis === STATUS_MEASURE_START && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10352
|
+
/* @__PURE__ */ jsx(
|
|
10353
|
+
MeasureText,
|
|
10354
|
+
{
|
|
10355
|
+
style: {
|
|
10356
|
+
...measureStyle,
|
|
10357
|
+
...lineClipStyle,
|
|
10358
|
+
WebkitLineClamp: rows
|
|
10359
|
+
},
|
|
10360
|
+
ref: needEllipsisRef,
|
|
10361
|
+
children: fullContent
|
|
10362
|
+
}
|
|
10363
|
+
),
|
|
10364
|
+
/* @__PURE__ */ jsx(
|
|
10365
|
+
MeasureText,
|
|
10366
|
+
{
|
|
10367
|
+
style: {
|
|
10368
|
+
...measureStyle,
|
|
10369
|
+
...lineClipStyle,
|
|
10370
|
+
WebkitLineClamp: rows - 1
|
|
10371
|
+
},
|
|
10372
|
+
ref: descRowsEllipsisRef,
|
|
10373
|
+
children: fullContent
|
|
10374
|
+
}
|
|
10375
|
+
),
|
|
10376
|
+
/* @__PURE__ */ jsx(
|
|
10377
|
+
MeasureText,
|
|
10378
|
+
{
|
|
10379
|
+
style: {
|
|
10380
|
+
...measureStyle,
|
|
10381
|
+
...lineClipStyle,
|
|
10382
|
+
WebkitLineClamp: 1
|
|
10383
|
+
},
|
|
10384
|
+
ref: symbolRowEllipsisRef,
|
|
10385
|
+
children: children([], true)
|
|
10386
|
+
}
|
|
10387
|
+
)
|
|
10388
|
+
] }),
|
|
10389
|
+
needEllipsis === STATUS_MEASURE_NEED_ELLIPSIS && ellipsisCutIndex && ellipsisCutIndex[0] !== ellipsisCutIndex[1] && /* @__PURE__ */ jsx(
|
|
10390
|
+
MeasureText,
|
|
10391
|
+
{
|
|
10392
|
+
style: {
|
|
10393
|
+
...measureStyle,
|
|
10394
|
+
top: 400
|
|
10395
|
+
},
|
|
10396
|
+
ref: cutMidRef,
|
|
10397
|
+
children: children(sliceNodes(nodeList, cutMidIndex), true)
|
|
10398
|
+
}
|
|
10399
|
+
),
|
|
10400
|
+
needEllipsis === STATUS_MEASURE_PREPARE && /* @__PURE__ */ jsx("span", { style: { whiteSpace: "inherit" }, ref: measureWhiteSpaceRef })
|
|
10401
|
+
] });
|
|
10402
|
+
}
|
|
10059
10403
|
var Truncated = ({
|
|
10060
10404
|
children,
|
|
10061
10405
|
className,
|
|
@@ -10065,49 +10409,41 @@ var Truncated = ({
|
|
|
10065
10409
|
tooltipProps,
|
|
10066
10410
|
tooltipContentProps
|
|
10067
10411
|
}) => {
|
|
10068
|
-
const elementRef = useRef(null);
|
|
10069
|
-
const [open, setOpen] = useState(false);
|
|
10070
|
-
const [isTruncated, setIsTruncated] = useState(false);
|
|
10412
|
+
const elementRef = React26.useRef(null);
|
|
10413
|
+
const [open, setOpen] = React26.useState(false);
|
|
10414
|
+
const [isTruncated, setIsTruncated] = React26.useState(false);
|
|
10415
|
+
const [measureWidth, setMeasureWidth] = React26.useState(0);
|
|
10071
10416
|
const Comp = as;
|
|
10072
10417
|
const normalizedChildren = typeof children === "string" ? children.replace(/>/g, ">\u200B") : children;
|
|
10073
10418
|
const lineClampLines = typeof ellipsis === "number" ? ellipsis : typeof ellipsis === "object" ? ellipsis?.lineClamp ?? 3 : null;
|
|
10074
|
-
|
|
10419
|
+
const enableMeasure = Boolean(ellipsis) && !tooltipProps?.disabled;
|
|
10420
|
+
useIsomorphicLayoutEffect(() => {
|
|
10075
10421
|
const el = elementRef.current;
|
|
10076
10422
|
if (!el) return;
|
|
10077
|
-
const
|
|
10078
|
-
if (!ellipsis) {
|
|
10079
|
-
setIsTruncated(false);
|
|
10080
|
-
return;
|
|
10081
|
-
}
|
|
10423
|
+
const updateWidth = () => {
|
|
10082
10424
|
const rect = el.getBoundingClientRect();
|
|
10083
|
-
const width = el.clientWidth || el.offsetWidth || rect.width;
|
|
10084
|
-
|
|
10085
|
-
if (!width || !height) {
|
|
10086
|
-
setIsTruncated(false);
|
|
10087
|
-
return;
|
|
10088
|
-
}
|
|
10089
|
-
const epsilon = 1;
|
|
10090
|
-
const overflowWidth = el.scrollWidth - width > epsilon;
|
|
10091
|
-
const overflowHeight = el.scrollHeight - height > epsilon;
|
|
10092
|
-
setIsTruncated(overflowWidth || overflowHeight);
|
|
10425
|
+
const width = el.clientWidth || el.offsetWidth || rect.width || 0;
|
|
10426
|
+
setMeasureWidth(width);
|
|
10093
10427
|
};
|
|
10094
|
-
|
|
10428
|
+
updateWidth();
|
|
10429
|
+
const resizeObserver = new ResizeObserver(() => requestAnimationFrame(updateWidth));
|
|
10095
10430
|
resizeObserver.observe(el);
|
|
10096
|
-
const mutationObserver = new MutationObserver(() => measure());
|
|
10097
|
-
mutationObserver.observe(el, { childList: true, subtree: true, characterData: true });
|
|
10098
|
-
requestAnimationFrame(measure);
|
|
10099
10431
|
return () => {
|
|
10100
10432
|
resizeObserver.disconnect();
|
|
10101
|
-
mutationObserver.disconnect();
|
|
10102
10433
|
};
|
|
10103
|
-
}, [
|
|
10104
|
-
|
|
10434
|
+
}, []);
|
|
10435
|
+
useIsomorphicLayoutEffect(() => {
|
|
10436
|
+
if (!enableMeasure) {
|
|
10437
|
+
setIsTruncated(false);
|
|
10438
|
+
}
|
|
10439
|
+
}, [enableMeasure]);
|
|
10440
|
+
const truncationClass = React26.useMemo(() => {
|
|
10105
10441
|
if (!ellipsis) return "";
|
|
10106
10442
|
if (typeof ellipsis === "number") return `line-clamp-${ellipsis}`;
|
|
10107
10443
|
if (typeof ellipsis === "object") return `line-clamp-${lineClampLines ?? 3}`;
|
|
10108
10444
|
return "truncate";
|
|
10109
10445
|
}, [ellipsis, lineClampLines]);
|
|
10110
|
-
const clampedStyle = useMemo(() => {
|
|
10446
|
+
const clampedStyle = React26.useMemo(() => {
|
|
10111
10447
|
if (!lineClampLines) return style;
|
|
10112
10448
|
return {
|
|
10113
10449
|
...style,
|
|
@@ -10117,7 +10453,19 @@ var Truncated = ({
|
|
|
10117
10453
|
overflow: "hidden"
|
|
10118
10454
|
};
|
|
10119
10455
|
}, [lineClampLines, style]);
|
|
10120
|
-
const baseContent = /* @__PURE__ */ jsx(Comp, { ref: elementRef, className: cn(truncationClass, className), style: clampedStyle, children:
|
|
10456
|
+
const baseContent = /* @__PURE__ */ jsx(Comp, { ref: elementRef, className: cn(truncationClass, className), style: clampedStyle, children: /* @__PURE__ */ jsx(
|
|
10457
|
+
EllipsisMeasure,
|
|
10458
|
+
{
|
|
10459
|
+
enableMeasure,
|
|
10460
|
+
text: normalizedChildren,
|
|
10461
|
+
width: measureWidth,
|
|
10462
|
+
rows: lineClampLines ?? 1,
|
|
10463
|
+
expanded: false,
|
|
10464
|
+
miscDeps: [truncationClass],
|
|
10465
|
+
onEllipsis: setIsTruncated,
|
|
10466
|
+
children: () => normalizedChildren
|
|
10467
|
+
}
|
|
10468
|
+
) });
|
|
10121
10469
|
let tooltipContent = normalizedChildren;
|
|
10122
10470
|
if (typeof ellipsis === "object") {
|
|
10123
10471
|
tooltipContent = ellipsis?.content ?? normalizedChildren;
|
|
@@ -10144,10 +10492,10 @@ var Truncated = ({
|
|
|
10144
10492
|
{
|
|
10145
10493
|
side: tooltipSide,
|
|
10146
10494
|
className: cn(
|
|
10147
|
-
"text-white bg-
|
|
10495
|
+
"text-white bg-sus-secondary-gray-10 max-w-xs sm:max-w-md wrap-break-word shadow-lg",
|
|
10148
10496
|
tooltipContentClassName
|
|
10149
10497
|
),
|
|
10150
|
-
arrowClassName: cn("bg-
|
|
10498
|
+
arrowClassName: cn("bg-sus-secondary-gray-10 fill-sus-secondary-gray-10", tooltipArrowClassName),
|
|
10151
10499
|
...tooltipContentRest,
|
|
10152
10500
|
children: tooltipContent
|
|
10153
10501
|
}
|
|
@@ -10157,7 +10505,7 @@ var Truncated = ({
|
|
|
10157
10505
|
);
|
|
10158
10506
|
};
|
|
10159
10507
|
var truncated_default = Truncated;
|
|
10160
|
-
var InputPrimitive2 =
|
|
10508
|
+
var InputPrimitive2 = React26.forwardRef(
|
|
10161
10509
|
({ className, type = "text", ...props }, ref) => {
|
|
10162
10510
|
return /* @__PURE__ */ jsx(
|
|
10163
10511
|
"input",
|
|
@@ -10196,7 +10544,7 @@ var inputVariants2 = cva("", {
|
|
|
10196
10544
|
appearance: "filled"
|
|
10197
10545
|
}
|
|
10198
10546
|
});
|
|
10199
|
-
var Input2 =
|
|
10547
|
+
var Input2 = React26.forwardRef(
|
|
10200
10548
|
({
|
|
10201
10549
|
className,
|
|
10202
10550
|
wrapperClassName,
|
|
@@ -10229,8 +10577,8 @@ var Input2 = React4.forwardRef(
|
|
|
10229
10577
|
onChange: onChangeProp
|
|
10230
10578
|
} = rest;
|
|
10231
10579
|
const ariaInvalid = invalid ?? ariaInvalidProp;
|
|
10232
|
-
const messageId =
|
|
10233
|
-
const handleChange =
|
|
10580
|
+
const messageId = React26.useId();
|
|
10581
|
+
const handleChange = React26.useCallback(
|
|
10234
10582
|
(event) => {
|
|
10235
10583
|
onChangeProp?.(event);
|
|
10236
10584
|
onValueChange?.(event.target.value);
|
|
@@ -10623,13 +10971,13 @@ var useFieldNames = ({
|
|
|
10623
10971
|
fieldNames
|
|
10624
10972
|
}) => {
|
|
10625
10973
|
const { label: labelFieldKey = "label", value: valueFieldKey = "value" } = fieldNames || {};
|
|
10626
|
-
const getLabelField =
|
|
10974
|
+
const getLabelField = React26__default.useCallback(
|
|
10627
10975
|
(option) => {
|
|
10628
10976
|
return option?.[labelFieldKey];
|
|
10629
10977
|
},
|
|
10630
10978
|
[labelFieldKey]
|
|
10631
10979
|
);
|
|
10632
|
-
const getValueField =
|
|
10980
|
+
const getValueField = React26__default.useCallback(
|
|
10633
10981
|
(option) => {
|
|
10634
10982
|
return option?.[valueFieldKey];
|
|
10635
10983
|
},
|
|
@@ -10650,7 +10998,7 @@ var VirtualizedCommand = ({
|
|
|
10650
10998
|
emptyContent = "No data.",
|
|
10651
10999
|
searchPlaceholder,
|
|
10652
11000
|
value,
|
|
10653
|
-
notFoundContent = "
|
|
11001
|
+
notFoundContent = "No item found.",
|
|
10654
11002
|
showSearch = true,
|
|
10655
11003
|
fieldNames,
|
|
10656
11004
|
disabledOption,
|
|
@@ -10661,11 +11009,11 @@ var VirtualizedCommand = ({
|
|
|
10661
11009
|
onFocus
|
|
10662
11010
|
}) => {
|
|
10663
11011
|
const { getLabelField, getValueField } = useFieldNames_default({ fieldNames });
|
|
10664
|
-
const internalOptions =
|
|
10665
|
-
const [filteredOptions, setFilteredOptions] =
|
|
10666
|
-
const [focusedIndex, setFocusedIndex] =
|
|
10667
|
-
const [isKeyboardNavActive, setIsKeyboardNavActive] =
|
|
10668
|
-
const parentRef =
|
|
11012
|
+
const internalOptions = React26.useMemo(() => options ?? [], [options]);
|
|
11013
|
+
const [filteredOptions, setFilteredOptions] = React26.useState(internalOptions);
|
|
11014
|
+
const [focusedIndex, setFocusedIndex] = React26.useState(0);
|
|
11015
|
+
const [isKeyboardNavActive, setIsKeyboardNavActive] = React26.useState(false);
|
|
11016
|
+
const parentRef = React26.useRef(null);
|
|
10669
11017
|
const virtualizer = useVirtualizer({
|
|
10670
11018
|
count: filteredOptions.length,
|
|
10671
11019
|
getScrollElement: () => parentRef.current,
|
|
@@ -10673,14 +11021,14 @@ var VirtualizedCommand = ({
|
|
|
10673
11021
|
overscan: 2
|
|
10674
11022
|
});
|
|
10675
11023
|
const virtualOptions = virtualizer.getVirtualItems();
|
|
10676
|
-
const dynamicHeight =
|
|
11024
|
+
const dynamicHeight = React26.useMemo(() => {
|
|
10677
11025
|
const contentHeight = filteredOptions.length * ROW_HEIGHT;
|
|
10678
11026
|
if (contentHeight <= 0) {
|
|
10679
11027
|
return MIN_HEIGHT_EMPTY;
|
|
10680
11028
|
}
|
|
10681
11029
|
return Math.max(ROW_HEIGHT, Math.min(height, contentHeight));
|
|
10682
11030
|
}, [filteredOptions.length, height]);
|
|
10683
|
-
const scrollToIndex =
|
|
11031
|
+
const scrollToIndex = React26.useCallback(
|
|
10684
11032
|
(index) => {
|
|
10685
11033
|
virtualizer.scrollToIndex(index, {
|
|
10686
11034
|
align: "center"
|
|
@@ -10688,7 +11036,7 @@ var VirtualizedCommand = ({
|
|
|
10688
11036
|
},
|
|
10689
11037
|
[virtualizer]
|
|
10690
11038
|
);
|
|
10691
|
-
const handleSearch =
|
|
11039
|
+
const handleSearch = React26.useCallback(
|
|
10692
11040
|
(search) => {
|
|
10693
11041
|
setIsKeyboardNavActive(false);
|
|
10694
11042
|
setFilteredOptions(
|
|
@@ -10703,7 +11051,7 @@ var VirtualizedCommand = ({
|
|
|
10703
11051
|
},
|
|
10704
11052
|
[filterOption, getLabelField, internalOptions]
|
|
10705
11053
|
);
|
|
10706
|
-
const handleKeyDown =
|
|
11054
|
+
const handleKeyDown = React26.useCallback(
|
|
10707
11055
|
(event) => {
|
|
10708
11056
|
switch (event.key) {
|
|
10709
11057
|
case "ArrowDown": {
|
|
@@ -10738,7 +11086,7 @@ var VirtualizedCommand = ({
|
|
|
10738
11086
|
},
|
|
10739
11087
|
[filteredOptions, focusedIndex, getValueField, onSelect, scrollToIndex]
|
|
10740
11088
|
);
|
|
10741
|
-
|
|
11089
|
+
React26.useEffect(() => {
|
|
10742
11090
|
if (value) {
|
|
10743
11091
|
const option = filteredOptions.find((option2) => {
|
|
10744
11092
|
const optionValue = getValueField(option2);
|
|
@@ -10852,21 +11200,21 @@ var ComboboxInner = ({
|
|
|
10852
11200
|
showSearch,
|
|
10853
11201
|
...props
|
|
10854
11202
|
}, ref) => {
|
|
10855
|
-
const { getValueField } = useFieldNames_default({ fieldNames });
|
|
10856
|
-
const [open, setOpen] =
|
|
11203
|
+
const { getLabelField, getValueField } = useFieldNames_default({ fieldNames });
|
|
11204
|
+
const [open, setOpen] = React26.useState(false);
|
|
10857
11205
|
const { value: selectedValue, updateState: setSelectedValue } = useControllableState_default({
|
|
10858
11206
|
defaultValue,
|
|
10859
11207
|
value
|
|
10860
11208
|
});
|
|
10861
|
-
const renderValue =
|
|
11209
|
+
const renderValue = React26.useMemo(() => {
|
|
10862
11210
|
if (!selectedValue) return placeholder2;
|
|
10863
11211
|
const selectedOptionFound = options?.find((option) => {
|
|
10864
11212
|
const optionValue = getValueField(option);
|
|
10865
11213
|
return optionValue === selectedValue;
|
|
10866
11214
|
});
|
|
10867
|
-
return selectedOptionFound ?
|
|
10868
|
-
}, [getValueField, options, placeholder2, selectedValue]);
|
|
10869
|
-
const handleSelect =
|
|
11215
|
+
return selectedOptionFound ? getLabelField(selectedOptionFound) : null;
|
|
11216
|
+
}, [getLabelField, getValueField, options, placeholder2, selectedValue]);
|
|
11217
|
+
const handleSelect = React26.useCallback(
|
|
10870
11218
|
(selected, option) => {
|
|
10871
11219
|
setSelectedValue(selected);
|
|
10872
11220
|
setOpen(false);
|
|
@@ -10876,7 +11224,7 @@ var ComboboxInner = ({
|
|
|
10876
11224
|
},
|
|
10877
11225
|
[onSelect, setSelectedValue]
|
|
10878
11226
|
);
|
|
10879
|
-
const handleClear =
|
|
11227
|
+
const handleClear = React26.useCallback(
|
|
10880
11228
|
(event) => {
|
|
10881
11229
|
event.stopPropagation();
|
|
10882
11230
|
setSelectedValue(void 0);
|
|
@@ -10893,9 +11241,11 @@ var ComboboxInner = ({
|
|
|
10893
11241
|
role: "combobox",
|
|
10894
11242
|
"aria-expanded": open,
|
|
10895
11243
|
className: cn(
|
|
10896
|
-
"flex
|
|
10897
|
-
"
|
|
10898
|
-
"
|
|
11244
|
+
"flex items-center justify-between gap-2 rounded-md border bg-white px-3 h-9 text-sm whitespace-nowrap shadow-xs outline-none border-input",
|
|
11245
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
11246
|
+
"focus-visible:border-ring focus-visible:ring-ring/50",
|
|
11247
|
+
"aria-invalid:ring-destructive/20 aria-invalid:border-destructive",
|
|
11248
|
+
"data-[state=open]:border-ring",
|
|
10899
11249
|
"transition-all",
|
|
10900
11250
|
className
|
|
10901
11251
|
),
|
|
@@ -10960,9 +11310,68 @@ var ComboboxInner = ({
|
|
|
10960
11310
|
)
|
|
10961
11311
|
] });
|
|
10962
11312
|
};
|
|
10963
|
-
var Combobox =
|
|
11313
|
+
var Combobox = React26.forwardRef(ComboboxInner);
|
|
10964
11314
|
var Combobox_default = Combobox;
|
|
11315
|
+
var TruncatedMouseEnterDiv = ({
|
|
11316
|
+
value,
|
|
11317
|
+
className,
|
|
11318
|
+
tooltipProps,
|
|
11319
|
+
tooltipContentProps,
|
|
11320
|
+
arrowClassName
|
|
11321
|
+
}) => {
|
|
11322
|
+
const textRef = useRef(null);
|
|
11323
|
+
const [isTruncated, setIsTruncated] = useState(false);
|
|
11324
|
+
const checkTruncation = () => {
|
|
11325
|
+
if (textRef.current) {
|
|
11326
|
+
const { scrollWidth, clientWidth } = textRef.current;
|
|
11327
|
+
setIsTruncated(scrollWidth > clientWidth);
|
|
11328
|
+
}
|
|
11329
|
+
};
|
|
11330
|
+
const {
|
|
11331
|
+
className: tooltipContentClassName,
|
|
11332
|
+
side: tooltipContentSide,
|
|
11333
|
+
sideOffset: tooltipContentSideOffset,
|
|
11334
|
+
...tooltipContentRest
|
|
11335
|
+
} = tooltipContentProps ?? {};
|
|
11336
|
+
return /* @__PURE__ */ jsxs(Tooltip2, { open: isTruncated, ...tooltipProps, children: [
|
|
11337
|
+
/* @__PURE__ */ jsx(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
11338
|
+
"div",
|
|
11339
|
+
{
|
|
11340
|
+
ref: textRef,
|
|
11341
|
+
onMouseEnter: checkTruncation,
|
|
11342
|
+
onMouseLeave: () => setIsTruncated(false),
|
|
11343
|
+
className: cn("truncate", className),
|
|
11344
|
+
children: value
|
|
11345
|
+
}
|
|
11346
|
+
) }),
|
|
11347
|
+
/* @__PURE__ */ jsxs(
|
|
11348
|
+
TooltipContent2,
|
|
11349
|
+
{
|
|
11350
|
+
side: tooltipContentSide ?? "bottom",
|
|
11351
|
+
className: cn(
|
|
11352
|
+
"text-white bg-sus-secondary-gray-10 max-w-xs sm:max-w-md wrap-break-word shadow-lg",
|
|
11353
|
+
tooltipContentClassName
|
|
11354
|
+
),
|
|
11355
|
+
sideOffset: tooltipContentSideOffset ?? 10,
|
|
11356
|
+
...tooltipContentRest,
|
|
11357
|
+
children: [
|
|
11358
|
+
/* @__PURE__ */ jsx(
|
|
11359
|
+
TooltipArrow,
|
|
11360
|
+
{
|
|
11361
|
+
className: cn(
|
|
11362
|
+
"bg-sus-secondary-gray-10 fill-sus-secondary-gray-10 z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px]",
|
|
11363
|
+
arrowClassName
|
|
11364
|
+
)
|
|
11365
|
+
}
|
|
11366
|
+
),
|
|
11367
|
+
value
|
|
11368
|
+
]
|
|
11369
|
+
}
|
|
11370
|
+
)
|
|
11371
|
+
] });
|
|
11372
|
+
};
|
|
11373
|
+
var truncatedMouseEnterDiv_default = TruncatedMouseEnterDiv;
|
|
10965
11374
|
|
|
10966
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionMenu, AdvanceSearch_default as AdvanceSearch, arrow_default as ArrowIcon, Button, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Combobox_default as Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CropperModal, CropperModalError, DIALOG_ALERT_I18N_SUBNAMESPACE, DIALOG_ALERT_TEMPLATES, DataTable_default as DataTable, DatePicker2 as DatePicker, Dialog, DialogAlert, DialogAlertProvider, DialogContent, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, ErrorCompression, ErrorCreateCanvas, ErrorGeneratingBlob, ErrorInvalidSVG, ErrorSVGExceedSize, filters_default as FiltersIcon, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormulaEditor, GridSettingsModal_default as GridSettingsModal, HeaderCell_default as HeaderCell, Image2 as Image, Input, InputNumber_default as InputNumber, Label2 as Label, List_default as List, container_default as ListContainer, header_default as ListHeader, table_default as ListTable, LookupSelect, MonthPicker2 as MonthPicker, navbar_default as Navbar, not_found_default as NotFoundIcon, Popover, PopoverAnchor, PopoverArrow, PopoverContent, PopoverTrigger, PreventPageLeave_default as PreventPageLeave, RadioGroupItem, RadioGroupRoot, RadioLabel, RichText, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator2 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLayout, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, calendar_default as SuiCalendarIcon, calendar2_default as SuiCalendarIcon2, check_default as SuiCheckIcon, dots_vertical_default as SuiDotsVerticalIcon, empty_data_default as SuiEmptyDataIcon, expand_default as SuiExpandIcon, filter_default as SuiFilterIcon, setting_default as SuiSettingIcon, triangle_down_default as SuiTriangleDownIcon, warning_default as SuiWarningIcon, Switch, Textarea, Tooltip2 as Tooltip, TooltipArrow, TooltipContent2 as TooltipContent, TooltipProvider2 as TooltipProvider, TooltipTrigger2 as TooltipTrigger, truncated_default as Truncated, ui_exports as UI, VirtualizedCommand_default as VirtualizedCommand, booleanToSelectValue, buildPrefixMap, buttonVariants, cn, compareAlphanumeric, debounce, defaultOperatorShortcuts, defaultOperators, formatISODate, getDialogAlertControls, inputVariants, isDefined, isEmptyObject, isValidParentheses, mapTokensToOutput, parseFormula, parseFormulaToToken, resetVisibleTableState, selectValueToBoolean, spinnerVariants, splitOperators, stripNullishObject, throttle, tokenizeFormulaString, useControllableState_default as useControllableState, useFormField, useGridSettingsStore_default as useGridSettingsStore, useHover_default as useHover, useIntersectionObserver_default as useIntersectionObserver, useMediaQuery_default as useMediaQuery, usePreventPageLeave_default as usePreventPageLeave, usePreventPageLeaveStore_default as usePreventPageLeaveStore, useScreenSize_default as useScreenSize, useSidebar, useTruncated_default as useTruncated, validateTokenPrefixes };
|
|
11375
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionMenu, AdvanceSearch_default as AdvanceSearch, arrow_default as ArrowIcon, AuditFooter, Button, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Combobox_default as Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CropperModal, CropperModalError, DIALOG_ALERT_I18N_SUBNAMESPACE, DIALOG_ALERT_TEMPLATES, DataTable_default as DataTable, DatePicker2 as DatePicker, Dialog, DialogAlert, DialogAlertProvider, DialogContent, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, ErrorCompression, ErrorCreateCanvas, ErrorGeneratingBlob, ErrorInvalidSVG, ErrorSVGExceedSize, filters_default as FiltersIcon, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormulaEditor, GridSettingsModal_default as GridSettingsModal, HeaderCell_default as HeaderCell, Image2 as Image, Input, InputNumber_default as InputNumber, Label2 as Label, List_default as List, container_default as ListContainer, header_default as ListHeader, table_default as ListTable, LookupSelect, MonthPicker2 as MonthPicker, navbar_default as Navbar, not_found_default as NotFoundIcon, Popover, PopoverAnchor, PopoverArrow, PopoverContent, PopoverTrigger, PreventPageLeave_default as PreventPageLeave, RadioGroupItem, RadioGroupRoot, RadioLabel, RichText, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator2 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLayout, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, calendar_default as SuiCalendarIcon, calendar2_default as SuiCalendarIcon2, check_default as SuiCheckIcon, dots_vertical_default as SuiDotsVerticalIcon, empty_data_default as SuiEmptyDataIcon, expand_default as SuiExpandIcon, filter_default as SuiFilterIcon, setting_default as SuiSettingIcon, triangle_down_default as SuiTriangleDownIcon, warning_default as SuiWarningIcon, Switch, Textarea, Tooltip2 as Tooltip, TooltipArrow, TooltipContent2 as TooltipContent, TooltipProvider2 as TooltipProvider, TooltipTrigger2 as TooltipTrigger, trash_default as TrashIcon, truncated_default as Truncated, truncatedMouseEnterDiv_default as TruncatedMouseEnterDiv, ui_exports as UI, VirtualizedCommand_default as VirtualizedCommand, booleanToSelectValue, buildPrefixMap, buttonVariants, cn, compareAlphanumeric, debounce, defaultOperatorShortcuts, defaultOperators, formatISODate, getDialogAlertControls, inputVariants, isDefined, isEmptyObject, isValidParentheses, mapTokensToOutput, parseFormula, parseFormulaToToken, resetVisibleTableState, selectValueToBoolean, spinnerVariants, splitOperators, stripNullishObject, throttle, tokenizeFormulaString, useControllableState_default as useControllableState, useFormField, useGridSettingsStore_default as useGridSettingsStore, useHover_default as useHover, useIntersectionObserver_default as useIntersectionObserver, useIsomorphicLayoutEffect, useMediaQuery_default as useMediaQuery, usePreventPageLeave_default as usePreventPageLeave, usePreventPageLeaveStore_default as usePreventPageLeaveStore, useScreenSize_default as useScreenSize, useSidebar, useTruncated_default as useTruncated, validateTokenPrefixes };
|
|
10967
11376
|
//# sourceMappingURL=index.mjs.map
|
|
10968
11377
|
//# sourceMappingURL=index.mjs.map
|