@sustaina/shared-ui 1.40.4 → 1.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var React25 = require('react');
3
+ var React27 = require('react');
4
4
  var reactRouter = require('@tanstack/react-router');
5
5
  var zustand = require('zustand');
6
6
  var clsx2 = require('clsx');
@@ -19,6 +19,7 @@ var PopoverPrimitive = require('@radix-ui/react-popover');
19
19
  var CheckboxPrimitive = require('@radix-ui/react-checkbox');
20
20
  var CollapsiblePrimitive = require('@radix-ui/react-collapsible');
21
21
  var reactTable = require('@tanstack/react-table');
22
+ var reactVirtual = require('@tanstack/react-virtual');
22
23
  var SheetPrimitive = require('@radix-ui/react-dialog');
23
24
  var reactI18next = require('react-i18next');
24
25
  var i18n = require('i18next');
@@ -61,7 +62,6 @@ var zod = require('zod');
61
62
  var Cropper = require('react-easy-crop');
62
63
  var reactNumberFormat = require('react-number-format');
63
64
  var cmdk = require('cmdk');
64
- var reactVirtual = require('@tanstack/react-virtual');
65
65
 
66
66
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
67
67
 
@@ -83,7 +83,7 @@ function _interopNamespace(e) {
83
83
  return Object.freeze(n);
84
84
  }
85
85
 
86
- var React25__namespace = /*#__PURE__*/_interopNamespace(React25);
86
+ var React27__namespace = /*#__PURE__*/_interopNamespace(React27);
87
87
  var clsx2__default = /*#__PURE__*/_interopDefault(clsx2);
88
88
  var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
89
89
  var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
