@sustaina/shared-ui 1.11.0 → 1.13.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
@@ -4,7 +4,7 @@ var AccordionPrimitive = require('@radix-ui/react-accordion');
4
4
  var clsx2 = require('clsx');
5
5
  var tailwindMerge = require('tailwind-merge');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
- var React5 = require('react');
7
+ var React4 = require('react');
8
8
  var dateFns = require('date-fns');
9
9
  var lucideReact = require('lucide-react');
10
10
  var reactDom = require('react-dom');
@@ -18,6 +18,9 @@ var CheckboxPrimitive = require('@radix-ui/react-checkbox');
18
18
  var CollapsiblePrimitive = require('@radix-ui/react-collapsible');
19
19
  var reactTable = require('@tanstack/react-table');
20
20
  var SheetPrimitive = require('@radix-ui/react-dialog');
21
+ var i18n = require('i18next');
22
+ var reactI18next = require('react-i18next');
23
+ var zustand = require('zustand');
21
24
  var zod$1 = require('@hookform/resolvers/zod');
22
25
  var sortable = require('@dnd-kit/sortable');
23
26
  var utilities = require('@dnd-kit/utilities');
@@ -25,7 +28,6 @@ var TooltipPrimitive = require('@radix-ui/react-tooltip');
25
28
  var core = require('@dnd-kit/core');
26
29
  var modifiers = require('@dnd-kit/modifiers');
27
30
  var zod = require('zod');
28
- var zustand = require('zustand');
29
31
  var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
30
32
  var lexical = require('lexical');
31
33
  var LexicalComposer = require('@lexical/react/LexicalComposer');
