@sustaina/shared-ui 1.45.0 → 1.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +372 -353
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +209 -190
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React28 = require('react');
|
|
4
4
|
var reactRouter = require('@tanstack/react-router');
|
|
5
5
|
var zustand = require('zustand');
|
|
6
6
|
var clsx2 = require('clsx');
|
|
@@ -83,7 +83,7 @@ function _interopNamespace(e) {
|
|
|
83
83
|
return Object.freeze(n);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
var
|
|
86
|
+
var React28__namespace = /*#__PURE__*/_interopNamespace(React28);
|
|
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] =
|
|
276
|
+
const [resolver, setResolver] = React28.useState({
|
|
277
277
|
status: "idle",
|
|
278
278
|
proceed: void 0,
|
|
279
279
|
reset: void 0
|
|
280
280
|
});
|
|
281
|
-
|
|
281
|
+
React28.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
|
-
|
|
311
|
+
React28.useEffect(() => {
|
|
312
312
|
if (disabled || router?.history || typeof window === "undefined") {
|
|
313
313
|
return;
|
|
314
314
|
}
|
|
@@ -2440,7 +2440,7 @@ function AccordionContent({
|
|
|
2440
2440
|
);
|
|
2441
2441
|
}
|
|
2442
2442
|
var ExpandCollapse = ({ title, children, portalId }) => {
|
|
2443
|
-
const [isOpen, setIsOpen] =
|
|
2443
|
+
const [isOpen, setIsOpen] = React28.useState(false);
|
|
2444
2444
|
const Panel = /* @__PURE__ */ jsxRuntime.jsx(
|
|
2445
2445
|
"div",
|
|
2446
2446
|
{
|
|
@@ -2550,31 +2550,31 @@ function makeNewRow(field) {
|
|
|
2550
2550
|
};
|
|
2551
2551
|
}
|
|
2552
2552
|
function useAdvanceSearch({ fields, limitRows }) {
|
|
2553
|
-
const [rows, setRows] =
|
|
2554
|
-
const updateRows =
|
|
2553
|
+
const [rows, setRows] = React28.useState([makeNewRow(fields[0])]);
|
|
2554
|
+
const updateRows = React28.useCallback((next) => {
|
|
2555
2555
|
setRows(next);
|
|
2556
2556
|
}, []);
|
|
2557
|
-
const operatorsForField =
|
|
2557
|
+
const operatorsForField = React28.useCallback(
|
|
2558
2558
|
(fieldName) => {
|
|
2559
2559
|
const t = getFieldType(fields, fieldName);
|
|
2560
2560
|
return OPERATOR_MAP[t];
|
|
2561
2561
|
},
|
|
2562
2562
|
[fields]
|
|
2563
2563
|
);
|
|
2564
|
-
const addRow =
|
|
2564
|
+
const addRow = React28.useCallback(() => {
|
|
2565
2565
|
if (limitRows && rows.length >= limitRows) return;
|
|
2566
2566
|
const lastRow = rows[rows.length - 1];
|
|
2567
2567
|
const lastField = fields.find((f) => f.name === lastRow?.fieldName) ?? fields[0];
|
|
2568
2568
|
updateRows([...rows, makeNewRow(lastField)]);
|
|
2569
2569
|
}, [rows, fields, updateRows, limitRows]);
|
|
2570
|
-
const removeRow =
|
|
2570
|
+
const removeRow = React28.useCallback(
|
|
2571
2571
|
(id) => {
|
|
2572
2572
|
if (rows.length === 1) return;
|
|
2573
2573
|
updateRows(rows.filter((r) => r.id !== id));
|
|
2574
2574
|
},
|
|
2575
2575
|
[rows, updateRows]
|
|
2576
2576
|
);
|
|
2577
|
-
const clearRow =
|
|
2577
|
+
const clearRow = React28.useCallback(
|
|
2578
2578
|
(id) => {
|
|
2579
2579
|
updateRows(
|
|
2580
2580
|
rows.map((r) => {
|
|
@@ -2607,10 +2607,10 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
2607
2607
|
},
|
|
2608
2608
|
[rows, fields, updateRows]
|
|
2609
2609
|
);
|
|
2610
|
-
const clearAllRow =
|
|
2610
|
+
const clearAllRow = React28.useCallback(() => {
|
|
2611
2611
|
updateRows([makeNewRow(fields[0])]);
|
|
2612
2612
|
}, [fields, updateRows]);
|
|
2613
|
-
const changeField =
|
|
2613
|
+
const changeField = React28.useCallback(
|
|
2614
2614
|
(id, fieldName) => {
|
|
2615
2615
|
updateRows(
|
|
2616
2616
|
rows.map((r) => {
|
|
@@ -2622,7 +2622,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
2622
2622
|
},
|
|
2623
2623
|
[rows, fields, updateRows]
|
|
2624
2624
|
);
|
|
2625
|
-
const changeOperator =
|
|
2625
|
+
const changeOperator = React28.useCallback(
|
|
2626
2626
|
(id, operator) => {
|
|
2627
2627
|
updateRows(
|
|
2628
2628
|
rows.map((r) => {
|
|
@@ -2656,7 +2656,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
2656
2656
|
},
|
|
2657
2657
|
[rows, updateRows]
|
|
2658
2658
|
);
|
|
2659
|
-
const changeValue =
|
|
2659
|
+
const changeValue = React28.useCallback(
|
|
2660
2660
|
(id, which, val) => {
|
|
2661
2661
|
updateRows(
|
|
2662
2662
|
rows.map((r) => {
|
|
@@ -2668,7 +2668,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
2668
2668
|
},
|
|
2669
2669
|
[rows, updateRows]
|
|
2670
2670
|
);
|
|
2671
|
-
const fieldOptions =
|
|
2671
|
+
const fieldOptions = React28.useMemo(
|
|
2672
2672
|
() => fields.map((f) => ({
|
|
2673
2673
|
value: f.name,
|
|
2674
2674
|
label: f.label ?? f.name
|
|
@@ -2863,7 +2863,7 @@ var OPERATOR_LABEL = {
|
|
|
2863
2863
|
containsAll: "Contains all of"
|
|
2864
2864
|
};
|
|
2865
2865
|
var OperatorSelect = ({ row, operators, onChangeOperator, error }) => {
|
|
2866
|
-
|
|
2866
|
+
React28__namespace.default.useEffect(() => {
|
|
2867
2867
|
if (!operators.length) return;
|
|
2868
2868
|
if (!operators.includes(row.operator)) {
|
|
2869
2869
|
onChangeOperator(operators[0]);
|
|
@@ -2899,15 +2899,15 @@ function Label2({ className, ...props }) {
|
|
|
2899
2899
|
);
|
|
2900
2900
|
}
|
|
2901
2901
|
var Form = reactHookForm.FormProvider;
|
|
2902
|
-
var FormFieldContext =
|
|
2902
|
+
var FormFieldContext = React28__namespace.createContext({});
|
|
2903
2903
|
var FormField = ({
|
|
2904
2904
|
...props
|
|
2905
2905
|
}) => {
|
|
2906
2906
|
return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
|
|
2907
2907
|
};
|
|
2908
2908
|
var useFormField = () => {
|
|
2909
|
-
const fieldContext =
|
|
2910
|
-
const itemContext =
|
|
2909
|
+
const fieldContext = React28__namespace.useContext(FormFieldContext);
|
|
2910
|
+
const itemContext = React28__namespace.useContext(FormItemContext);
|
|
2911
2911
|
const { getFieldState } = reactHookForm.useFormContext();
|
|
2912
2912
|
const formState = reactHookForm.useFormState({ name: fieldContext.name });
|
|
2913
2913
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -2924,9 +2924,9 @@ var useFormField = () => {
|
|
|
2924
2924
|
...fieldState
|
|
2925
2925
|
};
|
|
2926
2926
|
};
|
|
2927
|
-
var FormItemContext =
|
|
2927
|
+
var FormItemContext = React28__namespace.createContext({});
|
|
2928
2928
|
function FormItem({ className, ...props }) {
|
|
2929
|
-
const id =
|
|
2929
|
+
const id = React28__namespace.useId();
|
|
2930
2930
|
return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
|
|
2931
2931
|
}
|
|
2932
2932
|
function FormLabel({ className, ...props }) {
|
|
@@ -3030,7 +3030,7 @@ var Spinner = ({ className, variant, size = "default", ...props }) => /* @__PURE
|
|
|
3030
3030
|
]
|
|
3031
3031
|
}
|
|
3032
3032
|
);
|
|
3033
|
-
var InputPrimitive =
|
|
3033
|
+
var InputPrimitive = React28__namespace.forwardRef(
|
|
3034
3034
|
({ className, type = "text", ...props }, ref) => {
|
|
3035
3035
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3036
3036
|
"input",
|
|
@@ -3069,7 +3069,7 @@ var inputVariants = classVarianceAuthority.cva("", {
|
|
|
3069
3069
|
appearance: "filled"
|
|
3070
3070
|
}
|
|
3071
3071
|
});
|
|
3072
|
-
var Input =
|
|
3072
|
+
var Input = React28__namespace.forwardRef(
|
|
3073
3073
|
({
|
|
3074
3074
|
className,
|
|
3075
3075
|
wrapperClassName,
|
|
@@ -3102,8 +3102,8 @@ var Input = React27__namespace.forwardRef(
|
|
|
3102
3102
|
onChange: onChangeProp
|
|
3103
3103
|
} = rest;
|
|
3104
3104
|
const ariaInvalid = invalid ?? ariaInvalidProp;
|
|
3105
|
-
const messageId =
|
|
3106
|
-
const handleChange =
|
|
3105
|
+
const messageId = React28__namespace.useId();
|
|
3106
|
+
const handleChange = React28__namespace.useCallback(
|
|
3107
3107
|
(event) => {
|
|
3108
3108
|
onChangeProp?.(event);
|
|
3109
3109
|
onValueChange?.(event.target.value);
|
|
@@ -3491,20 +3491,20 @@ function DatePicker({
|
|
|
3491
3491
|
className,
|
|
3492
3492
|
...props
|
|
3493
3493
|
}) {
|
|
3494
|
-
const today =
|
|
3495
|
-
const [displayed, setDisplayed] =
|
|
3494
|
+
const today = React28__namespace.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
3495
|
+
const [displayed, setDisplayed] = React28__namespace.useState(
|
|
3496
3496
|
selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
|
|
3497
3497
|
);
|
|
3498
3498
|
minDate = clampToDay(minDate);
|
|
3499
3499
|
maxDate = clampToDay(maxDate);
|
|
3500
|
-
const disabledSet =
|
|
3500
|
+
const disabledSet = React28__namespace.useMemo(() => {
|
|
3501
3501
|
const s = /* @__PURE__ */ new Set();
|
|
3502
3502
|
disabledDates?.forEach((d) => s.add(startOfDay(d).toISOString()));
|
|
3503
3503
|
return s;
|
|
3504
3504
|
}, [disabledDates]);
|
|
3505
3505
|
const displayYear = displayed.getFullYear();
|
|
3506
3506
|
const displayMonth = displayed.getMonth();
|
|
3507
|
-
const weekdays =
|
|
3507
|
+
const weekdays = React28__namespace.useMemo(() => {
|
|
3508
3508
|
const labels = [];
|
|
3509
3509
|
for (let i = 0; i < 7; i++) {
|
|
3510
3510
|
const idx = i;
|
|
@@ -3513,7 +3513,7 @@ function DatePicker({
|
|
|
3513
3513
|
}
|
|
3514
3514
|
return labels;
|
|
3515
3515
|
}, [callbacks]);
|
|
3516
|
-
const grid =
|
|
3516
|
+
const grid = React28__namespace.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
|
|
3517
3517
|
const isDateDisabled = (date) => {
|
|
3518
3518
|
const d = startOfDay(date);
|
|
3519
3519
|
if (minDate && d < minDate) return true;
|
|
@@ -3523,7 +3523,7 @@ function DatePicker({
|
|
|
3523
3523
|
};
|
|
3524
3524
|
const minYear = minDate?.getFullYear();
|
|
3525
3525
|
const maxYear = maxDate?.getFullYear();
|
|
3526
|
-
const getMonthLabel =
|
|
3526
|
+
const getMonthLabel = React28__namespace.useCallback(
|
|
3527
3527
|
(year, monthIndex) => {
|
|
3528
3528
|
const label = callbacks?.monthLabel?.(year, monthIndex);
|
|
3529
3529
|
if (label === null || label === void 0) {
|
|
@@ -3533,7 +3533,7 @@ function DatePicker({
|
|
|
3533
3533
|
},
|
|
3534
3534
|
[callbacks]
|
|
3535
3535
|
);
|
|
3536
|
-
const getYearLabel =
|
|
3536
|
+
const getYearLabel = React28__namespace.useCallback(
|
|
3537
3537
|
(year) => {
|
|
3538
3538
|
const label = callbacks?.yearLabel?.(year);
|
|
3539
3539
|
if (label === null || label === void 0) return String(year);
|
|
@@ -3541,7 +3541,7 @@ function DatePicker({
|
|
|
3541
3541
|
},
|
|
3542
3542
|
[callbacks]
|
|
3543
3543
|
);
|
|
3544
|
-
const clampMonthToBounds =
|
|
3544
|
+
const clampMonthToBounds = React28__namespace.useCallback(
|
|
3545
3545
|
(year, monthIndex) => {
|
|
3546
3546
|
let output = monthIndex;
|
|
3547
3547
|
if (typeof minYear === "number" && year === minYear && minDate) {
|
|
@@ -3556,7 +3556,7 @@ function DatePicker({
|
|
|
3556
3556
|
},
|
|
3557
3557
|
[maxDate, minDate, maxYear, minYear]
|
|
3558
3558
|
);
|
|
3559
|
-
const yearOptions =
|
|
3559
|
+
const yearOptions = React28__namespace.useMemo(() => {
|
|
3560
3560
|
const fallbackWindow = 50;
|
|
3561
3561
|
const start = typeof minYear === "number" ? minYear : displayYear - fallbackWindow;
|
|
3562
3562
|
const end = typeof maxYear === "number" ? maxYear : displayYear + fallbackWindow;
|
|
@@ -3577,7 +3577,7 @@ function DatePicker({
|
|
|
3577
3577
|
}
|
|
3578
3578
|
return years;
|
|
3579
3579
|
}, [displayYear, maxYear, minYear, selectedDate]);
|
|
3580
|
-
const monthOptions =
|
|
3580
|
+
const monthOptions = React28__namespace.useMemo(() => {
|
|
3581
3581
|
const months = Array.from({ length: 12 }, (_, monthIndex) => {
|
|
3582
3582
|
const disabled = typeof minYear === "number" && displayYear === minYear && minDate && monthIndex < minDate.getMonth() || typeof maxYear === "number" && displayYear === maxYear && maxDate && monthIndex > maxDate.getMonth();
|
|
3583
3583
|
return {
|
|
@@ -3596,7 +3596,7 @@ function DatePicker({
|
|
|
3596
3596
|
}
|
|
3597
3597
|
return months.sort((a, b) => a.value - b.value).filter((option, index, arr) => index === 0 || option.value !== arr[index - 1].value);
|
|
3598
3598
|
}, [displayMonth, displayYear, getMonthLabel, maxDate, maxYear, minDate, minYear]);
|
|
3599
|
-
const handleMonthSelect =
|
|
3599
|
+
const handleMonthSelect = React28__namespace.useCallback((nextValue) => {
|
|
3600
3600
|
const nextMonth = Number.parseInt(nextValue, 10);
|
|
3601
3601
|
if (Number.isNaN(nextMonth)) return;
|
|
3602
3602
|
setDisplayed((prev) => {
|
|
@@ -3606,7 +3606,7 @@ function DatePicker({
|
|
|
3606
3606
|
return next;
|
|
3607
3607
|
});
|
|
3608
3608
|
}, []);
|
|
3609
|
-
const handleYearSelect =
|
|
3609
|
+
const handleYearSelect = React28__namespace.useCallback(
|
|
3610
3610
|
(nextValue) => {
|
|
3611
3611
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
3612
3612
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -3754,14 +3754,14 @@ var DatePicker2 = ({
|
|
|
3754
3754
|
ariaLabel,
|
|
3755
3755
|
...calendarProps
|
|
3756
3756
|
}) => {
|
|
3757
|
-
const [open, setOpen] =
|
|
3758
|
-
const parser =
|
|
3759
|
-
const outputFormatter =
|
|
3760
|
-
const labelFormatter =
|
|
3757
|
+
const [open, setOpen] = React28__namespace.default.useState(false);
|
|
3758
|
+
const parser = React28__namespace.default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
|
|
3759
|
+
const outputFormatter = React28__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
|
|
3760
|
+
const labelFormatter = React28__namespace.default.useMemo(
|
|
3761
3761
|
() => displayFormatter ?? defaultDisplayFormatter,
|
|
3762
3762
|
[displayFormatter]
|
|
3763
3763
|
);
|
|
3764
|
-
const parsedValue =
|
|
3764
|
+
const parsedValue = React28__namespace.default.useMemo(() => {
|
|
3765
3765
|
if (value === null || value === void 0) return void 0;
|
|
3766
3766
|
if (value instanceof Date) return value;
|
|
3767
3767
|
const parsed = parser(value);
|
|
@@ -3770,26 +3770,26 @@ var DatePicker2 = ({
|
|
|
3770
3770
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
|
|
3771
3771
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change date, current selection ${labelFormatter(parsedValue)}` : "Open date picker");
|
|
3772
3772
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
3773
|
-
const handleClose =
|
|
3774
|
-
const emitChange =
|
|
3773
|
+
const handleClose = React28__namespace.default.useCallback(() => setOpen(false), []);
|
|
3774
|
+
const emitChange = React28__namespace.default.useCallback(
|
|
3775
3775
|
(next) => {
|
|
3776
3776
|
onChange?.(next);
|
|
3777
3777
|
onValueChange?.(next ? outputFormatter(next) : void 0);
|
|
3778
3778
|
},
|
|
3779
3779
|
[onChange, onValueChange, outputFormatter]
|
|
3780
3780
|
);
|
|
3781
|
-
const handleSelect =
|
|
3781
|
+
const handleSelect = React28__namespace.default.useCallback(
|
|
3782
3782
|
(next) => {
|
|
3783
3783
|
emitChange(next);
|
|
3784
3784
|
if (closeOnSelect && next) handleClose();
|
|
3785
3785
|
},
|
|
3786
3786
|
[closeOnSelect, emitChange, handleClose]
|
|
3787
3787
|
);
|
|
3788
|
-
const handleClear =
|
|
3788
|
+
const handleClear = React28__namespace.default.useCallback(() => {
|
|
3789
3789
|
emitChange(void 0);
|
|
3790
3790
|
handleClose();
|
|
3791
3791
|
}, [emitChange, handleClose]);
|
|
3792
|
-
const handleOpenChange =
|
|
3792
|
+
const handleOpenChange = React28__namespace.default.useCallback(
|
|
3793
3793
|
(nextOpen) => {
|
|
3794
3794
|
if (disabled && nextOpen) return;
|
|
3795
3795
|
setOpen(nextOpen);
|
|
@@ -3853,6 +3853,7 @@ var DatePicker2 = ({
|
|
|
3853
3853
|
|
|
3854
3854
|
// src/components/advanceSearch/components/constants/index.ts
|
|
3855
3855
|
var fallbackShortDateFormat = "DD/MM/YYYY";
|
|
3856
|
+
var UUIDregex = /^[0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$/i;
|
|
3856
3857
|
var ConditionDateInput = ({
|
|
3857
3858
|
row,
|
|
3858
3859
|
control,
|
|
@@ -3979,15 +3980,15 @@ function MonthCal({
|
|
|
3979
3980
|
onYearBackward,
|
|
3980
3981
|
onYearForward
|
|
3981
3982
|
}) {
|
|
3982
|
-
const today =
|
|
3983
|
+
const today = React28__namespace.useMemo(() => {
|
|
3983
3984
|
const now = /* @__PURE__ */ new Date();
|
|
3984
3985
|
now.setDate(1);
|
|
3985
3986
|
now.setHours(0, 0, 0, 0);
|
|
3986
3987
|
return now;
|
|
3987
3988
|
}, []);
|
|
3988
|
-
const selectedMonthDate =
|
|
3989
|
-
const min =
|
|
3990
|
-
const max =
|
|
3989
|
+
const selectedMonthDate = React28__namespace.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
|
|
3990
|
+
const min = React28__namespace.useMemo(() => normalizeMonth(minDate), [minDate]);
|
|
3991
|
+
const max = React28__namespace.useMemo(() => normalizeMonth(maxDate), [maxDate]);
|
|
3991
3992
|
let effectiveMin = min;
|
|
3992
3993
|
if (min && max && min > max) {
|
|
3993
3994
|
effectiveMin = max;
|
|
@@ -3996,10 +3997,10 @@ function MonthCal({
|
|
|
3996
3997
|
const minMonth = effectiveMin?.getMonth();
|
|
3997
3998
|
const maxYear = max?.getFullYear();
|
|
3998
3999
|
const maxMonth = max?.getMonth();
|
|
3999
|
-
const [menuYear, setMenuYear] =
|
|
4000
|
+
const [menuYear, setMenuYear] = React28__namespace.useState(
|
|
4000
4001
|
() => selectedMonthDate?.getFullYear() ?? today.getFullYear()
|
|
4001
4002
|
);
|
|
4002
|
-
|
|
4003
|
+
React28__namespace.useEffect(() => {
|
|
4003
4004
|
if (selectedMonthDate) {
|
|
4004
4005
|
const year = selectedMonthDate.getFullYear();
|
|
4005
4006
|
if (year !== menuYear) {
|
|
@@ -4007,7 +4008,7 @@ function MonthCal({
|
|
|
4007
4008
|
}
|
|
4008
4009
|
}
|
|
4009
4010
|
}, [selectedMonthDate, menuYear]);
|
|
4010
|
-
|
|
4011
|
+
React28__namespace.useEffect(() => {
|
|
4011
4012
|
if (typeof minYear === "number" && menuYear < minYear) {
|
|
4012
4013
|
setMenuYear(minYear);
|
|
4013
4014
|
return;
|
|
@@ -4018,7 +4019,7 @@ function MonthCal({
|
|
|
4018
4019
|
}, [minYear, maxYear, menuYear]);
|
|
4019
4020
|
const disablePrevYear = typeof minYear === "number" ? menuYear <= minYear : false;
|
|
4020
4021
|
const disableNextYear = typeof maxYear === "number" ? menuYear >= maxYear : false;
|
|
4021
|
-
const yearOptions =
|
|
4022
|
+
const yearOptions = React28__namespace.useMemo(() => {
|
|
4022
4023
|
const fallbackWindow = 50;
|
|
4023
4024
|
const start = typeof minYear === "number" ? minYear : menuYear - fallbackWindow;
|
|
4024
4025
|
const end = typeof maxYear === "number" ? maxYear : menuYear + fallbackWindow;
|
|
@@ -4032,7 +4033,7 @@ function MonthCal({
|
|
|
4032
4033
|
}
|
|
4033
4034
|
return years;
|
|
4034
4035
|
}, [maxYear, menuYear, minYear]);
|
|
4035
|
-
const formatYearLabel =
|
|
4036
|
+
const formatYearLabel = React28__namespace.useCallback(
|
|
4036
4037
|
(year) => {
|
|
4037
4038
|
const raw = callbacks?.yearLabel?.(year);
|
|
4038
4039
|
if (raw === null || raw === void 0) return String(year);
|
|
@@ -4040,7 +4041,7 @@ function MonthCal({
|
|
|
4040
4041
|
},
|
|
4041
4042
|
[callbacks]
|
|
4042
4043
|
);
|
|
4043
|
-
const handleYearSelect =
|
|
4044
|
+
const handleYearSelect = React28__namespace.useCallback(
|
|
4044
4045
|
(nextValue) => {
|
|
4045
4046
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
4046
4047
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -4050,7 +4051,7 @@ function MonthCal({
|
|
|
4050
4051
|
},
|
|
4051
4052
|
[maxYear, minYear]
|
|
4052
4053
|
);
|
|
4053
|
-
const disabledPairs =
|
|
4054
|
+
const disabledPairs = React28__namespace.useMemo(() => {
|
|
4054
4055
|
if (!disabledDates?.length) return [];
|
|
4055
4056
|
const pairs = [];
|
|
4056
4057
|
disabledDates.forEach((date) => {
|
|
@@ -4195,14 +4196,14 @@ var MonthPicker2 = ({
|
|
|
4195
4196
|
ariaLabel,
|
|
4196
4197
|
...calendarProps
|
|
4197
4198
|
}) => {
|
|
4198
|
-
const [open, setOpen] =
|
|
4199
|
-
const parser =
|
|
4200
|
-
const outputFormatter =
|
|
4201
|
-
const labelFormatter =
|
|
4199
|
+
const [open, setOpen] = React28__namespace.default.useState(false);
|
|
4200
|
+
const parser = React28__namespace.default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
|
|
4201
|
+
const outputFormatter = React28__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
|
|
4202
|
+
const labelFormatter = React28__namespace.default.useMemo(
|
|
4202
4203
|
() => displayFormatter ?? defaultDisplayFormatter2,
|
|
4203
4204
|
[displayFormatter]
|
|
4204
4205
|
);
|
|
4205
|
-
const parsedValue =
|
|
4206
|
+
const parsedValue = React28__namespace.default.useMemo(() => {
|
|
4206
4207
|
if (value === null || value === void 0) return void 0;
|
|
4207
4208
|
if (value instanceof Date) return normalizeMonth2(value);
|
|
4208
4209
|
if (typeof value === "string") {
|
|
@@ -4214,8 +4215,8 @@ var MonthPicker2 = ({
|
|
|
4214
4215
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
|
|
4215
4216
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change month, current selection ${labelFormatter(parsedValue)}` : "Open month picker");
|
|
4216
4217
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
4217
|
-
const handleClose =
|
|
4218
|
-
const emitChange =
|
|
4218
|
+
const handleClose = React28__namespace.default.useCallback(() => setOpen(false), []);
|
|
4219
|
+
const emitChange = React28__namespace.default.useCallback(
|
|
4219
4220
|
(next) => {
|
|
4220
4221
|
const normalized = next ? normalizeMonth2(next) : void 0;
|
|
4221
4222
|
onChange?.(normalized);
|
|
@@ -4223,18 +4224,18 @@ var MonthPicker2 = ({
|
|
|
4223
4224
|
},
|
|
4224
4225
|
[onChange, onValueChange, outputFormatter]
|
|
4225
4226
|
);
|
|
4226
|
-
const handleSelect =
|
|
4227
|
+
const handleSelect = React28__namespace.default.useCallback(
|
|
4227
4228
|
(next) => {
|
|
4228
4229
|
emitChange(next);
|
|
4229
4230
|
if (closeOnSelect && next) handleClose();
|
|
4230
4231
|
},
|
|
4231
4232
|
[closeOnSelect, emitChange, handleClose]
|
|
4232
4233
|
);
|
|
4233
|
-
const handleClear =
|
|
4234
|
+
const handleClear = React28__namespace.default.useCallback(() => {
|
|
4234
4235
|
emitChange(void 0);
|
|
4235
4236
|
handleClose();
|
|
4236
4237
|
}, [emitChange, handleClose]);
|
|
4237
|
-
const handleOpenChange =
|
|
4238
|
+
const handleOpenChange = React28__namespace.default.useCallback(
|
|
4238
4239
|
(nextOpen) => {
|
|
4239
4240
|
if (disabled && nextOpen) return;
|
|
4240
4241
|
setOpen(nextOpen);
|
|
@@ -4342,51 +4343,70 @@ var ConditionMonthInput = ({ row, control, onClear }) => {
|
|
|
4342
4343
|
}
|
|
4343
4344
|
return renderPicker(`value_${row.id}`, "value");
|
|
4344
4345
|
};
|
|
4345
|
-
var ConditionDropdownInput = ({ row, control, fieldSchema, onClear }) =>
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4346
|
+
var ConditionDropdownInput = ({ row, control, fieldSchema, onClear }) => {
|
|
4347
|
+
const [options, setOptions] = React28.useState([]);
|
|
4348
|
+
const [loading, setIsLoading] = React28.useState(false);
|
|
4349
|
+
React28.useEffect(() => {
|
|
4350
|
+
if (!fieldSchema) {
|
|
4351
|
+
return;
|
|
4352
|
+
}
|
|
4353
|
+
if (fieldSchema.fetchOptions) {
|
|
4354
|
+
setIsLoading(true);
|
|
4355
|
+
fieldSchema.fetchOptions().then((fetchedOptions) => {
|
|
4356
|
+
setOptions(fetchedOptions);
|
|
4357
|
+
}).catch((err) => {
|
|
4358
|
+
console.error("Failed to fetch lookup options", err);
|
|
4359
|
+
}).finally(() => setIsLoading(false));
|
|
4360
|
+
} else {
|
|
4361
|
+
setOptions(fieldSchema.options);
|
|
4362
|
+
}
|
|
4363
|
+
}, [fieldSchema]);
|
|
4364
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4365
|
+
FormField,
|
|
4366
|
+
{
|
|
4367
|
+
control,
|
|
4368
|
+
name: `value_${row.id}`,
|
|
4369
|
+
rules: { required: "This field is required." },
|
|
4370
|
+
render: ({ field }) => {
|
|
4371
|
+
const handleClear = () => {
|
|
4372
|
+
field.onChange("");
|
|
4373
|
+
onClear("value");
|
|
4374
|
+
};
|
|
4375
|
+
const hasValue = Boolean(field.value);
|
|
4376
|
+
const clearLabel = "Clear selected value";
|
|
4377
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { className: "relative", children: [
|
|
4378
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Select, { value: field.value ?? "", onValueChange: field.onChange, children: [
|
|
4379
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4380
|
+
SelectTrigger,
|
|
4381
|
+
{
|
|
4382
|
+
className: cn(
|
|
4383
|
+
"w-full justify-between rounded-md bg-white px-4 text-sm font-medium text-gray-700 shadow-none focus:ring-0",
|
|
4384
|
+
hasValue ? "pr-8" : "pr-4"
|
|
4385
|
+
),
|
|
4386
|
+
"data-testid": "advsearch-dropdown-value",
|
|
4387
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select value" })
|
|
4388
|
+
}
|
|
4389
|
+
) }),
|
|
4390
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { className: "w-full min-w-[unset]", children: loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center items-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-2 text-sm text-inherit", children: fieldSchema?.loadingMessage ?? "Loading..." }) }) : options.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center items-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-2 text-sm text-inherit", children: fieldSchema?.noOptionsMessage ?? "No records found." }) }) : options.map((opt) => /* @__PURE__ */ jsxRuntime.jsxs(SelectItem, { value: opt.value, className: cn(opt.labelStyle), children: [
|
|
4391
|
+
opt.decorator,
|
|
4392
|
+
opt.label
|
|
4393
|
+
] }, opt.value)) })
|
|
4394
|
+
] }),
|
|
4395
|
+
hasValue && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4396
|
+
ClearButton,
|
|
4362
4397
|
{
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
"data-testid": "advsearch-dropdown-value",
|
|
4368
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select value" })
|
|
4398
|
+
onClick: handleClear,
|
|
4399
|
+
ariaLabel: clearLabel,
|
|
4400
|
+
title: clearLabel,
|
|
4401
|
+
className: "absolute right-3 top-1/2 z-10 -translate-y-1/2"
|
|
4369
4402
|
}
|
|
4370
|
-
)
|
|
4371
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
] }, opt.value)) })
|
|
4375
|
-
] }),
|
|
4376
|
-
hasValue && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4377
|
-
ClearButton,
|
|
4378
|
-
{
|
|
4379
|
-
onClick: handleClear,
|
|
4380
|
-
ariaLabel: clearLabel,
|
|
4381
|
-
title: clearLabel,
|
|
4382
|
-
className: "absolute right-3 top-1/2 z-10 -translate-y-1/2"
|
|
4383
|
-
}
|
|
4384
|
-
),
|
|
4385
|
-
/* @__PURE__ */ jsxRuntime.jsx(FormMessage, { className: "absolute left-0 top-full mt-1 text-xs text-red-600" })
|
|
4386
|
-
] });
|
|
4403
|
+
),
|
|
4404
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormMessage, { className: "absolute left-0 top-full mt-1 text-xs text-red-600" })
|
|
4405
|
+
] });
|
|
4406
|
+
}
|
|
4387
4407
|
}
|
|
4388
|
-
|
|
4389
|
-
|
|
4408
|
+
);
|
|
4409
|
+
};
|
|
4390
4410
|
var ConditionCheckboxInput = ({ row, control, onClear }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4391
4411
|
FormField,
|
|
4392
4412
|
{
|
|
@@ -4445,24 +4465,24 @@ var LookupSelect = ({
|
|
|
4445
4465
|
dropdownPortalId,
|
|
4446
4466
|
multiple = false
|
|
4447
4467
|
}) => {
|
|
4448
|
-
const [inputValue, setInputValue] =
|
|
4449
|
-
const inputRef =
|
|
4450
|
-
const [inputFocused, setInputFocused] =
|
|
4451
|
-
const [suggestions, setSuggestions] =
|
|
4452
|
-
const [optionLabels, setOptionLabels] =
|
|
4453
|
-
const [loading, setLoading] =
|
|
4454
|
-
const [fetchError, setFetchError] =
|
|
4455
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
4456
|
-
const containerRef =
|
|
4457
|
-
const fetchDelayRef =
|
|
4458
|
-
const requestIdRef =
|
|
4459
|
-
const [dropdownStyles, setDropdownStyles] =
|
|
4460
|
-
const dropdownContentRef =
|
|
4461
|
-
const assignDropdownContentRef =
|
|
4468
|
+
const [inputValue, setInputValue] = React28.useState("");
|
|
4469
|
+
const inputRef = React28.useRef(null);
|
|
4470
|
+
const [inputFocused, setInputFocused] = React28.useState(false);
|
|
4471
|
+
const [suggestions, setSuggestions] = React28.useState([]);
|
|
4472
|
+
const [optionLabels, setOptionLabels] = React28.useState({});
|
|
4473
|
+
const [loading, setLoading] = React28.useState(false);
|
|
4474
|
+
const [fetchError, setFetchError] = React28.useState(null);
|
|
4475
|
+
const [isDropdownOpen, setIsDropdownOpen] = React28.useState(false);
|
|
4476
|
+
const containerRef = React28.useRef(null);
|
|
4477
|
+
const fetchDelayRef = React28.useRef(null);
|
|
4478
|
+
const requestIdRef = React28.useRef(0);
|
|
4479
|
+
const [dropdownStyles, setDropdownStyles] = React28.useState();
|
|
4480
|
+
const dropdownContentRef = React28.useRef(null);
|
|
4481
|
+
const assignDropdownContentRef = React28.useCallback((node) => {
|
|
4462
4482
|
dropdownContentRef.current = node;
|
|
4463
4483
|
}, []);
|
|
4464
|
-
const [activeSuggestionIndex, setActiveSuggestionIndex] =
|
|
4465
|
-
const dropdownPortalElement =
|
|
4484
|
+
const [activeSuggestionIndex, setActiveSuggestionIndex] = React28.useState(-1);
|
|
4485
|
+
const dropdownPortalElement = React28.useMemo(() => {
|
|
4466
4486
|
if (typeof document === "undefined") return null;
|
|
4467
4487
|
if (dropdownPortalId) {
|
|
4468
4488
|
const element = document.getElementById(dropdownPortalId);
|
|
@@ -4473,7 +4493,7 @@ var LookupSelect = ({
|
|
|
4473
4493
|
const limitReached = multiple && value.length >= maxTags;
|
|
4474
4494
|
const selectedValue = !multiple && value.length > 0 ? value[0] : void 0;
|
|
4475
4495
|
const selectedLabel = selectedValue ? optionLabels[selectedValue] ?? selectedValue : void 0;
|
|
4476
|
-
const upsertOptionLabels =
|
|
4496
|
+
const upsertOptionLabels = React28.useCallback((options) => {
|
|
4477
4497
|
setOptionLabels((prev) => {
|
|
4478
4498
|
let next = null;
|
|
4479
4499
|
options.forEach((opt) => {
|
|
@@ -4486,7 +4506,7 @@ var LookupSelect = ({
|
|
|
4486
4506
|
return next ?? prev;
|
|
4487
4507
|
});
|
|
4488
4508
|
}, []);
|
|
4489
|
-
const addTag =
|
|
4509
|
+
const addTag = React28.useCallback(
|
|
4490
4510
|
(val) => {
|
|
4491
4511
|
const trimmed = val.trim();
|
|
4492
4512
|
if (!trimmed) return;
|
|
@@ -4501,7 +4521,7 @@ var LookupSelect = ({
|
|
|
4501
4521
|
},
|
|
4502
4522
|
[value, onChange, maxTags, multiple]
|
|
4503
4523
|
);
|
|
4504
|
-
const removeTag =
|
|
4524
|
+
const removeTag = React28.useCallback(
|
|
4505
4525
|
(index) => {
|
|
4506
4526
|
if (index < 0) return;
|
|
4507
4527
|
const newTags = value.filter((_, i) => i !== index);
|
|
@@ -4511,7 +4531,7 @@ var LookupSelect = ({
|
|
|
4511
4531
|
},
|
|
4512
4532
|
[value, onChange]
|
|
4513
4533
|
);
|
|
4514
|
-
const handleClear =
|
|
4534
|
+
const handleClear = React28.useCallback(() => {
|
|
4515
4535
|
setInputValue("");
|
|
4516
4536
|
setSuggestions([]);
|
|
4517
4537
|
setInputFocused(false);
|
|
@@ -4519,7 +4539,7 @@ var LookupSelect = ({
|
|
|
4519
4539
|
setFetchError(null);
|
|
4520
4540
|
if (onClear) onClear();
|
|
4521
4541
|
}, [onClear]);
|
|
4522
|
-
const handleSuggestionSelect =
|
|
4542
|
+
const handleSuggestionSelect = React28.useCallback(
|
|
4523
4543
|
(option) => {
|
|
4524
4544
|
upsertOptionLabels([option]);
|
|
4525
4545
|
addTag(option.value);
|
|
@@ -4537,7 +4557,7 @@ var LookupSelect = ({
|
|
|
4537
4557
|
},
|
|
4538
4558
|
[addTag, multiple, upsertOptionLabels]
|
|
4539
4559
|
);
|
|
4540
|
-
const handleKeyDown =
|
|
4560
|
+
const handleKeyDown = React28.useCallback(
|
|
4541
4561
|
(e) => {
|
|
4542
4562
|
if (e.key === "ArrowDown" && suggestions.length > 0) {
|
|
4543
4563
|
e.preventDefault();
|
|
@@ -4564,7 +4584,7 @@ var LookupSelect = ({
|
|
|
4564
4584
|
},
|
|
4565
4585
|
[suggestions, activeSuggestionIndex, handleSuggestionSelect, inputValue, removeTag, value.length]
|
|
4566
4586
|
);
|
|
4567
|
-
const updateDropdownPosition =
|
|
4587
|
+
const updateDropdownPosition = React28.useCallback(() => {
|
|
4568
4588
|
if (!dropdownPortalElement || !containerRef.current) return;
|
|
4569
4589
|
const rect = containerRef.current.getBoundingClientRect();
|
|
4570
4590
|
setDropdownStyles({
|
|
@@ -4575,7 +4595,7 @@ var LookupSelect = ({
|
|
|
4575
4595
|
zIndex: 50
|
|
4576
4596
|
});
|
|
4577
4597
|
}, [dropdownPortalElement]);
|
|
4578
|
-
|
|
4598
|
+
React28.useEffect(() => {
|
|
4579
4599
|
if (!fetchSuggestions || !inputFocused) return;
|
|
4580
4600
|
if (fetchDelayRef.current) {
|
|
4581
4601
|
clearTimeout(fetchDelayRef.current);
|
|
@@ -4609,7 +4629,7 @@ var LookupSelect = ({
|
|
|
4609
4629
|
}
|
|
4610
4630
|
};
|
|
4611
4631
|
}, [inputValue, fetchSuggestions, suggestionDebounce, upsertOptionLabels, inputFocused]);
|
|
4612
|
-
|
|
4632
|
+
React28.useEffect(() => {
|
|
4613
4633
|
if (!fetchSuggestions) return;
|
|
4614
4634
|
if (value.length === 0) return;
|
|
4615
4635
|
const unresolvedValues = value.filter((v) => !optionLabels[v]);
|
|
@@ -4619,7 +4639,7 @@ var LookupSelect = ({
|
|
|
4619
4639
|
}).catch(() => {
|
|
4620
4640
|
});
|
|
4621
4641
|
}, [value, fetchSuggestions, optionLabels, upsertOptionLabels]);
|
|
4622
|
-
|
|
4642
|
+
React28.useEffect(() => {
|
|
4623
4643
|
const handleDocumentClick = (event) => {
|
|
4624
4644
|
const target = event.target;
|
|
4625
4645
|
if (containerRef.current?.contains(target)) return;
|
|
@@ -4632,11 +4652,11 @@ var LookupSelect = ({
|
|
|
4632
4652
|
document.removeEventListener("mousedown", handleDocumentClick);
|
|
4633
4653
|
};
|
|
4634
4654
|
}, []);
|
|
4635
|
-
|
|
4655
|
+
React28.useEffect(() => {
|
|
4636
4656
|
if (!limitReached) return;
|
|
4637
4657
|
setIsDropdownOpen(false);
|
|
4638
4658
|
}, [limitReached]);
|
|
4639
|
-
|
|
4659
|
+
React28.useEffect(() => {
|
|
4640
4660
|
if (!dropdownPortalElement) return;
|
|
4641
4661
|
if (!isDropdownOpen) return;
|
|
4642
4662
|
updateDropdownPosition();
|
|
@@ -4648,7 +4668,7 @@ var LookupSelect = ({
|
|
|
4648
4668
|
window.removeEventListener("scroll", handleReposition, true);
|
|
4649
4669
|
};
|
|
4650
4670
|
}, [dropdownPortalElement, isDropdownOpen, updateDropdownPosition, value]);
|
|
4651
|
-
|
|
4671
|
+
React28.useEffect(() => {
|
|
4652
4672
|
if (suggestions.length === 0) {
|
|
4653
4673
|
setActiveSuggestionIndex(-1);
|
|
4654
4674
|
return;
|
|
@@ -5344,13 +5364,12 @@ var TextBuilder = class {
|
|
|
5344
5364
|
};
|
|
5345
5365
|
|
|
5346
5366
|
// src/components/advanceSearch/builder/uuid.ts
|
|
5347
|
-
var regex = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
5348
5367
|
var UUIDBuilder = class {
|
|
5349
5368
|
build(row) {
|
|
5350
5369
|
if (Array.isArray(row.value)) {
|
|
5351
5370
|
return {};
|
|
5352
5371
|
}
|
|
5353
|
-
if (!
|
|
5372
|
+
if (!UUIDregex.test(row.value)) {
|
|
5354
5373
|
return { [row.fieldName]: {} };
|
|
5355
5374
|
}
|
|
5356
5375
|
const sharedOptions = {
|
|
@@ -5454,7 +5473,7 @@ var sanitizeInput = (val) => {
|
|
|
5454
5473
|
if (/\p{Cc}/u.test(val)) return "__INVALID_CONTROL_CHAR__";
|
|
5455
5474
|
return trimmed.replace(/\s+/g, " ");
|
|
5456
5475
|
};
|
|
5457
|
-
var numericTypes = ["number"
|
|
5476
|
+
var numericTypes = ["number"];
|
|
5458
5477
|
var dateTypes = ["date", "datemonth"];
|
|
5459
5478
|
var validateByFieldType = (value, fieldType) => {
|
|
5460
5479
|
if (!value) return { valid: true };
|
|
@@ -5466,9 +5485,9 @@ var validateByFieldType = (value, fieldType) => {
|
|
|
5466
5485
|
return { valid: false, message: "Please enter a valid number." };
|
|
5467
5486
|
}
|
|
5468
5487
|
}
|
|
5469
|
-
if (fieldType === "
|
|
5470
|
-
if (!
|
|
5471
|
-
return { valid: false, message: "Please enter a
|
|
5488
|
+
if (fieldType === "uuid") {
|
|
5489
|
+
if (!UUIDregex.test(value)) {
|
|
5490
|
+
return { valid: false, message: "Please enter a valid UUID." };
|
|
5472
5491
|
}
|
|
5473
5492
|
}
|
|
5474
5493
|
if (dateTypes.includes(fieldType)) {
|
|
@@ -5491,7 +5510,7 @@ var AdvanceSearch = ({
|
|
|
5491
5510
|
filterFieldMap = FILTER_FIELD_MAP,
|
|
5492
5511
|
customParamsBuilderHook
|
|
5493
5512
|
}) => {
|
|
5494
|
-
const fieldsData =
|
|
5513
|
+
const fieldsData = React28.useMemo(() => {
|
|
5495
5514
|
if (fields.length === 0) throw new Error("fields cannot be an empty array");
|
|
5496
5515
|
return fields || [];
|
|
5497
5516
|
}, [fields]);
|
|
@@ -5511,8 +5530,8 @@ var AdvanceSearch = ({
|
|
|
5511
5530
|
defaultValues: {}
|
|
5512
5531
|
});
|
|
5513
5532
|
const { handleSubmit, unregister, resetField, getValues, clearErrors, setError } = form;
|
|
5514
|
-
const [operatorErrors, setOperatorErrors] =
|
|
5515
|
-
const clearOperatorError =
|
|
5533
|
+
const [operatorErrors, setOperatorErrors] = React28__namespace.default.useState({});
|
|
5534
|
+
const clearOperatorError = React28.useCallback(
|
|
5516
5535
|
(rowId) => {
|
|
5517
5536
|
setOperatorErrors((prev) => {
|
|
5518
5537
|
if (!(rowId in prev)) return prev;
|
|
@@ -5522,7 +5541,7 @@ var AdvanceSearch = ({
|
|
|
5522
5541
|
},
|
|
5523
5542
|
[setOperatorErrors]
|
|
5524
5543
|
);
|
|
5525
|
-
const clearValue =
|
|
5544
|
+
const clearValue = React28.useCallback(
|
|
5526
5545
|
(rowId, which) => {
|
|
5527
5546
|
const fieldName = `${which}_${rowId}`;
|
|
5528
5547
|
resetField(fieldName, { defaultValue: void 0 });
|
|
@@ -5532,14 +5551,14 @@ var AdvanceSearch = ({
|
|
|
5532
5551
|
},
|
|
5533
5552
|
[resetField, clearErrors]
|
|
5534
5553
|
);
|
|
5535
|
-
const parseRangeValue =
|
|
5554
|
+
const parseRangeValue = React28.useCallback((raw, fieldType) => {
|
|
5536
5555
|
if (!raw) return void 0;
|
|
5537
5556
|
if (Array.isArray(raw)) return void 0;
|
|
5538
5557
|
const normalized = fieldType === "datemonth" ? `${raw}-01` : raw;
|
|
5539
5558
|
const parsed = dateFns.parseISO(normalized);
|
|
5540
5559
|
return dateFns.isValid(parsed) ? parsed : void 0;
|
|
5541
5560
|
}, []);
|
|
5542
|
-
const onSubmit =
|
|
5561
|
+
const onSubmit = React28.useCallback(() => {
|
|
5543
5562
|
const operatorValidation = {};
|
|
5544
5563
|
rows.forEach((r) => {
|
|
5545
5564
|
const ops = operatorsForField(r.fieldName);
|
|
@@ -5793,11 +5812,11 @@ function resetVisibleTableState(payload) {
|
|
|
5793
5812
|
table.setSorting(prevState.sorting.filter((s) => isVisible(s.id)));
|
|
5794
5813
|
}
|
|
5795
5814
|
var useHover = () => {
|
|
5796
|
-
const [hovering, setHovering] =
|
|
5797
|
-
const prevRef =
|
|
5798
|
-
const onMouseEnter =
|
|
5799
|
-
const onMouseLeave =
|
|
5800
|
-
const nodeRefCallback =
|
|
5815
|
+
const [hovering, setHovering] = React28.useState(false);
|
|
5816
|
+
const prevRef = React28.useRef(null);
|
|
5817
|
+
const onMouseEnter = React28.useCallback(() => setHovering(true), []);
|
|
5818
|
+
const onMouseLeave = React28.useCallback(() => setHovering(false), []);
|
|
5819
|
+
const nodeRefCallback = React28.useCallback(
|
|
5801
5820
|
(node) => {
|
|
5802
5821
|
if (prevRef.current) {
|
|
5803
5822
|
prevRef.current.removeEventListener("mouseenter", onMouseEnter);
|
|
@@ -5825,15 +5844,15 @@ var useIntersectionObserver = ({
|
|
|
5825
5844
|
initialIsIntersecting = false,
|
|
5826
5845
|
onChange
|
|
5827
5846
|
} = {}) => {
|
|
5828
|
-
const [ref, setRef] =
|
|
5829
|
-
const [state, setState] =
|
|
5847
|
+
const [ref, setRef] = React28.useState(null);
|
|
5848
|
+
const [state, setState] = React28.useState(() => ({
|
|
5830
5849
|
isIntersecting: initialIsIntersecting,
|
|
5831
5850
|
entry: void 0
|
|
5832
5851
|
}));
|
|
5833
|
-
const callbackRef =
|
|
5852
|
+
const callbackRef = React28.useRef(null);
|
|
5834
5853
|
callbackRef.current = onChange;
|
|
5835
5854
|
const frozen = state.entry?.isIntersecting && freezeOnceVisible;
|
|
5836
|
-
|
|
5855
|
+
React28.useEffect(() => {
|
|
5837
5856
|
if (!ref) return;
|
|
5838
5857
|
if (!("IntersectionObserver" in window)) return;
|
|
5839
5858
|
if (frozen) return;
|
|
@@ -5863,8 +5882,8 @@ var useIntersectionObserver = ({
|
|
|
5863
5882
|
frozen,
|
|
5864
5883
|
freezeOnceVisible
|
|
5865
5884
|
]);
|
|
5866
|
-
const prevRef =
|
|
5867
|
-
|
|
5885
|
+
const prevRef = React28.useRef(null);
|
|
5886
|
+
React28.useEffect(() => {
|
|
5868
5887
|
if (!ref && state.entry?.target && !freezeOnceVisible && !frozen && prevRef.current !== state.entry.target) {
|
|
5869
5888
|
prevRef.current = state.entry.target;
|
|
5870
5889
|
setState({ isIntersecting: initialIsIntersecting, entry: void 0 });
|
|
@@ -5881,8 +5900,8 @@ var isValidMediaQueryString = (query) => {
|
|
|
5881
5900
|
return query !== "not all";
|
|
5882
5901
|
};
|
|
5883
5902
|
var useMediaQuery = ({ query }) => {
|
|
5884
|
-
const [matches, setMatches] =
|
|
5885
|
-
|
|
5903
|
+
const [matches, setMatches] = React28.useState(false);
|
|
5904
|
+
React28.useEffect(() => {
|
|
5886
5905
|
if (typeof window === "undefined") {
|
|
5887
5906
|
return;
|
|
5888
5907
|
}
|
|
@@ -5918,8 +5937,8 @@ var useTruncated = ({
|
|
|
5918
5937
|
onChange,
|
|
5919
5938
|
resizeDetectDelay = 150
|
|
5920
5939
|
}) => {
|
|
5921
|
-
const [isTruncated, setIsTruncated] =
|
|
5922
|
-
|
|
5940
|
+
const [isTruncated, setIsTruncated] = React28.useState(false);
|
|
5941
|
+
React28.useEffect(() => {
|
|
5923
5942
|
const element = elementRef.current;
|
|
5924
5943
|
if (!element) return;
|
|
5925
5944
|
const checkTruncate = debounce(() => {
|
|
@@ -5948,14 +5967,14 @@ var useControllableState = ({
|
|
|
5948
5967
|
value
|
|
5949
5968
|
}) => {
|
|
5950
5969
|
const isControlled = typeof value !== "undefined";
|
|
5951
|
-
const [internalValue, setInternalValue] =
|
|
5970
|
+
const [internalValue, setInternalValue] = React28__namespace.useState(() => {
|
|
5952
5971
|
return isControlled ? value : defaultValue;
|
|
5953
5972
|
});
|
|
5954
|
-
|
|
5973
|
+
React28__namespace.useEffect(() => {
|
|
5955
5974
|
if (!isControlled) return;
|
|
5956
5975
|
setInternalValue(value);
|
|
5957
5976
|
}, [isControlled, value]);
|
|
5958
|
-
const setValue =
|
|
5977
|
+
const setValue = React28__namespace.useCallback(
|
|
5959
5978
|
(nextValue) => {
|
|
5960
5979
|
if (isControlled) return;
|
|
5961
5980
|
setInternalValue(nextValue);
|
|
@@ -5969,9 +5988,9 @@ var useControllableState = ({
|
|
|
5969
5988
|
};
|
|
5970
5989
|
};
|
|
5971
5990
|
var useControllableState_default = useControllableState;
|
|
5972
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
5991
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React28.useLayoutEffect : React28.useEffect;
|
|
5973
5992
|
var useBindRef = ({ ref, value }) => {
|
|
5974
|
-
|
|
5993
|
+
React28__namespace.useEffect(() => {
|
|
5975
5994
|
if (!ref) return;
|
|
5976
5995
|
ref.current = value;
|
|
5977
5996
|
return () => {
|
|
@@ -6164,7 +6183,7 @@ var StatusContentSlot = ({
|
|
|
6164
6183
|
content
|
|
6165
6184
|
] });
|
|
6166
6185
|
};
|
|
6167
|
-
var StatusContentSlot_default =
|
|
6186
|
+
var StatusContentSlot_default = React28__namespace.default.memo(StatusContentSlot);
|
|
6168
6187
|
var stateOptions = [
|
|
6169
6188
|
"columnFilters",
|
|
6170
6189
|
"globalFilter",
|
|
@@ -6217,9 +6236,9 @@ var modelOptions = [
|
|
|
6217
6236
|
"getCenterVisibleLeafColumns"
|
|
6218
6237
|
];
|
|
6219
6238
|
var DataTableDevTool = ({ table }) => {
|
|
6220
|
-
const [open, setOpen] =
|
|
6221
|
-
const [visibleStates, setVisibleStates] =
|
|
6222
|
-
const [visibleModels, setVisibleModels] =
|
|
6239
|
+
const [open, setOpen] = React28.useState(false);
|
|
6240
|
+
const [visibleStates, setVisibleStates] = React28.useState([]);
|
|
6241
|
+
const [visibleModels, setVisibleModels] = React28.useState([]);
|
|
6223
6242
|
const tableState = table.getState();
|
|
6224
6243
|
const toggleValue = (arr, value) => arr.includes(value) ? arr.filter((v) => v !== value) : [...arr, value];
|
|
6225
6244
|
const getCircularReplacer = () => {
|
|
@@ -6432,7 +6451,7 @@ var useTableController = ({
|
|
|
6432
6451
|
return table;
|
|
6433
6452
|
};
|
|
6434
6453
|
var useScrollFetch = ({ scrollFetch, containerRef }) => {
|
|
6435
|
-
const fetchMoreOnScrollReached =
|
|
6454
|
+
const fetchMoreOnScrollReached = React28.useCallback(
|
|
6436
6455
|
(containerRefElement) => {
|
|
6437
6456
|
if (!scrollFetch?.enabled || !containerRefElement || scrollFetch?.isFetchingMore || !scrollFetch?.hasMore || !scrollFetch?.fetchMore) {
|
|
6438
6457
|
return;
|
|
@@ -6466,7 +6485,7 @@ var useScrollFetch = ({ scrollFetch, containerRef }) => {
|
|
|
6466
6485
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6467
6486
|
[scrollFetch?.enabled, scrollFetch?.isFetchingMore, scrollFetch?.hasMore, scrollFetch?.fetchMore]
|
|
6468
6487
|
);
|
|
6469
|
-
|
|
6488
|
+
React28.useEffect(() => {
|
|
6470
6489
|
fetchMoreOnScrollReached(containerRef.current);
|
|
6471
6490
|
}, [fetchMoreOnScrollReached, containerRef]);
|
|
6472
6491
|
return fetchMoreOnScrollReached;
|
|
@@ -6516,7 +6535,7 @@ function useComputedTableState({
|
|
|
6516
6535
|
leftVisibleLeftColumns.length + centerVisibleLeafColumns.length + rightVisibleLeafColumns.length,
|
|
6517
6536
|
1
|
|
6518
6537
|
);
|
|
6519
|
-
const { isSomeColumnsFilterable, filterableColumns } =
|
|
6538
|
+
const { isSomeColumnsFilterable, filterableColumns } = React28.useMemo(() => {
|
|
6520
6539
|
const mergedColumns = [
|
|
6521
6540
|
...leftVisibleLeftColumns,
|
|
6522
6541
|
...centerVisibleLeafColumns,
|
|
@@ -6527,7 +6546,7 @@ function useComputedTableState({
|
|
|
6527
6546
|
);
|
|
6528
6547
|
return { isSomeColumnsFilterable: isSomeColumnsFilterable2, filterableColumns: mergedColumns };
|
|
6529
6548
|
}, [centerVisibleLeafColumns, leftVisibleLeftColumns, rightVisibleLeafColumns]);
|
|
6530
|
-
const autoStatusKey =
|
|
6549
|
+
const autoStatusKey = React28.useMemo(() => {
|
|
6531
6550
|
if (isInitialLoading) return "initialLoading";
|
|
6532
6551
|
if (isTableEmpty) return "emptyData";
|
|
6533
6552
|
if (isTableEmptyAfterFiltering) return "emptyFilteredData";
|
|
@@ -6545,7 +6564,7 @@ function useComputedTableState({
|
|
|
6545
6564
|
scrollFetch?.hasMore,
|
|
6546
6565
|
scrollFetch?.isFetchingMore
|
|
6547
6566
|
]);
|
|
6548
|
-
const activeStatusContentComputed =
|
|
6567
|
+
const activeStatusContentComputed = React28.useMemo(() => {
|
|
6549
6568
|
if (!activeStatusContent) return autoStatusKey;
|
|
6550
6569
|
if (typeof activeStatusContent === "function") {
|
|
6551
6570
|
return activeStatusContent({ defaultComputedValue: autoStatusKey });
|
|
@@ -6596,7 +6615,7 @@ var ColumnSeparator = ({ show, className, ...props }) => {
|
|
|
6596
6615
|
}
|
|
6597
6616
|
);
|
|
6598
6617
|
};
|
|
6599
|
-
var ColumnSeparator_default =
|
|
6618
|
+
var ColumnSeparator_default = React28__namespace.default.memo(ColumnSeparator);
|
|
6600
6619
|
|
|
6601
6620
|
// src/components/data-table/helpers.ts
|
|
6602
6621
|
function getColumnPinningInfo(column) {
|
|
@@ -6754,7 +6773,7 @@ var TableDataRows = ({
|
|
|
6754
6773
|
if (!row) return null;
|
|
6755
6774
|
const virtualIndex = config.isVirtualize ? item.index : void 0;
|
|
6756
6775
|
const tableDataRowProps = typeof components?.tableDataRowProps === "function" ? components.tableDataRowProps({ row, table }) || {} : components?.tableDataRowProps || {};
|
|
6757
|
-
return /* @__PURE__ */
|
|
6776
|
+
return /* @__PURE__ */ React28.createElement(
|
|
6758
6777
|
TableRow,
|
|
6759
6778
|
{
|
|
6760
6779
|
"data-testid": `table-data-row-${row.id}`,
|
|
@@ -6843,7 +6862,7 @@ var DataTable = ({
|
|
|
6843
6862
|
components
|
|
6844
6863
|
}) => {
|
|
6845
6864
|
const virtualEnabled = virtual?.enabled ?? false;
|
|
6846
|
-
const tableContainerRef =
|
|
6865
|
+
const tableContainerRef = React28.useRef(null);
|
|
6847
6866
|
const table = useTableController({
|
|
6848
6867
|
columns,
|
|
6849
6868
|
data,
|
|
@@ -7247,11 +7266,11 @@ function DialogAlert({
|
|
|
7247
7266
|
}) {
|
|
7248
7267
|
const alignClass = align === "start" ? "justify-start" : align === "end" ? "justify-end" : "justify-center";
|
|
7249
7268
|
const { t } = reactI18next.useTranslation();
|
|
7250
|
-
const handleCancel =
|
|
7269
|
+
const handleCancel = React28.useCallback(() => {
|
|
7251
7270
|
onCancel?.();
|
|
7252
7271
|
onOpenChange(false);
|
|
7253
7272
|
}, [onCancel, onOpenChange]);
|
|
7254
|
-
const handleConfirm =
|
|
7273
|
+
const handleConfirm = React28.useCallback(() => {
|
|
7255
7274
|
let func = onConfirm;
|
|
7256
7275
|
if (variant === "success" && showCancel === false) {
|
|
7257
7276
|
func = onConfirm ?? onCancel;
|
|
@@ -7626,7 +7645,7 @@ var DialogAlertProvider = ({ children, i18nResource, i18nLang }) => {
|
|
|
7626
7645
|
const open = useDialogAlertStore((state) => state.open);
|
|
7627
7646
|
const setOpen = useDialogAlertStore((state) => state.setOpen);
|
|
7628
7647
|
const dialogProps = useDialogAlertStore((state) => state.dialogProps);
|
|
7629
|
-
|
|
7648
|
+
React28.useEffect(() => {
|
|
7630
7649
|
if (!i18nResource) {
|
|
7631
7650
|
i18n_default.changeLanguage("sharedui");
|
|
7632
7651
|
return;
|
|
@@ -7736,8 +7755,8 @@ var defaultOperatorShortcuts = {
|
|
|
7736
7755
|
};
|
|
7737
7756
|
var DEFAULT_DEBOUNCE = 200;
|
|
7738
7757
|
function useKeyboardNavigation(itemsLength, onSelect, isLocked) {
|
|
7739
|
-
const [selectedIndex, setSelectedIndex] =
|
|
7740
|
-
|
|
7758
|
+
const [selectedIndex, setSelectedIndex] = React28.useState(0);
|
|
7759
|
+
React28.useEffect(() => {
|
|
7741
7760
|
const handler = (event) => {
|
|
7742
7761
|
if (event.key === "ArrowDown") {
|
|
7743
7762
|
event.preventDefault();
|
|
@@ -7760,10 +7779,10 @@ function useKeyboardNavigation(itemsLength, onSelect, isLocked) {
|
|
|
7760
7779
|
return [selectedIndex, setSelectedIndex];
|
|
7761
7780
|
}
|
|
7762
7781
|
function useDropdownPosition(clientRect, itemsCount) {
|
|
7763
|
-
const [rect, setRect] =
|
|
7764
|
-
const [style, setStyle] =
|
|
7765
|
-
const ref =
|
|
7766
|
-
|
|
7782
|
+
const [rect, setRect] = React28.useState(null);
|
|
7783
|
+
const [style, setStyle] = React28.useState({});
|
|
7784
|
+
const ref = React28.useRef(null);
|
|
7785
|
+
React28.useEffect(() => {
|
|
7767
7786
|
if (!clientRect) return;
|
|
7768
7787
|
const update = () => {
|
|
7769
7788
|
const nextRect = clientRect();
|
|
@@ -7780,7 +7799,7 @@ function useDropdownPosition(clientRect, itemsCount) {
|
|
|
7780
7799
|
resizeObserver.disconnect();
|
|
7781
7800
|
};
|
|
7782
7801
|
}, [clientRect]);
|
|
7783
|
-
|
|
7802
|
+
React28.useLayoutEffect(() => {
|
|
7784
7803
|
if (!rect || !ref.current) return;
|
|
7785
7804
|
const dropdown = ref.current;
|
|
7786
7805
|
const dropdownRect = dropdown.getBoundingClientRect();
|
|
@@ -7807,15 +7826,15 @@ var SuggestionList = ({
|
|
|
7807
7826
|
debounceMs = DEFAULT_DEBOUNCE,
|
|
7808
7827
|
query
|
|
7809
7828
|
}) => {
|
|
7810
|
-
const [items, setItems] =
|
|
7811
|
-
const [isLoading, setIsLoading] =
|
|
7812
|
-
const fetchId =
|
|
7813
|
-
const debounceHandle =
|
|
7814
|
-
const itemRefs =
|
|
7829
|
+
const [items, setItems] = React28.useState([]);
|
|
7830
|
+
const [isLoading, setIsLoading] = React28.useState(false);
|
|
7831
|
+
const fetchId = React28.useRef(0);
|
|
7832
|
+
const debounceHandle = React28.useRef(null);
|
|
7833
|
+
const itemRefs = React28.useRef([]);
|
|
7815
7834
|
const { ref, style, rect } = useDropdownPosition(clientRect, items.length);
|
|
7816
|
-
const normalizedMap =
|
|
7817
|
-
const normalizeItem =
|
|
7818
|
-
|
|
7835
|
+
const normalizedMap = React28.useMemo(() => mapItem, [mapItem]);
|
|
7836
|
+
const normalizeItem = React28.useMemo(() => normalizeToken, [normalizeToken]);
|
|
7837
|
+
React28.useEffect(() => {
|
|
7819
7838
|
const runFetch = (input) => {
|
|
7820
7839
|
fetchId.current += 1;
|
|
7821
7840
|
const currentId = fetchId.current;
|
|
@@ -7846,7 +7865,7 @@ var SuggestionList = ({
|
|
|
7846
7865
|
fetchId.current += 1;
|
|
7847
7866
|
};
|
|
7848
7867
|
}, [query, fetchItems, normalizedMap, normalizeItem, debounceMs]);
|
|
7849
|
-
const handleSelect =
|
|
7868
|
+
const handleSelect = React28.useMemo(
|
|
7850
7869
|
() => (item) => {
|
|
7851
7870
|
if (isLoading) return;
|
|
7852
7871
|
command(item);
|
|
@@ -7861,10 +7880,10 @@ var SuggestionList = ({
|
|
|
7861
7880
|
},
|
|
7862
7881
|
isLoading
|
|
7863
7882
|
);
|
|
7864
|
-
|
|
7883
|
+
React28.useEffect(() => {
|
|
7865
7884
|
setSelectedIndex(0);
|
|
7866
7885
|
}, [items, setSelectedIndex]);
|
|
7867
|
-
|
|
7886
|
+
React28.useEffect(() => {
|
|
7868
7887
|
const element = itemRefs.current[selectedIndex];
|
|
7869
7888
|
if (element) element.scrollIntoView({ block: "nearest" });
|
|
7870
7889
|
}, [selectedIndex]);
|
|
@@ -7912,8 +7931,8 @@ var DISALLOWED_MARKS = ["bold", "italic", "link"];
|
|
|
7912
7931
|
var SUGGESTION_DEBOUNCE = 200;
|
|
7913
7932
|
var DEFAULT_CHIP_CLASS = "outline-1 outline-muted bg-muted/40 text-foreground";
|
|
7914
7933
|
var TokenView = ({ node, editor, getPos }) => {
|
|
7915
|
-
const [isFocused, setIsFocused] =
|
|
7916
|
-
|
|
7934
|
+
const [isFocused, setIsFocused] = React28__namespace.default.useState(false);
|
|
7935
|
+
React28__namespace.default.useEffect(() => {
|
|
7917
7936
|
const handler = () => {
|
|
7918
7937
|
const { from, to } = editor.state.selection;
|
|
7919
7938
|
const position = getPos();
|
|
@@ -8900,21 +8919,21 @@ function ToolbarPlugin({
|
|
|
8900
8919
|
acceptImageMimeTypes
|
|
8901
8920
|
}) {
|
|
8902
8921
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
8903
|
-
const [state, setState] =
|
|
8904
|
-
const fileInputRef =
|
|
8905
|
-
const [isLinkDialogOpen, setLinkDialogOpen] =
|
|
8906
|
-
const [editingExistingLink, setEditingExistingLink] =
|
|
8907
|
-
const [linkNodeKey, setLinkNodeKey] =
|
|
8908
|
-
const [isImageDialogOpen, setImageDialogOpen] =
|
|
8909
|
-
const [editingExistingImage, setEditingExistingImage] =
|
|
8910
|
-
const [imageNodeKey, setImageNodeKey] =
|
|
8922
|
+
const [state, setState] = React28.useState(initialToolbarState);
|
|
8923
|
+
const fileInputRef = React28.useRef(null);
|
|
8924
|
+
const [isLinkDialogOpen, setLinkDialogOpen] = React28.useState(false);
|
|
8925
|
+
const [editingExistingLink, setEditingExistingLink] = React28.useState(false);
|
|
8926
|
+
const [linkNodeKey, setLinkNodeKey] = React28.useState(null);
|
|
8927
|
+
const [isImageDialogOpen, setImageDialogOpen] = React28.useState(false);
|
|
8928
|
+
const [editingExistingImage, setEditingExistingImage] = React28.useState(false);
|
|
8929
|
+
const [imageNodeKey, setImageNodeKey] = React28.useState(null);
|
|
8911
8930
|
const linkForm = reactHookForm.useForm({
|
|
8912
8931
|
defaultValues: { url: "", label: "" }
|
|
8913
8932
|
});
|
|
8914
8933
|
const imageForm = reactHookForm.useForm({
|
|
8915
8934
|
defaultValues: { url: "", alt: "", width: "", height: "" }
|
|
8916
8935
|
});
|
|
8917
|
-
const openImageDialog =
|
|
8936
|
+
const openImageDialog = React28.useCallback(() => {
|
|
8918
8937
|
if (disabled || !allowImageUrlInsert) {
|
|
8919
8938
|
return;
|
|
8920
8939
|
}
|
|
@@ -8948,7 +8967,7 @@ function ToolbarPlugin({
|
|
|
8948
8967
|
setImageNodeKey(targetImage?.getKey() ?? null);
|
|
8949
8968
|
setImageDialogOpen(true);
|
|
8950
8969
|
}, [allowImageUrlInsert, disabled, editor, imageForm]);
|
|
8951
|
-
const closeImageDialog =
|
|
8970
|
+
const closeImageDialog = React28.useCallback(() => {
|
|
8952
8971
|
setImageDialogOpen(false);
|
|
8953
8972
|
setEditingExistingImage(false);
|
|
8954
8973
|
setImageNodeKey(null);
|
|
@@ -8957,7 +8976,7 @@ function ToolbarPlugin({
|
|
|
8957
8976
|
editor.focus();
|
|
8958
8977
|
}, 0);
|
|
8959
8978
|
}, [editor, imageForm]);
|
|
8960
|
-
const openLinkDialog =
|
|
8979
|
+
const openLinkDialog = React28.useCallback(() => {
|
|
8961
8980
|
if (disabled) {
|
|
8962
8981
|
return;
|
|
8963
8982
|
}
|
|
@@ -8997,7 +9016,7 @@ function ToolbarPlugin({
|
|
|
8997
9016
|
setLinkNodeKey(detectedLink?.getKey() ?? null);
|
|
8998
9017
|
setLinkDialogOpen(true);
|
|
8999
9018
|
}, [disabled, editor, linkForm]);
|
|
9000
|
-
const closeLinkDialog =
|
|
9019
|
+
const closeLinkDialog = React28.useCallback(() => {
|
|
9001
9020
|
setLinkDialogOpen(false);
|
|
9002
9021
|
setEditingExistingLink(false);
|
|
9003
9022
|
setLinkNodeKey(null);
|
|
@@ -9038,7 +9057,7 @@ function ToolbarPlugin({
|
|
|
9038
9057
|
});
|
|
9039
9058
|
closeLinkDialog();
|
|
9040
9059
|
});
|
|
9041
|
-
const handleRemoveLink =
|
|
9060
|
+
const handleRemoveLink = React28.useCallback(() => {
|
|
9042
9061
|
editor.focus();
|
|
9043
9062
|
editor.update(() => {
|
|
9044
9063
|
if (linkNodeKey) {
|
|
@@ -9055,7 +9074,7 @@ function ToolbarPlugin({
|
|
|
9055
9074
|
});
|
|
9056
9075
|
closeLinkDialog();
|
|
9057
9076
|
}, [closeLinkDialog, editor, linkNodeKey]);
|
|
9058
|
-
const handleLinkDialogOpenChange =
|
|
9077
|
+
const handleLinkDialogOpenChange = React28.useCallback(
|
|
9059
9078
|
(open) => {
|
|
9060
9079
|
if (open) {
|
|
9061
9080
|
setLinkDialogOpen(true);
|
|
@@ -9065,7 +9084,7 @@ function ToolbarPlugin({
|
|
|
9065
9084
|
},
|
|
9066
9085
|
[closeLinkDialog]
|
|
9067
9086
|
);
|
|
9068
|
-
const updateToolbar =
|
|
9087
|
+
const updateToolbar = React28.useCallback(() => {
|
|
9069
9088
|
const selection = lexical.$getSelection();
|
|
9070
9089
|
if (!lexical.$isRangeSelection(selection)) {
|
|
9071
9090
|
return;
|
|
@@ -9105,7 +9124,7 @@ function ToolbarPlugin({
|
|
|
9105
9124
|
isLink: hasLink
|
|
9106
9125
|
}));
|
|
9107
9126
|
}, []);
|
|
9108
|
-
|
|
9127
|
+
React28__namespace.useEffect(() => {
|
|
9109
9128
|
return utils.mergeRegister(
|
|
9110
9129
|
editor.registerCommand(
|
|
9111
9130
|
lexical.CAN_UNDO_COMMAND,
|
|
@@ -9136,7 +9155,7 @@ function ToolbarPlugin({
|
|
|
9136
9155
|
})
|
|
9137
9156
|
);
|
|
9138
9157
|
}, [editor, updateToolbar]);
|
|
9139
|
-
const applyBlock =
|
|
9158
|
+
const applyBlock = React28.useCallback(
|
|
9140
9159
|
(nextBlock) => {
|
|
9141
9160
|
if (disabled) {
|
|
9142
9161
|
return;
|
|
@@ -9198,7 +9217,7 @@ function ToolbarPlugin({
|
|
|
9198
9217
|
},
|
|
9199
9218
|
[disabled, editor, state.blockType]
|
|
9200
9219
|
);
|
|
9201
|
-
const toggleFormat =
|
|
9220
|
+
const toggleFormat = React28.useCallback(
|
|
9202
9221
|
(format5) => {
|
|
9203
9222
|
if (disabled) {
|
|
9204
9223
|
return;
|
|
@@ -9207,10 +9226,10 @@ function ToolbarPlugin({
|
|
|
9207
9226
|
},
|
|
9208
9227
|
[disabled, editor]
|
|
9209
9228
|
);
|
|
9210
|
-
const toggleLink =
|
|
9229
|
+
const toggleLink = React28.useCallback(() => {
|
|
9211
9230
|
openLinkDialog();
|
|
9212
9231
|
}, [openLinkDialog]);
|
|
9213
|
-
const applyElementFormat =
|
|
9232
|
+
const applyElementFormat = React28.useCallback(
|
|
9214
9233
|
(format5) => {
|
|
9215
9234
|
if (disabled) {
|
|
9216
9235
|
return;
|
|
@@ -9221,7 +9240,7 @@ function ToolbarPlugin({
|
|
|
9221
9240
|
);
|
|
9222
9241
|
const canInsertImage = allowImageUrlInsert || Boolean(onImageUpload);
|
|
9223
9242
|
const imageAccept = acceptImageMimeTypes ?? DEFAULT_IMAGE_ACCEPT;
|
|
9224
|
-
const handleInsertImage =
|
|
9243
|
+
const handleInsertImage = React28.useCallback(() => {
|
|
9225
9244
|
if (disabled || !canInsertImage) {
|
|
9226
9245
|
return;
|
|
9227
9246
|
}
|
|
@@ -9232,7 +9251,7 @@ function ToolbarPlugin({
|
|
|
9232
9251
|
}
|
|
9233
9252
|
openImageDialog();
|
|
9234
9253
|
}, [canInsertImage, disabled, editor, onImageUpload, openImageDialog]);
|
|
9235
|
-
const handleFileChange =
|
|
9254
|
+
const handleFileChange = React28.useCallback(
|
|
9236
9255
|
async (event) => {
|
|
9237
9256
|
if (!onImageUpload) {
|
|
9238
9257
|
return;
|
|
@@ -9322,7 +9341,7 @@ function ToolbarPlugin({
|
|
|
9322
9341
|
});
|
|
9323
9342
|
closeImageDialog();
|
|
9324
9343
|
});
|
|
9325
|
-
const handleImageDialogOpenChange =
|
|
9344
|
+
const handleImageDialogOpenChange = React28.useCallback(
|
|
9326
9345
|
(open) => {
|
|
9327
9346
|
if (open) {
|
|
9328
9347
|
setImageDialogOpen(true);
|
|
@@ -9332,7 +9351,7 @@ function ToolbarPlugin({
|
|
|
9332
9351
|
},
|
|
9333
9352
|
[closeImageDialog]
|
|
9334
9353
|
);
|
|
9335
|
-
const handleRemoveImage =
|
|
9354
|
+
const handleRemoveImage = React28.useCallback(() => {
|
|
9336
9355
|
if (!imageNodeKey) {
|
|
9337
9356
|
closeImageDialog();
|
|
9338
9357
|
return;
|
|
@@ -9691,7 +9710,7 @@ function ControlledValuePlugin({
|
|
|
9691
9710
|
trackAppliedValue
|
|
9692
9711
|
}) {
|
|
9693
9712
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
9694
|
-
|
|
9713
|
+
React28__namespace.useEffect(() => {
|
|
9695
9714
|
if (value == null || trackAppliedValue.current === value) {
|
|
9696
9715
|
return;
|
|
9697
9716
|
}
|
|
@@ -9715,14 +9734,14 @@ function ControlledValuePlugin({
|
|
|
9715
9734
|
}
|
|
9716
9735
|
function EditableStatePlugin({ editable }) {
|
|
9717
9736
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
9718
|
-
|
|
9737
|
+
React28__namespace.useEffect(() => {
|
|
9719
9738
|
editor.setEditable(editable);
|
|
9720
9739
|
}, [editor, editable]);
|
|
9721
9740
|
return null;
|
|
9722
9741
|
}
|
|
9723
9742
|
function ImagesPlugin() {
|
|
9724
9743
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
9725
|
-
|
|
9744
|
+
React28__namespace.useEffect(() => {
|
|
9726
9745
|
return editor.registerCommand(
|
|
9727
9746
|
INSERT_IMAGE_COMMAND,
|
|
9728
9747
|
(payload) => {
|
|
@@ -9741,7 +9760,7 @@ function ImagesPlugin() {
|
|
|
9741
9760
|
}, [editor]);
|
|
9742
9761
|
return null;
|
|
9743
9762
|
}
|
|
9744
|
-
var RichText =
|
|
9763
|
+
var RichText = React28.forwardRef(function RichText2({
|
|
9745
9764
|
value,
|
|
9746
9765
|
defaultValue,
|
|
9747
9766
|
onChange,
|
|
@@ -9760,11 +9779,11 @@ var RichText = React27.forwardRef(function RichText2({
|
|
|
9760
9779
|
id,
|
|
9761
9780
|
...rest
|
|
9762
9781
|
}, ref) {
|
|
9763
|
-
const initialSerializedStateRef =
|
|
9782
|
+
const initialSerializedStateRef = React28.useRef(void 0);
|
|
9764
9783
|
if (initialSerializedStateRef.current === void 0) {
|
|
9765
9784
|
initialSerializedStateRef.current = parseSerializedEditorState(value ?? defaultValue);
|
|
9766
9785
|
}
|
|
9767
|
-
const initialConfig =
|
|
9786
|
+
const initialConfig = React28.useMemo(
|
|
9768
9787
|
() => ({
|
|
9769
9788
|
namespace: "RichTextEditor",
|
|
9770
9789
|
editable: !(readOnly || disabled),
|
|
@@ -9777,8 +9796,8 @@ var RichText = React27.forwardRef(function RichText2({
|
|
|
9777
9796
|
}),
|
|
9778
9797
|
[disabled, readOnly]
|
|
9779
9798
|
);
|
|
9780
|
-
const appliedValueRef =
|
|
9781
|
-
const handleChange =
|
|
9799
|
+
const appliedValueRef = React28.useRef(value ?? defaultValue);
|
|
9800
|
+
const handleChange = React28.useCallback(
|
|
9782
9801
|
(editorState, editor) => {
|
|
9783
9802
|
const serialized = JSON.stringify(editorState.toJSON());
|
|
9784
9803
|
appliedValueRef.current = serialized;
|
|
@@ -9967,13 +9986,13 @@ function SheetDescription({
|
|
|
9967
9986
|
);
|
|
9968
9987
|
}
|
|
9969
9988
|
function useIsMobile(breakpoint = 768) {
|
|
9970
|
-
const [isMobile, setIsMobile] =
|
|
9989
|
+
const [isMobile, setIsMobile] = React28.useState(() => {
|
|
9971
9990
|
if (typeof window === "undefined") {
|
|
9972
9991
|
return false;
|
|
9973
9992
|
}
|
|
9974
9993
|
return window.innerWidth < breakpoint;
|
|
9975
9994
|
});
|
|
9976
|
-
|
|
9995
|
+
React28.useEffect(() => {
|
|
9977
9996
|
function onResize() {
|
|
9978
9997
|
setIsMobile(window.innerWidth < breakpoint);
|
|
9979
9998
|
}
|
|
@@ -10003,9 +10022,9 @@ var SIDEBAR_WIDTH = "16rem";
|
|
|
10003
10022
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
10004
10023
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
10005
10024
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
10006
|
-
var SidebarContext =
|
|
10025
|
+
var SidebarContext = React28__namespace.createContext(null);
|
|
10007
10026
|
function useSidebar() {
|
|
10008
|
-
const context =
|
|
10027
|
+
const context = React28__namespace.useContext(SidebarContext);
|
|
10009
10028
|
if (!context) {
|
|
10010
10029
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
10011
10030
|
}
|
|
@@ -10021,10 +10040,10 @@ function SidebarProvider({
|
|
|
10021
10040
|
...props
|
|
10022
10041
|
}) {
|
|
10023
10042
|
const isMobile = useIsMobile();
|
|
10024
|
-
const [openMobile, setOpenMobile] =
|
|
10025
|
-
const [_open, _setOpen] =
|
|
10043
|
+
const [openMobile, setOpenMobile] = React28__namespace.useState(false);
|
|
10044
|
+
const [_open, _setOpen] = React28__namespace.useState(defaultOpen);
|
|
10026
10045
|
const open = openProp ?? _open;
|
|
10027
|
-
const setOpen =
|
|
10046
|
+
const setOpen = React28__namespace.useCallback(
|
|
10028
10047
|
(value) => {
|
|
10029
10048
|
const openState = typeof value === "function" ? value(open) : value;
|
|
10030
10049
|
if (setOpenProp) {
|
|
@@ -10036,10 +10055,10 @@ function SidebarProvider({
|
|
|
10036
10055
|
},
|
|
10037
10056
|
[setOpenProp, open]
|
|
10038
10057
|
);
|
|
10039
|
-
const toggleSidebar =
|
|
10058
|
+
const toggleSidebar = React28__namespace.useCallback(() => {
|
|
10040
10059
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
10041
10060
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
10042
|
-
|
|
10061
|
+
React28__namespace.useEffect(() => {
|
|
10043
10062
|
const handleKeyDown = (event) => {
|
|
10044
10063
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
10045
10064
|
event.preventDefault();
|
|
@@ -10050,7 +10069,7 @@ function SidebarProvider({
|
|
|
10050
10069
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
10051
10070
|
}, [toggleSidebar]);
|
|
10052
10071
|
const state = open ? "expanded" : "collapsed";
|
|
10053
|
-
const contextValue =
|
|
10072
|
+
const contextValue = React28__namespace.useMemo(
|
|
10054
10073
|
() => ({
|
|
10055
10074
|
state,
|
|
10056
10075
|
open,
|
|
@@ -10492,7 +10511,7 @@ function SidebarMenuSkeleton({
|
|
|
10492
10511
|
showIcon = false,
|
|
10493
10512
|
...props
|
|
10494
10513
|
}) {
|
|
10495
|
-
const width =
|
|
10514
|
+
const width = React28__namespace.useMemo(() => {
|
|
10496
10515
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
10497
10516
|
}, []);
|
|
10498
10517
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -10757,10 +10776,10 @@ var FormulaEditor = ({
|
|
|
10757
10776
|
fieldState,
|
|
10758
10777
|
mode = "edit"
|
|
10759
10778
|
}) => {
|
|
10760
|
-
const [isExpanded, setIsExpanded] =
|
|
10761
|
-
const lastEmittedValueRef =
|
|
10762
|
-
const ignorePropValueRef =
|
|
10763
|
-
const normalizedConfigs =
|
|
10779
|
+
const [isExpanded, setIsExpanded] = React28.useState(false);
|
|
10780
|
+
const lastEmittedValueRef = React28.useRef(null);
|
|
10781
|
+
const ignorePropValueRef = React28.useRef(false);
|
|
10782
|
+
const normalizedConfigs = React28.useMemo(() => {
|
|
10764
10783
|
const configsToUse = tokenConfigs?.length ? tokenConfigs : DEFAULT_TOKEN_CONFIGS;
|
|
10765
10784
|
return configsToUse.map((config) => ({
|
|
10766
10785
|
...config,
|
|
@@ -10769,18 +10788,18 @@ var FormulaEditor = ({
|
|
|
10769
10788
|
outputType: config.outputType ?? config.type
|
|
10770
10789
|
}));
|
|
10771
10790
|
}, [tokenConfigs]);
|
|
10772
|
-
const prefixMap =
|
|
10773
|
-
const configLookup =
|
|
10791
|
+
const prefixMap = React28.useMemo(() => buildPrefixMap(normalizedConfigs), [normalizedConfigs]);
|
|
10792
|
+
const configLookup = React28.useMemo(() => {
|
|
10774
10793
|
const lookup = /* @__PURE__ */ new Map();
|
|
10775
10794
|
normalizedConfigs.forEach((config) => lookup.set(config.prefix, config));
|
|
10776
10795
|
return lookup;
|
|
10777
10796
|
}, [normalizedConfigs]);
|
|
10778
|
-
const allowedOperators =
|
|
10797
|
+
const allowedOperators = React28.useMemo(() => operators.map((operator) => operator.value), [operators]);
|
|
10779
10798
|
const displayError = errorMessage ?? fieldState?.error?.message;
|
|
10780
10799
|
const hasError = Boolean(displayError);
|
|
10781
10800
|
const isEditorReadOnly = mode === "display";
|
|
10782
10801
|
const isEditorDisabled = disabled || loading || isEditorReadOnly;
|
|
10783
|
-
const convertValueToContent =
|
|
10802
|
+
const convertValueToContent = React28.useCallback(
|
|
10784
10803
|
(input) => {
|
|
10785
10804
|
if (!input) return "";
|
|
10786
10805
|
const trimmed = input.trim();
|
|
@@ -10792,8 +10811,8 @@ var FormulaEditor = ({
|
|
|
10792
10811
|
},
|
|
10793
10812
|
[configLookup, prefixMap]
|
|
10794
10813
|
);
|
|
10795
|
-
const resolvedContent =
|
|
10796
|
-
const extensions =
|
|
10814
|
+
const resolvedContent = React28.useMemo(() => convertValueToContent(value), [convertValueToContent, value]);
|
|
10815
|
+
const extensions = React28.useMemo(
|
|
10797
10816
|
() => [
|
|
10798
10817
|
StarterKit__default.default.configure({ bold: false, italic: false }),
|
|
10799
10818
|
Token.configure({ configs: normalizedConfigs, onSelect: onSelectSuggestion }),
|
|
@@ -10825,11 +10844,11 @@ var FormulaEditor = ({
|
|
|
10825
10844
|
}
|
|
10826
10845
|
}
|
|
10827
10846
|
});
|
|
10828
|
-
|
|
10847
|
+
React28.useEffect(() => {
|
|
10829
10848
|
if (!editor) return;
|
|
10830
10849
|
editor.setEditable(!isEditorDisabled);
|
|
10831
10850
|
}, [editor, isEditorDisabled]);
|
|
10832
|
-
|
|
10851
|
+
React28.useEffect(() => {
|
|
10833
10852
|
if (!editor || resolvedContent === void 0) return;
|
|
10834
10853
|
if (ignorePropValueRef.current && typeof value === "string" && value === lastEmittedValueRef.current) {
|
|
10835
10854
|
ignorePropValueRef.current = false;
|
|
@@ -10962,7 +10981,7 @@ function SortableRow({
|
|
|
10962
10981
|
id: value,
|
|
10963
10982
|
disabled: name === "columns.0.id"
|
|
10964
10983
|
});
|
|
10965
|
-
const style =
|
|
10984
|
+
const style = React28__namespace.useMemo(
|
|
10966
10985
|
() => ({
|
|
10967
10986
|
transform: utilities.CSS.Transform.toString(transform),
|
|
10968
10987
|
transition
|
|
@@ -11074,8 +11093,8 @@ var GridSettingsModal = ({
|
|
|
11074
11093
|
onClose,
|
|
11075
11094
|
onSaveColumns
|
|
11076
11095
|
}) => {
|
|
11077
|
-
const [isDragging, setIsDragging] =
|
|
11078
|
-
const scrollRef =
|
|
11096
|
+
const [isDragging, setIsDragging] = React28.useState(false);
|
|
11097
|
+
const scrollRef = React28.useRef(null);
|
|
11079
11098
|
const form = reactHookForm.useForm({
|
|
11080
11099
|
resolver: zod$1.zodResolver(GridSettingsSchema),
|
|
11081
11100
|
defaultValues: { columns: currentColumns },
|
|
@@ -11087,7 +11106,7 @@ var GridSettingsModal = ({
|
|
|
11087
11106
|
name: "columns",
|
|
11088
11107
|
keyName: "fieldId"
|
|
11089
11108
|
});
|
|
11090
|
-
|
|
11109
|
+
React28.useEffect(() => {
|
|
11091
11110
|
if (isOpen) {
|
|
11092
11111
|
form.reset({ columns: currentColumns });
|
|
11093
11112
|
}
|
|
@@ -11364,7 +11383,7 @@ function getCandidateWidths({
|
|
|
11364
11383
|
}
|
|
11365
11384
|
return DEVICE_SIZES;
|
|
11366
11385
|
}
|
|
11367
|
-
var Image2 =
|
|
11386
|
+
var Image2 = React28__namespace.forwardRef(function Image3({
|
|
11368
11387
|
src,
|
|
11369
11388
|
alt,
|
|
11370
11389
|
width,
|
|
@@ -11394,34 +11413,34 @@ var Image2 = React27__namespace.forwardRef(function Image3({
|
|
|
11394
11413
|
} = imgProps;
|
|
11395
11414
|
const widthNumber = toNumber(width);
|
|
11396
11415
|
const heightNumber = toNumber(height);
|
|
11397
|
-
|
|
11416
|
+
React28__namespace.useEffect(() => {
|
|
11398
11417
|
if (!fill && (!widthNumber || !heightNumber)) {
|
|
11399
11418
|
console.warn(
|
|
11400
11419
|
"[Image] When `fill` is false you should provide both `width` and `height` to prevent layout shifts."
|
|
11401
11420
|
);
|
|
11402
11421
|
}
|
|
11403
11422
|
}, [fill, heightNumber, widthNumber]);
|
|
11404
|
-
const candidateWidths =
|
|
11423
|
+
const candidateWidths = React28__namespace.useMemo(
|
|
11405
11424
|
() => getCandidateWidths({ width: widthNumber, sizes, fill }),
|
|
11406
11425
|
[fill, sizes, widthNumber]
|
|
11407
11426
|
);
|
|
11408
11427
|
const largestWidth = candidateWidths[candidateWidths.length - 1] ?? widthNumber ?? DEVICE_SIZES[DEVICE_SIZES.length - 1];
|
|
11409
|
-
const computedSrc =
|
|
11428
|
+
const computedSrc = React28__namespace.useMemo(() => {
|
|
11410
11429
|
if (unoptimized) {
|
|
11411
11430
|
return src;
|
|
11412
11431
|
}
|
|
11413
11432
|
return loader({ src, width: largestWidth, quality });
|
|
11414
11433
|
}, [largestWidth, loader, quality, src, unoptimized]);
|
|
11415
|
-
const computedSrcSet =
|
|
11434
|
+
const computedSrcSet = React28__namespace.useMemo(() => {
|
|
11416
11435
|
if (unoptimized) {
|
|
11417
11436
|
return void 0;
|
|
11418
11437
|
}
|
|
11419
11438
|
return candidateWidths.map((currentWidth) => `${loader({ src, width: currentWidth, quality })} ${currentWidth}w`).join(", ");
|
|
11420
11439
|
}, [candidateWidths, loader, quality, src, unoptimized]);
|
|
11421
11440
|
const sizesValue = sizes ?? (fill ? "100vw" : widthNumber ? `${widthNumber}px` : void 0);
|
|
11422
|
-
const [isLoaded, setIsLoaded] =
|
|
11423
|
-
const internalRef =
|
|
11424
|
-
const setRefs =
|
|
11441
|
+
const [isLoaded, setIsLoaded] = React28__namespace.useState(false);
|
|
11442
|
+
const internalRef = React28__namespace.useRef(null);
|
|
11443
|
+
const setRefs = React28__namespace.useCallback(
|
|
11425
11444
|
(node) => {
|
|
11426
11445
|
internalRef.current = node;
|
|
11427
11446
|
if (!ref) {
|
|
@@ -11435,7 +11454,7 @@ var Image2 = React27__namespace.forwardRef(function Image3({
|
|
|
11435
11454
|
},
|
|
11436
11455
|
[ref]
|
|
11437
11456
|
);
|
|
11438
|
-
|
|
11457
|
+
React28__namespace.useEffect(() => {
|
|
11439
11458
|
const image = internalRef.current;
|
|
11440
11459
|
if (!image) {
|
|
11441
11460
|
return;
|
|
@@ -11447,7 +11466,7 @@ var Image2 = React27__namespace.forwardRef(function Image3({
|
|
|
11447
11466
|
setIsLoaded(false);
|
|
11448
11467
|
}
|
|
11449
11468
|
}, [onLoadingComplete, src]);
|
|
11450
|
-
const handleLoad =
|
|
11469
|
+
const handleLoad = React28__namespace.useCallback(
|
|
11451
11470
|
(event) => {
|
|
11452
11471
|
setIsLoaded(true);
|
|
11453
11472
|
onLoadProp?.(event);
|
|
@@ -11459,7 +11478,7 @@ var Image2 = React27__namespace.forwardRef(function Image3({
|
|
|
11459
11478
|
const fetchPriority = priority ? "high" : fetchPriorityProp;
|
|
11460
11479
|
const decoding = decodingProp ?? "async";
|
|
11461
11480
|
const resolvedObjectFit = objectFit ?? (fill ? "cover" : void 0);
|
|
11462
|
-
const wrapperStyle =
|
|
11481
|
+
const wrapperStyle = React28__namespace.useMemo(
|
|
11463
11482
|
() => ({
|
|
11464
11483
|
position: "relative",
|
|
11465
11484
|
display: fill ? "block" : "inline-block",
|
|
@@ -11469,7 +11488,7 @@ var Image2 = React27__namespace.forwardRef(function Image3({
|
|
|
11469
11488
|
}),
|
|
11470
11489
|
[fill, height, width]
|
|
11471
11490
|
);
|
|
11472
|
-
const imageStyle =
|
|
11491
|
+
const imageStyle = React28__namespace.useMemo(
|
|
11473
11492
|
() => ({
|
|
11474
11493
|
width: fill ? "100%" : formatDimension(width) ?? void 0,
|
|
11475
11494
|
height: fill ? "100%" : formatDimension(height) ?? void 0,
|
|
@@ -11618,7 +11637,7 @@ var InfoIcon = ({ size = "1em", className, ...props }) => {
|
|
|
11618
11637
|
}
|
|
11619
11638
|
);
|
|
11620
11639
|
};
|
|
11621
|
-
var InfoIcon_default =
|
|
11640
|
+
var InfoIcon_default = React28__namespace.default.memo(InfoIcon);
|
|
11622
11641
|
var Navbar = ({
|
|
11623
11642
|
className,
|
|
11624
11643
|
title,
|
|
@@ -11643,7 +11662,7 @@ var Navbar = ({
|
|
|
11643
11662
|
}) => {
|
|
11644
11663
|
const { isMobile, isTablet, isDesktop } = useScreenSize_default();
|
|
11645
11664
|
const Icon2 = lucideReact.CircleHelp;
|
|
11646
|
-
const shouldShowSeparator = !separatorDisable &&
|
|
11665
|
+
const shouldShowSeparator = !separatorDisable && React28.isValidElement(searchButton);
|
|
11647
11666
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11648
11667
|
"nav",
|
|
11649
11668
|
{
|
|
@@ -11654,8 +11673,8 @@ var Navbar = ({
|
|
|
11654
11673
|
children: [
|
|
11655
11674
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
11656
11675
|
headImageURL !== "" ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: headImageURL, alt: "", className: cn("w-full h-full", headImageURLClassName) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
11657
|
-
|
|
11658
|
-
|
|
11676
|
+
React28.isValidElement(title) ? title : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-xl font-bold", children: title }),
|
|
11677
|
+
React28.isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
|
|
11659
11678
|
] }),
|
|
11660
11679
|
tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
|
|
11661
11680
|
/* @__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" }) }) }),
|
|
@@ -11686,10 +11705,10 @@ var Navbar = ({
|
|
|
11686
11705
|
),
|
|
11687
11706
|
children: [
|
|
11688
11707
|
tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
11689
|
-
|
|
11708
|
+
React28.isValidElement(tooltipIcon) ? tooltipIcon : /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 32, "aria-hidden": "true" }),
|
|
11690
11709
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-bold", children: tooltipTitle })
|
|
11691
11710
|
] }),
|
|
11692
|
-
|
|
11711
|
+
React28.isValidElement(tooltipdescription) && tooltipdescription
|
|
11693
11712
|
]
|
|
11694
11713
|
}
|
|
11695
11714
|
),
|
|
@@ -11744,13 +11763,13 @@ var Navbar = ({
|
|
|
11744
11763
|
}
|
|
11745
11764
|
),
|
|
11746
11765
|
shouldShowSeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "separator", className: "ml-1 w-[1px] h-10 bg-white" }),
|
|
11747
|
-
|
|
11766
|
+
React28.isValidElement(searchButton) ? searchButton : ""
|
|
11748
11767
|
] })
|
|
11749
11768
|
]
|
|
11750
11769
|
}
|
|
11751
11770
|
);
|
|
11752
11771
|
};
|
|
11753
|
-
var navbar_default =
|
|
11772
|
+
var navbar_default = React28__namespace.default.memo(Navbar);
|
|
11754
11773
|
var usePreventPageLeaveStore = zustand.create((set) => ({
|
|
11755
11774
|
isPreventing: false,
|
|
11756
11775
|
setPreventing: (value) => set({ isPreventing: value })
|
|
@@ -11760,7 +11779,7 @@ var usePreventPageLeaveStore_default = usePreventPageLeaveStore;
|
|
|
11760
11779
|
// src/components/prevent-page-leave/PreventPageLeave.tsx
|
|
11761
11780
|
var PreventPageLeave = ({ children }) => {
|
|
11762
11781
|
const { isPreventing } = usePreventPageLeaveStore();
|
|
11763
|
-
|
|
11782
|
+
React28.useEffect(() => {
|
|
11764
11783
|
if (!isPreventing || typeof window === "undefined") {
|
|
11765
11784
|
return;
|
|
11766
11785
|
}
|
|
@@ -11778,7 +11797,7 @@ var PreventPageLeave = ({ children }) => {
|
|
|
11778
11797
|
var PreventPageLeave_default = PreventPageLeave;
|
|
11779
11798
|
var usePreventPageLeave = ({ isPrevening }) => {
|
|
11780
11799
|
const setPreventing = usePreventPageLeaveStore_default((state) => state.setPreventing);
|
|
11781
|
-
|
|
11800
|
+
React28.useEffect(() => {
|
|
11782
11801
|
setPreventing(isPrevening);
|
|
11783
11802
|
}, [isPrevening, setPreventing]);
|
|
11784
11803
|
};
|
|
@@ -11790,7 +11809,7 @@ var DefaultHeader = ({
|
|
|
11790
11809
|
classNames,
|
|
11791
11810
|
rightActions
|
|
11792
11811
|
}) => {
|
|
11793
|
-
const titleRef =
|
|
11812
|
+
const titleRef = React28__namespace.useRef(null);
|
|
11794
11813
|
const isTruncated = useTruncated_default({ elementRef: titleRef });
|
|
11795
11814
|
const textElement = title ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11796
11815
|
"span",
|
|
@@ -12008,20 +12027,20 @@ var CropperModal = ({
|
|
|
12008
12027
|
title,
|
|
12009
12028
|
props
|
|
12010
12029
|
}) => {
|
|
12011
|
-
const [isLoading, setIsLoading] =
|
|
12012
|
-
const [crop, setCrop] =
|
|
12013
|
-
const [zoom, setZoom] =
|
|
12014
|
-
const [croppedAreaPixels, setCroppedAreaPixels] =
|
|
12015
|
-
const handleClose =
|
|
12030
|
+
const [isLoading, setIsLoading] = React28.useState(false);
|
|
12031
|
+
const [crop, setCrop] = React28.useState({ x: 0, y: 0 });
|
|
12032
|
+
const [zoom, setZoom] = React28.useState();
|
|
12033
|
+
const [croppedAreaPixels, setCroppedAreaPixels] = React28.useState(null);
|
|
12034
|
+
const handleClose = React28.useCallback(() => {
|
|
12016
12035
|
onOpenChange(false);
|
|
12017
12036
|
}, [onOpenChange]);
|
|
12018
|
-
const handleCancel =
|
|
12037
|
+
const handleCancel = React28.useCallback(() => {
|
|
12019
12038
|
if (onCancel) {
|
|
12020
12039
|
onCancel();
|
|
12021
12040
|
}
|
|
12022
12041
|
handleClose();
|
|
12023
12042
|
}, [handleClose, onCancel]);
|
|
12024
|
-
const handleCropComplete =
|
|
12043
|
+
const handleCropComplete = React28.useCallback((_, croppedAreaPixels2) => {
|
|
12025
12044
|
setCroppedAreaPixels(croppedAreaPixels2);
|
|
12026
12045
|
}, []);
|
|
12027
12046
|
const handleConfirm = async () => {
|
|
@@ -12129,7 +12148,7 @@ function isFragment(object) {
|
|
|
12129
12148
|
var isValidText = (val) => ["string", "number"].includes(typeof val);
|
|
12130
12149
|
function toArray(children, option = {}) {
|
|
12131
12150
|
let ret = [];
|
|
12132
|
-
|
|
12151
|
+
React28__namespace.Children.forEach(children, (child) => {
|
|
12133
12152
|
if ((child === void 0 || child === null) && !option.keepEmpty) {
|
|
12134
12153
|
return;
|
|
12135
12154
|
}
|
|
@@ -12143,9 +12162,9 @@ function toArray(children, option = {}) {
|
|
|
12143
12162
|
});
|
|
12144
12163
|
return ret;
|
|
12145
12164
|
}
|
|
12146
|
-
var MeasureText =
|
|
12147
|
-
const spanRef =
|
|
12148
|
-
|
|
12165
|
+
var MeasureText = React28__namespace.forwardRef(({ style, children }, ref) => {
|
|
12166
|
+
const spanRef = React28__namespace.useRef(null);
|
|
12167
|
+
React28__namespace.useImperativeHandle(ref, () => ({
|
|
12149
12168
|
isExceed: () => {
|
|
12150
12169
|
const span = spanRef.current;
|
|
12151
12170
|
return span.scrollHeight > span.clientHeight;
|
|
@@ -12203,19 +12222,19 @@ var lineClipStyle = {
|
|
|
12203
12222
|
};
|
|
12204
12223
|
function EllipsisMeasure(props) {
|
|
12205
12224
|
const { enableMeasure, width, text, children, rows, expanded, miscDeps, onEllipsis } = props;
|
|
12206
|
-
const nodeList =
|
|
12207
|
-
const nodeLen =
|
|
12208
|
-
const fullContent =
|
|
12209
|
-
const [ellipsisCutIndex, setEllipsisCutIndex] =
|
|
12210
|
-
const cutMidRef =
|
|
12211
|
-
const measureWhiteSpaceRef =
|
|
12212
|
-
const needEllipsisRef =
|
|
12213
|
-
const descRowsEllipsisRef =
|
|
12214
|
-
const symbolRowEllipsisRef =
|
|
12215
|
-
const [canEllipsis, setCanEllipsis] =
|
|
12216
|
-
const [needEllipsis, setNeedEllipsis] =
|
|
12217
|
-
const [ellipsisHeight, setEllipsisHeight] =
|
|
12218
|
-
const [parentWhiteSpace, setParentWhiteSpace] =
|
|
12225
|
+
const nodeList = React28__namespace.useMemo(() => toArray(text), [text]);
|
|
12226
|
+
const nodeLen = React28__namespace.useMemo(() => getNodesLen(nodeList), [text]);
|
|
12227
|
+
const fullContent = React28__namespace.useMemo(() => children(nodeList, false), [text]);
|
|
12228
|
+
const [ellipsisCutIndex, setEllipsisCutIndex] = React28__namespace.useState(null);
|
|
12229
|
+
const cutMidRef = React28__namespace.useRef(null);
|
|
12230
|
+
const measureWhiteSpaceRef = React28__namespace.useRef(null);
|
|
12231
|
+
const needEllipsisRef = React28__namespace.useRef(null);
|
|
12232
|
+
const descRowsEllipsisRef = React28__namespace.useRef(null);
|
|
12233
|
+
const symbolRowEllipsisRef = React28__namespace.useRef(null);
|
|
12234
|
+
const [canEllipsis, setCanEllipsis] = React28__namespace.useState(false);
|
|
12235
|
+
const [needEllipsis, setNeedEllipsis] = React28__namespace.useState(STATUS_MEASURE_NONE);
|
|
12236
|
+
const [ellipsisHeight, setEllipsisHeight] = React28__namespace.useState(0);
|
|
12237
|
+
const [parentWhiteSpace, setParentWhiteSpace] = React28__namespace.useState(null);
|
|
12219
12238
|
useIsomorphicLayoutEffect(() => {
|
|
12220
12239
|
if (enableMeasure && width && nodeLen) {
|
|
12221
12240
|
setNeedEllipsis(STATUS_MEASURE_PREPARE);
|
|
@@ -12258,7 +12277,7 @@ function EllipsisMeasure(props) {
|
|
|
12258
12277
|
setEllipsisCutIndex(isOverflow ? [minIndex, targetMidIndex] : [targetMidIndex, maxIndex]);
|
|
12259
12278
|
}
|
|
12260
12279
|
}, [ellipsisCutIndex, cutMidIndex]);
|
|
12261
|
-
const finalContent =
|
|
12280
|
+
const finalContent = React28__namespace.useMemo(() => {
|
|
12262
12281
|
if (!enableMeasure) {
|
|
12263
12282
|
return children(nodeList, false);
|
|
12264
12283
|
}
|
|
@@ -12349,10 +12368,10 @@ var Truncated = ({
|
|
|
12349
12368
|
tooltipProps,
|
|
12350
12369
|
tooltipContentProps
|
|
12351
12370
|
}) => {
|
|
12352
|
-
const elementRef =
|
|
12353
|
-
const [open, setOpen] =
|
|
12354
|
-
const [isTruncated, setIsTruncated] =
|
|
12355
|
-
const [measureWidth, setMeasureWidth] =
|
|
12371
|
+
const elementRef = React28__namespace.useRef(null);
|
|
12372
|
+
const [open, setOpen] = React28__namespace.useState(false);
|
|
12373
|
+
const [isTruncated, setIsTruncated] = React28__namespace.useState(false);
|
|
12374
|
+
const [measureWidth, setMeasureWidth] = React28__namespace.useState(0);
|
|
12356
12375
|
const Comp = as;
|
|
12357
12376
|
const normalizedChildren = typeof children === "string" ? children.replace(/>/g, ">\u200B") : children;
|
|
12358
12377
|
const lineClampLines = typeof ellipsis === "number" ? ellipsis : typeof ellipsis === "object" ? ellipsis?.lineClamp ?? 3 : null;
|
|
@@ -12377,13 +12396,13 @@ var Truncated = ({
|
|
|
12377
12396
|
setIsTruncated(false);
|
|
12378
12397
|
}
|
|
12379
12398
|
}, [enableMeasure]);
|
|
12380
|
-
const truncationClass =
|
|
12399
|
+
const truncationClass = React28__namespace.useMemo(() => {
|
|
12381
12400
|
if (!ellipsis) return "";
|
|
12382
12401
|
if (typeof ellipsis === "number") return `line-clamp-${ellipsis}`;
|
|
12383
12402
|
if (typeof ellipsis === "object") return `line-clamp-${lineClampLines ?? 3}`;
|
|
12384
12403
|
return "truncate";
|
|
12385
12404
|
}, [ellipsis, lineClampLines]);
|
|
12386
|
-
const clampedStyle =
|
|
12405
|
+
const clampedStyle = React28__namespace.useMemo(() => {
|
|
12387
12406
|
if (!lineClampLines) return style;
|
|
12388
12407
|
return {
|
|
12389
12408
|
...style,
|
|
@@ -12445,7 +12464,7 @@ var Truncated = ({
|
|
|
12445
12464
|
);
|
|
12446
12465
|
};
|
|
12447
12466
|
var truncated_default = Truncated;
|
|
12448
|
-
var InputPrimitive2 =
|
|
12467
|
+
var InputPrimitive2 = React28__namespace.forwardRef(
|
|
12449
12468
|
({ className, type = "text", ...props }, ref) => {
|
|
12450
12469
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12451
12470
|
"input",
|
|
@@ -12484,7 +12503,7 @@ var inputVariants2 = classVarianceAuthority.cva("", {
|
|
|
12484
12503
|
appearance: "filled"
|
|
12485
12504
|
}
|
|
12486
12505
|
});
|
|
12487
|
-
var Input2 =
|
|
12506
|
+
var Input2 = React28__namespace.forwardRef(
|
|
12488
12507
|
({
|
|
12489
12508
|
className,
|
|
12490
12509
|
wrapperClassName,
|
|
@@ -12517,8 +12536,8 @@ var Input2 = React27__namespace.forwardRef(
|
|
|
12517
12536
|
onChange: onChangeProp
|
|
12518
12537
|
} = rest;
|
|
12519
12538
|
const ariaInvalid = invalid ?? ariaInvalidProp;
|
|
12520
|
-
const messageId =
|
|
12521
|
-
const handleChange =
|
|
12539
|
+
const messageId = React28__namespace.useId();
|
|
12540
|
+
const handleChange = React28__namespace.useCallback(
|
|
12522
12541
|
(event) => {
|
|
12523
12542
|
onChangeProp?.(event);
|
|
12524
12543
|
onValueChange?.(event.target.value);
|
|
@@ -12633,11 +12652,11 @@ var InputNumber = ({
|
|
|
12633
12652
|
onBlur,
|
|
12634
12653
|
...props
|
|
12635
12654
|
}) => {
|
|
12636
|
-
const [internalValue, setInternalValue] =
|
|
12655
|
+
const [internalValue, setInternalValue] = React28__namespace.useState(
|
|
12637
12656
|
() => parseToNumber(value) ?? parseToNumber(defaultValue)
|
|
12638
12657
|
);
|
|
12639
|
-
const [stepperChanged, setStepperChanged] =
|
|
12640
|
-
|
|
12658
|
+
const [stepperChanged, setStepperChanged] = React28__namespace.useState(false);
|
|
12659
|
+
React28__namespace.useEffect(() => {
|
|
12641
12660
|
const parsed = parseToNumber(value);
|
|
12642
12661
|
if (parsed !== void 0) setInternalValue(parsed);
|
|
12643
12662
|
}, [value]);
|
|
@@ -12769,8 +12788,8 @@ var ActionMenu = ({
|
|
|
12769
12788
|
actionButtonClassName,
|
|
12770
12789
|
separatorClassName
|
|
12771
12790
|
}) => {
|
|
12772
|
-
const [open, setOpen] =
|
|
12773
|
-
const isAllowed =
|
|
12791
|
+
const [open, setOpen] = React28.useState(false);
|
|
12792
|
+
const isAllowed = React28.useCallback(
|
|
12774
12793
|
(requiredPermission) => {
|
|
12775
12794
|
if (!checkPermissionFunc || requiredPermission === void 0) {
|
|
12776
12795
|
return true;
|
|
@@ -12779,7 +12798,7 @@ var ActionMenu = ({
|
|
|
12779
12798
|
},
|
|
12780
12799
|
[checkPermissionFunc]
|
|
12781
12800
|
);
|
|
12782
|
-
const filteredButtons =
|
|
12801
|
+
const filteredButtons = React28.useMemo(() => {
|
|
12783
12802
|
return buttons.filter((btn) => isAllowed(btn.requiredPermission));
|
|
12784
12803
|
}, [buttons, isAllowed]);
|
|
12785
12804
|
if (buttons.length === 0) {
|
|
@@ -13035,13 +13054,13 @@ var useFieldNames = ({
|
|
|
13035
13054
|
fieldNames
|
|
13036
13055
|
}) => {
|
|
13037
13056
|
const { label: labelFieldKey = "label", value: valueFieldKey = "value" } = fieldNames || {};
|
|
13038
|
-
const getLabelField =
|
|
13057
|
+
const getLabelField = React28__namespace.default.useCallback(
|
|
13039
13058
|
(option) => {
|
|
13040
13059
|
return option?.[labelFieldKey];
|
|
13041
13060
|
},
|
|
13042
13061
|
[labelFieldKey]
|
|
13043
13062
|
);
|
|
13044
|
-
const getValueField =
|
|
13063
|
+
const getValueField = React28__namespace.default.useCallback(
|
|
13045
13064
|
(option) => {
|
|
13046
13065
|
return option?.[valueFieldKey];
|
|
13047
13066
|
},
|
|
@@ -13073,11 +13092,11 @@ var VirtualizedCommand = ({
|
|
|
13073
13092
|
onFocus
|
|
13074
13093
|
}) => {
|
|
13075
13094
|
const { getLabelField, getValueField } = useFieldNames_default({ fieldNames });
|
|
13076
|
-
const internalOptions =
|
|
13077
|
-
const [filteredOptions, setFilteredOptions] =
|
|
13078
|
-
const [focusedIndex, setFocusedIndex] =
|
|
13079
|
-
const [isKeyboardNavActive, setIsKeyboardNavActive] =
|
|
13080
|
-
const parentRef =
|
|
13095
|
+
const internalOptions = React28__namespace.useMemo(() => options ?? [], [options]);
|
|
13096
|
+
const [filteredOptions, setFilteredOptions] = React28__namespace.useState(internalOptions);
|
|
13097
|
+
const [focusedIndex, setFocusedIndex] = React28__namespace.useState(0);
|
|
13098
|
+
const [isKeyboardNavActive, setIsKeyboardNavActive] = React28__namespace.useState(false);
|
|
13099
|
+
const parentRef = React28__namespace.useRef(null);
|
|
13081
13100
|
const virtualizer = reactVirtual.useVirtualizer({
|
|
13082
13101
|
count: filteredOptions.length,
|
|
13083
13102
|
getScrollElement: () => parentRef.current,
|
|
@@ -13085,14 +13104,14 @@ var VirtualizedCommand = ({
|
|
|
13085
13104
|
overscan: 2
|
|
13086
13105
|
});
|
|
13087
13106
|
const virtualOptions = virtualizer.getVirtualItems();
|
|
13088
|
-
const dynamicHeight =
|
|
13107
|
+
const dynamicHeight = React28__namespace.useMemo(() => {
|
|
13089
13108
|
const contentHeight = filteredOptions.length * ROW_HEIGHT;
|
|
13090
13109
|
if (contentHeight <= 0) {
|
|
13091
13110
|
return MIN_HEIGHT_EMPTY;
|
|
13092
13111
|
}
|
|
13093
13112
|
return Math.max(ROW_HEIGHT, Math.min(height, contentHeight));
|
|
13094
13113
|
}, [filteredOptions.length, height]);
|
|
13095
|
-
const scrollToIndex =
|
|
13114
|
+
const scrollToIndex = React28__namespace.useCallback(
|
|
13096
13115
|
(index) => {
|
|
13097
13116
|
virtualizer.scrollToIndex(index, {
|
|
13098
13117
|
align: "center"
|
|
@@ -13100,7 +13119,7 @@ var VirtualizedCommand = ({
|
|
|
13100
13119
|
},
|
|
13101
13120
|
[virtualizer]
|
|
13102
13121
|
);
|
|
13103
|
-
const handleSearch =
|
|
13122
|
+
const handleSearch = React28__namespace.useCallback(
|
|
13104
13123
|
(search) => {
|
|
13105
13124
|
setIsKeyboardNavActive(false);
|
|
13106
13125
|
setFilteredOptions(
|
|
@@ -13115,7 +13134,7 @@ var VirtualizedCommand = ({
|
|
|
13115
13134
|
},
|
|
13116
13135
|
[filterOption, getLabelField, internalOptions]
|
|
13117
13136
|
);
|
|
13118
|
-
const handleKeyDown =
|
|
13137
|
+
const handleKeyDown = React28__namespace.useCallback(
|
|
13119
13138
|
(event) => {
|
|
13120
13139
|
switch (event.key) {
|
|
13121
13140
|
case "ArrowDown": {
|
|
@@ -13150,7 +13169,7 @@ var VirtualizedCommand = ({
|
|
|
13150
13169
|
},
|
|
13151
13170
|
[filteredOptions, focusedIndex, getValueField, onSelect, scrollToIndex]
|
|
13152
13171
|
);
|
|
13153
|
-
|
|
13172
|
+
React28__namespace.useEffect(() => {
|
|
13154
13173
|
if (value) {
|
|
13155
13174
|
const option = filteredOptions.find((option2) => {
|
|
13156
13175
|
const optionValue = getValueField(option2);
|
|
@@ -13277,13 +13296,13 @@ var ComboboxInner = ({
|
|
|
13277
13296
|
defaultValue,
|
|
13278
13297
|
value
|
|
13279
13298
|
});
|
|
13280
|
-
const currentSelectedOption =
|
|
13299
|
+
const currentSelectedOption = React28__namespace.useMemo(() => {
|
|
13281
13300
|
return options?.find((option) => {
|
|
13282
13301
|
const optionValue = getValueField(option);
|
|
13283
13302
|
return optionValue === selectedValue;
|
|
13284
13303
|
});
|
|
13285
13304
|
}, [getValueField, options, selectedValue]);
|
|
13286
|
-
const renderValue =
|
|
13305
|
+
const renderValue = React28__namespace.useMemo(() => {
|
|
13287
13306
|
if (!selectedValue) return placeholder2;
|
|
13288
13307
|
if (currentSelectedOption) {
|
|
13289
13308
|
return getLabelField(currentSelectedOption);
|
|
@@ -13293,7 +13312,7 @@ var ComboboxInner = ({
|
|
|
13293
13312
|
}
|
|
13294
13313
|
return null;
|
|
13295
13314
|
}, [currentSelectedOption, getLabelField, placeholder2, selectedValue, showValueWhenNoMatch]);
|
|
13296
|
-
const handleSelect =
|
|
13315
|
+
const handleSelect = React28__namespace.useCallback(
|
|
13297
13316
|
(selected, option) => {
|
|
13298
13317
|
setSelectedValue(selected);
|
|
13299
13318
|
setOpenPopover(false);
|
|
@@ -13306,7 +13325,7 @@ var ComboboxInner = ({
|
|
|
13306
13325
|
},
|
|
13307
13326
|
[onOpenChange, onSelect, setOpenPopover, setSelectedValue]
|
|
13308
13327
|
);
|
|
13309
|
-
const handleOpenPopover =
|
|
13328
|
+
const handleOpenPopover = React28__namespace.useCallback(
|
|
13310
13329
|
(isOpen) => {
|
|
13311
13330
|
if (disabled) return;
|
|
13312
13331
|
setOpenPopover(isOpen);
|
|
@@ -13316,7 +13335,7 @@ var ComboboxInner = ({
|
|
|
13316
13335
|
},
|
|
13317
13336
|
[disabled, onOpenChange, setOpenPopover]
|
|
13318
13337
|
);
|
|
13319
|
-
const handleClear =
|
|
13338
|
+
const handleClear = React28__namespace.useCallback(
|
|
13320
13339
|
(event) => {
|
|
13321
13340
|
event.stopPropagation();
|
|
13322
13341
|
setSelectedValue(void 0);
|
|
@@ -13405,7 +13424,7 @@ var ComboboxInner = ({
|
|
|
13405
13424
|
)
|
|
13406
13425
|
] });
|
|
13407
13426
|
};
|
|
13408
|
-
var Combobox =
|
|
13427
|
+
var Combobox = React28__namespace.forwardRef(ComboboxInner);
|
|
13409
13428
|
var Combobox_default = Combobox;
|
|
13410
13429
|
var TruncatedMouseEnterDiv = ({
|
|
13411
13430
|
value,
|
|
@@ -13414,8 +13433,8 @@ var TruncatedMouseEnterDiv = ({
|
|
|
13414
13433
|
tooltipContentProps,
|
|
13415
13434
|
arrowClassName
|
|
13416
13435
|
}) => {
|
|
13417
|
-
const textRef =
|
|
13418
|
-
const [isTruncated, setIsTruncated] =
|
|
13436
|
+
const textRef = React28.useRef(null);
|
|
13437
|
+
const [isTruncated, setIsTruncated] = React28.useState(false);
|
|
13419
13438
|
const checkTruncation = () => {
|
|
13420
13439
|
if (textRef.current) {
|
|
13421
13440
|
const { scrollWidth, clientWidth } = textRef.current;
|
|
@@ -13475,8 +13494,8 @@ var TabSelect = ({
|
|
|
13475
13494
|
separatorClassName,
|
|
13476
13495
|
...rest
|
|
13477
13496
|
}) => {
|
|
13478
|
-
const [selected, setSelected] =
|
|
13479
|
-
|
|
13497
|
+
const [selected, setSelected] = React28.useState(items[0]);
|
|
13498
|
+
React28.useEffect(() => {
|
|
13480
13499
|
onSelectTab(selected.id);
|
|
13481
13500
|
}, [onSelectTab, selected]);
|
|
13482
13501
|
if (items.length === 0) {
|