@sustaina/shared-ui 1.33.1 → 1.33.2

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.js CHANGED
@@ -4,7 +4,7 @@ var AccordionPrimitive = require('@radix-ui/react-accordion');
4
4
  var clsx2 = require('clsx');
5
5
  var tailwindMerge = require('tailwind-merge');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
- var React4 = require('react');
7
+ var React26 = require('react');
8
8
  var lucideReact = require('lucide-react');
9
9
  var reactDom = require('react-dom');
10
10
  var SelectPrimitive = require('@radix-ui/react-select');
@@ -84,7 +84,7 @@ function _interopNamespace(e) {
84
84
 
85
85
  var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
86
86
  var clsx2__default = /*#__PURE__*/_interopDefault(clsx2);
87
- var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
87
+ var React26__namespace = /*#__PURE__*/_interopNamespace(React26);
88
88
  var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
89
89
  var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
90
90
  var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
@@ -820,7 +820,7 @@ function AccordionContent({
820
820
  );
821
821
  }
822
822
  var ExpandCollapse = ({ title, children, portalId }) => {
823
- const [isOpen, setIsOpen] = React4.useState(false);
823
+ const [isOpen, setIsOpen] = React26.useState(false);
824
824
  const Panel = /* @__PURE__ */ jsxRuntime.jsx(
825
825
  "div",
826
826
  {
@@ -930,31 +930,31 @@ function makeNewRow(field) {
930
930
  };
931
931
  }
932
932
  function useAdvanceSearch({ fields, limitRows }) {
933
- const [rows, setRows] = React4.useState([makeNewRow(fields[0])]);
934
- const updateRows = React4.useCallback((next) => {
933
+ const [rows, setRows] = React26.useState([makeNewRow(fields[0])]);
934
+ const updateRows = React26.useCallback((next) => {
935
935
  setRows(next);
936
936
  }, []);
937
- const operatorsForField = React4.useCallback(
937
+ const operatorsForField = React26.useCallback(
938
938
  (fieldName) => {
939
939
  const t = getFieldType(fields, fieldName);
940
940
  return OPERATOR_MAP[t];
941
941
  },
942
942
  [fields]
943
943
  );
944
- const addRow = React4.useCallback(() => {
944
+ const addRow = React26.useCallback(() => {
945
945
  if (limitRows && rows.length >= limitRows) return;
946
946
  const lastRow = rows[rows.length - 1];
947
947
  const lastField = fields.find((f) => f.name === lastRow?.fieldName) ?? fields[0];
948
948
  updateRows([...rows, makeNewRow(lastField)]);
949
949
  }, [rows, fields, updateRows, limitRows]);
950
- const removeRow = React4.useCallback(
950
+ const removeRow = React26.useCallback(
951
951
  (id) => {
952
952
  if (rows.length === 1) return;
953
953
  updateRows(rows.filter((r) => r.id !== id));
954
954
  },
955
955
  [rows, updateRows]
956
956
  );
957
- const clearRow = React4.useCallback(
957
+ const clearRow = React26.useCallback(
958
958
  (id) => {
959
959
  updateRows(
960
960
  rows.map((r) => {
@@ -987,10 +987,10 @@ function useAdvanceSearch({ fields, limitRows }) {
987
987
  },
988
988
  [rows, fields, updateRows]
989
989
  );
990
- const clearAllRow = React4.useCallback(() => {
990
+ const clearAllRow = React26.useCallback(() => {
991
991
  updateRows([makeNewRow(fields[0])]);
992
992
  }, [fields, updateRows]);
993
- const changeField = React4.useCallback(
993
+ const changeField = React26.useCallback(
994
994
  (id, fieldName) => {
995
995
  updateRows(
996
996
  rows.map((r) => {
@@ -1002,7 +1002,7 @@ function useAdvanceSearch({ fields, limitRows }) {
1002
1002
  },
1003
1003
  [rows, fields, updateRows]
1004
1004
  );
1005
- const changeOperator = React4.useCallback(
1005
+ const changeOperator = React26.useCallback(
1006
1006
  (id, operator) => {
1007
1007
  updateRows(
1008
1008
  rows.map((r) => {
@@ -1036,7 +1036,7 @@ function useAdvanceSearch({ fields, limitRows }) {
1036
1036
  },
1037
1037
  [rows, updateRows]
1038
1038
  );
1039
- const changeValue = React4.useCallback(
1039
+ const changeValue = React26.useCallback(
1040
1040
  (id, which, val) => {
1041
1041
  updateRows(
1042
1042
  rows.map((r) => {
@@ -1048,7 +1048,7 @@ function useAdvanceSearch({ fields, limitRows }) {
1048
1048
  },
1049
1049
  [rows, updateRows]
1050
1050
  );
1051
- const fieldOptions = React4.useMemo(
1051
+ const fieldOptions = React26.useMemo(
1052
1052
  () => fields.map((f) => ({
1053
1053
  value: f.name,
1054
1054
  label: f.label ?? f.name
@@ -1243,7 +1243,7 @@ var OPERATOR_LABEL = {
1243
1243
  containsAll: "Contains all of"
1244
1244
  };
1245
1245
  var OperatorSelect = ({ row, operators, onChangeOperator, error }) => {
1246
- React4__namespace.default.useEffect(() => {
1246
+ React26__namespace.default.useEffect(() => {
1247
1247
  if (!operators.length) return;
1248
1248
  if (!operators.includes(row.operator)) {
1249
1249
  onChangeOperator(operators[0]);
@@ -1279,15 +1279,15 @@ function Label2({ className, ...props }) {
1279
1279
  );
1280
1280
  }
1281
1281
  var Form = reactHookForm.FormProvider;
1282
- var FormFieldContext = React4__namespace.createContext({});
1282
+ var FormFieldContext = React26__namespace.createContext({});
1283
1283
  var FormField = ({
1284
1284
  ...props
1285
1285
  }) => {
1286
1286
  return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
1287
1287
  };
1288
1288
  var useFormField = () => {
1289
- const fieldContext = React4__namespace.useContext(FormFieldContext);
1290
- const itemContext = React4__namespace.useContext(FormItemContext);
1289
+ const fieldContext = React26__namespace.useContext(FormFieldContext);
1290
+ const itemContext = React26__namespace.useContext(FormItemContext);
1291
1291
  const { getFieldState } = reactHookForm.useFormContext();
1292
1292
  const formState = reactHookForm.useFormState({ name: fieldContext.name });
1293
1293
  const fieldState = getFieldState(fieldContext.name, formState);
@@ -1304,9 +1304,9 @@ var useFormField = () => {
1304
1304
  ...fieldState
1305
1305
  };
1306
1306
  };
1307
- var FormItemContext = React4__namespace.createContext({});
1307
+ var FormItemContext = React26__namespace.createContext({});
1308
1308
  function FormItem({ className, ...props }) {
1309
- const id = React4__namespace.useId();
1309
+ const id = React26__namespace.useId();
1310
1310
  return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
1311
1311
  }
1312
1312
  function FormLabel({ className, ...props }) {
@@ -1410,7 +1410,7 @@ var Spinner = ({ className, variant, size = "default", ...props }) => /* @__PURE
1410
1410
  ]
1411
1411
  }
1412
1412
  );
1413
- var InputPrimitive = React4__namespace.forwardRef(
1413
+ var InputPrimitive = React26__namespace.forwardRef(
1414
1414
  ({ className, type = "text", ...props }, ref) => {
1415
1415
  return /* @__PURE__ */ jsxRuntime.jsx(
1416
1416
  "input",
@@ -1449,7 +1449,7 @@ var inputVariants = classVarianceAuthority.cva("", {
1449
1449
  appearance: "filled"
1450
1450
  }
1451
1451
  });
1452
- var Input = React4__namespace.forwardRef(
1452
+ var Input = React26__namespace.forwardRef(
1453
1453
  ({
1454
1454
  className,
1455
1455
  wrapperClassName,
@@ -1482,8 +1482,8 @@ var Input = React4__namespace.forwardRef(
1482
1482
  onChange: onChangeProp
1483
1483
  } = rest;
1484
1484
  const ariaInvalid = invalid ?? ariaInvalidProp;
1485
- const messageId = React4__namespace.useId();
1486
- const handleChange = React4__namespace.useCallback(
1485
+ const messageId = React26__namespace.useId();
1486
+ const handleChange = React26__namespace.useCallback(
1487
1487
  (event) => {
1488
1488
  onChangeProp?.(event);
1489
1489
  onValueChange?.(event.target.value);
@@ -1826,20 +1826,20 @@ function DatePicker({
1826
1826
  className,
1827
1827
  ...props
1828
1828
  }) {
1829
- const today = React4__namespace.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
1830
- const [displayed, setDisplayed] = React4__namespace.useState(
1829
+ const today = React26__namespace.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
1830
+ const [displayed, setDisplayed] = React26__namespace.useState(
1831
1831
  selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
1832
1832
  );
1833
1833
  minDate = clampToDay(minDate);
1834
1834
  maxDate = clampToDay(maxDate);
1835
- const disabledSet = React4__namespace.useMemo(() => {
1835
+ const disabledSet = React26__namespace.useMemo(() => {
1836
1836
  const s = /* @__PURE__ */ new Set();
1837
1837
  disabledDates?.forEach((d) => s.add(startOfDay(d).toISOString()));
1838
1838
  return s;
1839
1839
  }, [disabledDates]);
1840
1840
  const displayYear = displayed.getFullYear();
1841
1841
  const displayMonth = displayed.getMonth();
1842
- const weekdays = React4__namespace.useMemo(() => {
1842
+ const weekdays = React26__namespace.useMemo(() => {
1843
1843
  const labels = [];
1844
1844
  for (let i = 0; i < 7; i++) {
1845
1845
  const idx = i;
@@ -1848,7 +1848,7 @@ function DatePicker({
1848
1848
  }
1849
1849
  return labels;
1850
1850
  }, [callbacks]);
1851
- const grid = React4__namespace.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
1851
+ const grid = React26__namespace.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
1852
1852
  const isDateDisabled = (date) => {
1853
1853
  const d = startOfDay(date);
1854
1854
  if (minDate && d < minDate) return true;
@@ -1858,7 +1858,7 @@ function DatePicker({
1858
1858
  };
1859
1859
  const minYear = minDate?.getFullYear();
1860
1860
  const maxYear = maxDate?.getFullYear();
1861
- const getMonthLabel = React4__namespace.useCallback(
1861
+ const getMonthLabel = React26__namespace.useCallback(
1862
1862
  (year, monthIndex) => {
1863
1863
  const label = callbacks?.monthLabel?.(year, monthIndex);
1864
1864
  if (label === null || label === void 0) {
@@ -1868,7 +1868,7 @@ function DatePicker({
1868
1868
  },
1869
1869
  [callbacks]
1870
1870
  );
1871
- const getYearLabel = React4__namespace.useCallback(
1871
+ const getYearLabel = React26__namespace.useCallback(
1872
1872
  (year) => {
1873
1873
  const label = callbacks?.yearLabel?.(year);
1874
1874
  if (label === null || label === void 0) return String(year);
@@ -1876,7 +1876,7 @@ function DatePicker({
1876
1876
  },
1877
1877
  [callbacks]
1878
1878
  );
1879
- const clampMonthToBounds = React4__namespace.useCallback(
1879
+ const clampMonthToBounds = React26__namespace.useCallback(
1880
1880
  (year, monthIndex) => {
1881
1881
  let output = monthIndex;
1882
1882
  if (typeof minYear === "number" && year === minYear && minDate) {
@@ -1891,7 +1891,7 @@ function DatePicker({
1891
1891
  },
1892
1892
  [maxDate, minDate, maxYear, minYear]
1893
1893
  );
1894
- const yearOptions = React4__namespace.useMemo(() => {
1894
+ const yearOptions = React26__namespace.useMemo(() => {
1895
1895
  const fallbackWindow = 50;
1896
1896
  const start = typeof minYear === "number" ? minYear : displayYear - fallbackWindow;
1897
1897
  const end = typeof maxYear === "number" ? maxYear : displayYear + fallbackWindow;
@@ -1912,7 +1912,7 @@ function DatePicker({
1912
1912
  }
1913
1913
  return years;
1914
1914
  }, [displayYear, maxYear, minYear, selectedDate]);
1915
- const monthOptions = React4__namespace.useMemo(() => {
1915
+ const monthOptions = React26__namespace.useMemo(() => {
1916
1916
  const months = Array.from({ length: 12 }, (_, monthIndex) => {
1917
1917
  const disabled = typeof minYear === "number" && displayYear === minYear && minDate && monthIndex < minDate.getMonth() || typeof maxYear === "number" && displayYear === maxYear && maxDate && monthIndex > maxDate.getMonth();
1918
1918
  return {
@@ -1931,7 +1931,7 @@ function DatePicker({
1931
1931
  }
1932
1932
  return months.sort((a, b) => a.value - b.value).filter((option, index, arr) => index === 0 || option.value !== arr[index - 1].value);
1933
1933
  }, [displayMonth, displayYear, getMonthLabel, maxDate, maxYear, minDate, minYear]);
1934
- const handleMonthSelect = React4__namespace.useCallback((nextValue) => {
1934
+ const handleMonthSelect = React26__namespace.useCallback((nextValue) => {
1935
1935
  const nextMonth = Number.parseInt(nextValue, 10);
1936
1936
  if (Number.isNaN(nextMonth)) return;
1937
1937
  setDisplayed((prev) => {
@@ -1941,7 +1941,7 @@ function DatePicker({
1941
1941
  return next;
1942
1942
  });
1943
1943
  }, []);
1944
- const handleYearSelect = React4__namespace.useCallback(
1944
+ const handleYearSelect = React26__namespace.useCallback(
1945
1945
  (nextValue) => {
1946
1946
  const nextYear = Number.parseInt(nextValue, 10);
1947
1947
  if (Number.isNaN(nextYear)) return;
@@ -2089,14 +2089,14 @@ var DatePicker2 = ({
2089
2089
  ariaLabel,
2090
2090
  ...calendarProps
2091
2091
  }) => {
2092
- const [open, setOpen] = React4__namespace.default.useState(false);
2093
- const parser = React4__namespace.default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
2094
- const outputFormatter = React4__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
2095
- const labelFormatter = React4__namespace.default.useMemo(
2092
+ const [open, setOpen] = React26__namespace.default.useState(false);
2093
+ const parser = React26__namespace.default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
2094
+ const outputFormatter = React26__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
2095
+ const labelFormatter = React26__namespace.default.useMemo(
2096
2096
  () => displayFormatter ?? defaultDisplayFormatter,
2097
2097
  [displayFormatter]
2098
2098
  );
2099
- const parsedValue = React4__namespace.default.useMemo(() => {
2099
+ const parsedValue = React26__namespace.default.useMemo(() => {
2100
2100
  if (value === null || value === void 0) return void 0;
2101
2101
  if (value instanceof Date) return value;
2102
2102
  const parsed = parser(value);
@@ -2105,26 +2105,26 @@ var DatePicker2 = ({
2105
2105
  const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
2106
2106
  const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change date, current selection ${labelFormatter(parsedValue)}` : "Open date picker");
2107
2107
  const shouldShowClear = allowClear && !disabled && !!parsedValue;
2108
- const handleClose = React4__namespace.default.useCallback(() => setOpen(false), []);
2109
- const emitChange = React4__namespace.default.useCallback(
2108
+ const handleClose = React26__namespace.default.useCallback(() => setOpen(false), []);
2109
+ const emitChange = React26__namespace.default.useCallback(
2110
2110
  (next) => {
2111
2111
  onChange?.(next);
2112
2112
  onValueChange?.(next ? outputFormatter(next) : void 0);
2113
2113
  },
2114
2114
  [onChange, onValueChange, outputFormatter]
2115
2115
  );
2116
- const handleSelect = React4__namespace.default.useCallback(
2116
+ const handleSelect = React26__namespace.default.useCallback(
2117
2117
  (next) => {
2118
2118
  emitChange(next);
2119
2119
  if (closeOnSelect && next) handleClose();
2120
2120
  },
2121
2121
  [closeOnSelect, emitChange, handleClose]
2122
2122
  );
2123
- const handleClear = React4__namespace.default.useCallback(() => {
2123
+ const handleClear = React26__namespace.default.useCallback(() => {
2124
2124
  emitChange(void 0);
2125
2125
  handleClose();
2126
2126
  }, [emitChange, handleClose]);
2127
- const handleOpenChange = React4__namespace.default.useCallback(
2127
+ const handleOpenChange = React26__namespace.default.useCallback(
2128
2128
  (nextOpen) => {
2129
2129
  if (disabled && nextOpen) return;
2130
2130
  setOpen(nextOpen);
@@ -2314,15 +2314,15 @@ function MonthCal({
2314
2314
  onYearBackward,
2315
2315
  onYearForward
2316
2316
  }) {
2317
- const today = React4__namespace.useMemo(() => {
2317
+ const today = React26__namespace.useMemo(() => {
2318
2318
  const now = /* @__PURE__ */ new Date();
2319
2319
  now.setDate(1);
2320
2320
  now.setHours(0, 0, 0, 0);
2321
2321
  return now;
2322
2322
  }, []);
2323
- const selectedMonthDate = React4__namespace.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
2324
- const min = React4__namespace.useMemo(() => normalizeMonth(minDate), [minDate]);
2325
- const max = React4__namespace.useMemo(() => normalizeMonth(maxDate), [maxDate]);
2323
+ const selectedMonthDate = React26__namespace.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
2324
+ const min = React26__namespace.useMemo(() => normalizeMonth(minDate), [minDate]);
2325
+ const max = React26__namespace.useMemo(() => normalizeMonth(maxDate), [maxDate]);
2326
2326
  let effectiveMin = min;
2327
2327
  if (min && max && min > max) {
2328
2328
  effectiveMin = max;
@@ -2331,10 +2331,10 @@ function MonthCal({
2331
2331
  const minMonth = effectiveMin?.getMonth();
2332
2332
  const maxYear = max?.getFullYear();
2333
2333
  const maxMonth = max?.getMonth();
2334
- const [menuYear, setMenuYear] = React4__namespace.useState(
2334
+ const [menuYear, setMenuYear] = React26__namespace.useState(
2335
2335
  () => selectedMonthDate?.getFullYear() ?? today.getFullYear()
2336
2336
  );
2337
- React4__namespace.useEffect(() => {
2337
+ React26__namespace.useEffect(() => {
2338
2338
  if (selectedMonthDate) {
2339
2339
  const year = selectedMonthDate.getFullYear();
2340
2340
  if (year !== menuYear) {
@@ -2342,7 +2342,7 @@ function MonthCal({
2342
2342
  }
2343
2343
  }
2344
2344
  }, [selectedMonthDate, menuYear]);
2345
- React4__namespace.useEffect(() => {
2345
+ React26__namespace.useEffect(() => {
2346
2346
  if (typeof minYear === "number" && menuYear < minYear) {
2347
2347
  setMenuYear(minYear);
2348
2348
  return;
@@ -2353,7 +2353,7 @@ function MonthCal({
2353
2353
  }, [minYear, maxYear, menuYear]);
2354
2354
  const disablePrevYear = typeof minYear === "number" ? menuYear <= minYear : false;
2355
2355
  const disableNextYear = typeof maxYear === "number" ? menuYear >= maxYear : false;
2356
- const yearOptions = React4__namespace.useMemo(() => {
2356
+ const yearOptions = React26__namespace.useMemo(() => {
2357
2357
  const fallbackWindow = 50;
2358
2358
  const start = typeof minYear === "number" ? minYear : menuYear - fallbackWindow;
2359
2359
  const end = typeof maxYear === "number" ? maxYear : menuYear + fallbackWindow;
@@ -2367,7 +2367,7 @@ function MonthCal({
2367
2367
  }
2368
2368
  return years;
2369
2369
  }, [maxYear, menuYear, minYear]);
2370
- const formatYearLabel = React4__namespace.useCallback(
2370
+ const formatYearLabel = React26__namespace.useCallback(
2371
2371
  (year) => {
2372
2372
  const raw = callbacks?.yearLabel?.(year);
2373
2373
  if (raw === null || raw === void 0) return String(year);
@@ -2375,7 +2375,7 @@ function MonthCal({
2375
2375
  },
2376
2376
  [callbacks]
2377
2377
  );
2378
- const handleYearSelect = React4__namespace.useCallback(
2378
+ const handleYearSelect = React26__namespace.useCallback(
2379
2379
  (nextValue) => {
2380
2380
  const nextYear = Number.parseInt(nextValue, 10);
2381
2381
  if (Number.isNaN(nextYear)) return;
@@ -2385,7 +2385,7 @@ function MonthCal({
2385
2385
  },
2386
2386
  [maxYear, minYear]
2387
2387
  );
2388
- const disabledPairs = React4__namespace.useMemo(() => {
2388
+ const disabledPairs = React26__namespace.useMemo(() => {
2389
2389
  if (!disabledDates?.length) return [];
2390
2390
  const pairs = [];
2391
2391
  disabledDates.forEach((date) => {
@@ -2530,14 +2530,14 @@ var MonthPicker2 = ({
2530
2530
  ariaLabel,
2531
2531
  ...calendarProps
2532
2532
  }) => {
2533
- const [open, setOpen] = React4__namespace.default.useState(false);
2534
- const parser = React4__namespace.default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
2535
- const outputFormatter = React4__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
2536
- const labelFormatter = React4__namespace.default.useMemo(
2533
+ const [open, setOpen] = React26__namespace.default.useState(false);
2534
+ const parser = React26__namespace.default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
2535
+ const outputFormatter = React26__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
2536
+ const labelFormatter = React26__namespace.default.useMemo(
2537
2537
  () => displayFormatter ?? defaultDisplayFormatter2,
2538
2538
  [displayFormatter]
2539
2539
  );
2540
- const parsedValue = React4__namespace.default.useMemo(() => {
2540
+ const parsedValue = React26__namespace.default.useMemo(() => {
2541
2541
  if (value === null || value === void 0) return void 0;
2542
2542
  if (value instanceof Date) return normalizeMonth2(value);
2543
2543
  if (typeof value === "string") {
@@ -2549,8 +2549,8 @@ var MonthPicker2 = ({
2549
2549
  const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
2550
2550
  const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change month, current selection ${labelFormatter(parsedValue)}` : "Open month picker");
2551
2551
  const shouldShowClear = allowClear && !disabled && !!parsedValue;
2552
- const handleClose = React4__namespace.default.useCallback(() => setOpen(false), []);
2553
- const emitChange = React4__namespace.default.useCallback(
2552
+ const handleClose = React26__namespace.default.useCallback(() => setOpen(false), []);
2553
+ const emitChange = React26__namespace.default.useCallback(
2554
2554
  (next) => {
2555
2555
  const normalized = next ? normalizeMonth2(next) : void 0;
2556
2556
  onChange?.(normalized);
@@ -2558,18 +2558,18 @@ var MonthPicker2 = ({
2558
2558
  },
2559
2559
  [onChange, onValueChange, outputFormatter]
2560
2560
  );
2561
- const handleSelect = React4__namespace.default.useCallback(
2561
+ const handleSelect = React26__namespace.default.useCallback(
2562
2562
  (next) => {
2563
2563
  emitChange(next);
2564
2564
  if (closeOnSelect && next) handleClose();
2565
2565
  },
2566
2566
  [closeOnSelect, emitChange, handleClose]
2567
2567
  );
2568
- const handleClear = React4__namespace.default.useCallback(() => {
2568
+ const handleClear = React26__namespace.default.useCallback(() => {
2569
2569
  emitChange(void 0);
2570
2570
  handleClose();
2571
2571
  }, [emitChange, handleClose]);
2572
- const handleOpenChange = React4__namespace.default.useCallback(
2572
+ const handleOpenChange = React26__namespace.default.useCallback(
2573
2573
  (nextOpen) => {
2574
2574
  if (disabled && nextOpen) return;
2575
2575
  setOpen(nextOpen);
@@ -2780,23 +2780,23 @@ var LookupSelect = ({
2780
2780
  dropdownPortalId,
2781
2781
  multiple = false
2782
2782
  }) => {
2783
- const [inputValue, setInputValue] = React4.useState("");
2784
- const inputRef = React4.useRef(null);
2785
- const [suggestions, setSuggestions] = React4.useState([]);
2786
- const [optionLabels, setOptionLabels] = React4.useState({});
2787
- const [loading, setLoading] = React4.useState(false);
2788
- const [fetchError, setFetchError] = React4.useState(null);
2789
- const [isDropdownOpen, setIsDropdownOpen] = React4.useState(false);
2790
- const containerRef = React4.useRef(null);
2791
- const fetchDelayRef = React4.useRef(null);
2792
- const requestIdRef = React4.useRef(0);
2793
- const [dropdownStyles, setDropdownStyles] = React4.useState();
2794
- const dropdownContentRef = React4.useRef(null);
2795
- const assignDropdownContentRef = React4.useCallback((node) => {
2783
+ const [inputValue, setInputValue] = React26.useState("");
2784
+ const inputRef = React26.useRef(null);
2785
+ const [suggestions, setSuggestions] = React26.useState([]);
2786
+ const [optionLabels, setOptionLabels] = React26.useState({});
2787
+ const [loading, setLoading] = React26.useState(false);
2788
+ const [fetchError, setFetchError] = React26.useState(null);
2789
+ const [isDropdownOpen, setIsDropdownOpen] = React26.useState(false);
2790
+ const containerRef = React26.useRef(null);
2791
+ const fetchDelayRef = React26.useRef(null);
2792
+ const requestIdRef = React26.useRef(0);
2793
+ const [dropdownStyles, setDropdownStyles] = React26.useState();
2794
+ const dropdownContentRef = React26.useRef(null);
2795
+ const assignDropdownContentRef = React26.useCallback((node) => {
2796
2796
  dropdownContentRef.current = node;
2797
2797
  }, []);
2798
- const [activeSuggestionIndex, setActiveSuggestionIndex] = React4.useState(-1);
2799
- const dropdownPortalElement = React4.useMemo(() => {
2798
+ const [activeSuggestionIndex, setActiveSuggestionIndex] = React26.useState(-1);
2799
+ const dropdownPortalElement = React26.useMemo(() => {
2800
2800
  if (typeof document === "undefined") return null;
2801
2801
  if (dropdownPortalId) {
2802
2802
  const element = document.getElementById(dropdownPortalId);
@@ -2807,7 +2807,7 @@ var LookupSelect = ({
2807
2807
  const limitReached = multiple && value.length >= maxTags;
2808
2808
  const selectedValue = !multiple && value.length > 0 ? value[0] : void 0;
2809
2809
  const selectedLabel = selectedValue ? optionLabels[selectedValue] ?? selectedValue : void 0;
2810
- const upsertOptionLabels = React4.useCallback((options) => {
2810
+ const upsertOptionLabels = React26.useCallback((options) => {
2811
2811
  setOptionLabels((prev) => {
2812
2812
  let next = null;
2813
2813
  options.forEach((opt) => {
@@ -2820,7 +2820,7 @@ var LookupSelect = ({
2820
2820
  return next ?? prev;
2821
2821
  });
2822
2822
  }, []);
2823
- const addTag = React4.useCallback(
2823
+ const addTag = React26.useCallback(
2824
2824
  (val) => {
2825
2825
  const trimmed = val.trim();
2826
2826
  if (!trimmed) return;
@@ -2837,7 +2837,7 @@ var LookupSelect = ({
2837
2837
  },
2838
2838
  [value, onChange, maxTags, multiple]
2839
2839
  );
2840
- const removeTag = React4.useCallback(
2840
+ const removeTag = React26.useCallback(
2841
2841
  (index) => {
2842
2842
  if (index < 0) return;
2843
2843
  const newTags = value.filter((_, i) => i !== index);
@@ -2845,14 +2845,14 @@ var LookupSelect = ({
2845
2845
  },
2846
2846
  [value, onChange]
2847
2847
  );
2848
- const handleClear = React4.useCallback(() => {
2848
+ const handleClear = React26.useCallback(() => {
2849
2849
  setInputValue("");
2850
2850
  setSuggestions([]);
2851
2851
  setIsDropdownOpen(false);
2852
2852
  setFetchError(null);
2853
2853
  if (onClear) onClear();
2854
2854
  }, [onClear]);
2855
- const handleSuggestionSelect = React4.useCallback(
2855
+ const handleSuggestionSelect = React26.useCallback(
2856
2856
  (option) => {
2857
2857
  upsertOptionLabels([option]);
2858
2858
  addTag(option.value);
@@ -2867,7 +2867,7 @@ var LookupSelect = ({
2867
2867
  },
2868
2868
  [addTag, multiple, upsertOptionLabels]
2869
2869
  );
2870
- const handleKeyDown = React4.useCallback(
2870
+ const handleKeyDown = React26.useCallback(
2871
2871
  (e) => {
2872
2872
  if (e.key === "ArrowDown" && suggestions.length > 0) {
2873
2873
  e.preventDefault();
@@ -2894,7 +2894,7 @@ var LookupSelect = ({
2894
2894
  },
2895
2895
  [suggestions, activeSuggestionIndex, handleSuggestionSelect, inputValue, removeTag, value.length]
2896
2896
  );
2897
- const updateDropdownPosition = React4.useCallback(() => {
2897
+ const updateDropdownPosition = React26.useCallback(() => {
2898
2898
  if (!dropdownPortalElement || !containerRef.current) return;
2899
2899
  const rect = containerRef.current.getBoundingClientRect();
2900
2900
  setDropdownStyles({
@@ -2905,7 +2905,7 @@ var LookupSelect = ({
2905
2905
  zIndex: 50
2906
2906
  });
2907
2907
  }, [dropdownPortalElement]);
2908
- React4.useEffect(() => {
2908
+ React26.useEffect(() => {
2909
2909
  if (!fetchSuggestions) return;
2910
2910
  if (fetchDelayRef.current) {
2911
2911
  clearTimeout(fetchDelayRef.current);
@@ -2946,7 +2946,7 @@ var LookupSelect = ({
2946
2946
  }
2947
2947
  };
2948
2948
  }, [inputValue, fetchSuggestions, suggestionDebounce, upsertOptionLabels]);
2949
- React4.useEffect(() => {
2949
+ React26.useEffect(() => {
2950
2950
  if (!fetchSuggestions) return;
2951
2951
  if (value.length === 0) return;
2952
2952
  const unresolvedValues = value.filter((v) => !optionLabels[v]);
@@ -2956,7 +2956,7 @@ var LookupSelect = ({
2956
2956
  }).catch(() => {
2957
2957
  });
2958
2958
  }, [value, fetchSuggestions, optionLabels, upsertOptionLabels]);
2959
- React4.useEffect(() => {
2959
+ React26.useEffect(() => {
2960
2960
  const handleDocumentClick = (event) => {
2961
2961
  const target = event.target;
2962
2962
  if (containerRef.current?.contains(target)) return;
@@ -2968,11 +2968,11 @@ var LookupSelect = ({
2968
2968
  document.removeEventListener("mousedown", handleDocumentClick);
2969
2969
  };
2970
2970
  }, []);
2971
- React4.useEffect(() => {
2971
+ React26.useEffect(() => {
2972
2972
  if (!limitReached) return;
2973
2973
  setIsDropdownOpen(false);
2974
2974
  }, [limitReached]);
2975
- React4.useEffect(() => {
2975
+ React26.useEffect(() => {
2976
2976
  if (!dropdownPortalElement) return;
2977
2977
  if (!isDropdownOpen) return;
2978
2978
  updateDropdownPosition();
@@ -2984,7 +2984,7 @@ var LookupSelect = ({
2984
2984
  window.removeEventListener("scroll", handleReposition, true);
2985
2985
  };
2986
2986
  }, [dropdownPortalElement, isDropdownOpen, updateDropdownPosition]);
2987
- React4.useEffect(() => {
2987
+ React26.useEffect(() => {
2988
2988
  if (suggestions.length === 0) {
2989
2989
  setActiveSuggestionIndex(-1);
2990
2990
  return;
@@ -3819,7 +3819,7 @@ var AdvanceSearch = ({
3819
3819
  shortDateFormat,
3820
3820
  filterFieldMap = FILTER_FIELD_MAP
3821
3821
  }) => {
3822
- const fieldsData = React4.useMemo(() => {
3822
+ const fieldsData = React26.useMemo(() => {
3823
3823
  if (fields.length === 0) throw new Error("fields cannot be an empty array");
3824
3824
  return fields || [];
3825
3825
  }, [fields]);
@@ -3839,8 +3839,8 @@ var AdvanceSearch = ({
3839
3839
  defaultValues: {}
3840
3840
  });
3841
3841
  const { handleSubmit, unregister, resetField, getValues, clearErrors, setError } = form;
3842
- const [operatorErrors, setOperatorErrors] = React4__namespace.default.useState({});
3843
- const clearOperatorError = React4.useCallback(
3842
+ const [operatorErrors, setOperatorErrors] = React26__namespace.default.useState({});
3843
+ const clearOperatorError = React26.useCallback(
3844
3844
  (rowId) => {
3845
3845
  setOperatorErrors((prev) => {
3846
3846
  if (!(rowId in prev)) return prev;
@@ -3850,7 +3850,7 @@ var AdvanceSearch = ({
3850
3850
  },
3851
3851
  [setOperatorErrors]
3852
3852
  );
3853
- const clearValue = React4.useCallback(
3853
+ const clearValue = React26.useCallback(
3854
3854
  (rowId, which) => {
3855
3855
  const fieldName = `${which}_${rowId}`;
3856
3856
  resetField(fieldName, { defaultValue: void 0 });
@@ -3860,14 +3860,14 @@ var AdvanceSearch = ({
3860
3860
  },
3861
3861
  [resetField, clearErrors]
3862
3862
  );
3863
- const parseRangeValue = React4.useCallback((raw, fieldType) => {
3863
+ const parseRangeValue = React26.useCallback((raw, fieldType) => {
3864
3864
  if (!raw) return void 0;
3865
3865
  if (Array.isArray(raw)) return void 0;
3866
3866
  const normalized = fieldType === "datemonth" ? `${raw}-01` : raw;
3867
3867
  const parsed = dateFns.parseISO(normalized);
3868
3868
  return dateFns.isValid(parsed) ? parsed : void 0;
3869
3869
  }, []);
3870
- const onSubmit = React4.useCallback(() => {
3870
+ const onSubmit = React26.useCallback(() => {
3871
3871
  const operatorValidation = {};
3872
3872
  rows.forEach((r) => {
3873
3873
  const ops = operatorsForField(r.fieldName);
@@ -4103,11 +4103,11 @@ function resetVisibleTableState(payload) {
4103
4103
  table.setSorting(prevState.sorting.filter((s) => isVisible(s.id)));
4104
4104
  }
4105
4105
  var useHover = () => {
4106
- const [hovering, setHovering] = React4.useState(false);
4107
- const prevRef = React4.useRef(null);
4108
- const onMouseEnter = React4.useCallback(() => setHovering(true), []);
4109
- const onMouseLeave = React4.useCallback(() => setHovering(false), []);
4110
- const nodeRefCallback = React4.useCallback(
4106
+ const [hovering, setHovering] = React26.useState(false);
4107
+ const prevRef = React26.useRef(null);
4108
+ const onMouseEnter = React26.useCallback(() => setHovering(true), []);
4109
+ const onMouseLeave = React26.useCallback(() => setHovering(false), []);
4110
+ const nodeRefCallback = React26.useCallback(
4111
4111
  (node) => {
4112
4112
  if (prevRef.current) {
4113
4113
  prevRef.current.removeEventListener("mouseenter", onMouseEnter);
@@ -4135,15 +4135,15 @@ var useIntersectionObserver = ({
4135
4135
  initialIsIntersecting = false,
4136
4136
  onChange
4137
4137
  } = {}) => {
4138
- const [ref, setRef] = React4.useState(null);
4139
- const [state, setState] = React4.useState(() => ({
4138
+ const [ref, setRef] = React26.useState(null);
4139
+ const [state, setState] = React26.useState(() => ({
4140
4140
  isIntersecting: initialIsIntersecting,
4141
4141
  entry: void 0
4142
4142
  }));
4143
- const callbackRef = React4.useRef(null);
4143
+ const callbackRef = React26.useRef(null);
4144
4144
  callbackRef.current = onChange;
4145
4145
  const frozen = state.entry?.isIntersecting && freezeOnceVisible;
4146
- React4.useEffect(() => {
4146
+ React26.useEffect(() => {
4147
4147
  if (!ref) return;
4148
4148
  if (!("IntersectionObserver" in window)) return;
4149
4149
  if (frozen) return;
@@ -4173,8 +4173,8 @@ var useIntersectionObserver = ({
4173
4173
  frozen,
4174
4174
  freezeOnceVisible
4175
4175
  ]);
4176
- const prevRef = React4.useRef(null);
4177
- React4.useEffect(() => {
4176
+ const prevRef = React26.useRef(null);
4177
+ React26.useEffect(() => {
4178
4178
  if (!ref && state.entry?.target && !freezeOnceVisible && !frozen && prevRef.current !== state.entry.target) {
4179
4179
  prevRef.current = state.entry.target;
4180
4180
  setState({ isIntersecting: initialIsIntersecting, entry: void 0 });
@@ -4191,8 +4191,8 @@ var isValidMediaQueryString = (query) => {
4191
4191
  return query !== "not all";
4192
4192
  };
4193
4193
  var useMediaQuery = ({ query }) => {
4194
- const [matches, setMatches] = React4.useState(false);
4195
- React4.useEffect(() => {
4194
+ const [matches, setMatches] = React26.useState(false);
4195
+ React26.useEffect(() => {
4196
4196
  if (typeof window === "undefined") {
4197
4197
  return;
4198
4198
  }
@@ -4228,8 +4228,8 @@ var useTruncated = ({
4228
4228
  onChange,
4229
4229
  resizeDetectDelay = 150
4230
4230
  }) => {
4231
- const [isTruncated, setIsTruncated] = React4.useState(false);
4232
- React4.useEffect(() => {
4231
+ const [isTruncated, setIsTruncated] = React26.useState(false);
4232
+ React26.useEffect(() => {
4233
4233
  const element = elementRef.current;
4234
4234
  if (!element) return;
4235
4235
  const checkTruncate = debounce(() => {
@@ -4257,13 +4257,13 @@ var useControllableState = ({
4257
4257
  defaultValue,
4258
4258
  value
4259
4259
  }) => {
4260
- const [internalValue, setInternalValue] = React4__namespace.useState(value ?? defaultValue);
4261
- React4__namespace.useEffect(() => {
4260
+ const [internalValue, setInternalValue] = React26__namespace.useState(value ?? defaultValue);
4261
+ React26__namespace.useEffect(() => {
4262
4262
  if (value !== internalValue) {
4263
4263
  setInternalValue(value);
4264
4264
  }
4265
4265
  }, [value]);
4266
- const updateState = React4__namespace.useCallback((nextValue) => {
4266
+ const updateState = React26__namespace.useCallback((nextValue) => {
4267
4267
  setInternalValue(nextValue);
4268
4268
  }, []);
4269
4269
  return {
@@ -4272,6 +4272,7 @@ var useControllableState = ({
4272
4272
  };
4273
4273
  };
4274
4274
  var useControllableState_default = useControllableState;
4275
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React26.useLayoutEffect : React26.useEffect;
4275
4276
  var HeaderCell = ({
4276
4277
  rootClassName,
4277
4278
  labelClassName,
@@ -4469,7 +4470,7 @@ var ColumnSeparator = ({ show, className, ...props }) => {
4469
4470
  }
4470
4471
  );
4471
4472
  };
4472
- var ColumnSeparator_default = React4__namespace.default.memo(ColumnSeparator);
4473
+ var ColumnSeparator_default = React26__namespace.default.memo(ColumnSeparator);
4473
4474
  var StatusContentSlot = ({
4474
4475
  content,
4475
4476
  icon,
@@ -4488,7 +4489,7 @@ var StatusContentSlot = ({
4488
4489
  content
4489
4490
  ] });
4490
4491
  };
4491
- var StatusContentSlot_default = React4__namespace.default.memo(StatusContentSlot);
4492
+ var StatusContentSlot_default = React26__namespace.default.memo(StatusContentSlot);
4492
4493
  var stateOptions = [
4493
4494
  "columnFilters",
4494
4495
  "globalFilter",
@@ -4541,9 +4542,9 @@ var modelOptions = [
4541
4542
  "getCenterVisibleLeafColumns"
4542
4543
  ];
4543
4544
  var DataTableDevTool = ({ table }) => {
4544
- const [open, setOpen] = React4.useState(false);
4545
- const [visibleStates, setVisibleStates] = React4.useState([]);
4546
- const [visibleModels, setVisibleModels] = React4.useState([]);
4545
+ const [open, setOpen] = React26.useState(false);
4546
+ const [visibleStates, setVisibleStates] = React26.useState([]);
4547
+ const [visibleModels, setVisibleModels] = React26.useState([]);
4547
4548
  const tableState = table.getState();
4548
4549
  const toggleValue = (arr, value) => arr.includes(value) ? arr.filter((v) => v !== value) : [...arr, value];
4549
4550
  const getCircularReplacer = () => {
@@ -4800,14 +4801,14 @@ var DataTable = ({
4800
4801
  columnResizeMode: columnResizing?.enabled ? columnResizing?.resizeMode ?? "onChange" : "onChange"
4801
4802
  })
4802
4803
  });
4803
- const tableContainerRef = React4.useRef(null);
4804
+ const tableContainerRef = React26.useRef(null);
4804
4805
  const isTableEmpty = table.getCoreRowModel().rows.length === 0;
4805
4806
  const isTableEmptyAfterFiltering = table.getRowModel().rows.length === 0;
4806
4807
  const isFiltering = table.getState().columnFilters.length > 0 || !!table.getState().globalFilter;
4807
4808
  const leftVisibleLeftColumns = table.getLeftVisibleLeafColumns();
4808
4809
  const centerVisibleLeafColumns = table.getCenterVisibleLeafColumns();
4809
4810
  const rightVisibleLeafColumns = table.getRightVisibleLeafColumns();
4810
- const { isSomeColumnsFilterable, filterableColumns } = React4.useMemo(() => {
4811
+ const { isSomeColumnsFilterable, filterableColumns } = React26.useMemo(() => {
4811
4812
  const mergedColumns = [
4812
4813
  ...leftVisibleLeftColumns,
4813
4814
  ...centerVisibleLeafColumns,
@@ -4818,7 +4819,7 @@ var DataTable = ({
4818
4819
  );
4819
4820
  return { isSomeColumnsFilterable: isSomeColumnsFilterable2, filterableColumns: mergedColumns };
4820
4821
  }, [centerVisibleLeafColumns, leftVisibleLeftColumns, rightVisibleLeafColumns]);
4821
- const autoStatusKey = React4.useMemo(() => {
4822
+ const autoStatusKey = React26.useMemo(() => {
4822
4823
  if (isInitialLoading) return "initialLoading";
4823
4824
  if (isTableEmpty) return "emptyData";
4824
4825
  if (isTableEmptyAfterFiltering) return "emptyFilteredData";
@@ -4836,14 +4837,14 @@ var DataTable = ({
4836
4837
  scrollFetch?.hasMore,
4837
4838
  scrollFetch?.isFetchingMore
4838
4839
  ]);
4839
- const activeStatusContentComputed = React4.useMemo(() => {
4840
+ const activeStatusContentComputed = React26.useMemo(() => {
4840
4841
  if (!activeStatusContent) return autoStatusKey;
4841
4842
  if (typeof activeStatusContent === "function") {
4842
4843
  return activeStatusContent({ defaultComputedValue: autoStatusKey });
4843
4844
  }
4844
4845
  return activeStatusContent;
4845
4846
  }, [activeStatusContent, autoStatusKey]);
4846
- const fetchMoreOnScrollReached = React4.useCallback(
4847
+ const fetchMoreOnScrollReached = React26.useCallback(
4847
4848
  (containerRefElement) => {
4848
4849
  if (!scrollFetch?.enabled || !containerRefElement || scrollFetch?.isFetchingMore || !scrollFetch?.hasMore || !scrollFetch?.fetchMore) {
4849
4850
  return;
@@ -4877,14 +4878,14 @@ var DataTable = ({
4877
4878
  // eslint-disable-next-line react-hooks/exhaustive-deps
4878
4879
  [scrollFetch?.enabled, scrollFetch?.isFetchingMore, scrollFetch?.hasMore, scrollFetch?.fetchMore]
4879
4880
  );
4880
- React4.useEffect(() => {
4881
+ React26.useEffect(() => {
4881
4882
  if (!tableRef) return;
4882
4883
  tableRef.current = table;
4883
4884
  return () => {
4884
4885
  tableRef.current = null;
4885
4886
  };
4886
4887
  }, [tableRef, table]);
4887
- React4.useEffect(() => {
4888
+ React26.useEffect(() => {
4888
4889
  fetchMoreOnScrollReached(tableContainerRef.current);
4889
4890
  }, [fetchMoreOnScrollReached]);
4890
4891
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -5014,7 +5015,7 @@ var DataTable = ({
5014
5015
  ),
5015
5016
  /* @__PURE__ */ jsxRuntime.jsx(TableBody, { ...components?.tableBodyProps, children: table.getRowModel().rows.map((row) => {
5016
5017
  const tableDataRowProps = typeof components?.tableDataRowProps === "function" ? components.tableDataRowProps({ row, table }) || {} : components?.tableDataRowProps || {};
5017
- return /* @__PURE__ */ React4.createElement(
5018
+ return /* @__PURE__ */ React26.createElement(
5018
5019
  TableRow,
5019
5020
  {
5020
5021
  "data-testid": `table-data-row-${row.id}`,
@@ -5487,11 +5488,11 @@ function DialogAlert({
5487
5488
  }) {
5488
5489
  const alignClass = align === "start" ? "justify-start" : align === "end" ? "justify-end" : "justify-center";
5489
5490
  const { t } = reactI18next.useTranslation();
5490
- const handleCancel = React4.useCallback(() => {
5491
+ const handleCancel = React26.useCallback(() => {
5491
5492
  onCancel?.();
5492
5493
  onOpenChange(false);
5493
5494
  }, [onCancel, onOpenChange]);
5494
- const handleConfirm = React4.useCallback(() => {
5495
+ const handleConfirm = React26.useCallback(() => {
5495
5496
  onConfirm?.();
5496
5497
  onOpenChange(false);
5497
5498
  }, [onConfirm, onOpenChange]);
@@ -5711,7 +5712,7 @@ var DialogAlertProvider = ({ children, i18nResource, i18nLang }) => {
5711
5712
  const open = useDialogAlertStore((state) => state.open);
5712
5713
  const setOpen = useDialogAlertStore((state) => state.setOpen);
5713
5714
  const dialogProps = useDialogAlertStore((state) => state.dialogProps);
5714
- React4.useEffect(() => {
5715
+ React26.useEffect(() => {
5715
5716
  if (!i18nResource) {
5716
5717
  i18n_default.changeLanguage("sharedui");
5717
5718
  return;
@@ -5821,8 +5822,8 @@ var defaultOperatorShortcuts = {
5821
5822
  };
5822
5823
  var DEFAULT_DEBOUNCE = 200;
5823
5824
  function useKeyboardNavigation(itemsLength, onSelect, isLocked) {
5824
- const [selectedIndex, setSelectedIndex] = React4.useState(0);
5825
- React4.useEffect(() => {
5825
+ const [selectedIndex, setSelectedIndex] = React26.useState(0);
5826
+ React26.useEffect(() => {
5826
5827
  const handler = (event) => {
5827
5828
  if (event.key === "ArrowDown") {
5828
5829
  event.preventDefault();
@@ -5845,10 +5846,10 @@ function useKeyboardNavigation(itemsLength, onSelect, isLocked) {
5845
5846
  return [selectedIndex, setSelectedIndex];
5846
5847
  }
5847
5848
  function useDropdownPosition(clientRect, itemsCount) {
5848
- const [rect, setRect] = React4.useState(null);
5849
- const [style, setStyle] = React4.useState({});
5850
- const ref = React4.useRef(null);
5851
- React4.useEffect(() => {
5849
+ const [rect, setRect] = React26.useState(null);
5850
+ const [style, setStyle] = React26.useState({});
5851
+ const ref = React26.useRef(null);
5852
+ React26.useEffect(() => {
5852
5853
  if (!clientRect) return;
5853
5854
  const update = () => {
5854
5855
  const nextRect = clientRect();
@@ -5865,7 +5866,7 @@ function useDropdownPosition(clientRect, itemsCount) {
5865
5866
  resizeObserver.disconnect();
5866
5867
  };
5867
5868
  }, [clientRect]);
5868
- React4.useLayoutEffect(() => {
5869
+ React26.useLayoutEffect(() => {
5869
5870
  if (!rect || !ref.current) return;
5870
5871
  const dropdown = ref.current;
5871
5872
  const dropdownRect = dropdown.getBoundingClientRect();
@@ -5892,15 +5893,15 @@ var SuggestionList = ({
5892
5893
  debounceMs = DEFAULT_DEBOUNCE,
5893
5894
  query
5894
5895
  }) => {
5895
- const [items, setItems] = React4.useState([]);
5896
- const [isLoading, setIsLoading] = React4.useState(false);
5897
- const fetchId = React4.useRef(0);
5898
- const debounceHandle = React4.useRef(null);
5899
- const itemRefs = React4.useRef([]);
5896
+ const [items, setItems] = React26.useState([]);
5897
+ const [isLoading, setIsLoading] = React26.useState(false);
5898
+ const fetchId = React26.useRef(0);
5899
+ const debounceHandle = React26.useRef(null);
5900
+ const itemRefs = React26.useRef([]);
5900
5901
  const { ref, style, rect } = useDropdownPosition(clientRect, items.length);
5901
- const normalizedMap = React4.useMemo(() => mapItem, [mapItem]);
5902
- const normalizeItem = React4.useMemo(() => normalizeToken, [normalizeToken]);
5903
- React4.useEffect(() => {
5902
+ const normalizedMap = React26.useMemo(() => mapItem, [mapItem]);
5903
+ const normalizeItem = React26.useMemo(() => normalizeToken, [normalizeToken]);
5904
+ React26.useEffect(() => {
5904
5905
  const runFetch = (input) => {
5905
5906
  fetchId.current += 1;
5906
5907
  const currentId = fetchId.current;
@@ -5931,7 +5932,7 @@ var SuggestionList = ({
5931
5932
  fetchId.current += 1;
5932
5933
  };
5933
5934
  }, [query, fetchItems, normalizedMap, normalizeItem, debounceMs]);
5934
- const handleSelect = React4.useMemo(
5935
+ const handleSelect = React26.useMemo(
5935
5936
  () => (item) => {
5936
5937
  if (isLoading) return;
5937
5938
  command(item);
@@ -5946,10 +5947,10 @@ var SuggestionList = ({
5946
5947
  },
5947
5948
  isLoading
5948
5949
  );
5949
- React4.useEffect(() => {
5950
+ React26.useEffect(() => {
5950
5951
  setSelectedIndex(0);
5951
5952
  }, [items, setSelectedIndex]);
5952
- React4.useEffect(() => {
5953
+ React26.useEffect(() => {
5953
5954
  const element = itemRefs.current[selectedIndex];
5954
5955
  if (element) element.scrollIntoView({ block: "nearest" });
5955
5956
  }, [selectedIndex]);
@@ -5997,8 +5998,8 @@ var DISALLOWED_MARKS = ["bold", "italic", "link"];
5997
5998
  var SUGGESTION_DEBOUNCE = 200;
5998
5999
  var DEFAULT_CHIP_CLASS = "outline-1 outline-muted bg-muted/40 text-foreground";
5999
6000
  var TokenView = ({ node, editor, getPos }) => {
6000
- const [isFocused, setIsFocused] = React4__namespace.default.useState(false);
6001
- React4__namespace.default.useEffect(() => {
6001
+ const [isFocused, setIsFocused] = React26__namespace.default.useState(false);
6002
+ React26__namespace.default.useEffect(() => {
6002
6003
  const handler = () => {
6003
6004
  const { from, to } = editor.state.selection;
6004
6005
  const position = getPos();
@@ -6913,21 +6914,21 @@ function ToolbarPlugin({
6913
6914
  acceptImageMimeTypes
6914
6915
  }) {
6915
6916
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
6916
- const [state, setState] = React4.useState(initialToolbarState);
6917
- const fileInputRef = React4.useRef(null);
6918
- const [isLinkDialogOpen, setLinkDialogOpen] = React4.useState(false);
6919
- const [editingExistingLink, setEditingExistingLink] = React4.useState(false);
6920
- const [linkNodeKey, setLinkNodeKey] = React4.useState(null);
6921
- const [isImageDialogOpen, setImageDialogOpen] = React4.useState(false);
6922
- const [editingExistingImage, setEditingExistingImage] = React4.useState(false);
6923
- const [imageNodeKey, setImageNodeKey] = React4.useState(null);
6917
+ const [state, setState] = React26.useState(initialToolbarState);
6918
+ const fileInputRef = React26.useRef(null);
6919
+ const [isLinkDialogOpen, setLinkDialogOpen] = React26.useState(false);
6920
+ const [editingExistingLink, setEditingExistingLink] = React26.useState(false);
6921
+ const [linkNodeKey, setLinkNodeKey] = React26.useState(null);
6922
+ const [isImageDialogOpen, setImageDialogOpen] = React26.useState(false);
6923
+ const [editingExistingImage, setEditingExistingImage] = React26.useState(false);
6924
+ const [imageNodeKey, setImageNodeKey] = React26.useState(null);
6924
6925
  const linkForm = reactHookForm.useForm({
6925
6926
  defaultValues: { url: "", label: "" }
6926
6927
  });
6927
6928
  const imageForm = reactHookForm.useForm({
6928
6929
  defaultValues: { url: "", alt: "", width: "", height: "" }
6929
6930
  });
6930
- const openImageDialog = React4.useCallback(() => {
6931
+ const openImageDialog = React26.useCallback(() => {
6931
6932
  if (disabled || !allowImageUrlInsert) {
6932
6933
  return;
6933
6934
  }
@@ -6961,7 +6962,7 @@ function ToolbarPlugin({
6961
6962
  setImageNodeKey(targetImage?.getKey() ?? null);
6962
6963
  setImageDialogOpen(true);
6963
6964
  }, [allowImageUrlInsert, disabled, editor, imageForm]);
6964
- const closeImageDialog = React4.useCallback(() => {
6965
+ const closeImageDialog = React26.useCallback(() => {
6965
6966
  setImageDialogOpen(false);
6966
6967
  setEditingExistingImage(false);
6967
6968
  setImageNodeKey(null);
@@ -6970,7 +6971,7 @@ function ToolbarPlugin({
6970
6971
  editor.focus();
6971
6972
  }, 0);
6972
6973
  }, [editor, imageForm]);
6973
- const openLinkDialog = React4.useCallback(() => {
6974
+ const openLinkDialog = React26.useCallback(() => {
6974
6975
  if (disabled) {
6975
6976
  return;
6976
6977
  }
@@ -7010,7 +7011,7 @@ function ToolbarPlugin({
7010
7011
  setLinkNodeKey(detectedLink?.getKey() ?? null);
7011
7012
  setLinkDialogOpen(true);
7012
7013
  }, [disabled, editor, linkForm]);
7013
- const closeLinkDialog = React4.useCallback(() => {
7014
+ const closeLinkDialog = React26.useCallback(() => {
7014
7015
  setLinkDialogOpen(false);
7015
7016
  setEditingExistingLink(false);
7016
7017
  setLinkNodeKey(null);
@@ -7051,7 +7052,7 @@ function ToolbarPlugin({
7051
7052
  });
7052
7053
  closeLinkDialog();
7053
7054
  });
7054
- const handleRemoveLink = React4.useCallback(() => {
7055
+ const handleRemoveLink = React26.useCallback(() => {
7055
7056
  editor.focus();
7056
7057
  editor.update(() => {
7057
7058
  if (linkNodeKey) {
@@ -7068,7 +7069,7 @@ function ToolbarPlugin({
7068
7069
  });
7069
7070
  closeLinkDialog();
7070
7071
  }, [closeLinkDialog, editor, linkNodeKey]);
7071
- const handleLinkDialogOpenChange = React4.useCallback(
7072
+ const handleLinkDialogOpenChange = React26.useCallback(
7072
7073
  (open) => {
7073
7074
  if (open) {
7074
7075
  setLinkDialogOpen(true);
@@ -7078,7 +7079,7 @@ function ToolbarPlugin({
7078
7079
  },
7079
7080
  [closeLinkDialog]
7080
7081
  );
7081
- const updateToolbar = React4.useCallback(() => {
7082
+ const updateToolbar = React26.useCallback(() => {
7082
7083
  const selection = lexical.$getSelection();
7083
7084
  if (!lexical.$isRangeSelection(selection)) {
7084
7085
  return;
@@ -7118,7 +7119,7 @@ function ToolbarPlugin({
7118
7119
  isLink: hasLink
7119
7120
  }));
7120
7121
  }, []);
7121
- React4__namespace.useEffect(() => {
7122
+ React26__namespace.useEffect(() => {
7122
7123
  return utils.mergeRegister(
7123
7124
  editor.registerCommand(
7124
7125
  lexical.CAN_UNDO_COMMAND,
@@ -7149,7 +7150,7 @@ function ToolbarPlugin({
7149
7150
  })
7150
7151
  );
7151
7152
  }, [editor, updateToolbar]);
7152
- const applyBlock = React4.useCallback(
7153
+ const applyBlock = React26.useCallback(
7153
7154
  (nextBlock) => {
7154
7155
  if (disabled) {
7155
7156
  return;
@@ -7211,7 +7212,7 @@ function ToolbarPlugin({
7211
7212
  },
7212
7213
  [disabled, editor, state.blockType]
7213
7214
  );
7214
- const toggleFormat = React4.useCallback(
7215
+ const toggleFormat = React26.useCallback(
7215
7216
  (format5) => {
7216
7217
  if (disabled) {
7217
7218
  return;
@@ -7220,10 +7221,10 @@ function ToolbarPlugin({
7220
7221
  },
7221
7222
  [disabled, editor]
7222
7223
  );
7223
- const toggleLink = React4.useCallback(() => {
7224
+ const toggleLink = React26.useCallback(() => {
7224
7225
  openLinkDialog();
7225
7226
  }, [openLinkDialog]);
7226
- const applyElementFormat = React4.useCallback(
7227
+ const applyElementFormat = React26.useCallback(
7227
7228
  (format5) => {
7228
7229
  if (disabled) {
7229
7230
  return;
@@ -7234,7 +7235,7 @@ function ToolbarPlugin({
7234
7235
  );
7235
7236
  const canInsertImage = allowImageUrlInsert || Boolean(onImageUpload);
7236
7237
  const imageAccept = acceptImageMimeTypes ?? DEFAULT_IMAGE_ACCEPT;
7237
- const handleInsertImage = React4.useCallback(() => {
7238
+ const handleInsertImage = React26.useCallback(() => {
7238
7239
  if (disabled || !canInsertImage) {
7239
7240
  return;
7240
7241
  }
@@ -7245,7 +7246,7 @@ function ToolbarPlugin({
7245
7246
  }
7246
7247
  openImageDialog();
7247
7248
  }, [canInsertImage, disabled, editor, onImageUpload, openImageDialog]);
7248
- const handleFileChange = React4.useCallback(
7249
+ const handleFileChange = React26.useCallback(
7249
7250
  async (event) => {
7250
7251
  if (!onImageUpload) {
7251
7252
  return;
@@ -7335,7 +7336,7 @@ function ToolbarPlugin({
7335
7336
  });
7336
7337
  closeImageDialog();
7337
7338
  });
7338
- const handleImageDialogOpenChange = React4.useCallback(
7339
+ const handleImageDialogOpenChange = React26.useCallback(
7339
7340
  (open) => {
7340
7341
  if (open) {
7341
7342
  setImageDialogOpen(true);
@@ -7345,7 +7346,7 @@ function ToolbarPlugin({
7345
7346
  },
7346
7347
  [closeImageDialog]
7347
7348
  );
7348
- const handleRemoveImage = React4.useCallback(() => {
7349
+ const handleRemoveImage = React26.useCallback(() => {
7349
7350
  if (!imageNodeKey) {
7350
7351
  closeImageDialog();
7351
7352
  return;
@@ -7704,7 +7705,7 @@ function ControlledValuePlugin({
7704
7705
  trackAppliedValue
7705
7706
  }) {
7706
7707
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
7707
- React4__namespace.useEffect(() => {
7708
+ React26__namespace.useEffect(() => {
7708
7709
  if (value == null || trackAppliedValue.current === value) {
7709
7710
  return;
7710
7711
  }
@@ -7728,14 +7729,14 @@ function ControlledValuePlugin({
7728
7729
  }
7729
7730
  function EditableStatePlugin({ editable }) {
7730
7731
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
7731
- React4__namespace.useEffect(() => {
7732
+ React26__namespace.useEffect(() => {
7732
7733
  editor.setEditable(editable);
7733
7734
  }, [editor, editable]);
7734
7735
  return null;
7735
7736
  }
7736
7737
  function ImagesPlugin() {
7737
7738
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
7738
- React4__namespace.useEffect(() => {
7739
+ React26__namespace.useEffect(() => {
7739
7740
  return editor.registerCommand(
7740
7741
  INSERT_IMAGE_COMMAND,
7741
7742
  (payload) => {
@@ -7754,7 +7755,7 @@ function ImagesPlugin() {
7754
7755
  }, [editor]);
7755
7756
  return null;
7756
7757
  }
7757
- var RichText = React4.forwardRef(function RichText2({
7758
+ var RichText = React26.forwardRef(function RichText2({
7758
7759
  value,
7759
7760
  defaultValue,
7760
7761
  onChange,
@@ -7773,11 +7774,11 @@ var RichText = React4.forwardRef(function RichText2({
7773
7774
  id,
7774
7775
  ...rest
7775
7776
  }, ref) {
7776
- const initialSerializedStateRef = React4.useRef(void 0);
7777
+ const initialSerializedStateRef = React26.useRef(void 0);
7777
7778
  if (initialSerializedStateRef.current === void 0) {
7778
7779
  initialSerializedStateRef.current = parseSerializedEditorState(value ?? defaultValue);
7779
7780
  }
7780
- const initialConfig = React4.useMemo(
7781
+ const initialConfig = React26.useMemo(
7781
7782
  () => ({
7782
7783
  namespace: "RichTextEditor",
7783
7784
  editable: !(readOnly || disabled),
@@ -7790,8 +7791,8 @@ var RichText = React4.forwardRef(function RichText2({
7790
7791
  }),
7791
7792
  [disabled, readOnly]
7792
7793
  );
7793
- const appliedValueRef = React4.useRef(value ?? defaultValue);
7794
- const handleChange = React4.useCallback(
7794
+ const appliedValueRef = React26.useRef(value ?? defaultValue);
7795
+ const handleChange = React26.useCallback(
7795
7796
  (editorState, editor) => {
7796
7797
  const serialized = JSON.stringify(editorState.toJSON());
7797
7798
  appliedValueRef.current = serialized;
@@ -7980,13 +7981,13 @@ function SheetDescription({
7980
7981
  );
7981
7982
  }
7982
7983
  function useIsMobile(breakpoint = 768) {
7983
- const [isMobile, setIsMobile] = React4.useState(() => {
7984
+ const [isMobile, setIsMobile] = React26.useState(() => {
7984
7985
  if (typeof window === "undefined") {
7985
7986
  return false;
7986
7987
  }
7987
7988
  return window.innerWidth < breakpoint;
7988
7989
  });
7989
- React4.useEffect(() => {
7990
+ React26.useEffect(() => {
7990
7991
  function onResize() {
7991
7992
  setIsMobile(window.innerWidth < breakpoint);
7992
7993
  }
@@ -8016,9 +8017,9 @@ var SIDEBAR_WIDTH = "16rem";
8016
8017
  var SIDEBAR_WIDTH_MOBILE = "18rem";
8017
8018
  var SIDEBAR_WIDTH_ICON = "3rem";
8018
8019
  var SIDEBAR_KEYBOARD_SHORTCUT = "b";
8019
- var SidebarContext = React4__namespace.createContext(null);
8020
+ var SidebarContext = React26__namespace.createContext(null);
8020
8021
  function useSidebar() {
8021
- const context = React4__namespace.useContext(SidebarContext);
8022
+ const context = React26__namespace.useContext(SidebarContext);
8022
8023
  if (!context) {
8023
8024
  throw new Error("useSidebar must be used within a SidebarProvider.");
8024
8025
  }
@@ -8034,10 +8035,10 @@ function SidebarProvider({
8034
8035
  ...props
8035
8036
  }) {
8036
8037
  const isMobile = useIsMobile();
8037
- const [openMobile, setOpenMobile] = React4__namespace.useState(false);
8038
- const [_open, _setOpen] = React4__namespace.useState(defaultOpen);
8038
+ const [openMobile, setOpenMobile] = React26__namespace.useState(false);
8039
+ const [_open, _setOpen] = React26__namespace.useState(defaultOpen);
8039
8040
  const open = openProp ?? _open;
8040
- const setOpen = React4__namespace.useCallback(
8041
+ const setOpen = React26__namespace.useCallback(
8041
8042
  (value) => {
8042
8043
  const openState = typeof value === "function" ? value(open) : value;
8043
8044
  if (setOpenProp) {
@@ -8049,10 +8050,10 @@ function SidebarProvider({
8049
8050
  },
8050
8051
  [setOpenProp, open]
8051
8052
  );
8052
- const toggleSidebar = React4__namespace.useCallback(() => {
8053
+ const toggleSidebar = React26__namespace.useCallback(() => {
8053
8054
  return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
8054
8055
  }, [isMobile, setOpen, setOpenMobile]);
8055
- React4__namespace.useEffect(() => {
8056
+ React26__namespace.useEffect(() => {
8056
8057
  const handleKeyDown = (event) => {
8057
8058
  if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
8058
8059
  event.preventDefault();
@@ -8063,7 +8064,7 @@ function SidebarProvider({
8063
8064
  return () => window.removeEventListener("keydown", handleKeyDown);
8064
8065
  }, [toggleSidebar]);
8065
8066
  const state = open ? "expanded" : "collapsed";
8066
- const contextValue = React4__namespace.useMemo(
8067
+ const contextValue = React26__namespace.useMemo(
8067
8068
  () => ({
8068
8069
  state,
8069
8070
  open,
@@ -8505,7 +8506,7 @@ function SidebarMenuSkeleton({
8505
8506
  showIcon = false,
8506
8507
  ...props
8507
8508
  }) {
8508
- const width = React4__namespace.useMemo(() => {
8509
+ const width = React26__namespace.useMemo(() => {
8509
8510
  return `${Math.floor(Math.random() * 40) + 50}%`;
8510
8511
  }, []);
8511
8512
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -8770,10 +8771,10 @@ var FormulaEditor = ({
8770
8771
  fieldState,
8771
8772
  mode = "edit"
8772
8773
  }) => {
8773
- const [isExpanded, setIsExpanded] = React4.useState(false);
8774
- const lastEmittedValueRef = React4.useRef(null);
8775
- const ignorePropValueRef = React4.useRef(false);
8776
- const normalizedConfigs = React4.useMemo(() => {
8774
+ const [isExpanded, setIsExpanded] = React26.useState(false);
8775
+ const lastEmittedValueRef = React26.useRef(null);
8776
+ const ignorePropValueRef = React26.useRef(false);
8777
+ const normalizedConfigs = React26.useMemo(() => {
8777
8778
  const configsToUse = tokenConfigs?.length ? tokenConfigs : DEFAULT_TOKEN_CONFIGS;
8778
8779
  return configsToUse.map((config) => ({
8779
8780
  ...config,
@@ -8782,18 +8783,18 @@ var FormulaEditor = ({
8782
8783
  outputType: config.outputType ?? config.type
8783
8784
  }));
8784
8785
  }, [tokenConfigs]);
8785
- const prefixMap = React4.useMemo(() => buildPrefixMap(normalizedConfigs), [normalizedConfigs]);
8786
- const configLookup = React4.useMemo(() => {
8786
+ const prefixMap = React26.useMemo(() => buildPrefixMap(normalizedConfigs), [normalizedConfigs]);
8787
+ const configLookup = React26.useMemo(() => {
8787
8788
  const lookup = /* @__PURE__ */ new Map();
8788
8789
  normalizedConfigs.forEach((config) => lookup.set(config.prefix, config));
8789
8790
  return lookup;
8790
8791
  }, [normalizedConfigs]);
8791
- const allowedOperators = React4.useMemo(() => operators.map((operator) => operator.value), [operators]);
8792
+ const allowedOperators = React26.useMemo(() => operators.map((operator) => operator.value), [operators]);
8792
8793
  const displayError = errorMessage ?? fieldState?.error?.message;
8793
8794
  const hasError = Boolean(displayError);
8794
8795
  const isEditorReadOnly = mode === "display";
8795
8796
  const isEditorDisabled = disabled || loading || isEditorReadOnly;
8796
- const convertValueToContent = React4.useCallback(
8797
+ const convertValueToContent = React26.useCallback(
8797
8798
  (input) => {
8798
8799
  if (!input) return "";
8799
8800
  const trimmed = input.trim();
@@ -8805,8 +8806,8 @@ var FormulaEditor = ({
8805
8806
  },
8806
8807
  [configLookup, prefixMap]
8807
8808
  );
8808
- const resolvedContent = React4.useMemo(() => convertValueToContent(value), [convertValueToContent, value]);
8809
- const extensions = React4.useMemo(
8809
+ const resolvedContent = React26.useMemo(() => convertValueToContent(value), [convertValueToContent, value]);
8810
+ const extensions = React26.useMemo(
8810
8811
  () => [
8811
8812
  StarterKit__default.default.configure({ bold: false, italic: false }),
8812
8813
  Token.configure({ configs: normalizedConfigs, onSelect: onSelectSuggestion }),
@@ -8838,11 +8839,11 @@ var FormulaEditor = ({
8838
8839
  }
8839
8840
  }
8840
8841
  });
8841
- React4.useEffect(() => {
8842
+ React26.useEffect(() => {
8842
8843
  if (!editor) return;
8843
8844
  editor.setEditable(!isEditorDisabled);
8844
8845
  }, [editor, isEditorDisabled]);
8845
- React4.useEffect(() => {
8846
+ React26.useEffect(() => {
8846
8847
  if (!editor || resolvedContent === void 0) return;
8847
8848
  if (ignorePropValueRef.current && typeof value === "string" && value === lastEmittedValueRef.current) {
8848
8849
  ignorePropValueRef.current = false;
@@ -8974,7 +8975,7 @@ function SortableRow({
8974
8975
  id: value,
8975
8976
  disabled: name === "columns.0.id"
8976
8977
  });
8977
- const style = React4__namespace.useMemo(
8978
+ const style = React26__namespace.useMemo(
8978
8979
  () => ({
8979
8980
  transform: utilities.CSS.Transform.toString(transform),
8980
8981
  transition
@@ -9086,8 +9087,8 @@ var GridSettingsModal = ({
9086
9087
  onClose,
9087
9088
  onSaveColumns
9088
9089
  }) => {
9089
- const [isDragging, setIsDragging] = React4.useState(false);
9090
- const scrollRef = React4.useRef(null);
9090
+ const [isDragging, setIsDragging] = React26.useState(false);
9091
+ const scrollRef = React26.useRef(null);
9091
9092
  const form = reactHookForm.useForm({
9092
9093
  resolver: zod$1.zodResolver(GridSettingsSchema),
9093
9094
  defaultValues: { columns: currentColumns },
@@ -9099,7 +9100,7 @@ var GridSettingsModal = ({
9099
9100
  name: "columns",
9100
9101
  keyName: "fieldId"
9101
9102
  });
9102
- React4.useEffect(() => {
9103
+ React26.useEffect(() => {
9103
9104
  if (isOpen) {
9104
9105
  form.reset({ columns: currentColumns });
9105
9106
  }
@@ -9376,7 +9377,7 @@ function getCandidateWidths({
9376
9377
  }
9377
9378
  return DEVICE_SIZES;
9378
9379
  }
9379
- var Image2 = React4__namespace.forwardRef(function Image3({
9380
+ var Image2 = React26__namespace.forwardRef(function Image3({
9380
9381
  src,
9381
9382
  alt,
9382
9383
  width,
@@ -9406,34 +9407,34 @@ var Image2 = React4__namespace.forwardRef(function Image3({
9406
9407
  } = imgProps;
9407
9408
  const widthNumber = toNumber(width);
9408
9409
  const heightNumber = toNumber(height);
9409
- React4__namespace.useEffect(() => {
9410
+ React26__namespace.useEffect(() => {
9410
9411
  if (!fill && (!widthNumber || !heightNumber)) {
9411
9412
  console.warn(
9412
9413
  "[Image] When `fill` is false you should provide both `width` and `height` to prevent layout shifts."
9413
9414
  );
9414
9415
  }
9415
9416
  }, [fill, heightNumber, widthNumber]);
9416
- const candidateWidths = React4__namespace.useMemo(
9417
+ const candidateWidths = React26__namespace.useMemo(
9417
9418
  () => getCandidateWidths({ width: widthNumber, sizes, fill }),
9418
9419
  [fill, sizes, widthNumber]
9419
9420
  );
9420
9421
  const largestWidth = candidateWidths[candidateWidths.length - 1] ?? widthNumber ?? DEVICE_SIZES[DEVICE_SIZES.length - 1];
9421
- const computedSrc = React4__namespace.useMemo(() => {
9422
+ const computedSrc = React26__namespace.useMemo(() => {
9422
9423
  if (unoptimized) {
9423
9424
  return src;
9424
9425
  }
9425
9426
  return loader({ src, width: largestWidth, quality });
9426
9427
  }, [largestWidth, loader, quality, src, unoptimized]);
9427
- const computedSrcSet = React4__namespace.useMemo(() => {
9428
+ const computedSrcSet = React26__namespace.useMemo(() => {
9428
9429
  if (unoptimized) {
9429
9430
  return void 0;
9430
9431
  }
9431
9432
  return candidateWidths.map((currentWidth) => `${loader({ src, width: currentWidth, quality })} ${currentWidth}w`).join(", ");
9432
9433
  }, [candidateWidths, loader, quality, src, unoptimized]);
9433
9434
  const sizesValue = sizes ?? (fill ? "100vw" : widthNumber ? `${widthNumber}px` : void 0);
9434
- const [isLoaded, setIsLoaded] = React4__namespace.useState(false);
9435
- const internalRef = React4__namespace.useRef(null);
9436
- const setRefs = React4__namespace.useCallback(
9435
+ const [isLoaded, setIsLoaded] = React26__namespace.useState(false);
9436
+ const internalRef = React26__namespace.useRef(null);
9437
+ const setRefs = React26__namespace.useCallback(
9437
9438
  (node) => {
9438
9439
  internalRef.current = node;
9439
9440
  if (!ref) {
@@ -9447,7 +9448,7 @@ var Image2 = React4__namespace.forwardRef(function Image3({
9447
9448
  },
9448
9449
  [ref]
9449
9450
  );
9450
- React4__namespace.useEffect(() => {
9451
+ React26__namespace.useEffect(() => {
9451
9452
  const image = internalRef.current;
9452
9453
  if (!image) {
9453
9454
  return;
@@ -9459,7 +9460,7 @@ var Image2 = React4__namespace.forwardRef(function Image3({
9459
9460
  setIsLoaded(false);
9460
9461
  }
9461
9462
  }, [onLoadingComplete, src]);
9462
- const handleLoad = React4__namespace.useCallback(
9463
+ const handleLoad = React26__namespace.useCallback(
9463
9464
  (event) => {
9464
9465
  setIsLoaded(true);
9465
9466
  onLoadProp?.(event);
@@ -9471,7 +9472,7 @@ var Image2 = React4__namespace.forwardRef(function Image3({
9471
9472
  const fetchPriority = priority ? "high" : fetchPriorityProp;
9472
9473
  const decoding = decodingProp ?? "async";
9473
9474
  const resolvedObjectFit = objectFit ?? (fill ? "cover" : void 0);
9474
- const wrapperStyle = React4__namespace.useMemo(
9475
+ const wrapperStyle = React26__namespace.useMemo(
9475
9476
  () => ({
9476
9477
  position: "relative",
9477
9478
  display: fill ? "block" : "inline-block",
@@ -9481,7 +9482,7 @@ var Image2 = React4__namespace.forwardRef(function Image3({
9481
9482
  }),
9482
9483
  [fill, height, width]
9483
9484
  );
9484
- const imageStyle = React4__namespace.useMemo(
9485
+ const imageStyle = React26__namespace.useMemo(
9485
9486
  () => ({
9486
9487
  width: fill ? "100%" : formatDimension(width) ?? void 0,
9487
9488
  height: fill ? "100%" : formatDimension(height) ?? void 0,
@@ -9543,7 +9544,7 @@ var Image2 = React4__namespace.forwardRef(function Image3({
9543
9544
  });
9544
9545
  Image2.displayName = "Image";
9545
9546
  var ListTable = ({ onTableReady, children }) => {
9546
- React4__namespace.useEffect(() => {
9547
+ React26__namespace.useEffect(() => {
9547
9548
  if (onTableReady) {
9548
9549
  onTableReady({ ready: true });
9549
9550
  }
@@ -9588,7 +9589,7 @@ var ListHeader = ({
9588
9589
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": "list-header", className: cn("rounded-t-lg px-4 py-2", bgColor, className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
9589
9590
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center gap-2 text-lg", textClassName), children: [
9590
9591
  titleIcon,
9591
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "leading-none", children: title })
9592
+ title
9592
9593
  ] }),
9593
9594
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: rightActions ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9594
9595
  onSettingClick && /* @__PURE__ */ jsxRuntime.jsx(
@@ -9688,7 +9689,7 @@ var InfoIcon = (props) => {
9688
9689
  }
9689
9690
  );
9690
9691
  };
9691
- var InfoIcon_default = React4__namespace.default.memo(InfoIcon);
9692
+ var InfoIcon_default = React26__namespace.default.memo(InfoIcon);
9692
9693
  var Navbar = ({
9693
9694
  className,
9694
9695
  title,
@@ -9713,7 +9714,7 @@ var Navbar = ({
9713
9714
  }) => {
9714
9715
  const { isMobile, isTablet, isDesktop } = useScreenSize_default();
9715
9716
  const Icon2 = lucideReact.CircleHelp;
9716
- const shouldShowSeparator = !separatorDisable && React4.isValidElement(searchButton);
9717
+ const shouldShowSeparator = !separatorDisable && React26.isValidElement(searchButton);
9717
9718
  return /* @__PURE__ */ jsxRuntime.jsxs(
9718
9719
  "nav",
9719
9720
  {
@@ -9724,8 +9725,8 @@ var Navbar = ({
9724
9725
  children: [
9725
9726
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5", children: [
9726
9727
  headImageURL !== "" ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: headImageURL, alt: "", className: cn("w-full h-full", headImageURLClassName) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
9727
- React4.isValidElement(title) ? title : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-xl font-bold", children: title }),
9728
- React4.isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
9728
+ React26.isValidElement(title) ? title : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-xl font-bold", children: title }),
9729
+ React26.isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
9729
9730
  ] }),
9730
9731
  tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
9731
9732
  /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "text-white hover:opacity-80 ", children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon_default, { className: "w-4" }) }) }),
@@ -9756,10 +9757,10 @@ var Navbar = ({
9756
9757
  ),
9757
9758
  children: [
9758
9759
  tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
9759
- React4.isValidElement(tooltipIcon) ? tooltipIcon : /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 32, "aria-hidden": "true" }),
9760
+ React26.isValidElement(tooltipIcon) ? tooltipIcon : /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 32, "aria-hidden": "true" }),
9760
9761
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-bold", children: tooltipTitle })
9761
9762
  ] }),
9762
- React4.isValidElement(tooltipdescription) && tooltipdescription
9763
+ React26.isValidElement(tooltipdescription) && tooltipdescription
9763
9764
  ]
9764
9765
  }
9765
9766
  ),
@@ -9814,13 +9815,13 @@ var Navbar = ({
9814
9815
  }
9815
9816
  ),
9816
9817
  shouldShowSeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "separator", className: "ml-1 w-[1px] h-10 bg-white" }),
9817
- React4.isValidElement(searchButton) ? searchButton : ""
9818
+ React26.isValidElement(searchButton) ? searchButton : ""
9818
9819
  ] })
9819
9820
  ]
9820
9821
  }
9821
9822
  );
9822
9823
  };
9823
- var navbar_default = React4__namespace.default.memo(Navbar);
9824
+ var navbar_default = React26__namespace.default.memo(Navbar);
9824
9825
  var usePreventPageLeaveStore = zustand.create((set) => ({
9825
9826
  isPreventing: false,
9826
9827
  setPreventing: (value) => set({ isPreventing: value })
@@ -9830,7 +9831,7 @@ var usePreventPageLeaveStore_default = usePreventPageLeaveStore;
9830
9831
  // src/components/prevent-page-leave/PreventPageLeave.tsx
9831
9832
  var PreventPageLeave = ({ children }) => {
9832
9833
  const { isPreventing } = usePreventPageLeaveStore();
9833
- React4.useEffect(() => {
9834
+ React26.useEffect(() => {
9834
9835
  if (!isPreventing || typeof window === "undefined") {
9835
9836
  return;
9836
9837
  }
@@ -9848,7 +9849,7 @@ var PreventPageLeave = ({ children }) => {
9848
9849
  var PreventPageLeave_default = PreventPageLeave;
9849
9850
  var usePreventPageLeave = ({ isPrevening }) => {
9850
9851
  const setPreventing = usePreventPageLeaveStore_default((state) => state.setPreventing);
9851
- React4.useEffect(() => {
9852
+ React26.useEffect(() => {
9852
9853
  setPreventing(isPrevening);
9853
9854
  }, [isPrevening, setPreventing]);
9854
9855
  };
@@ -9989,20 +9990,20 @@ var CropperModal = ({
9989
9990
  title,
9990
9991
  props
9991
9992
  }) => {
9992
- const [isLoading, setIsLoading] = React4.useState(false);
9993
- const [crop, setCrop] = React4.useState({ x: 0, y: 0 });
9994
- const [zoom, setZoom] = React4.useState();
9995
- const [croppedAreaPixels, setCroppedAreaPixels] = React4.useState(null);
9996
- const handleClose = React4.useCallback(() => {
9993
+ const [isLoading, setIsLoading] = React26.useState(false);
9994
+ const [crop, setCrop] = React26.useState({ x: 0, y: 0 });
9995
+ const [zoom, setZoom] = React26.useState();
9996
+ const [croppedAreaPixels, setCroppedAreaPixels] = React26.useState(null);
9997
+ const handleClose = React26.useCallback(() => {
9997
9998
  onOpenChange(false);
9998
9999
  }, [onOpenChange]);
9999
- const handleCancel = React4.useCallback(() => {
10000
+ const handleCancel = React26.useCallback(() => {
10000
10001
  if (onCancel) {
10001
10002
  onCancel();
10002
10003
  }
10003
10004
  handleClose();
10004
10005
  }, [handleClose, onCancel]);
10005
- const handleCropComplete = React4.useCallback((_, croppedAreaPixels2) => {
10006
+ const handleCropComplete = React26.useCallback((_, croppedAreaPixels2) => {
10006
10007
  setCroppedAreaPixels(croppedAreaPixels2);
10007
10008
  }, []);
10008
10009
  const handleConfirm = async () => {
@@ -10096,6 +10097,231 @@ var CropperModal = ({
10096
10097
  }
10097
10098
  );
10098
10099
  };
10100
+ var REACT_ELEMENT_TYPE_18 = /* @__PURE__ */ Symbol.for("react.element");
10101
+ var REACT_ELEMENT_TYPE_19 = /* @__PURE__ */ Symbol.for("react.transitional.element");
10102
+ var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
10103
+ function isFragment(object) {
10104
+ return (
10105
+ // Base object type
10106
+ object && typeof object === "object" && // React Element type
10107
+ (object.$$typeof === REACT_ELEMENT_TYPE_18 || object.$$typeof === REACT_ELEMENT_TYPE_19) && // React Fragment type
10108
+ object.type === REACT_FRAGMENT_TYPE
10109
+ );
10110
+ }
10111
+ var isValidText = (val) => ["string", "number"].includes(typeof val);
10112
+ function toArray(children, option = {}) {
10113
+ let ret = [];
10114
+ React26__namespace.Children.forEach(children, (child) => {
10115
+ if ((child === void 0 || child === null) && !option.keepEmpty) {
10116
+ return;
10117
+ }
10118
+ if (Array.isArray(child)) {
10119
+ ret = ret.concat(toArray(child));
10120
+ } else if (isFragment(child) && child.props) {
10121
+ ret = ret.concat(toArray(child.props.children, option));
10122
+ } else {
10123
+ ret.push(child);
10124
+ }
10125
+ });
10126
+ return ret;
10127
+ }
10128
+ var MeasureText = React26__namespace.forwardRef(({ style, children }, ref) => {
10129
+ const spanRef = React26__namespace.useRef(null);
10130
+ React26__namespace.useImperativeHandle(ref, () => ({
10131
+ isExceed: () => {
10132
+ const span = spanRef.current;
10133
+ return span.scrollHeight > span.clientHeight;
10134
+ },
10135
+ getHeight: () => spanRef.current.clientHeight
10136
+ }));
10137
+ return /* @__PURE__ */ jsxRuntime.jsx(
10138
+ "span",
10139
+ {
10140
+ "aria-hidden": true,
10141
+ ref: spanRef,
10142
+ style: {
10143
+ position: "fixed",
10144
+ display: "block",
10145
+ left: 0,
10146
+ top: 0,
10147
+ pointerEvents: "none",
10148
+ ...style
10149
+ },
10150
+ children
10151
+ }
10152
+ );
10153
+ });
10154
+ var getNodesLen = (nodeList) => nodeList.reduce((totalLen, node) => totalLen + (isValidText(node) ? String(node).length : 1), 0);
10155
+ function sliceNodes(nodeList, len) {
10156
+ let currLen = 0;
10157
+ const currentNodeList = [];
10158
+ for (let i = 0; i < nodeList.length; i += 1) {
10159
+ if (currLen === len) {
10160
+ return currentNodeList;
10161
+ }
10162
+ const node = nodeList[i];
10163
+ const canCut = isValidText(node);
10164
+ const nodeLen = canCut ? String(node).length : 1;
10165
+ const nextLen = currLen + nodeLen;
10166
+ if (nextLen > len) {
10167
+ const restLen = len - currLen;
10168
+ currentNodeList.push(String(node).slice(0, restLen));
10169
+ return currentNodeList;
10170
+ }
10171
+ currentNodeList.push(node);
10172
+ currLen = nextLen;
10173
+ }
10174
+ return nodeList;
10175
+ }
10176
+ var STATUS_MEASURE_NONE = 0;
10177
+ var STATUS_MEASURE_PREPARE = 1;
10178
+ var STATUS_MEASURE_START = 2;
10179
+ var STATUS_MEASURE_NEED_ELLIPSIS = 3;
10180
+ var STATUS_MEASURE_NO_NEED_ELLIPSIS = 4;
10181
+ var lineClipStyle = {
10182
+ display: "-webkit-box",
10183
+ overflow: "hidden",
10184
+ WebkitBoxOrient: "vertical"
10185
+ };
10186
+ function EllipsisMeasure(props) {
10187
+ const { enableMeasure, width, text, children, rows, expanded, miscDeps, onEllipsis } = props;
10188
+ const nodeList = React26__namespace.useMemo(() => toArray(text), [text]);
10189
+ const nodeLen = React26__namespace.useMemo(() => getNodesLen(nodeList), [text]);
10190
+ const fullContent = React26__namespace.useMemo(() => children(nodeList, false), [text]);
10191
+ const [ellipsisCutIndex, setEllipsisCutIndex] = React26__namespace.useState(null);
10192
+ const cutMidRef = React26__namespace.useRef(null);
10193
+ const measureWhiteSpaceRef = React26__namespace.useRef(null);
10194
+ const needEllipsisRef = React26__namespace.useRef(null);
10195
+ const descRowsEllipsisRef = React26__namespace.useRef(null);
10196
+ const symbolRowEllipsisRef = React26__namespace.useRef(null);
10197
+ const [canEllipsis, setCanEllipsis] = React26__namespace.useState(false);
10198
+ const [needEllipsis, setNeedEllipsis] = React26__namespace.useState(STATUS_MEASURE_NONE);
10199
+ const [ellipsisHeight, setEllipsisHeight] = React26__namespace.useState(0);
10200
+ const [parentWhiteSpace, setParentWhiteSpace] = React26__namespace.useState(null);
10201
+ useIsomorphicLayoutEffect(() => {
10202
+ if (enableMeasure && width && nodeLen) {
10203
+ setNeedEllipsis(STATUS_MEASURE_PREPARE);
10204
+ } else {
10205
+ setNeedEllipsis(STATUS_MEASURE_NONE);
10206
+ }
10207
+ }, [width, text, rows, enableMeasure, nodeList]);
10208
+ useIsomorphicLayoutEffect(() => {
10209
+ if (needEllipsis === STATUS_MEASURE_PREPARE) {
10210
+ setNeedEllipsis(STATUS_MEASURE_START);
10211
+ const nextWhiteSpace = measureWhiteSpaceRef.current && getComputedStyle(measureWhiteSpaceRef.current).whiteSpace;
10212
+ setParentWhiteSpace(nextWhiteSpace);
10213
+ } else if (needEllipsis === STATUS_MEASURE_START) {
10214
+ const isOverflow = !!needEllipsisRef.current?.isExceed();
10215
+ setNeedEllipsis(isOverflow ? STATUS_MEASURE_NEED_ELLIPSIS : STATUS_MEASURE_NO_NEED_ELLIPSIS);
10216
+ setEllipsisCutIndex(isOverflow ? [0, nodeLen] : null);
10217
+ setCanEllipsis(isOverflow);
10218
+ const baseRowsEllipsisHeight = needEllipsisRef.current?.getHeight() || 0;
10219
+ const descRowsEllipsisHeight = rows === 1 ? 0 : descRowsEllipsisRef.current?.getHeight() || 0;
10220
+ const symbolRowEllipsisHeight = symbolRowEllipsisRef.current?.getHeight() || 0;
10221
+ const maxRowsHeight = Math.max(
10222
+ baseRowsEllipsisHeight,
10223
+ // height of rows with ellipsis
10224
+ descRowsEllipsisHeight + symbolRowEllipsisHeight
10225
+ );
10226
+ setEllipsisHeight(maxRowsHeight + 1);
10227
+ onEllipsis(isOverflow);
10228
+ }
10229
+ }, [needEllipsis]);
10230
+ const cutMidIndex = ellipsisCutIndex ? Math.ceil((ellipsisCutIndex[0] + ellipsisCutIndex[1]) / 2) : 0;
10231
+ useIsomorphicLayoutEffect(() => {
10232
+ const [minIndex, maxIndex] = ellipsisCutIndex || [0, 0];
10233
+ if (minIndex !== maxIndex) {
10234
+ const midHeight = cutMidRef.current?.getHeight() || 0;
10235
+ const isOverflow = midHeight > ellipsisHeight;
10236
+ let targetMidIndex = cutMidIndex;
10237
+ if (maxIndex - minIndex === 1) {
10238
+ targetMidIndex = isOverflow ? minIndex : maxIndex;
10239
+ }
10240
+ setEllipsisCutIndex(isOverflow ? [minIndex, targetMidIndex] : [targetMidIndex, maxIndex]);
10241
+ }
10242
+ }, [ellipsisCutIndex, cutMidIndex]);
10243
+ const finalContent = React26__namespace.useMemo(() => {
10244
+ if (!enableMeasure) {
10245
+ return children(nodeList, false);
10246
+ }
10247
+ if (needEllipsis !== STATUS_MEASURE_NEED_ELLIPSIS || !ellipsisCutIndex || ellipsisCutIndex[0] !== ellipsisCutIndex[1]) {
10248
+ const content = children(nodeList, false);
10249
+ if ([STATUS_MEASURE_NO_NEED_ELLIPSIS, STATUS_MEASURE_NONE].includes(needEllipsis)) {
10250
+ return content;
10251
+ }
10252
+ return /* @__PURE__ */ jsxRuntime.jsx(
10253
+ "span",
10254
+ {
10255
+ style: {
10256
+ ...lineClipStyle,
10257
+ WebkitLineClamp: rows
10258
+ },
10259
+ children: content
10260
+ }
10261
+ );
10262
+ }
10263
+ return children(expanded ? nodeList : sliceNodes(nodeList, ellipsisCutIndex[0]), canEllipsis);
10264
+ }, [expanded, needEllipsis, ellipsisCutIndex, nodeList, ...miscDeps]);
10265
+ const measureStyle = {
10266
+ width,
10267
+ margin: 0,
10268
+ padding: 0,
10269
+ whiteSpace: parentWhiteSpace === "nowrap" ? "normal" : "inherit"
10270
+ };
10271
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10272
+ finalContent,
10273
+ needEllipsis === STATUS_MEASURE_START && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10274
+ /* @__PURE__ */ jsxRuntime.jsx(
10275
+ MeasureText,
10276
+ {
10277
+ style: {
10278
+ ...measureStyle,
10279
+ ...lineClipStyle,
10280
+ WebkitLineClamp: rows
10281
+ },
10282
+ ref: needEllipsisRef,
10283
+ children: fullContent
10284
+ }
10285
+ ),
10286
+ /* @__PURE__ */ jsxRuntime.jsx(
10287
+ MeasureText,
10288
+ {
10289
+ style: {
10290
+ ...measureStyle,
10291
+ ...lineClipStyle,
10292
+ WebkitLineClamp: rows - 1
10293
+ },
10294
+ ref: descRowsEllipsisRef,
10295
+ children: fullContent
10296
+ }
10297
+ ),
10298
+ /* @__PURE__ */ jsxRuntime.jsx(
10299
+ MeasureText,
10300
+ {
10301
+ style: {
10302
+ ...measureStyle,
10303
+ ...lineClipStyle,
10304
+ WebkitLineClamp: 1
10305
+ },
10306
+ ref: symbolRowEllipsisRef,
10307
+ children: children([], true)
10308
+ }
10309
+ )
10310
+ ] }),
10311
+ needEllipsis === STATUS_MEASURE_NEED_ELLIPSIS && ellipsisCutIndex && ellipsisCutIndex[0] !== ellipsisCutIndex[1] && /* @__PURE__ */ jsxRuntime.jsx(
10312
+ MeasureText,
10313
+ {
10314
+ style: {
10315
+ ...measureStyle,
10316
+ top: 400
10317
+ },
10318
+ ref: cutMidRef,
10319
+ children: children(sliceNodes(nodeList, cutMidIndex), true)
10320
+ }
10321
+ ),
10322
+ needEllipsis === STATUS_MEASURE_PREPARE && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { whiteSpace: "inherit" }, ref: measureWhiteSpaceRef })
10323
+ ] });
10324
+ }
10099
10325
  var Truncated = ({
10100
10326
  children,
10101
10327
  className,
@@ -10105,49 +10331,41 @@ var Truncated = ({
10105
10331
  tooltipProps,
10106
10332
  tooltipContentProps
10107
10333
  }) => {
10108
- const elementRef = React4.useRef(null);
10109
- const [open, setOpen] = React4.useState(false);
10110
- const [isTruncated, setIsTruncated] = React4.useState(false);
10334
+ const elementRef = React26__namespace.useRef(null);
10335
+ const [open, setOpen] = React26__namespace.useState(false);
10336
+ const [isTruncated, setIsTruncated] = React26__namespace.useState(false);
10337
+ const [measureWidth, setMeasureWidth] = React26__namespace.useState(0);
10111
10338
  const Comp = as;
10112
10339
  const normalizedChildren = typeof children === "string" ? children.replace(/>/g, ">\u200B") : children;
10113
10340
  const lineClampLines = typeof ellipsis === "number" ? ellipsis : typeof ellipsis === "object" ? ellipsis?.lineClamp ?? 3 : null;
10114
- React4.useEffect(() => {
10341
+ const enableMeasure = Boolean(ellipsis) && !tooltipProps?.disabled;
10342
+ useIsomorphicLayoutEffect(() => {
10115
10343
  const el = elementRef.current;
10116
10344
  if (!el) return;
10117
- const measure = () => {
10118
- if (!ellipsis) {
10119
- setIsTruncated(false);
10120
- return;
10121
- }
10345
+ const updateWidth = () => {
10122
10346
  const rect = el.getBoundingClientRect();
10123
- const width = el.clientWidth || el.offsetWidth || rect.width;
10124
- const height = el.clientHeight || el.offsetHeight || rect.height;
10125
- if (!width || !height) {
10126
- setIsTruncated(false);
10127
- return;
10128
- }
10129
- const epsilon = 1;
10130
- const overflowWidth = el.scrollWidth - width > epsilon;
10131
- const overflowHeight = el.scrollHeight - height > epsilon;
10132
- setIsTruncated(overflowWidth || overflowHeight);
10347
+ const width = el.clientWidth || el.offsetWidth || rect.width || 0;
10348
+ setMeasureWidth(width);
10133
10349
  };
10134
- const resizeObserver = new ResizeObserver(() => requestAnimationFrame(measure));
10350
+ updateWidth();
10351
+ const resizeObserver = new ResizeObserver(() => requestAnimationFrame(updateWidth));
10135
10352
  resizeObserver.observe(el);
10136
- const mutationObserver = new MutationObserver(() => measure());
10137
- mutationObserver.observe(el, { childList: true, subtree: true, characterData: true });
10138
- requestAnimationFrame(measure);
10139
10353
  return () => {
10140
10354
  resizeObserver.disconnect();
10141
- mutationObserver.disconnect();
10142
10355
  };
10143
- }, [children, ellipsis, lineClampLines]);
10144
- const truncationClass = React4.useMemo(() => {
10356
+ }, []);
10357
+ useIsomorphicLayoutEffect(() => {
10358
+ if (!enableMeasure) {
10359
+ setIsTruncated(false);
10360
+ }
10361
+ }, [enableMeasure]);
10362
+ const truncationClass = React26__namespace.useMemo(() => {
10145
10363
  if (!ellipsis) return "";
10146
10364
  if (typeof ellipsis === "number") return `line-clamp-${ellipsis}`;
10147
10365
  if (typeof ellipsis === "object") return `line-clamp-${lineClampLines ?? 3}`;
10148
10366
  return "truncate";
10149
10367
  }, [ellipsis, lineClampLines]);
10150
- const clampedStyle = React4.useMemo(() => {
10368
+ const clampedStyle = React26__namespace.useMemo(() => {
10151
10369
  if (!lineClampLines) return style;
10152
10370
  return {
10153
10371
  ...style,
@@ -10157,7 +10375,22 @@ var Truncated = ({
10157
10375
  overflow: "hidden"
10158
10376
  };
10159
10377
  }, [lineClampLines, style]);
10160
- const baseContent = /* @__PURE__ */ jsxRuntime.jsx(Comp, { ref: elementRef, className: cn(truncationClass, className), style: clampedStyle, children: normalizedChildren });
10378
+ const baseContent = /* @__PURE__ */ jsxRuntime.jsx(Comp, { ref: elementRef, className: cn(truncationClass, className), style: clampedStyle, children: /* @__PURE__ */ jsxRuntime.jsx(
10379
+ EllipsisMeasure,
10380
+ {
10381
+ enableMeasure,
10382
+ text: normalizedChildren,
10383
+ width: measureWidth,
10384
+ rows: lineClampLines ?? 1,
10385
+ expanded: false,
10386
+ miscDeps: [truncationClass],
10387
+ onEllipsis: (s) => {
10388
+ console.log("\u{1F680} ~ Truncated ~ s:", s);
10389
+ setIsTruncated(s);
10390
+ },
10391
+ children: () => normalizedChildren
10392
+ }
10393
+ ) });
10161
10394
  let tooltipContent = normalizedChildren;
10162
10395
  if (typeof ellipsis === "object") {
10163
10396
  tooltipContent = ellipsis?.content ?? normalizedChildren;
@@ -10197,7 +10430,7 @@ var Truncated = ({
10197
10430
  );
10198
10431
  };
10199
10432
  var truncated_default = Truncated;
10200
- var InputPrimitive2 = React4__namespace.forwardRef(
10433
+ var InputPrimitive2 = React26__namespace.forwardRef(
10201
10434
  ({ className, type = "text", ...props }, ref) => {
10202
10435
  return /* @__PURE__ */ jsxRuntime.jsx(
10203
10436
  "input",
@@ -10236,7 +10469,7 @@ var inputVariants2 = classVarianceAuthority.cva("", {
10236
10469
  appearance: "filled"
10237
10470
  }
10238
10471
  });
10239
- var Input2 = React4__namespace.forwardRef(
10472
+ var Input2 = React26__namespace.forwardRef(
10240
10473
  ({
10241
10474
  className,
10242
10475
  wrapperClassName,
@@ -10269,8 +10502,8 @@ var Input2 = React4__namespace.forwardRef(
10269
10502
  onChange: onChangeProp
10270
10503
  } = rest;
10271
10504
  const ariaInvalid = invalid ?? ariaInvalidProp;
10272
- const messageId = React4__namespace.useId();
10273
- const handleChange = React4__namespace.useCallback(
10505
+ const messageId = React26__namespace.useId();
10506
+ const handleChange = React26__namespace.useCallback(
10274
10507
  (event) => {
10275
10508
  onChangeProp?.(event);
10276
10509
  onValueChange?.(event.target.value);
@@ -10398,8 +10631,8 @@ var ActionMenu = ({
10398
10631
  actionButtonClassName,
10399
10632
  separatorClassName
10400
10633
  }) => {
10401
- const [open, setOpen] = React4.useState(false);
10402
- const isAllowed = React4.useCallback(
10634
+ const [open, setOpen] = React26.useState(false);
10635
+ const isAllowed = React26.useCallback(
10403
10636
  (requiredPermission) => {
10404
10637
  if (!checkPermissionFunc || requiredPermission === void 0) {
10405
10638
  return true;
@@ -10408,7 +10641,7 @@ var ActionMenu = ({
10408
10641
  },
10409
10642
  [checkPermissionFunc]
10410
10643
  );
10411
- const filteredButtons = React4.useMemo(() => {
10644
+ const filteredButtons = React26.useMemo(() => {
10412
10645
  return buttons.filter((btn) => isAllowed(btn.requiredPermission));
10413
10646
  }, [buttons, isAllowed]);
10414
10647
  if (buttons.length === 0) {
@@ -10663,13 +10896,13 @@ var useFieldNames = ({
10663
10896
  fieldNames
10664
10897
  }) => {
10665
10898
  const { label: labelFieldKey = "label", value: valueFieldKey = "value" } = fieldNames || {};
10666
- const getLabelField = React4__namespace.default.useCallback(
10899
+ const getLabelField = React26__namespace.default.useCallback(
10667
10900
  (option) => {
10668
10901
  return option?.[labelFieldKey];
10669
10902
  },
10670
10903
  [labelFieldKey]
10671
10904
  );
10672
- const getValueField = React4__namespace.default.useCallback(
10905
+ const getValueField = React26__namespace.default.useCallback(
10673
10906
  (option) => {
10674
10907
  return option?.[valueFieldKey];
10675
10908
  },
@@ -10690,7 +10923,7 @@ var VirtualizedCommand = ({
10690
10923
  emptyContent = "No data.",
10691
10924
  searchPlaceholder,
10692
10925
  value,
10693
- notFoundContent = "Not item found.",
10926
+ notFoundContent = "No item found.",
10694
10927
  showSearch = true,
10695
10928
  fieldNames,
10696
10929
  disabledOption,
@@ -10701,11 +10934,11 @@ var VirtualizedCommand = ({
10701
10934
  onFocus
10702
10935
  }) => {
10703
10936
  const { getLabelField, getValueField } = useFieldNames_default({ fieldNames });
10704
- const internalOptions = React4__namespace.useMemo(() => options ?? [], [options]);
10705
- const [filteredOptions, setFilteredOptions] = React4__namespace.useState(internalOptions);
10706
- const [focusedIndex, setFocusedIndex] = React4__namespace.useState(0);
10707
- const [isKeyboardNavActive, setIsKeyboardNavActive] = React4__namespace.useState(false);
10708
- const parentRef = React4__namespace.useRef(null);
10937
+ const internalOptions = React26__namespace.useMemo(() => options ?? [], [options]);
10938
+ const [filteredOptions, setFilteredOptions] = React26__namespace.useState(internalOptions);
10939
+ const [focusedIndex, setFocusedIndex] = React26__namespace.useState(0);
10940
+ const [isKeyboardNavActive, setIsKeyboardNavActive] = React26__namespace.useState(false);
10941
+ const parentRef = React26__namespace.useRef(null);
10709
10942
  const virtualizer = reactVirtual.useVirtualizer({
10710
10943
  count: filteredOptions.length,
10711
10944
  getScrollElement: () => parentRef.current,
@@ -10713,14 +10946,14 @@ var VirtualizedCommand = ({
10713
10946
  overscan: 2
10714
10947
  });
10715
10948
  const virtualOptions = virtualizer.getVirtualItems();
10716
- const dynamicHeight = React4__namespace.useMemo(() => {
10949
+ const dynamicHeight = React26__namespace.useMemo(() => {
10717
10950
  const contentHeight = filteredOptions.length * ROW_HEIGHT;
10718
10951
  if (contentHeight <= 0) {
10719
10952
  return MIN_HEIGHT_EMPTY;
10720
10953
  }
10721
10954
  return Math.max(ROW_HEIGHT, Math.min(height, contentHeight));
10722
10955
  }, [filteredOptions.length, height]);
10723
- const scrollToIndex = React4__namespace.useCallback(
10956
+ const scrollToIndex = React26__namespace.useCallback(
10724
10957
  (index) => {
10725
10958
  virtualizer.scrollToIndex(index, {
10726
10959
  align: "center"
@@ -10728,7 +10961,7 @@ var VirtualizedCommand = ({
10728
10961
  },
10729
10962
  [virtualizer]
10730
10963
  );
10731
- const handleSearch = React4__namespace.useCallback(
10964
+ const handleSearch = React26__namespace.useCallback(
10732
10965
  (search) => {
10733
10966
  setIsKeyboardNavActive(false);
10734
10967
  setFilteredOptions(
@@ -10743,7 +10976,7 @@ var VirtualizedCommand = ({
10743
10976
  },
10744
10977
  [filterOption, getLabelField, internalOptions]
10745
10978
  );
10746
- const handleKeyDown = React4__namespace.useCallback(
10979
+ const handleKeyDown = React26__namespace.useCallback(
10747
10980
  (event) => {
10748
10981
  switch (event.key) {
10749
10982
  case "ArrowDown": {
@@ -10778,7 +11011,7 @@ var VirtualizedCommand = ({
10778
11011
  },
10779
11012
  [filteredOptions, focusedIndex, getValueField, onSelect, scrollToIndex]
10780
11013
  );
10781
- React4__namespace.useEffect(() => {
11014
+ React26__namespace.useEffect(() => {
10782
11015
  if (value) {
10783
11016
  const option = filteredOptions.find((option2) => {
10784
11017
  const optionValue = getValueField(option2);
@@ -10892,21 +11125,21 @@ var ComboboxInner = ({
10892
11125
  showSearch,
10893
11126
  ...props
10894
11127
  }, ref) => {
10895
- const { getValueField } = useFieldNames_default({ fieldNames });
10896
- const [open, setOpen] = React4__namespace.useState(false);
11128
+ const { getLabelField, getValueField } = useFieldNames_default({ fieldNames });
11129
+ const [open, setOpen] = React26__namespace.useState(false);
10897
11130
  const { value: selectedValue, updateState: setSelectedValue } = useControllableState_default({
10898
11131
  defaultValue,
10899
11132
  value
10900
11133
  });
10901
- const renderValue = React4__namespace.useMemo(() => {
11134
+ const renderValue = React26__namespace.useMemo(() => {
10902
11135
  if (!selectedValue) return placeholder2;
10903
11136
  const selectedOptionFound = options?.find((option) => {
10904
11137
  const optionValue = getValueField(option);
10905
11138
  return optionValue === selectedValue;
10906
11139
  });
10907
- return selectedOptionFound ? getValueField(selectedOptionFound) : null;
10908
- }, [getValueField, options, placeholder2, selectedValue]);
10909
- const handleSelect = React4__namespace.useCallback(
11140
+ return selectedOptionFound ? getLabelField(selectedOptionFound) : null;
11141
+ }, [getLabelField, getValueField, options, placeholder2, selectedValue]);
11142
+ const handleSelect = React26__namespace.useCallback(
10910
11143
  (selected, option) => {
10911
11144
  setSelectedValue(selected);
10912
11145
  setOpen(false);
@@ -10916,7 +11149,7 @@ var ComboboxInner = ({
10916
11149
  },
10917
11150
  [onSelect, setSelectedValue]
10918
11151
  );
10919
- const handleClear = React4__namespace.useCallback(
11152
+ const handleClear = React26__namespace.useCallback(
10920
11153
  (event) => {
10921
11154
  event.stopPropagation();
10922
11155
  setSelectedValue(void 0);
@@ -10933,9 +11166,11 @@ var ComboboxInner = ({
10933
11166
  role: "combobox",
10934
11167
  "aria-expanded": open,
10935
11168
  className: cn(
10936
- "flex w-full 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",
10937
- "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 aria-invalid:border-destructive disabled:cursor-not-allowed disabled:opacity-50",
10938
- "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
11169
+ "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",
11170
+ "disabled:cursor-not-allowed disabled:opacity-50",
11171
+ "focus-visible:border-ring focus-visible:ring-ring/50",
11172
+ "aria-invalid:ring-destructive/20 aria-invalid:border-destructive",
11173
+ "data-[state=open]:border-ring",
10939
11174
  "transition-all",
10940
11175
  className
10941
11176
  ),
@@ -11000,7 +11235,7 @@ var ComboboxInner = ({
11000
11235
  )
11001
11236
  ] });
11002
11237
  };
11003
- var Combobox = React4__namespace.forwardRef(ComboboxInner);
11238
+ var Combobox = React26__namespace.forwardRef(ComboboxInner);
11004
11239
  var Combobox_default = Combobox;
11005
11240
 
11006
11241
  exports.Accordion = Accordion;
@@ -11171,6 +11406,7 @@ exports.useFormField = useFormField;
11171
11406
  exports.useGridSettingsStore = useGridSettingsStore_default;
11172
11407
  exports.useHover = useHover_default;
11173
11408
  exports.useIntersectionObserver = useIntersectionObserver_default;
11409
+ exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
11174
11410
  exports.useMediaQuery = useMediaQuery_default;
11175
11411
  exports.usePreventPageLeave = usePreventPageLeave_default;
11176
11412
  exports.usePreventPageLeaveStore = usePreventPageLeaveStore_default;