@@ -73,13 +75,14 @@ function _interopNamespace(e) {
73
75
 
74
76
  var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
75
77
  var clsx2__default = /*#__PURE__*/_interopDefault(clsx2);
76
- var React5__namespace = /*#__PURE__*/_interopNamespace(React5);
78
+ var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
77
79
  var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
78
80
  var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
79
81
  var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
80
82
  var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
81
83
  var CollapsiblePrimitive__namespace = /*#__PURE__*/_interopNamespace(CollapsiblePrimitive);
82
84
  var SheetPrimitive__namespace = /*#__PURE__*/_interopNamespace(SheetPrimitive);
85
+ var i18n__default = /*#__PURE__*/_interopDefault(i18n);
83
86
  var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
84
87
  var RadioGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(RadioGroupPrimitive);
85
88
  var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
@@ -583,7 +586,7 @@ function AccordionContent({
583
586
  );
584
587
  }
585
588
  var ExpandCollapse = ({ title, children, portalId }) => {
586
- const [isOpen, setIsOpen] = React5.useState(false);
589
+ const [isOpen, setIsOpen] = React4.useState(false);
587
590
  const Panel = /* @__PURE__ */ jsxRuntime.jsx(
588
591
  "div",
589
592
  {
@@ -677,31 +680,31 @@ function makeNewRow(field) {
677
680
  };
678
681
  }
679
682
  function useAdvanceSearch({ fields, limitRows }) {
680
- const [rows, setRows] = React5.useState([makeNewRow(fields[0])]);
681
- const updateRows = React5.useCallback((next) => {
683
+ const [rows, setRows] = React4.useState([makeNewRow(fields[0])]);
684
+ const updateRows = React4.useCallback((next) => {
682
685
  setRows(next);
683
686
  }, []);
684
- const operatorsForField = React5.useCallback(
687
+ const operatorsForField = React4.useCallback(
685
688
  (fieldName) => {
686
689
  const t = getFieldType(fields, fieldName);
687
690
  return OPERATOR_MAP[t];
688
691
  },
689
692
  [fields]
690
693
  );
691
- const addRow = React5.useCallback(() => {
694
+ const addRow = React4.useCallback(() => {
692
695
  if (limitRows && rows.length >= limitRows) return;
693
696
  const lastRow = rows[rows.length - 1];
694
697
  const lastField = fields.find((f) => f.name === lastRow?.fieldName) ?? fields[0];
695
698
  updateRows([...rows, makeNewRow(lastField)]);
696
699
  }, [rows, fields, updateRows, limitRows]);
697
- const removeRow = React5.useCallback(
700
+ const removeRow = React4.useCallback(
698
701
  (id) => {
699
702
  if (rows.length === 1) return;
700
703
  updateRows(rows.filter((r) => r.id !== id));
701
704
  },
702
705
  [rows, updateRows]
703
706
  );
704
- const clearRow = React5.useCallback(
707
+ const clearRow = React4.useCallback(
705
708
  (id) => {
706
709
  updateRows(
707
710
  rows.map((r) => {
@@ -730,10 +733,10 @@ function useAdvanceSearch({ fields, limitRows }) {
730
733
  },
731
734
  [rows, fields, updateRows]
732
735
  );
733
- const clearAllRow = React5.useCallback(() => {
736
+ const clearAllRow = React4.useCallback(() => {
734
737
  updateRows([makeNewRow(fields[0])]);
735
738
  }, [fields, updateRows]);
736
- const changeField = React5.useCallback(
739
+ const changeField = React4.useCallback(
737
740
  (id, fieldName) => {
738
741
  updateRows(
739
742
  rows.map((r) => {
@@ -745,7 +748,7 @@ function useAdvanceSearch({ fields, limitRows }) {
745
748
  },
746
749
  [rows, fields, updateRows]
747
750
  );
748
- const changeOperator = React5.useCallback(
751
+ const changeOperator = React4.useCallback(
749
752
  (id, operator) => {
750
753
  updateRows(
751
754
  rows.map((r) => {
@@ -776,7 +779,7 @@ function useAdvanceSearch({ fields, limitRows }) {
776
779
  },
777
780
  [rows, updateRows]
778
781
  );
779
- const changeValue = React5.useCallback(
782
+ const changeValue = React4.useCallback(
780
783
  (id, which, val) => {
781
784
  updateRows(
782
785
  rows.map((r) => {
@@ -788,7 +791,7 @@ function useAdvanceSearch({ fields, limitRows }) {
788
791
  },
789
792
  [rows, updateRows]
790
793
  );
791
- const fieldOptions = React5.useMemo(
794
+ const fieldOptions = React4.useMemo(
792
795
  () => fields.map((f) => ({
793
796
  value: f.name,
794
797
  label: f.label ?? f.name
@@ -976,7 +979,7 @@ var OPERATOR_LABEL = {
976
979
  containsAll: "Contains all of"
977
980
  };
978
981
  var OperatorSelect = ({ row, operators, onChangeOperator, error }) => {
979
- React5__namespace.default.useEffect(() => {
982
+ React4__namespace.default.useEffect(() => {
980
983
  if (!operators.length) return;
981
984
  if (!operators.includes(row.operator)) {
982
985
  onChangeOperator(operators[0]);
@@ -1011,15 +1014,15 @@ function Label2({ className, ...props }) {
1011
1014
  );
1012
1015
  }
1013
1016
  var Form = reactHookForm.FormProvider;
1014
- var FormFieldContext = React5__namespace.createContext({});
1017
+ var FormFieldContext = React4__namespace.createContext({});
1015
1018
  var FormField = ({
1016
1019
  ...props
1017
1020
  }) => {
1018
1021
  return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
1019
1022
  };
1020
1023
  var useFormField = () => {
1021
- const fieldContext = React5__namespace.useContext(FormFieldContext);
1022
- const itemContext = React5__namespace.useContext(FormItemContext);
1024
+ const fieldContext = React4__namespace.useContext(FormFieldContext);
1025
+ const itemContext = React4__namespace.useContext(FormItemContext);
1023
1026
  const { getFieldState } = reactHookForm.useFormContext();
1024
1027
  const formState = reactHookForm.useFormState({ name: fieldContext.name });
1025
1028
  const fieldState = getFieldState(fieldContext.name, formState);
@@ -1036,18 +1039,17 @@ var useFormField = () => {
1036
1039
  ...fieldState
1037
1040
  };
1038
1041
  };
1039
- var FormItemContext = React5__namespace.createContext({});
1042
+ var FormItemContext = React4__namespace.createContext({});
1040
1043
  function FormItem({ className, ...props }) {
1041
- const id = React5__namespace.useId();
1044
+ const id = React4__namespace.useId();
1042
1045
  return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
1043
1046
  }
1044
1047
  function FormLabel({ className, ...props }) {
1045
- const { error, formItemId } = useFormField();
1048
+ const { formItemId } = useFormField();
1046
1049
  return /* @__PURE__ */ jsxRuntime.jsx(
1047
1050
  Label2,
1048
1051
  {
1049
1052
  "data-slot": "form-label",
1050
- "data-error": !!error,
1051
1053
  className: cn("data-[error=true]:text-destructive", className),
1052
1054
  htmlFor: formItemId,
1053
1055
  ...props
@@ -1097,23 +1099,6 @@ function FormMessage({ className, ...props }) {
1097
1099
  }
1098
1100
  );
1099
1101
  }
1100
- var InputPrimitive = React5__namespace.forwardRef(
1101
- ({ className, type = "text", ...props }, ref) => {
1102
- return /* @__PURE__ */ jsxRuntime.jsx(
1103
- "input",
1104
- {
1105
- ref,
1106
- type,
1107
- className: cn(
1108
- "placeholder:text-neutral-400 text-neutral-900 flex h-10 w-full min-w-0 items-center rounded-lg border bg-white px-4 text-sm transition-colors outline-none file:inline-flex file:h-7 file:rounded-md file:border-0 file:bg-transparent file:px-2 file:text-sm file:font-medium hover:border-neutral-500 focus-visible:border-neutral-900 focus-visible:ring-0 disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:text-neutral-400 disabled:border-neutral-200 aria-invalid:border-destructive",
1109
- className
1110
- ),
1111
- ...props
1112
- }
1113
- );
1114
- }
1115
- );
1116
- InputPrimitive.displayName = "InputPrimitive";
1117
1102
  var spinnerVariants = classVarianceAuthority.cva("relative inline-block aspect-square transform-gpu", {
1118
1103
  variants: {
1119
1104
  variant: {
@@ -1160,6 +1145,23 @@ var Spinner = ({ className, variant, size = "default", ...props }) => /* @__PURE
1160
1145
  ]
1161
1146
  }
1162
1147
  );
1148
+ var InputPrimitive = React4__namespace.forwardRef(
1149
+ ({ className, type = "text", ...props }, ref) => {
1150
+ return /* @__PURE__ */ jsxRuntime.jsx(
1151
+ "input",
1152
+ {
1153
+ ref,
1154
+ type,
1155
+ className: cn(
1156
+ "placeholder:text-neutral-400 text-neutral-900 flex h-10 w-full min-w-0 items-center rounded-lg border bg-white px-4 text-sm transition-colors outline-none file:inline-flex file:h-7 file:rounded-md file:border-0 file:bg-transparent file:px-2 file:text-sm file:font-medium hover:border-neutral-500 focus-visible:border-neutral-900 focus-visible:ring-0 disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:text-neutral-400 disabled:border-neutral-200 aria-invalid:border-destructive",
1157
+ className
1158
+ ),
1159
+ ...props
1160
+ }
1161
+ );
1162
+ }
1163
+ );
1164
+ InputPrimitive.displayName = "InputPrimitive";
1163
1165
  var inputVariants = classVarianceAuthority.cva("", {
1164
1166
  variants: {
1165
1167
  controlSize: {
@@ -1182,7 +1184,7 @@ var inputVariants = classVarianceAuthority.cva("", {
1182
1184
  appearance: "filled"
1183
1185
  }
1184
1186
  });
1185
- var Input = React5__namespace.forwardRef(
1187
+ var Input = React4__namespace.forwardRef(
1186
1188
  ({
1187
1189
  className,
1188
1190
  wrapperClassName,
@@ -1191,14 +1193,17 @@ var Input = React5__namespace.forwardRef(
1191
1193
  appearance,
1192
1194
  prefix,
1193
1195
  prefixProps,
1196
+ prefixInteractive,
1194
1197
  suffix,
1195
1198
  suffixProps,
1199
+ suffixInteractive,
1196
1200
  invalid,
1197
1201
  loading,
1198
1202
  loadingIcon,
1199
1203
  validationMessage,
1200
1204
  validationIcon,
1201
1205
  validationMessageProps,
1206
+ onValueChange,
1202
1207
  type = "text",
1203
1208
  ...rest
1204
1209
  }, ref) => {
@@ -1208,10 +1213,18 @@ var Input = React5__namespace.forwardRef(
1208
1213
  const {
1209
1214
  "aria-invalid": ariaInvalidProp,
1210
1215
  "aria-describedby": ariaDescribedByProp,
1216
+ onChange: onChangeProp,
1211
1217
  ...inputProps
1212
1218
  } = rest;
1213
1219
  const ariaInvalid = invalid ?? ariaInvalidProp;
1214
- const messageId = React5__namespace.useId();
1220
+ const messageId = React4__namespace.useId();
1221
+ const handleChange = React4__namespace.useCallback(
1222
+ (event) => {
1223
+ onChangeProp?.(event);
1224
+ onValueChange?.(event.target.value);
1225
+ },
1226
+ [onChangeProp, onValueChange]
1227
+ );
1215
1228
  const resolvedAriaInvalid = typeof ariaInvalid === "string" ? ariaInvalid : ariaInvalid ? true : void 0;
1216
1229
  const describedBy = validationMessage ? [ariaDescribedByProp, messageId].filter(Boolean).join(" ") : ariaDescribedByProp;
1217
1230
  const controlWrapperClassName = cn(
@@ -1233,6 +1246,7 @@ var Input = React5__namespace.forwardRef(
1233
1246
  ),
1234
1247
  "aria-invalid": resolvedAriaInvalid,
1235
1248
  "aria-describedby": describedBy || void 0,
1249
+ onChange: handleChange,
1236
1250
  ...inputProps
1237
1251
  }
1238
1252
  );
@@ -1252,7 +1266,8 @@ var Input = React5__namespace.forwardRef(
1252
1266
  {
1253
1267
  ...prefixRest,
1254
1268
  className: cn(
1255
- "pointer-events-none absolute left-3 inline-flex items-center text-muted-foreground",
1269
+ "absolute left-3 top-1/2 -translate-y-1/2 inline-flex items-center text-muted-foreground",
1270
+ !prefixInteractive && "pointer-events-none",
1256
1271
  prefixClassName
1257
1272
  ),
1258
1273
  children: prefix
@@ -1264,7 +1279,8 @@ var Input = React5__namespace.forwardRef(
1264
1279
  {
1265
1280
  ...suffixRest,
1266
1281
  className: cn(
1267
- "pointer-events-none absolute right-3 inline-flex items-center gap-2 text-muted-foreground",
1282
+ "absolute right-3 top-1/2 -translate-y-1/2 inline-flex items-center gap-2 text-muted-foreground",
1283
+ !suffixInteractive && "pointer-events-none",
1268
1284
  suffixClassName
1269
1285
  ),
1270
1286
  children: suffixContent
@@ -1527,20 +1543,20 @@ function DatePicker({
1527
1543
  className,
1528
1544
  ...props
1529
1545
  }) {
1530
- const today = React5__namespace.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
1531
- const [displayed, setDisplayed] = React5__namespace.useState(
1546
+ const today = React4__namespace.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
1547
+ const [displayed, setDisplayed] = React4__namespace.useState(
1532
1548
  selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
1533
1549
  );
1534
1550
  minDate = clampToDay(minDate);
1535
1551
  maxDate = clampToDay(maxDate);
1536
- const disabledSet = React5__namespace.useMemo(() => {
1552
+ const disabledSet = React4__namespace.useMemo(() => {
1537
1553
  const s = /* @__PURE__ */ new Set();
1538
1554
  disabledDates?.forEach((d) => s.add(startOfDay(d).toISOString()));
1539
1555
  return s;
1540
1556
  }, [disabledDates]);
1541
1557
  const displayYear = displayed.getFullYear();
1542
1558
  const displayMonth = displayed.getMonth();
1543
- const weekdays = React5__namespace.useMemo(() => {
1559
+ const weekdays = React4__namespace.useMemo(() => {
1544
1560
  const labels = [];
1545
1561
  for (let i = 0; i < 7; i++) {
1546
1562
  const idx = i;
@@ -1549,7 +1565,7 @@ function DatePicker({
1549
1565
  }
1550
1566
  return labels;
1551
1567
  }, [callbacks]);
1552
- const grid = React5__namespace.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
1568
+ const grid = React4__namespace.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
1553
1569
  const isDateDisabled = (date) => {
1554
1570
  const d = startOfDay(date);
1555
1571
  if (minDate && d < minDate) return true;
@@ -1559,7 +1575,7 @@ function DatePicker({
1559
1575
  };
1560
1576
  const minYear = minDate?.getFullYear();
1561
1577
  const maxYear = maxDate?.getFullYear();
1562
- const getMonthLabel = React5__namespace.useCallback(
1578
+ const getMonthLabel = React4__namespace.useCallback(
1563
1579
  (year, monthIndex) => {
1564
1580
  const label = callbacks?.monthLabel?.(year, monthIndex);
1565
1581
  if (label === null || label === void 0) {
@@ -1569,7 +1585,7 @@ function DatePicker({
1569
1585
  },
1570
1586
  [callbacks]
1571
1587
  );
1572
- const getYearLabel = React5__namespace.useCallback(
1588
+ const getYearLabel = React4__namespace.useCallback(
1573
1589
  (year) => {
1574
1590
  const label = callbacks?.yearLabel?.(year);
1575
1591
  if (label === null || label === void 0) return String(year);
@@ -1577,7 +1593,7 @@ function DatePicker({
1577
1593
  },
1578
1594
  [callbacks]
1579
1595
  );
1580
- const clampMonthToBounds = React5__namespace.useCallback(
1596
+ const clampMonthToBounds = React4__namespace.useCallback(
1581
1597
  (year, monthIndex) => {
1582
1598
  let output = monthIndex;
1583
1599
  if (typeof minYear === "number" && year === minYear && minDate) {
@@ -1592,7 +1608,7 @@ function DatePicker({
1592
1608
  },
1593
1609
  [maxDate, minDate, maxYear, minYear]
1594
1610
  );
1595
- const yearOptions = React5__namespace.useMemo(() => {
1611
+ const yearOptions = React4__namespace.useMemo(() => {
1596
1612
  const fallbackWindow = 50;
1597
1613
  const start = typeof minYear === "number" ? minYear : displayYear - fallbackWindow;
1598
1614
  const end = typeof maxYear === "number" ? maxYear : displayYear + fallbackWindow;
@@ -1613,7 +1629,7 @@ function DatePicker({
1613
1629
  }
1614
1630
  return years;
1615
1631
  }, [displayYear, maxYear, minYear, selectedDate]);
1616
- const monthOptions = React5__namespace.useMemo(() => {
1632
+ const monthOptions = React4__namespace.useMemo(() => {
1617
1633
  const months = Array.from({ length: 12 }, (_, monthIndex) => {
1618
1634
  const disabled = typeof minYear === "number" && displayYear === minYear && minDate && monthIndex < minDate.getMonth() || typeof maxYear === "number" && displayYear === maxYear && maxDate && monthIndex > maxDate.getMonth();
1619
1635
  return {
@@ -1632,7 +1648,7 @@ function DatePicker({
1632
1648
  }
1633
1649
  return months.sort((a, b) => a.value - b.value).filter((option, index, arr) => index === 0 || option.value !== arr[index - 1].value);
1634
1650
  }, [displayMonth, displayYear, getMonthLabel, maxDate, maxYear, minDate, minYear]);
1635
- const handleMonthSelect = React5__namespace.useCallback((nextValue) => {
1651
+ const handleMonthSelect = React4__namespace.useCallback((nextValue) => {
1636
1652
  const nextMonth = Number.parseInt(nextValue, 10);
1637
1653
  if (Number.isNaN(nextMonth)) return;
1638
1654
  setDisplayed((prev) => {
@@ -1642,7 +1658,7 @@ function DatePicker({
1642
1658
  return next;
1643
1659
  });
1644
1660
  }, []);
1645
- const handleYearSelect = React5__namespace.useCallback(
1661
+ const handleYearSelect = React4__namespace.useCallback(
1646
1662
  (nextValue) => {
1647
1663
  const nextYear = Number.parseInt(nextValue, 10);
1648
1664
  if (Number.isNaN(nextYear)) return;
@@ -1790,14 +1806,14 @@ var DatePicker2 = ({
1790
1806
  ariaLabel,
1791
1807
  ...calendarProps
1792
1808
  }) => {
1793
- const [open, setOpen] = React5__namespace.default.useState(false);
1794
- const parser = React5__namespace.default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
1795
- const outputFormatter = React5__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
1796
- const labelFormatter = React5__namespace.default.useMemo(
1809
+ const [open, setOpen] = React4__namespace.default.useState(false);
1810
+ const parser = React4__namespace.default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
1811
+ const outputFormatter = React4__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
1812
+ const labelFormatter = React4__namespace.default.useMemo(
1797
1813
  () => displayFormatter ?? defaultDisplayFormatter,
1798
1814
  [displayFormatter]
1799
1815
  );
1800
- const parsedValue = React5__namespace.default.useMemo(() => {
1816
+ const parsedValue = React4__namespace.default.useMemo(() => {
1801
1817
  if (value === null || value === void 0) return void 0;
1802
1818
  if (value instanceof Date) return value;
1803
1819
  const parsed = parser(value);
@@ -1806,26 +1822,26 @@ var DatePicker2 = ({
1806
1822
  const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder3;
1807
1823
  const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change date, current selection ${labelFormatter(parsedValue)}` : "Open date picker");
1808
1824
  const shouldShowClear = allowClear && !disabled && !!parsedValue;
1809
- const handleClose = React5__namespace.default.useCallback(() => setOpen(false), []);
1810
- const emitChange = React5__namespace.default.useCallback(
1825
+ const handleClose = React4__namespace.default.useCallback(() => setOpen(false), []);
1826
+ const emitChange = React4__namespace.default.useCallback(
1811
1827
  (next) => {
1812
1828
  onChange?.(next);
1813
1829
  onValueChange?.(next ? outputFormatter(next) : void 0);
1814
1830
  },
1815
1831
  [onChange, onValueChange, outputFormatter]
1816
1832
  );
1817
- const handleSelect = React5__namespace.default.useCallback(
1833
+ const handleSelect = React4__namespace.default.useCallback(
1818
1834
  (next) => {
1819
1835
  emitChange(next);
1820
1836
  if (closeOnSelect && next) handleClose();
1821
1837
  },
1822
1838
  [closeOnSelect, emitChange, handleClose]
1823
1839
  );
1824
- const handleClear = React5__namespace.default.useCallback(() => {
1840
+ const handleClear = React4__namespace.default.useCallback(() => {
1825
1841
  emitChange(void 0);
1826
1842
  handleClose();
1827
1843
  }, [emitChange, handleClose]);
1828
- const handleOpenChange = React5__namespace.default.useCallback(
1844
+ const handleOpenChange = React4__namespace.default.useCallback(
1829
1845
  (nextOpen) => {
1830
1846
  if (disabled && nextOpen) return;
1831
1847
  setOpen(nextOpen);
@@ -1997,15 +2013,15 @@ function MonthCal({
1997
2013
  onYearBackward,
1998
2014
  onYearForward
1999
2015
  }) {
2000
- const today = React5__namespace.useMemo(() => {
2016
+ const today = React4__namespace.useMemo(() => {
2001
2017
  const now = /* @__PURE__ */ new Date();
2002
2018
  now.setDate(1);
2003
2019
  now.setHours(0, 0, 0, 0);
2004
2020
  return now;
2005
2021
  }, []);
2006
- const selectedMonthDate = React5__namespace.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
2007
- const min = React5__namespace.useMemo(() => normalizeMonth(minDate), [minDate]);
2008
- const max = React5__namespace.useMemo(() => normalizeMonth(maxDate), [maxDate]);
2022
+ const selectedMonthDate = React4__namespace.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
2023
+ const min = React4__namespace.useMemo(() => normalizeMonth(minDate), [minDate]);
2024
+ const max = React4__namespace.useMemo(() => normalizeMonth(maxDate), [maxDate]);
2009
2025
  let effectiveMin = min;
2010
2026
  if (min && max && min > max) {
2011
2027
  effectiveMin = max;
@@ -2014,10 +2030,10 @@ function MonthCal({
2014
2030
  const minMonth = effectiveMin?.getMonth();
2015
2031
  const maxYear = max?.getFullYear();
2016
2032
  const maxMonth = max?.getMonth();
2017
- const [menuYear, setMenuYear] = React5__namespace.useState(
2033
+ const [menuYear, setMenuYear] = React4__namespace.useState(
2018
2034
  () => selectedMonthDate?.getFullYear() ?? today.getFullYear()
2019
2035
  );
2020
- React5__namespace.useEffect(() => {
2036
+ React4__namespace.useEffect(() => {
2021
2037
  if (selectedMonthDate) {
2022
2038
  const year = selectedMonthDate.getFullYear();
2023
2039
  if (year !== menuYear) {
@@ -2025,7 +2041,7 @@ function MonthCal({
2025
2041
  }
2026
2042
  }
2027
2043
  }, [selectedMonthDate, menuYear]);
2028
- React5__namespace.useEffect(() => {
2044
+ React4__namespace.useEffect(() => {
2029
2045
  if (typeof minYear === "number" && menuYear < minYear) {
2030
2046
  setMenuYear(minYear);
2031
2047
  return;
@@ -2036,7 +2052,7 @@ function MonthCal({
2036
2052
  }, [minYear, maxYear, menuYear]);
2037
2053
  const disablePrevYear = typeof minYear === "number" ? menuYear <= minYear : false;
2038
2054
  const disableNextYear = typeof maxYear === "number" ? menuYear >= maxYear : false;
2039
- const yearOptions = React5__namespace.useMemo(() => {
2055
+ const yearOptions = React4__namespace.useMemo(() => {
2040
2056
  const fallbackWindow = 50;
2041
2057
  const start = typeof minYear === "number" ? minYear : menuYear - fallbackWindow;
2042
2058
  const end = typeof maxYear === "number" ? maxYear : menuYear + fallbackWindow;
@@ -2050,7 +2066,7 @@ function MonthCal({
2050
2066
  }
2051
2067
  return years;
2052
2068
  }, [maxYear, menuYear, minYear]);
2053
- const formatYearLabel = React5__namespace.useCallback(
2069
+ const formatYearLabel = React4__namespace.useCallback(
2054
2070
  (year) => {
2055
2071
  const raw = callbacks?.yearLabel?.(year);
2056
2072
  if (raw === null || raw === void 0) return String(year);
@@ -2058,7 +2074,7 @@ function MonthCal({
2058
2074
  },
2059
2075
  [callbacks]
2060
2076
  );
2061
- const handleYearSelect = React5__namespace.useCallback(
2077
+ const handleYearSelect = React4__namespace.useCallback(
2062
2078
  (nextValue) => {
2063
2079
  const nextYear = Number.parseInt(nextValue, 10);
2064
2080
  if (Number.isNaN(nextYear)) return;
@@ -2068,7 +2084,7 @@ function MonthCal({
2068
2084
  },
2069
2085
  [maxYear, minYear]
2070
2086
  );
2071
- const disabledPairs = React5__namespace.useMemo(() => {
2087
+ const disabledPairs = React4__namespace.useMemo(() => {
2072
2088
  if (!disabledDates?.length) return [];
2073
2089
  const pairs = [];
2074
2090
  disabledDates.forEach((date) => {
@@ -2213,14 +2229,14 @@ var MonthPicker2 = ({
2213
2229
  ariaLabel,
2214
2230
  ...calendarProps
2215
2231
  }) => {
2216
- const [open, setOpen] = React5__namespace.default.useState(false);
2217
- const parser = React5__namespace.default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
2218
- const outputFormatter = React5__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
2219
- const labelFormatter = React5__namespace.default.useMemo(
2232
+ const [open, setOpen] = React4__namespace.default.useState(false);
2233
+ const parser = React4__namespace.default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
2234
+ const outputFormatter = React4__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
2235
+ const labelFormatter = React4__namespace.default.useMemo(
2220
2236
  () => displayFormatter ?? defaultDisplayFormatter2,
2221
2237
  [displayFormatter]
2222
2238
  );
2223
- const parsedValue = React5__namespace.default.useMemo(() => {
2239
+ const parsedValue = React4__namespace.default.useMemo(() => {
2224
2240
  if (value === null || value === void 0) return void 0;
2225
2241
  if (value instanceof Date) return normalizeMonth2(value);
2226
2242
  if (typeof value === "string") {
@@ -2232,8 +2248,8 @@ var MonthPicker2 = ({
2232
2248
  const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder3;
2233
2249
  const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change month, current selection ${labelFormatter(parsedValue)}` : "Open month picker");
2234
2250
  const shouldShowClear = allowClear && !disabled && !!parsedValue;
2235
- const handleClose = React5__namespace.default.useCallback(() => setOpen(false), []);
2236
- const emitChange = React5__namespace.default.useCallback(
2251
+ const handleClose = React4__namespace.default.useCallback(() => setOpen(false), []);
2252
+ const emitChange = React4__namespace.default.useCallback(
2237
2253
  (next) => {
2238
2254
  const normalized = next ? normalizeMonth2(next) : void 0;
2239
2255
  onChange?.(normalized);
@@ -2241,18 +2257,18 @@ var MonthPicker2 = ({
2241
2257
  },
2242
2258
  [onChange, onValueChange, outputFormatter]
2243
2259
  );
2244
- const handleSelect = React5__namespace.default.useCallback(
2260
+ const handleSelect = React4__namespace.default.useCallback(
2245
2261
  (next) => {
2246
2262
  emitChange(next);
2247
2263
  if (closeOnSelect && next) handleClose();
2248
2264
  },
2249
2265
  [closeOnSelect, emitChange, handleClose]
2250
2266
  );
2251
- const handleClear = React5__namespace.default.useCallback(() => {
2267
+ const handleClear = React4__namespace.default.useCallback(() => {
2252
2268
  emitChange(void 0);
2253
2269
  handleClose();
2254
2270
  }, [emitChange, handleClose]);
2255
- const handleOpenChange = React5__namespace.default.useCallback(
2271
+ const handleOpenChange = React4__namespace.default.useCallback(
2256
2272
  (nextOpen) => {
2257
2273
  if (disabled && nextOpen) return;
2258
2274
  setOpen(nextOpen);
@@ -2458,21 +2474,21 @@ var LookupSelect = ({
2458
2474
  loadingMessage = "Loading...",
2459
2475
  dropdownPortalId
2460
2476
  }) => {
2461
- const [inputValue, setInputValue] = React5.useState("");
2462
- const [suggestions, setSuggestions] = React5.useState([]);
2463
- const [optionLabels, setOptionLabels] = React5.useState({});
2464
- const [loading, setLoading] = React5.useState(false);
2465
- const [fetchError, setFetchError] = React5.useState(null);
2466
- const [isDropdownOpen, setIsDropdownOpen] = React5.useState(false);
2467
- const containerRef = React5.useRef(null);
2468
- const fetchDelayRef = React5.useRef(null);
2469
- const requestIdRef = React5.useRef(0);
2470
- const [dropdownStyles, setDropdownStyles] = React5.useState();
2471
- const dropdownContentRef = React5.useRef(null);
2472
- const assignDropdownContentRef = React5.useCallback((node) => {
2477
+ const [inputValue, setInputValue] = React4.useState("");
2478
+ const [suggestions, setSuggestions] = React4.useState([]);
2479
+ const [optionLabels, setOptionLabels] = React4.useState({});
2480
+ const [loading, setLoading] = React4.useState(false);
2481
+ const [fetchError, setFetchError] = React4.useState(null);
2482
+ const [isDropdownOpen, setIsDropdownOpen] = React4.useState(false);
2483
+ const containerRef = React4.useRef(null);
2484
+ const fetchDelayRef = React4.useRef(null);
2485
+ const requestIdRef = React4.useRef(0);
2486
+ const [dropdownStyles, setDropdownStyles] = React4.useState();
2487
+ const dropdownContentRef = React4.useRef(null);
2488
+ const assignDropdownContentRef = React4.useCallback((node) => {
2473
2489
  dropdownContentRef.current = node;
2474
2490
  }, []);
2475
- const dropdownPortalElement = React5.useMemo(() => {
2491
+ const dropdownPortalElement = React4.useMemo(() => {
2476
2492
  if (typeof document === "undefined") return null;
2477
2493
  if (dropdownPortalId) {
2478
2494
  const element = document.getElementById(dropdownPortalId);
@@ -2481,7 +2497,7 @@ var LookupSelect = ({
2481
2497
  return document.body;
2482
2498
  }, [dropdownPortalId]);
2483
2499
  const limitReached = value.length >= maxTags;
2484
- const upsertOptionLabels = React5.useCallback((options) => {
2500
+ const upsertOptionLabels = React4.useCallback((options) => {
2485
2501
  setOptionLabels((prev) => {
2486
2502
  let next = null;
2487
2503
  options.forEach((opt) => {
@@ -2494,7 +2510,7 @@ var LookupSelect = ({
2494
2510
  return next ?? prev;
2495
2511
  });
2496
2512
  }, []);
2497
- const addTag = React5.useCallback(
2513
+ const addTag = React4.useCallback(
2498
2514
  (val) => {
2499
2515
  const trimmed = val.trim();
2500
2516
  if (!trimmed) return;
@@ -2507,7 +2523,7 @@ var LookupSelect = ({
2507
2523
  },
2508
2524
  [value, onChange, maxTags]
2509
2525
  );
2510
- const removeTag = React5.useCallback(
2526
+ const removeTag = React4.useCallback(
2511
2527
  (index) => {
2512
2528
  if (index < 0) return;
2513
2529
  const newTags = value.filter((_, i) => i !== index);
@@ -2515,7 +2531,7 @@ var LookupSelect = ({
2515
2531
  },
2516
2532
  [value, onChange]
2517
2533
  );
2518
- const handleKeyDown = React5.useCallback(
2534
+ const handleKeyDown = React4.useCallback(
2519
2535
  (e) => {
2520
2536
  if (e.key === "Enter" || e.key === ",") {
2521
2537
  e.preventDefault();
@@ -2526,21 +2542,21 @@ var LookupSelect = ({
2526
2542
  },
2527
2543
  [inputValue, removeTag, value.length]
2528
2544
  );
2529
- const handleClear = React5.useCallback(() => {
2545
+ const handleClear = React4.useCallback(() => {
2530
2546
  setInputValue("");
2531
2547
  setSuggestions([]);
2532
2548
  setIsDropdownOpen(false);
2533
2549
  setFetchError(null);
2534
2550
  if (onClear) onClear();
2535
2551
  }, [onClear]);
2536
- const handleSuggestionSelect = React5.useCallback(
2552
+ const handleSuggestionSelect = React4.useCallback(
2537
2553
  (option) => {
2538
2554
  upsertOptionLabels([option]);
2539
2555
  addTag(option.value);
2540
2556
  },
2541
2557
  [addTag, upsertOptionLabels]
2542
2558
  );
2543
- const updateDropdownPosition = React5.useCallback(() => {
2559
+ const updateDropdownPosition = React4.useCallback(() => {
2544
2560
  if (!dropdownPortalElement || !containerRef.current) return;
2545
2561
  const rect = containerRef.current.getBoundingClientRect();
2546
2562
  setDropdownStyles({
@@ -2551,7 +2567,7 @@ var LookupSelect = ({
2551
2567
  zIndex: 50
2552
2568
  });
2553
2569
  }, [dropdownPortalElement]);
2554
- React5.useEffect(() => {
2570
+ React4.useEffect(() => {
2555
2571
  if (!fetchSuggestions) return;
2556
2572
  if (fetchDelayRef.current) {
2557
2573
  clearTimeout(fetchDelayRef.current);
@@ -2591,7 +2607,7 @@ var LookupSelect = ({
2591
2607
  }
2592
2608
  };
2593
2609
  }, [inputValue, fetchSuggestions, suggestionDebounce, upsertOptionLabels]);
2594
- React5.useEffect(() => {
2610
+ React4.useEffect(() => {
2595
2611
  const handleDocumentClick = (event) => {
2596
2612
  const target = event.target;
2597
2613
  if (containerRef.current?.contains(target)) return;
@@ -2603,11 +2619,11 @@ var LookupSelect = ({
2603
2619
  document.removeEventListener("mousedown", handleDocumentClick);
2604
2620
  };
2605
2621
  }, []);
2606
- React5.useEffect(() => {
2622
+ React4.useEffect(() => {
2607
2623
  if (!limitReached) return;
2608
2624
  setIsDropdownOpen(false);
2609
2625
  }, [limitReached]);
2610
- React5.useEffect(() => {
2626
+ React4.useEffect(() => {
2611
2627
  if (!dropdownPortalElement) return;
2612
2628
  if (!isDropdownOpen) return;
2613
2629
  updateDropdownPosition();
@@ -3292,7 +3308,7 @@ var AdvanceSearch = ({
3292
3308
  onSearch,
3293
3309
  onClear
3294
3310
  }) => {
3295
- const fieldsData = React5.useMemo(() => {
3311
+ const fieldsData = React4.useMemo(() => {
3296
3312
  if (fields.length === 0) throw new Error("fields cannot be an empty array");
3297
3313
  return fields || [];
3298
3314
  }, [fields]);
@@ -3312,8 +3328,8 @@ var AdvanceSearch = ({
3312
3328
  defaultValues: {}
3313
3329
  });
3314
3330
  const { handleSubmit, unregister, resetField, getValues, clearErrors, setError } = form;
3315
- const [operatorErrors, setOperatorErrors] = React5__namespace.default.useState({});
3316
- const clearOperatorError = React5.useCallback(
3331
+ const [operatorErrors, setOperatorErrors] = React4__namespace.default.useState({});
3332
+ const clearOperatorError = React4.useCallback(
3317
3333
  (rowId) => {
3318
3334
  setOperatorErrors((prev) => {
3319
3335
  if (!(rowId in prev)) return prev;
@@ -3323,7 +3339,7 @@ var AdvanceSearch = ({
3323
3339
  },
3324
3340
  [setOperatorErrors]
3325
3341
  );
3326
- const clearValue = React5.useCallback(
3342
+ const clearValue = React4.useCallback(
3327
3343
  (rowId, which) => {
3328
3344
  const fieldName = `${which}_${rowId}`;
3329
3345
  resetField(fieldName, { defaultValue: void 0 });
@@ -3333,13 +3349,13 @@ var AdvanceSearch = ({
3333
3349
  },
3334
3350
  [resetField, clearErrors]
3335
3351
  );
3336
- const parseRangeValue = React5.useCallback((raw, fieldType) => {
3352
+ const parseRangeValue = React4.useCallback((raw, fieldType) => {
3337
3353
  if (!raw) return void 0;
3338
3354
  const normalized = fieldType === "datemonth" ? `${raw}-01` : raw;
3339
3355
  const parsed = dateFns.parseISO(normalized);
3340
3356
  return dateFns.isValid(parsed) ? parsed : void 0;
3341
3357
  }, []);
3342
- const onSubmit = React5.useCallback(() => {
3358
+ const onSubmit = React4.useCallback(() => {
3343
3359
  const operatorValidation = {};
3344
3360
  rows.forEach((r) => {
3345
3361
  const availableOperators = operatorsForField(r.fieldName);
@@ -3557,11 +3573,11 @@ function selectValueToBoolean(value) {
3557
3573
  return void 0;
3558
3574
  }
3559
3575
  var useHover = () => {
3560
- const [hovering, setHovering] = React5.useState(false);
3561
- const prevRef = React5.useRef(null);
3562
- const onMouseEnter = React5.useCallback(() => setHovering(true), []);
3563
- const onMouseLeave = React5.useCallback(() => setHovering(false), []);
3564
- const nodeRefCallback = React5.useCallback(
3576
+ const [hovering, setHovering] = React4.useState(false);
3577
+ const prevRef = React4.useRef(null);
3578
+ const onMouseEnter = React4.useCallback(() => setHovering(true), []);
3579
+ const onMouseLeave = React4.useCallback(() => setHovering(false), []);
3580
+ const nodeRefCallback = React4.useCallback(
3565
3581
  (node) => {
3566
3582
  if (prevRef.current) {
3567
3583
  prevRef.current.removeEventListener("mouseenter", onMouseEnter);
@@ -3589,15 +3605,15 @@ var useIntersectionObserver = ({
3589
3605
  initialIsIntersecting = false,
3590
3606
  onChange
3591
3607
  } = {}) => {
3592
- const [ref, setRef] = React5.useState(null);
3593
- const [state, setState] = React5.useState(() => ({
3608
+ const [ref, setRef] = React4.useState(null);
3609
+ const [state, setState] = React4.useState(() => ({
3594
3610
  isIntersecting: initialIsIntersecting,
3595
3611
  entry: void 0
3596
3612
  }));
3597
- const callbackRef = React5.useRef(null);
3613
+ const callbackRef = React4.useRef(null);
3598
3614
  callbackRef.current = onChange;
3599
3615
  const frozen = state.entry?.isIntersecting && freezeOnceVisible;
3600
- React5.useEffect(() => {
3616
+ React4.useEffect(() => {
3601
3617
  if (!ref) return;
3602
3618
  if (!("IntersectionObserver" in window)) return;
3603
3619
  if (frozen) return;
@@ -3627,8 +3643,8 @@ var useIntersectionObserver = ({
3627
3643
  frozen,
3628
3644
  freezeOnceVisible
3629
3645
  ]);
3630
- const prevRef = React5.useRef(null);
3631
- React5.useEffect(() => {
3646
+ const prevRef = React4.useRef(null);
3647
+ React4.useEffect(() => {
3632
3648
  if (!ref && state.entry?.target && !freezeOnceVisible && !frozen && prevRef.current !== state.entry.target) {
3633
3649
  prevRef.current = state.entry.target;
3634
3650
  setState({ isIntersecting: initialIsIntersecting, entry: void 0 });
@@ -3645,8 +3661,8 @@ var isValidMediaQueryString = (query) => {
3645
3661
  return query !== "not all";
3646
3662
  };
3647
3663
  var useMediaQuery = ({ query }) => {
3648
- const [matches, setMatches] = React5.useState(false);
3649
- React5.useEffect(() => {
3664
+ const [matches, setMatches] = React4.useState(false);
3665
+ React4.useEffect(() => {
3650
3666
  if (typeof window === "undefined") {
3651
3667
  return;
3652
3668
  }
@@ -3682,8 +3698,8 @@ var useTruncated = ({
3682
3698
  onChange,
3683
3699
  resizeDetectDelay = 150
3684
3700
  }) => {
3685
- const [isTruncated, setIsTruncated] = React5.useState(false);
3686
- React5.useEffect(() => {
3701
+ const [isTruncated, setIsTruncated] = React4.useState(false);
3702
+ React4.useEffect(() => {
3687
3703
  const element = elementRef.current;
3688
3704
  if (!element) return;
3689
3705
  const checkTruncate = debounce(() => {
@@ -3903,7 +3919,7 @@ var ColumnSeparator = ({ show, className, ...props }) => {
3903
3919
  }
3904
3920
  );
3905
3921
  };
3906
- var ColumnSeparator_default = React5__namespace.default.memo(ColumnSeparator);
3922
+ var ColumnSeparator_default = React4__namespace.default.memo(ColumnSeparator);
3907
3923
  var StatusContentSlot = ({
3908
3924
  content,
3909
3925
  icon,
@@ -3922,7 +3938,7 @@ var StatusContentSlot = ({
3922
3938
  content
3923
3939
  ] });
3924
3940
  };
3925
- var StatusContentSlot_default = React5__namespace.default.memo(StatusContentSlot);
3941
+ var StatusContentSlot_default = React4__namespace.default.memo(StatusContentSlot);
3926
3942
  var stateOptions = [
3927
3943
  "columnFilters",
3928
3944
  "globalFilter",
@@ -3975,9 +3991,9 @@ var modelOptions = [
3975
3991
  "getCenterVisibleLeafColumns"
3976
3992
  ];
3977
3993
  var DataTableDevTool = ({ table }) => {
3978
- const [open, setOpen] = React5.useState(false);
3979
- const [visibleStates, setVisibleStates] = React5.useState([]);
3980
- const [visibleModels, setVisibleModels] = React5.useState([]);
3994
+ const [open, setOpen] = React4.useState(false);
3995
+ const [visibleStates, setVisibleStates] = React4.useState([]);
3996
+ const [visibleModels, setVisibleModels] = React4.useState([]);
3981
3997
  const tableState = table.getState();
3982
3998
  const toggleValue = (arr, value) => arr.includes(value) ? arr.filter((v) => v !== value) : [...arr, value];
3983
3999
  const getCircularReplacer = () => {
@@ -4237,14 +4253,14 @@ var DataTable = ({
4237
4253
  if (isDefined(tableRef) && !isDefined(tableRef?.current)) {
4238
4254
  tableRef.current = table;
4239
4255
  }
4240
- const tableContainerRef = React5.useRef(null);
4256
+ const tableContainerRef = React4.useRef(null);
4241
4257
  const isTableEmpty = table.getCoreRowModel().rows.length === 0;
4242
4258
  const isTableEmptyAfterFiltering = table.getRowModel().rows.length === 0;
4243
4259
  const isFiltering = table.getState().columnFilters.length > 0 || !!table.getState().globalFilter;
4244
4260
  const leftVisibleLeftColumns = table.getLeftVisibleLeafColumns();
4245
4261
  const centerVisibleLeafColumns = table.getCenterVisibleLeafColumns();
4246
4262
  const rightVisibleLeafColumns = table.getRightVisibleLeafColumns();
4247
- const { isSomeColumnsFilterable, filterableColumns } = React5.useMemo(() => {
4263
+ const { isSomeColumnsFilterable, filterableColumns } = React4.useMemo(() => {
4248
4264
  const mergedColumns = [
4249
4265
  ...leftVisibleLeftColumns,
4250
4266
  ...centerVisibleLeafColumns,
@@ -4255,7 +4271,7 @@ var DataTable = ({
4255
4271
  );
4256
4272
  return { isSomeColumnsFilterable: isSomeColumnsFilterable2, filterableColumns: mergedColumns };
4257
4273
  }, [centerVisibleLeafColumns, leftVisibleLeftColumns, rightVisibleLeafColumns]);
4258
- const autoStatusKey = React5.useMemo(() => {
4274
+ const autoStatusKey = React4.useMemo(() => {
4259
4275
  if (isInitialLoading) return "initialLoading";
4260
4276
  if (isTableEmpty) return "emptyData";
4261
4277
  if (isTableEmptyAfterFiltering) return "emptyFilteredData";
@@ -4273,14 +4289,14 @@ var DataTable = ({
4273
4289
  scrollFetch?.hasMore,
4274
4290
  scrollFetch?.isFetchingMore
4275
4291
  ]);
4276
- const activeStatusContentComputed = React5.useMemo(() => {
4292
+ const activeStatusContentComputed = React4.useMemo(() => {
4277
4293
  if (!activeStatusContent) return autoStatusKey;
4278
4294
  if (typeof activeStatusContent === "function") {
4279
4295
  return activeStatusContent({ defaultComputedValue: autoStatusKey });
4280
4296
  }
4281
4297
  return activeStatusContent;
4282
4298
  }, [activeStatusContent, autoStatusKey]);
4283
- const fetchMoreOnScrollReached = React5.useCallback(
4299
+ const fetchMoreOnScrollReached = React4.useCallback(
4284
4300
  (containerRefElement) => {
4285
4301
  if (!scrollFetch?.enabled || !containerRefElement || scrollFetch?.isFetchingMore || !scrollFetch?.hasMore || !scrollFetch?.fetchMore) {
4286
4302
  return;
@@ -4314,7 +4330,7 @@ var DataTable = ({
4314
4330
  // eslint-disable-next-line react-hooks/exhaustive-deps
4315
4331
  [scrollFetch?.enabled, scrollFetch?.isFetchingMore, scrollFetch?.hasMore, scrollFetch?.fetchMore]
4316
4332
  );
4317
- React5.useEffect(() => {
4333
+ React4.useEffect(() => {
4318
4334
  fetchMoreOnScrollReached(tableContainerRef.current);
4319
4335
  }, [fetchMoreOnScrollReached]);
4320
4336
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -4444,7 +4460,7 @@ var DataTable = ({
4444
4460
  ),
4445
4461
  /* @__PURE__ */ jsxRuntime.jsx(TableBody, { ...components?.tableBodyProps, children: table.getRowModel().rows.map((row) => {
4446
4462
  const tableDataRowProps = typeof components?.tableDataRowProps === "function" ? components.tableDataRowProps({ row, table }) || {} : components?.tableDataRowProps || {};
4447
- return /* @__PURE__ */ React5.createElement(
4463
+ return /* @__PURE__ */ React4.createElement(
4448
4464
  TableRow,
4449
4465
  {
4450
4466
  "data-testid": `table-data-row-${row.id}`,
@@ -4747,9 +4763,11 @@ var buttonVariants2 = classVarianceAuthority.cva(
4747
4763
  variant: {
4748
4764
  default: "border bg-[#8B8B8B] text-white shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:hover:bg-input/50",
4749
4765
  success: "bg-sus-primary-1 text-primary-foreground shadow-xs hover:bg-sus-primary/90",
4750
- error: "border border-[#BB0B0E] bg-[#BB0B0E] shadow-xs hover:bg-accent hover:text-accent-foreground text-white",
4766
+ error: "border border-[#BB0B0E] text-[#BB0B0E] bg-white shadow-xs hover:bg-accent hover:text-accent-foreground",
4751
4767
  warning: "bg-yellow-500 text-black shadow-xs hover:bg-yellow-600 dark:hover:bg-yellow-400",
4752
- cancel: "border bg-[#8B8B8B] text-white shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:hover:bg-input/50"
4768
+ cancel: "border bg-[#8B8B8B] text-white shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:hover:bg-input/50",
4769
+ confirm: "border border-[#BB0B0E] text-[#BB0B0E] bg-white shadow-xs hover:bg-accent hover:text-accent-foreground",
4770
+ "confirm-green": "border border-[#379A2A] text-[#379A2A] bg-white shadow-xs hover:bg-accent hover:text-accent-foreground"
4753
4771
  },
4754
4772
  size: {
4755
4773
  default: "h-9 px-4 has-[>svg]:px-3",
@@ -4791,6 +4809,154 @@ function Button2({
4791
4809
  }
4792
4810
  );
4793
4811
  }
4812
+
4813
+ // src/components/dialog-alert/lib/constants.ts
4814
+ var DIALOG_ALERT_I18N_NAMESPACE = "dialog_alert";
4815
+
4816
+ // src/components/dialog-alert/locale/default.ts
4817
+ var defaultResource = {
4818
+ sharedui: {
4819
+ [DIALOG_ALERT_I18N_NAMESPACE]: {
4820
+ cancel: "Cancel",
4821
+ close: "Close",
4822
+ "success.saved": {
4823
+ title: "Successfully",
4824
+ description: "Data has been successfully saved"
4825
+ },
4826
+ "success.deleted": {
4827
+ title: "Successfully",
4828
+ description: "Data has been successfully deleted"
4829
+ },
4830
+ "success.removed": {
4831
+ title: "Successfully",
4832
+ description: "Data has been successfully removed"
4833
+ },
4834
+ "error.api_db_error": {
4835
+ title: "API/Database Error",
4836
+ description: "Failed to connect to the system. Please check API or database connection."
4837
+ },
4838
+ "error.permission_denied": {
4839
+ title: "Permission Denied",
4840
+ description: "You do not have permission to delete this data.",
4841
+ confirm_text: "Discard"
4842
+ },
4843
+ "error.session_expired": {
4844
+ title: "Session Expired",
4845
+ description: "Your session has expired or you have been logged out. Please sign in again.",
4846
+ confirm_text: "Logout"
4847
+ },
4848
+ "error.user_not_found": {
4849
+ title: "User Not Found",
4850
+ description: "The system could not locate the user account.",
4851
+ confirm_text: "Logout"
4852
+ },
4853
+ "error.data_not_found": {
4854
+ title: "Data Not Found",
4855
+ description: "The data has already been deleted or does not exist in the system."
4856
+ },
4857
+ "error.data_restrict_editing": {
4858
+ title: "Data Status Restricts Editing",
4859
+ description: "Data status does not allow editing."
4860
+ },
4861
+ "error.network_timeout_error": {
4862
+ title: "Network Error / Timeout",
4863
+ description: "The system could not connect to the network or the request took too long to process."
4864
+ },
4865
+ "error.queue_full": {
4866
+ title: "Queue Full",
4867
+ description: "The notification queue has reached its limit. Please try again later."
4868
+ },
4869
+ "error.invalid_data_format": {
4870
+ title: "Invalid Data Format",
4871
+ description: "Data creation failed due to invalid or incorrectly formatted data."
4872
+ },
4873
+ "error.data_linked_to_system_data": {
4874
+ title: "Data Linked to System Data",
4875
+ description: "Cannot delete data because they are linked to existing system data."
4876
+ },
4877
+ "error.pending_workflow_conflict": {
4878
+ title: "Pending Workflow Conflict ",
4879
+ description: "The data is currently involved in a pending workflow or approval process and cannot be deactivated."
4880
+ },
4881
+ "error.invalid_incomplete_data": {
4882
+ title: "Invalid or Incomplete Data",
4883
+ description: "Data status cannot be changed due to incomplete or invalid information."
4884
+ },
4885
+ "error.client_side_error": {
4886
+ title: "Client-Side Error",
4887
+ description: "An error occurred on the client side. Please refresh the page or try again."
4888
+ },
4889
+ "error.system_limitation": {
4890
+ title: "System Limitation",
4891
+ description: "The search cannot be completed due to system limitations. Please simplify your query."
4892
+ },
4893
+ "error.timeout": {
4894
+ title: "Timeout",
4895
+ description: "Request failed due to a system error or timeout. Please try again."
4896
+ },
4897
+ "error.duplicate_data": {
4898
+ title: "Duplicate Data",
4899
+ description: "The data you entered already exists in the system."
4900
+ },
4901
+ "error.something_went_wrong": {
4902
+ title: "Something Went Wrong",
4903
+ description: "An unknown error occurred."
4904
+ },
4905
+ "confirm.delete": {
4906
+ title: "Confirmation",
4907
+ description: "Are you sure you want to delete this item?",
4908
+ confirm_text: "Delete"
4909
+ },
4910
+ "confirm.inactive": {
4911
+ title: "Confirmation",
4912
+ description: "Are you sure you want to inactive this item?",
4913
+ confirm_text: "Inactive"
4914
+ },
4915
+ "confirm.active": {
4916
+ variant: "confirm-green",
4917
+ title: "Confirmation",
4918
+ description: "Are you sure you want to active this item?",
4919
+ confirm_text: "Active"
4920
+ },
4921
+ "confirm.leave_page": {
4922
+ title: "Confirmation",
4923
+ description: "Unsaved changes. Do you want to leave this page?",
4924
+ confirm_text: "Leave"
4925
+ },
4926
+ "confirm.remove": {
4927
+ title: "Confirmation",
4928
+ description: "Are you sure you want to remove this item?",
4929
+ confirm_text: "Remove"
4930
+ },
4931
+ "confirm.logout": {
4932
+ title: "Confirmation",
4933
+ description: "Do you want to log out?",
4934
+ confirm_text: "Logout"
4935
+ }
4936
+ }
4937
+ }
4938
+ };
4939
+
4940
+ // src/components/dialog-alert/locale/i18n.ts
4941
+ i18n__default.default.use(reactI18next.initReactI18next).init({
4942
+ resources: defaultResource,
4943
+ lng: "sharedui",
4944
+ fallbackLng: "sharedui",
4945
+ defaultNS: DIALOG_ALERT_I18N_NAMESPACE,
4946
+ interpolation: {
4947
+ escapeValue: false
4948
+ // react already safes from xss
4949
+ }
4950
+ });
4951
+ var i18n_default = i18n__default.default;
4952
+ var titleColorVariant = {
4953
+ default: "",
4954
+ success: "text-green-600",
4955
+ error: "text-red-600",
4956
+ warning: "text-yellow-600",
4957
+ confirm: "text-red-600",
4958
+ "confirm-green": "text-red-600"
4959
+ };
4794
4960
  function DialogAlert({
4795
4961
  open,
4796
4962
  onOpenChange,
@@ -4798,7 +4964,7 @@ function DialogAlert({
4798
4964
  description,
4799
4965
  variant = "default",
4800
4966
  confirmText,
4801
- cancelText = "Cancel",
4967
+ cancelText = "cancel",
4802
4968
  onConfirm,
4803
4969
  onCancel,
4804
4970
  showCancel = true,
@@ -4807,38 +4973,272 @@ function DialogAlert({
4807
4973
  persistent = false
4808
4974
  }) {
4809
4975
  const alignClass = align === "start" ? "justify-start" : align === "end" ? "justify-end" : "justify-center";
4810
- const handleCancel = React5.useCallback(() => {
4976
+ const { t } = reactI18next.useTranslation(DIALOG_ALERT_I18N_NAMESPACE);
4977
+ const handleCancel = React4.useCallback(() => {
4811
4978
  onCancel?.();
4812
4979
  onOpenChange(false);
4813
4980
  }, [onCancel, onOpenChange]);
4814
- const handleConfirm = React5.useCallback(() => {
4981
+ const handleConfirm = React4.useCallback(() => {
4815
4982
  onConfirm?.();
4816
4983
  }, [onConfirm]);
4817
4984
  return /* @__PURE__ */ jsxRuntime.jsx(Dialog2, { open, onOpenChange: persistent ? () => {
4818
4985
  } : onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent2, { className: "max-w-md", showCloseButton: !persistent, children: [
4819
4986
  /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader2, { children: [
4820
- title && /* @__PURE__ */ jsxRuntime.jsx(DialogTitle2, { className: variantClass(variant), children: title }),
4821
- description && /* @__PURE__ */ jsxRuntime.jsx(DialogDescription2, { children: description })
4987
+ title && /* @__PURE__ */ jsxRuntime.jsx(DialogTitle2, { className: titleColorVariant[variant], children: t(title) }),
4988
+ description && /* @__PURE__ */ jsxRuntime.jsx(DialogDescription2, { children: t(description) })
4822
4989
  ] }),
4823
4990
  outlet && outlet,
4824
4991
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex gap-3 mt-3 ${alignClass}`, children: [
4825
- showCancel && /* @__PURE__ */ jsxRuntime.jsx(Button2, { variant: "cancel", onClick: handleCancel, children: cancelText }),
4826
- confirmText && /* @__PURE__ */ jsxRuntime.jsx(Button2, { variant, onClick: handleConfirm, children: confirmText })
4992
+ showCancel && /* @__PURE__ */ jsxRuntime.jsx(Button2, { variant: "cancel", onClick: handleCancel, children: t(cancelText) }),
4993
+ confirmText && /* @__PURE__ */ jsxRuntime.jsx(Button2, { variant, onClick: handleConfirm, children: t(confirmText) })
4827
4994
  ] })
4828
4995
  ] }) });
4829
4996
  }
4830
- function variantClass(variant) {
4831
- switch (variant) {
4832
- case "success":
4833
- return "text-green-600";
4834
- case "error":
4835
- return "text-red-600";
4836
- case "warning":
4837
- return "text-yellow-600";
4838
- default:
4839
- return "";
4997
+
4998
+ // src/components/dialog-alert/templates/index.ts
4999
+ var getDialogTemplates = ({ setOpen = () => {
5000
+ } }) => ({
5001
+ "success.saved": {
5002
+ variant: "success",
5003
+ title: "success.saved.title",
5004
+ description: "success.saved.description",
5005
+ cancelText: "close"
5006
+ },
5007
+ "success.deleted": {
5008
+ variant: "success",
5009
+ title: "success.deleted.title",
5010
+ description: "success.deleted.description",
5011
+ cancelText: "close"
5012
+ },
5013
+ "success.removed": {
5014
+ variant: "success",
5015
+ title: "success.removed.title",
5016
+ description: "success.removed.description",
5017
+ cancelText: "close"
5018
+ },
5019
+ "error.api_db_error": {
5020
+ variant: "error",
5021
+ title: "error.api_db_error.title",
5022
+ description: "error.api_db_error.description",
5023
+ cancelText: "close"
5024
+ },
5025
+ "error.permission_denied": {
5026
+ variant: "error",
5027
+ title: "error.permission_denied.title",
5028
+ description: "error.permission_denied.description",
5029
+ confirmText: "error.permission_denied.confirm_text",
5030
+ showCancel: false,
5031
+ onConfirm: () => setOpen(false)
5032
+ },
5033
+ "error.session_expired": {
5034
+ variant: "error",
5035
+ title: "error.session_expired.title",
5036
+ description: "error.session_expired.description",
5037
+ confirmText: "error.session_expired.confirm_text",
5038
+ showCancel: false
5039
+ },
5040
+ "error.user_not_found": {
5041
+ variant: "error",
5042
+ title: "error.user_not_found.title",
5043
+ description: "error.user_not_found.description",
5044
+ confirmText: "error.user_not_found.confirm_text",
5045
+ showCancel: false
5046
+ },
5047
+ "error.data_not_found": {
5048
+ variant: "error",
5049
+ title: "error.data_not_found.title",
5050
+ description: "error.data_not_found.description",
5051
+ cancelText: "close"
5052
+ },
5053
+ "error.data_restrict_editing": {
5054
+ variant: "error",
5055
+ title: "error.data_restrict_editing.title",
5056
+ description: "error.data_restrict_editing.description",
5057
+ cancelText: "close"
5058
+ },
5059
+ "error.network_timeout_error": {
5060
+ variant: "error",
5061
+ title: "error.network_timeout_error.title",
5062
+ description: "error.network_timeout_error.description",
5063
+ cancelText: "close"
5064
+ },
5065
+ "error.queue_full": {
5066
+ variant: "error",
5067
+ title: "error.queue_full.title",
5068
+ description: "error.queue_full.description",
5069
+ cancelText: "close"
5070
+ },
5071
+ "error.invalid_data_format": {
5072
+ variant: "error",
5073
+ title: "error.invalid_data_format.title",
5074
+ description: "error.invalid_data_format.description",
5075
+ cancelText: "close"
5076
+ },
5077
+ "error.data_linked_to_system_data": {
5078
+ variant: "error",
5079
+ title: "error.data_linked_to_system_data.title",
5080
+ description: "error.data_linked_to_system_data.description",
5081
+ cancelText: "close"
5082
+ },
5083
+ "error.pending_workflow_conflict": {
5084
+ variant: "error",
5085
+ title: "error.pending_workflow_conflict.title",
5086
+ description: "error.pending_workflow_conflict.description",
5087
+ cancelText: "close"
5088
+ },
5089
+ "error.invalid_incomplete_data": {
5090
+ variant: "error",
5091
+ title: "error.invalid_incomplete_data.title",
5092
+ description: "error.invalid_incomplete_data.description",
5093
+ cancelText: "close"
5094
+ },
5095
+ "error.client_side_error": {
5096
+ variant: "error",
5097
+ title: "error.client_side_error.title",
5098
+ description: "error.client_side_error.description",
5099
+ cancelText: "close"
5100
+ },
5101
+ "error.system_limitation": {
5102
+ variant: "error",
5103
+ title: "error.system_limitation.title",
5104
+ description: "error.system_limitation.description",
5105
+ cancelText: "close"
5106
+ },
5107
+ "error.timeout": {
5108
+ variant: "error",
5109
+ title: "error.timeout.title",
5110
+ description: "error.timeout.description",
5111
+ cancelText: "close"
5112
+ },
5113
+ "error.duplicate_data": {
5114
+ variant: "error",
5115
+ title: "error.duplicate_data.title",
5116
+ description: "error.duplicate_data.description",
5117
+ cancelText: "close"
5118
+ },
5119
+ "error.something_went_wrong": {
5120
+ variant: "error",
5121
+ title: "error.something_went_wrong.title",
5122
+ description: "error.something_went_wrong.description",
5123
+ cancelText: "close"
5124
+ },
5125
+ "confirm.delete": {
5126
+ variant: "confirm",
5127
+ title: "confirm.delete.title",
5128
+ description: "confirm.delete.description",
5129
+ confirmText: "confirm.delete.confirm_text"
5130
+ },
5131
+ "confirm.inactive": {
5132
+ variant: "confirm",
5133
+ title: "confirm.inactive.title",
5134
+ description: "confirm.inactive.description",
5135
+ confirmText: "confirm.inactive.confirm_text"
5136
+ },
5137
+ "confirm.active": {
5138
+ variant: "confirm-green",
5139
+ title: "confirm.active.title",
5140
+ description: "confirm.active.description",
5141
+ confirmText: "confirm.active.confirm_text"
5142
+ },
5143
+ "confirm.leave_page": {
5144
+ variant: "confirm",
5145
+ title: "confirm.leave_page.title",
5146
+ description: "confirm.leave_page.description",
5147
+ confirmText: "confirm.leave_page.confirm_text"
5148
+ },
5149
+ "confirm.remove": {
5150
+ variant: "confirm",
5151
+ title: "confirm.remove.title",
5152
+ description: "confirm.remove.description",
5153
+ confirmText: "confirm.remove.confirm_text"
5154
+ },
5155
+ "confirm.logout": {
5156
+ variant: "confirm",
5157
+ title: "confirm.logout.title",
5158
+ description: "confirm.logout.description",
5159
+ confirmText: "confirm.logout.confirm_text"
4840
5160
  }
4841
- }
5161
+ });
5162
+ var useDialogAlertStore = zustand.create((set, get) => ({
5163
+ open: false,
5164
+ dialogProps: {},
5165
+ setOpen: (data) => set({ open: data }),
5166
+ setDialogProps: (data) => set({ dialogProps: data }),
5167
+ openDialogAlert: (payload) => {
5168
+ let templateVal;
5169
+ if (payload?.template) {
5170
+ templateVal = getDialogTemplates({ setOpen: get().setOpen })[payload.template];
5171
+ }
5172
+ get().setDialogProps({ ...templateVal, ...payload?.props });
5173
+ get().setOpen(true);
5174
+ },
5175
+ closeDialogAlert: () => {
5176
+ set({ open: false });
5177
+ }
5178
+ }));
5179
+ var DialogAlertProvider = ({ children, i18nResource, i18nLang }) => {
5180
+ const open = useDialogAlertStore((state) => state.open);
5181
+ const setOpen = useDialogAlertStore((state) => state.setOpen);
5182
+ const dialogProps = useDialogAlertStore((state) => state.dialogProps);
5183
+ React4.useEffect(() => {
5184
+ if (!i18nResource) {
5185
+ i18n_default.changeLanguage("sharedui");
5186
+ return;
5187
+ }
5188
+ const langs = Object.keys(i18nResource);
5189
+ for (const lang of langs) {
5190
+ i18n_default.addResourceBundle(
5191
+ lang,
5192
+ DIALOG_ALERT_I18N_NAMESPACE,
5193
+ i18nResource[lang][DIALOG_ALERT_I18N_NAMESPACE],
5194
+ false,
5195
+ true
5196
+ );
5197
+ }
5198
+ i18n_default.changeLanguage(i18nLang);
5199
+ }, [i18nLang, i18nResource]);
5200
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5201
+ children,
5202
+ /* @__PURE__ */ jsxRuntime.jsx(DialogAlert, { open, onOpenChange: setOpen, ...dialogProps })
5203
+ ] });
5204
+ };
5205
+ var openDialogAlert = useDialogAlertStore.getState().openDialogAlert;
5206
+ var closeDialogAlert = useDialogAlertStore.getState().closeDialogAlert;
5207
+ var openErrorDialogAlert = (error) => {
5208
+ if (error instanceof Error) {
5209
+ openDialogAlert({ template: "error.something_went_wrong", props: { description: error.message } });
5210
+ } else if (error.isAxiosError) {
5211
+ let template = "error.something_went_wrong";
5212
+ switch (error.response?.status) {
5213
+ case 400:
5214
+ template = "error.invalid_incomplete_data";
5215
+ break;
5216
+ case 401:
5217
+ template = "error.session_expired";
5218
+ break;
5219
+ case 403:
5220
+ template = "error.permission_denied";
5221
+ break;
5222
+ case 404:
5223
+ template = "error.data_not_found";
5224
+ break;
5225
+ case 409:
5226
+ template = "error.duplicate_data";
5227
+ break;
5228
+ case 500:
5229
+ template = "error.api_db_error";
5230
+ break;
5231
+ }
5232
+ openDialogAlert({ template });
5233
+ } else {
5234
+ openDialogAlert({ template: "error.something_went_wrong" });
5235
+ }
5236
+ };
5237
+ var getDialogAlertControls = () => ({
5238
+ openDialogAlert,
5239
+ closeDialogAlert,
5240
+ openErrorDialogAlert
5241
+ });
4842
5242
  function TooltipProvider({
4843
5243
  delayDuration = 0,
4844
5244
  ...props
@@ -4897,7 +5297,7 @@ function SortableRow({
4897
5297
  id: value,
4898
5298
  disabled: name === "columns.0.id"
4899
5299
  });
4900
- const style = React5__namespace.useMemo(
5300
+ const style = React4__namespace.useMemo(
4901
5301
  () => ({
4902
5302
  transform: utilities.CSS.Transform.toString(transform),
4903
5303
  transition
@@ -5009,8 +5409,8 @@ var GridSettingsModal = ({
5009
5409
  onClose,
5010
5410
  onSaveColumns
5011
5411
  }) => {
5012
- const [isDragging, setIsDragging] = React5.useState(false);
5013
- const scrollRef = React5.useRef(null);
5412
+ const [isDragging, setIsDragging] = React4.useState(false);
5413
+ const scrollRef = React4.useRef(null);
5014
5414
  const form = reactHookForm.useForm({
5015
5415
  resolver: zod$1.zodResolver(GridSettingsSchema),
5016
5416
  defaultValues: { columns: currentColumns },
@@ -5022,7 +5422,7 @@ var GridSettingsModal = ({
5022
5422
  name: "columns",
5023
5423
  keyName: "fieldId"
5024
5424
  });
5025
- React5.useEffect(() => {
5425
+ React4.useEffect(() => {
5026
5426
  if (isOpen) {
5027
5427
  form.reset({ columns: currentColumns });
5028
5428
  }
@@ -5239,7 +5639,7 @@ var useGridSettingsStore = zustand.create(
5239
5639
  );
5240
5640
  var useGridSettingsStore_default = useGridSettingsStore;
5241
5641
  var ListTable = ({ onTableReady, children }) => {
5242
- React5__namespace.useEffect(() => {
5642
+ React4__namespace.useEffect(() => {
5243
5643
  if (onTableReady) {
5244
5644
  onTableReady({ ready: true });
5245
5645
  }
@@ -5343,26 +5743,48 @@ var InfoIcon = (props) => {
5343
5743
  return /* @__PURE__ */ jsxRuntime.jsxs(
5344
5744
  "svg",
5345
5745
  {
5346
- width: "24",
5347
- height: "26",
5348
- viewBox: "0 0 14 13",
5746
+ width: "20",
5747
+ height: "20",
5748
+ viewBox: "0 0 20 20",
5349
5749
  fill: "none",
5350
5750
  xmlns: "http://www.w3.org/2000/svg",
5351
5751
  ...props,
5352
5752
  children: [
5353
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "6.98438", cy: "6.63281", r: "6.25", fill: "white" }),
5354
5753
  /* @__PURE__ */ jsxRuntime.jsx(
5355
5754
  "path",
5356
5755
  {
5357
- d: "M5.98811 3.39501C5.98811 4.01786 6.44715 4.40642 6.99953 4.40642C7.5519 4.40642 7.98047 4.04833 7.98047 3.39501C7.98047 2.74168 7.5519 2.41406 6.99953 2.41406C6.44715 2.41406 5.98811 2.76073 5.98811 3.39501ZM6.13096 10.8521H7.86809V5.02928H6.13096V10.8521Z",
5358
- fill: "#231F20"
5756
+ d: "M10.0013 18.3327C14.6037 18.3327 18.3346 14.6017 18.3346 9.99935C18.3346 5.39698 14.6037 1.66602 10.0013 1.66602C5.39893 1.66602 1.66797 5.39698 1.66797 9.99935C1.66797 14.6017 5.39893 18.3327 10.0013 18.3327Z",
5757
+ stroke: "white",
5758
+ "stroke-width": "1.5",
5759
+ "stroke-linecap": "round",
5760
+ "stroke-linejoin": "round"
5761
+ }
5762
+ ),
5763
+ /* @__PURE__ */ jsxRuntime.jsx(
5764
+ "path",
5765
+ {
5766
+ d: "M10 13.3333V10",
5767
+ stroke: "white",
5768
+ "stroke-width": "1.5",
5769
+ "stroke-linecap": "round",
5770
+ "stroke-linejoin": "round"
5771
+ }
5772
+ ),
5773
+ /* @__PURE__ */ jsxRuntime.jsx(
5774
+ "path",
5775
+ {
5776
+ d: "M10 6.66602H10.0083",
5777
+ stroke: "white",
5778
+ "stroke-width": "1.5",
5779
+ "stroke-linecap": "round",
5780
+ "stroke-linejoin": "round"
5359
5781
  }
5360
5782
  )
5361
5783
  ]
5362
5784
  }
5363
5785
  );
5364
5786
  };
5365
- var InfoIcon_default = React5__namespace.default.memo(InfoIcon);
5787
+ var InfoIcon_default = React4__namespace.default.memo(InfoIcon);
5366
5788
  var Navbar = ({
5367
5789
  className,
5368
5790
  title,
@@ -5387,7 +5809,7 @@ var Navbar = ({
5387
5809
  }) => {
5388
5810
  const { isMobile, isTablet, isDesktop } = useScreenSize_default();
5389
5811
  const Icon2 = lucideReact.CircleHelp;
5390
- const shouldShowSeparator = !separatorDisable && React5.isValidElement(searchButton);
5812
+ const shouldShowSeparator = !separatorDisable && React4.isValidElement(searchButton);
5391
5813
  return /* @__PURE__ */ jsxRuntime.jsxs(
5392
5814
  "nav",
5393
5815
  {
@@ -5398,8 +5820,8 @@ var Navbar = ({
5398
5820
  children: [
5399
5821
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5", children: [
5400
5822
  headImageURL !== "" ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: headImageURL, alt: "", className: cn("w-full h-full", headImageURLClassName) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
5401
- React5.isValidElement(title) ? title : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-xl font-bold", children: title }),
5402
- React5.isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
5823
+ React4.isValidElement(title) ? title : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-xl font-bold", children: title }),
5824
+ React4.isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
5403
5825
  ] }),
5404
5826
  tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
5405
5827
  /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "text-white hover:opacity-80 ", children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon_default, { className: "w-4" }) }) }),
@@ -5430,10 +5852,10 @@ var Navbar = ({
5430
5852
  ),
5431
5853
  children: [
5432
5854
  tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
5433
- React5.isValidElement(tooltipIcon) ? tooltipIcon : /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 32, "aria-hidden": "true" }),
5855
+ React4.isValidElement(tooltipIcon) ? tooltipIcon : /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 32, "aria-hidden": "true" }),
5434
5856
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-bold", children: tooltipTitle })
5435
5857
  ] }),
5436
- React5.isValidElement(tooltipdescription) && tooltipdescription
5858
+ React4.isValidElement(tooltipdescription) && tooltipdescription
5437
5859
  ]
5438
5860
  }
5439
5861
  ),
@@ -5487,13 +5909,13 @@ var Navbar = ({
5487
5909
  }
5488
5910
  ),
5489
5911
  shouldShowSeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "separator", className: "ml-1 w-[1px] h-10 bg-white" }),
5490
- React5.isValidElement(searchButton) ? searchButton : ""
5912
+ React4.isValidElement(searchButton) ? searchButton : ""
5491
5913
  ] })
5492
5914
  ]
5493
5915
  }
5494
5916
  );
5495
5917
  };
5496
- var navbar_default = React5__namespace.default.memo(Navbar);
5918
+ var navbar_default = React4__namespace.default.memo(Navbar);
5497
5919
  function Sheet({ ...props }) {
5498
5920
  return /* @__PURE__ */ jsxRuntime.jsx(SheetPrimitive__namespace.Root, { "data-slot": "sheet", ...props });
5499
5921
  }
@@ -5596,7 +6018,7 @@ var usePreventPageLeaveStore_default = usePreventPageLeaveStore;
5596
6018
  // src/components/prevent-page-leave/PreventPageLeave.tsx
5597
6019
  var PreventPageLeave = ({ children }) => {
5598
6020
  const { isPreventing } = usePreventPageLeaveStore();
5599
- React5.useEffect(() => {
6021
+ React4.useEffect(() => {
5600
6022
  if (!isPreventing || typeof window === "undefined") {
5601
6023
  return;
5602
6024
  }
@@ -5614,7 +6036,7 @@ var PreventPageLeave = ({ children }) => {
5614
6036
  var PreventPageLeave_default = PreventPageLeave;
5615
6037
  var usePreventPageLeave = ({ isPrevening }) => {
5616
6038
  const setPreventing = usePreventPageLeaveStore_default((state) => state.setPreventing);
5617
- React5.useEffect(() => {
6039
+ React4.useEffect(() => {
5618
6040
  setPreventing(isPrevening);
5619
6041
  }, [isPrevening, setPreventing]);
5620
6042
  };
@@ -5893,21 +6315,21 @@ function ToolbarPlugin({
5893
6315
  acceptImageMimeTypes
5894
6316
  }) {
5895
6317
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
5896
- const [state, setState] = React5.useState(initialToolbarState);
5897
- const fileInputRef = React5.useRef(null);
5898
- const [isLinkDialogOpen, setLinkDialogOpen] = React5.useState(false);
5899
- const [editingExistingLink, setEditingExistingLink] = React5.useState(false);
5900
- const [linkNodeKey, setLinkNodeKey] = React5.useState(null);
5901
- const [isImageDialogOpen, setImageDialogOpen] = React5.useState(false);
5902
- const [editingExistingImage, setEditingExistingImage] = React5.useState(false);
5903
- const [imageNodeKey, setImageNodeKey] = React5.useState(null);
6318
+ const [state, setState] = React4.useState(initialToolbarState);
6319
+ const fileInputRef = React4.useRef(null);
6320
+ const [isLinkDialogOpen, setLinkDialogOpen] = React4.useState(false);
6321
+ const [editingExistingLink, setEditingExistingLink] = React4.useState(false);
6322
+ const [linkNodeKey, setLinkNodeKey] = React4.useState(null);
6323
+ const [isImageDialogOpen, setImageDialogOpen] = React4.useState(false);
6324
+ const [editingExistingImage, setEditingExistingImage] = React4.useState(false);
6325
+ const [imageNodeKey, setImageNodeKey] = React4.useState(null);
5904
6326
  const linkForm = reactHookForm.useForm({
5905
6327
  defaultValues: { url: "", label: "" }
5906
6328
  });
5907
6329
  const imageForm = reactHookForm.useForm({
5908
6330
  defaultValues: { url: "", alt: "", width: "", height: "" }
5909
6331
  });
5910
- const openImageDialog = React5.useCallback(() => {
6332
+ const openImageDialog = React4.useCallback(() => {
5911
6333
  if (disabled || !allowImageUrlInsert) {
5912
6334
  return;
5913
6335
  }
@@ -5941,7 +6363,7 @@ function ToolbarPlugin({
5941
6363
  setImageNodeKey(targetImage?.getKey() ?? null);
5942
6364
  setImageDialogOpen(true);
5943
6365
  }, [allowImageUrlInsert, disabled, editor, imageForm]);
5944
- const closeImageDialog = React5.useCallback(() => {
6366
+ const closeImageDialog = React4.useCallback(() => {
5945
6367
  setImageDialogOpen(false);
5946
6368
  setEditingExistingImage(false);
5947
6369
  setImageNodeKey(null);
@@ -5950,7 +6372,7 @@ function ToolbarPlugin({
5950
6372
  editor.focus();
5951
6373
  }, 0);
5952
6374
  }, [editor, imageForm]);
5953
- const openLinkDialog = React5.useCallback(() => {
6375
+ const openLinkDialog = React4.useCallback(() => {
5954
6376
  if (disabled) {
5955
6377
  return;
5956
6378
  }
@@ -5990,7 +6412,7 @@ function ToolbarPlugin({
5990
6412
  setLinkNodeKey(detectedLink?.getKey() ?? null);
5991
6413
  setLinkDialogOpen(true);
5992
6414
  }, [disabled, editor, linkForm]);
5993
- const closeLinkDialog = React5.useCallback(() => {
6415
+ const closeLinkDialog = React4.useCallback(() => {
5994
6416
  setLinkDialogOpen(false);
5995
6417
  setEditingExistingLink(false);
5996
6418
  setLinkNodeKey(null);
@@ -6031,7 +6453,7 @@ function ToolbarPlugin({
6031
6453
  });
6032
6454
  closeLinkDialog();
6033
6455
  });
6034
- const handleRemoveLink = React5.useCallback(() => {
6456
+ const handleRemoveLink = React4.useCallback(() => {
6035
6457
  editor.focus();
6036
6458
  editor.update(() => {
6037
6459
  if (linkNodeKey) {
@@ -6048,7 +6470,7 @@ function ToolbarPlugin({
6048
6470
  });
6049
6471
  closeLinkDialog();
6050
6472
  }, [closeLinkDialog, editor, linkNodeKey]);
6051
- const handleLinkDialogOpenChange = React5.useCallback(
6473
+ const handleLinkDialogOpenChange = React4.useCallback(
6052
6474
  (open) => {
6053
6475
  if (open) {
6054
6476
  setLinkDialogOpen(true);
@@ -6058,7 +6480,7 @@ function ToolbarPlugin({
6058
6480
  },
6059
6481
  [closeLinkDialog]
6060
6482
  );
6061
- const updateToolbar = React5.useCallback(() => {
6483
+ const updateToolbar = React4.useCallback(() => {
6062
6484
  const selection = lexical.$getSelection();
6063
6485
  if (!lexical.$isRangeSelection(selection)) {
6064
6486
  return;
@@ -6098,7 +6520,7 @@ function ToolbarPlugin({
6098
6520
  isLink: hasLink
6099
6521
  }));
6100
6522
  }, []);
6101
- React5__namespace.useEffect(() => {
6523
+ React4__namespace.useEffect(() => {
6102
6524
  return utils.mergeRegister(
6103
6525
  editor.registerCommand(
6104
6526
  lexical.CAN_UNDO_COMMAND,
@@ -6129,7 +6551,7 @@ function ToolbarPlugin({
6129
6551
  })
6130
6552
  );
6131
6553
  }, [editor, updateToolbar]);
6132
- const applyBlock = React5.useCallback(
6554
+ const applyBlock = React4.useCallback(
6133
6555
  (nextBlock) => {
6134
6556
  if (disabled) {
6135
6557
  return;
@@ -6191,7 +6613,7 @@ function ToolbarPlugin({
6191
6613
  },
6192
6614
  [disabled, editor, state.blockType]
6193
6615
  );
6194
- const toggleFormat = React5.useCallback(
6616
+ const toggleFormat = React4.useCallback(
6195
6617
  (format5) => {
6196
6618
  if (disabled) {
6197
6619
  return;
@@ -6200,10 +6622,10 @@ function ToolbarPlugin({
6200
6622
  },
6201
6623
  [disabled, editor]
6202
6624
  );
6203
- const toggleLink = React5.useCallback(() => {
6625
+ const toggleLink = React4.useCallback(() => {
6204
6626
  openLinkDialog();
6205
6627
  }, [openLinkDialog]);
6206
- const applyElementFormat = React5.useCallback(
6628
+ const applyElementFormat = React4.useCallback(
6207
6629
  (format5) => {
6208
6630
  if (disabled) {
6209
6631
  return;
@@ -6214,7 +6636,7 @@ function ToolbarPlugin({
6214
6636
  );
6215
6637
  const canInsertImage = allowImageUrlInsert || Boolean(onImageUpload);
6216
6638
  const imageAccept = acceptImageMimeTypes ?? DEFAULT_IMAGE_ACCEPT;
6217
- const handleInsertImage = React5.useCallback(() => {
6639
+ const handleInsertImage = React4.useCallback(() => {
6218
6640
  if (disabled || !canInsertImage) {
6219
6641
  return;
6220
6642
  }
@@ -6225,7 +6647,7 @@ function ToolbarPlugin({
6225
6647
  }
6226
6648
  openImageDialog();
6227
6649
  }, [canInsertImage, disabled, editor, onImageUpload, openImageDialog]);
6228
- const handleFileChange = React5.useCallback(
6650
+ const handleFileChange = React4.useCallback(
6229
6651
  async (event) => {
6230
6652
  if (!onImageUpload) {
6231
6653
  return;
@@ -6315,7 +6737,7 @@ function ToolbarPlugin({
6315
6737
  });
6316
6738
  closeImageDialog();
6317
6739
  });
6318
- const handleImageDialogOpenChange = React5.useCallback(
6740
+ const handleImageDialogOpenChange = React4.useCallback(
6319
6741
  (open) => {
6320
6742
  if (open) {
6321
6743
  setImageDialogOpen(true);
@@ -6325,7 +6747,7 @@ function ToolbarPlugin({
6325
6747
  },
6326
6748
  [closeImageDialog]
6327
6749
  );
6328
- const handleRemoveImage = React5.useCallback(() => {
6750
+ const handleRemoveImage = React4.useCallback(() => {
6329
6751
  if (!imageNodeKey) {
6330
6752
  closeImageDialog();
6331
6753
  return;
@@ -6684,7 +7106,7 @@ function ControlledValuePlugin({
6684
7106
  trackAppliedValue
6685
7107
  }) {
6686
7108
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
6687
- React5__namespace.useEffect(() => {
7109
+ React4__namespace.useEffect(() => {
6688
7110
  if (value == null || trackAppliedValue.current === value) {
6689
7111
  return;
6690
7112
  }
@@ -6708,14 +7130,14 @@ function ControlledValuePlugin({
6708
7130
  }
6709
7131
  function EditableStatePlugin({ editable }) {
6710
7132
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
6711
- React5__namespace.useEffect(() => {
7133
+ React4__namespace.useEffect(() => {
6712
7134
  editor.setEditable(editable);
6713
7135
  }, [editor, editable]);
6714
7136
  return null;
6715
7137
  }
6716
7138
  function ImagesPlugin() {
6717
7139
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
6718
- React5__namespace.useEffect(() => {
7140
+ React4__namespace.useEffect(() => {
6719
7141
  return editor.registerCommand(
6720
7142
  INSERT_IMAGE_COMMAND,
6721
7143
  (payload) => {
@@ -6734,7 +7156,7 @@ function ImagesPlugin() {
6734
7156
  }, [editor]);
6735
7157
  return null;
6736
7158
  }
6737
- var RichText = React5.forwardRef(function RichText2({
7159
+ var RichText = React4.forwardRef(function RichText2({
6738
7160
  value,
6739
7161
  defaultValue,
6740
7162
  onChange,
@@ -6753,11 +7175,11 @@ var RichText = React5.forwardRef(function RichText2({
6753
7175
  id,
6754
7176
  ...rest
6755
7177
  }, ref) {
6756
- const initialSerializedStateRef = React5.useRef(void 0);
7178
+ const initialSerializedStateRef = React4.useRef(void 0);
6757
7179
  if (initialSerializedStateRef.current === void 0) {
6758
7180
  initialSerializedStateRef.current = parseSerializedEditorState(value ?? defaultValue);
6759
7181
  }
6760
- const initialConfig = React5.useMemo(
7182
+ const initialConfig = React4.useMemo(
6761
7183
  () => ({
6762
7184
  namespace: "RichTextEditor",
6763
7185
  editable: !(readOnly || disabled),
@@ -6770,8 +7192,8 @@ var RichText = React5.forwardRef(function RichText2({
6770
7192
  }),
6771
7193
  [disabled, readOnly]
6772
7194
  );
6773
- const appliedValueRef = React5.useRef(value ?? defaultValue);
6774
- const handleChange = React5.useCallback(
7195
+ const appliedValueRef = React4.useRef(value ?? defaultValue);
7196
+ const handleChange = React4.useCallback(
6775
7197
  (editorState, editor) => {
6776
7198
  const serialized = JSON.stringify(editorState.toJSON());
6777
7199
  appliedValueRef.current = serialized;
@@ -6867,13 +7289,13 @@ function Separator2({
6867
7289
  );
6868
7290
  }
6869
7291
  function useIsMobile(breakpoint = 768) {
6870
- const [isMobile, setIsMobile] = React5.useState(() => {
7292
+ const [isMobile, setIsMobile] = React4.useState(() => {
6871
7293
  if (typeof window === "undefined") {
6872
7294
  return false;
6873
7295
  }
6874
7296
  return window.innerWidth < breakpoint;
6875
7297
  });
6876
- React5.useEffect(() => {
7298
+ React4.useEffect(() => {
6877
7299
  function onResize() {
6878
7300
  setIsMobile(window.innerWidth < breakpoint);
6879
7301
  }
@@ -6925,6 +7347,7 @@ __export(ui_exports, {
6925
7347
  FormItem: () => FormItem,
6926
7348
  FormLabel: () => FormLabel,
6927
7349
  FormMessage: () => FormMessage,
7350
+ Input: () => Input,
6928
7351
  InputPrimitive: () => InputPrimitive,
6929
7352
  Label: () => Label2,
6930
7353
  MonthPicker: () => MonthPicker,
@@ -6998,6 +7421,7 @@ __export(ui_exports, {
6998
7421
  TooltipProvider: () => TooltipProvider2,
6999
7422
  TooltipTrigger: () => TooltipTrigger2,
7000
7423
  buttonVariants: () => buttonVariants,
7424
+ inputVariants: () => inputVariants,
7001
7425
  spinnerVariants: () => spinnerVariants,
7002
7426
  useFormField: () => useFormField,
7003
7427
  useSidebar: () => useSidebar
@@ -7096,9 +7520,9 @@ var SIDEBAR_WIDTH = "16rem";
7096
7520
  var SIDEBAR_WIDTH_MOBILE = "18rem";
7097
7521
  var SIDEBAR_WIDTH_ICON = "3rem";
7098
7522
  var SIDEBAR_KEYBOARD_SHORTCUT = "b";
7099
- var SidebarContext = React5__namespace.createContext(null);
7523
+ var SidebarContext = React4__namespace.createContext(null);
7100
7524
  function useSidebar() {
7101
- const context = React5__namespace.useContext(SidebarContext);
7525
+ const context = React4__namespace.useContext(SidebarContext);
7102
7526
  if (!context) {
7103
7527
  throw new Error("useSidebar must be used within a SidebarProvider.");
7104
7528
  }
@@ -7114,10 +7538,10 @@ function SidebarProvider({
7114
7538
  ...props
7115
7539
  }) {
7116
7540
  const isMobile = useIsMobile();
7117
- const [openMobile, setOpenMobile] = React5__namespace.useState(false);
7118
- const [_open, _setOpen] = React5__namespace.useState(defaultOpen);
7541
+ const [openMobile, setOpenMobile] = React4__namespace.useState(false);
7542
+ const [_open, _setOpen] = React4__namespace.useState(defaultOpen);
7119
7543
  const open = openProp ?? _open;
7120
- const setOpen = React5__namespace.useCallback(
7544
+ const setOpen = React4__namespace.useCallback(
7121
7545
  (value) => {
7122
7546
  const openState = typeof value === "function" ? value(open) : value;
7123
7547
  if (setOpenProp) {
@@ -7129,10 +7553,10 @@ function SidebarProvider({
7129
7553
  },
7130
7554
  [setOpenProp, open]
7131
7555
  );
7132
- const toggleSidebar = React5__namespace.useCallback(() => {
7556
+ const toggleSidebar = React4__namespace.useCallback(() => {
7133
7557
  return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
7134
7558
  }, [isMobile, setOpen, setOpenMobile]);
7135
- React5__namespace.useEffect(() => {
7559
+ React4__namespace.useEffect(() => {
7136
7560
  const handleKeyDown = (event) => {
7137
7561
  if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
7138
7562
  event.preventDefault();
@@ -7143,7 +7567,7 @@ function SidebarProvider({
7143
7567
  return () => window.removeEventListener("keydown", handleKeyDown);
7144
7568
  }, [toggleSidebar]);
7145
7569
  const state = open ? "expanded" : "collapsed";
7146
- const contextValue = React5__namespace.useMemo(
7570
+ const contextValue = React4__namespace.useMemo(
7147
7571
  () => ({
7148
7572
  state,
7149
7573
  open,
@@ -7585,7 +8009,7 @@ function SidebarMenuSkeleton({
7585
8009
  showIcon = false,
7586
8010
  ...props
7587
8011
  }) {
7588
- const width = React5__namespace.useMemo(() => {
8012
+ const width = React4__namespace.useMemo(() => {
7589
8013
  return `${Math.floor(Math.random() * 40) + 50}%`;
7590
8014
  }, []);
7591
8015
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -7725,10 +8149,38 @@ async function getCroppedImg(imageSrc, pixelCrop, desiredDimension) {
7725
8149
  }, "image/png");
7726
8150
  });
7727
8151
  }
8152
+ async function getCroppedSVG(imageSrc, pixelCrop, desiredDimension) {
8153
+ let svgString;
8154
+ const parts = imageSrc.split(",");
8155
+ const meta = parts[0];
8156
+ const data = parts[1];
8157
+ if (meta.includes("base64")) {
8158
+ svgString = atob(data);
8159
+ } else {
8160
+ svgString = decodeURIComponent(data);
8161
+ }
8162
+ const parser = new DOMParser();
8163
+ const svgDoc = parser.parseFromString(svgString, "image/svg+xml");
8164
+ const svgElement = svgDoc.documentElement;
8165
+ if (svgElement.tagName.toLowerCase() !== "svg") {
8166
+ throw new Error("The file is not a valid SVG document root.");
8167
+ }
8168
+ const newViewBox = `${pixelCrop.x} ${pixelCrop.y} ${pixelCrop.width} ${pixelCrop.height}`;
8169
+ svgElement.setAttribute("viewBox", newViewBox);
8170
+ const outputWidth = desiredDimension?.width ?? pixelCrop.width;
8171
+ const outputHeight = desiredDimension?.height ?? pixelCrop.height;
8172
+ svgElement.setAttribute("width", String(outputWidth));
8173
+ svgElement.setAttribute("height", String(outputHeight));
8174
+ const serializer = new XMLSerializer();
8175
+ const croppedSvgString = serializer.serializeToString(svgElement);
8176
+ const blob = new Blob([croppedSvgString], { type: "image/svg+xml" });
8177
+ return URL.createObjectURL(blob);
8178
+ }
7728
8179
  var CropperModal = ({
7729
8180
  open,
7730
8181
  onOpenChange,
7731
8182
  imageSrc,
8183
+ isSVG,
7732
8184
  onConfirm,
7733
8185
  onCancel,
7734
8186
  onError,
@@ -7738,20 +8190,20 @@ var CropperModal = ({
7738
8190
  title,
7739
8191
  props
7740
8192
  }) => {
7741
- const [isLoading, setIsLoading] = React5.useState(false);
7742
- const [crop, setCrop] = React5.useState({ x: 0, y: 0 });
7743
- const [zoom, setZoom] = React5.useState();
7744
- const [croppedAreaPixels, setCroppedAreaPixels] = React5.useState(null);
7745
- const handleClose = React5.useCallback(() => {
8193
+ const [isLoading, setIsLoading] = React4.useState(false);
8194
+ const [crop, setCrop] = React4.useState({ x: 0, y: 0 });
8195
+ const [zoom, setZoom] = React4.useState();
8196
+ const [croppedAreaPixels, setCroppedAreaPixels] = React4.useState(null);
8197
+ const handleClose = React4.useCallback(() => {
7746
8198
  onOpenChange(false);
7747
8199
  }, [onOpenChange]);
7748
- const handleCancel = React5.useCallback(() => {
8200
+ const handleCancel = React4.useCallback(() => {
7749
8201
  if (onCancel) {
7750
8202
  onCancel();
7751
8203
  }
7752
8204
  handleClose();
7753
8205
  }, [handleClose, onCancel]);
7754
- const handleCropComplete = React5.useCallback((_, croppedAreaPixels2) => {
8206
+ const handleCropComplete = React4.useCallback((_, croppedAreaPixels2) => {
7755
8207
  setCroppedAreaPixels(croppedAreaPixels2);
7756
8208
  }, []);
7757
8209
  const handleConfirm = async () => {
@@ -7770,7 +8222,7 @@ var CropperModal = ({
7770
8222
  setIsLoading(true);
7771
8223
  try {
7772
8224
  const desiredDimension = outputExactCropSize ? cropSize : void 0;
7773
- const croppedImage = await getCroppedImg(imageSrc, croppedAreaPixels, desiredDimension);
8225
+ const croppedImage = isSVG ? await getCroppedSVG(imageSrc, croppedAreaPixels, desiredDimension) : await getCroppedImg(imageSrc, croppedAreaPixels, desiredDimension);
7774
8226
  onConfirm({ crop, croppedAreaPixels, croppedImageBlobUrl: croppedImage });
7775
8227
  } catch (e) {
7776
8228
  if (onError) {
@@ -7835,7 +8287,7 @@ var CropperModal = ({
7835
8287
  ...props?.cropper
7836
8288
  }
7837
8289
  ) }),
7838
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full py-4 px-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full justify-between", children: [
8290
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full py-4 px-8 min-h-10", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full justify-between", children: [
7839
8291
  /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "cancel", onClick: handleCancel, disabled: isLoading, children: "Cancel" }),
7840
8292
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto flex gap-x-2", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "default", onClick: handleConfirm, disabled: isLoading, children: "Confirm" }) })
7841
8293
  ] }) })
@@ -7858,10 +8310,12 @@ exports.Collapsible = Collapsible;
7858
8310
  exports.CollapsibleContent = CollapsibleContent2;
7859
8311
  exports.CollapsibleTrigger = CollapsibleTrigger2;
7860
8312
  exports.CropperModal = CropperModal;
8313
+ exports.DIALOG_ALERT_I18N_NAMESPACE = DIALOG_ALERT_I18N_NAMESPACE;
7861
8314
  exports.DataTable = DataTable_default;
7862
8315
  exports.DatePicker = DatePicker2;
7863
8316
  exports.Dialog = Dialog;
7864
8317
  exports.DialogAlert = DialogAlert;
8318
+ exports.DialogAlertProvider = DialogAlertProvider;
7865
8319
  exports.DialogContent = DialogContent;
7866
8320
  exports.DialogDescription = DialogDescription;
7867
8321
  exports.DialogFooter = DialogFooter;
@@ -7962,6 +8416,8 @@ exports.buttonVariants = buttonVariants;
7962
8416
  exports.cn = cn;
7963
8417
  exports.compareAlphanumeric = compareAlphanumeric;
7964
8418
  exports.debounce = debounce;
8419
+ exports.getDialogAlertControls = getDialogAlertControls;
8420
+ exports.getDialogTemplates = getDialogTemplates;
7965
8421
  exports.inputVariants = inputVariants;
7966
8422
  exports.isDefined = isDefined;
7967
8423
  exports.isEmptyObject = isEmptyObject;