@@ -273,12 +273,12 @@ function useSafeBlocker({
273
273
  withResolver = false
274
274
  }) {
275
275
  const router = reactRouter.useRouter({ warn: false });
276
- const [resolver, setResolver] = React25.useState({
276
+ const [resolver, setResolver] = React27.useState({
277
277
  status: "idle",
278
278
  proceed: void 0,
279
279
  reset: void 0
280
280
  });
281
- React25.useEffect(() => {
281
+ React27.useEffect(() => {
282
282
  if (disabled || !router?.history?.block) {
283
283
  return;
284
284
  }
@@ -308,7 +308,7 @@ function useSafeBlocker({
308
308
  }
309
309
  });
310
310
  }, [disabled, enableBeforeUnload, router, shouldBlockFn, withResolver]);
311
- React25.useEffect(() => {
311
+ React27.useEffect(() => {
312
312
  if (disabled || router?.history || typeof window === "undefined") {
313
313
  return;
314
314
  }
@@ -2159,7 +2159,7 @@ function AccordionContent({
2159
2159
  );
2160
2160
  }
2161
2161
  var ExpandCollapse = ({ title, children, portalId }) => {
2162
- const [isOpen, setIsOpen] = React25.useState(false);
2162
+ const [isOpen, setIsOpen] = React27.useState(false);
2163
2163
  const Panel = /* @__PURE__ */ jsxRuntime.jsx(
2164
2164
  "div",
2165
2165
  {
@@ -2269,31 +2269,31 @@ function makeNewRow(field) {
2269
2269
  };
2270
2270
  }
2271
2271
  function useAdvanceSearch({ fields, limitRows }) {
2272
- const [rows, setRows] = React25.useState([makeNewRow(fields[0])]);
2273
- const updateRows = React25.useCallback((next) => {
2272
+ const [rows, setRows] = React27.useState([makeNewRow(fields[0])]);
2273
+ const updateRows = React27.useCallback((next) => {
2274
2274
  setRows(next);
2275
2275
  }, []);
2276
- const operatorsForField = React25.useCallback(
2276
+ const operatorsForField = React27.useCallback(
2277
2277
  (fieldName) => {
2278
2278
  const t = getFieldType(fields, fieldName);
2279
2279
  return OPERATOR_MAP[t];
2280
2280
  },
2281
2281
  [fields]
2282
2282
  );
2283
- const addRow = React25.useCallback(() => {
2283
+ const addRow = React27.useCallback(() => {
2284
2284
  if (limitRows && rows.length >= limitRows) return;
2285
2285
  const lastRow = rows[rows.length - 1];
2286
2286
  const lastField = fields.find((f) => f.name === lastRow?.fieldName) ?? fields[0];
2287
2287
  updateRows([...rows, makeNewRow(lastField)]);
2288
2288
  }, [rows, fields, updateRows, limitRows]);
2289
- const removeRow = React25.useCallback(
2289
+ const removeRow = React27.useCallback(
2290
2290
  (id) => {
2291
2291
  if (rows.length === 1) return;
2292
2292
  updateRows(rows.filter((r) => r.id !== id));
2293
2293
  },
2294
2294
  [rows, updateRows]
2295
2295
  );
2296
- const clearRow = React25.useCallback(
2296
+ const clearRow = React27.useCallback(
2297
2297
  (id) => {
2298
2298
  updateRows(
2299
2299
  rows.map((r) => {
@@ -2326,10 +2326,10 @@ function useAdvanceSearch({ fields, limitRows }) {
2326
2326
  },
2327
2327
  [rows, fields, updateRows]
2328
2328
  );
2329
- const clearAllRow = React25.useCallback(() => {
2329
+ const clearAllRow = React27.useCallback(() => {
2330
2330
  updateRows([makeNewRow(fields[0])]);
2331
2331
  }, [fields, updateRows]);
2332
- const changeField = React25.useCallback(
2332
+ const changeField = React27.useCallback(
2333
2333
  (id, fieldName) => {
2334
2334
  updateRows(
2335
2335
  rows.map((r) => {
@@ -2341,7 +2341,7 @@ function useAdvanceSearch({ fields, limitRows }) {
2341
2341
  },
2342
2342
  [rows, fields, updateRows]
2343
2343
  );
2344
- const changeOperator = React25.useCallback(
2344
+ const changeOperator = React27.useCallback(
2345
2345
  (id, operator) => {
2346
2346
  updateRows(
2347
2347
  rows.map((r) => {
@@ -2375,7 +2375,7 @@ function useAdvanceSearch({ fields, limitRows }) {
2375
2375
  },
2376
2376
  [rows, updateRows]
2377
2377
  );
2378
- const changeValue = React25.useCallback(
2378
+ const changeValue = React27.useCallback(
2379
2379
  (id, which, val) => {
2380
2380
  updateRows(
2381
2381
  rows.map((r) => {
@@ -2387,7 +2387,7 @@ function useAdvanceSearch({ fields, limitRows }) {
2387
2387
  },
2388
2388
  [rows, updateRows]
2389
2389
  );
2390
- const fieldOptions = React25.useMemo(
2390
+ const fieldOptions = React27.useMemo(
2391
2391
  () => fields.map((f) => ({
2392
2392
  value: f.name,
2393
2393
  label: f.label ?? f.name
@@ -2582,7 +2582,7 @@ var OPERATOR_LABEL = {
2582
2582
  containsAll: "Contains all of"
2583
2583
  };
2584
2584
  var OperatorSelect = ({ row, operators, onChangeOperator, error }) => {
2585
- React25__namespace.default.useEffect(() => {
2585
+ React27__namespace.default.useEffect(() => {
2586
2586
  if (!operators.length) return;
2587
2587
  if (!operators.includes(row.operator)) {
2588
2588
  onChangeOperator(operators[0]);
@@ -2618,15 +2618,15 @@ function Label2({ className, ...props }) {
2618
2618
  );
2619
2619
  }
2620
2620
  var Form = reactHookForm.FormProvider;
2621
- var FormFieldContext = React25__namespace.createContext({});
2621
+ var FormFieldContext = React27__namespace.createContext({});
2622
2622
  var FormField = ({
2623
2623
  ...props
2624
2624
  }) => {
2625
2625
  return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
2626
2626
  };
2627
2627
  var useFormField = () => {
2628
- const fieldContext = React25__namespace.useContext(FormFieldContext);
2629
- const itemContext = React25__namespace.useContext(FormItemContext);
2628
+ const fieldContext = React27__namespace.useContext(FormFieldContext);
2629
+ const itemContext = React27__namespace.useContext(FormItemContext);
2630
2630
  const { getFieldState } = reactHookForm.useFormContext();
2631
2631
  const formState = reactHookForm.useFormState({ name: fieldContext.name });
2632
2632
  const fieldState = getFieldState(fieldContext.name, formState);
@@ -2643,9 +2643,9 @@ var useFormField = () => {
2643
2643
  ...fieldState
2644
2644
  };
2645
2645
  };
2646
- var FormItemContext = React25__namespace.createContext({});
2646
+ var FormItemContext = React27__namespace.createContext({});
2647
2647
  function FormItem({ className, ...props }) {
2648
- const id = React25__namespace.useId();
2648
+ const id = React27__namespace.useId();
2649
2649
  return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
2650
2650
  }
2651
2651
  function FormLabel({ className, ...props }) {
@@ -2749,7 +2749,7 @@ var Spinner = ({ className, variant, size = "default", ...props }) => /* @__PURE
2749
2749
  ]
2750
2750
  }
2751
2751
  );
2752
- var InputPrimitive = React25__namespace.forwardRef(
2752
+ var InputPrimitive = React27__namespace.forwardRef(
2753
2753
  ({ className, type = "text", ...props }, ref) => {
2754
2754
  return /* @__PURE__ */ jsxRuntime.jsx(
2755
2755
  "input",
@@ -2788,7 +2788,7 @@ var inputVariants = classVarianceAuthority.cva("", {
2788
2788
  appearance: "filled"
2789
2789
  }
2790
2790
  });
2791
- var Input = React25__namespace.forwardRef(
2791
+ var Input = React27__namespace.forwardRef(
2792
2792
  ({
2793
2793
  className,
2794
2794
  wrapperClassName,
@@ -2821,8 +2821,8 @@ var Input = React25__namespace.forwardRef(
2821
2821
  onChange: onChangeProp
2822
2822
  } = rest;
2823
2823
  const ariaInvalid = invalid ?? ariaInvalidProp;
2824
- const messageId = React25__namespace.useId();
2825
- const handleChange = React25__namespace.useCallback(
2824
+ const messageId = React27__namespace.useId();
2825
+ const handleChange = React27__namespace.useCallback(
2826
2826
  (event) => {
2827
2827
  onChangeProp?.(event);
2828
2828
  onValueChange?.(event.target.value);
@@ -3210,20 +3210,20 @@ function DatePicker({
3210
3210
  className,
3211
3211
  ...props
3212
3212
  }) {
3213
- const today = React25__namespace.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
3214
- const [displayed, setDisplayed] = React25__namespace.useState(
3213
+ const today = React27__namespace.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
3214
+ const [displayed, setDisplayed] = React27__namespace.useState(
3215
3215
  selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
3216
3216
  );
3217
3217
  minDate = clampToDay(minDate);
3218
3218
  maxDate = clampToDay(maxDate);
3219
- const disabledSet = React25__namespace.useMemo(() => {
3219
+ const disabledSet = React27__namespace.useMemo(() => {
3220
3220
  const s = /* @__PURE__ */ new Set();
3221
3221
  disabledDates?.forEach((d) => s.add(startOfDay(d).toISOString()));
3222
3222
  return s;
3223
3223
  }, [disabledDates]);
3224
3224
  const displayYear = displayed.getFullYear();
3225
3225
  const displayMonth = displayed.getMonth();
3226
- const weekdays = React25__namespace.useMemo(() => {
3226
+ const weekdays = React27__namespace.useMemo(() => {
3227
3227
  const labels = [];
3228
3228
  for (let i = 0; i < 7; i++) {
3229
3229
  const idx = i;
@@ -3232,7 +3232,7 @@ function DatePicker({
3232
3232
  }
3233
3233
  return labels;
3234
3234
  }, [callbacks]);
3235
- const grid = React25__namespace.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
3235
+ const grid = React27__namespace.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
3236
3236
  const isDateDisabled = (date) => {
3237
3237
  const d = startOfDay(date);
3238
3238
  if (minDate && d < minDate) return true;
@@ -3242,7 +3242,7 @@ function DatePicker({
3242
3242
  };
3243
3243
  const minYear = minDate?.getFullYear();
3244
3244
  const maxYear = maxDate?.getFullYear();
3245
- const getMonthLabel = React25__namespace.useCallback(
3245
+ const getMonthLabel = React27__namespace.useCallback(
3246
3246
  (year, monthIndex) => {
3247
3247
  const label = callbacks?.monthLabel?.(year, monthIndex);
3248
3248
  if (label === null || label === void 0) {
@@ -3252,7 +3252,7 @@ function DatePicker({
3252
3252
  },
3253
3253
  [callbacks]
3254
3254
  );
3255
- const getYearLabel = React25__namespace.useCallback(
3255
+ const getYearLabel = React27__namespace.useCallback(
3256
3256
  (year) => {
3257
3257
  const label = callbacks?.yearLabel?.(year);
3258
3258
  if (label === null || label === void 0) return String(year);
@@ -3260,7 +3260,7 @@ function DatePicker({
3260
3260
  },
3261
3261
  [callbacks]
3262
3262
  );
3263
- const clampMonthToBounds = React25__namespace.useCallback(
3263
+ const clampMonthToBounds = React27__namespace.useCallback(
3264
3264
  (year, monthIndex) => {
3265
3265
  let output = monthIndex;
3266
3266
  if (typeof minYear === "number" && year === minYear && minDate) {
@@ -3275,7 +3275,7 @@ function DatePicker({
3275
3275
  },
3276
3276
  [maxDate, minDate, maxYear, minYear]
3277
3277
  );
3278
- const yearOptions = React25__namespace.useMemo(() => {
3278
+ const yearOptions = React27__namespace.useMemo(() => {
3279
3279
  const fallbackWindow = 50;
3280
3280
  const start = typeof minYear === "number" ? minYear : displayYear - fallbackWindow;
3281
3281
  const end = typeof maxYear === "number" ? maxYear : displayYear + fallbackWindow;
@@ -3296,7 +3296,7 @@ function DatePicker({
3296
3296
  }
3297
3297
  return years;
3298
3298
  }, [displayYear, maxYear, minYear, selectedDate]);
3299
- const monthOptions = React25__namespace.useMemo(() => {
3299
+ const monthOptions = React27__namespace.useMemo(() => {
3300
3300
  const months = Array.from({ length: 12 }, (_, monthIndex) => {
3301
3301
  const disabled = typeof minYear === "number" && displayYear === minYear && minDate && monthIndex < minDate.getMonth() || typeof maxYear === "number" && displayYear === maxYear && maxDate && monthIndex > maxDate.getMonth();
3302
3302
  return {
@@ -3315,7 +3315,7 @@ function DatePicker({
3315
3315
  }
3316
3316
  return months.sort((a, b) => a.value - b.value).filter((option, index, arr) => index === 0 || option.value !== arr[index - 1].value);
3317
3317
  }, [displayMonth, displayYear, getMonthLabel, maxDate, maxYear, minDate, minYear]);
3318
- const handleMonthSelect = React25__namespace.useCallback((nextValue) => {
3318
+ const handleMonthSelect = React27__namespace.useCallback((nextValue) => {
3319
3319
  const nextMonth = Number.parseInt(nextValue, 10);
3320
3320
  if (Number.isNaN(nextMonth)) return;
3321
3321
  setDisplayed((prev) => {
@@ -3325,7 +3325,7 @@ function DatePicker({
3325
3325
  return next;
3326
3326
  });
3327
3327
  }, []);
3328
- const handleYearSelect = React25__namespace.useCallback(
3328
+ const handleYearSelect = React27__namespace.useCallback(
3329
3329
  (nextValue) => {
3330
3330
  const nextYear = Number.parseInt(nextValue, 10);
3331
3331
  if (Number.isNaN(nextYear)) return;
@@ -3473,14 +3473,14 @@ var DatePicker2 = ({
3473
3473
  ariaLabel,
3474
3474
  ...calendarProps
3475
3475
  }) => {
3476
- const [open, setOpen] = React25__namespace.default.useState(false);
3477
- const parser = React25__namespace.default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
3478
- const outputFormatter = React25__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
3479
- const labelFormatter = React25__namespace.default.useMemo(
3476
+ const [open, setOpen] = React27__namespace.default.useState(false);
3477
+ const parser = React27__namespace.default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
3478
+ const outputFormatter = React27__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
3479
+ const labelFormatter = React27__namespace.default.useMemo(
3480
3480
  () => displayFormatter ?? defaultDisplayFormatter,
3481
3481
  [displayFormatter]
3482
3482
  );
3483
- const parsedValue = React25__namespace.default.useMemo(() => {
3483
+ const parsedValue = React27__namespace.default.useMemo(() => {
3484
3484
  if (value === null || value === void 0) return void 0;
3485
3485
  if (value instanceof Date) return value;
3486
3486
  const parsed = parser(value);
@@ -3489,26 +3489,26 @@ var DatePicker2 = ({
3489
3489
  const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
3490
3490
  const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change date, current selection ${labelFormatter(parsedValue)}` : "Open date picker");
3491
3491
  const shouldShowClear = allowClear && !disabled && !!parsedValue;
3492
- const handleClose = React25__namespace.default.useCallback(() => setOpen(false), []);
3493
- const emitChange = React25__namespace.default.useCallback(
3492
+ const handleClose = React27__namespace.default.useCallback(() => setOpen(false), []);
3493
+ const emitChange = React27__namespace.default.useCallback(
3494
3494
  (next) => {
3495
3495
  onChange?.(next);
3496
3496
  onValueChange?.(next ? outputFormatter(next) : void 0);
3497
3497
  },
3498
3498
  [onChange, onValueChange, outputFormatter]
3499
3499
  );
3500
- const handleSelect = React25__namespace.default.useCallback(
3500
+ const handleSelect = React27__namespace.default.useCallback(
3501
3501
  (next) => {
3502
3502
  emitChange(next);
3503
3503
  if (closeOnSelect && next) handleClose();
3504
3504
  },
3505
3505
  [closeOnSelect, emitChange, handleClose]
3506
3506
  );
3507
- const handleClear = React25__namespace.default.useCallback(() => {
3507
+ const handleClear = React27__namespace.default.useCallback(() => {
3508
3508
  emitChange(void 0);
3509
3509
  handleClose();
3510
3510
  }, [emitChange, handleClose]);
3511
- const handleOpenChange = React25__namespace.default.useCallback(
3511
+ const handleOpenChange = React27__namespace.default.useCallback(
3512
3512
  (nextOpen) => {
3513
3513
  if (disabled && nextOpen) return;
3514
3514
  setOpen(nextOpen);
@@ -3698,15 +3698,15 @@ function MonthCal({
3698
3698
  onYearBackward,
3699
3699
  onYearForward
3700
3700
  }) {
3701
- const today = React25__namespace.useMemo(() => {
3701
+ const today = React27__namespace.useMemo(() => {
3702
3702
  const now = /* @__PURE__ */ new Date();
3703
3703
  now.setDate(1);
3704
3704
  now.setHours(0, 0, 0, 0);
3705
3705
  return now;
3706
3706
  }, []);
3707
- const selectedMonthDate = React25__namespace.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
3708
- const min = React25__namespace.useMemo(() => normalizeMonth(minDate), [minDate]);
3709
- const max = React25__namespace.useMemo(() => normalizeMonth(maxDate), [maxDate]);
3707
+ const selectedMonthDate = React27__namespace.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
3708
+ const min = React27__namespace.useMemo(() => normalizeMonth(minDate), [minDate]);
3709
+ const max = React27__namespace.useMemo(() => normalizeMonth(maxDate), [maxDate]);
3710
3710
  let effectiveMin = min;
3711
3711
  if (min && max && min > max) {
3712
3712
  effectiveMin = max;
@@ -3715,10 +3715,10 @@ function MonthCal({
3715
3715
  const minMonth = effectiveMin?.getMonth();
3716
3716
  const maxYear = max?.getFullYear();
3717
3717
  const maxMonth = max?.getMonth();
3718
- const [menuYear, setMenuYear] = React25__namespace.useState(
3718
+ const [menuYear, setMenuYear] = React27__namespace.useState(
3719
3719
  () => selectedMonthDate?.getFullYear() ?? today.getFullYear()
3720
3720
  );
3721
- React25__namespace.useEffect(() => {
3721
+ React27__namespace.useEffect(() => {
3722
3722
  if (selectedMonthDate) {
3723
3723
  const year = selectedMonthDate.getFullYear();
3724
3724
  if (year !== menuYear) {
@@ -3726,7 +3726,7 @@ function MonthCal({
3726
3726
  }
3727
3727
  }
3728
3728
  }, [selectedMonthDate, menuYear]);
3729
- React25__namespace.useEffect(() => {
3729
+ React27__namespace.useEffect(() => {
3730
3730
  if (typeof minYear === "number" && menuYear < minYear) {
3731
3731
  setMenuYear(minYear);
3732
3732
  return;
@@ -3737,7 +3737,7 @@ function MonthCal({
3737
3737
  }, [minYear, maxYear, menuYear]);
3738
3738
  const disablePrevYear = typeof minYear === "number" ? menuYear <= minYear : false;
3739
3739
  const disableNextYear = typeof maxYear === "number" ? menuYear >= maxYear : false;
3740
- const yearOptions = React25__namespace.useMemo(() => {
3740
+ const yearOptions = React27__namespace.useMemo(() => {
3741
3741
  const fallbackWindow = 50;
3742
3742
  const start = typeof minYear === "number" ? minYear : menuYear - fallbackWindow;
3743
3743
  const end = typeof maxYear === "number" ? maxYear : menuYear + fallbackWindow;
@@ -3751,7 +3751,7 @@ function MonthCal({
3751
3751
  }
3752
3752
  return years;
3753
3753
  }, [maxYear, menuYear, minYear]);
3754
- const formatYearLabel = React25__namespace.useCallback(
3754
+ const formatYearLabel = React27__namespace.useCallback(
3755
3755
  (year) => {
3756
3756
  const raw = callbacks?.yearLabel?.(year);
3757
3757
  if (raw === null || raw === void 0) return String(year);
@@ -3759,7 +3759,7 @@ function MonthCal({
3759
3759
  },
3760
3760
  [callbacks]
3761
3761
  );
3762
- const handleYearSelect = React25__namespace.useCallback(
3762
+ const handleYearSelect = React27__namespace.useCallback(
3763
3763
  (nextValue) => {
3764
3764
  const nextYear = Number.parseInt(nextValue, 10);
3765
3765
  if (Number.isNaN(nextYear)) return;
@@ -3769,7 +3769,7 @@ function MonthCal({
3769
3769
  },
3770
3770
  [maxYear, minYear]
3771
3771
  );
3772
- const disabledPairs = React25__namespace.useMemo(() => {
3772
+ const disabledPairs = React27__namespace.useMemo(() => {
3773
3773
  if (!disabledDates?.length) return [];
3774
3774
  const pairs = [];
3775
3775
  disabledDates.forEach((date) => {
@@ -3914,14 +3914,14 @@ var MonthPicker2 = ({
3914
3914
  ariaLabel,
3915
3915
  ...calendarProps
3916
3916
  }) => {
3917
- const [open, setOpen] = React25__namespace.default.useState(false);
3918
- const parser = React25__namespace.default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
3919
- const outputFormatter = React25__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
3920
- const labelFormatter = React25__namespace.default.useMemo(
3917
+ const [open, setOpen] = React27__namespace.default.useState(false);
3918
+ const parser = React27__namespace.default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
3919
+ const outputFormatter = React27__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
3920
+ const labelFormatter = React27__namespace.default.useMemo(
3921
3921
  () => displayFormatter ?? defaultDisplayFormatter2,
3922
3922
  [displayFormatter]
3923
3923
  );
3924
- const parsedValue = React25__namespace.default.useMemo(() => {
3924
+ const parsedValue = React27__namespace.default.useMemo(() => {
3925
3925
  if (value === null || value === void 0) return void 0;
3926
3926
  if (value instanceof Date) return normalizeMonth2(value);
3927
3927
  if (typeof value === "string") {
@@ -3933,8 +3933,8 @@ var MonthPicker2 = ({
3933
3933
  const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
3934
3934
  const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change month, current selection ${labelFormatter(parsedValue)}` : "Open month picker");
3935
3935
  const shouldShowClear = allowClear && !disabled && !!parsedValue;
3936
- const handleClose = React25__namespace.default.useCallback(() => setOpen(false), []);
3937
- const emitChange = React25__namespace.default.useCallback(
3936
+ const handleClose = React27__namespace.default.useCallback(() => setOpen(false), []);
3937
+ const emitChange = React27__namespace.default.useCallback(
3938
3938
  (next) => {
3939
3939
  const normalized = next ? normalizeMonth2(next) : void 0;
3940
3940
  onChange?.(normalized);
@@ -3942,18 +3942,18 @@ var MonthPicker2 = ({
3942
3942
  },
3943
3943
  [onChange, onValueChange, outputFormatter]
3944
3944
  );
3945
- const handleSelect = React25__namespace.default.useCallback(
3945
+ const handleSelect = React27__namespace.default.useCallback(
3946
3946
  (next) => {
3947
3947
  emitChange(next);
3948
3948
  if (closeOnSelect && next) handleClose();
3949
3949
  },
3950
3950
  [closeOnSelect, emitChange, handleClose]
3951
3951
  );
3952
- const handleClear = React25__namespace.default.useCallback(() => {
3952
+ const handleClear = React27__namespace.default.useCallback(() => {
3953
3953
  emitChange(void 0);
3954
3954
  handleClose();
3955
3955
  }, [emitChange, handleClose]);
3956
- const handleOpenChange = React25__namespace.default.useCallback(
3956
+ const handleOpenChange = React27__namespace.default.useCallback(
3957
3957
  (nextOpen) => {
3958
3958
  if (disabled && nextOpen) return;
3959
3959
  setOpen(nextOpen);
@@ -4164,24 +4164,24 @@ var LookupSelect = ({
4164
4164
  dropdownPortalId,
4165
4165
  multiple = false
4166
4166
  }) => {
4167
- const [inputValue, setInputValue] = React25.useState("");
4168
- const inputRef = React25.useRef(null);
4169
- const [inputFocused, setInputFocused] = React25.useState(false);
4170
- const [suggestions, setSuggestions] = React25.useState([]);
4171
- const [optionLabels, setOptionLabels] = React25.useState({});
4172
- const [loading, setLoading] = React25.useState(false);
4173
- const [fetchError, setFetchError] = React25.useState(null);
4174
- const [isDropdownOpen, setIsDropdownOpen] = React25.useState(false);
4175
- const containerRef = React25.useRef(null);
4176
- const fetchDelayRef = React25.useRef(null);
4177
- const requestIdRef = React25.useRef(0);
4178
- const [dropdownStyles, setDropdownStyles] = React25.useState();
4179
- const dropdownContentRef = React25.useRef(null);
4180
- const assignDropdownContentRef = React25.useCallback((node) => {
4167
+ const [inputValue, setInputValue] = React27.useState("");
4168
+ const inputRef = React27.useRef(null);
4169
+ const [inputFocused, setInputFocused] = React27.useState(false);
4170
+ const [suggestions, setSuggestions] = React27.useState([]);
4171
+ const [optionLabels, setOptionLabels] = React27.useState({});
4172
+ const [loading, setLoading] = React27.useState(false);
4173
+ const [fetchError, setFetchError] = React27.useState(null);
4174
+ const [isDropdownOpen, setIsDropdownOpen] = React27.useState(false);
4175
+ const containerRef = React27.useRef(null);
4176
+ const fetchDelayRef = React27.useRef(null);
4177
+ const requestIdRef = React27.useRef(0);
4178
+ const [dropdownStyles, setDropdownStyles] = React27.useState();
4179
+ const dropdownContentRef = React27.useRef(null);
4180
+ const assignDropdownContentRef = React27.useCallback((node) => {
4181
4181
  dropdownContentRef.current = node;
4182
4182
  }, []);
4183
- const [activeSuggestionIndex, setActiveSuggestionIndex] = React25.useState(-1);
4184
- const dropdownPortalElement = React25.useMemo(() => {
4183
+ const [activeSuggestionIndex, setActiveSuggestionIndex] = React27.useState(-1);
4184
+ const dropdownPortalElement = React27.useMemo(() => {
4185
4185
  if (typeof document === "undefined") return null;
4186
4186
  if (dropdownPortalId) {
4187
4187
  const element = document.getElementById(dropdownPortalId);
@@ -4192,7 +4192,7 @@ var LookupSelect = ({
4192
4192
  const limitReached = multiple && value.length >= maxTags;
4193
4193
  const selectedValue = !multiple && value.length > 0 ? value[0] : void 0;
4194
4194
  const selectedLabel = selectedValue ? optionLabels[selectedValue] ?? selectedValue : void 0;
4195
- const upsertOptionLabels = React25.useCallback((options) => {
4195
+ const upsertOptionLabels = React27.useCallback((options) => {
4196
4196
  setOptionLabels((prev) => {
4197
4197
  let next = null;
4198
4198
  options.forEach((opt) => {
@@ -4205,7 +4205,7 @@ var LookupSelect = ({
4205
4205
  return next ?? prev;
4206
4206
  });
4207
4207
  }, []);
4208
- const addTag = React25.useCallback(
4208
+ const addTag = React27.useCallback(
4209
4209
  (val) => {
4210
4210
  const trimmed = val.trim();
4211
4211
  if (!trimmed) return;
@@ -4220,7 +4220,7 @@ var LookupSelect = ({
4220
4220
  },
4221
4221
  [value, onChange, maxTags, multiple]
4222
4222
  );
4223
- const removeTag = React25.useCallback(
4223
+ const removeTag = React27.useCallback(
4224
4224
  (index) => {
4225
4225
  if (index < 0) return;
4226
4226
  const newTags = value.filter((_, i) => i !== index);
@@ -4230,7 +4230,7 @@ var LookupSelect = ({
4230
4230
  },
4231
4231
  [value, onChange]
4232
4232
  );
4233
- const handleClear = React25.useCallback(() => {
4233
+ const handleClear = React27.useCallback(() => {
4234
4234
  setInputValue("");
4235
4235
  setSuggestions([]);
4236
4236
  setInputFocused(false);
@@ -4238,7 +4238,7 @@ var LookupSelect = ({
4238
4238
  setFetchError(null);
4239
4239
  if (onClear) onClear();
4240
4240
  }, [onClear]);
4241
- const handleSuggestionSelect = React25.useCallback(
4241
+ const handleSuggestionSelect = React27.useCallback(
4242
4242
  (option) => {
4243
4243
  upsertOptionLabels([option]);
4244
4244
  addTag(option.value);
@@ -4256,7 +4256,7 @@ var LookupSelect = ({
4256
4256
  },
4257
4257
  [addTag, multiple, upsertOptionLabels]
4258
4258
  );
4259
- const handleKeyDown = React25.useCallback(
4259
+ const handleKeyDown = React27.useCallback(
4260
4260
  (e) => {
4261
4261
  if (e.key === "ArrowDown" && suggestions.length > 0) {
4262
4262
  e.preventDefault();
@@ -4283,7 +4283,7 @@ var LookupSelect = ({
4283
4283
  },
4284
4284
  [suggestions, activeSuggestionIndex, handleSuggestionSelect, inputValue, removeTag, value.length]
4285
4285
  );
4286
- const updateDropdownPosition = React25.useCallback(() => {
4286
+ const updateDropdownPosition = React27.useCallback(() => {
4287
4287
  if (!dropdownPortalElement || !containerRef.current) return;
4288
4288
  const rect = containerRef.current.getBoundingClientRect();
4289
4289
  setDropdownStyles({
@@ -4294,7 +4294,7 @@ var LookupSelect = ({
4294
4294
  zIndex: 50
4295
4295
  });
4296
4296
  }, [dropdownPortalElement]);
4297
- React25.useEffect(() => {
4297
+ React27.useEffect(() => {
4298
4298
  if (!fetchSuggestions || !inputFocused) return;
4299
4299
  if (fetchDelayRef.current) {
4300
4300
  clearTimeout(fetchDelayRef.current);
@@ -4328,7 +4328,7 @@ var LookupSelect = ({
4328
4328
  }
4329
4329
  };
4330
4330
  }, [inputValue, fetchSuggestions, suggestionDebounce, upsertOptionLabels, inputFocused]);
4331
- React25.useEffect(() => {
4331
+ React27.useEffect(() => {
4332
4332
  if (!fetchSuggestions) return;
4333
4333
  if (value.length === 0) return;
4334
4334
  const unresolvedValues = value.filter((v) => !optionLabels[v]);
@@ -4338,7 +4338,7 @@ var LookupSelect = ({
4338
4338
  }).catch(() => {
4339
4339
  });
4340
4340
  }, [value, fetchSuggestions, optionLabels, upsertOptionLabels]);
4341
- React25.useEffect(() => {
4341
+ React27.useEffect(() => {
4342
4342
  const handleDocumentClick = (event) => {
4343
4343
  const target = event.target;
4344
4344
  if (containerRef.current?.contains(target)) return;
@@ -4351,11 +4351,11 @@ var LookupSelect = ({
4351
4351
  document.removeEventListener("mousedown", handleDocumentClick);
4352
4352
  };
4353
4353
  }, []);
4354
- React25.useEffect(() => {
4354
+ React27.useEffect(() => {
4355
4355
  if (!limitReached) return;
4356
4356
  setIsDropdownOpen(false);
4357
4357
  }, [limitReached]);
4358
- React25.useEffect(() => {
4358
+ React27.useEffect(() => {
4359
4359
  if (!dropdownPortalElement) return;
4360
4360
  if (!isDropdownOpen) return;
4361
4361
  updateDropdownPosition();
@@ -4367,7 +4367,7 @@ var LookupSelect = ({
4367
4367
  window.removeEventListener("scroll", handleReposition, true);
4368
4368
  };
4369
4369
  }, [dropdownPortalElement, isDropdownOpen, updateDropdownPosition, value]);
4370
- React25.useEffect(() => {
4370
+ React27.useEffect(() => {
4371
4371
  if (suggestions.length === 0) {
4372
4372
  setActiveSuggestionIndex(-1);
4373
4373
  return;
@@ -5209,7 +5209,7 @@ var AdvanceSearch = ({
5209
5209
  shortDateFormat,
5210
5210
  filterFieldMap = FILTER_FIELD_MAP
5211
5211
  }) => {
5212
- const fieldsData = React25.useMemo(() => {
5212
+ const fieldsData = React27.useMemo(() => {
5213
5213
  if (fields.length === 0) throw new Error("fields cannot be an empty array");
5214
5214
  return fields || [];
5215
5215
  }, [fields]);
@@ -5229,8 +5229,8 @@ var AdvanceSearch = ({
5229
5229
  defaultValues: {}
5230
5230
  });
5231
5231
  const { handleSubmit, unregister, resetField, getValues, clearErrors, setError } = form;
5232
- const [operatorErrors, setOperatorErrors] = React25__namespace.default.useState({});
5233
- const clearOperatorError = React25.useCallback(
5232
+ const [operatorErrors, setOperatorErrors] = React27__namespace.default.useState({});
5233
+ const clearOperatorError = React27.useCallback(
5234
5234
  (rowId) => {
5235
5235
  setOperatorErrors((prev) => {
5236
5236
  if (!(rowId in prev)) return prev;
@@ -5240,7 +5240,7 @@ var AdvanceSearch = ({
5240
5240
  },
5241
5241
  [setOperatorErrors]
5242
5242
  );
5243
- const clearValue = React25.useCallback(
5243
+ const clearValue = React27.useCallback(
5244
5244
  (rowId, which) => {
5245
5245
  const fieldName = `${which}_${rowId}`;
5246
5246
  resetField(fieldName, { defaultValue: void 0 });
@@ -5250,14 +5250,14 @@ var AdvanceSearch = ({
5250
5250
  },
5251
5251
  [resetField, clearErrors]
5252
5252
  );
5253
- const parseRangeValue = React25.useCallback((raw, fieldType) => {
5253
+ const parseRangeValue = React27.useCallback((raw, fieldType) => {
5254
5254
  if (!raw) return void 0;
5255
5255
  if (Array.isArray(raw)) return void 0;
5256
5256
  const normalized = fieldType === "datemonth" ? `${raw}-01` : raw;
5257
5257
  const parsed = dateFns.parseISO(normalized);
5258
5258
  return dateFns.isValid(parsed) ? parsed : void 0;
5259
5259
  }, []);
5260
- const onSubmit = React25.useCallback(() => {
5260
+ const onSubmit = React27.useCallback(() => {
5261
5261
  const operatorValidation = {};
5262
5262
  rows.forEach((r) => {
5263
5263
  const ops = operatorsForField(r.fieldName);
@@ -5495,11 +5495,11 @@ function resetVisibleTableState(payload) {
5495
5495
  table.setSorting(prevState.sorting.filter((s) => isVisible(s.id)));
5496
5496
  }
5497
5497
  var useHover = () => {
5498
- const [hovering, setHovering] = React25.useState(false);
5499
- const prevRef = React25.useRef(null);
5500
- const onMouseEnter = React25.useCallback(() => setHovering(true), []);
5501
- const onMouseLeave = React25.useCallback(() => setHovering(false), []);
5502
- const nodeRefCallback = React25.useCallback(
5498
+ const [hovering, setHovering] = React27.useState(false);
5499
+ const prevRef = React27.useRef(null);
5500
+ const onMouseEnter = React27.useCallback(() => setHovering(true), []);
5501
+ const onMouseLeave = React27.useCallback(() => setHovering(false), []);
5502
+ const nodeRefCallback = React27.useCallback(
5503
5503
  (node) => {
5504
5504
  if (prevRef.current) {
5505
5505
  prevRef.current.removeEventListener("mouseenter", onMouseEnter);
@@ -5527,15 +5527,15 @@ var useIntersectionObserver = ({
5527
5527
  initialIsIntersecting = false,
5528
5528
  onChange
5529
5529
  } = {}) => {
5530
- const [ref, setRef] = React25.useState(null);
5531
- const [state, setState] = React25.useState(() => ({
5530
+ const [ref, setRef] = React27.useState(null);
5531
+ const [state, setState] = React27.useState(() => ({
5532
5532
  isIntersecting: initialIsIntersecting,
5533
5533
  entry: void 0
5534
5534
  }));
5535
- const callbackRef = React25.useRef(null);
5535
+ const callbackRef = React27.useRef(null);
5536
5536
  callbackRef.current = onChange;
5537
5537
  const frozen = state.entry?.isIntersecting && freezeOnceVisible;
5538
- React25.useEffect(() => {
5538
+ React27.useEffect(() => {
5539
5539
  if (!ref) return;
5540
5540
  if (!("IntersectionObserver" in window)) return;
5541
5541
  if (frozen) return;
@@ -5565,8 +5565,8 @@ var useIntersectionObserver = ({
5565
5565
  frozen,
5566
5566
  freezeOnceVisible
5567
5567
  ]);
5568
- const prevRef = React25.useRef(null);
5569
- React25.useEffect(() => {
5568
+ const prevRef = React27.useRef(null);
5569
+ React27.useEffect(() => {
5570
5570
  if (!ref && state.entry?.target && !freezeOnceVisible && !frozen && prevRef.current !== state.entry.target) {
5571
5571
  prevRef.current = state.entry.target;
5572
5572
  setState({ isIntersecting: initialIsIntersecting, entry: void 0 });
@@ -5583,8 +5583,8 @@ var isValidMediaQueryString = (query) => {
5583
5583
  return query !== "not all";
5584
5584
  };
5585
5585
  var useMediaQuery = ({ query }) => {
5586
- const [matches, setMatches] = React25.useState(false);
5587
- React25.useEffect(() => {
5586
+ const [matches, setMatches] = React27.useState(false);
5587
+ React27.useEffect(() => {
5588
5588
  if (typeof window === "undefined") {
5589
5589
  return;
5590
5590
  }
@@ -5620,8 +5620,8 @@ var useTruncated = ({
5620
5620
  onChange,
5621
5621
  resizeDetectDelay = 150
5622
5622
  }) => {
5623
- const [isTruncated, setIsTruncated] = React25.useState(false);
5624
- React25.useEffect(() => {
5623
+ const [isTruncated, setIsTruncated] = React27.useState(false);
5624
+ React27.useEffect(() => {
5625
5625
  const element = elementRef.current;
5626
5626
  if (!element) return;
5627
5627
  const checkTruncate = debounce(() => {
@@ -5650,14 +5650,14 @@ var useControllableState = ({
5650
5650
  value
5651
5651
  }) => {
5652
5652
  const isControlled = typeof value !== "undefined";
5653
- const [internalValue, setInternalValue] = React25__namespace.useState(() => {
5653
+ const [internalValue, setInternalValue] = React27__namespace.useState(() => {
5654
5654
  return isControlled ? value : defaultValue;
5655
5655
  });
5656
- React25__namespace.useEffect(() => {
5656
+ React27__namespace.useEffect(() => {
5657
5657
  if (!isControlled) return;
5658
5658
  setInternalValue(value);
5659
5659
  }, [isControlled, value]);
5660
- const setValue = React25__namespace.useCallback(
5660
+ const setValue = React27__namespace.useCallback(
5661
5661
  (nextValue) => {
5662
5662
  if (isControlled) return;
5663
5663
  setInternalValue(nextValue);
@@ -5671,7 +5671,17 @@ var useControllableState = ({
5671
5671
  };
5672
5672
  };
5673
5673
  var useControllableState_default = useControllableState;
5674
- var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React25.useLayoutEffect : React25.useEffect;
5674
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React27.useLayoutEffect : React27.useEffect;
5675
+ var useBindRef = ({ ref, value }) => {
5676
+ React27__namespace.useEffect(() => {
5677
+ if (!ref) return;
5678
+ ref.current = value;
5679
+ return () => {
5680
+ ref.current = null;
5681
+ };
5682
+ }, [ref, value]);
5683
+ };
5684
+ var useBindRef_default = useBindRef;
5675
5685
  var HeaderCell = ({
5676
5686
  rootClassName,
5677
5687
  labelClassName,
@@ -5838,38 +5848,6 @@ function TableCaption({ className, ...props }) {
5838
5848
  }
5839
5849
  );
5840
5850
  }
5841
- var ColumnResizer = ({ header, className, style }) => {
5842
- if (!header.column.getCanResize()) {
5843
- return null;
5844
- }
5845
- const resizeHandler = header.getResizeHandler();
5846
- return /* @__PURE__ */ jsxRuntime.jsx(
5847
- "div",
5848
- {
5849
- className: cn(
5850
- "z-[2] absolute top-0 right-0 h-full w-1 select-none touch-none cursor-col-resize hover:bg-[#41875c]/45 active:bg-[#41875c]",
5851
- className
5852
- ),
5853
- onDoubleClick: () => header.column.resetSize(),
5854
- onTouchStart: resizeHandler,
5855
- onMouseDown: resizeHandler,
5856
- style
5857
- }
5858
- );
5859
- };
5860
- var ColumnResizer_default = ColumnResizer;
5861
- var ColumnSeparator = ({ show, className, ...props }) => {
5862
- if (!show) return null;
5863
- return /* @__PURE__ */ jsxRuntime.jsx(
5864
- "span",
5865
- {
5866
- "data-slot": "table-head-separator",
5867
- className: cn("absolute right-0 top-1/2 h-4 w-px -translate-y-1/2 bg-gray-300", className),
5868
- ...props
5869
- }
5870
- );
5871
- };
5872
- var ColumnSeparator_default = React25__namespace.default.memo(ColumnSeparator);
5873
5851
  var StatusContentSlot = ({
5874
5852
  content,
5875
5853
  icon,
@@ -5888,7 +5866,7 @@ var StatusContentSlot = ({
5888
5866
  content
5889
5867
  ] });
5890
5868
  };
5891
- var StatusContentSlot_default = React25__namespace.default.memo(StatusContentSlot);
5869
+ var StatusContentSlot_default = React27__namespace.default.memo(StatusContentSlot);
5892
5870
  var stateOptions = [
5893
5871
  "columnFilters",
5894
5872
  "globalFilter",
@@ -5941,9 +5919,9 @@ var modelOptions = [
5941
5919
  "getCenterVisibleLeafColumns"
5942
5920
  ];
5943
5921
  var DataTableDevTool = ({ table }) => {
5944
- const [open, setOpen] = React25.useState(false);
5945
- const [visibleStates, setVisibleStates] = React25.useState([]);
5946
- const [visibleModels, setVisibleModels] = React25.useState([]);
5922
+ const [open, setOpen] = React27.useState(false);
5923
+ const [visibleStates, setVisibleStates] = React27.useState([]);
5924
+ const [visibleModels, setVisibleModels] = React27.useState([]);
5947
5925
  const tableState = table.getState();
5948
5926
  const toggleValue = (arr, value) => arr.includes(value) ? arr.filter((v) => v !== value) : [...arr, value];
5949
5927
  const getCircularReplacer = () => {
@@ -6054,45 +6032,8 @@ var DataTableDevTool = ({ table }) => {
6054
6032
  ] });
6055
6033
  };
6056
6034
  var DataTableDevTool_default = DataTableDevTool;
6057
-
6058
- // src/components/data-table/helpers.ts
6059
- function getColumnPinningInfo(column) {
6060
- const isPinned = column.getIsPinned();
6061
- const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
6062
- const isFirstRightPinnedColumn = isPinned === "right" && column.getIsFirstColumn("right");
6063
- return { isPinned, isLastLeftPinnedColumn, isFirstRightPinnedColumn };
6064
- }
6065
- function getColumnPinningStyles(column) {
6066
- const { isPinned, isFirstRightPinnedColumn, isLastLeftPinnedColumn } = getColumnPinningInfo(column);
6067
- const classes = cn(
6068
- isPinned ? "sticky" : "relative",
6069
- isPinned ? "z-[1]" : "z-0",
6070
- isLastLeftPinnedColumn && "shadow-[inset_-1px_0_0_0_black]",
6071
- isFirstRightPinnedColumn && "shadow-[inset_1px_0_0_0_black]"
6072
- );
6073
- const style = {
6074
- left: isPinned === "left" ? column.getStart("left") : void 0,
6075
- right: isPinned === "right" ? column.getAfter("right") : void 0
6076
- };
6077
- return { classes, style };
6078
- }
6079
- function getRowClickHandlers(handler, { rowData, row, table }) {
6080
- const handleClick = (event) => {
6081
- if (event.detail === 1) {
6082
- handler(rowData, { event, row, table, clickType: "single" });
6083
- }
6084
- if (event.detail >= 2) {
6085
- handler(rowData, { event, row, table, clickType: "double" });
6086
- }
6087
- };
6088
- return {
6089
- onClick: handleClick
6090
- };
6091
- }
6092
6035
  var fallbackData = [];
6093
- var DataTable = ({
6094
- tableRef,
6095
- isInitialLoading,
6036
+ var useTableController = ({
6096
6037
  columns,
6097
6038
  data,
6098
6039
  filters,
@@ -6104,14 +6045,8 @@ var DataTable = ({
6104
6045
  columnResizing,
6105
6046
  rowSelection,
6106
6047
  rowExpansion,
6107
- scrollFetch,
6108
- activeStatusContent,
6109
- statusContent,
6110
6048
  rowIdKey,
6111
- childrenKey,
6112
- onRowClick,
6113
- debug,
6114
- components
6049
+ childrenKey
6115
6050
  }) => {
6116
6051
  const table = reactTable.useReactTable({
6117
6052
  // required properties
@@ -6164,7 +6099,6 @@ var DataTable = ({
6164
6099
  getSortedRowModel: !sorting?.manual && sorting?.enabled ? reactTable.getSortedRowModel() : void 0,
6165
6100
  manualSorting: sorting?.enabled && (sorting?.manual ?? false),
6166
6101
  enableSorting: sorting?.enabled ?? false,
6167
- // default behavior: column with type number is sort by desc and string sort by asc first, we fix force always asc
6168
6102
  sortDescFirst: sorting?.enabled ? sorting?.sortDescFirst ?? false : false,
6169
6103
  onSortingChange: sorting?.enabled ? sorting?.onSortingChange : void 0,
6170
6104
  // ordering
@@ -6179,10 +6113,7 @@ var DataTable = ({
6179
6113
  enableMultiRowSelection: rowSelection?.enabled ? rowSelection?.multiSelect ?? true : true,
6180
6114
  onRowSelectionChange: rowSelection?.enabled ? rowSelection?.onSelectionChange : void 0,
6181
6115
  // row expanded
6182
- getExpandedRowModel: (
6183
- // when grouping is use then we should open this
6184
- !rowExpansion?.manual && rowExpansion?.enabled ? reactTable.getExpandedRowModel() : void 0
6185
- ),
6116
+ getExpandedRowModel: !rowExpansion?.manual && rowExpansion?.enabled ? reactTable.getExpandedRowModel() : void 0,
6186
6117
  manualExpanding: rowExpansion?.enabled && (rowExpansion?.manual ?? false),
6187
6118
  enableExpanding: rowExpansion?.enabled ?? false,
6188
6119
  getIsRowExpanded: rowExpansion?.enabled ? rowExpansion?.isRowExpanded : void 0,
@@ -6200,14 +6131,94 @@ var DataTable = ({
6200
6131
  columnResizeMode: columnResizing?.enabled ? columnResizing?.resizeMode ?? "onChange" : "onChange"
6201
6132
  })
6202
6133
  });
6203
- const tableContainerRef = React25.useRef(null);
6134
+ return table;
6135
+ };
6136
+ var useScrollFetch = ({ scrollFetch, containerRef }) => {
6137
+ const fetchMoreOnScrollReached = React27.useCallback(
6138
+ (containerRefElement) => {
6139
+ if (!scrollFetch?.enabled || !containerRefElement || scrollFetch?.isFetchingMore || !scrollFetch?.hasMore || !scrollFetch?.fetchMore) {
6140
+ return;
6141
+ }
6142
+ const { scrollHeight, scrollTop, clientHeight } = containerRefElement;
6143
+ const scrollableHeight = scrollHeight - clientHeight;
6144
+ const distanceToBottom = scrollableHeight - scrollTop;
6145
+ const ratioToBottom = scrollableHeight > 0 ? scrollTop / scrollableHeight : 1;
6146
+ const info = {
6147
+ scrollTop,
6148
+ scrollHeight,
6149
+ clientHeight,
6150
+ scrollableHeight,
6151
+ distanceToBottom,
6152
+ ratioToBottom,
6153
+ isTopReached: scrollTop === 0,
6154
+ isBottomReached: distanceToBottom <= 0
6155
+ };
6156
+ let shouldTrigger = false;
6157
+ if (typeof scrollFetch.scrollThreshold === "number") {
6158
+ shouldTrigger = info.ratioToBottom >= scrollFetch.scrollThreshold;
6159
+ } else if (typeof scrollFetch.scrollThreshold === "function") {
6160
+ shouldTrigger = scrollFetch.scrollThreshold(info);
6161
+ } else {
6162
+ shouldTrigger = info.ratioToBottom >= 0.7;
6163
+ }
6164
+ if (shouldTrigger) {
6165
+ scrollFetch.fetchMore();
6166
+ }
6167
+ },
6168
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6169
+ [scrollFetch?.enabled, scrollFetch?.isFetchingMore, scrollFetch?.hasMore, scrollFetch?.fetchMore]
6170
+ );
6171
+ React27.useEffect(() => {
6172
+ fetchMoreOnScrollReached(containerRef.current);
6173
+ }, [fetchMoreOnScrollReached, containerRef]);
6174
+ return fetchMoreOnScrollReached;
6175
+ };
6176
+ var DEFAULT_ROW_HEIGHT = 40;
6177
+ var DEFAULT_OVER_SCAN = 10;
6178
+ var useTableVirtualizer = ({
6179
+ enabled,
6180
+ table,
6181
+ containerRef,
6182
+ virtual
6183
+ }) => {
6184
+ const rowModel = table.getRowModel().rows;
6185
+ const virtualizer = reactVirtual.useVirtualizer({
6186
+ count: enabled ? rowModel.length : 0,
6187
+ useFlushSync: false,
6188
+ getScrollElement: () => containerRef.current,
6189
+ estimateSize: () => DEFAULT_ROW_HEIGHT,
6190
+ measureElement: typeof window !== "undefined" && navigator.userAgent.indexOf("Firefox") === -1 ? (element) => element?.getBoundingClientRect().height : void 0,
6191
+ overscan: virtual?.overscan ?? DEFAULT_OVER_SCAN
6192
+ });
6193
+ const virtualItems = enabled ? virtualizer.getVirtualItems() : [];
6194
+ const paddingTop = enabled && virtualItems.length > 0 ? virtualItems[0].start : 0;
6195
+ const paddingBottom = enabled && virtualItems.length > 0 ? virtualizer.getTotalSize() - virtualItems[virtualItems.length - 1].end : 0;
6196
+ return {
6197
+ virtualizer,
6198
+ virtualItems,
6199
+ paddingTop,
6200
+ paddingBottom,
6201
+ rowModel
6202
+ };
6203
+ };
6204
+ function useComputedTableState({
6205
+ table,
6206
+ rowModel,
6207
+ isInitialLoading,
6208
+ scrollFetch,
6209
+ activeStatusContent
6210
+ }) {
6204
6211
  const isTableEmpty = table.getCoreRowModel().rows.length === 0;
6205
- const isTableEmptyAfterFiltering = table.getRowModel().rows.length === 0;
6212
+ const isTableEmptyAfterFiltering = rowModel.length === 0;
6206
6213
  const isFiltering = table.getState().columnFilters.length > 0 || !!table.getState().globalFilter;
6207
6214
  const leftVisibleLeftColumns = table.getLeftVisibleLeafColumns();
6208
6215
  const centerVisibleLeafColumns = table.getCenterVisibleLeafColumns();
6209
6216
  const rightVisibleLeafColumns = table.getRightVisibleLeafColumns();
6210
- const { isSomeColumnsFilterable, filterableColumns } = React25.useMemo(() => {
6217
+ const visibleColumnCount = Math.max(
6218
+ leftVisibleLeftColumns.length + centerVisibleLeafColumns.length + rightVisibleLeafColumns.length,
6219
+ 1
6220
+ );
6221
+ const { isSomeColumnsFilterable, filterableColumns } = React27.useMemo(() => {
6211
6222
  const mergedColumns = [
6212
6223
  ...leftVisibleLeftColumns,
6213
6224
  ...centerVisibleLeafColumns,
@@ -6218,7 +6229,7 @@ var DataTable = ({
6218
6229
  );
6219
6230
  return { isSomeColumnsFilterable: isSomeColumnsFilterable2, filterableColumns: mergedColumns };
6220
6231
  }, [centerVisibleLeafColumns, leftVisibleLeftColumns, rightVisibleLeafColumns]);
6221
- const autoStatusKey = React25.useMemo(() => {
6232
+ const autoStatusKey = React27.useMemo(() => {
6222
6233
  if (isInitialLoading) return "initialLoading";
6223
6234
  if (isTableEmpty) return "emptyData";
6224
6235
  if (isTableEmptyAfterFiltering) return "emptyFilteredData";
@@ -6236,57 +6247,336 @@ var DataTable = ({
6236
6247
  scrollFetch?.hasMore,
6237
6248
  scrollFetch?.isFetchingMore
6238
6249
  ]);
6239
- const activeStatusContentComputed = React25.useMemo(() => {
6250
+ const activeStatusContentComputed = React27.useMemo(() => {
6240
6251
  if (!activeStatusContent) return autoStatusKey;
6241
6252
  if (typeof activeStatusContent === "function") {
6242
6253
  return activeStatusContent({ defaultComputedValue: autoStatusKey });
6243
6254
  }
6244
6255
  return activeStatusContent;
6245
6256
  }, [activeStatusContent, autoStatusKey]);
6246
- const fetchMoreOnScrollReached = React25.useCallback(
6247
- (containerRefElement) => {
6248
- if (!scrollFetch?.enabled || !containerRefElement || scrollFetch?.isFetchingMore || !scrollFetch?.hasMore || !scrollFetch?.fetchMore) {
6249
- return;
6250
- }
6251
- const { scrollHeight, scrollTop, clientHeight } = containerRefElement;
6252
- const scrollableHeight = scrollHeight - clientHeight;
6253
- const distanceToBottom = scrollableHeight - scrollTop;
6254
- const ratioToBottom = scrollableHeight > 0 ? scrollTop / scrollableHeight : 1;
6255
- const info = {
6256
- scrollTop,
6257
- scrollHeight,
6258
- clientHeight,
6259
- scrollableHeight,
6260
- distanceToBottom,
6261
- ratioToBottom,
6262
- isTopReached: scrollTop === 0,
6263
- isBottomReached: distanceToBottom <= 0
6264
- };
6265
- let shouldTrigger = false;
6266
- if (typeof scrollFetch.scrollThreshold === "number") {
6267
- shouldTrigger = info.ratioToBottom >= scrollFetch.scrollThreshold;
6268
- } else if (typeof scrollFetch.scrollThreshold === "function") {
6269
- shouldTrigger = scrollFetch.scrollThreshold(info);
6270
- } else {
6271
- shouldTrigger = info.ratioToBottom >= 0.7;
6257
+ return {
6258
+ isTableEmpty,
6259
+ isTableEmptyAfterFiltering,
6260
+ isFiltering,
6261
+ leftVisibleLeftColumns,
6262
+ centerVisibleLeafColumns,
6263
+ rightVisibleLeafColumns,
6264
+ visibleColumnCount,
6265
+ isSomeColumnsFilterable,
6266
+ filterableColumns,
6267
+ activeStatusContentComputed
6268
+ };
6269
+ }
6270
+ var ColumnResizer = ({ header, className, style }) => {
6271
+ if (!header.column.getCanResize()) {
6272
+ return null;
6273
+ }
6274
+ const resizeHandler = header.getResizeHandler();
6275
+ return /* @__PURE__ */ jsxRuntime.jsx(
6276
+ "div",
6277
+ {
6278
+ className: cn(
6279
+ "z-[2] absolute top-0 right-0 h-full w-1 select-none touch-none cursor-col-resize hover:bg-[#41875c]/45 active:bg-[#41875c]",
6280
+ className
6281
+ ),
6282
+ onDoubleClick: () => header.column.resetSize(),
6283
+ onTouchStart: resizeHandler,
6284
+ onMouseDown: resizeHandler,
6285
+ style
6286
+ }
6287
+ );
6288
+ };
6289
+ var ColumnResizer_default = ColumnResizer;
6290
+ var ColumnSeparator = ({ show, className, ...props }) => {
6291
+ if (!show) return null;
6292
+ return /* @__PURE__ */ jsxRuntime.jsx(
6293
+ "span",
6294
+ {
6295
+ "data-slot": "table-head-separator",
6296
+ className: cn("absolute right-0 top-1/2 h-4 w-px -translate-y-1/2 bg-gray-300", className),
6297
+ ...props
6298
+ }
6299
+ );
6300
+ };
6301
+ var ColumnSeparator_default = React27__namespace.default.memo(ColumnSeparator);
6302
+
6303
+ // src/components/data-table/helpers.ts
6304
+ function getColumnPinningInfo(column) {
6305
+ const isPinned = column.getIsPinned();
6306
+ const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
6307
+ const isFirstRightPinnedColumn = isPinned === "right" && column.getIsFirstColumn("right");
6308
+ return { isPinned, isLastLeftPinnedColumn, isFirstRightPinnedColumn };
6309
+ }
6310
+ function getColumnPinningStyles(column) {
6311
+ const { isPinned, isFirstRightPinnedColumn, isLastLeftPinnedColumn } = getColumnPinningInfo(column);
6312
+ const classes = cn(isPinned ? "sticky" : "relative");
6313
+ const style = {
6314
+ left: isPinned === "left" ? column.getStart("left") : void 0,
6315
+ right: isPinned === "right" ? column.getAfter("right") : void 0,
6316
+ zIndex: isPinned ? 1 : 0,
6317
+ boxShadow: isLastLeftPinnedColumn ? "inset -1px 0 0 0 black" : isFirstRightPinnedColumn ? "inset 1px 0 0 0 black" : void 0
6318
+ };
6319
+ return { classes, style };
6320
+ }
6321
+ function getRowClickHandlers(handler, { rowData, row, table }) {
6322
+ const handleClick = (event) => {
6323
+ if (event.detail === 1) {
6324
+ handler(rowData, { event, row, table, clickType: "single" });
6325
+ }
6326
+ if (event.detail >= 2) {
6327
+ handler(rowData, { event, row, table, clickType: "double" });
6328
+ }
6329
+ };
6330
+ return {
6331
+ onClick: handleClick
6332
+ };
6333
+ }
6334
+ var TableHeaderRows = ({
6335
+ table,
6336
+ columnResizing,
6337
+ virtual,
6338
+ components
6339
+ }) => {
6340
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: table.getHeaderGroups().map((headerGroup) => {
6341
+ return /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: headerGroup.headers.map((header) => {
6342
+ const { classes, style } = getColumnPinningStyles(header.column);
6343
+ const useColumnSizing = header.column.columnDef?.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
6344
+ const tableHeadCellProps = typeof components?.tableHeadCellProps === "function" ? components?.tableHeadCellProps({ header, table }) : components?.tableHeadCellProps;
6345
+ const nextHeader = headerGroup.headers?.[header.index + 1] || header;
6346
+ const { isLastLeftPinnedColumn } = getColumnPinningInfo(header.column);
6347
+ const { isFirstRightPinnedColumn } = getColumnPinningInfo(nextHeader.column);
6348
+ const headerGroupLength = header.headerGroup.headers.length;
6349
+ const showSeparator = header.index !== headerGroupLength - 1 && !isLastLeftPinnedColumn && !isFirstRightPinnedColumn;
6350
+ return /* @__PURE__ */ jsxRuntime.jsxs(
6351
+ TableHead,
6352
+ {
6353
+ "data-testid": `table-head-${header.id}`,
6354
+ colSpan: header.colSpan,
6355
+ ...tableHeadCellProps,
6356
+ ...header.column.columnDef?.meta?.headerProps,
6357
+ className: cn(
6358
+ classes,
6359
+ tableHeadCellProps?.className,
6360
+ header.column.columnDef?.meta?.headerProps?.className
6361
+ ),
6362
+ style: {
6363
+ ...style,
6364
+ width: useColumnSizing ? header.column.getSize() : void 0,
6365
+ minWidth: useColumnSizing ? header.column.columnDef.minSize : void 0,
6366
+ maxWidth: useColumnSizing ? header.column.columnDef.maxSize : void 0,
6367
+ ...tableHeadCellProps?.style,
6368
+ ...header.column.columnDef?.meta?.headerProps?.style
6369
+ },
6370
+ children: [
6371
+ header.isPlaceholder ? null : reactTable.flexRender(header.column.columnDef.header, header.getContext()),
6372
+ /* @__PURE__ */ jsxRuntime.jsx(
6373
+ ColumnSeparator_default,
6374
+ {
6375
+ ...components?.columnSeparatorProps?.headerCell,
6376
+ ...header.column.columnDef?.meta?.columnSeparatorProps,
6377
+ show: header.column.columnDef?.meta?.columnSeparatorProps?.show ?? components?.columnSeparatorProps?.headerCell?.show ?? showSeparator
6378
+ }
6379
+ ),
6380
+ /* @__PURE__ */ jsxRuntime.jsx(ColumnResizer_default, { header, ...components?.columnResizerProps })
6381
+ ]
6382
+ },
6383
+ header.id
6384
+ );
6385
+ }) }, headerGroup.id);
6386
+ }) });
6387
+ };
6388
+ var TableFilterRow = ({
6389
+ table,
6390
+ filterableColumns,
6391
+ isSomeColumnsFilterable,
6392
+ columnResizing,
6393
+ virtual,
6394
+ components
6395
+ }) => {
6396
+ if (!isSomeColumnsFilterable) return null;
6397
+ return /* @__PURE__ */ jsxRuntime.jsx(TableRow, { "data-testid": "table-filter-row", children: filterableColumns.map((column) => {
6398
+ const { classes, style } = getColumnPinningStyles(column);
6399
+ const useColumnSizing = column.columnDef.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
6400
+ const tableFilterCellProps = typeof components?.tableFilterCellProps === "function" ? components?.tableFilterCellProps({ column, table }) : components?.tableFilterCellProps;
6401
+ return /* @__PURE__ */ jsxRuntime.jsx(
6402
+ TableCell,
6403
+ {
6404
+ "data-testid": `table-filter-cell-${column.id}`,
6405
+ ...tableFilterCellProps,
6406
+ ...column.columnDef?.meta?.filterCellProps,
6407
+ className: cn(
6408
+ "bg-white border-b",
6409
+ classes,
6410
+ tableFilterCellProps?.className,
6411
+ column.columnDef?.meta?.filterCellProps?.className
6412
+ ),
6413
+ style: {
6414
+ ...style,
6415
+ width: useColumnSizing ? column.getSize() : void 0,
6416
+ minWidth: useColumnSizing ? column.columnDef.minSize : void 0,
6417
+ maxWidth: useColumnSizing ? column.columnDef.maxSize : void 0,
6418
+ ...tableFilterCellProps?.style,
6419
+ ...column.columnDef?.meta?.filterCellProps?.style
6420
+ },
6421
+ children: column.getCanFilter() && column.columnDef.meta?.renderColumnFilter?.({
6422
+ column,
6423
+ table
6424
+ })
6425
+ },
6426
+ column.id
6427
+ );
6428
+ }) });
6429
+ };
6430
+ var TableDataRows = ({
6431
+ table,
6432
+ rowModel,
6433
+ virtualEnabled,
6434
+ virtualItems,
6435
+ virtualizer,
6436
+ paddingTop,
6437
+ paddingBottom,
6438
+ visibleColumnCount,
6439
+ columnResizing,
6440
+ virtual,
6441
+ onRowClick,
6442
+ components
6443
+ }) => {
6444
+ const config = virtualEnabled ? { items: virtualItems, isVirtualize: true, rowModel } : { items: rowModel, isVirtualize: false };
6445
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6446
+ virtualEnabled && paddingTop > 0 && /* @__PURE__ */ jsxRuntime.jsx(TableRow, { "aria-hidden": "true", "data-testid": "table-virtual-padding-top", children: /* @__PURE__ */ jsxRuntime.jsx(
6447
+ TableCell,
6448
+ {
6449
+ className: "border-b-0 p-0 h-auto",
6450
+ colSpan: visibleColumnCount,
6451
+ style: { height: `${paddingTop}px` }
6272
6452
  }
6273
- if (shouldTrigger) {
6274
- scrollFetch.fetchMore();
6453
+ ) }),
6454
+ config.items.map((item) => {
6455
+ const row = config.isVirtualize ? config.rowModel[item.index] : item;
6456
+ if (!row) return null;
6457
+ const virtualIndex = config.isVirtualize ? item.index : void 0;
6458
+ const tableDataRowProps = typeof components?.tableDataRowProps === "function" ? components.tableDataRowProps({ row, table }) || {} : components?.tableDataRowProps || {};
6459
+ return /* @__PURE__ */ React27.createElement(
6460
+ TableRow,
6461
+ {
6462
+ "data-testid": `table-data-row-${row.id}`,
6463
+ "data-index": virtualIndex,
6464
+ ref: config.isVirtualize ? (node) => virtualizer.measureElement(node) : void 0,
6465
+ ...tableDataRowProps,
6466
+ key: row.id,
6467
+ className: cn("group", tableDataRowProps?.className),
6468
+ "data-state": row.getIsSelected() ? "selected" : "non-selected",
6469
+ ...getRowClickHandlers(onRowClick ?? (() => {
6470
+ }), {
6471
+ rowData: row.original,
6472
+ row,
6473
+ table
6474
+ })
6475
+ },
6476
+ row.getVisibleCells().map((cell) => {
6477
+ const { classes, style } = getColumnPinningStyles(cell.column);
6478
+ const useColumnSizing = cell.column.columnDef.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
6479
+ const tableDataCellProps = typeof components?.tableDataCellProps === "function" ? components?.tableDataCellProps({ row, cell, table }) : components?.tableDataCellProps;
6480
+ return /* @__PURE__ */ jsxRuntime.jsx(
6481
+ TableCell,
6482
+ {
6483
+ "data-testid": `table-data-cell-${cell.id}`,
6484
+ "data-row-id": row.id,
6485
+ "data-column-id": cell.column.id,
6486
+ ...tableDataCellProps,
6487
+ ...cell.column.columnDef?.meta?.cellProps,
6488
+ className: cn(
6489
+ {
6490
+ "bg-[#dfeae3]": row.getIsSelected(),
6491
+ "bg-white group-hover:bg-sus-primary-3-hover": !row.getIsSelected()
6492
+ },
6493
+ classes,
6494
+ tableDataCellProps?.className,
6495
+ cell.column.columnDef?.meta?.cellProps?.className
6496
+ ),
6497
+ style: {
6498
+ ...style,
6499
+ width: useColumnSizing ? cell.column.getSize() : void 0,
6500
+ minWidth: useColumnSizing ? cell.column.columnDef.minSize : void 0,
6501
+ maxWidth: useColumnSizing ? cell.column.columnDef.maxSize : void 0,
6502
+ ...tableDataCellProps?.style,
6503
+ ...cell.column.columnDef?.meta?.cellProps?.style
6504
+ },
6505
+ children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext())
6506
+ },
6507
+ cell.id
6508
+ );
6509
+ })
6510
+ );
6511
+ }),
6512
+ virtualEnabled && paddingBottom > 0 && /* @__PURE__ */ jsxRuntime.jsx(TableRow, { "aria-hidden": "true", "data-testid": "table-virtual-padding-bottom", children: /* @__PURE__ */ jsxRuntime.jsx(
6513
+ TableCell,
6514
+ {
6515
+ className: "border-b-0 p-0 h-auto",
6516
+ colSpan: visibleColumnCount,
6517
+ style: { height: `${paddingBottom}px` }
6275
6518
  }
6276
- },
6277
- // eslint-disable-next-line react-hooks/exhaustive-deps
6278
- [scrollFetch?.enabled, scrollFetch?.isFetchingMore, scrollFetch?.hasMore, scrollFetch?.fetchMore]
6279
- );
6280
- React25.useEffect(() => {
6281
- if (!tableRef) return;
6282
- tableRef.current = table;
6283
- return () => {
6284
- tableRef.current = null;
6285
- };
6286
- }, [tableRef, table]);
6287
- React25.useEffect(() => {
6288
- fetchMoreOnScrollReached(tableContainerRef.current);
6289
- }, [fetchMoreOnScrollReached]);
6519
+ ) })
6520
+ ] });
6521
+ };
6522
+ var DataTable = ({
6523
+ tableRef,
6524
+ virtualizerRef,
6525
+ isInitialLoading,
6526
+ columns,
6527
+ data,
6528
+ filters,
6529
+ sorting,
6530
+ columnOrder,
6531
+ columnVisibility,
6532
+ columnPinning,
6533
+ columnGrouping,
6534
+ columnResizing,
6535
+ rowSelection,
6536
+ rowExpansion,
6537
+ virtual,
6538
+ scrollFetch,
6539
+ activeStatusContent,
6540
+ statusContent,
6541
+ rowIdKey,
6542
+ childrenKey,
6543
+ onRowClick,
6544
+ debug,
6545
+ components
6546
+ }) => {
6547
+ const virtualEnabled = virtual?.enabled ?? false;
6548
+ const tableContainerRef = React27.useRef(null);
6549
+ const table = useTableController({
6550
+ columns,
6551
+ data,
6552
+ filters,
6553
+ sorting,
6554
+ columnOrder,
6555
+ columnVisibility,
6556
+ columnPinning,
6557
+ columnGrouping,
6558
+ columnResizing,
6559
+ rowSelection,
6560
+ rowExpansion,
6561
+ rowIdKey,
6562
+ childrenKey
6563
+ });
6564
+ const { virtualizer, virtualItems, paddingTop, paddingBottom, rowModel } = useTableVirtualizer({
6565
+ enabled: virtualEnabled,
6566
+ table,
6567
+ containerRef: tableContainerRef,
6568
+ virtual
6569
+ });
6570
+ const { visibleColumnCount, isSomeColumnsFilterable, filterableColumns, activeStatusContentComputed } = useComputedTableState({
6571
+ table,
6572
+ rowModel,
6573
+ isInitialLoading,
6574
+ scrollFetch,
6575
+ activeStatusContent
6576
+ });
6577
+ const fetchMoreOnScrollReached = useScrollFetch({ scrollFetch, containerRef: tableContainerRef });
6578
+ useBindRef_default({ ref: tableRef, value: table });
6579
+ useBindRef_default({ ref: virtualizerRef, value: virtualizer });
6290
6580
  return /* @__PURE__ */ jsxRuntime.jsxs(
6291
6581
  TableContainer,
6292
6582
  {
@@ -6323,149 +6613,61 @@ var DataTable = ({
6323
6613
  defaultIcon: /* @__PURE__ */ jsxRuntime.jsx(empty_data_default, { size: 128 })
6324
6614
  }
6325
6615
  ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6326
- /* @__PURE__ */ jsxRuntime.jsxs(Table, { ...components?.tableProps, children: [
6327
- /* @__PURE__ */ jsxRuntime.jsxs(
6328
- TableHeader,
6329
- {
6330
- className: cn("sticky top-0 z-10", components?.tableHeaderProps?.className),
6331
- ...components?.tableHeaderProps,
6332
- children: [
6333
- table.getHeaderGroups().map((headerGroup) => {
6334
- return /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: headerGroup.headers.map((header) => {
6335
- const { classes, style } = getColumnPinningStyles(header.column);
6336
- const useColumnSizing = header.column.columnDef?.meta?.useColumnSizing ?? columnResizing?.enabled ?? false;
6337
- const tableHeadCellProps = typeof components?.tableHeadCellProps === "function" ? components?.tableHeadCellProps({ header, table }) : components?.tableHeadCellProps;
6338
- const nextHeader = headerGroup.headers?.[header.index + 1] || header;
6339
- const { isLastLeftPinnedColumn } = getColumnPinningInfo(header.column);
6340
- const { isFirstRightPinnedColumn } = getColumnPinningInfo(nextHeader.column);
6341
- const headerGroupLength = header.headerGroup.headers.length;
6342
- const showSeparator = header.index !== headerGroupLength - 1 && !isLastLeftPinnedColumn && !isFirstRightPinnedColumn;
6343
- return /* @__PURE__ */ jsxRuntime.jsxs(
6344
- TableHead,
6345
- {
6346
- "data-testid": `table-head-${header.id}`,
6347
- colSpan: header.colSpan,
6348
- ...tableHeadCellProps,
6349
- ...header.column.columnDef?.meta?.headerProps,
6350
- className: cn(
6351
- classes,
6352
- tableHeadCellProps?.className,
6353
- header.column.columnDef?.meta?.headerProps?.className
6354
- ),
6355
- style: {
6356
- ...style,
6357
- width: useColumnSizing ? header.column.getSize() : void 0,
6358
- minWidth: useColumnSizing ? header.column.columnDef.minSize : void 0,
6359
- maxWidth: useColumnSizing ? header.column.columnDef.maxSize : void 0,
6360
- ...tableHeadCellProps?.style,
6361
- ...header.column.columnDef?.meta?.headerProps?.style
6362
- },
6363
- children: [
6364
- header.isPlaceholder ? null : reactTable.flexRender(header.column.columnDef.header, header.getContext()),
6365
- /* @__PURE__ */ jsxRuntime.jsx(
6366
- ColumnSeparator_default,
6367
- {
6368
- ...components?.columnSeparatorProps?.headerCell,
6369
- ...header.column.columnDef?.meta?.columnSeparatorProps,
6370
- show: header.column.columnDef?.meta?.columnSeparatorProps?.show ?? components?.columnSeparatorProps?.headerCell?.show ?? showSeparator
6371
- }
6372
- ),
6373
- /* @__PURE__ */ jsxRuntime.jsx(ColumnResizer_default, { header, ...components?.columnResizerProps })
6374
- ]
6375
- },
6376
- header.id
6377
- );
6378
- }) }, headerGroup.id);
6379
- }),
6380
- isSomeColumnsFilterable && /* @__PURE__ */ jsxRuntime.jsx(TableRow, { "data-testid": "table-filter-row", children: filterableColumns.map((column) => {
6381
- const { classes, style } = getColumnPinningStyles(column);
6382
- const useColumnSizing = column.columnDef.meta?.useColumnSizing ?? columnResizing?.enabled ?? false;
6383
- const tableFilterCellProps = typeof components?.tableFilterCellProps === "function" ? components?.tableFilterCellProps({ column, table }) : components?.tableFilterCellProps;
6384
- return /* @__PURE__ */ jsxRuntime.jsx(
6385
- TableCell,
6386
- {
6387
- "data-testid": `table-filter-cell-${column.id}`,
6388
- ...tableFilterCellProps,
6389
- ...column.columnDef?.meta?.filterCellProps,
6390
- className: cn(
6391
- "bg-white border-b",
6392
- classes,
6393
- tableFilterCellProps?.className,
6394
- column.columnDef?.meta?.filterCellProps?.className
6395
- ),
6396
- style: {
6397
- ...style,
6398
- width: useColumnSizing ? column.getSize() : void 0,
6399
- minWidth: useColumnSizing ? column.columnDef.minSize : void 0,
6400
- maxWidth: useColumnSizing ? column.columnDef.maxSize : void 0,
6401
- ...tableFilterCellProps?.style,
6402
- ...column.columnDef?.meta?.filterCellProps?.style
6403
- },
6404
- children: column.getCanFilter() && column.columnDef.meta?.renderColumnFilter?.({
6405
- column,
6406
- table
6407
- })
6408
- },
6409
- column.id
6410
- );
6411
- }) })
6412
- ]
6413
- }
6414
- ),
6415
- /* @__PURE__ */ jsxRuntime.jsx(TableBody, { ...components?.tableBodyProps, children: table.getRowModel().rows.map((row) => {
6416
- const tableDataRowProps = typeof components?.tableDataRowProps === "function" ? components.tableDataRowProps({ row, table }) || {} : components?.tableDataRowProps || {};
6417
- return /* @__PURE__ */ React25.createElement(
6418
- TableRow,
6419
- {
6420
- "data-testid": `table-data-row-${row.id}`,
6421
- ...tableDataRowProps,
6422
- key: row.id,
6423
- className: cn("group", tableDataRowProps?.className),
6424
- "data-state": row.getIsSelected() ? "selected" : "non-selected",
6425
- ...getRowClickHandlers(onRowClick ?? (() => {
6426
- }), {
6427
- rowData: row.original,
6428
- row,
6429
- table
6430
- })
6431
- },
6432
- row.getVisibleCells().map((cell) => {
6433
- const { classes, style } = getColumnPinningStyles(cell.column);
6434
- const useColumnSizing = cell.column.columnDef.meta?.useColumnSizing ?? columnResizing?.enabled ?? false;
6435
- const tableDataCellProps = typeof components?.tableDataCellProps === "function" ? components?.tableDataCellProps({ row, cell, table }) : components?.tableDataCellProps;
6436
- return /* @__PURE__ */ jsxRuntime.jsx(
6437
- TableCell,
6438
- {
6439
- "data-testid": `table-data-cell-${cell.id}`,
6440
- "data-row-id": row.id,
6441
- "data-column-id": cell.column.id,
6442
- ...tableDataCellProps,
6443
- ...cell.column.columnDef?.meta?.cellProps,
6444
- className: cn(
6616
+ /* @__PURE__ */ jsxRuntime.jsxs(
6617
+ Table,
6618
+ {
6619
+ ...components?.tableProps,
6620
+ style: { tableLayout: virtualEnabled ? "fixed" : "auto", ...components?.tableProps?.style },
6621
+ children: [
6622
+ /* @__PURE__ */ jsxRuntime.jsxs(
6623
+ TableHeader,
6624
+ {
6625
+ className: cn("sticky top-0 z-10 bg-white", components?.tableHeaderProps?.className),
6626
+ ...components?.tableHeaderProps,
6627
+ children: [
6628
+ /* @__PURE__ */ jsxRuntime.jsx(
6629
+ TableHeaderRows,
6445
6630
  {
6446
- "bg-[#dfeae3]": row.getIsSelected(),
6447
- "bg-white group-hover:bg-[#eff5f1]": !row.getIsSelected()
6448
- },
6449
- classes,
6450
- tableDataCellProps?.className,
6451
- cell.column.columnDef?.meta?.cellProps?.className
6631
+ table,
6632
+ columnResizing,
6633
+ virtual,
6634
+ components
6635
+ }
6452
6636
  ),
6453
- style: {
6454
- ...style,
6455
- width: useColumnSizing ? cell.column.getSize() : void 0,
6456
- minWidth: useColumnSizing ? cell.column.columnDef.minSize : void 0,
6457
- maxWidth: useColumnSizing ? cell.column.columnDef.maxSize : void 0,
6458
- ...tableDataCellProps?.style,
6459
- ...cell.column.columnDef?.meta?.cellProps?.style
6460
- },
6461
- children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext())
6462
- },
6463
- cell.id
6464
- );
6465
- })
6466
- );
6467
- }) })
6468
- ] }),
6637
+ /* @__PURE__ */ jsxRuntime.jsx(
6638
+ TableFilterRow,
6639
+ {
6640
+ table,
6641
+ filterableColumns,
6642
+ isSomeColumnsFilterable,
6643
+ columnResizing,
6644
+ virtual,
6645
+ components
6646
+ }
6647
+ )
6648
+ ]
6649
+ }
6650
+ ),
6651
+ /* @__PURE__ */ jsxRuntime.jsx(TableBody, { ...components?.tableBodyProps, children: /* @__PURE__ */ jsxRuntime.jsx(
6652
+ TableDataRows,
6653
+ {
6654
+ table,
6655
+ rowModel,
6656
+ virtualEnabled,
6657
+ virtualItems,
6658
+ virtualizer,
6659
+ paddingTop,
6660
+ paddingBottom,
6661
+ visibleColumnCount,
6662
+ columnResizing,
6663
+ virtual,
6664
+ onRowClick,
6665
+ components
6666
+ }
6667
+ ) })
6668
+ ]
6669
+ }
6670
+ ),
6469
6671
  activeStatusContentComputed === "emptyFilteredData" && /* @__PURE__ */ jsxRuntime.jsx(
6470
6672
  StatusContentSlot_default,
6471
6673
  {
@@ -6747,11 +6949,11 @@ function DialogAlert({
6747
6949
  }) {
6748
6950
  const alignClass = align === "start" ? "justify-start" : align === "end" ? "justify-end" : "justify-center";
6749
6951
  const { t } = reactI18next.useTranslation();
6750
- const handleCancel = React25.useCallback(() => {
6952
+ const handleCancel = React27.useCallback(() => {
6751
6953
  onCancel?.();
6752
6954
  onOpenChange(false);
6753
6955
  }, [onCancel, onOpenChange]);
6754
- const handleConfirm = React25.useCallback(() => {
6956
+ const handleConfirm = React27.useCallback(() => {
6755
6957
  let func = onConfirm;
6756
6958
  if (variant === "success" && showCancel === false) {
6757
6959
  func = onConfirm ?? onCancel;
@@ -7126,7 +7328,7 @@ var DialogAlertProvider = ({ children, i18nResource, i18nLang }) => {
7126
7328
  const open = useDialogAlertStore((state) => state.open);
7127
7329
  const setOpen = useDialogAlertStore((state) => state.setOpen);
7128
7330
  const dialogProps = useDialogAlertStore((state) => state.dialogProps);
7129
- React25.useEffect(() => {
7331
+ React27.useEffect(() => {
7130
7332
  if (!i18nResource) {
7131
7333
  i18n_default.changeLanguage("sharedui");
7132
7334
  return;
@@ -7236,8 +7438,8 @@ var defaultOperatorShortcuts = {
7236
7438
  };
7237
7439
  var DEFAULT_DEBOUNCE = 200;
7238
7440
  function useKeyboardNavigation(itemsLength, onSelect, isLocked) {
7239
- const [selectedIndex, setSelectedIndex] = React25.useState(0);
7240
- React25.useEffect(() => {
7441
+ const [selectedIndex, setSelectedIndex] = React27.useState(0);
7442
+ React27.useEffect(() => {
7241
7443
  const handler = (event) => {
7242
7444
  if (event.key === "ArrowDown") {
7243
7445
  event.preventDefault();
@@ -7260,10 +7462,10 @@ function useKeyboardNavigation(itemsLength, onSelect, isLocked) {
7260
7462
  return [selectedIndex, setSelectedIndex];
7261
7463
  }
7262
7464
  function useDropdownPosition(clientRect, itemsCount) {
7263
- const [rect, setRect] = React25.useState(null);
7264
- const [style, setStyle] = React25.useState({});
7265
- const ref = React25.useRef(null);
7266
- React25.useEffect(() => {
7465
+ const [rect, setRect] = React27.useState(null);
7466
+ const [style, setStyle] = React27.useState({});
7467
+ const ref = React27.useRef(null);
7468
+ React27.useEffect(() => {
7267
7469
  if (!clientRect) return;
7268
7470
  const update = () => {
7269
7471
  const nextRect = clientRect();
@@ -7280,7 +7482,7 @@ function useDropdownPosition(clientRect, itemsCount) {
7280
7482
  resizeObserver.disconnect();
7281
7483
  };
7282
7484
  }, [clientRect]);
7283
- React25.useLayoutEffect(() => {
7485
+ React27.useLayoutEffect(() => {
7284
7486
  if (!rect || !ref.current) return;
7285
7487
  const dropdown = ref.current;
7286
7488
  const dropdownRect = dropdown.getBoundingClientRect();
@@ -7307,15 +7509,15 @@ var SuggestionList = ({
7307
7509
  debounceMs = DEFAULT_DEBOUNCE,
7308
7510
  query
7309
7511
  }) => {
7310
- const [items, setItems] = React25.useState([]);
7311
- const [isLoading, setIsLoading] = React25.useState(false);
7312
- const fetchId = React25.useRef(0);
7313
- const debounceHandle = React25.useRef(null);
7314
- const itemRefs = React25.useRef([]);
7512
+ const [items, setItems] = React27.useState([]);
7513
+ const [isLoading, setIsLoading] = React27.useState(false);
7514
+ const fetchId = React27.useRef(0);
7515
+ const debounceHandle = React27.useRef(null);
7516
+ const itemRefs = React27.useRef([]);
7315
7517
  const { ref, style, rect } = useDropdownPosition(clientRect, items.length);
7316
- const normalizedMap = React25.useMemo(() => mapItem, [mapItem]);
7317
- const normalizeItem = React25.useMemo(() => normalizeToken, [normalizeToken]);
7318
- React25.useEffect(() => {
7518
+ const normalizedMap = React27.useMemo(() => mapItem, [mapItem]);
7519
+ const normalizeItem = React27.useMemo(() => normalizeToken, [normalizeToken]);
7520
+ React27.useEffect(() => {
7319
7521
  const runFetch = (input) => {
7320
7522
  fetchId.current += 1;
7321
7523
  const currentId = fetchId.current;
@@ -7346,7 +7548,7 @@ var SuggestionList = ({
7346
7548
  fetchId.current += 1;
7347
7549
  };
7348
7550
  }, [query, fetchItems, normalizedMap, normalizeItem, debounceMs]);
7349
- const handleSelect = React25.useMemo(
7551
+ const handleSelect = React27.useMemo(
7350
7552
  () => (item) => {
7351
7553
  if (isLoading) return;
7352
7554
  command(item);
@@ -7361,10 +7563,10 @@ var SuggestionList = ({
7361
7563
  },
7362
7564
  isLoading
7363
7565
  );
7364
- React25.useEffect(() => {
7566
+ React27.useEffect(() => {
7365
7567
  setSelectedIndex(0);
7366
7568
  }, [items, setSelectedIndex]);
7367
- React25.useEffect(() => {
7569
+ React27.useEffect(() => {
7368
7570
  const element = itemRefs.current[selectedIndex];
7369
7571
  if (element) element.scrollIntoView({ block: "nearest" });
7370
7572
  }, [selectedIndex]);
@@ -7412,8 +7614,8 @@ var DISALLOWED_MARKS = ["bold", "italic", "link"];
7412
7614
  var SUGGESTION_DEBOUNCE = 200;
7413
7615
  var DEFAULT_CHIP_CLASS = "outline-1 outline-muted bg-muted/40 text-foreground";
7414
7616
  var TokenView = ({ node, editor, getPos }) => {
7415
- const [isFocused, setIsFocused] = React25__namespace.default.useState(false);
7416
- React25__namespace.default.useEffect(() => {
7617
+ const [isFocused, setIsFocused] = React27__namespace.default.useState(false);
7618
+ React27__namespace.default.useEffect(() => {
7417
7619
  const handler = () => {
7418
7620
  const { from, to } = editor.state.selection;
7419
7621
  const position = getPos();
@@ -8400,21 +8602,21 @@ function ToolbarPlugin({
8400
8602
  acceptImageMimeTypes
8401
8603
  }) {
8402
8604
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
8403
- const [state, setState] = React25.useState(initialToolbarState);
8404
- const fileInputRef = React25.useRef(null);
8405
- const [isLinkDialogOpen, setLinkDialogOpen] = React25.useState(false);
8406
- const [editingExistingLink, setEditingExistingLink] = React25.useState(false);
8407
- const [linkNodeKey, setLinkNodeKey] = React25.useState(null);
8408
- const [isImageDialogOpen, setImageDialogOpen] = React25.useState(false);
8409
- const [editingExistingImage, setEditingExistingImage] = React25.useState(false);
8410
- const [imageNodeKey, setImageNodeKey] = React25.useState(null);
8605
+ const [state, setState] = React27.useState(initialToolbarState);
8606
+ const fileInputRef = React27.useRef(null);
8607
+ const [isLinkDialogOpen, setLinkDialogOpen] = React27.useState(false);
8608
+ const [editingExistingLink, setEditingExistingLink] = React27.useState(false);
8609
+ const [linkNodeKey, setLinkNodeKey] = React27.useState(null);
8610
+ const [isImageDialogOpen, setImageDialogOpen] = React27.useState(false);
8611
+ const [editingExistingImage, setEditingExistingImage] = React27.useState(false);
8612
+ const [imageNodeKey, setImageNodeKey] = React27.useState(null);
8411
8613
  const linkForm = reactHookForm.useForm({
8412
8614
  defaultValues: { url: "", label: "" }
8413
8615
  });
8414
8616
  const imageForm = reactHookForm.useForm({
8415
8617
  defaultValues: { url: "", alt: "", width: "", height: "" }
8416
8618
  });
8417
- const openImageDialog = React25.useCallback(() => {
8619
+ const openImageDialog = React27.useCallback(() => {
8418
8620
  if (disabled || !allowImageUrlInsert) {
8419
8621
  return;
8420
8622
  }
@@ -8448,7 +8650,7 @@ function ToolbarPlugin({
8448
8650
  setImageNodeKey(targetImage?.getKey() ?? null);
8449
8651
  setImageDialogOpen(true);
8450
8652
  }, [allowImageUrlInsert, disabled, editor, imageForm]);
8451
- const closeImageDialog = React25.useCallback(() => {
8653
+ const closeImageDialog = React27.useCallback(() => {
8452
8654
  setImageDialogOpen(false);
8453
8655
  setEditingExistingImage(false);
8454
8656
  setImageNodeKey(null);
@@ -8457,7 +8659,7 @@ function ToolbarPlugin({
8457
8659
  editor.focus();
8458
8660
  }, 0);
8459
8661
  }, [editor, imageForm]);
8460
- const openLinkDialog = React25.useCallback(() => {
8662
+ const openLinkDialog = React27.useCallback(() => {
8461
8663
  if (disabled) {
8462
8664
  return;
8463
8665
  }
@@ -8497,7 +8699,7 @@ function ToolbarPlugin({
8497
8699
  setLinkNodeKey(detectedLink?.getKey() ?? null);
8498
8700
  setLinkDialogOpen(true);
8499
8701
  }, [disabled, editor, linkForm]);
8500
- const closeLinkDialog = React25.useCallback(() => {
8702
+ const closeLinkDialog = React27.useCallback(() => {
8501
8703
  setLinkDialogOpen(false);
8502
8704
  setEditingExistingLink(false);
8503
8705
  setLinkNodeKey(null);
@@ -8538,7 +8740,7 @@ function ToolbarPlugin({
8538
8740
  });
8539
8741
  closeLinkDialog();
8540
8742
  });
8541
- const handleRemoveLink = React25.useCallback(() => {
8743
+ const handleRemoveLink = React27.useCallback(() => {
8542
8744
  editor.focus();
8543
8745
  editor.update(() => {
8544
8746
  if (linkNodeKey) {
@@ -8555,7 +8757,7 @@ function ToolbarPlugin({
8555
8757
  });
8556
8758
  closeLinkDialog();
8557
8759
  }, [closeLinkDialog, editor, linkNodeKey]);
8558
- const handleLinkDialogOpenChange = React25.useCallback(
8760
+ const handleLinkDialogOpenChange = React27.useCallback(
8559
8761
  (open) => {
8560
8762
  if (open) {
8561
8763
  setLinkDialogOpen(true);
@@ -8565,7 +8767,7 @@ function ToolbarPlugin({
8565
8767
  },
8566
8768
  [closeLinkDialog]
8567
8769
  );
8568
- const updateToolbar = React25.useCallback(() => {
8770
+ const updateToolbar = React27.useCallback(() => {
8569
8771
  const selection = lexical.$getSelection();
8570
8772
  if (!lexical.$isRangeSelection(selection)) {
8571
8773
  return;
@@ -8605,7 +8807,7 @@ function ToolbarPlugin({
8605
8807
  isLink: hasLink
8606
8808
  }));
8607
8809
  }, []);
8608
- React25__namespace.useEffect(() => {
8810
+ React27__namespace.useEffect(() => {
8609
8811
  return utils.mergeRegister(
8610
8812
  editor.registerCommand(
8611
8813
  lexical.CAN_UNDO_COMMAND,
@@ -8636,7 +8838,7 @@ function ToolbarPlugin({
8636
8838
  })
8637
8839
  );
8638
8840
  }, [editor, updateToolbar]);
8639
- const applyBlock = React25.useCallback(
8841
+ const applyBlock = React27.useCallback(
8640
8842
  (nextBlock) => {
8641
8843
  if (disabled) {
8642
8844
  return;
@@ -8698,7 +8900,7 @@ function ToolbarPlugin({
8698
8900
  },
8699
8901
  [disabled, editor, state.blockType]
8700
8902
  );
8701
- const toggleFormat = React25.useCallback(
8903
+ const toggleFormat = React27.useCallback(
8702
8904
  (format5) => {
8703
8905
  if (disabled) {
8704
8906
  return;
@@ -8707,10 +8909,10 @@ function ToolbarPlugin({
8707
8909
  },
8708
8910
  [disabled, editor]
8709
8911
  );
8710
- const toggleLink = React25.useCallback(() => {
8912
+ const toggleLink = React27.useCallback(() => {
8711
8913
  openLinkDialog();
8712
8914
  }, [openLinkDialog]);
8713
- const applyElementFormat = React25.useCallback(
8915
+ const applyElementFormat = React27.useCallback(
8714
8916
  (format5) => {
8715
8917
  if (disabled) {
8716
8918
  return;
@@ -8721,7 +8923,7 @@ function ToolbarPlugin({
8721
8923
  );
8722
8924
  const canInsertImage = allowImageUrlInsert || Boolean(onImageUpload);
8723
8925
  const imageAccept = acceptImageMimeTypes ?? DEFAULT_IMAGE_ACCEPT;
8724
- const handleInsertImage = React25.useCallback(() => {
8926
+ const handleInsertImage = React27.useCallback(() => {
8725
8927
  if (disabled || !canInsertImage) {
8726
8928
  return;
8727
8929
  }
@@ -8732,7 +8934,7 @@ function ToolbarPlugin({
8732
8934
  }
8733
8935
  openImageDialog();
8734
8936
  }, [canInsertImage, disabled, editor, onImageUpload, openImageDialog]);
8735
- const handleFileChange = React25.useCallback(
8937
+ const handleFileChange = React27.useCallback(
8736
8938
  async (event) => {
8737
8939
  if (!onImageUpload) {
8738
8940
  return;
@@ -8822,7 +9024,7 @@ function ToolbarPlugin({
8822
9024
  });
8823
9025
  closeImageDialog();
8824
9026
  });
8825
- const handleImageDialogOpenChange = React25.useCallback(
9027
+ const handleImageDialogOpenChange = React27.useCallback(
8826
9028
  (open) => {
8827
9029
  if (open) {
8828
9030
  setImageDialogOpen(true);
@@ -8832,7 +9034,7 @@ function ToolbarPlugin({
8832
9034
  },
8833
9035
  [closeImageDialog]
8834
9036
  );
8835
- const handleRemoveImage = React25.useCallback(() => {
9037
+ const handleRemoveImage = React27.useCallback(() => {
8836
9038
  if (!imageNodeKey) {
8837
9039
  closeImageDialog();
8838
9040
  return;
@@ -9191,7 +9393,7 @@ function ControlledValuePlugin({
9191
9393
  trackAppliedValue
9192
9394
  }) {
9193
9395
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
9194
- React25__namespace.useEffect(() => {
9396
+ React27__namespace.useEffect(() => {
9195
9397
  if (value == null || trackAppliedValue.current === value) {
9196
9398
  return;
9197
9399
  }
@@ -9215,14 +9417,14 @@ function ControlledValuePlugin({
9215
9417
  }
9216
9418
  function EditableStatePlugin({ editable }) {
9217
9419
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
9218
- React25__namespace.useEffect(() => {
9420
+ React27__namespace.useEffect(() => {
9219
9421
  editor.setEditable(editable);
9220
9422
  }, [editor, editable]);
9221
9423
  return null;
9222
9424
  }
9223
9425
  function ImagesPlugin() {
9224
9426
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
9225
- React25__namespace.useEffect(() => {
9427
+ React27__namespace.useEffect(() => {
9226
9428
  return editor.registerCommand(
9227
9429
  INSERT_IMAGE_COMMAND,
9228
9430
  (payload) => {
@@ -9241,7 +9443,7 @@ function ImagesPlugin() {
9241
9443
  }, [editor]);
9242
9444
  return null;
9243
9445
  }
9244
- var RichText = React25.forwardRef(function RichText2({
9446
+ var RichText = React27.forwardRef(function RichText2({
9245
9447
  value,
9246
9448
  defaultValue,
9247
9449
  onChange,
@@ -9260,11 +9462,11 @@ var RichText = React25.forwardRef(function RichText2({
9260
9462
  id,
9261
9463
  ...rest
9262
9464
  }, ref) {
9263
- const initialSerializedStateRef = React25.useRef(void 0);
9465
+ const initialSerializedStateRef = React27.useRef(void 0);
9264
9466
  if (initialSerializedStateRef.current === void 0) {
9265
9467
  initialSerializedStateRef.current = parseSerializedEditorState(value ?? defaultValue);
9266
9468
  }
9267
- const initialConfig = React25.useMemo(
9469
+ const initialConfig = React27.useMemo(
9268
9470
  () => ({
9269
9471
  namespace: "RichTextEditor",
9270
9472
  editable: !(readOnly || disabled),
@@ -9277,8 +9479,8 @@ var RichText = React25.forwardRef(function RichText2({
9277
9479
  }),
9278
9480
  [disabled, readOnly]
9279
9481
  );
9280
- const appliedValueRef = React25.useRef(value ?? defaultValue);
9281
- const handleChange = React25.useCallback(
9482
+ const appliedValueRef = React27.useRef(value ?? defaultValue);
9483
+ const handleChange = React27.useCallback(
9282
9484
  (editorState, editor) => {
9283
9485
  const serialized = JSON.stringify(editorState.toJSON());
9284
9486
  appliedValueRef.current = serialized;
@@ -9467,13 +9669,13 @@ function SheetDescription({
9467
9669
  );
9468
9670
  }
9469
9671
  function useIsMobile(breakpoint = 768) {
9470
- const [isMobile, setIsMobile] = React25.useState(() => {
9672
+ const [isMobile, setIsMobile] = React27.useState(() => {
9471
9673
  if (typeof window === "undefined") {
9472
9674
  return false;
9473
9675
  }
9474
9676
  return window.innerWidth < breakpoint;
9475
9677
  });
9476
- React25.useEffect(() => {
9678
+ React27.useEffect(() => {
9477
9679
  function onResize() {
9478
9680
  setIsMobile(window.innerWidth < breakpoint);
9479
9681
  }
@@ -9503,9 +9705,9 @@ var SIDEBAR_WIDTH = "16rem";
9503
9705
  var SIDEBAR_WIDTH_MOBILE = "18rem";
9504
9706
  var SIDEBAR_WIDTH_ICON = "3rem";
9505
9707
  var SIDEBAR_KEYBOARD_SHORTCUT = "b";
9506
- var SidebarContext = React25__namespace.createContext(null);
9708
+ var SidebarContext = React27__namespace.createContext(null);
9507
9709
  function useSidebar() {
9508
- const context = React25__namespace.useContext(SidebarContext);
9710
+ const context = React27__namespace.useContext(SidebarContext);
9509
9711
  if (!context) {
9510
9712
  throw new Error("useSidebar must be used within a SidebarProvider.");
9511
9713
  }
@@ -9521,10 +9723,10 @@ function SidebarProvider({
9521
9723
  ...props
9522
9724
  }) {
9523
9725
  const isMobile = useIsMobile();
9524
- const [openMobile, setOpenMobile] = React25__namespace.useState(false);
9525
- const [_open, _setOpen] = React25__namespace.useState(defaultOpen);
9726
+ const [openMobile, setOpenMobile] = React27__namespace.useState(false);
9727
+ const [_open, _setOpen] = React27__namespace.useState(defaultOpen);
9526
9728
  const open = openProp ?? _open;
9527
- const setOpen = React25__namespace.useCallback(
9729
+ const setOpen = React27__namespace.useCallback(
9528
9730
  (value) => {
9529
9731
  const openState = typeof value === "function" ? value(open) : value;
9530
9732
  if (setOpenProp) {
@@ -9536,10 +9738,10 @@ function SidebarProvider({
9536
9738
  },
9537
9739
  [setOpenProp, open]
9538
9740
  );
9539
- const toggleSidebar = React25__namespace.useCallback(() => {
9741
+ const toggleSidebar = React27__namespace.useCallback(() => {
9540
9742
  return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
9541
9743
  }, [isMobile, setOpen, setOpenMobile]);
9542
- React25__namespace.useEffect(() => {
9744
+ React27__namespace.useEffect(() => {
9543
9745
  const handleKeyDown = (event) => {
9544
9746
  if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
9545
9747
  event.preventDefault();
@@ -9550,7 +9752,7 @@ function SidebarProvider({
9550
9752
  return () => window.removeEventListener("keydown", handleKeyDown);
9551
9753
  }, [toggleSidebar]);
9552
9754
  const state = open ? "expanded" : "collapsed";
9553
- const contextValue = React25__namespace.useMemo(
9755
+ const contextValue = React27__namespace.useMemo(
9554
9756
  () => ({
9555
9757
  state,
9556
9758
  open,
@@ -9992,7 +10194,7 @@ function SidebarMenuSkeleton({
9992
10194
  showIcon = false,
9993
10195
  ...props
9994
10196
  }) {
9995
- const width = React25__namespace.useMemo(() => {
10197
+ const width = React27__namespace.useMemo(() => {
9996
10198
  return `${Math.floor(Math.random() * 40) + 50}%`;
9997
10199
  }, []);
9998
10200
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -10135,8 +10337,8 @@ function TooltipProvider({
10135
10337
  }) {
10136
10338
  return /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Provider, { "data-slot": "tooltip-provider", delayDuration, ...props });
10137
10339
  }
10138
- function Tooltip({ ...props }) {
10139
- return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Root, { "data-slot": "tooltip", ...props }) });
10340
+ function Tooltip({ children, ...props }) {
10341
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Root, { "data-slot": "tooltip", ...props, children }) });
10140
10342
  }
10141
10343
  function TooltipTrigger({ ...props }) {
10142
10344
  return /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Trigger, { "data-slot": "tooltip-trigger", ...props });
@@ -10257,10 +10459,10 @@ var FormulaEditor = ({
10257
10459
  fieldState,
10258
10460
  mode = "edit"
10259
10461
  }) => {
10260
- const [isExpanded, setIsExpanded] = React25.useState(false);
10261
- const lastEmittedValueRef = React25.useRef(null);
10262
- const ignorePropValueRef = React25.useRef(false);
10263
- const normalizedConfigs = React25.useMemo(() => {
10462
+ const [isExpanded, setIsExpanded] = React27.useState(false);
10463
+ const lastEmittedValueRef = React27.useRef(null);
10464
+ const ignorePropValueRef = React27.useRef(false);
10465
+ const normalizedConfigs = React27.useMemo(() => {
10264
10466
  const configsToUse = tokenConfigs?.length ? tokenConfigs : DEFAULT_TOKEN_CONFIGS;
10265
10467
  return configsToUse.map((config) => ({
10266
10468
  ...config,
@@ -10269,18 +10471,18 @@ var FormulaEditor = ({
10269
10471
  outputType: config.outputType ?? config.type
10270
10472
  }));
10271
10473
  }, [tokenConfigs]);
10272
- const prefixMap = React25.useMemo(() => buildPrefixMap(normalizedConfigs), [normalizedConfigs]);
10273
- const configLookup = React25.useMemo(() => {
10474
+ const prefixMap = React27.useMemo(() => buildPrefixMap(normalizedConfigs), [normalizedConfigs]);
10475
+ const configLookup = React27.useMemo(() => {
10274
10476
  const lookup = /* @__PURE__ */ new Map();
10275
10477
  normalizedConfigs.forEach((config) => lookup.set(config.prefix, config));
10276
10478
  return lookup;
10277
10479
  }, [normalizedConfigs]);
10278
- const allowedOperators = React25.useMemo(() => operators.map((operator) => operator.value), [operators]);
10480
+ const allowedOperators = React27.useMemo(() => operators.map((operator) => operator.value), [operators]);
10279
10481
  const displayError = errorMessage ?? fieldState?.error?.message;
10280
10482
  const hasError = Boolean(displayError);
10281
10483
  const isEditorReadOnly = mode === "display";
10282
10484
  const isEditorDisabled = disabled || loading || isEditorReadOnly;
10283
- const convertValueToContent = React25.useCallback(
10485
+ const convertValueToContent = React27.useCallback(
10284
10486
  (input) => {
10285
10487
  if (!input) return "";
10286
10488
  const trimmed = input.trim();
@@ -10292,8 +10494,8 @@ var FormulaEditor = ({
10292
10494
  },
10293
10495
  [configLookup, prefixMap]
10294
10496
  );
10295
- const resolvedContent = React25.useMemo(() => convertValueToContent(value), [convertValueToContent, value]);
10296
- const extensions = React25.useMemo(
10497
+ const resolvedContent = React27.useMemo(() => convertValueToContent(value), [convertValueToContent, value]);
10498
+ const extensions = React27.useMemo(
10297
10499
  () => [
10298
10500
  StarterKit__default.default.configure({ bold: false, italic: false }),
10299
10501
  Token.configure({ configs: normalizedConfigs, onSelect: onSelectSuggestion }),
@@ -10325,11 +10527,11 @@ var FormulaEditor = ({
10325
10527
  }
10326
10528
  }
10327
10529
  });
10328
- React25.useEffect(() => {
10530
+ React27.useEffect(() => {
10329
10531
  if (!editor) return;
10330
10532
  editor.setEditable(!isEditorDisabled);
10331
10533
  }, [editor, isEditorDisabled]);
10332
- React25.useEffect(() => {
10534
+ React27.useEffect(() => {
10333
10535
  if (!editor || resolvedContent === void 0) return;
10334
10536
  if (ignorePropValueRef.current && typeof value === "string" && value === lastEmittedValueRef.current) {
10335
10537
  ignorePropValueRef.current = false;
@@ -10462,7 +10664,7 @@ function SortableRow({
10462
10664
  id: value,
10463
10665
  disabled: name === "columns.0.id"
10464
10666
  });
10465
- const style = React25__namespace.useMemo(
10667
+ const style = React27__namespace.useMemo(
10466
10668
  () => ({
10467
10669
  transform: utilities.CSS.Transform.toString(transform),
10468
10670
  transition
@@ -10574,8 +10776,8 @@ var GridSettingsModal = ({
10574
10776
  onClose,
10575
10777
  onSaveColumns
10576
10778
  }) => {
10577
- const [isDragging, setIsDragging] = React25.useState(false);
10578
- const scrollRef = React25.useRef(null);
10779
+ const [isDragging, setIsDragging] = React27.useState(false);
10780
+ const scrollRef = React27.useRef(null);
10579
10781
  const form = reactHookForm.useForm({
10580
10782
  resolver: zod$1.zodResolver(GridSettingsSchema),
10581
10783
  defaultValues: { columns: currentColumns },
@@ -10587,7 +10789,7 @@ var GridSettingsModal = ({
10587
10789
  name: "columns",
10588
10790
  keyName: "fieldId"
10589
10791
  });
10590
- React25.useEffect(() => {
10792
+ React27.useEffect(() => {
10591
10793
  if (isOpen) {
10592
10794
  form.reset({ columns: currentColumns });
10593
10795
  }
@@ -10864,7 +11066,7 @@ function getCandidateWidths({
10864
11066
  }
10865
11067
  return DEVICE_SIZES;
10866
11068
  }
10867
- var Image2 = React25__namespace.forwardRef(function Image3({
11069
+ var Image2 = React27__namespace.forwardRef(function Image3({
10868
11070
  src,
10869
11071
  alt,
10870
11072
  width,
@@ -10894,34 +11096,34 @@ var Image2 = React25__namespace.forwardRef(function Image3({
10894
11096
  } = imgProps;
10895
11097
  const widthNumber = toNumber(width);
10896
11098
  const heightNumber = toNumber(height);
10897
- React25__namespace.useEffect(() => {
11099
+ React27__namespace.useEffect(() => {
10898
11100
  if (!fill && (!widthNumber || !heightNumber)) {
10899
11101
  console.warn(
10900
11102
  "[Image] When `fill` is false you should provide both `width` and `height` to prevent layout shifts."
10901
11103
  );
10902
11104
  }
10903
11105
  }, [fill, heightNumber, widthNumber]);
10904
- const candidateWidths = React25__namespace.useMemo(
11106
+ const candidateWidths = React27__namespace.useMemo(
10905
11107
  () => getCandidateWidths({ width: widthNumber, sizes, fill }),
10906
11108
  [fill, sizes, widthNumber]
10907
11109
  );
10908
11110
  const largestWidth = candidateWidths[candidateWidths.length - 1] ?? widthNumber ?? DEVICE_SIZES[DEVICE_SIZES.length - 1];
10909
- const computedSrc = React25__namespace.useMemo(() => {
11111
+ const computedSrc = React27__namespace.useMemo(() => {
10910
11112
  if (unoptimized) {
10911
11113
  return src;
10912
11114
  }
10913
11115
  return loader({ src, width: largestWidth, quality });
10914
11116
  }, [largestWidth, loader, quality, src, unoptimized]);
10915
- const computedSrcSet = React25__namespace.useMemo(() => {
11117
+ const computedSrcSet = React27__namespace.useMemo(() => {
10916
11118
  if (unoptimized) {
10917
11119
  return void 0;
10918
11120
  }
10919
11121
  return candidateWidths.map((currentWidth) => `${loader({ src, width: currentWidth, quality })} ${currentWidth}w`).join(", ");
10920
11122
  }, [candidateWidths, loader, quality, src, unoptimized]);
10921
11123
  const sizesValue = sizes ?? (fill ? "100vw" : widthNumber ? `${widthNumber}px` : void 0);
10922
- const [isLoaded, setIsLoaded] = React25__namespace.useState(false);
10923
- const internalRef = React25__namespace.useRef(null);
10924
- const setRefs = React25__namespace.useCallback(
11124
+ const [isLoaded, setIsLoaded] = React27__namespace.useState(false);
11125
+ const internalRef = React27__namespace.useRef(null);
11126
+ const setRefs = React27__namespace.useCallback(
10925
11127
  (node) => {
10926
11128
  internalRef.current = node;
10927
11129
  if (!ref) {
@@ -10935,7 +11137,7 @@ var Image2 = React25__namespace.forwardRef(function Image3({
10935
11137
  },
10936
11138
  [ref]
10937
11139
  );
10938
- React25__namespace.useEffect(() => {
11140
+ React27__namespace.useEffect(() => {
10939
11141
  const image = internalRef.current;
10940
11142
  if (!image) {
10941
11143
  return;
@@ -10947,7 +11149,7 @@ var Image2 = React25__namespace.forwardRef(function Image3({
10947
11149
  setIsLoaded(false);
10948
11150
  }
10949
11151
  }, [onLoadingComplete, src]);
10950
- const handleLoad = React25__namespace.useCallback(
11152
+ const handleLoad = React27__namespace.useCallback(
10951
11153
  (event) => {
10952
11154
  setIsLoaded(true);
10953
11155
  onLoadProp?.(event);
@@ -10959,7 +11161,7 @@ var Image2 = React25__namespace.forwardRef(function Image3({
10959
11161
  const fetchPriority = priority ? "high" : fetchPriorityProp;
10960
11162
  const decoding = decodingProp ?? "async";
10961
11163
  const resolvedObjectFit = objectFit ?? (fill ? "cover" : void 0);
10962
- const wrapperStyle = React25__namespace.useMemo(
11164
+ const wrapperStyle = React27__namespace.useMemo(
10963
11165
  () => ({
10964
11166
  position: "relative",
10965
11167
  display: fill ? "block" : "inline-block",
@@ -10969,7 +11171,7 @@ var Image2 = React25__namespace.forwardRef(function Image3({
10969
11171
  }),
10970
11172
  [fill, height, width]
10971
11173
  );
10972
- const imageStyle = React25__namespace.useMemo(
11174
+ const imageStyle = React27__namespace.useMemo(
10973
11175
  () => ({
10974
11176
  width: fill ? "100%" : formatDimension(width) ?? void 0,
10975
11177
  height: fill ? "100%" : formatDimension(height) ?? void 0,
@@ -11118,7 +11320,7 @@ var InfoIcon = ({ size = "1em", className, ...props }) => {
11118
11320
  }
11119
11321
  );
11120
11322
  };
11121
- var InfoIcon_default = React25__namespace.default.memo(InfoIcon);
11323
+ var InfoIcon_default = React27__namespace.default.memo(InfoIcon);
11122
11324
  var Navbar = ({
11123
11325
  className,
11124
11326
  title,
@@ -11143,7 +11345,7 @@ var Navbar = ({
11143
11345
  }) => {
11144
11346
  const { isMobile, isTablet, isDesktop } = useScreenSize_default();
11145
11347
  const Icon2 = lucideReact.CircleHelp;
11146
- const shouldShowSeparator = !separatorDisable && React25.isValidElement(searchButton);
11348
+ const shouldShowSeparator = !separatorDisable && React27.isValidElement(searchButton);
11147
11349
  return /* @__PURE__ */ jsxRuntime.jsxs(
11148
11350
  "nav",
11149
11351
  {
@@ -11154,8 +11356,8 @@ var Navbar = ({
11154
11356
  children: [
11155
11357
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5", children: [
11156
11358
  headImageURL !== "" ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: headImageURL, alt: "", className: cn("w-full h-full", headImageURLClassName) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
11157
- React25.isValidElement(title) ? title : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-xl font-bold", children: title }),
11158
- React25.isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
11359
+ React27.isValidElement(title) ? title : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-xl font-bold", children: title }),
11360
+ React27.isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
11159
11361
  ] }),
11160
11362
  tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
11161
11363
  /* @__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" }) }) }),
@@ -11186,10 +11388,10 @@ var Navbar = ({
11186
11388
  ),
11187
11389
  children: [
11188
11390
  tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
11189
- React25.isValidElement(tooltipIcon) ? tooltipIcon : /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 32, "aria-hidden": "true" }),
11391
+ React27.isValidElement(tooltipIcon) ? tooltipIcon : /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 32, "aria-hidden": "true" }),
11190
11392
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-bold", children: tooltipTitle })
11191
11393
  ] }),
11192
- React25.isValidElement(tooltipdescription) && tooltipdescription
11394
+ React27.isValidElement(tooltipdescription) && tooltipdescription
11193
11395
  ]
11194
11396
  }
11195
11397
  ),
@@ -11244,13 +11446,13 @@ var Navbar = ({
11244
11446
  }
11245
11447
  ),
11246
11448
  shouldShowSeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "separator", className: "ml-1 w-[1px] h-10 bg-white" }),
11247
- React25.isValidElement(searchButton) ? searchButton : ""
11449
+ React27.isValidElement(searchButton) ? searchButton : ""
11248
11450
  ] })
11249
11451
  ]
11250
11452
  }
11251
11453
  );
11252
11454
  };
11253
- var navbar_default = React25__namespace.default.memo(Navbar);
11455
+ var navbar_default = React27__namespace.default.memo(Navbar);
11254
11456
  var usePreventPageLeaveStore = zustand.create((set) => ({
11255
11457
  isPreventing: false,
11256
11458
  setPreventing: (value) => set({ isPreventing: value })
@@ -11260,7 +11462,7 @@ var usePreventPageLeaveStore_default = usePreventPageLeaveStore;
11260
11462
  // src/components/prevent-page-leave/PreventPageLeave.tsx
11261
11463
  var PreventPageLeave = ({ children }) => {
11262
11464
  const { isPreventing } = usePreventPageLeaveStore();
11263
- React25.useEffect(() => {
11465
+ React27.useEffect(() => {
11264
11466
  if (!isPreventing || typeof window === "undefined") {
11265
11467
  return;
11266
11468
  }
@@ -11278,7 +11480,7 @@ var PreventPageLeave = ({ children }) => {
11278
11480
  var PreventPageLeave_default = PreventPageLeave;
11279
11481
  var usePreventPageLeave = ({ isPrevening }) => {
11280
11482
  const setPreventing = usePreventPageLeaveStore_default((state) => state.setPreventing);
11281
- React25.useEffect(() => {
11483
+ React27.useEffect(() => {
11282
11484
  setPreventing(isPrevening);
11283
11485
  }, [isPrevening, setPreventing]);
11284
11486
  };
@@ -11289,25 +11491,40 @@ var DefaultHeader = ({
11289
11491
  icon,
11290
11492
  classNames,
11291
11493
  rightActions
11292
- }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-start justify-between gap-3", classNames?.header), children: [
11293
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
11294
- icon ? /* @__PURE__ */ jsxRuntime.jsx(
11295
- "div",
11296
- {
11297
- className: cn(
11298
- "w-10 h-10 rounded-full bg-sus-green-50 flex items-center justify-center",
11299
- classNames?.iconWrapper
11300
- ),
11301
- children: icon
11302
- }
11303
- ) : null,
11304
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
11305
- subtitle ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-xs text-gray-500", classNames?.subtitle), children: subtitle }) : null,
11306
- title ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-lg font-semibold text-sus-green-1", classNames?.title), children: title }) : null
11307
- ] })
11308
- ] }),
11309
- rightActions ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: rightActions }) : null
11310
- ] });
11494
+ }) => {
11495
+ const titleRef = React27__namespace.useRef(null);
11496
+ const isTruncated = useTruncated_default({ elementRef: titleRef });
11497
+ const textElement = title ? /* @__PURE__ */ jsxRuntime.jsx(
11498
+ "span",
11499
+ {
11500
+ ref: titleRef,
11501
+ className: cn("text-lg font-semibold text-sus-green-1 truncate", classNames?.title),
11502
+ children: title
11503
+ }
11504
+ ) : null;
11505
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-start justify-between gap-3", classNames?.header), children: [
11506
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 min-w-0", children: [
11507
+ icon ? /* @__PURE__ */ jsxRuntime.jsx(
11508
+ "div",
11509
+ {
11510
+ className: cn(
11511
+ "w-10 h-10 rounded-full bg-sus-green-50 flex items-center justify-center",
11512
+ classNames?.iconWrapper
11513
+ ),
11514
+ children: icon
11515
+ }
11516
+ ) : null,
11517
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0", children: [
11518
+ subtitle ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-xs text-gray-500", classNames?.subtitle), children: subtitle }) : null,
11519
+ textElement ? isTruncated ? /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
11520
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: textElement }),
11521
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: title })
11522
+ ] }) : textElement : null
11523
+ ] })
11524
+ ] }),
11525
+ rightActions ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: rightActions }) : null
11526
+ ] });
11527
+ };
11311
11528
  var RightPanelContainer = ({
11312
11529
  title,
11313
11530
  subtitle,
@@ -11331,19 +11548,28 @@ var RightPanelContainer = ({
11331
11548
  className,
11332
11549
  classNames?.root
11333
11550
  ),
11334
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex-1 flex min-h-0 px-4 py-6 justify-center", classNames?.body), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("w-full max-w-3xl overflow-auto", classNames?.content), children: [
11335
- renderHeader ? renderHeader({ title, subtitle, icon, rightActions, classNames }) : Header2 ? /* @__PURE__ */ jsxRuntime.jsx(
11336
- Header2,
11337
- {
11338
- title,
11339
- subtitle,
11340
- icon,
11341
- rightActions,
11342
- classNames
11343
- }
11344
- ) : null,
11345
- children
11346
- ] }) })
11551
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex-1 flex min-h-0 min-w-0 px-4 py-6 justify-center", classNames?.body), children: /* @__PURE__ */ jsxRuntime.jsxs(
11552
+ "div",
11553
+ {
11554
+ className: cn(
11555
+ "w-full max-w-3xl min-w-0 overflow-x-hidden overflow-y-auto",
11556
+ classNames?.content
11557
+ ),
11558
+ children: [
11559
+ renderHeader ? renderHeader({ title, subtitle, icon, rightActions, classNames }) : Header2 ? /* @__PURE__ */ jsxRuntime.jsx(
11560
+ Header2,
11561
+ {
11562
+ title,
11563
+ subtitle,
11564
+ icon,
11565
+ rightActions,
11566
+ classNames
11567
+ }
11568
+ ) : null,
11569
+ children
11570
+ ]
11571
+ }
11572
+ ) })
11347
11573
  }
11348
11574
  );
11349
11575
  };
@@ -11484,20 +11710,20 @@ var CropperModal = ({
11484
11710
  title,
11485
11711
  props
11486
11712
  }) => {
11487
- const [isLoading, setIsLoading] = React25.useState(false);
11488
- const [crop, setCrop] = React25.useState({ x: 0, y: 0 });
11489
- const [zoom, setZoom] = React25.useState();
11490
- const [croppedAreaPixels, setCroppedAreaPixels] = React25.useState(null);
11491
- const handleClose = React25.useCallback(() => {
11713
+ const [isLoading, setIsLoading] = React27.useState(false);
11714
+ const [crop, setCrop] = React27.useState({ x: 0, y: 0 });
11715
+ const [zoom, setZoom] = React27.useState();
11716
+ const [croppedAreaPixels, setCroppedAreaPixels] = React27.useState(null);
11717
+ const handleClose = React27.useCallback(() => {
11492
11718
  onOpenChange(false);
11493
11719
  }, [onOpenChange]);
11494
- const handleCancel = React25.useCallback(() => {
11720
+ const handleCancel = React27.useCallback(() => {
11495
11721
  if (onCancel) {
11496
11722
  onCancel();
11497
11723
  }
11498
11724
  handleClose();
11499
11725
  }, [handleClose, onCancel]);
11500
- const handleCropComplete = React25.useCallback((_, croppedAreaPixels2) => {
11726
+ const handleCropComplete = React27.useCallback((_, croppedAreaPixels2) => {
11501
11727
  setCroppedAreaPixels(croppedAreaPixels2);
11502
11728
  }, []);
11503
11729
  const handleConfirm = async () => {
@@ -11605,7 +11831,7 @@ function isFragment(object) {
11605
11831
  var isValidText = (val) => ["string", "number"].includes(typeof val);
11606
11832
  function toArray(children, option = {}) {
11607
11833
  let ret = [];
11608
- React25__namespace.Children.forEach(children, (child) => {
11834
+ React27__namespace.Children.forEach(children, (child) => {
11609
11835
  if ((child === void 0 || child === null) && !option.keepEmpty) {
11610
11836
  return;
11611
11837
  }
@@ -11619,9 +11845,9 @@ function toArray(children, option = {}) {
11619
11845
  });
11620
11846
  return ret;
11621
11847
  }
11622
- var MeasureText = React25__namespace.forwardRef(({ style, children }, ref) => {
11623
- const spanRef = React25__namespace.useRef(null);
11624
- React25__namespace.useImperativeHandle(ref, () => ({
11848
+ var MeasureText = React27__namespace.forwardRef(({ style, children }, ref) => {
11849
+ const spanRef = React27__namespace.useRef(null);
11850
+ React27__namespace.useImperativeHandle(ref, () => ({
11625
11851
  isExceed: () => {
11626
11852
  const span = spanRef.current;
11627
11853
  return span.scrollHeight > span.clientHeight;
@@ -11679,19 +11905,19 @@ var lineClipStyle = {
11679
11905
  };
11680
11906
  function EllipsisMeasure(props) {
11681
11907
  const { enableMeasure, width, text, children, rows, expanded, miscDeps, onEllipsis } = props;
11682
- const nodeList = React25__namespace.useMemo(() => toArray(text), [text]);
11683
- const nodeLen = React25__namespace.useMemo(() => getNodesLen(nodeList), [text]);
11684
- const fullContent = React25__namespace.useMemo(() => children(nodeList, false), [text]);
11685
- const [ellipsisCutIndex, setEllipsisCutIndex] = React25__namespace.useState(null);
11686
- const cutMidRef = React25__namespace.useRef(null);
11687
- const measureWhiteSpaceRef = React25__namespace.useRef(null);
11688
- const needEllipsisRef = React25__namespace.useRef(null);
11689
- const descRowsEllipsisRef = React25__namespace.useRef(null);
11690
- const symbolRowEllipsisRef = React25__namespace.useRef(null);
11691
- const [canEllipsis, setCanEllipsis] = React25__namespace.useState(false);
11692
- const [needEllipsis, setNeedEllipsis] = React25__namespace.useState(STATUS_MEASURE_NONE);
11693
- const [ellipsisHeight, setEllipsisHeight] = React25__namespace.useState(0);
11694
- const [parentWhiteSpace, setParentWhiteSpace] = React25__namespace.useState(null);
11908
+ const nodeList = React27__namespace.useMemo(() => toArray(text), [text]);
11909
+ const nodeLen = React27__namespace.useMemo(() => getNodesLen(nodeList), [text]);
11910
+ const fullContent = React27__namespace.useMemo(() => children(nodeList, false), [text]);
11911
+ const [ellipsisCutIndex, setEllipsisCutIndex] = React27__namespace.useState(null);
11912
+ const cutMidRef = React27__namespace.useRef(null);
11913
+ const measureWhiteSpaceRef = React27__namespace.useRef(null);
11914
+ const needEllipsisRef = React27__namespace.useRef(null);
11915
+ const descRowsEllipsisRef = React27__namespace.useRef(null);
11916
+ const symbolRowEllipsisRef = React27__namespace.useRef(null);
11917
+ const [canEllipsis, setCanEllipsis] = React27__namespace.useState(false);
11918
+ const [needEllipsis, setNeedEllipsis] = React27__namespace.useState(STATUS_MEASURE_NONE);
11919
+ const [ellipsisHeight, setEllipsisHeight] = React27__namespace.useState(0);
11920
+ const [parentWhiteSpace, setParentWhiteSpace] = React27__namespace.useState(null);
11695
11921
  useIsomorphicLayoutEffect(() => {
11696
11922
  if (enableMeasure && width && nodeLen) {
11697
11923
  setNeedEllipsis(STATUS_MEASURE_PREPARE);
@@ -11734,7 +11960,7 @@ function EllipsisMeasure(props) {
11734
11960
  setEllipsisCutIndex(isOverflow ? [minIndex, targetMidIndex] : [targetMidIndex, maxIndex]);
11735
11961
  }
11736
11962
  }, [ellipsisCutIndex, cutMidIndex]);
11737
- const finalContent = React25__namespace.useMemo(() => {
11963
+ const finalContent = React27__namespace.useMemo(() => {
11738
11964
  if (!enableMeasure) {
11739
11965
  return children(nodeList, false);
11740
11966
  }
@@ -11825,10 +12051,10 @@ var Truncated = ({
11825
12051
  tooltipProps,
11826
12052
  tooltipContentProps
11827
12053
  }) => {
11828
- const elementRef = React25__namespace.useRef(null);
11829
- const [open, setOpen] = React25__namespace.useState(false);
11830
- const [isTruncated, setIsTruncated] = React25__namespace.useState(false);
11831
- const [measureWidth, setMeasureWidth] = React25__namespace.useState(0);
12054
+ const elementRef = React27__namespace.useRef(null);
12055
+ const [open, setOpen] = React27__namespace.useState(false);
12056
+ const [isTruncated, setIsTruncated] = React27__namespace.useState(false);
12057
+ const [measureWidth, setMeasureWidth] = React27__namespace.useState(0);
11832
12058
  const Comp = as;
11833
12059
  const normalizedChildren = typeof children === "string" ? children.replace(/>/g, ">\u200B") : children;
11834
12060
  const lineClampLines = typeof ellipsis === "number" ? ellipsis : typeof ellipsis === "object" ? ellipsis?.lineClamp ?? 3 : null;
@@ -11853,13 +12079,13 @@ var Truncated = ({
11853
12079
  setIsTruncated(false);
11854
12080
  }
11855
12081
  }, [enableMeasure]);
11856
- const truncationClass = React25__namespace.useMemo(() => {
12082
+ const truncationClass = React27__namespace.useMemo(() => {
11857
12083
  if (!ellipsis) return "";
11858
12084
  if (typeof ellipsis === "number") return `line-clamp-${ellipsis}`;
11859
12085
  if (typeof ellipsis === "object") return `line-clamp-${lineClampLines ?? 3}`;
11860
12086
  return "truncate";
11861
12087
  }, [ellipsis, lineClampLines]);
11862
- const clampedStyle = React25__namespace.useMemo(() => {
12088
+ const clampedStyle = React27__namespace.useMemo(() => {
11863
12089
  if (!lineClampLines) return style;
11864
12090
  return {
11865
12091
  ...style,
@@ -11921,7 +12147,7 @@ var Truncated = ({
11921
12147
  );
11922
12148
  };
11923
12149
  var truncated_default = Truncated;
11924
- var InputPrimitive2 = React25__namespace.forwardRef(
12150
+ var InputPrimitive2 = React27__namespace.forwardRef(
11925
12151
  ({ className, type = "text", ...props }, ref) => {
11926
12152
  return /* @__PURE__ */ jsxRuntime.jsx(
11927
12153
  "input",
@@ -11960,7 +12186,7 @@ var inputVariants2 = classVarianceAuthority.cva("", {
11960
12186
  appearance: "filled"
11961
12187
  }
11962
12188
  });
11963
- var Input2 = React25__namespace.forwardRef(
12189
+ var Input2 = React27__namespace.forwardRef(
11964
12190
  ({
11965
12191
  className,
11966
12192
  wrapperClassName,
@@ -11993,8 +12219,8 @@ var Input2 = React25__namespace.forwardRef(
11993
12219
  onChange: onChangeProp
11994
12220
  } = rest;
11995
12221
  const ariaInvalid = invalid ?? ariaInvalidProp;
11996
- const messageId = React25__namespace.useId();
11997
- const handleChange = React25__namespace.useCallback(
12222
+ const messageId = React27__namespace.useId();
12223
+ const handleChange = React27__namespace.useCallback(
11998
12224
  (event) => {
11999
12225
  onChangeProp?.(event);
12000
12226
  onValueChange?.(event.target.value);
@@ -12088,16 +12314,16 @@ var InputNumber = ({ customInputProps, ...props }) => {
12088
12314
  return /* @__PURE__ */ jsxRuntime.jsx(reactNumberFormat.NumericFormat, { customInput: Input2, ...props, ...customInputProps });
12089
12315
  };
12090
12316
  var InputNumber_default = InputNumber;
12091
- var ActionButton = ({ label, onPress, className }) => {
12092
- const disabled = onPress === void 0;
12317
+ var ActionButton = ({ label, onPress, disabled, className }) => {
12318
+ const isDisabled = disabled || onPress === void 0;
12093
12319
  return /* @__PURE__ */ jsxRuntime.jsx(
12094
12320
  "button",
12095
12321
  {
12096
12322
  type: "button",
12097
- disabled,
12323
+ disabled: isDisabled,
12098
12324
  onClick: (e) => {
12099
12325
  e.stopPropagation();
12100
- if (disabled) {
12326
+ if (isDisabled || !onPress) {
12101
12327
  return;
12102
12328
  }
12103
12329
  onPress();
@@ -12105,7 +12331,7 @@ var ActionButton = ({ label, onPress, className }) => {
12105
12331
  className: cn(
12106
12332
  "action-menu-btn flex w-full items-center justify-start px-4 py-3 text-left",
12107
12333
  "hover:bg-sus-secondary-green-3 hover:not-disabled:text-sus-primary-green-9 text-gray-800",
12108
- disabled && "cursor-not-allowed opacity-50 hover:bg-transparent text-gray-400",
12334
+ isDisabled && "cursor-not-allowed opacity-50 hover:bg-transparent text-gray-400",
12109
12335
  className
12110
12336
  ),
12111
12337
  children: label
@@ -12122,8 +12348,8 @@ var ActionMenu = ({
12122
12348
  actionButtonClassName,
12123
12349
  separatorClassName
12124
12350
  }) => {
12125
- const [open, setOpen] = React25.useState(false);
12126
- const isAllowed = React25.useCallback(
12351
+ const [open, setOpen] = React27.useState(false);
12352
+ const isAllowed = React27.useCallback(
12127
12353
  (requiredPermission) => {
12128
12354
  if (!checkPermissionFunc || requiredPermission === void 0) {
12129
12355
  return true;
@@ -12132,7 +12358,7 @@ var ActionMenu = ({
12132
12358
  },
12133
12359
  [checkPermissionFunc]
12134
12360
  );
12135
- const filteredButtons = React25.useMemo(() => {
12361
+ const filteredButtons = React27.useMemo(() => {
12136
12362
  return buttons.filter((btn) => isAllowed(btn.requiredPermission));
12137
12363
  }, [buttons, isAllowed]);
12138
12364
  if (buttons.length === 0) {
@@ -12168,6 +12394,7 @@ var ActionMenu = ({
12168
12394
  {
12169
12395
  className: actionButtonClassName,
12170
12396
  label: btn.label,
12397
+ disabled: btn.disabled,
12171
12398
  onPress: btn.onPress ? () => {
12172
12399
  btn.onPress?.(id);
12173
12400
  setOpen(false);
@@ -12387,13 +12614,13 @@ var useFieldNames = ({
12387
12614
  fieldNames
12388
12615
  }) => {
12389
12616
  const { label: labelFieldKey = "label", value: valueFieldKey = "value" } = fieldNames || {};
12390
- const getLabelField = React25__namespace.default.useCallback(
12617
+ const getLabelField = React27__namespace.default.useCallback(
12391
12618
  (option) => {
12392
12619
  return option?.[labelFieldKey];
12393
12620
  },
12394
12621
  [labelFieldKey]
12395
12622
  );
12396
- const getValueField = React25__namespace.default.useCallback(
12623
+ const getValueField = React27__namespace.default.useCallback(
12397
12624
  (option) => {
12398
12625
  return option?.[valueFieldKey];
12399
12626
  },
@@ -12425,11 +12652,11 @@ var VirtualizedCommand = ({
12425
12652
  onFocus
12426
12653
  }) => {
12427
12654
  const { getLabelField, getValueField } = useFieldNames_default({ fieldNames });
12428
- const internalOptions = React25__namespace.useMemo(() => options ?? [], [options]);
12429
- const [filteredOptions, setFilteredOptions] = React25__namespace.useState(internalOptions);
12430
- const [focusedIndex, setFocusedIndex] = React25__namespace.useState(0);
12431
- const [isKeyboardNavActive, setIsKeyboardNavActive] = React25__namespace.useState(false);
12432
- const parentRef = React25__namespace.useRef(null);
12655
+ const internalOptions = React27__namespace.useMemo(() => options ?? [], [options]);
12656
+ const [filteredOptions, setFilteredOptions] = React27__namespace.useState(internalOptions);
12657
+ const [focusedIndex, setFocusedIndex] = React27__namespace.useState(0);
12658
+ const [isKeyboardNavActive, setIsKeyboardNavActive] = React27__namespace.useState(false);
12659
+ const parentRef = React27__namespace.useRef(null);
12433
12660
  const virtualizer = reactVirtual.useVirtualizer({
12434
12661
  count: filteredOptions.length,
12435
12662
  getScrollElement: () => parentRef.current,
@@ -12437,14 +12664,14 @@ var VirtualizedCommand = ({
12437
12664
  overscan: 2
12438
12665
  });
12439
12666
  const virtualOptions = virtualizer.getVirtualItems();
12440
- const dynamicHeight = React25__namespace.useMemo(() => {
12667
+ const dynamicHeight = React27__namespace.useMemo(() => {
12441
12668
  const contentHeight = filteredOptions.length * ROW_HEIGHT;
12442
12669
  if (contentHeight <= 0) {
12443
12670
  return MIN_HEIGHT_EMPTY;
12444
12671
  }
12445
12672
  return Math.max(ROW_HEIGHT, Math.min(height, contentHeight));
12446
12673
  }, [filteredOptions.length, height]);
12447
- const scrollToIndex = React25__namespace.useCallback(
12674
+ const scrollToIndex = React27__namespace.useCallback(
12448
12675
  (index) => {
12449
12676
  virtualizer.scrollToIndex(index, {
12450
12677
  align: "center"
@@ -12452,7 +12679,7 @@ var VirtualizedCommand = ({
12452
12679
  },
12453
12680
  [virtualizer]
12454
12681
  );
12455
- const handleSearch = React25__namespace.useCallback(
12682
+ const handleSearch = React27__namespace.useCallback(
12456
12683
  (search) => {
12457
12684
  setIsKeyboardNavActive(false);
12458
12685
  setFilteredOptions(
@@ -12467,7 +12694,7 @@ var VirtualizedCommand = ({
12467
12694
  },
12468
12695
  [filterOption, getLabelField, internalOptions]
12469
12696
  );
12470
- const handleKeyDown = React25__namespace.useCallback(
12697
+ const handleKeyDown = React27__namespace.useCallback(
12471
12698
  (event) => {
12472
12699
  switch (event.key) {
12473
12700
  case "ArrowDown": {
@@ -12502,7 +12729,7 @@ var VirtualizedCommand = ({
12502
12729
  },
12503
12730
  [filteredOptions, focusedIndex, getValueField, onSelect, scrollToIndex]
12504
12731
  );
12505
- React25__namespace.useEffect(() => {
12732
+ React27__namespace.useEffect(() => {
12506
12733
  if (value) {
12507
12734
  const option = filteredOptions.find((option2) => {
12508
12735
  const optionValue = getValueField(option2);
@@ -12629,13 +12856,13 @@ var ComboboxInner = ({
12629
12856
  defaultValue,
12630
12857
  value
12631
12858
  });
12632
- const currentSelectedOption = React25__namespace.useMemo(() => {
12859
+ const currentSelectedOption = React27__namespace.useMemo(() => {
12633
12860
  return options?.find((option) => {
12634
12861
  const optionValue = getValueField(option);
12635
12862
  return optionValue === selectedValue;
12636
12863
  });
12637
12864
  }, [getValueField, options, selectedValue]);
12638
- const renderValue = React25__namespace.useMemo(() => {
12865
+ const renderValue = React27__namespace.useMemo(() => {
12639
12866
  if (!selectedValue) return placeholder2;
12640
12867
  if (currentSelectedOption) {
12641
12868
  return getLabelField(currentSelectedOption);
@@ -12645,7 +12872,7 @@ var ComboboxInner = ({
12645
12872
  }
12646
12873
  return null;
12647
12874
  }, [currentSelectedOption, getLabelField, placeholder2, selectedValue, showValueWhenNoMatch]);
12648
- const handleSelect = React25__namespace.useCallback(
12875
+ const handleSelect = React27__namespace.useCallback(
12649
12876
  (selected, option) => {
12650
12877
  setSelectedValue(selected);
12651
12878
  setOpenPopover(false);
@@ -12658,7 +12885,7 @@ var ComboboxInner = ({
12658
12885
  },
12659
12886
  [onOpenChange, onSelect, setOpenPopover, setSelectedValue]
12660
12887
  );
12661
- const handleOpenPopover = React25__namespace.useCallback(
12888
+ const handleOpenPopover = React27__namespace.useCallback(
12662
12889
  (isOpen) => {
12663
12890
  if (disabled) return;
12664
12891
  setOpenPopover(isOpen);
@@ -12668,7 +12895,7 @@ var ComboboxInner = ({
12668
12895
  },
12669
12896
  [disabled, onOpenChange, setOpenPopover]
12670
12897
  );
12671
- const handleClear = React25__namespace.useCallback(
12898
+ const handleClear = React27__namespace.useCallback(
12672
12899
  (event) => {
12673
12900
  event.stopPropagation();
12674
12901
  setSelectedValue(void 0);
@@ -12757,7 +12984,7 @@ var ComboboxInner = ({
12757
12984
  )
12758
12985
  ] });
12759
12986
  };
12760
- var Combobox = React25__namespace.forwardRef(ComboboxInner);
12987
+ var Combobox = React27__namespace.forwardRef(ComboboxInner);
12761
12988
  var Combobox_default = Combobox;
12762
12989
  var TruncatedMouseEnterDiv = ({
12763
12990
  value,
@@ -12766,8 +12993,8 @@ var TruncatedMouseEnterDiv = ({
12766
12993
  tooltipContentProps,
12767
12994
  arrowClassName
12768
12995
  }) => {
12769
- const textRef = React25.useRef(null);
12770
- const [isTruncated, setIsTruncated] = React25.useState(false);
12996
+ const textRef = React27.useRef(null);
12997
+ const [isTruncated, setIsTruncated] = React27.useState(false);
12771
12998
  const checkTruncation = () => {
12772
12999
  if (textRef.current) {
12773
13000
  const { scrollWidth, clientWidth } = textRef.current;
@@ -12827,8 +13054,8 @@ var TabSelect = ({
12827
13054
  separatorClassName,
12828
13055
  ...rest
12829
13056
  }) => {
12830
- const [selected, setSelected] = React25.useState(items[0]);
12831
- React25.useEffect(() => {
13057
+ const [selected, setSelected] = React27.useState(items[0]);
13058
+ React27.useEffect(() => {
12832
13059
  onSelectTab(selected.id);
12833
13060
  }, [onSelectTab, selected]);
12834
13061
  if (items.length === 0) {
@@ -13071,6 +13298,7 @@ exports.splitOperators = splitOperators;
13071
13298
  exports.stripNullishObject = stripNullishObject;
13072
13299
  exports.throttle = throttle;
13073
13300
  exports.tokenizeFormulaString = tokenizeFormulaString;
13301
+ exports.useBindRef = useBindRef_default;
13074
13302
  exports.useControllableState = useControllableState_default;
13075
13303
  exports.useDraftGuardStore = useDraftGuardStore;
13076
13304
  exports.useFormField = useFormField;