@sustaina/shared-ui 1.41.0 → 1.43.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 React26 = 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 React26__namespace = /*#__PURE__*/_interopNamespace(React26);
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] = React26.useState({
276
+ const [resolver, setResolver] = React27.useState({
277
277
  status: "idle",
278
278
  proceed: void 0,
279
279
  reset: void 0
280
280
  });
281
- React26.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
- React26.useEffect(() => {
311
+ React27.useEffect(() => {
312
312
  if (disabled || router?.history || typeof window === "undefined") {
313
313
  return;
314
314
  }
@@ -1987,6 +1987,68 @@ var UserFriendIcon = ({ size = "1em", className, ...props }) => /* @__PURE__ */
1987
1987
  }
1988
1988
  );
1989
1989
  var user_friend_default = UserFriendIcon;
1990
+ var UserGroupIcon = ({
1991
+ size = "1em",
1992
+ stroke = "currentColor",
1993
+ className,
1994
+ ...props
1995
+ }) => /* @__PURE__ */ jsxRuntime.jsxs(
1996
+ "svg",
1997
+ {
1998
+ viewBox: "0 0 18 18",
1999
+ xmlns: "http://www.w3.org/2000/svg",
2000
+ fill: "none",
2001
+ preserveAspectRatio: "xMidYMid meet",
2002
+ width: size,
2003
+ height: size,
2004
+ className,
2005
+ "aria-hidden": true,
2006
+ ...props,
2007
+ children: [
2008
+ /* @__PURE__ */ jsxRuntime.jsx(
2009
+ "path",
2010
+ {
2011
+ d: "M12 15.75V14.25C12 13.4544 11.6839 12.6913 11.1213 12.1287C10.5587 11.5661 9.79565 11.25 9 11.25H4.5C3.70435 11.25 2.94129 11.5661 2.37868 12.1287C1.81607 12.6913 1.5 13.4544 1.5 14.25V15.75",
2012
+ stroke,
2013
+ strokeWidth: "1.5",
2014
+ strokeLinecap: "round",
2015
+ strokeLinejoin: "round"
2016
+ }
2017
+ ),
2018
+ /* @__PURE__ */ jsxRuntime.jsx(
2019
+ "path",
2020
+ {
2021
+ d: "M12 2.34595C12.6433 2.51272 13.213 2.8884 13.6198 3.41399C14.0265 3.93959 14.2471 4.58536 14.2471 5.24995C14.2471 5.91453 14.0265 6.5603 13.6198 7.0859C13.213 7.6115 12.6433 7.98717 12 8.15395",
2022
+ stroke,
2023
+ strokeWidth: "1.5",
2024
+ strokeLinecap: "round",
2025
+ strokeLinejoin: "round"
2026
+ }
2027
+ ),
2028
+ /* @__PURE__ */ jsxRuntime.jsx(
2029
+ "path",
2030
+ {
2031
+ d: "M16.5 15.7499V14.2499C16.4995 13.5852 16.2783 12.9395 15.871 12.4141C15.4638 11.8888 14.8936 11.5136 14.25 11.3474",
2032
+ stroke,
2033
+ strokeWidth: "1.5",
2034
+ strokeLinecap: "round",
2035
+ strokeLinejoin: "round"
2036
+ }
2037
+ ),
2038
+ /* @__PURE__ */ jsxRuntime.jsx(
2039
+ "path",
2040
+ {
2041
+ d: "M6.75 8.25C8.40685 8.25 9.75 6.90685 9.75 5.25C9.75 3.59315 8.40685 2.25 6.75 2.25C5.09315 2.25 3.75 3.59315 3.75 5.25C3.75 6.90685 5.09315 8.25 6.75 8.25Z",
2042
+ stroke,
2043
+ strokeWidth: "1.5",
2044
+ strokeLinecap: "round",
2045
+ strokeLinejoin: "round"
2046
+ }
2047
+ )
2048
+ ]
2049
+ }
2050
+ );
2051
+ var user_group_default = UserGroupIcon;
1990
2052
  var UserIcon = ({ size = "1em", className, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs(
1991
2053
  "svg",
1992
2054
  {
@@ -2159,7 +2221,7 @@ function AccordionContent({
2159
2221
  );
2160
2222
  }
2161
2223
  var ExpandCollapse = ({ title, children, portalId }) => {
2162
- const [isOpen, setIsOpen] = React26.useState(false);
2224
+ const [isOpen, setIsOpen] = React27.useState(false);
2163
2225
  const Panel = /* @__PURE__ */ jsxRuntime.jsx(
2164
2226
  "div",
2165
2227
  {
@@ -2269,31 +2331,31 @@ function makeNewRow(field) {
2269
2331
  };
2270
2332
  }
2271
2333
  function useAdvanceSearch({ fields, limitRows }) {
2272
- const [rows, setRows] = React26.useState([makeNewRow(fields[0])]);
2273
- const updateRows = React26.useCallback((next) => {
2334
+ const [rows, setRows] = React27.useState([makeNewRow(fields[0])]);
2335
+ const updateRows = React27.useCallback((next) => {
2274
2336
  setRows(next);
2275
2337
  }, []);
2276
- const operatorsForField = React26.useCallback(
2338
+ const operatorsForField = React27.useCallback(
2277
2339
  (fieldName) => {
2278
2340
  const t = getFieldType(fields, fieldName);
2279
2341
  return OPERATOR_MAP[t];
2280
2342
  },
2281
2343
  [fields]
2282
2344
  );
2283
- const addRow = React26.useCallback(() => {
2345
+ const addRow = React27.useCallback(() => {
2284
2346
  if (limitRows && rows.length >= limitRows) return;
2285
2347
  const lastRow = rows[rows.length - 1];
2286
2348
  const lastField = fields.find((f) => f.name === lastRow?.fieldName) ?? fields[0];
2287
2349
  updateRows([...rows, makeNewRow(lastField)]);
2288
2350
  }, [rows, fields, updateRows, limitRows]);
2289
- const removeRow = React26.useCallback(
2351
+ const removeRow = React27.useCallback(
2290
2352
  (id) => {
2291
2353
  if (rows.length === 1) return;
2292
2354
  updateRows(rows.filter((r) => r.id !== id));
2293
2355
  },
2294
2356
  [rows, updateRows]
2295
2357
  );
2296
- const clearRow = React26.useCallback(
2358
+ const clearRow = React27.useCallback(
2297
2359
  (id) => {
2298
2360
  updateRows(
2299
2361
  rows.map((r) => {
@@ -2326,10 +2388,10 @@ function useAdvanceSearch({ fields, limitRows }) {
2326
2388
  },
2327
2389
  [rows, fields, updateRows]
2328
2390
  );
2329
- const clearAllRow = React26.useCallback(() => {
2391
+ const clearAllRow = React27.useCallback(() => {
2330
2392
  updateRows([makeNewRow(fields[0])]);
2331
2393
  }, [fields, updateRows]);
2332
- const changeField = React26.useCallback(
2394
+ const changeField = React27.useCallback(
2333
2395
  (id, fieldName) => {
2334
2396
  updateRows(
2335
2397
  rows.map((r) => {
@@ -2341,7 +2403,7 @@ function useAdvanceSearch({ fields, limitRows }) {
2341
2403
  },
2342
2404
  [rows, fields, updateRows]
2343
2405
  );
2344
- const changeOperator = React26.useCallback(
2406
+ const changeOperator = React27.useCallback(
2345
2407
  (id, operator) => {
2346
2408
  updateRows(
2347
2409
  rows.map((r) => {
@@ -2375,7 +2437,7 @@ function useAdvanceSearch({ fields, limitRows }) {
2375
2437
  },
2376
2438
  [rows, updateRows]
2377
2439
  );
2378
- const changeValue = React26.useCallback(
2440
+ const changeValue = React27.useCallback(
2379
2441
  (id, which, val) => {
2380
2442
  updateRows(
2381
2443
  rows.map((r) => {
@@ -2387,7 +2449,7 @@ function useAdvanceSearch({ fields, limitRows }) {
2387
2449
  },
2388
2450
  [rows, updateRows]
2389
2451
  );
2390
- const fieldOptions = React26.useMemo(
2452
+ const fieldOptions = React27.useMemo(
2391
2453
  () => fields.map((f) => ({
2392
2454
  value: f.name,
2393
2455
  label: f.label ?? f.name
@@ -2582,7 +2644,7 @@ var OPERATOR_LABEL = {
2582
2644
  containsAll: "Contains all of"
2583
2645
  };
2584
2646
  var OperatorSelect = ({ row, operators, onChangeOperator, error }) => {
2585
- React26__namespace.default.useEffect(() => {
2647
+ React27__namespace.default.useEffect(() => {
2586
2648
  if (!operators.length) return;
2587
2649
  if (!operators.includes(row.operator)) {
2588
2650
  onChangeOperator(operators[0]);
@@ -2618,15 +2680,15 @@ function Label2({ className, ...props }) {
2618
2680
  );
2619
2681
  }
2620
2682
  var Form = reactHookForm.FormProvider;
2621
- var FormFieldContext = React26__namespace.createContext({});
2683
+ var FormFieldContext = React27__namespace.createContext({});
2622
2684
  var FormField = ({
2623
2685
  ...props
2624
2686
  }) => {
2625
2687
  return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
2626
2688
  };
2627
2689
  var useFormField = () => {
2628
- const fieldContext = React26__namespace.useContext(FormFieldContext);
2629
- const itemContext = React26__namespace.useContext(FormItemContext);
2690
+ const fieldContext = React27__namespace.useContext(FormFieldContext);
2691
+ const itemContext = React27__namespace.useContext(FormItemContext);
2630
2692
  const { getFieldState } = reactHookForm.useFormContext();
2631
2693
  const formState = reactHookForm.useFormState({ name: fieldContext.name });
2632
2694
  const fieldState = getFieldState(fieldContext.name, formState);
@@ -2643,9 +2705,9 @@ var useFormField = () => {
2643
2705
  ...fieldState
2644
2706
  };
2645
2707
  };
2646
- var FormItemContext = React26__namespace.createContext({});
2708
+ var FormItemContext = React27__namespace.createContext({});
2647
2709
  function FormItem({ className, ...props }) {
2648
- const id = React26__namespace.useId();
2710
+ const id = React27__namespace.useId();
2649
2711
  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
2712
  }
2651
2713
  function FormLabel({ className, ...props }) {
@@ -2749,7 +2811,7 @@ var Spinner = ({ className, variant, size = "default", ...props }) => /* @__PURE
2749
2811
  ]
2750
2812
  }
2751
2813
  );
2752
- var InputPrimitive = React26__namespace.forwardRef(
2814
+ var InputPrimitive = React27__namespace.forwardRef(
2753
2815
  ({ className, type = "text", ...props }, ref) => {
2754
2816
  return /* @__PURE__ */ jsxRuntime.jsx(
2755
2817
  "input",
@@ -2788,7 +2850,7 @@ var inputVariants = classVarianceAuthority.cva("", {
2788
2850
  appearance: "filled"
2789
2851
  }
2790
2852
  });
2791
- var Input = React26__namespace.forwardRef(
2853
+ var Input = React27__namespace.forwardRef(
2792
2854
  ({
2793
2855
  className,
2794
2856
  wrapperClassName,
@@ -2821,8 +2883,8 @@ var Input = React26__namespace.forwardRef(
2821
2883
  onChange: onChangeProp
2822
2884
  } = rest;
2823
2885
  const ariaInvalid = invalid ?? ariaInvalidProp;
2824
- const messageId = React26__namespace.useId();
2825
- const handleChange = React26__namespace.useCallback(
2886
+ const messageId = React27__namespace.useId();
2887
+ const handleChange = React27__namespace.useCallback(
2826
2888
  (event) => {
2827
2889
  onChangeProp?.(event);
2828
2890
  onValueChange?.(event.target.value);
@@ -3210,20 +3272,20 @@ function DatePicker({
3210
3272
  className,
3211
3273
  ...props
3212
3274
  }) {
3213
- const today = React26__namespace.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
3214
- const [displayed, setDisplayed] = React26__namespace.useState(
3275
+ const today = React27__namespace.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
3276
+ const [displayed, setDisplayed] = React27__namespace.useState(
3215
3277
  selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
3216
3278
  );
3217
3279
  minDate = clampToDay(minDate);
3218
3280
  maxDate = clampToDay(maxDate);
3219
- const disabledSet = React26__namespace.useMemo(() => {
3281
+ const disabledSet = React27__namespace.useMemo(() => {
3220
3282
  const s = /* @__PURE__ */ new Set();
3221
3283
  disabledDates?.forEach((d) => s.add(startOfDay(d).toISOString()));
3222
3284
  return s;
3223
3285
  }, [disabledDates]);
3224
3286
  const displayYear = displayed.getFullYear();
3225
3287
  const displayMonth = displayed.getMonth();
3226
- const weekdays = React26__namespace.useMemo(() => {
3288
+ const weekdays = React27__namespace.useMemo(() => {
3227
3289
  const labels = [];
3228
3290
  for (let i = 0; i < 7; i++) {
3229
3291
  const idx = i;
@@ -3232,7 +3294,7 @@ function DatePicker({
3232
3294
  }
3233
3295
  return labels;
3234
3296
  }, [callbacks]);
3235
- const grid = React26__namespace.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
3297
+ const grid = React27__namespace.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
3236
3298
  const isDateDisabled = (date) => {
3237
3299
  const d = startOfDay(date);
3238
3300
  if (minDate && d < minDate) return true;
@@ -3242,7 +3304,7 @@ function DatePicker({
3242
3304
  };
3243
3305
  const minYear = minDate?.getFullYear();
3244
3306
  const maxYear = maxDate?.getFullYear();
3245
- const getMonthLabel = React26__namespace.useCallback(
3307
+ const getMonthLabel = React27__namespace.useCallback(
3246
3308
  (year, monthIndex) => {
3247
3309
  const label = callbacks?.monthLabel?.(year, monthIndex);
3248
3310
  if (label === null || label === void 0) {
@@ -3252,7 +3314,7 @@ function DatePicker({
3252
3314
  },
3253
3315
  [callbacks]
3254
3316
  );
3255
- const getYearLabel = React26__namespace.useCallback(
3317
+ const getYearLabel = React27__namespace.useCallback(
3256
3318
  (year) => {
3257
3319
  const label = callbacks?.yearLabel?.(year);
3258
3320
  if (label === null || label === void 0) return String(year);
@@ -3260,7 +3322,7 @@ function DatePicker({
3260
3322
  },
3261
3323
  [callbacks]
3262
3324
  );
3263
- const clampMonthToBounds = React26__namespace.useCallback(
3325
+ const clampMonthToBounds = React27__namespace.useCallback(
3264
3326
  (year, monthIndex) => {
3265
3327
  let output = monthIndex;
3266
3328
  if (typeof minYear === "number" && year === minYear && minDate) {
@@ -3275,7 +3337,7 @@ function DatePicker({
3275
3337
  },
3276
3338
  [maxDate, minDate, maxYear, minYear]
3277
3339
  );
3278
- const yearOptions = React26__namespace.useMemo(() => {
3340
+ const yearOptions = React27__namespace.useMemo(() => {
3279
3341
  const fallbackWindow = 50;
3280
3342
  const start = typeof minYear === "number" ? minYear : displayYear - fallbackWindow;
3281
3343
  const end = typeof maxYear === "number" ? maxYear : displayYear + fallbackWindow;
@@ -3296,7 +3358,7 @@ function DatePicker({
3296
3358
  }
3297
3359
  return years;
3298
3360
  }, [displayYear, maxYear, minYear, selectedDate]);
3299
- const monthOptions = React26__namespace.useMemo(() => {
3361
+ const monthOptions = React27__namespace.useMemo(() => {
3300
3362
  const months = Array.from({ length: 12 }, (_, monthIndex) => {
3301
3363
  const disabled = typeof minYear === "number" && displayYear === minYear && minDate && monthIndex < minDate.getMonth() || typeof maxYear === "number" && displayYear === maxYear && maxDate && monthIndex > maxDate.getMonth();
3302
3364
  return {
@@ -3315,7 +3377,7 @@ function DatePicker({
3315
3377
  }
3316
3378
  return months.sort((a, b) => a.value - b.value).filter((option, index, arr) => index === 0 || option.value !== arr[index - 1].value);
3317
3379
  }, [displayMonth, displayYear, getMonthLabel, maxDate, maxYear, minDate, minYear]);
3318
- const handleMonthSelect = React26__namespace.useCallback((nextValue) => {
3380
+ const handleMonthSelect = React27__namespace.useCallback((nextValue) => {
3319
3381
  const nextMonth = Number.parseInt(nextValue, 10);
3320
3382
  if (Number.isNaN(nextMonth)) return;
3321
3383
  setDisplayed((prev) => {
@@ -3325,7 +3387,7 @@ function DatePicker({
3325
3387
  return next;
3326
3388
  });
3327
3389
  }, []);
3328
- const handleYearSelect = React26__namespace.useCallback(
3390
+ const handleYearSelect = React27__namespace.useCallback(
3329
3391
  (nextValue) => {
3330
3392
  const nextYear = Number.parseInt(nextValue, 10);
3331
3393
  if (Number.isNaN(nextYear)) return;
@@ -3473,14 +3535,14 @@ var DatePicker2 = ({
3473
3535
  ariaLabel,
3474
3536
  ...calendarProps
3475
3537
  }) => {
3476
- const [open, setOpen] = React26__namespace.default.useState(false);
3477
- const parser = React26__namespace.default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
3478
- const outputFormatter = React26__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
3479
- const labelFormatter = React26__namespace.default.useMemo(
3538
+ const [open, setOpen] = React27__namespace.default.useState(false);
3539
+ const parser = React27__namespace.default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
3540
+ const outputFormatter = React27__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
3541
+ const labelFormatter = React27__namespace.default.useMemo(
3480
3542
  () => displayFormatter ?? defaultDisplayFormatter,
3481
3543
  [displayFormatter]
3482
3544
  );
3483
- const parsedValue = React26__namespace.default.useMemo(() => {
3545
+ const parsedValue = React27__namespace.default.useMemo(() => {
3484
3546
  if (value === null || value === void 0) return void 0;
3485
3547
  if (value instanceof Date) return value;
3486
3548
  const parsed = parser(value);
@@ -3489,26 +3551,26 @@ var DatePicker2 = ({
3489
3551
  const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
3490
3552
  const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change date, current selection ${labelFormatter(parsedValue)}` : "Open date picker");
3491
3553
  const shouldShowClear = allowClear && !disabled && !!parsedValue;
3492
- const handleClose = React26__namespace.default.useCallback(() => setOpen(false), []);
3493
- const emitChange = React26__namespace.default.useCallback(
3554
+ const handleClose = React27__namespace.default.useCallback(() => setOpen(false), []);
3555
+ const emitChange = React27__namespace.default.useCallback(
3494
3556
  (next) => {
3495
3557
  onChange?.(next);
3496
3558
  onValueChange?.(next ? outputFormatter(next) : void 0);
3497
3559
  },
3498
3560
  [onChange, onValueChange, outputFormatter]
3499
3561
  );
3500
- const handleSelect = React26__namespace.default.useCallback(
3562
+ const handleSelect = React27__namespace.default.useCallback(
3501
3563
  (next) => {
3502
3564
  emitChange(next);
3503
3565
  if (closeOnSelect && next) handleClose();
3504
3566
  },
3505
3567
  [closeOnSelect, emitChange, handleClose]
3506
3568
  );
3507
- const handleClear = React26__namespace.default.useCallback(() => {
3569
+ const handleClear = React27__namespace.default.useCallback(() => {
3508
3570
  emitChange(void 0);
3509
3571
  handleClose();
3510
3572
  }, [emitChange, handleClose]);
3511
- const handleOpenChange = React26__namespace.default.useCallback(
3573
+ const handleOpenChange = React27__namespace.default.useCallback(
3512
3574
  (nextOpen) => {
3513
3575
  if (disabled && nextOpen) return;
3514
3576
  setOpen(nextOpen);
@@ -3698,15 +3760,15 @@ function MonthCal({
3698
3760
  onYearBackward,
3699
3761
  onYearForward
3700
3762
  }) {
3701
- const today = React26__namespace.useMemo(() => {
3763
+ const today = React27__namespace.useMemo(() => {
3702
3764
  const now = /* @__PURE__ */ new Date();
3703
3765
  now.setDate(1);
3704
3766
  now.setHours(0, 0, 0, 0);
3705
3767
  return now;
3706
3768
  }, []);
3707
- const selectedMonthDate = React26__namespace.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
3708
- const min = React26__namespace.useMemo(() => normalizeMonth(minDate), [minDate]);
3709
- const max = React26__namespace.useMemo(() => normalizeMonth(maxDate), [maxDate]);
3769
+ const selectedMonthDate = React27__namespace.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
3770
+ const min = React27__namespace.useMemo(() => normalizeMonth(minDate), [minDate]);
3771
+ const max = React27__namespace.useMemo(() => normalizeMonth(maxDate), [maxDate]);
3710
3772
  let effectiveMin = min;
3711
3773
  if (min && max && min > max) {
3712
3774
  effectiveMin = max;
@@ -3715,10 +3777,10 @@ function MonthCal({
3715
3777
  const minMonth = effectiveMin?.getMonth();
3716
3778
  const maxYear = max?.getFullYear();
3717
3779
  const maxMonth = max?.getMonth();
3718
- const [menuYear, setMenuYear] = React26__namespace.useState(
3780
+ const [menuYear, setMenuYear] = React27__namespace.useState(
3719
3781
  () => selectedMonthDate?.getFullYear() ?? today.getFullYear()
3720
3782
  );
3721
- React26__namespace.useEffect(() => {
3783
+ React27__namespace.useEffect(() => {
3722
3784
  if (selectedMonthDate) {
3723
3785
  const year = selectedMonthDate.getFullYear();
3724
3786
  if (year !== menuYear) {
@@ -3726,7 +3788,7 @@ function MonthCal({
3726
3788
  }
3727
3789
  }
3728
3790
  }, [selectedMonthDate, menuYear]);
3729
- React26__namespace.useEffect(() => {
3791
+ React27__namespace.useEffect(() => {
3730
3792
  if (typeof minYear === "number" && menuYear < minYear) {
3731
3793
  setMenuYear(minYear);
3732
3794
  return;
@@ -3737,7 +3799,7 @@ function MonthCal({
3737
3799
  }, [minYear, maxYear, menuYear]);
3738
3800
  const disablePrevYear = typeof minYear === "number" ? menuYear <= minYear : false;
3739
3801
  const disableNextYear = typeof maxYear === "number" ? menuYear >= maxYear : false;
3740
- const yearOptions = React26__namespace.useMemo(() => {
3802
+ const yearOptions = React27__namespace.useMemo(() => {
3741
3803
  const fallbackWindow = 50;
3742
3804
  const start = typeof minYear === "number" ? minYear : menuYear - fallbackWindow;
3743
3805
  const end = typeof maxYear === "number" ? maxYear : menuYear + fallbackWindow;
@@ -3751,7 +3813,7 @@ function MonthCal({
3751
3813
  }
3752
3814
  return years;
3753
3815
  }, [maxYear, menuYear, minYear]);
3754
- const formatYearLabel = React26__namespace.useCallback(
3816
+ const formatYearLabel = React27__namespace.useCallback(
3755
3817
  (year) => {
3756
3818
  const raw = callbacks?.yearLabel?.(year);
3757
3819
  if (raw === null || raw === void 0) return String(year);
@@ -3759,7 +3821,7 @@ function MonthCal({
3759
3821
  },
3760
3822
  [callbacks]
3761
3823
  );
3762
- const handleYearSelect = React26__namespace.useCallback(
3824
+ const handleYearSelect = React27__namespace.useCallback(
3763
3825
  (nextValue) => {
3764
3826
  const nextYear = Number.parseInt(nextValue, 10);
3765
3827
  if (Number.isNaN(nextYear)) return;
@@ -3769,7 +3831,7 @@ function MonthCal({
3769
3831
  },
3770
3832
  [maxYear, minYear]
3771
3833
  );
3772
- const disabledPairs = React26__namespace.useMemo(() => {
3834
+ const disabledPairs = React27__namespace.useMemo(() => {
3773
3835
  if (!disabledDates?.length) return [];
3774
3836
  const pairs = [];
3775
3837
  disabledDates.forEach((date) => {
@@ -3914,14 +3976,14 @@ var MonthPicker2 = ({
3914
3976
  ariaLabel,
3915
3977
  ...calendarProps
3916
3978
  }) => {
3917
- const [open, setOpen] = React26__namespace.default.useState(false);
3918
- const parser = React26__namespace.default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
3919
- const outputFormatter = React26__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
3920
- const labelFormatter = React26__namespace.default.useMemo(
3979
+ const [open, setOpen] = React27__namespace.default.useState(false);
3980
+ const parser = React27__namespace.default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
3981
+ const outputFormatter = React27__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
3982
+ const labelFormatter = React27__namespace.default.useMemo(
3921
3983
  () => displayFormatter ?? defaultDisplayFormatter2,
3922
3984
  [displayFormatter]
3923
3985
  );
3924
- const parsedValue = React26__namespace.default.useMemo(() => {
3986
+ const parsedValue = React27__namespace.default.useMemo(() => {
3925
3987
  if (value === null || value === void 0) return void 0;
3926
3988
  if (value instanceof Date) return normalizeMonth2(value);
3927
3989
  if (typeof value === "string") {
@@ -3933,8 +3995,8 @@ var MonthPicker2 = ({
3933
3995
  const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
3934
3996
  const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change month, current selection ${labelFormatter(parsedValue)}` : "Open month picker");
3935
3997
  const shouldShowClear = allowClear && !disabled && !!parsedValue;
3936
- const handleClose = React26__namespace.default.useCallback(() => setOpen(false), []);
3937
- const emitChange = React26__namespace.default.useCallback(
3998
+ const handleClose = React27__namespace.default.useCallback(() => setOpen(false), []);
3999
+ const emitChange = React27__namespace.default.useCallback(
3938
4000
  (next) => {
3939
4001
  const normalized = next ? normalizeMonth2(next) : void 0;
3940
4002
  onChange?.(normalized);
@@ -3942,18 +4004,18 @@ var MonthPicker2 = ({
3942
4004
  },
3943
4005
  [onChange, onValueChange, outputFormatter]
3944
4006
  );
3945
- const handleSelect = React26__namespace.default.useCallback(
4007
+ const handleSelect = React27__namespace.default.useCallback(
3946
4008
  (next) => {
3947
4009
  emitChange(next);
3948
4010
  if (closeOnSelect && next) handleClose();
3949
4011
  },
3950
4012
  [closeOnSelect, emitChange, handleClose]
3951
4013
  );
3952
- const handleClear = React26__namespace.default.useCallback(() => {
4014
+ const handleClear = React27__namespace.default.useCallback(() => {
3953
4015
  emitChange(void 0);
3954
4016
  handleClose();
3955
4017
  }, [emitChange, handleClose]);
3956
- const handleOpenChange = React26__namespace.default.useCallback(
4018
+ const handleOpenChange = React27__namespace.default.useCallback(
3957
4019
  (nextOpen) => {
3958
4020
  if (disabled && nextOpen) return;
3959
4021
  setOpen(nextOpen);
@@ -4164,24 +4226,24 @@ var LookupSelect = ({
4164
4226
  dropdownPortalId,
4165
4227
  multiple = false
4166
4228
  }) => {
4167
- const [inputValue, setInputValue] = React26.useState("");
4168
- const inputRef = React26.useRef(null);
4169
- const [inputFocused, setInputFocused] = React26.useState(false);
4170
- const [suggestions, setSuggestions] = React26.useState([]);
4171
- const [optionLabels, setOptionLabels] = React26.useState({});
4172
- const [loading, setLoading] = React26.useState(false);
4173
- const [fetchError, setFetchError] = React26.useState(null);
4174
- const [isDropdownOpen, setIsDropdownOpen] = React26.useState(false);
4175
- const containerRef = React26.useRef(null);
4176
- const fetchDelayRef = React26.useRef(null);
4177
- const requestIdRef = React26.useRef(0);
4178
- const [dropdownStyles, setDropdownStyles] = React26.useState();
4179
- const dropdownContentRef = React26.useRef(null);
4180
- const assignDropdownContentRef = React26.useCallback((node) => {
4229
+ const [inputValue, setInputValue] = React27.useState("");
4230
+ const inputRef = React27.useRef(null);
4231
+ const [inputFocused, setInputFocused] = React27.useState(false);
4232
+ const [suggestions, setSuggestions] = React27.useState([]);
4233
+ const [optionLabels, setOptionLabels] = React27.useState({});
4234
+ const [loading, setLoading] = React27.useState(false);
4235
+ const [fetchError, setFetchError] = React27.useState(null);
4236
+ const [isDropdownOpen, setIsDropdownOpen] = React27.useState(false);
4237
+ const containerRef = React27.useRef(null);
4238
+ const fetchDelayRef = React27.useRef(null);
4239
+ const requestIdRef = React27.useRef(0);
4240
+ const [dropdownStyles, setDropdownStyles] = React27.useState();
4241
+ const dropdownContentRef = React27.useRef(null);
4242
+ const assignDropdownContentRef = React27.useCallback((node) => {
4181
4243
  dropdownContentRef.current = node;
4182
4244
  }, []);
4183
- const [activeSuggestionIndex, setActiveSuggestionIndex] = React26.useState(-1);
4184
- const dropdownPortalElement = React26.useMemo(() => {
4245
+ const [activeSuggestionIndex, setActiveSuggestionIndex] = React27.useState(-1);
4246
+ const dropdownPortalElement = React27.useMemo(() => {
4185
4247
  if (typeof document === "undefined") return null;
4186
4248
  if (dropdownPortalId) {
4187
4249
  const element = document.getElementById(dropdownPortalId);
@@ -4192,7 +4254,7 @@ var LookupSelect = ({
4192
4254
  const limitReached = multiple && value.length >= maxTags;
4193
4255
  const selectedValue = !multiple && value.length > 0 ? value[0] : void 0;
4194
4256
  const selectedLabel = selectedValue ? optionLabels[selectedValue] ?? selectedValue : void 0;
4195
- const upsertOptionLabels = React26.useCallback((options) => {
4257
+ const upsertOptionLabels = React27.useCallback((options) => {
4196
4258
  setOptionLabels((prev) => {
4197
4259
  let next = null;
4198
4260
  options.forEach((opt) => {
@@ -4205,7 +4267,7 @@ var LookupSelect = ({
4205
4267
  return next ?? prev;
4206
4268
  });
4207
4269
  }, []);
4208
- const addTag = React26.useCallback(
4270
+ const addTag = React27.useCallback(
4209
4271
  (val) => {
4210
4272
  const trimmed = val.trim();
4211
4273
  if (!trimmed) return;
@@ -4220,7 +4282,7 @@ var LookupSelect = ({
4220
4282
  },
4221
4283
  [value, onChange, maxTags, multiple]
4222
4284
  );
4223
- const removeTag = React26.useCallback(
4285
+ const removeTag = React27.useCallback(
4224
4286
  (index) => {
4225
4287
  if (index < 0) return;
4226
4288
  const newTags = value.filter((_, i) => i !== index);
@@ -4230,7 +4292,7 @@ var LookupSelect = ({
4230
4292
  },
4231
4293
  [value, onChange]
4232
4294
  );
4233
- const handleClear = React26.useCallback(() => {
4295
+ const handleClear = React27.useCallback(() => {
4234
4296
  setInputValue("");
4235
4297
  setSuggestions([]);
4236
4298
  setInputFocused(false);
@@ -4238,7 +4300,7 @@ var LookupSelect = ({
4238
4300
  setFetchError(null);
4239
4301
  if (onClear) onClear();
4240
4302
  }, [onClear]);
4241
- const handleSuggestionSelect = React26.useCallback(
4303
+ const handleSuggestionSelect = React27.useCallback(
4242
4304
  (option) => {
4243
4305
  upsertOptionLabels([option]);
4244
4306
  addTag(option.value);
@@ -4256,7 +4318,7 @@ var LookupSelect = ({
4256
4318
  },
4257
4319
  [addTag, multiple, upsertOptionLabels]
4258
4320
  );
4259
- const handleKeyDown = React26.useCallback(
4321
+ const handleKeyDown = React27.useCallback(
4260
4322
  (e) => {
4261
4323
  if (e.key === "ArrowDown" && suggestions.length > 0) {
4262
4324
  e.preventDefault();
@@ -4283,7 +4345,7 @@ var LookupSelect = ({
4283
4345
  },
4284
4346
  [suggestions, activeSuggestionIndex, handleSuggestionSelect, inputValue, removeTag, value.length]
4285
4347
  );
4286
- const updateDropdownPosition = React26.useCallback(() => {
4348
+ const updateDropdownPosition = React27.useCallback(() => {
4287
4349
  if (!dropdownPortalElement || !containerRef.current) return;
4288
4350
  const rect = containerRef.current.getBoundingClientRect();
4289
4351
  setDropdownStyles({
@@ -4294,7 +4356,7 @@ var LookupSelect = ({
4294
4356
  zIndex: 50
4295
4357
  });
4296
4358
  }, [dropdownPortalElement]);
4297
- React26.useEffect(() => {
4359
+ React27.useEffect(() => {
4298
4360
  if (!fetchSuggestions || !inputFocused) return;
4299
4361
  if (fetchDelayRef.current) {
4300
4362
  clearTimeout(fetchDelayRef.current);
@@ -4328,7 +4390,7 @@ var LookupSelect = ({
4328
4390
  }
4329
4391
  };
4330
4392
  }, [inputValue, fetchSuggestions, suggestionDebounce, upsertOptionLabels, inputFocused]);
4331
- React26.useEffect(() => {
4393
+ React27.useEffect(() => {
4332
4394
  if (!fetchSuggestions) return;
4333
4395
  if (value.length === 0) return;
4334
4396
  const unresolvedValues = value.filter((v) => !optionLabels[v]);
@@ -4338,7 +4400,7 @@ var LookupSelect = ({
4338
4400
  }).catch(() => {
4339
4401
  });
4340
4402
  }, [value, fetchSuggestions, optionLabels, upsertOptionLabels]);
4341
- React26.useEffect(() => {
4403
+ React27.useEffect(() => {
4342
4404
  const handleDocumentClick = (event) => {
4343
4405
  const target = event.target;
4344
4406
  if (containerRef.current?.contains(target)) return;
@@ -4351,11 +4413,11 @@ var LookupSelect = ({
4351
4413
  document.removeEventListener("mousedown", handleDocumentClick);
4352
4414
  };
4353
4415
  }, []);
4354
- React26.useEffect(() => {
4416
+ React27.useEffect(() => {
4355
4417
  if (!limitReached) return;
4356
4418
  setIsDropdownOpen(false);
4357
4419
  }, [limitReached]);
4358
- React26.useEffect(() => {
4420
+ React27.useEffect(() => {
4359
4421
  if (!dropdownPortalElement) return;
4360
4422
  if (!isDropdownOpen) return;
4361
4423
  updateDropdownPosition();
@@ -4367,7 +4429,7 @@ var LookupSelect = ({
4367
4429
  window.removeEventListener("scroll", handleReposition, true);
4368
4430
  };
4369
4431
  }, [dropdownPortalElement, isDropdownOpen, updateDropdownPosition, value]);
4370
- React26.useEffect(() => {
4432
+ React27.useEffect(() => {
4371
4433
  if (suggestions.length === 0) {
4372
4434
  setActiveSuggestionIndex(-1);
4373
4435
  return;
@@ -5209,7 +5271,7 @@ var AdvanceSearch = ({
5209
5271
  shortDateFormat,
5210
5272
  filterFieldMap = FILTER_FIELD_MAP
5211
5273
  }) => {
5212
- const fieldsData = React26.useMemo(() => {
5274
+ const fieldsData = React27.useMemo(() => {
5213
5275
  if (fields.length === 0) throw new Error("fields cannot be an empty array");
5214
5276
  return fields || [];
5215
5277
  }, [fields]);
@@ -5229,8 +5291,8 @@ var AdvanceSearch = ({
5229
5291
  defaultValues: {}
5230
5292
  });
5231
5293
  const { handleSubmit, unregister, resetField, getValues, clearErrors, setError } = form;
5232
- const [operatorErrors, setOperatorErrors] = React26__namespace.default.useState({});
5233
- const clearOperatorError = React26.useCallback(
5294
+ const [operatorErrors, setOperatorErrors] = React27__namespace.default.useState({});
5295
+ const clearOperatorError = React27.useCallback(
5234
5296
  (rowId) => {
5235
5297
  setOperatorErrors((prev) => {
5236
5298
  if (!(rowId in prev)) return prev;
@@ -5240,7 +5302,7 @@ var AdvanceSearch = ({
5240
5302
  },
5241
5303
  [setOperatorErrors]
5242
5304
  );
5243
- const clearValue = React26.useCallback(
5305
+ const clearValue = React27.useCallback(
5244
5306
  (rowId, which) => {
5245
5307
  const fieldName = `${which}_${rowId}`;
5246
5308
  resetField(fieldName, { defaultValue: void 0 });
@@ -5250,14 +5312,14 @@ var AdvanceSearch = ({
5250
5312
  },
5251
5313
  [resetField, clearErrors]
5252
5314
  );
5253
- const parseRangeValue = React26.useCallback((raw, fieldType) => {
5315
+ const parseRangeValue = React27.useCallback((raw, fieldType) => {
5254
5316
  if (!raw) return void 0;
5255
5317
  if (Array.isArray(raw)) return void 0;
5256
5318
  const normalized = fieldType === "datemonth" ? `${raw}-01` : raw;
5257
5319
  const parsed = dateFns.parseISO(normalized);
5258
5320
  return dateFns.isValid(parsed) ? parsed : void 0;
5259
5321
  }, []);
5260
- const onSubmit = React26.useCallback(() => {
5322
+ const onSubmit = React27.useCallback(() => {
5261
5323
  const operatorValidation = {};
5262
5324
  rows.forEach((r) => {
5263
5325
  const ops = operatorsForField(r.fieldName);
@@ -5495,11 +5557,11 @@ function resetVisibleTableState(payload) {
5495
5557
  table.setSorting(prevState.sorting.filter((s) => isVisible(s.id)));
5496
5558
  }
5497
5559
  var useHover = () => {
5498
- const [hovering, setHovering] = React26.useState(false);
5499
- const prevRef = React26.useRef(null);
5500
- const onMouseEnter = React26.useCallback(() => setHovering(true), []);
5501
- const onMouseLeave = React26.useCallback(() => setHovering(false), []);
5502
- const nodeRefCallback = React26.useCallback(
5560
+ const [hovering, setHovering] = React27.useState(false);
5561
+ const prevRef = React27.useRef(null);
5562
+ const onMouseEnter = React27.useCallback(() => setHovering(true), []);
5563
+ const onMouseLeave = React27.useCallback(() => setHovering(false), []);
5564
+ const nodeRefCallback = React27.useCallback(
5503
5565
  (node) => {
5504
5566
  if (prevRef.current) {
5505
5567
  prevRef.current.removeEventListener("mouseenter", onMouseEnter);
@@ -5527,15 +5589,15 @@ var useIntersectionObserver = ({
5527
5589
  initialIsIntersecting = false,
5528
5590
  onChange
5529
5591
  } = {}) => {
5530
- const [ref, setRef] = React26.useState(null);
5531
- const [state, setState] = React26.useState(() => ({
5592
+ const [ref, setRef] = React27.useState(null);
5593
+ const [state, setState] = React27.useState(() => ({
5532
5594
  isIntersecting: initialIsIntersecting,
5533
5595
  entry: void 0
5534
5596
  }));
5535
- const callbackRef = React26.useRef(null);
5597
+ const callbackRef = React27.useRef(null);
5536
5598
  callbackRef.current = onChange;
5537
5599
  const frozen = state.entry?.isIntersecting && freezeOnceVisible;
5538
- React26.useEffect(() => {
5600
+ React27.useEffect(() => {
5539
5601
  if (!ref) return;
5540
5602
  if (!("IntersectionObserver" in window)) return;
5541
5603
  if (frozen) return;
@@ -5565,8 +5627,8 @@ var useIntersectionObserver = ({
5565
5627
  frozen,
5566
5628
  freezeOnceVisible
5567
5629
  ]);
5568
- const prevRef = React26.useRef(null);
5569
- React26.useEffect(() => {
5630
+ const prevRef = React27.useRef(null);
5631
+ React27.useEffect(() => {
5570
5632
  if (!ref && state.entry?.target && !freezeOnceVisible && !frozen && prevRef.current !== state.entry.target) {
5571
5633
  prevRef.current = state.entry.target;
5572
5634
  setState({ isIntersecting: initialIsIntersecting, entry: void 0 });
@@ -5583,8 +5645,8 @@ var isValidMediaQueryString = (query) => {
5583
5645
  return query !== "not all";
5584
5646
  };
5585
5647
  var useMediaQuery = ({ query }) => {
5586
- const [matches, setMatches] = React26.useState(false);
5587
- React26.useEffect(() => {
5648
+ const [matches, setMatches] = React27.useState(false);
5649
+ React27.useEffect(() => {
5588
5650
  if (typeof window === "undefined") {
5589
5651
  return;
5590
5652
  }
@@ -5620,8 +5682,8 @@ var useTruncated = ({
5620
5682
  onChange,
5621
5683
  resizeDetectDelay = 150
5622
5684
  }) => {
5623
- const [isTruncated, setIsTruncated] = React26.useState(false);
5624
- React26.useEffect(() => {
5685
+ const [isTruncated, setIsTruncated] = React27.useState(false);
5686
+ React27.useEffect(() => {
5625
5687
  const element = elementRef.current;
5626
5688
  if (!element) return;
5627
5689
  const checkTruncate = debounce(() => {
@@ -5650,14 +5712,14 @@ var useControllableState = ({
5650
5712
  value
5651
5713
  }) => {
5652
5714
  const isControlled = typeof value !== "undefined";
5653
- const [internalValue, setInternalValue] = React26__namespace.useState(() => {
5715
+ const [internalValue, setInternalValue] = React27__namespace.useState(() => {
5654
5716
  return isControlled ? value : defaultValue;
5655
5717
  });
5656
- React26__namespace.useEffect(() => {
5718
+ React27__namespace.useEffect(() => {
5657
5719
  if (!isControlled) return;
5658
5720
  setInternalValue(value);
5659
5721
  }, [isControlled, value]);
5660
- const setValue = React26__namespace.useCallback(
5722
+ const setValue = React27__namespace.useCallback(
5661
5723
  (nextValue) => {
5662
5724
  if (isControlled) return;
5663
5725
  setInternalValue(nextValue);
@@ -5671,7 +5733,17 @@ var useControllableState = ({
5671
5733
  };
5672
5734
  };
5673
5735
  var useControllableState_default = useControllableState;
5674
- var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React26.useLayoutEffect : React26.useEffect;
5736
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React27.useLayoutEffect : React27.useEffect;
5737
+ var useBindRef = ({ ref, value }) => {
5738
+ React27__namespace.useEffect(() => {
5739
+ if (!ref) return;
5740
+ ref.current = value;
5741
+ return () => {
5742
+ ref.current = null;
5743
+ };
5744
+ }, [ref, value]);
5745
+ };
5746
+ var useBindRef_default = useBindRef;
5675
5747
  var HeaderCell = ({
5676
5748
  rootClassName,
5677
5749
  labelClassName,
@@ -5838,38 +5910,6 @@ function TableCaption({ className, ...props }) {
5838
5910
  }
5839
5911
  );
5840
5912
  }
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 = React26__namespace.default.memo(ColumnSeparator);
5873
5913
  var StatusContentSlot = ({
5874
5914
  content,
5875
5915
  icon,
@@ -5888,7 +5928,7 @@ var StatusContentSlot = ({
5888
5928
  content
5889
5929
  ] });
5890
5930
  };
5891
- var StatusContentSlot_default = React26__namespace.default.memo(StatusContentSlot);
5931
+ var StatusContentSlot_default = React27__namespace.default.memo(StatusContentSlot);
5892
5932
  var stateOptions = [
5893
5933
  "columnFilters",
5894
5934
  "globalFilter",
@@ -5941,9 +5981,9 @@ var modelOptions = [
5941
5981
  "getCenterVisibleLeafColumns"
5942
5982
  ];
5943
5983
  var DataTableDevTool = ({ table }) => {
5944
- const [open, setOpen] = React26.useState(false);
5945
- const [visibleStates, setVisibleStates] = React26.useState([]);
5946
- const [visibleModels, setVisibleModels] = React26.useState([]);
5984
+ const [open, setOpen] = React27.useState(false);
5985
+ const [visibleStates, setVisibleStates] = React27.useState([]);
5986
+ const [visibleModels, setVisibleModels] = React27.useState([]);
5947
5987
  const tableState = table.getState();
5948
5988
  const toggleValue = (arr, value) => arr.includes(value) ? arr.filter((v) => v !== value) : [...arr, value];
5949
5989
  const getCircularReplacer = () => {
@@ -6054,45 +6094,8 @@ var DataTableDevTool = ({ table }) => {
6054
6094
  ] });
6055
6095
  };
6056
6096
  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
6097
  var fallbackData = [];
6093
- var DataTable = ({
6094
- tableRef,
6095
- isInitialLoading,
6098
+ var useTableController = ({
6096
6099
  columns,
6097
6100
  data,
6098
6101
  filters,
@@ -6104,14 +6107,8 @@ var DataTable = ({
6104
6107
  columnResizing,
6105
6108
  rowSelection,
6106
6109
  rowExpansion,
6107
- scrollFetch,
6108
- activeStatusContent,
6109
- statusContent,
6110
6110
  rowIdKey,
6111
- childrenKey,
6112
- onRowClick,
6113
- debug,
6114
- components
6111
+ childrenKey
6115
6112
  }) => {
6116
6113
  const table = reactTable.useReactTable({
6117
6114
  // required properties
@@ -6164,7 +6161,6 @@ var DataTable = ({
6164
6161
  getSortedRowModel: !sorting?.manual && sorting?.enabled ? reactTable.getSortedRowModel() : void 0,
6165
6162
  manualSorting: sorting?.enabled && (sorting?.manual ?? false),
6166
6163
  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
6164
  sortDescFirst: sorting?.enabled ? sorting?.sortDescFirst ?? false : false,
6169
6165
  onSortingChange: sorting?.enabled ? sorting?.onSortingChange : void 0,
6170
6166
  // ordering
@@ -6179,10 +6175,7 @@ var DataTable = ({
6179
6175
  enableMultiRowSelection: rowSelection?.enabled ? rowSelection?.multiSelect ?? true : true,
6180
6176
  onRowSelectionChange: rowSelection?.enabled ? rowSelection?.onSelectionChange : void 0,
6181
6177
  // row expanded
6182
- getExpandedRowModel: (
6183
- // when grouping is use then we should open this
6184
- !rowExpansion?.manual && rowExpansion?.enabled ? reactTable.getExpandedRowModel() : void 0
6185
- ),
6178
+ getExpandedRowModel: !rowExpansion?.manual && rowExpansion?.enabled ? reactTable.getExpandedRowModel() : void 0,
6186
6179
  manualExpanding: rowExpansion?.enabled && (rowExpansion?.manual ?? false),
6187
6180
  enableExpanding: rowExpansion?.enabled ?? false,
6188
6181
  getIsRowExpanded: rowExpansion?.enabled ? rowExpansion?.isRowExpanded : void 0,
@@ -6200,14 +6193,94 @@ var DataTable = ({
6200
6193
  columnResizeMode: columnResizing?.enabled ? columnResizing?.resizeMode ?? "onChange" : "onChange"
6201
6194
  })
6202
6195
  });
6203
- const tableContainerRef = React26.useRef(null);
6196
+ return table;
6197
+ };
6198
+ var useScrollFetch = ({ scrollFetch, containerRef }) => {
6199
+ const fetchMoreOnScrollReached = React27.useCallback(
6200
+ (containerRefElement) => {
6201
+ if (!scrollFetch?.enabled || !containerRefElement || scrollFetch?.isFetchingMore || !scrollFetch?.hasMore || !scrollFetch?.fetchMore) {
6202
+ return;
6203
+ }
6204
+ const { scrollHeight, scrollTop, clientHeight } = containerRefElement;
6205
+ const scrollableHeight = scrollHeight - clientHeight;
6206
+ const distanceToBottom = scrollableHeight - scrollTop;
6207
+ const ratioToBottom = scrollableHeight > 0 ? scrollTop / scrollableHeight : 1;
6208
+ const info = {
6209
+ scrollTop,
6210
+ scrollHeight,
6211
+ clientHeight,
6212
+ scrollableHeight,
6213
+ distanceToBottom,
6214
+ ratioToBottom,
6215
+ isTopReached: scrollTop === 0,
6216
+ isBottomReached: distanceToBottom <= 0
6217
+ };
6218
+ let shouldTrigger = false;
6219
+ if (typeof scrollFetch.scrollThreshold === "number") {
6220
+ shouldTrigger = info.ratioToBottom >= scrollFetch.scrollThreshold;
6221
+ } else if (typeof scrollFetch.scrollThreshold === "function") {
6222
+ shouldTrigger = scrollFetch.scrollThreshold(info);
6223
+ } else {
6224
+ shouldTrigger = info.ratioToBottom >= 0.7;
6225
+ }
6226
+ if (shouldTrigger) {
6227
+ scrollFetch.fetchMore();
6228
+ }
6229
+ },
6230
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6231
+ [scrollFetch?.enabled, scrollFetch?.isFetchingMore, scrollFetch?.hasMore, scrollFetch?.fetchMore]
6232
+ );
6233
+ React27.useEffect(() => {
6234
+ fetchMoreOnScrollReached(containerRef.current);
6235
+ }, [fetchMoreOnScrollReached, containerRef]);
6236
+ return fetchMoreOnScrollReached;
6237
+ };
6238
+ var DEFAULT_ROW_HEIGHT = 40;
6239
+ var DEFAULT_OVER_SCAN = 10;
6240
+ var useTableVirtualizer = ({
6241
+ enabled,
6242
+ table,
6243
+ containerRef,
6244
+ virtual
6245
+ }) => {
6246
+ const rowModel = table.getRowModel().rows;
6247
+ const virtualizer = reactVirtual.useVirtualizer({
6248
+ count: enabled ? rowModel.length : 0,
6249
+ useFlushSync: false,
6250
+ getScrollElement: () => containerRef.current,
6251
+ estimateSize: () => DEFAULT_ROW_HEIGHT,
6252
+ measureElement: typeof window !== "undefined" && navigator.userAgent.indexOf("Firefox") === -1 ? (element) => element?.getBoundingClientRect().height : void 0,
6253
+ overscan: virtual?.overscan ?? DEFAULT_OVER_SCAN
6254
+ });
6255
+ const virtualItems = enabled ? virtualizer.getVirtualItems() : [];
6256
+ const paddingTop = enabled && virtualItems.length > 0 ? virtualItems[0].start : 0;
6257
+ const paddingBottom = enabled && virtualItems.length > 0 ? virtualizer.getTotalSize() - virtualItems[virtualItems.length - 1].end : 0;
6258
+ return {
6259
+ virtualizer,
6260
+ virtualItems,
6261
+ paddingTop,
6262
+ paddingBottom,
6263
+ rowModel
6264
+ };
6265
+ };
6266
+ function useComputedTableState({
6267
+ table,
6268
+ rowModel,
6269
+ isInitialLoading,
6270
+ scrollFetch,
6271
+ activeStatusContent
6272
+ }) {
6204
6273
  const isTableEmpty = table.getCoreRowModel().rows.length === 0;
6205
- const isTableEmptyAfterFiltering = table.getRowModel().rows.length === 0;
6274
+ const isTableEmptyAfterFiltering = rowModel.length === 0;
6206
6275
  const isFiltering = table.getState().columnFilters.length > 0 || !!table.getState().globalFilter;
6207
6276
  const leftVisibleLeftColumns = table.getLeftVisibleLeafColumns();
6208
6277
  const centerVisibleLeafColumns = table.getCenterVisibleLeafColumns();
6209
6278
  const rightVisibleLeafColumns = table.getRightVisibleLeafColumns();
6210
- const { isSomeColumnsFilterable, filterableColumns } = React26.useMemo(() => {
6279
+ const visibleColumnCount = Math.max(
6280
+ leftVisibleLeftColumns.length + centerVisibleLeafColumns.length + rightVisibleLeafColumns.length,
6281
+ 1
6282
+ );
6283
+ const { isSomeColumnsFilterable, filterableColumns } = React27.useMemo(() => {
6211
6284
  const mergedColumns = [
6212
6285
  ...leftVisibleLeftColumns,
6213
6286
  ...centerVisibleLeafColumns,
@@ -6218,7 +6291,7 @@ var DataTable = ({
6218
6291
  );
6219
6292
  return { isSomeColumnsFilterable: isSomeColumnsFilterable2, filterableColumns: mergedColumns };
6220
6293
  }, [centerVisibleLeafColumns, leftVisibleLeftColumns, rightVisibleLeafColumns]);
6221
- const autoStatusKey = React26.useMemo(() => {
6294
+ const autoStatusKey = React27.useMemo(() => {
6222
6295
  if (isInitialLoading) return "initialLoading";
6223
6296
  if (isTableEmpty) return "emptyData";
6224
6297
  if (isTableEmptyAfterFiltering) return "emptyFilteredData";
@@ -6236,57 +6309,336 @@ var DataTable = ({
6236
6309
  scrollFetch?.hasMore,
6237
6310
  scrollFetch?.isFetchingMore
6238
6311
  ]);
6239
- const activeStatusContentComputed = React26.useMemo(() => {
6312
+ const activeStatusContentComputed = React27.useMemo(() => {
6240
6313
  if (!activeStatusContent) return autoStatusKey;
6241
6314
  if (typeof activeStatusContent === "function") {
6242
6315
  return activeStatusContent({ defaultComputedValue: autoStatusKey });
6243
6316
  }
6244
6317
  return activeStatusContent;
6245
6318
  }, [activeStatusContent, autoStatusKey]);
6246
- const fetchMoreOnScrollReached = React26.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;
6319
+ return {
6320
+ isTableEmpty,
6321
+ isTableEmptyAfterFiltering,
6322
+ isFiltering,
6323
+ leftVisibleLeftColumns,
6324
+ centerVisibleLeafColumns,
6325
+ rightVisibleLeafColumns,
6326
+ visibleColumnCount,
6327
+ isSomeColumnsFilterable,
6328
+ filterableColumns,
6329
+ activeStatusContentComputed
6330
+ };
6331
+ }
6332
+ var ColumnResizer = ({ header, className, style }) => {
6333
+ if (!header.column.getCanResize()) {
6334
+ return null;
6335
+ }
6336
+ const resizeHandler = header.getResizeHandler();
6337
+ return /* @__PURE__ */ jsxRuntime.jsx(
6338
+ "div",
6339
+ {
6340
+ className: cn(
6341
+ "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]",
6342
+ className
6343
+ ),
6344
+ onDoubleClick: () => header.column.resetSize(),
6345
+ onTouchStart: resizeHandler,
6346
+ onMouseDown: resizeHandler,
6347
+ style
6348
+ }
6349
+ );
6350
+ };
6351
+ var ColumnResizer_default = ColumnResizer;
6352
+ var ColumnSeparator = ({ show, className, ...props }) => {
6353
+ if (!show) return null;
6354
+ return /* @__PURE__ */ jsxRuntime.jsx(
6355
+ "span",
6356
+ {
6357
+ "data-slot": "table-head-separator",
6358
+ className: cn("absolute right-0 top-1/2 h-4 w-px -translate-y-1/2 bg-gray-300", className),
6359
+ ...props
6360
+ }
6361
+ );
6362
+ };
6363
+ var ColumnSeparator_default = React27__namespace.default.memo(ColumnSeparator);
6364
+
6365
+ // src/components/data-table/helpers.ts
6366
+ function getColumnPinningInfo(column) {
6367
+ const isPinned = column.getIsPinned();
6368
+ const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
6369
+ const isFirstRightPinnedColumn = isPinned === "right" && column.getIsFirstColumn("right");
6370
+ return { isPinned, isLastLeftPinnedColumn, isFirstRightPinnedColumn };
6371
+ }
6372
+ function getColumnPinningStyles(column) {
6373
+ const { isPinned, isFirstRightPinnedColumn, isLastLeftPinnedColumn } = getColumnPinningInfo(column);
6374
+ const classes = cn(isPinned ? "sticky" : "relative");
6375
+ const style = {
6376
+ left: isPinned === "left" ? column.getStart("left") : void 0,
6377
+ right: isPinned === "right" ? column.getAfter("right") : void 0,
6378
+ zIndex: isPinned ? 1 : 0,
6379
+ boxShadow: isLastLeftPinnedColumn ? "inset -1px 0 0 0 black" : isFirstRightPinnedColumn ? "inset 1px 0 0 0 black" : void 0
6380
+ };
6381
+ return { classes, style };
6382
+ }
6383
+ function getRowClickHandlers(handler, { rowData, row, table }) {
6384
+ const handleClick = (event) => {
6385
+ if (event.detail === 1) {
6386
+ handler(rowData, { event, row, table, clickType: "single" });
6387
+ }
6388
+ if (event.detail >= 2) {
6389
+ handler(rowData, { event, row, table, clickType: "double" });
6390
+ }
6391
+ };
6392
+ return {
6393
+ onClick: handleClick
6394
+ };
6395
+ }
6396
+ var TableHeaderRows = ({
6397
+ table,
6398
+ columnResizing,
6399
+ virtual,
6400
+ components
6401
+ }) => {
6402
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: table.getHeaderGroups().map((headerGroup) => {
6403
+ return /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: headerGroup.headers.map((header) => {
6404
+ const { classes, style } = getColumnPinningStyles(header.column);
6405
+ const useColumnSizing = header.column.columnDef?.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
6406
+ const tableHeadCellProps = typeof components?.tableHeadCellProps === "function" ? components?.tableHeadCellProps({ header, table }) : components?.tableHeadCellProps;
6407
+ const nextHeader = headerGroup.headers?.[header.index + 1] || header;
6408
+ const { isLastLeftPinnedColumn } = getColumnPinningInfo(header.column);
6409
+ const { isFirstRightPinnedColumn } = getColumnPinningInfo(nextHeader.column);
6410
+ const headerGroupLength = header.headerGroup.headers.length;
6411
+ const showSeparator = header.index !== headerGroupLength - 1 && !isLastLeftPinnedColumn && !isFirstRightPinnedColumn;
6412
+ return /* @__PURE__ */ jsxRuntime.jsxs(
6413
+ TableHead,
6414
+ {
6415
+ "data-testid": `table-head-${header.id}`,
6416
+ colSpan: header.colSpan,
6417
+ ...tableHeadCellProps,
6418
+ ...header.column.columnDef?.meta?.headerProps,
6419
+ className: cn(
6420
+ classes,
6421
+ tableHeadCellProps?.className,
6422
+ header.column.columnDef?.meta?.headerProps?.className
6423
+ ),
6424
+ style: {
6425
+ ...style,
6426
+ width: useColumnSizing ? header.column.getSize() : void 0,
6427
+ minWidth: useColumnSizing ? header.column.columnDef.minSize : void 0,
6428
+ maxWidth: useColumnSizing ? header.column.columnDef.maxSize : void 0,
6429
+ ...tableHeadCellProps?.style,
6430
+ ...header.column.columnDef?.meta?.headerProps?.style
6431
+ },
6432
+ children: [
6433
+ header.isPlaceholder ? null : reactTable.flexRender(header.column.columnDef.header, header.getContext()),
6434
+ /* @__PURE__ */ jsxRuntime.jsx(
6435
+ ColumnSeparator_default,
6436
+ {
6437
+ ...components?.columnSeparatorProps?.headerCell,
6438
+ ...header.column.columnDef?.meta?.columnSeparatorProps,
6439
+ show: header.column.columnDef?.meta?.columnSeparatorProps?.show ?? components?.columnSeparatorProps?.headerCell?.show ?? showSeparator
6440
+ }
6441
+ ),
6442
+ /* @__PURE__ */ jsxRuntime.jsx(ColumnResizer_default, { header, ...components?.columnResizerProps })
6443
+ ]
6444
+ },
6445
+ header.id
6446
+ );
6447
+ }) }, headerGroup.id);
6448
+ }) });
6449
+ };
6450
+ var TableFilterRow = ({
6451
+ table,
6452
+ filterableColumns,
6453
+ isSomeColumnsFilterable,
6454
+ columnResizing,
6455
+ virtual,
6456
+ components
6457
+ }) => {
6458
+ if (!isSomeColumnsFilterable) return null;
6459
+ return /* @__PURE__ */ jsxRuntime.jsx(TableRow, { "data-testid": "table-filter-row", children: filterableColumns.map((column) => {
6460
+ const { classes, style } = getColumnPinningStyles(column);
6461
+ const useColumnSizing = column.columnDef.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
6462
+ const tableFilterCellProps = typeof components?.tableFilterCellProps === "function" ? components?.tableFilterCellProps({ column, table }) : components?.tableFilterCellProps;
6463
+ return /* @__PURE__ */ jsxRuntime.jsx(
6464
+ TableCell,
6465
+ {
6466
+ "data-testid": `table-filter-cell-${column.id}`,
6467
+ ...tableFilterCellProps,
6468
+ ...column.columnDef?.meta?.filterCellProps,
6469
+ className: cn(
6470
+ "bg-white border-b",
6471
+ classes,
6472
+ tableFilterCellProps?.className,
6473
+ column.columnDef?.meta?.filterCellProps?.className
6474
+ ),
6475
+ style: {
6476
+ ...style,
6477
+ width: useColumnSizing ? column.getSize() : void 0,
6478
+ minWidth: useColumnSizing ? column.columnDef.minSize : void 0,
6479
+ maxWidth: useColumnSizing ? column.columnDef.maxSize : void 0,
6480
+ ...tableFilterCellProps?.style,
6481
+ ...column.columnDef?.meta?.filterCellProps?.style
6482
+ },
6483
+ children: column.getCanFilter() && column.columnDef.meta?.renderColumnFilter?.({
6484
+ column,
6485
+ table
6486
+ })
6487
+ },
6488
+ column.id
6489
+ );
6490
+ }) });
6491
+ };
6492
+ var TableDataRows = ({
6493
+ table,
6494
+ rowModel,
6495
+ virtualEnabled,
6496
+ virtualItems,
6497
+ virtualizer,
6498
+ paddingTop,
6499
+ paddingBottom,
6500
+ visibleColumnCount,
6501
+ columnResizing,
6502
+ virtual,
6503
+ onRowClick,
6504
+ components
6505
+ }) => {
6506
+ const config = virtualEnabled ? { items: virtualItems, isVirtualize: true, rowModel } : { items: rowModel, isVirtualize: false };
6507
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6508
+ virtualEnabled && paddingTop > 0 && /* @__PURE__ */ jsxRuntime.jsx(TableRow, { "aria-hidden": "true", "data-testid": "table-virtual-padding-top", children: /* @__PURE__ */ jsxRuntime.jsx(
6509
+ TableCell,
6510
+ {
6511
+ className: "border-b-0 p-0 h-auto",
6512
+ colSpan: visibleColumnCount,
6513
+ style: { height: `${paddingTop}px` }
6272
6514
  }
6273
- if (shouldTrigger) {
6274
- scrollFetch.fetchMore();
6515
+ ) }),
6516
+ config.items.map((item) => {
6517
+ const row = config.isVirtualize ? config.rowModel[item.index] : item;
6518
+ if (!row) return null;
6519
+ const virtualIndex = config.isVirtualize ? item.index : void 0;
6520
+ const tableDataRowProps = typeof components?.tableDataRowProps === "function" ? components.tableDataRowProps({ row, table }) || {} : components?.tableDataRowProps || {};
6521
+ return /* @__PURE__ */ React27.createElement(
6522
+ TableRow,
6523
+ {
6524
+ "data-testid": `table-data-row-${row.id}`,
6525
+ "data-index": virtualIndex,
6526
+ ref: config.isVirtualize ? (node) => virtualizer.measureElement(node) : void 0,
6527
+ ...tableDataRowProps,
6528
+ key: row.id,
6529
+ className: cn("group", tableDataRowProps?.className),
6530
+ "data-state": row.getIsSelected() ? "selected" : "non-selected",
6531
+ ...getRowClickHandlers(onRowClick ?? (() => {
6532
+ }), {
6533
+ rowData: row.original,
6534
+ row,
6535
+ table
6536
+ })
6537
+ },
6538
+ row.getVisibleCells().map((cell) => {
6539
+ const { classes, style } = getColumnPinningStyles(cell.column);
6540
+ const useColumnSizing = cell.column.columnDef.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
6541
+ const tableDataCellProps = typeof components?.tableDataCellProps === "function" ? components?.tableDataCellProps({ row, cell, table }) : components?.tableDataCellProps;
6542
+ return /* @__PURE__ */ jsxRuntime.jsx(
6543
+ TableCell,
6544
+ {
6545
+ "data-testid": `table-data-cell-${cell.id}`,
6546
+ "data-row-id": row.id,
6547
+ "data-column-id": cell.column.id,
6548
+ ...tableDataCellProps,
6549
+ ...cell.column.columnDef?.meta?.cellProps,
6550
+ className: cn(
6551
+ {
6552
+ "bg-[#dfeae3]": row.getIsSelected(),
6553
+ "bg-white group-hover:bg-sus-primary-3-hover": !row.getIsSelected()
6554
+ },
6555
+ classes,
6556
+ tableDataCellProps?.className,
6557
+ cell.column.columnDef?.meta?.cellProps?.className
6558
+ ),
6559
+ style: {
6560
+ ...style,
6561
+ width: useColumnSizing ? cell.column.getSize() : void 0,
6562
+ minWidth: useColumnSizing ? cell.column.columnDef.minSize : void 0,
6563
+ maxWidth: useColumnSizing ? cell.column.columnDef.maxSize : void 0,
6564
+ ...tableDataCellProps?.style,
6565
+ ...cell.column.columnDef?.meta?.cellProps?.style
6566
+ },
6567
+ children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext())
6568
+ },
6569
+ cell.id
6570
+ );
6571
+ })
6572
+ );
6573
+ }),
6574
+ virtualEnabled && paddingBottom > 0 && /* @__PURE__ */ jsxRuntime.jsx(TableRow, { "aria-hidden": "true", "data-testid": "table-virtual-padding-bottom", children: /* @__PURE__ */ jsxRuntime.jsx(
6575
+ TableCell,
6576
+ {
6577
+ className: "border-b-0 p-0 h-auto",
6578
+ colSpan: visibleColumnCount,
6579
+ style: { height: `${paddingBottom}px` }
6275
6580
  }
6276
- },
6277
- // eslint-disable-next-line react-hooks/exhaustive-deps
6278
- [scrollFetch?.enabled, scrollFetch?.isFetchingMore, scrollFetch?.hasMore, scrollFetch?.fetchMore]
6279
- );
6280
- React26.useEffect(() => {
6281
- if (!tableRef) return;
6282
- tableRef.current = table;
6283
- return () => {
6284
- tableRef.current = null;
6285
- };
6286
- }, [tableRef, table]);
6287
- React26.useEffect(() => {
6288
- fetchMoreOnScrollReached(tableContainerRef.current);
6289
- }, [fetchMoreOnScrollReached]);
6581
+ ) })
6582
+ ] });
6583
+ };
6584
+ var DataTable = ({
6585
+ tableRef,
6586
+ virtualizerRef,
6587
+ isInitialLoading,
6588
+ columns,
6589
+ data,
6590
+ filters,
6591
+ sorting,
6592
+ columnOrder,
6593
+ columnVisibility,
6594
+ columnPinning,
6595
+ columnGrouping,
6596
+ columnResizing,
6597
+ rowSelection,
6598
+ rowExpansion,
6599
+ virtual,
6600
+ scrollFetch,
6601
+ activeStatusContent,
6602
+ statusContent,
6603
+ rowIdKey,
6604
+ childrenKey,
6605
+ onRowClick,
6606
+ debug,
6607
+ components
6608
+ }) => {
6609
+ const virtualEnabled = virtual?.enabled ?? false;
6610
+ const tableContainerRef = React27.useRef(null);
6611
+ const table = useTableController({
6612
+ columns,
6613
+ data,
6614
+ filters,
6615
+ sorting,
6616
+ columnOrder,
6617
+ columnVisibility,
6618
+ columnPinning,
6619
+ columnGrouping,
6620
+ columnResizing,
6621
+ rowSelection,
6622
+ rowExpansion,
6623
+ rowIdKey,
6624
+ childrenKey
6625
+ });
6626
+ const { virtualizer, virtualItems, paddingTop, paddingBottom, rowModel } = useTableVirtualizer({
6627
+ enabled: virtualEnabled,
6628
+ table,
6629
+ containerRef: tableContainerRef,
6630
+ virtual
6631
+ });
6632
+ const { visibleColumnCount, isSomeColumnsFilterable, filterableColumns, activeStatusContentComputed } = useComputedTableState({
6633
+ table,
6634
+ rowModel,
6635
+ isInitialLoading,
6636
+ scrollFetch,
6637
+ activeStatusContent
6638
+ });
6639
+ const fetchMoreOnScrollReached = useScrollFetch({ scrollFetch, containerRef: tableContainerRef });
6640
+ useBindRef_default({ ref: tableRef, value: table });
6641
+ useBindRef_default({ ref: virtualizerRef, value: virtualizer });
6290
6642
  return /* @__PURE__ */ jsxRuntime.jsxs(
6291
6643
  TableContainer,
6292
6644
  {
@@ -6323,149 +6675,61 @@ var DataTable = ({
6323
6675
  defaultIcon: /* @__PURE__ */ jsxRuntime.jsx(empty_data_default, { size: 128 })
6324
6676
  }
6325
6677
  ) : /* @__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__ */ React26.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(
6678
+ /* @__PURE__ */ jsxRuntime.jsxs(
6679
+ Table,
6680
+ {
6681
+ ...components?.tableProps,
6682
+ style: { tableLayout: virtualEnabled ? "fixed" : "auto", ...components?.tableProps?.style },
6683
+ children: [
6684
+ /* @__PURE__ */ jsxRuntime.jsxs(
6685
+ TableHeader,
6686
+ {
6687
+ className: cn("sticky top-0 z-10 bg-white", components?.tableHeaderProps?.className),
6688
+ ...components?.tableHeaderProps,
6689
+ children: [
6690
+ /* @__PURE__ */ jsxRuntime.jsx(
6691
+ TableHeaderRows,
6445
6692
  {
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
6693
+ table,
6694
+ columnResizing,
6695
+ virtual,
6696
+ components
6697
+ }
6452
6698
  ),
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
- ] }),
6699
+ /* @__PURE__ */ jsxRuntime.jsx(
6700
+ TableFilterRow,
6701
+ {
6702
+ table,
6703
+ filterableColumns,
6704
+ isSomeColumnsFilterable,
6705
+ columnResizing,
6706
+ virtual,
6707
+ components
6708
+ }
6709
+ )
6710
+ ]
6711
+ }
6712
+ ),
6713
+ /* @__PURE__ */ jsxRuntime.jsx(TableBody, { ...components?.tableBodyProps, children: /* @__PURE__ */ jsxRuntime.jsx(
6714
+ TableDataRows,
6715
+ {
6716
+ table,
6717
+ rowModel,
6718
+ virtualEnabled,
6719
+ virtualItems,
6720
+ virtualizer,
6721
+ paddingTop,
6722
+ paddingBottom,
6723
+ visibleColumnCount,
6724
+ columnResizing,
6725
+ virtual,
6726
+ onRowClick,
6727
+ components
6728
+ }
6729
+ ) })
6730
+ ]
6731
+ }
6732
+ ),
6469
6733
  activeStatusContentComputed === "emptyFilteredData" && /* @__PURE__ */ jsxRuntime.jsx(
6470
6734
  StatusContentSlot_default,
6471
6735
  {
@@ -6747,11 +7011,11 @@ function DialogAlert({
6747
7011
  }) {
6748
7012
  const alignClass = align === "start" ? "justify-start" : align === "end" ? "justify-end" : "justify-center";
6749
7013
  const { t } = reactI18next.useTranslation();
6750
- const handleCancel = React26.useCallback(() => {
7014
+ const handleCancel = React27.useCallback(() => {
6751
7015
  onCancel?.();
6752
7016
  onOpenChange(false);
6753
7017
  }, [onCancel, onOpenChange]);
6754
- const handleConfirm = React26.useCallback(() => {
7018
+ const handleConfirm = React27.useCallback(() => {
6755
7019
  let func = onConfirm;
6756
7020
  if (variant === "success" && showCancel === false) {
6757
7021
  func = onConfirm ?? onCancel;
@@ -7126,7 +7390,7 @@ var DialogAlertProvider = ({ children, i18nResource, i18nLang }) => {
7126
7390
  const open = useDialogAlertStore((state) => state.open);
7127
7391
  const setOpen = useDialogAlertStore((state) => state.setOpen);
7128
7392
  const dialogProps = useDialogAlertStore((state) => state.dialogProps);
7129
- React26.useEffect(() => {
7393
+ React27.useEffect(() => {
7130
7394
  if (!i18nResource) {
7131
7395
  i18n_default.changeLanguage("sharedui");
7132
7396
  return;
@@ -7236,8 +7500,8 @@ var defaultOperatorShortcuts = {
7236
7500
  };
7237
7501
  var DEFAULT_DEBOUNCE = 200;
7238
7502
  function useKeyboardNavigation(itemsLength, onSelect, isLocked) {
7239
- const [selectedIndex, setSelectedIndex] = React26.useState(0);
7240
- React26.useEffect(() => {
7503
+ const [selectedIndex, setSelectedIndex] = React27.useState(0);
7504
+ React27.useEffect(() => {
7241
7505
  const handler = (event) => {
7242
7506
  if (event.key === "ArrowDown") {
7243
7507
  event.preventDefault();
@@ -7260,10 +7524,10 @@ function useKeyboardNavigation(itemsLength, onSelect, isLocked) {
7260
7524
  return [selectedIndex, setSelectedIndex];
7261
7525
  }
7262
7526
  function useDropdownPosition(clientRect, itemsCount) {
7263
- const [rect, setRect] = React26.useState(null);
7264
- const [style, setStyle] = React26.useState({});
7265
- const ref = React26.useRef(null);
7266
- React26.useEffect(() => {
7527
+ const [rect, setRect] = React27.useState(null);
7528
+ const [style, setStyle] = React27.useState({});
7529
+ const ref = React27.useRef(null);
7530
+ React27.useEffect(() => {
7267
7531
  if (!clientRect) return;
7268
7532
  const update = () => {
7269
7533
  const nextRect = clientRect();
@@ -7280,7 +7544,7 @@ function useDropdownPosition(clientRect, itemsCount) {
7280
7544
  resizeObserver.disconnect();
7281
7545
  };
7282
7546
  }, [clientRect]);
7283
- React26.useLayoutEffect(() => {
7547
+ React27.useLayoutEffect(() => {
7284
7548
  if (!rect || !ref.current) return;
7285
7549
  const dropdown = ref.current;
7286
7550
  const dropdownRect = dropdown.getBoundingClientRect();
@@ -7307,15 +7571,15 @@ var SuggestionList = ({
7307
7571
  debounceMs = DEFAULT_DEBOUNCE,
7308
7572
  query
7309
7573
  }) => {
7310
- const [items, setItems] = React26.useState([]);
7311
- const [isLoading, setIsLoading] = React26.useState(false);
7312
- const fetchId = React26.useRef(0);
7313
- const debounceHandle = React26.useRef(null);
7314
- const itemRefs = React26.useRef([]);
7574
+ const [items, setItems] = React27.useState([]);
7575
+ const [isLoading, setIsLoading] = React27.useState(false);
7576
+ const fetchId = React27.useRef(0);
7577
+ const debounceHandle = React27.useRef(null);
7578
+ const itemRefs = React27.useRef([]);
7315
7579
  const { ref, style, rect } = useDropdownPosition(clientRect, items.length);
7316
- const normalizedMap = React26.useMemo(() => mapItem, [mapItem]);
7317
- const normalizeItem = React26.useMemo(() => normalizeToken, [normalizeToken]);
7318
- React26.useEffect(() => {
7580
+ const normalizedMap = React27.useMemo(() => mapItem, [mapItem]);
7581
+ const normalizeItem = React27.useMemo(() => normalizeToken, [normalizeToken]);
7582
+ React27.useEffect(() => {
7319
7583
  const runFetch = (input) => {
7320
7584
  fetchId.current += 1;
7321
7585
  const currentId = fetchId.current;
@@ -7346,7 +7610,7 @@ var SuggestionList = ({
7346
7610
  fetchId.current += 1;
7347
7611
  };
7348
7612
  }, [query, fetchItems, normalizedMap, normalizeItem, debounceMs]);
7349
- const handleSelect = React26.useMemo(
7613
+ const handleSelect = React27.useMemo(
7350
7614
  () => (item) => {
7351
7615
  if (isLoading) return;
7352
7616
  command(item);
@@ -7361,10 +7625,10 @@ var SuggestionList = ({
7361
7625
  },
7362
7626
  isLoading
7363
7627
  );
7364
- React26.useEffect(() => {
7628
+ React27.useEffect(() => {
7365
7629
  setSelectedIndex(0);
7366
7630
  }, [items, setSelectedIndex]);
7367
- React26.useEffect(() => {
7631
+ React27.useEffect(() => {
7368
7632
  const element = itemRefs.current[selectedIndex];
7369
7633
  if (element) element.scrollIntoView({ block: "nearest" });
7370
7634
  }, [selectedIndex]);
@@ -7412,8 +7676,8 @@ var DISALLOWED_MARKS = ["bold", "italic", "link"];
7412
7676
  var SUGGESTION_DEBOUNCE = 200;
7413
7677
  var DEFAULT_CHIP_CLASS = "outline-1 outline-muted bg-muted/40 text-foreground";
7414
7678
  var TokenView = ({ node, editor, getPos }) => {
7415
- const [isFocused, setIsFocused] = React26__namespace.default.useState(false);
7416
- React26__namespace.default.useEffect(() => {
7679
+ const [isFocused, setIsFocused] = React27__namespace.default.useState(false);
7680
+ React27__namespace.default.useEffect(() => {
7417
7681
  const handler = () => {
7418
7682
  const { from, to } = editor.state.selection;
7419
7683
  const position = getPos();
@@ -8400,21 +8664,21 @@ function ToolbarPlugin({
8400
8664
  acceptImageMimeTypes
8401
8665
  }) {
8402
8666
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
8403
- const [state, setState] = React26.useState(initialToolbarState);
8404
- const fileInputRef = React26.useRef(null);
8405
- const [isLinkDialogOpen, setLinkDialogOpen] = React26.useState(false);
8406
- const [editingExistingLink, setEditingExistingLink] = React26.useState(false);
8407
- const [linkNodeKey, setLinkNodeKey] = React26.useState(null);
8408
- const [isImageDialogOpen, setImageDialogOpen] = React26.useState(false);
8409
- const [editingExistingImage, setEditingExistingImage] = React26.useState(false);
8410
- const [imageNodeKey, setImageNodeKey] = React26.useState(null);
8667
+ const [state, setState] = React27.useState(initialToolbarState);
8668
+ const fileInputRef = React27.useRef(null);
8669
+ const [isLinkDialogOpen, setLinkDialogOpen] = React27.useState(false);
8670
+ const [editingExistingLink, setEditingExistingLink] = React27.useState(false);
8671
+ const [linkNodeKey, setLinkNodeKey] = React27.useState(null);
8672
+ const [isImageDialogOpen, setImageDialogOpen] = React27.useState(false);
8673
+ const [editingExistingImage, setEditingExistingImage] = React27.useState(false);
8674
+ const [imageNodeKey, setImageNodeKey] = React27.useState(null);
8411
8675
  const linkForm = reactHookForm.useForm({
8412
8676
  defaultValues: { url: "", label: "" }
8413
8677
  });
8414
8678
  const imageForm = reactHookForm.useForm({
8415
8679
  defaultValues: { url: "", alt: "", width: "", height: "" }
8416
8680
  });
8417
- const openImageDialog = React26.useCallback(() => {
8681
+ const openImageDialog = React27.useCallback(() => {
8418
8682
  if (disabled || !allowImageUrlInsert) {
8419
8683
  return;
8420
8684
  }
@@ -8448,7 +8712,7 @@ function ToolbarPlugin({
8448
8712
  setImageNodeKey(targetImage?.getKey() ?? null);
8449
8713
  setImageDialogOpen(true);
8450
8714
  }, [allowImageUrlInsert, disabled, editor, imageForm]);
8451
- const closeImageDialog = React26.useCallback(() => {
8715
+ const closeImageDialog = React27.useCallback(() => {
8452
8716
  setImageDialogOpen(false);
8453
8717
  setEditingExistingImage(false);
8454
8718
  setImageNodeKey(null);
@@ -8457,7 +8721,7 @@ function ToolbarPlugin({
8457
8721
  editor.focus();
8458
8722
  }, 0);
8459
8723
  }, [editor, imageForm]);
8460
- const openLinkDialog = React26.useCallback(() => {
8724
+ const openLinkDialog = React27.useCallback(() => {
8461
8725
  if (disabled) {
8462
8726
  return;
8463
8727
  }
@@ -8497,7 +8761,7 @@ function ToolbarPlugin({
8497
8761
  setLinkNodeKey(detectedLink?.getKey() ?? null);
8498
8762
  setLinkDialogOpen(true);
8499
8763
  }, [disabled, editor, linkForm]);
8500
- const closeLinkDialog = React26.useCallback(() => {
8764
+ const closeLinkDialog = React27.useCallback(() => {
8501
8765
  setLinkDialogOpen(false);
8502
8766
  setEditingExistingLink(false);
8503
8767
  setLinkNodeKey(null);
@@ -8538,7 +8802,7 @@ function ToolbarPlugin({
8538
8802
  });
8539
8803
  closeLinkDialog();
8540
8804
  });
8541
- const handleRemoveLink = React26.useCallback(() => {
8805
+ const handleRemoveLink = React27.useCallback(() => {
8542
8806
  editor.focus();
8543
8807
  editor.update(() => {
8544
8808
  if (linkNodeKey) {
@@ -8555,7 +8819,7 @@ function ToolbarPlugin({
8555
8819
  });
8556
8820
  closeLinkDialog();
8557
8821
  }, [closeLinkDialog, editor, linkNodeKey]);
8558
- const handleLinkDialogOpenChange = React26.useCallback(
8822
+ const handleLinkDialogOpenChange = React27.useCallback(
8559
8823
  (open) => {
8560
8824
  if (open) {
8561
8825
  setLinkDialogOpen(true);
@@ -8565,7 +8829,7 @@ function ToolbarPlugin({
8565
8829
  },
8566
8830
  [closeLinkDialog]
8567
8831
  );
8568
- const updateToolbar = React26.useCallback(() => {
8832
+ const updateToolbar = React27.useCallback(() => {
8569
8833
  const selection = lexical.$getSelection();
8570
8834
  if (!lexical.$isRangeSelection(selection)) {
8571
8835
  return;
@@ -8605,7 +8869,7 @@ function ToolbarPlugin({
8605
8869
  isLink: hasLink
8606
8870
  }));
8607
8871
  }, []);
8608
- React26__namespace.useEffect(() => {
8872
+ React27__namespace.useEffect(() => {
8609
8873
  return utils.mergeRegister(
8610
8874
  editor.registerCommand(
8611
8875
  lexical.CAN_UNDO_COMMAND,
@@ -8636,7 +8900,7 @@ function ToolbarPlugin({
8636
8900
  })
8637
8901
  );
8638
8902
  }, [editor, updateToolbar]);
8639
- const applyBlock = React26.useCallback(
8903
+ const applyBlock = React27.useCallback(
8640
8904
  (nextBlock) => {
8641
8905
  if (disabled) {
8642
8906
  return;
@@ -8698,7 +8962,7 @@ function ToolbarPlugin({
8698
8962
  },
8699
8963
  [disabled, editor, state.blockType]
8700
8964
  );
8701
- const toggleFormat = React26.useCallback(
8965
+ const toggleFormat = React27.useCallback(
8702
8966
  (format5) => {
8703
8967
  if (disabled) {
8704
8968
  return;
@@ -8707,10 +8971,10 @@ function ToolbarPlugin({
8707
8971
  },
8708
8972
  [disabled, editor]
8709
8973
  );
8710
- const toggleLink = React26.useCallback(() => {
8974
+ const toggleLink = React27.useCallback(() => {
8711
8975
  openLinkDialog();
8712
8976
  }, [openLinkDialog]);
8713
- const applyElementFormat = React26.useCallback(
8977
+ const applyElementFormat = React27.useCallback(
8714
8978
  (format5) => {
8715
8979
  if (disabled) {
8716
8980
  return;
@@ -8721,7 +8985,7 @@ function ToolbarPlugin({
8721
8985
  );
8722
8986
  const canInsertImage = allowImageUrlInsert || Boolean(onImageUpload);
8723
8987
  const imageAccept = acceptImageMimeTypes ?? DEFAULT_IMAGE_ACCEPT;
8724
- const handleInsertImage = React26.useCallback(() => {
8988
+ const handleInsertImage = React27.useCallback(() => {
8725
8989
  if (disabled || !canInsertImage) {
8726
8990
  return;
8727
8991
  }
@@ -8732,7 +8996,7 @@ function ToolbarPlugin({
8732
8996
  }
8733
8997
  openImageDialog();
8734
8998
  }, [canInsertImage, disabled, editor, onImageUpload, openImageDialog]);
8735
- const handleFileChange = React26.useCallback(
8999
+ const handleFileChange = React27.useCallback(
8736
9000
  async (event) => {
8737
9001
  if (!onImageUpload) {
8738
9002
  return;
@@ -8822,7 +9086,7 @@ function ToolbarPlugin({
8822
9086
  });
8823
9087
  closeImageDialog();
8824
9088
  });
8825
- const handleImageDialogOpenChange = React26.useCallback(
9089
+ const handleImageDialogOpenChange = React27.useCallback(
8826
9090
  (open) => {
8827
9091
  if (open) {
8828
9092
  setImageDialogOpen(true);
@@ -8832,7 +9096,7 @@ function ToolbarPlugin({
8832
9096
  },
8833
9097
  [closeImageDialog]
8834
9098
  );
8835
- const handleRemoveImage = React26.useCallback(() => {
9099
+ const handleRemoveImage = React27.useCallback(() => {
8836
9100
  if (!imageNodeKey) {
8837
9101
  closeImageDialog();
8838
9102
  return;
@@ -9191,7 +9455,7 @@ function ControlledValuePlugin({
9191
9455
  trackAppliedValue
9192
9456
  }) {
9193
9457
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
9194
- React26__namespace.useEffect(() => {
9458
+ React27__namespace.useEffect(() => {
9195
9459
  if (value == null || trackAppliedValue.current === value) {
9196
9460
  return;
9197
9461
  }
@@ -9215,14 +9479,14 @@ function ControlledValuePlugin({
9215
9479
  }
9216
9480
  function EditableStatePlugin({ editable }) {
9217
9481
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
9218
- React26__namespace.useEffect(() => {
9482
+ React27__namespace.useEffect(() => {
9219
9483
  editor.setEditable(editable);
9220
9484
  }, [editor, editable]);
9221
9485
  return null;
9222
9486
  }
9223
9487
  function ImagesPlugin() {
9224
9488
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
9225
- React26__namespace.useEffect(() => {
9489
+ React27__namespace.useEffect(() => {
9226
9490
  return editor.registerCommand(
9227
9491
  INSERT_IMAGE_COMMAND,
9228
9492
  (payload) => {
@@ -9241,7 +9505,7 @@ function ImagesPlugin() {
9241
9505
  }, [editor]);
9242
9506
  return null;
9243
9507
  }
9244
- var RichText = React26.forwardRef(function RichText2({
9508
+ var RichText = React27.forwardRef(function RichText2({
9245
9509
  value,
9246
9510
  defaultValue,
9247
9511
  onChange,
@@ -9260,11 +9524,11 @@ var RichText = React26.forwardRef(function RichText2({
9260
9524
  id,
9261
9525
  ...rest
9262
9526
  }, ref) {
9263
- const initialSerializedStateRef = React26.useRef(void 0);
9527
+ const initialSerializedStateRef = React27.useRef(void 0);
9264
9528
  if (initialSerializedStateRef.current === void 0) {
9265
9529
  initialSerializedStateRef.current = parseSerializedEditorState(value ?? defaultValue);
9266
9530
  }
9267
- const initialConfig = React26.useMemo(
9531
+ const initialConfig = React27.useMemo(
9268
9532
  () => ({
9269
9533
  namespace: "RichTextEditor",
9270
9534
  editable: !(readOnly || disabled),
@@ -9277,8 +9541,8 @@ var RichText = React26.forwardRef(function RichText2({
9277
9541
  }),
9278
9542
  [disabled, readOnly]
9279
9543
  );
9280
- const appliedValueRef = React26.useRef(value ?? defaultValue);
9281
- const handleChange = React26.useCallback(
9544
+ const appliedValueRef = React27.useRef(value ?? defaultValue);
9545
+ const handleChange = React27.useCallback(
9282
9546
  (editorState, editor) => {
9283
9547
  const serialized = JSON.stringify(editorState.toJSON());
9284
9548
  appliedValueRef.current = serialized;
@@ -9467,13 +9731,13 @@ function SheetDescription({
9467
9731
  );
9468
9732
  }
9469
9733
  function useIsMobile(breakpoint = 768) {
9470
- const [isMobile, setIsMobile] = React26.useState(() => {
9734
+ const [isMobile, setIsMobile] = React27.useState(() => {
9471
9735
  if (typeof window === "undefined") {
9472
9736
  return false;
9473
9737
  }
9474
9738
  return window.innerWidth < breakpoint;
9475
9739
  });
9476
- React26.useEffect(() => {
9740
+ React27.useEffect(() => {
9477
9741
  function onResize() {
9478
9742
  setIsMobile(window.innerWidth < breakpoint);
9479
9743
  }
@@ -9503,9 +9767,9 @@ var SIDEBAR_WIDTH = "16rem";
9503
9767
  var SIDEBAR_WIDTH_MOBILE = "18rem";
9504
9768
  var SIDEBAR_WIDTH_ICON = "3rem";
9505
9769
  var SIDEBAR_KEYBOARD_SHORTCUT = "b";
9506
- var SidebarContext = React26__namespace.createContext(null);
9770
+ var SidebarContext = React27__namespace.createContext(null);
9507
9771
  function useSidebar() {
9508
- const context = React26__namespace.useContext(SidebarContext);
9772
+ const context = React27__namespace.useContext(SidebarContext);
9509
9773
  if (!context) {
9510
9774
  throw new Error("useSidebar must be used within a SidebarProvider.");
9511
9775
  }
@@ -9521,10 +9785,10 @@ function SidebarProvider({
9521
9785
  ...props
9522
9786
  }) {
9523
9787
  const isMobile = useIsMobile();
9524
- const [openMobile, setOpenMobile] = React26__namespace.useState(false);
9525
- const [_open, _setOpen] = React26__namespace.useState(defaultOpen);
9788
+ const [openMobile, setOpenMobile] = React27__namespace.useState(false);
9789
+ const [_open, _setOpen] = React27__namespace.useState(defaultOpen);
9526
9790
  const open = openProp ?? _open;
9527
- const setOpen = React26__namespace.useCallback(
9791
+ const setOpen = React27__namespace.useCallback(
9528
9792
  (value) => {
9529
9793
  const openState = typeof value === "function" ? value(open) : value;
9530
9794
  if (setOpenProp) {
@@ -9536,10 +9800,10 @@ function SidebarProvider({
9536
9800
  },
9537
9801
  [setOpenProp, open]
9538
9802
  );
9539
- const toggleSidebar = React26__namespace.useCallback(() => {
9803
+ const toggleSidebar = React27__namespace.useCallback(() => {
9540
9804
  return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
9541
9805
  }, [isMobile, setOpen, setOpenMobile]);
9542
- React26__namespace.useEffect(() => {
9806
+ React27__namespace.useEffect(() => {
9543
9807
  const handleKeyDown = (event) => {
9544
9808
  if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
9545
9809
  event.preventDefault();
@@ -9550,7 +9814,7 @@ function SidebarProvider({
9550
9814
  return () => window.removeEventListener("keydown", handleKeyDown);
9551
9815
  }, [toggleSidebar]);
9552
9816
  const state = open ? "expanded" : "collapsed";
9553
- const contextValue = React26__namespace.useMemo(
9817
+ const contextValue = React27__namespace.useMemo(
9554
9818
  () => ({
9555
9819
  state,
9556
9820
  open,
@@ -9992,7 +10256,7 @@ function SidebarMenuSkeleton({
9992
10256
  showIcon = false,
9993
10257
  ...props
9994
10258
  }) {
9995
- const width = React26__namespace.useMemo(() => {
10259
+ const width = React27__namespace.useMemo(() => {
9996
10260
  return `${Math.floor(Math.random() * 40) + 50}%`;
9997
10261
  }, []);
9998
10262
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -10257,10 +10521,10 @@ var FormulaEditor = ({
10257
10521
  fieldState,
10258
10522
  mode = "edit"
10259
10523
  }) => {
10260
- const [isExpanded, setIsExpanded] = React26.useState(false);
10261
- const lastEmittedValueRef = React26.useRef(null);
10262
- const ignorePropValueRef = React26.useRef(false);
10263
- const normalizedConfigs = React26.useMemo(() => {
10524
+ const [isExpanded, setIsExpanded] = React27.useState(false);
10525
+ const lastEmittedValueRef = React27.useRef(null);
10526
+ const ignorePropValueRef = React27.useRef(false);
10527
+ const normalizedConfigs = React27.useMemo(() => {
10264
10528
  const configsToUse = tokenConfigs?.length ? tokenConfigs : DEFAULT_TOKEN_CONFIGS;
10265
10529
  return configsToUse.map((config) => ({
10266
10530
  ...config,
@@ -10269,18 +10533,18 @@ var FormulaEditor = ({
10269
10533
  outputType: config.outputType ?? config.type
10270
10534
  }));
10271
10535
  }, [tokenConfigs]);
10272
- const prefixMap = React26.useMemo(() => buildPrefixMap(normalizedConfigs), [normalizedConfigs]);
10273
- const configLookup = React26.useMemo(() => {
10536
+ const prefixMap = React27.useMemo(() => buildPrefixMap(normalizedConfigs), [normalizedConfigs]);
10537
+ const configLookup = React27.useMemo(() => {
10274
10538
  const lookup = /* @__PURE__ */ new Map();
10275
10539
  normalizedConfigs.forEach((config) => lookup.set(config.prefix, config));
10276
10540
  return lookup;
10277
10541
  }, [normalizedConfigs]);
10278
- const allowedOperators = React26.useMemo(() => operators.map((operator) => operator.value), [operators]);
10542
+ const allowedOperators = React27.useMemo(() => operators.map((operator) => operator.value), [operators]);
10279
10543
  const displayError = errorMessage ?? fieldState?.error?.message;
10280
10544
  const hasError = Boolean(displayError);
10281
10545
  const isEditorReadOnly = mode === "display";
10282
10546
  const isEditorDisabled = disabled || loading || isEditorReadOnly;
10283
- const convertValueToContent = React26.useCallback(
10547
+ const convertValueToContent = React27.useCallback(
10284
10548
  (input) => {
10285
10549
  if (!input) return "";
10286
10550
  const trimmed = input.trim();
@@ -10292,8 +10556,8 @@ var FormulaEditor = ({
10292
10556
  },
10293
10557
  [configLookup, prefixMap]
10294
10558
  );
10295
- const resolvedContent = React26.useMemo(() => convertValueToContent(value), [convertValueToContent, value]);
10296
- const extensions = React26.useMemo(
10559
+ const resolvedContent = React27.useMemo(() => convertValueToContent(value), [convertValueToContent, value]);
10560
+ const extensions = React27.useMemo(
10297
10561
  () => [
10298
10562
  StarterKit__default.default.configure({ bold: false, italic: false }),
10299
10563
  Token.configure({ configs: normalizedConfigs, onSelect: onSelectSuggestion }),
@@ -10325,11 +10589,11 @@ var FormulaEditor = ({
10325
10589
  }
10326
10590
  }
10327
10591
  });
10328
- React26.useEffect(() => {
10592
+ React27.useEffect(() => {
10329
10593
  if (!editor) return;
10330
10594
  editor.setEditable(!isEditorDisabled);
10331
10595
  }, [editor, isEditorDisabled]);
10332
- React26.useEffect(() => {
10596
+ React27.useEffect(() => {
10333
10597
  if (!editor || resolvedContent === void 0) return;
10334
10598
  if (ignorePropValueRef.current && typeof value === "string" && value === lastEmittedValueRef.current) {
10335
10599
  ignorePropValueRef.current = false;
@@ -10462,7 +10726,7 @@ function SortableRow({
10462
10726
  id: value,
10463
10727
  disabled: name === "columns.0.id"
10464
10728
  });
10465
- const style = React26__namespace.useMemo(
10729
+ const style = React27__namespace.useMemo(
10466
10730
  () => ({
10467
10731
  transform: utilities.CSS.Transform.toString(transform),
10468
10732
  transition
@@ -10574,8 +10838,8 @@ var GridSettingsModal = ({
10574
10838
  onClose,
10575
10839
  onSaveColumns
10576
10840
  }) => {
10577
- const [isDragging, setIsDragging] = React26.useState(false);
10578
- const scrollRef = React26.useRef(null);
10841
+ const [isDragging, setIsDragging] = React27.useState(false);
10842
+ const scrollRef = React27.useRef(null);
10579
10843
  const form = reactHookForm.useForm({
10580
10844
  resolver: zod$1.zodResolver(GridSettingsSchema),
10581
10845
  defaultValues: { columns: currentColumns },
@@ -10587,7 +10851,7 @@ var GridSettingsModal = ({
10587
10851
  name: "columns",
10588
10852
  keyName: "fieldId"
10589
10853
  });
10590
- React26.useEffect(() => {
10854
+ React27.useEffect(() => {
10591
10855
  if (isOpen) {
10592
10856
  form.reset({ columns: currentColumns });
10593
10857
  }
@@ -10864,7 +11128,7 @@ function getCandidateWidths({
10864
11128
  }
10865
11129
  return DEVICE_SIZES;
10866
11130
  }
10867
- var Image2 = React26__namespace.forwardRef(function Image3({
11131
+ var Image2 = React27__namespace.forwardRef(function Image3({
10868
11132
  src,
10869
11133
  alt,
10870
11134
  width,
@@ -10894,34 +11158,34 @@ var Image2 = React26__namespace.forwardRef(function Image3({
10894
11158
  } = imgProps;
10895
11159
  const widthNumber = toNumber(width);
10896
11160
  const heightNumber = toNumber(height);
10897
- React26__namespace.useEffect(() => {
11161
+ React27__namespace.useEffect(() => {
10898
11162
  if (!fill && (!widthNumber || !heightNumber)) {
10899
11163
  console.warn(
10900
11164
  "[Image] When `fill` is false you should provide both `width` and `height` to prevent layout shifts."
10901
11165
  );
10902
11166
  }
10903
11167
  }, [fill, heightNumber, widthNumber]);
10904
- const candidateWidths = React26__namespace.useMemo(
11168
+ const candidateWidths = React27__namespace.useMemo(
10905
11169
  () => getCandidateWidths({ width: widthNumber, sizes, fill }),
10906
11170
  [fill, sizes, widthNumber]
10907
11171
  );
10908
11172
  const largestWidth = candidateWidths[candidateWidths.length - 1] ?? widthNumber ?? DEVICE_SIZES[DEVICE_SIZES.length - 1];
10909
- const computedSrc = React26__namespace.useMemo(() => {
11173
+ const computedSrc = React27__namespace.useMemo(() => {
10910
11174
  if (unoptimized) {
10911
11175
  return src;
10912
11176
  }
10913
11177
  return loader({ src, width: largestWidth, quality });
10914
11178
  }, [largestWidth, loader, quality, src, unoptimized]);
10915
- const computedSrcSet = React26__namespace.useMemo(() => {
11179
+ const computedSrcSet = React27__namespace.useMemo(() => {
10916
11180
  if (unoptimized) {
10917
11181
  return void 0;
10918
11182
  }
10919
11183
  return candidateWidths.map((currentWidth) => `${loader({ src, width: currentWidth, quality })} ${currentWidth}w`).join(", ");
10920
11184
  }, [candidateWidths, loader, quality, src, unoptimized]);
10921
11185
  const sizesValue = sizes ?? (fill ? "100vw" : widthNumber ? `${widthNumber}px` : void 0);
10922
- const [isLoaded, setIsLoaded] = React26__namespace.useState(false);
10923
- const internalRef = React26__namespace.useRef(null);
10924
- const setRefs = React26__namespace.useCallback(
11186
+ const [isLoaded, setIsLoaded] = React27__namespace.useState(false);
11187
+ const internalRef = React27__namespace.useRef(null);
11188
+ const setRefs = React27__namespace.useCallback(
10925
11189
  (node) => {
10926
11190
  internalRef.current = node;
10927
11191
  if (!ref) {
@@ -10935,7 +11199,7 @@ var Image2 = React26__namespace.forwardRef(function Image3({
10935
11199
  },
10936
11200
  [ref]
10937
11201
  );
10938
- React26__namespace.useEffect(() => {
11202
+ React27__namespace.useEffect(() => {
10939
11203
  const image = internalRef.current;
10940
11204
  if (!image) {
10941
11205
  return;
@@ -10947,7 +11211,7 @@ var Image2 = React26__namespace.forwardRef(function Image3({
10947
11211
  setIsLoaded(false);
10948
11212
  }
10949
11213
  }, [onLoadingComplete, src]);
10950
- const handleLoad = React26__namespace.useCallback(
11214
+ const handleLoad = React27__namespace.useCallback(
10951
11215
  (event) => {
10952
11216
  setIsLoaded(true);
10953
11217
  onLoadProp?.(event);
@@ -10959,7 +11223,7 @@ var Image2 = React26__namespace.forwardRef(function Image3({
10959
11223
  const fetchPriority = priority ? "high" : fetchPriorityProp;
10960
11224
  const decoding = decodingProp ?? "async";
10961
11225
  const resolvedObjectFit = objectFit ?? (fill ? "cover" : void 0);
10962
- const wrapperStyle = React26__namespace.useMemo(
11226
+ const wrapperStyle = React27__namespace.useMemo(
10963
11227
  () => ({
10964
11228
  position: "relative",
10965
11229
  display: fill ? "block" : "inline-block",
@@ -10969,7 +11233,7 @@ var Image2 = React26__namespace.forwardRef(function Image3({
10969
11233
  }),
10970
11234
  [fill, height, width]
10971
11235
  );
10972
- const imageStyle = React26__namespace.useMemo(
11236
+ const imageStyle = React27__namespace.useMemo(
10973
11237
  () => ({
10974
11238
  width: fill ? "100%" : formatDimension(width) ?? void 0,
10975
11239
  height: fill ? "100%" : formatDimension(height) ?? void 0,
@@ -11118,7 +11382,7 @@ var InfoIcon = ({ size = "1em", className, ...props }) => {
11118
11382
  }
11119
11383
  );
11120
11384
  };
11121
- var InfoIcon_default = React26__namespace.default.memo(InfoIcon);
11385
+ var InfoIcon_default = React27__namespace.default.memo(InfoIcon);
11122
11386
  var Navbar = ({
11123
11387
  className,
11124
11388
  title,
@@ -11143,7 +11407,7 @@ var Navbar = ({
11143
11407
  }) => {
11144
11408
  const { isMobile, isTablet, isDesktop } = useScreenSize_default();
11145
11409
  const Icon2 = lucideReact.CircleHelp;
11146
- const shouldShowSeparator = !separatorDisable && React26.isValidElement(searchButton);
11410
+ const shouldShowSeparator = !separatorDisable && React27.isValidElement(searchButton);
11147
11411
  return /* @__PURE__ */ jsxRuntime.jsxs(
11148
11412
  "nav",
11149
11413
  {
@@ -11154,8 +11418,8 @@ var Navbar = ({
11154
11418
  children: [
11155
11419
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5", children: [
11156
11420
  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
- React26.isValidElement(title) ? title : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-xl font-bold", children: title }),
11158
- React26.isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
11421
+ React27.isValidElement(title) ? title : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-xl font-bold", children: title }),
11422
+ React27.isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
11159
11423
  ] }),
11160
11424
  tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
11161
11425
  /* @__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 +11450,10 @@ var Navbar = ({
11186
11450
  ),
11187
11451
  children: [
11188
11452
  tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
11189
- React26.isValidElement(tooltipIcon) ? tooltipIcon : /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 32, "aria-hidden": "true" }),
11453
+ React27.isValidElement(tooltipIcon) ? tooltipIcon : /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 32, "aria-hidden": "true" }),
11190
11454
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-bold", children: tooltipTitle })
11191
11455
  ] }),
11192
- React26.isValidElement(tooltipdescription) && tooltipdescription
11456
+ React27.isValidElement(tooltipdescription) && tooltipdescription
11193
11457
  ]
11194
11458
  }
11195
11459
  ),
@@ -11244,13 +11508,13 @@ var Navbar = ({
11244
11508
  }
11245
11509
  ),
11246
11510
  shouldShowSeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "separator", className: "ml-1 w-[1px] h-10 bg-white" }),
11247
- React26.isValidElement(searchButton) ? searchButton : ""
11511
+ React27.isValidElement(searchButton) ? searchButton : ""
11248
11512
  ] })
11249
11513
  ]
11250
11514
  }
11251
11515
  );
11252
11516
  };
11253
- var navbar_default = React26__namespace.default.memo(Navbar);
11517
+ var navbar_default = React27__namespace.default.memo(Navbar);
11254
11518
  var usePreventPageLeaveStore = zustand.create((set) => ({
11255
11519
  isPreventing: false,
11256
11520
  setPreventing: (value) => set({ isPreventing: value })
@@ -11260,7 +11524,7 @@ var usePreventPageLeaveStore_default = usePreventPageLeaveStore;
11260
11524
  // src/components/prevent-page-leave/PreventPageLeave.tsx
11261
11525
  var PreventPageLeave = ({ children }) => {
11262
11526
  const { isPreventing } = usePreventPageLeaveStore();
11263
- React26.useEffect(() => {
11527
+ React27.useEffect(() => {
11264
11528
  if (!isPreventing || typeof window === "undefined") {
11265
11529
  return;
11266
11530
  }
@@ -11278,7 +11542,7 @@ var PreventPageLeave = ({ children }) => {
11278
11542
  var PreventPageLeave_default = PreventPageLeave;
11279
11543
  var usePreventPageLeave = ({ isPrevening }) => {
11280
11544
  const setPreventing = usePreventPageLeaveStore_default((state) => state.setPreventing);
11281
- React26.useEffect(() => {
11545
+ React27.useEffect(() => {
11282
11546
  setPreventing(isPrevening);
11283
11547
  }, [isPrevening, setPreventing]);
11284
11548
  };
@@ -11290,7 +11554,7 @@ var DefaultHeader = ({
11290
11554
  classNames,
11291
11555
  rightActions
11292
11556
  }) => {
11293
- const titleRef = React26__namespace.useRef(null);
11557
+ const titleRef = React27__namespace.useRef(null);
11294
11558
  const isTruncated = useTruncated_default({ elementRef: titleRef });
11295
11559
  const textElement = title ? /* @__PURE__ */ jsxRuntime.jsx(
11296
11560
  "span",
@@ -11300,13 +11564,13 @@ var DefaultHeader = ({
11300
11564
  children: title
11301
11565
  }
11302
11566
  ) : null;
11303
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-start justify-between gap-3", classNames?.header), children: [
11304
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 min-w-0", children: [
11567
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-start justify-between gap-1", classNames?.header), children: [
11568
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 min-w-0", children: [
11305
11569
  icon ? /* @__PURE__ */ jsxRuntime.jsx(
11306
11570
  "div",
11307
11571
  {
11308
11572
  className: cn(
11309
- "w-10 h-10 rounded-full bg-sus-green-50 flex items-center justify-center",
11573
+ "w-10 h-10 rounded-full bg-sus-green-50 flex items-start justify-center",
11310
11574
  classNames?.iconWrapper
11311
11575
  ),
11312
11576
  children: icon
@@ -11508,20 +11772,20 @@ var CropperModal = ({
11508
11772
  title,
11509
11773
  props
11510
11774
  }) => {
11511
- const [isLoading, setIsLoading] = React26.useState(false);
11512
- const [crop, setCrop] = React26.useState({ x: 0, y: 0 });
11513
- const [zoom, setZoom] = React26.useState();
11514
- const [croppedAreaPixels, setCroppedAreaPixels] = React26.useState(null);
11515
- const handleClose = React26.useCallback(() => {
11775
+ const [isLoading, setIsLoading] = React27.useState(false);
11776
+ const [crop, setCrop] = React27.useState({ x: 0, y: 0 });
11777
+ const [zoom, setZoom] = React27.useState();
11778
+ const [croppedAreaPixels, setCroppedAreaPixels] = React27.useState(null);
11779
+ const handleClose = React27.useCallback(() => {
11516
11780
  onOpenChange(false);
11517
11781
  }, [onOpenChange]);
11518
- const handleCancel = React26.useCallback(() => {
11782
+ const handleCancel = React27.useCallback(() => {
11519
11783
  if (onCancel) {
11520
11784
  onCancel();
11521
11785
  }
11522
11786
  handleClose();
11523
11787
  }, [handleClose, onCancel]);
11524
- const handleCropComplete = React26.useCallback((_, croppedAreaPixels2) => {
11788
+ const handleCropComplete = React27.useCallback((_, croppedAreaPixels2) => {
11525
11789
  setCroppedAreaPixels(croppedAreaPixels2);
11526
11790
  }, []);
11527
11791
  const handleConfirm = async () => {
@@ -11629,7 +11893,7 @@ function isFragment(object) {
11629
11893
  var isValidText = (val) => ["string", "number"].includes(typeof val);
11630
11894
  function toArray(children, option = {}) {
11631
11895
  let ret = [];
11632
- React26__namespace.Children.forEach(children, (child) => {
11896
+ React27__namespace.Children.forEach(children, (child) => {
11633
11897
  if ((child === void 0 || child === null) && !option.keepEmpty) {
11634
11898
  return;
11635
11899
  }
@@ -11643,9 +11907,9 @@ function toArray(children, option = {}) {
11643
11907
  });
11644
11908
  return ret;
11645
11909
  }
11646
- var MeasureText = React26__namespace.forwardRef(({ style, children }, ref) => {
11647
- const spanRef = React26__namespace.useRef(null);
11648
- React26__namespace.useImperativeHandle(ref, () => ({
11910
+ var MeasureText = React27__namespace.forwardRef(({ style, children }, ref) => {
11911
+ const spanRef = React27__namespace.useRef(null);
11912
+ React27__namespace.useImperativeHandle(ref, () => ({
11649
11913
  isExceed: () => {
11650
11914
  const span = spanRef.current;
11651
11915
  return span.scrollHeight > span.clientHeight;
@@ -11703,19 +11967,19 @@ var lineClipStyle = {
11703
11967
  };
11704
11968
  function EllipsisMeasure(props) {
11705
11969
  const { enableMeasure, width, text, children, rows, expanded, miscDeps, onEllipsis } = props;
11706
- const nodeList = React26__namespace.useMemo(() => toArray(text), [text]);
11707
- const nodeLen = React26__namespace.useMemo(() => getNodesLen(nodeList), [text]);
11708
- const fullContent = React26__namespace.useMemo(() => children(nodeList, false), [text]);
11709
- const [ellipsisCutIndex, setEllipsisCutIndex] = React26__namespace.useState(null);
11710
- const cutMidRef = React26__namespace.useRef(null);
11711
- const measureWhiteSpaceRef = React26__namespace.useRef(null);
11712
- const needEllipsisRef = React26__namespace.useRef(null);
11713
- const descRowsEllipsisRef = React26__namespace.useRef(null);
11714
- const symbolRowEllipsisRef = React26__namespace.useRef(null);
11715
- const [canEllipsis, setCanEllipsis] = React26__namespace.useState(false);
11716
- const [needEllipsis, setNeedEllipsis] = React26__namespace.useState(STATUS_MEASURE_NONE);
11717
- const [ellipsisHeight, setEllipsisHeight] = React26__namespace.useState(0);
11718
- const [parentWhiteSpace, setParentWhiteSpace] = React26__namespace.useState(null);
11970
+ const nodeList = React27__namespace.useMemo(() => toArray(text), [text]);
11971
+ const nodeLen = React27__namespace.useMemo(() => getNodesLen(nodeList), [text]);
11972
+ const fullContent = React27__namespace.useMemo(() => children(nodeList, false), [text]);
11973
+ const [ellipsisCutIndex, setEllipsisCutIndex] = React27__namespace.useState(null);
11974
+ const cutMidRef = React27__namespace.useRef(null);
11975
+ const measureWhiteSpaceRef = React27__namespace.useRef(null);
11976
+ const needEllipsisRef = React27__namespace.useRef(null);
11977
+ const descRowsEllipsisRef = React27__namespace.useRef(null);
11978
+ const symbolRowEllipsisRef = React27__namespace.useRef(null);
11979
+ const [canEllipsis, setCanEllipsis] = React27__namespace.useState(false);
11980
+ const [needEllipsis, setNeedEllipsis] = React27__namespace.useState(STATUS_MEASURE_NONE);
11981
+ const [ellipsisHeight, setEllipsisHeight] = React27__namespace.useState(0);
11982
+ const [parentWhiteSpace, setParentWhiteSpace] = React27__namespace.useState(null);
11719
11983
  useIsomorphicLayoutEffect(() => {
11720
11984
  if (enableMeasure && width && nodeLen) {
11721
11985
  setNeedEllipsis(STATUS_MEASURE_PREPARE);
@@ -11758,7 +12022,7 @@ function EllipsisMeasure(props) {
11758
12022
  setEllipsisCutIndex(isOverflow ? [minIndex, targetMidIndex] : [targetMidIndex, maxIndex]);
11759
12023
  }
11760
12024
  }, [ellipsisCutIndex, cutMidIndex]);
11761
- const finalContent = React26__namespace.useMemo(() => {
12025
+ const finalContent = React27__namespace.useMemo(() => {
11762
12026
  if (!enableMeasure) {
11763
12027
  return children(nodeList, false);
11764
12028
  }
@@ -11849,10 +12113,10 @@ var Truncated = ({
11849
12113
  tooltipProps,
11850
12114
  tooltipContentProps
11851
12115
  }) => {
11852
- const elementRef = React26__namespace.useRef(null);
11853
- const [open, setOpen] = React26__namespace.useState(false);
11854
- const [isTruncated, setIsTruncated] = React26__namespace.useState(false);
11855
- const [measureWidth, setMeasureWidth] = React26__namespace.useState(0);
12116
+ const elementRef = React27__namespace.useRef(null);
12117
+ const [open, setOpen] = React27__namespace.useState(false);
12118
+ const [isTruncated, setIsTruncated] = React27__namespace.useState(false);
12119
+ const [measureWidth, setMeasureWidth] = React27__namespace.useState(0);
11856
12120
  const Comp = as;
11857
12121
  const normalizedChildren = typeof children === "string" ? children.replace(/>/g, ">\u200B") : children;
11858
12122
  const lineClampLines = typeof ellipsis === "number" ? ellipsis : typeof ellipsis === "object" ? ellipsis?.lineClamp ?? 3 : null;
@@ -11877,13 +12141,13 @@ var Truncated = ({
11877
12141
  setIsTruncated(false);
11878
12142
  }
11879
12143
  }, [enableMeasure]);
11880
- const truncationClass = React26__namespace.useMemo(() => {
12144
+ const truncationClass = React27__namespace.useMemo(() => {
11881
12145
  if (!ellipsis) return "";
11882
12146
  if (typeof ellipsis === "number") return `line-clamp-${ellipsis}`;
11883
12147
  if (typeof ellipsis === "object") return `line-clamp-${lineClampLines ?? 3}`;
11884
12148
  return "truncate";
11885
12149
  }, [ellipsis, lineClampLines]);
11886
- const clampedStyle = React26__namespace.useMemo(() => {
12150
+ const clampedStyle = React27__namespace.useMemo(() => {
11887
12151
  if (!lineClampLines) return style;
11888
12152
  return {
11889
12153
  ...style,
@@ -11945,7 +12209,7 @@ var Truncated = ({
11945
12209
  );
11946
12210
  };
11947
12211
  var truncated_default = Truncated;
11948
- var InputPrimitive2 = React26__namespace.forwardRef(
12212
+ var InputPrimitive2 = React27__namespace.forwardRef(
11949
12213
  ({ className, type = "text", ...props }, ref) => {
11950
12214
  return /* @__PURE__ */ jsxRuntime.jsx(
11951
12215
  "input",
@@ -11984,7 +12248,7 @@ var inputVariants2 = classVarianceAuthority.cva("", {
11984
12248
  appearance: "filled"
11985
12249
  }
11986
12250
  });
11987
- var Input2 = React26__namespace.forwardRef(
12251
+ var Input2 = React27__namespace.forwardRef(
11988
12252
  ({
11989
12253
  className,
11990
12254
  wrapperClassName,
@@ -12017,8 +12281,8 @@ var Input2 = React26__namespace.forwardRef(
12017
12281
  onChange: onChangeProp
12018
12282
  } = rest;
12019
12283
  const ariaInvalid = invalid ?? ariaInvalidProp;
12020
- const messageId = React26__namespace.useId();
12021
- const handleChange = React26__namespace.useCallback(
12284
+ const messageId = React27__namespace.useId();
12285
+ const handleChange = React27__namespace.useCallback(
12022
12286
  (event) => {
12023
12287
  onChangeProp?.(event);
12024
12288
  onValueChange?.(event.target.value);
@@ -12146,8 +12410,8 @@ var ActionMenu = ({
12146
12410
  actionButtonClassName,
12147
12411
  separatorClassName
12148
12412
  }) => {
12149
- const [open, setOpen] = React26.useState(false);
12150
- const isAllowed = React26.useCallback(
12413
+ const [open, setOpen] = React27.useState(false);
12414
+ const isAllowed = React27.useCallback(
12151
12415
  (requiredPermission) => {
12152
12416
  if (!checkPermissionFunc || requiredPermission === void 0) {
12153
12417
  return true;
@@ -12156,7 +12420,7 @@ var ActionMenu = ({
12156
12420
  },
12157
12421
  [checkPermissionFunc]
12158
12422
  );
12159
- const filteredButtons = React26.useMemo(() => {
12423
+ const filteredButtons = React27.useMemo(() => {
12160
12424
  return buttons.filter((btn) => isAllowed(btn.requiredPermission));
12161
12425
  }, [buttons, isAllowed]);
12162
12426
  if (buttons.length === 0) {
@@ -12412,13 +12676,13 @@ var useFieldNames = ({
12412
12676
  fieldNames
12413
12677
  }) => {
12414
12678
  const { label: labelFieldKey = "label", value: valueFieldKey = "value" } = fieldNames || {};
12415
- const getLabelField = React26__namespace.default.useCallback(
12679
+ const getLabelField = React27__namespace.default.useCallback(
12416
12680
  (option) => {
12417
12681
  return option?.[labelFieldKey];
12418
12682
  },
12419
12683
  [labelFieldKey]
12420
12684
  );
12421
- const getValueField = React26__namespace.default.useCallback(
12685
+ const getValueField = React27__namespace.default.useCallback(
12422
12686
  (option) => {
12423
12687
  return option?.[valueFieldKey];
12424
12688
  },
@@ -12450,11 +12714,11 @@ var VirtualizedCommand = ({
12450
12714
  onFocus
12451
12715
  }) => {
12452
12716
  const { getLabelField, getValueField } = useFieldNames_default({ fieldNames });
12453
- const internalOptions = React26__namespace.useMemo(() => options ?? [], [options]);
12454
- const [filteredOptions, setFilteredOptions] = React26__namespace.useState(internalOptions);
12455
- const [focusedIndex, setFocusedIndex] = React26__namespace.useState(0);
12456
- const [isKeyboardNavActive, setIsKeyboardNavActive] = React26__namespace.useState(false);
12457
- const parentRef = React26__namespace.useRef(null);
12717
+ const internalOptions = React27__namespace.useMemo(() => options ?? [], [options]);
12718
+ const [filteredOptions, setFilteredOptions] = React27__namespace.useState(internalOptions);
12719
+ const [focusedIndex, setFocusedIndex] = React27__namespace.useState(0);
12720
+ const [isKeyboardNavActive, setIsKeyboardNavActive] = React27__namespace.useState(false);
12721
+ const parentRef = React27__namespace.useRef(null);
12458
12722
  const virtualizer = reactVirtual.useVirtualizer({
12459
12723
  count: filteredOptions.length,
12460
12724
  getScrollElement: () => parentRef.current,
@@ -12462,14 +12726,14 @@ var VirtualizedCommand = ({
12462
12726
  overscan: 2
12463
12727
  });
12464
12728
  const virtualOptions = virtualizer.getVirtualItems();
12465
- const dynamicHeight = React26__namespace.useMemo(() => {
12729
+ const dynamicHeight = React27__namespace.useMemo(() => {
12466
12730
  const contentHeight = filteredOptions.length * ROW_HEIGHT;
12467
12731
  if (contentHeight <= 0) {
12468
12732
  return MIN_HEIGHT_EMPTY;
12469
12733
  }
12470
12734
  return Math.max(ROW_HEIGHT, Math.min(height, contentHeight));
12471
12735
  }, [filteredOptions.length, height]);
12472
- const scrollToIndex = React26__namespace.useCallback(
12736
+ const scrollToIndex = React27__namespace.useCallback(
12473
12737
  (index) => {
12474
12738
  virtualizer.scrollToIndex(index, {
12475
12739
  align: "center"
@@ -12477,7 +12741,7 @@ var VirtualizedCommand = ({
12477
12741
  },
12478
12742
  [virtualizer]
12479
12743
  );
12480
- const handleSearch = React26__namespace.useCallback(
12744
+ const handleSearch = React27__namespace.useCallback(
12481
12745
  (search) => {
12482
12746
  setIsKeyboardNavActive(false);
12483
12747
  setFilteredOptions(
@@ -12492,7 +12756,7 @@ var VirtualizedCommand = ({
12492
12756
  },
12493
12757
  [filterOption, getLabelField, internalOptions]
12494
12758
  );
12495
- const handleKeyDown = React26__namespace.useCallback(
12759
+ const handleKeyDown = React27__namespace.useCallback(
12496
12760
  (event) => {
12497
12761
  switch (event.key) {
12498
12762
  case "ArrowDown": {
@@ -12527,7 +12791,7 @@ var VirtualizedCommand = ({
12527
12791
  },
12528
12792
  [filteredOptions, focusedIndex, getValueField, onSelect, scrollToIndex]
12529
12793
  );
12530
- React26__namespace.useEffect(() => {
12794
+ React27__namespace.useEffect(() => {
12531
12795
  if (value) {
12532
12796
  const option = filteredOptions.find((option2) => {
12533
12797
  const optionValue = getValueField(option2);
@@ -12654,13 +12918,13 @@ var ComboboxInner = ({
12654
12918
  defaultValue,
12655
12919
  value
12656
12920
  });
12657
- const currentSelectedOption = React26__namespace.useMemo(() => {
12921
+ const currentSelectedOption = React27__namespace.useMemo(() => {
12658
12922
  return options?.find((option) => {
12659
12923
  const optionValue = getValueField(option);
12660
12924
  return optionValue === selectedValue;
12661
12925
  });
12662
12926
  }, [getValueField, options, selectedValue]);
12663
- const renderValue = React26__namespace.useMemo(() => {
12927
+ const renderValue = React27__namespace.useMemo(() => {
12664
12928
  if (!selectedValue) return placeholder2;
12665
12929
  if (currentSelectedOption) {
12666
12930
  return getLabelField(currentSelectedOption);
@@ -12670,7 +12934,7 @@ var ComboboxInner = ({
12670
12934
  }
12671
12935
  return null;
12672
12936
  }, [currentSelectedOption, getLabelField, placeholder2, selectedValue, showValueWhenNoMatch]);
12673
- const handleSelect = React26__namespace.useCallback(
12937
+ const handleSelect = React27__namespace.useCallback(
12674
12938
  (selected, option) => {
12675
12939
  setSelectedValue(selected);
12676
12940
  setOpenPopover(false);
@@ -12683,7 +12947,7 @@ var ComboboxInner = ({
12683
12947
  },
12684
12948
  [onOpenChange, onSelect, setOpenPopover, setSelectedValue]
12685
12949
  );
12686
- const handleOpenPopover = React26__namespace.useCallback(
12950
+ const handleOpenPopover = React27__namespace.useCallback(
12687
12951
  (isOpen) => {
12688
12952
  if (disabled) return;
12689
12953
  setOpenPopover(isOpen);
@@ -12693,7 +12957,7 @@ var ComboboxInner = ({
12693
12957
  },
12694
12958
  [disabled, onOpenChange, setOpenPopover]
12695
12959
  );
12696
- const handleClear = React26__namespace.useCallback(
12960
+ const handleClear = React27__namespace.useCallback(
12697
12961
  (event) => {
12698
12962
  event.stopPropagation();
12699
12963
  setSelectedValue(void 0);
@@ -12782,7 +13046,7 @@ var ComboboxInner = ({
12782
13046
  )
12783
13047
  ] });
12784
13048
  };
12785
- var Combobox = React26__namespace.forwardRef(ComboboxInner);
13049
+ var Combobox = React27__namespace.forwardRef(ComboboxInner);
12786
13050
  var Combobox_default = Combobox;
12787
13051
  var TruncatedMouseEnterDiv = ({
12788
13052
  value,
@@ -12791,8 +13055,8 @@ var TruncatedMouseEnterDiv = ({
12791
13055
  tooltipContentProps,
12792
13056
  arrowClassName
12793
13057
  }) => {
12794
- const textRef = React26.useRef(null);
12795
- const [isTruncated, setIsTruncated] = React26.useState(false);
13058
+ const textRef = React27.useRef(null);
13059
+ const [isTruncated, setIsTruncated] = React27.useState(false);
12796
13060
  const checkTruncation = () => {
12797
13061
  if (textRef.current) {
12798
13062
  const { scrollWidth, clientWidth } = textRef.current;
@@ -12852,8 +13116,8 @@ var TabSelect = ({
12852
13116
  separatorClassName,
12853
13117
  ...rest
12854
13118
  }) => {
12855
- const [selected, setSelected] = React26.useState(items[0]);
12856
- React26.useEffect(() => {
13119
+ const [selected, setSelected] = React27.useState(items[0]);
13120
+ React27.useEffect(() => {
12857
13121
  onSelectTab(selected.id);
12858
13122
  }, [onSelectTab, selected]);
12859
13123
  if (items.length === 0) {
@@ -13070,6 +13334,7 @@ exports.TruncatedMouseEnterDiv = truncatedMouseEnterDiv_default;
13070
13334
  exports.UI = ui_exports;
13071
13335
  exports.UserAloneIcon = user_alone_default;
13072
13336
  exports.UserFriendIcon = user_friend_default;
13337
+ exports.UserGroupIcon = user_group_default;
13073
13338
  exports.UserIcon = user_default;
13074
13339
  exports.VirtualizedCommand = VirtualizedCommand_default;
13075
13340
  exports.booleanToSelectValue = booleanToSelectValue;
@@ -13096,6 +13361,7 @@ exports.splitOperators = splitOperators;
13096
13361
  exports.stripNullishObject = stripNullishObject;
13097
13362
  exports.throttle = throttle;
13098
13363
  exports.tokenizeFormulaString = tokenizeFormulaString;
13364
+ exports.useBindRef = useBindRef_default;
13099
13365
  exports.useControllableState = useControllableState_default;
13100
13366
  exports.useDraftGuardStore = useDraftGuardStore;
13101
13367
  exports.useFormField = useFormField;