@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.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as React28 from 'react';
|
|
2
|
+
import React28__default, { forwardRef, useRef, useMemo, useCallback, useState, isValidElement, useEffect, useLayoutEffect, createElement } from 'react';
|
|
3
3
|
import { useRouter } from '@tanstack/react-router';
|
|
4
4
|
import { create } from 'zustand';
|
|
5
5
|
import clsx2, { clsx } from 'clsx';
|
|
@@ -2823,7 +2823,7 @@ var OPERATOR_LABEL = {
|
|
|
2823
2823
|
containsAll: "Contains all of"
|
|
2824
2824
|
};
|
|
2825
2825
|
var OperatorSelect = ({ row, operators, onChangeOperator, error }) => {
|
|
2826
|
-
|
|
2826
|
+
React28__default.useEffect(() => {
|
|
2827
2827
|
if (!operators.length) return;
|
|
2828
2828
|
if (!operators.includes(row.operator)) {
|
|
2829
2829
|
onChangeOperator(operators[0]);
|
|
@@ -2859,15 +2859,15 @@ function Label2({ className, ...props }) {
|
|
|
2859
2859
|
);
|
|
2860
2860
|
}
|
|
2861
2861
|
var Form = FormProvider;
|
|
2862
|
-
var FormFieldContext =
|
|
2862
|
+
var FormFieldContext = React28.createContext({});
|
|
2863
2863
|
var FormField = ({
|
|
2864
2864
|
...props
|
|
2865
2865
|
}) => {
|
|
2866
2866
|
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
2867
2867
|
};
|
|
2868
2868
|
var useFormField = () => {
|
|
2869
|
-
const fieldContext =
|
|
2870
|
-
const itemContext =
|
|
2869
|
+
const fieldContext = React28.useContext(FormFieldContext);
|
|
2870
|
+
const itemContext = React28.useContext(FormItemContext);
|
|
2871
2871
|
const { getFieldState } = useFormContext();
|
|
2872
2872
|
const formState = useFormState({ name: fieldContext.name });
|
|
2873
2873
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -2884,9 +2884,9 @@ var useFormField = () => {
|
|
|
2884
2884
|
...fieldState
|
|
2885
2885
|
};
|
|
2886
2886
|
};
|
|
2887
|
-
var FormItemContext =
|
|
2887
|
+
var FormItemContext = React28.createContext({});
|
|
2888
2888
|
function FormItem({ className, ...props }) {
|
|
2889
|
-
const id =
|
|
2889
|
+
const id = React28.useId();
|
|
2890
2890
|
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
|
|
2891
2891
|
}
|
|
2892
2892
|
function FormLabel({ className, ...props }) {
|
|
@@ -2990,7 +2990,7 @@ var Spinner = ({ className, variant, size = "default", ...props }) => /* @__PURE
|
|
|
2990
2990
|
]
|
|
2991
2991
|
}
|
|
2992
2992
|
);
|
|
2993
|
-
var InputPrimitive =
|
|
2993
|
+
var InputPrimitive = React28.forwardRef(
|
|
2994
2994
|
({ className, type = "text", ...props }, ref) => {
|
|
2995
2995
|
return /* @__PURE__ */ jsx(
|
|
2996
2996
|
"input",
|
|
@@ -3029,7 +3029,7 @@ var inputVariants = cva("", {
|
|
|
3029
3029
|
appearance: "filled"
|
|
3030
3030
|
}
|
|
3031
3031
|
});
|
|
3032
|
-
var Input =
|
|
3032
|
+
var Input = React28.forwardRef(
|
|
3033
3033
|
({
|
|
3034
3034
|
className,
|
|
3035
3035
|
wrapperClassName,
|
|
@@ -3062,8 +3062,8 @@ var Input = React27.forwardRef(
|
|
|
3062
3062
|
onChange: onChangeProp
|
|
3063
3063
|
} = rest;
|
|
3064
3064
|
const ariaInvalid = invalid ?? ariaInvalidProp;
|
|
3065
|
-
const messageId =
|
|
3066
|
-
const handleChange =
|
|
3065
|
+
const messageId = React28.useId();
|
|
3066
|
+
const handleChange = React28.useCallback(
|
|
3067
3067
|
(event) => {
|
|
3068
3068
|
onChangeProp?.(event);
|
|
3069
3069
|
onValueChange?.(event.target.value);
|
|
@@ -3451,20 +3451,20 @@ function DatePicker({
|
|
|
3451
3451
|
className,
|
|
3452
3452
|
...props
|
|
3453
3453
|
}) {
|
|
3454
|
-
const today =
|
|
3455
|
-
const [displayed, setDisplayed] =
|
|
3454
|
+
const today = React28.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
3455
|
+
const [displayed, setDisplayed] = React28.useState(
|
|
3456
3456
|
selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
|
|
3457
3457
|
);
|
|
3458
3458
|
minDate = clampToDay(minDate);
|
|
3459
3459
|
maxDate = clampToDay(maxDate);
|
|
3460
|
-
const disabledSet =
|
|
3460
|
+
const disabledSet = React28.useMemo(() => {
|
|
3461
3461
|
const s = /* @__PURE__ */ new Set();
|
|
3462
3462
|
disabledDates?.forEach((d) => s.add(startOfDay(d).toISOString()));
|
|
3463
3463
|
return s;
|
|
3464
3464
|
}, [disabledDates]);
|
|
3465
3465
|
const displayYear = displayed.getFullYear();
|
|
3466
3466
|
const displayMonth = displayed.getMonth();
|
|
3467
|
-
const weekdays =
|
|
3467
|
+
const weekdays = React28.useMemo(() => {
|
|
3468
3468
|
const labels = [];
|
|
3469
3469
|
for (let i = 0; i < 7; i++) {
|
|
3470
3470
|
const idx = i;
|
|
@@ -3473,7 +3473,7 @@ function DatePicker({
|
|
|
3473
3473
|
}
|
|
3474
3474
|
return labels;
|
|
3475
3475
|
}, [callbacks]);
|
|
3476
|
-
const grid =
|
|
3476
|
+
const grid = React28.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
|
|
3477
3477
|
const isDateDisabled = (date) => {
|
|
3478
3478
|
const d = startOfDay(date);
|
|
3479
3479
|
if (minDate && d < minDate) return true;
|
|
@@ -3483,7 +3483,7 @@ function DatePicker({
|
|
|
3483
3483
|
};
|
|
3484
3484
|
const minYear = minDate?.getFullYear();
|
|
3485
3485
|
const maxYear = maxDate?.getFullYear();
|
|
3486
|
-
const getMonthLabel =
|
|
3486
|
+
const getMonthLabel = React28.useCallback(
|
|
3487
3487
|
(year, monthIndex) => {
|
|
3488
3488
|
const label = callbacks?.monthLabel?.(year, monthIndex);
|
|
3489
3489
|
if (label === null || label === void 0) {
|
|
@@ -3493,7 +3493,7 @@ function DatePicker({
|
|
|
3493
3493
|
},
|
|
3494
3494
|
[callbacks]
|
|
3495
3495
|
);
|
|
3496
|
-
const getYearLabel =
|
|
3496
|
+
const getYearLabel = React28.useCallback(
|
|
3497
3497
|
(year) => {
|
|
3498
3498
|
const label = callbacks?.yearLabel?.(year);
|
|
3499
3499
|
if (label === null || label === void 0) return String(year);
|
|
@@ -3501,7 +3501,7 @@ function DatePicker({
|
|
|
3501
3501
|
},
|
|
3502
3502
|
[callbacks]
|
|
3503
3503
|
);
|
|
3504
|
-
const clampMonthToBounds =
|
|
3504
|
+
const clampMonthToBounds = React28.useCallback(
|
|
3505
3505
|
(year, monthIndex) => {
|
|
3506
3506
|
let output = monthIndex;
|
|
3507
3507
|
if (typeof minYear === "number" && year === minYear && minDate) {
|
|
@@ -3516,7 +3516,7 @@ function DatePicker({
|
|
|
3516
3516
|
},
|
|
3517
3517
|
[maxDate, minDate, maxYear, minYear]
|
|
3518
3518
|
);
|
|
3519
|
-
const yearOptions =
|
|
3519
|
+
const yearOptions = React28.useMemo(() => {
|
|
3520
3520
|
const fallbackWindow = 50;
|
|
3521
3521
|
const start = typeof minYear === "number" ? minYear : displayYear - fallbackWindow;
|
|
3522
3522
|
const end = typeof maxYear === "number" ? maxYear : displayYear + fallbackWindow;
|
|
@@ -3537,7 +3537,7 @@ function DatePicker({
|
|
|
3537
3537
|
}
|
|
3538
3538
|
return years;
|
|
3539
3539
|
}, [displayYear, maxYear, minYear, selectedDate]);
|
|
3540
|
-
const monthOptions =
|
|
3540
|
+
const monthOptions = React28.useMemo(() => {
|
|
3541
3541
|
const months = Array.from({ length: 12 }, (_, monthIndex) => {
|
|
3542
3542
|
const disabled = typeof minYear === "number" && displayYear === minYear && minDate && monthIndex < minDate.getMonth() || typeof maxYear === "number" && displayYear === maxYear && maxDate && monthIndex > maxDate.getMonth();
|
|
3543
3543
|
return {
|
|
@@ -3556,7 +3556,7 @@ function DatePicker({
|
|
|
3556
3556
|
}
|
|
3557
3557
|
return months.sort((a, b) => a.value - b.value).filter((option, index, arr) => index === 0 || option.value !== arr[index - 1].value);
|
|
3558
3558
|
}, [displayMonth, displayYear, getMonthLabel, maxDate, maxYear, minDate, minYear]);
|
|
3559
|
-
const handleMonthSelect =
|
|
3559
|
+
const handleMonthSelect = React28.useCallback((nextValue) => {
|
|
3560
3560
|
const nextMonth = Number.parseInt(nextValue, 10);
|
|
3561
3561
|
if (Number.isNaN(nextMonth)) return;
|
|
3562
3562
|
setDisplayed((prev) => {
|
|
@@ -3566,7 +3566,7 @@ function DatePicker({
|
|
|
3566
3566
|
return next;
|
|
3567
3567
|
});
|
|
3568
3568
|
}, []);
|
|
3569
|
-
const handleYearSelect =
|
|
3569
|
+
const handleYearSelect = React28.useCallback(
|
|
3570
3570
|
(nextValue) => {
|
|
3571
3571
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
3572
3572
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -3714,14 +3714,14 @@ var DatePicker2 = ({
|
|
|
3714
3714
|
ariaLabel,
|
|
3715
3715
|
...calendarProps
|
|
3716
3716
|
}) => {
|
|
3717
|
-
const [open, setOpen] =
|
|
3718
|
-
const parser =
|
|
3719
|
-
const outputFormatter =
|
|
3720
|
-
const labelFormatter =
|
|
3717
|
+
const [open, setOpen] = React28__default.useState(false);
|
|
3718
|
+
const parser = React28__default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
|
|
3719
|
+
const outputFormatter = React28__default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
|
|
3720
|
+
const labelFormatter = React28__default.useMemo(
|
|
3721
3721
|
() => displayFormatter ?? defaultDisplayFormatter,
|
|
3722
3722
|
[displayFormatter]
|
|
3723
3723
|
);
|
|
3724
|
-
const parsedValue =
|
|
3724
|
+
const parsedValue = React28__default.useMemo(() => {
|
|
3725
3725
|
if (value === null || value === void 0) return void 0;
|
|
3726
3726
|
if (value instanceof Date) return value;
|
|
3727
3727
|
const parsed = parser(value);
|
|
@@ -3730,26 +3730,26 @@ var DatePicker2 = ({
|
|
|
3730
3730
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
|
|
3731
3731
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change date, current selection ${labelFormatter(parsedValue)}` : "Open date picker");
|
|
3732
3732
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
3733
|
-
const handleClose =
|
|
3734
|
-
const emitChange =
|
|
3733
|
+
const handleClose = React28__default.useCallback(() => setOpen(false), []);
|
|
3734
|
+
const emitChange = React28__default.useCallback(
|
|
3735
3735
|
(next) => {
|
|
3736
3736
|
onChange?.(next);
|
|
3737
3737
|
onValueChange?.(next ? outputFormatter(next) : void 0);
|
|
3738
3738
|
},
|
|
3739
3739
|
[onChange, onValueChange, outputFormatter]
|
|
3740
3740
|
);
|
|
3741
|
-
const handleSelect =
|
|
3741
|
+
const handleSelect = React28__default.useCallback(
|
|
3742
3742
|
(next) => {
|
|
3743
3743
|
emitChange(next);
|
|
3744
3744
|
if (closeOnSelect && next) handleClose();
|
|
3745
3745
|
},
|
|
3746
3746
|
[closeOnSelect, emitChange, handleClose]
|
|
3747
3747
|
);
|
|
3748
|
-
const handleClear =
|
|
3748
|
+
const handleClear = React28__default.useCallback(() => {
|
|
3749
3749
|
emitChange(void 0);
|
|
3750
3750
|
handleClose();
|
|
3751
3751
|
}, [emitChange, handleClose]);
|
|
3752
|
-
const handleOpenChange =
|
|
3752
|
+
const handleOpenChange = React28__default.useCallback(
|
|
3753
3753
|
(nextOpen) => {
|
|
3754
3754
|
if (disabled && nextOpen) return;
|
|
3755
3755
|
setOpen(nextOpen);
|
|
@@ -3813,6 +3813,7 @@ var DatePicker2 = ({
|
|
|
3813
3813
|
|
|
3814
3814
|
// src/components/advanceSearch/components/constants/index.ts
|
|
3815
3815
|
var fallbackShortDateFormat = "DD/MM/YYYY";
|
|
3816
|
+
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;
|
|
3816
3817
|
var ConditionDateInput = ({
|
|
3817
3818
|
row,
|
|
3818
3819
|
control,
|
|
@@ -3939,15 +3940,15 @@ function MonthCal({
|
|
|
3939
3940
|
onYearBackward,
|
|
3940
3941
|
onYearForward
|
|
3941
3942
|
}) {
|
|
3942
|
-
const today =
|
|
3943
|
+
const today = React28.useMemo(() => {
|
|
3943
3944
|
const now = /* @__PURE__ */ new Date();
|
|
3944
3945
|
now.setDate(1);
|
|
3945
3946
|
now.setHours(0, 0, 0, 0);
|
|
3946
3947
|
return now;
|
|
3947
3948
|
}, []);
|
|
3948
|
-
const selectedMonthDate =
|
|
3949
|
-
const min =
|
|
3950
|
-
const max =
|
|
3949
|
+
const selectedMonthDate = React28.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
|
|
3950
|
+
const min = React28.useMemo(() => normalizeMonth(minDate), [minDate]);
|
|
3951
|
+
const max = React28.useMemo(() => normalizeMonth(maxDate), [maxDate]);
|
|
3951
3952
|
let effectiveMin = min;
|
|
3952
3953
|
if (min && max && min > max) {
|
|
3953
3954
|
effectiveMin = max;
|
|
@@ -3956,10 +3957,10 @@ function MonthCal({
|
|
|
3956
3957
|
const minMonth = effectiveMin?.getMonth();
|
|
3957
3958
|
const maxYear = max?.getFullYear();
|
|
3958
3959
|
const maxMonth = max?.getMonth();
|
|
3959
|
-
const [menuYear, setMenuYear] =
|
|
3960
|
+
const [menuYear, setMenuYear] = React28.useState(
|
|
3960
3961
|
() => selectedMonthDate?.getFullYear() ?? today.getFullYear()
|
|
3961
3962
|
);
|
|
3962
|
-
|
|
3963
|
+
React28.useEffect(() => {
|
|
3963
3964
|
if (selectedMonthDate) {
|
|
3964
3965
|
const year = selectedMonthDate.getFullYear();
|
|
3965
3966
|
if (year !== menuYear) {
|
|
@@ -3967,7 +3968,7 @@ function MonthCal({
|
|
|
3967
3968
|
}
|
|
3968
3969
|
}
|
|
3969
3970
|
}, [selectedMonthDate, menuYear]);
|
|
3970
|
-
|
|
3971
|
+
React28.useEffect(() => {
|
|
3971
3972
|
if (typeof minYear === "number" && menuYear < minYear) {
|
|
3972
3973
|
setMenuYear(minYear);
|
|
3973
3974
|
return;
|
|
@@ -3978,7 +3979,7 @@ function MonthCal({
|
|
|
3978
3979
|
}, [minYear, maxYear, menuYear]);
|
|
3979
3980
|
const disablePrevYear = typeof minYear === "number" ? menuYear <= minYear : false;
|
|
3980
3981
|
const disableNextYear = typeof maxYear === "number" ? menuYear >= maxYear : false;
|
|
3981
|
-
const yearOptions =
|
|
3982
|
+
const yearOptions = React28.useMemo(() => {
|
|
3982
3983
|
const fallbackWindow = 50;
|
|
3983
3984
|
const start = typeof minYear === "number" ? minYear : menuYear - fallbackWindow;
|
|
3984
3985
|
const end = typeof maxYear === "number" ? maxYear : menuYear + fallbackWindow;
|
|
@@ -3992,7 +3993,7 @@ function MonthCal({
|
|
|
3992
3993
|
}
|
|
3993
3994
|
return years;
|
|
3994
3995
|
}, [maxYear, menuYear, minYear]);
|
|
3995
|
-
const formatYearLabel =
|
|
3996
|
+
const formatYearLabel = React28.useCallback(
|
|
3996
3997
|
(year) => {
|
|
3997
3998
|
const raw = callbacks?.yearLabel?.(year);
|
|
3998
3999
|
if (raw === null || raw === void 0) return String(year);
|
|
@@ -4000,7 +4001,7 @@ function MonthCal({
|
|
|
4000
4001
|
},
|
|
4001
4002
|
[callbacks]
|
|
4002
4003
|
);
|
|
4003
|
-
const handleYearSelect =
|
|
4004
|
+
const handleYearSelect = React28.useCallback(
|
|
4004
4005
|
(nextValue) => {
|
|
4005
4006
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
4006
4007
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -4010,7 +4011,7 @@ function MonthCal({
|
|
|
4010
4011
|
},
|
|
4011
4012
|
[maxYear, minYear]
|
|
4012
4013
|
);
|
|
4013
|
-
const disabledPairs =
|
|
4014
|
+
const disabledPairs = React28.useMemo(() => {
|
|
4014
4015
|
if (!disabledDates?.length) return [];
|
|
4015
4016
|
const pairs = [];
|
|
4016
4017
|
disabledDates.forEach((date) => {
|
|
@@ -4155,14 +4156,14 @@ var MonthPicker2 = ({
|
|
|
4155
4156
|
ariaLabel,
|
|
4156
4157
|
...calendarProps
|
|
4157
4158
|
}) => {
|
|
4158
|
-
const [open, setOpen] =
|
|
4159
|
-
const parser =
|
|
4160
|
-
const outputFormatter =
|
|
4161
|
-
const labelFormatter =
|
|
4159
|
+
const [open, setOpen] = React28__default.useState(false);
|
|
4160
|
+
const parser = React28__default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
|
|
4161
|
+
const outputFormatter = React28__default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
|
|
4162
|
+
const labelFormatter = React28__default.useMemo(
|
|
4162
4163
|
() => displayFormatter ?? defaultDisplayFormatter2,
|
|
4163
4164
|
[displayFormatter]
|
|
4164
4165
|
);
|
|
4165
|
-
const parsedValue =
|
|
4166
|
+
const parsedValue = React28__default.useMemo(() => {
|
|
4166
4167
|
if (value === null || value === void 0) return void 0;
|
|
4167
4168
|
if (value instanceof Date) return normalizeMonth2(value);
|
|
4168
4169
|
if (typeof value === "string") {
|
|
@@ -4174,8 +4175,8 @@ var MonthPicker2 = ({
|
|
|
4174
4175
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
|
|
4175
4176
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change month, current selection ${labelFormatter(parsedValue)}` : "Open month picker");
|
|
4176
4177
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
4177
|
-
const handleClose =
|
|
4178
|
-
const emitChange =
|
|
4178
|
+
const handleClose = React28__default.useCallback(() => setOpen(false), []);
|
|
4179
|
+
const emitChange = React28__default.useCallback(
|
|
4179
4180
|
(next) => {
|
|
4180
4181
|
const normalized = next ? normalizeMonth2(next) : void 0;
|
|
4181
4182
|
onChange?.(normalized);
|
|
@@ -4183,18 +4184,18 @@ var MonthPicker2 = ({
|
|
|
4183
4184
|
},
|
|
4184
4185
|
[onChange, onValueChange, outputFormatter]
|
|
4185
4186
|
);
|
|
4186
|
-
const handleSelect =
|
|
4187
|
+
const handleSelect = React28__default.useCallback(
|
|
4187
4188
|
(next) => {
|
|
4188
4189
|
emitChange(next);
|
|
4189
4190
|
if (closeOnSelect && next) handleClose();
|
|
4190
4191
|
},
|
|
4191
4192
|
[closeOnSelect, emitChange, handleClose]
|
|
4192
4193
|
);
|
|
4193
|
-
const handleClear =
|
|
4194
|
+
const handleClear = React28__default.useCallback(() => {
|
|
4194
4195
|
emitChange(void 0);
|
|
4195
4196
|
handleClose();
|
|
4196
4197
|
}, [emitChange, handleClose]);
|
|
4197
|
-
const handleOpenChange =
|
|
4198
|
+
const handleOpenChange = React28__default.useCallback(
|
|
4198
4199
|
(nextOpen) => {
|
|
4199
4200
|
if (disabled && nextOpen) return;
|
|
4200
4201
|
setOpen(nextOpen);
|
|
@@ -4302,51 +4303,70 @@ var ConditionMonthInput = ({ row, control, onClear }) => {
|
|
|
4302
4303
|
}
|
|
4303
4304
|
return renderPicker(`value_${row.id}`, "value");
|
|
4304
4305
|
};
|
|
4305
|
-
var ConditionDropdownInput = ({ row, control, fieldSchema, onClear }) =>
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4306
|
+
var ConditionDropdownInput = ({ row, control, fieldSchema, onClear }) => {
|
|
4307
|
+
const [options, setOptions] = useState([]);
|
|
4308
|
+
const [loading, setIsLoading] = useState(false);
|
|
4309
|
+
useEffect(() => {
|
|
4310
|
+
if (!fieldSchema) {
|
|
4311
|
+
return;
|
|
4312
|
+
}
|
|
4313
|
+
if (fieldSchema.fetchOptions) {
|
|
4314
|
+
setIsLoading(true);
|
|
4315
|
+
fieldSchema.fetchOptions().then((fetchedOptions) => {
|
|
4316
|
+
setOptions(fetchedOptions);
|
|
4317
|
+
}).catch((err) => {
|
|
4318
|
+
console.error("Failed to fetch lookup options", err);
|
|
4319
|
+
}).finally(() => setIsLoading(false));
|
|
4320
|
+
} else {
|
|
4321
|
+
setOptions(fieldSchema.options);
|
|
4322
|
+
}
|
|
4323
|
+
}, [fieldSchema]);
|
|
4324
|
+
return /* @__PURE__ */ jsx(
|
|
4325
|
+
FormField,
|
|
4326
|
+
{
|
|
4327
|
+
control,
|
|
4328
|
+
name: `value_${row.id}`,
|
|
4329
|
+
rules: { required: "This field is required." },
|
|
4330
|
+
render: ({ field }) => {
|
|
4331
|
+
const handleClear = () => {
|
|
4332
|
+
field.onChange("");
|
|
4333
|
+
onClear("value");
|
|
4334
|
+
};
|
|
4335
|
+
const hasValue = Boolean(field.value);
|
|
4336
|
+
const clearLabel = "Clear selected value";
|
|
4337
|
+
return /* @__PURE__ */ jsxs(FormItem, { className: "relative", children: [
|
|
4338
|
+
/* @__PURE__ */ jsxs(Select, { value: field.value ?? "", onValueChange: field.onChange, children: [
|
|
4339
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
|
|
4340
|
+
SelectTrigger,
|
|
4341
|
+
{
|
|
4342
|
+
className: cn(
|
|
4343
|
+
"w-full justify-between rounded-md bg-white px-4 text-sm font-medium text-gray-700 shadow-none focus:ring-0",
|
|
4344
|
+
hasValue ? "pr-8" : "pr-4"
|
|
4345
|
+
),
|
|
4346
|
+
"data-testid": "advsearch-dropdown-value",
|
|
4347
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select value" })
|
|
4348
|
+
}
|
|
4349
|
+
) }),
|
|
4350
|
+
/* @__PURE__ */ jsx(SelectContent, { className: "w-full min-w-[unset]", children: loading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center", children: /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-sm text-inherit", children: fieldSchema?.loadingMessage ?? "Loading..." }) }) : options.length === 0 ? /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center", children: /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-sm text-inherit", children: fieldSchema?.noOptionsMessage ?? "No records found." }) }) : options.map((opt) => /* @__PURE__ */ jsxs(SelectItem, { value: opt.value, className: cn(opt.labelStyle), children: [
|
|
4351
|
+
opt.decorator,
|
|
4352
|
+
opt.label
|
|
4353
|
+
] }, opt.value)) })
|
|
4354
|
+
] }),
|
|
4355
|
+
hasValue && /* @__PURE__ */ jsx(
|
|
4356
|
+
ClearButton,
|
|
4322
4357
|
{
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
"data-testid": "advsearch-dropdown-value",
|
|
4328
|
-
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select value" })
|
|
4358
|
+
onClick: handleClear,
|
|
4359
|
+
ariaLabel: clearLabel,
|
|
4360
|
+
title: clearLabel,
|
|
4361
|
+
className: "absolute right-3 top-1/2 z-10 -translate-y-1/2"
|
|
4329
4362
|
}
|
|
4330
|
-
)
|
|
4331
|
-
/* @__PURE__ */ jsx(
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
] }, opt.value)) })
|
|
4335
|
-
] }),
|
|
4336
|
-
hasValue && /* @__PURE__ */ jsx(
|
|
4337
|
-
ClearButton,
|
|
4338
|
-
{
|
|
4339
|
-
onClick: handleClear,
|
|
4340
|
-
ariaLabel: clearLabel,
|
|
4341
|
-
title: clearLabel,
|
|
4342
|
-
className: "absolute right-3 top-1/2 z-10 -translate-y-1/2"
|
|
4343
|
-
}
|
|
4344
|
-
),
|
|
4345
|
-
/* @__PURE__ */ jsx(FormMessage, { className: "absolute left-0 top-full mt-1 text-xs text-red-600" })
|
|
4346
|
-
] });
|
|
4363
|
+
),
|
|
4364
|
+
/* @__PURE__ */ jsx(FormMessage, { className: "absolute left-0 top-full mt-1 text-xs text-red-600" })
|
|
4365
|
+
] });
|
|
4366
|
+
}
|
|
4347
4367
|
}
|
|
4348
|
-
|
|
4349
|
-
|
|
4368
|
+
);
|
|
4369
|
+
};
|
|
4350
4370
|
var ConditionCheckboxInput = ({ row, control, onClear }) => /* @__PURE__ */ jsx(
|
|
4351
4371
|
FormField,
|
|
4352
4372
|
{
|
|
@@ -5304,13 +5324,12 @@ var TextBuilder = class {
|
|
|
5304
5324
|
};
|
|
5305
5325
|
|
|
5306
5326
|
// src/components/advanceSearch/builder/uuid.ts
|
|
5307
|
-
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;
|
|
5308
5327
|
var UUIDBuilder = class {
|
|
5309
5328
|
build(row) {
|
|
5310
5329
|
if (Array.isArray(row.value)) {
|
|
5311
5330
|
return {};
|
|
5312
5331
|
}
|
|
5313
|
-
if (!
|
|
5332
|
+
if (!UUIDregex.test(row.value)) {
|
|
5314
5333
|
return { [row.fieldName]: {} };
|
|
5315
5334
|
}
|
|
5316
5335
|
const sharedOptions = {
|
|
@@ -5414,7 +5433,7 @@ var sanitizeInput = (val) => {
|
|
|
5414
5433
|
if (/\p{Cc}/u.test(val)) return "__INVALID_CONTROL_CHAR__";
|
|
5415
5434
|
return trimmed.replace(/\s+/g, " ");
|
|
5416
5435
|
};
|
|
5417
|
-
var numericTypes = ["number"
|
|
5436
|
+
var numericTypes = ["number"];
|
|
5418
5437
|
var dateTypes = ["date", "datemonth"];
|
|
5419
5438
|
var validateByFieldType = (value, fieldType) => {
|
|
5420
5439
|
if (!value) return { valid: true };
|
|
@@ -5426,9 +5445,9 @@ var validateByFieldType = (value, fieldType) => {
|
|
|
5426
5445
|
return { valid: false, message: "Please enter a valid number." };
|
|
5427
5446
|
}
|
|
5428
5447
|
}
|
|
5429
|
-
if (fieldType === "
|
|
5430
|
-
if (!
|
|
5431
|
-
return { valid: false, message: "Please enter a
|
|
5448
|
+
if (fieldType === "uuid") {
|
|
5449
|
+
if (!UUIDregex.test(value)) {
|
|
5450
|
+
return { valid: false, message: "Please enter a valid UUID." };
|
|
5432
5451
|
}
|
|
5433
5452
|
}
|
|
5434
5453
|
if (dateTypes.includes(fieldType)) {
|
|
@@ -5471,7 +5490,7 @@ var AdvanceSearch = ({
|
|
|
5471
5490
|
defaultValues: {}
|
|
5472
5491
|
});
|
|
5473
5492
|
const { handleSubmit, unregister, resetField, getValues, clearErrors, setError } = form;
|
|
5474
|
-
const [operatorErrors, setOperatorErrors] =
|
|
5493
|
+
const [operatorErrors, setOperatorErrors] = React28__default.useState({});
|
|
5475
5494
|
const clearOperatorError = useCallback(
|
|
5476
5495
|
(rowId) => {
|
|
5477
5496
|
setOperatorErrors((prev) => {
|
|
@@ -5908,14 +5927,14 @@ var useControllableState = ({
|
|
|
5908
5927
|
value
|
|
5909
5928
|
}) => {
|
|
5910
5929
|
const isControlled = typeof value !== "undefined";
|
|
5911
|
-
const [internalValue, setInternalValue] =
|
|
5930
|
+
const [internalValue, setInternalValue] = React28.useState(() => {
|
|
5912
5931
|
return isControlled ? value : defaultValue;
|
|
5913
5932
|
});
|
|
5914
|
-
|
|
5933
|
+
React28.useEffect(() => {
|
|
5915
5934
|
if (!isControlled) return;
|
|
5916
5935
|
setInternalValue(value);
|
|
5917
5936
|
}, [isControlled, value]);
|
|
5918
|
-
const setValue =
|
|
5937
|
+
const setValue = React28.useCallback(
|
|
5919
5938
|
(nextValue) => {
|
|
5920
5939
|
if (isControlled) return;
|
|
5921
5940
|
setInternalValue(nextValue);
|
|
@@ -5931,7 +5950,7 @@ var useControllableState = ({
|
|
|
5931
5950
|
var useControllableState_default = useControllableState;
|
|
5932
5951
|
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
5933
5952
|
var useBindRef = ({ ref, value }) => {
|
|
5934
|
-
|
|
5953
|
+
React28.useEffect(() => {
|
|
5935
5954
|
if (!ref) return;
|
|
5936
5955
|
ref.current = value;
|
|
5937
5956
|
return () => {
|
|
@@ -6124,7 +6143,7 @@ var StatusContentSlot = ({
|
|
|
6124
6143
|
content
|
|
6125
6144
|
] });
|
|
6126
6145
|
};
|
|
6127
|
-
var StatusContentSlot_default =
|
|
6146
|
+
var StatusContentSlot_default = React28__default.memo(StatusContentSlot);
|
|
6128
6147
|
var stateOptions = [
|
|
6129
6148
|
"columnFilters",
|
|
6130
6149
|
"globalFilter",
|
|
@@ -6556,7 +6575,7 @@ var ColumnSeparator = ({ show, className, ...props }) => {
|
|
|
6556
6575
|
}
|
|
6557
6576
|
);
|
|
6558
6577
|
};
|
|
6559
|
-
var ColumnSeparator_default =
|
|
6578
|
+
var ColumnSeparator_default = React28__default.memo(ColumnSeparator);
|
|
6560
6579
|
|
|
6561
6580
|
// src/components/data-table/helpers.ts
|
|
6562
6581
|
function getColumnPinningInfo(column) {
|
|
@@ -7872,8 +7891,8 @@ var DISALLOWED_MARKS = ["bold", "italic", "link"];
|
|
|
7872
7891
|
var SUGGESTION_DEBOUNCE = 200;
|
|
7873
7892
|
var DEFAULT_CHIP_CLASS = "outline-1 outline-muted bg-muted/40 text-foreground";
|
|
7874
7893
|
var TokenView = ({ node, editor, getPos }) => {
|
|
7875
|
-
const [isFocused, setIsFocused] =
|
|
7876
|
-
|
|
7894
|
+
const [isFocused, setIsFocused] = React28__default.useState(false);
|
|
7895
|
+
React28__default.useEffect(() => {
|
|
7877
7896
|
const handler = () => {
|
|
7878
7897
|
const { from, to } = editor.state.selection;
|
|
7879
7898
|
const position = getPos();
|
|
@@ -9065,7 +9084,7 @@ function ToolbarPlugin({
|
|
|
9065
9084
|
isLink: hasLink
|
|
9066
9085
|
}));
|
|
9067
9086
|
}, []);
|
|
9068
|
-
|
|
9087
|
+
React28.useEffect(() => {
|
|
9069
9088
|
return mergeRegister(
|
|
9070
9089
|
editor.registerCommand(
|
|
9071
9090
|
CAN_UNDO_COMMAND,
|
|
@@ -9651,7 +9670,7 @@ function ControlledValuePlugin({
|
|
|
9651
9670
|
trackAppliedValue
|
|
9652
9671
|
}) {
|
|
9653
9672
|
const [editor] = useLexicalComposerContext();
|
|
9654
|
-
|
|
9673
|
+
React28.useEffect(() => {
|
|
9655
9674
|
if (value == null || trackAppliedValue.current === value) {
|
|
9656
9675
|
return;
|
|
9657
9676
|
}
|
|
@@ -9675,14 +9694,14 @@ function ControlledValuePlugin({
|
|
|
9675
9694
|
}
|
|
9676
9695
|
function EditableStatePlugin({ editable }) {
|
|
9677
9696
|
const [editor] = useLexicalComposerContext();
|
|
9678
|
-
|
|
9697
|
+
React28.useEffect(() => {
|
|
9679
9698
|
editor.setEditable(editable);
|
|
9680
9699
|
}, [editor, editable]);
|
|
9681
9700
|
return null;
|
|
9682
9701
|
}
|
|
9683
9702
|
function ImagesPlugin() {
|
|
9684
9703
|
const [editor] = useLexicalComposerContext();
|
|
9685
|
-
|
|
9704
|
+
React28.useEffect(() => {
|
|
9686
9705
|
return editor.registerCommand(
|
|
9687
9706
|
INSERT_IMAGE_COMMAND,
|
|
9688
9707
|
(payload) => {
|
|
@@ -9963,9 +9982,9 @@ var SIDEBAR_WIDTH = "16rem";
|
|
|
9963
9982
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
9964
9983
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
9965
9984
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
9966
|
-
var SidebarContext =
|
|
9985
|
+
var SidebarContext = React28.createContext(null);
|
|
9967
9986
|
function useSidebar() {
|
|
9968
|
-
const context =
|
|
9987
|
+
const context = React28.useContext(SidebarContext);
|
|
9969
9988
|
if (!context) {
|
|
9970
9989
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
9971
9990
|
}
|
|
@@ -9981,10 +10000,10 @@ function SidebarProvider({
|
|
|
9981
10000
|
...props
|
|
9982
10001
|
}) {
|
|
9983
10002
|
const isMobile = useIsMobile();
|
|
9984
|
-
const [openMobile, setOpenMobile] =
|
|
9985
|
-
const [_open, _setOpen] =
|
|
10003
|
+
const [openMobile, setOpenMobile] = React28.useState(false);
|
|
10004
|
+
const [_open, _setOpen] = React28.useState(defaultOpen);
|
|
9986
10005
|
const open = openProp ?? _open;
|
|
9987
|
-
const setOpen =
|
|
10006
|
+
const setOpen = React28.useCallback(
|
|
9988
10007
|
(value) => {
|
|
9989
10008
|
const openState = typeof value === "function" ? value(open) : value;
|
|
9990
10009
|
if (setOpenProp) {
|
|
@@ -9996,10 +10015,10 @@ function SidebarProvider({
|
|
|
9996
10015
|
},
|
|
9997
10016
|
[setOpenProp, open]
|
|
9998
10017
|
);
|
|
9999
|
-
const toggleSidebar =
|
|
10018
|
+
const toggleSidebar = React28.useCallback(() => {
|
|
10000
10019
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
10001
10020
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
10002
|
-
|
|
10021
|
+
React28.useEffect(() => {
|
|
10003
10022
|
const handleKeyDown = (event) => {
|
|
10004
10023
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
10005
10024
|
event.preventDefault();
|
|
@@ -10010,7 +10029,7 @@ function SidebarProvider({
|
|
|
10010
10029
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
10011
10030
|
}, [toggleSidebar]);
|
|
10012
10031
|
const state = open ? "expanded" : "collapsed";
|
|
10013
|
-
const contextValue =
|
|
10032
|
+
const contextValue = React28.useMemo(
|
|
10014
10033
|
() => ({
|
|
10015
10034
|
state,
|
|
10016
10035
|
open,
|
|
@@ -10452,7 +10471,7 @@ function SidebarMenuSkeleton({
|
|
|
10452
10471
|
showIcon = false,
|
|
10453
10472
|
...props
|
|
10454
10473
|
}) {
|
|
10455
|
-
const width =
|
|
10474
|
+
const width = React28.useMemo(() => {
|
|
10456
10475
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
10457
10476
|
}, []);
|
|
10458
10477
|
return /* @__PURE__ */ jsxs(
|
|
@@ -10922,7 +10941,7 @@ function SortableRow({
|
|
|
10922
10941
|
id: value,
|
|
10923
10942
|
disabled: name === "columns.0.id"
|
|
10924
10943
|
});
|
|
10925
|
-
const style =
|
|
10944
|
+
const style = React28.useMemo(
|
|
10926
10945
|
() => ({
|
|
10927
10946
|
transform: CSS.Transform.toString(transform),
|
|
10928
10947
|
transition
|
|
@@ -11324,7 +11343,7 @@ function getCandidateWidths({
|
|
|
11324
11343
|
}
|
|
11325
11344
|
return DEVICE_SIZES;
|
|
11326
11345
|
}
|
|
11327
|
-
var Image2 =
|
|
11346
|
+
var Image2 = React28.forwardRef(function Image3({
|
|
11328
11347
|
src,
|
|
11329
11348
|
alt,
|
|
11330
11349
|
width,
|
|
@@ -11354,34 +11373,34 @@ var Image2 = React27.forwardRef(function Image3({
|
|
|
11354
11373
|
} = imgProps;
|
|
11355
11374
|
const widthNumber = toNumber(width);
|
|
11356
11375
|
const heightNumber = toNumber(height);
|
|
11357
|
-
|
|
11376
|
+
React28.useEffect(() => {
|
|
11358
11377
|
if (!fill && (!widthNumber || !heightNumber)) {
|
|
11359
11378
|
console.warn(
|
|
11360
11379
|
"[Image] When `fill` is false you should provide both `width` and `height` to prevent layout shifts."
|
|
11361
11380
|
);
|
|
11362
11381
|
}
|
|
11363
11382
|
}, [fill, heightNumber, widthNumber]);
|
|
11364
|
-
const candidateWidths =
|
|
11383
|
+
const candidateWidths = React28.useMemo(
|
|
11365
11384
|
() => getCandidateWidths({ width: widthNumber, sizes, fill }),
|
|
11366
11385
|
[fill, sizes, widthNumber]
|
|
11367
11386
|
);
|
|
11368
11387
|
const largestWidth = candidateWidths[candidateWidths.length - 1] ?? widthNumber ?? DEVICE_SIZES[DEVICE_SIZES.length - 1];
|
|
11369
|
-
const computedSrc =
|
|
11388
|
+
const computedSrc = React28.useMemo(() => {
|
|
11370
11389
|
if (unoptimized) {
|
|
11371
11390
|
return src;
|
|
11372
11391
|
}
|
|
11373
11392
|
return loader({ src, width: largestWidth, quality });
|
|
11374
11393
|
}, [largestWidth, loader, quality, src, unoptimized]);
|
|
11375
|
-
const computedSrcSet =
|
|
11394
|
+
const computedSrcSet = React28.useMemo(() => {
|
|
11376
11395
|
if (unoptimized) {
|
|
11377
11396
|
return void 0;
|
|
11378
11397
|
}
|
|
11379
11398
|
return candidateWidths.map((currentWidth) => `${loader({ src, width: currentWidth, quality })} ${currentWidth}w`).join(", ");
|
|
11380
11399
|
}, [candidateWidths, loader, quality, src, unoptimized]);
|
|
11381
11400
|
const sizesValue = sizes ?? (fill ? "100vw" : widthNumber ? `${widthNumber}px` : void 0);
|
|
11382
|
-
const [isLoaded, setIsLoaded] =
|
|
11383
|
-
const internalRef =
|
|
11384
|
-
const setRefs =
|
|
11401
|
+
const [isLoaded, setIsLoaded] = React28.useState(false);
|
|
11402
|
+
const internalRef = React28.useRef(null);
|
|
11403
|
+
const setRefs = React28.useCallback(
|
|
11385
11404
|
(node) => {
|
|
11386
11405
|
internalRef.current = node;
|
|
11387
11406
|
if (!ref) {
|
|
@@ -11395,7 +11414,7 @@ var Image2 = React27.forwardRef(function Image3({
|
|
|
11395
11414
|
},
|
|
11396
11415
|
[ref]
|
|
11397
11416
|
);
|
|
11398
|
-
|
|
11417
|
+
React28.useEffect(() => {
|
|
11399
11418
|
const image = internalRef.current;
|
|
11400
11419
|
if (!image) {
|
|
11401
11420
|
return;
|
|
@@ -11407,7 +11426,7 @@ var Image2 = React27.forwardRef(function Image3({
|
|
|
11407
11426
|
setIsLoaded(false);
|
|
11408
11427
|
}
|
|
11409
11428
|
}, [onLoadingComplete, src]);
|
|
11410
|
-
const handleLoad =
|
|
11429
|
+
const handleLoad = React28.useCallback(
|
|
11411
11430
|
(event) => {
|
|
11412
11431
|
setIsLoaded(true);
|
|
11413
11432
|
onLoadProp?.(event);
|
|
@@ -11419,7 +11438,7 @@ var Image2 = React27.forwardRef(function Image3({
|
|
|
11419
11438
|
const fetchPriority = priority ? "high" : fetchPriorityProp;
|
|
11420
11439
|
const decoding = decodingProp ?? "async";
|
|
11421
11440
|
const resolvedObjectFit = objectFit ?? (fill ? "cover" : void 0);
|
|
11422
|
-
const wrapperStyle =
|
|
11441
|
+
const wrapperStyle = React28.useMemo(
|
|
11423
11442
|
() => ({
|
|
11424
11443
|
position: "relative",
|
|
11425
11444
|
display: fill ? "block" : "inline-block",
|
|
@@ -11429,7 +11448,7 @@ var Image2 = React27.forwardRef(function Image3({
|
|
|
11429
11448
|
}),
|
|
11430
11449
|
[fill, height, width]
|
|
11431
11450
|
);
|
|
11432
|
-
const imageStyle =
|
|
11451
|
+
const imageStyle = React28.useMemo(
|
|
11433
11452
|
() => ({
|
|
11434
11453
|
width: fill ? "100%" : formatDimension(width) ?? void 0,
|
|
11435
11454
|
height: fill ? "100%" : formatDimension(height) ?? void 0,
|
|
@@ -11578,7 +11597,7 @@ var InfoIcon = ({ size = "1em", className, ...props }) => {
|
|
|
11578
11597
|
}
|
|
11579
11598
|
);
|
|
11580
11599
|
};
|
|
11581
|
-
var InfoIcon_default =
|
|
11600
|
+
var InfoIcon_default = React28__default.memo(InfoIcon);
|
|
11582
11601
|
var Navbar = ({
|
|
11583
11602
|
className,
|
|
11584
11603
|
title,
|
|
@@ -11710,7 +11729,7 @@ var Navbar = ({
|
|
|
11710
11729
|
}
|
|
11711
11730
|
);
|
|
11712
11731
|
};
|
|
11713
|
-
var navbar_default =
|
|
11732
|
+
var navbar_default = React28__default.memo(Navbar);
|
|
11714
11733
|
var usePreventPageLeaveStore = create((set) => ({
|
|
11715
11734
|
isPreventing: false,
|
|
11716
11735
|
setPreventing: (value) => set({ isPreventing: value })
|
|
@@ -11750,7 +11769,7 @@ var DefaultHeader = ({
|
|
|
11750
11769
|
classNames,
|
|
11751
11770
|
rightActions
|
|
11752
11771
|
}) => {
|
|
11753
|
-
const titleRef =
|
|
11772
|
+
const titleRef = React28.useRef(null);
|
|
11754
11773
|
const isTruncated = useTruncated_default({ elementRef: titleRef });
|
|
11755
11774
|
const textElement = title ? /* @__PURE__ */ jsx(
|
|
11756
11775
|
"span",
|
|
@@ -12089,7 +12108,7 @@ function isFragment(object) {
|
|
|
12089
12108
|
var isValidText = (val) => ["string", "number"].includes(typeof val);
|
|
12090
12109
|
function toArray(children, option = {}) {
|
|
12091
12110
|
let ret = [];
|
|
12092
|
-
|
|
12111
|
+
React28.Children.forEach(children, (child) => {
|
|
12093
12112
|
if ((child === void 0 || child === null) && !option.keepEmpty) {
|
|
12094
12113
|
return;
|
|
12095
12114
|
}
|
|
@@ -12103,9 +12122,9 @@ function toArray(children, option = {}) {
|
|
|
12103
12122
|
});
|
|
12104
12123
|
return ret;
|
|
12105
12124
|
}
|
|
12106
|
-
var MeasureText =
|
|
12107
|
-
const spanRef =
|
|
12108
|
-
|
|
12125
|
+
var MeasureText = React28.forwardRef(({ style, children }, ref) => {
|
|
12126
|
+
const spanRef = React28.useRef(null);
|
|
12127
|
+
React28.useImperativeHandle(ref, () => ({
|
|
12109
12128
|
isExceed: () => {
|
|
12110
12129
|
const span = spanRef.current;
|
|
12111
12130
|
return span.scrollHeight > span.clientHeight;
|
|
@@ -12163,19 +12182,19 @@ var lineClipStyle = {
|
|
|
12163
12182
|
};
|
|
12164
12183
|
function EllipsisMeasure(props) {
|
|
12165
12184
|
const { enableMeasure, width, text, children, rows, expanded, miscDeps, onEllipsis } = props;
|
|
12166
|
-
const nodeList =
|
|
12167
|
-
const nodeLen =
|
|
12168
|
-
const fullContent =
|
|
12169
|
-
const [ellipsisCutIndex, setEllipsisCutIndex] =
|
|
12170
|
-
const cutMidRef =
|
|
12171
|
-
const measureWhiteSpaceRef =
|
|
12172
|
-
const needEllipsisRef =
|
|
12173
|
-
const descRowsEllipsisRef =
|
|
12174
|
-
const symbolRowEllipsisRef =
|
|
12175
|
-
const [canEllipsis, setCanEllipsis] =
|
|
12176
|
-
const [needEllipsis, setNeedEllipsis] =
|
|
12177
|
-
const [ellipsisHeight, setEllipsisHeight] =
|
|
12178
|
-
const [parentWhiteSpace, setParentWhiteSpace] =
|
|
12185
|
+
const nodeList = React28.useMemo(() => toArray(text), [text]);
|
|
12186
|
+
const nodeLen = React28.useMemo(() => getNodesLen(nodeList), [text]);
|
|
12187
|
+
const fullContent = React28.useMemo(() => children(nodeList, false), [text]);
|
|
12188
|
+
const [ellipsisCutIndex, setEllipsisCutIndex] = React28.useState(null);
|
|
12189
|
+
const cutMidRef = React28.useRef(null);
|
|
12190
|
+
const measureWhiteSpaceRef = React28.useRef(null);
|
|
12191
|
+
const needEllipsisRef = React28.useRef(null);
|
|
12192
|
+
const descRowsEllipsisRef = React28.useRef(null);
|
|
12193
|
+
const symbolRowEllipsisRef = React28.useRef(null);
|
|
12194
|
+
const [canEllipsis, setCanEllipsis] = React28.useState(false);
|
|
12195
|
+
const [needEllipsis, setNeedEllipsis] = React28.useState(STATUS_MEASURE_NONE);
|
|
12196
|
+
const [ellipsisHeight, setEllipsisHeight] = React28.useState(0);
|
|
12197
|
+
const [parentWhiteSpace, setParentWhiteSpace] = React28.useState(null);
|
|
12179
12198
|
useIsomorphicLayoutEffect(() => {
|
|
12180
12199
|
if (enableMeasure && width && nodeLen) {
|
|
12181
12200
|
setNeedEllipsis(STATUS_MEASURE_PREPARE);
|
|
@@ -12218,7 +12237,7 @@ function EllipsisMeasure(props) {
|
|
|
12218
12237
|
setEllipsisCutIndex(isOverflow ? [minIndex, targetMidIndex] : [targetMidIndex, maxIndex]);
|
|
12219
12238
|
}
|
|
12220
12239
|
}, [ellipsisCutIndex, cutMidIndex]);
|
|
12221
|
-
const finalContent =
|
|
12240
|
+
const finalContent = React28.useMemo(() => {
|
|
12222
12241
|
if (!enableMeasure) {
|
|
12223
12242
|
return children(nodeList, false);
|
|
12224
12243
|
}
|
|
@@ -12309,10 +12328,10 @@ var Truncated = ({
|
|
|
12309
12328
|
tooltipProps,
|
|
12310
12329
|
tooltipContentProps
|
|
12311
12330
|
}) => {
|
|
12312
|
-
const elementRef =
|
|
12313
|
-
const [open, setOpen] =
|
|
12314
|
-
const [isTruncated, setIsTruncated] =
|
|
12315
|
-
const [measureWidth, setMeasureWidth] =
|
|
12331
|
+
const elementRef = React28.useRef(null);
|
|
12332
|
+
const [open, setOpen] = React28.useState(false);
|
|
12333
|
+
const [isTruncated, setIsTruncated] = React28.useState(false);
|
|
12334
|
+
const [measureWidth, setMeasureWidth] = React28.useState(0);
|
|
12316
12335
|
const Comp = as;
|
|
12317
12336
|
const normalizedChildren = typeof children === "string" ? children.replace(/>/g, ">\u200B") : children;
|
|
12318
12337
|
const lineClampLines = typeof ellipsis === "number" ? ellipsis : typeof ellipsis === "object" ? ellipsis?.lineClamp ?? 3 : null;
|
|
@@ -12337,13 +12356,13 @@ var Truncated = ({
|
|
|
12337
12356
|
setIsTruncated(false);
|
|
12338
12357
|
}
|
|
12339
12358
|
}, [enableMeasure]);
|
|
12340
|
-
const truncationClass =
|
|
12359
|
+
const truncationClass = React28.useMemo(() => {
|
|
12341
12360
|
if (!ellipsis) return "";
|
|
12342
12361
|
if (typeof ellipsis === "number") return `line-clamp-${ellipsis}`;
|
|
12343
12362
|
if (typeof ellipsis === "object") return `line-clamp-${lineClampLines ?? 3}`;
|
|
12344
12363
|
return "truncate";
|
|
12345
12364
|
}, [ellipsis, lineClampLines]);
|
|
12346
|
-
const clampedStyle =
|
|
12365
|
+
const clampedStyle = React28.useMemo(() => {
|
|
12347
12366
|
if (!lineClampLines) return style;
|
|
12348
12367
|
return {
|
|
12349
12368
|
...style,
|
|
@@ -12405,7 +12424,7 @@ var Truncated = ({
|
|
|
12405
12424
|
);
|
|
12406
12425
|
};
|
|
12407
12426
|
var truncated_default = Truncated;
|
|
12408
|
-
var InputPrimitive2 =
|
|
12427
|
+
var InputPrimitive2 = React28.forwardRef(
|
|
12409
12428
|
({ className, type = "text", ...props }, ref) => {
|
|
12410
12429
|
return /* @__PURE__ */ jsx(
|
|
12411
12430
|
"input",
|
|
@@ -12444,7 +12463,7 @@ var inputVariants2 = cva("", {
|
|
|
12444
12463
|
appearance: "filled"
|
|
12445
12464
|
}
|
|
12446
12465
|
});
|
|
12447
|
-
var Input2 =
|
|
12466
|
+
var Input2 = React28.forwardRef(
|
|
12448
12467
|
({
|
|
12449
12468
|
className,
|
|
12450
12469
|
wrapperClassName,
|
|
@@ -12477,8 +12496,8 @@ var Input2 = React27.forwardRef(
|
|
|
12477
12496
|
onChange: onChangeProp
|
|
12478
12497
|
} = rest;
|
|
12479
12498
|
const ariaInvalid = invalid ?? ariaInvalidProp;
|
|
12480
|
-
const messageId =
|
|
12481
|
-
const handleChange =
|
|
12499
|
+
const messageId = React28.useId();
|
|
12500
|
+
const handleChange = React28.useCallback(
|
|
12482
12501
|
(event) => {
|
|
12483
12502
|
onChangeProp?.(event);
|
|
12484
12503
|
onValueChange?.(event.target.value);
|
|
@@ -12593,11 +12612,11 @@ var InputNumber = ({
|
|
|
12593
12612
|
onBlur,
|
|
12594
12613
|
...props
|
|
12595
12614
|
}) => {
|
|
12596
|
-
const [internalValue, setInternalValue] =
|
|
12615
|
+
const [internalValue, setInternalValue] = React28.useState(
|
|
12597
12616
|
() => parseToNumber(value) ?? parseToNumber(defaultValue)
|
|
12598
12617
|
);
|
|
12599
|
-
const [stepperChanged, setStepperChanged] =
|
|
12600
|
-
|
|
12618
|
+
const [stepperChanged, setStepperChanged] = React28.useState(false);
|
|
12619
|
+
React28.useEffect(() => {
|
|
12601
12620
|
const parsed = parseToNumber(value);
|
|
12602
12621
|
if (parsed !== void 0) setInternalValue(parsed);
|
|
12603
12622
|
}, [value]);
|
|
@@ -12995,13 +13014,13 @@ var useFieldNames = ({
|
|
|
12995
13014
|
fieldNames
|
|
12996
13015
|
}) => {
|
|
12997
13016
|
const { label: labelFieldKey = "label", value: valueFieldKey = "value" } = fieldNames || {};
|
|
12998
|
-
const getLabelField =
|
|
13017
|
+
const getLabelField = React28__default.useCallback(
|
|
12999
13018
|
(option) => {
|
|
13000
13019
|
return option?.[labelFieldKey];
|
|
13001
13020
|
},
|
|
13002
13021
|
[labelFieldKey]
|
|
13003
13022
|
);
|
|
13004
|
-
const getValueField =
|
|
13023
|
+
const getValueField = React28__default.useCallback(
|
|
13005
13024
|
(option) => {
|
|
13006
13025
|
return option?.[valueFieldKey];
|
|
13007
13026
|
},
|
|
@@ -13033,11 +13052,11 @@ var VirtualizedCommand = ({
|
|
|
13033
13052
|
onFocus
|
|
13034
13053
|
}) => {
|
|
13035
13054
|
const { getLabelField, getValueField } = useFieldNames_default({ fieldNames });
|
|
13036
|
-
const internalOptions =
|
|
13037
|
-
const [filteredOptions, setFilteredOptions] =
|
|
13038
|
-
const [focusedIndex, setFocusedIndex] =
|
|
13039
|
-
const [isKeyboardNavActive, setIsKeyboardNavActive] =
|
|
13040
|
-
const parentRef =
|
|
13055
|
+
const internalOptions = React28.useMemo(() => options ?? [], [options]);
|
|
13056
|
+
const [filteredOptions, setFilteredOptions] = React28.useState(internalOptions);
|
|
13057
|
+
const [focusedIndex, setFocusedIndex] = React28.useState(0);
|
|
13058
|
+
const [isKeyboardNavActive, setIsKeyboardNavActive] = React28.useState(false);
|
|
13059
|
+
const parentRef = React28.useRef(null);
|
|
13041
13060
|
const virtualizer = useVirtualizer({
|
|
13042
13061
|
count: filteredOptions.length,
|
|
13043
13062
|
getScrollElement: () => parentRef.current,
|
|
@@ -13045,14 +13064,14 @@ var VirtualizedCommand = ({
|
|
|
13045
13064
|
overscan: 2
|
|
13046
13065
|
});
|
|
13047
13066
|
const virtualOptions = virtualizer.getVirtualItems();
|
|
13048
|
-
const dynamicHeight =
|
|
13067
|
+
const dynamicHeight = React28.useMemo(() => {
|
|
13049
13068
|
const contentHeight = filteredOptions.length * ROW_HEIGHT;
|
|
13050
13069
|
if (contentHeight <= 0) {
|
|
13051
13070
|
return MIN_HEIGHT_EMPTY;
|
|
13052
13071
|
}
|
|
13053
13072
|
return Math.max(ROW_HEIGHT, Math.min(height, contentHeight));
|
|
13054
13073
|
}, [filteredOptions.length, height]);
|
|
13055
|
-
const scrollToIndex =
|
|
13074
|
+
const scrollToIndex = React28.useCallback(
|
|
13056
13075
|
(index) => {
|
|
13057
13076
|
virtualizer.scrollToIndex(index, {
|
|
13058
13077
|
align: "center"
|
|
@@ -13060,7 +13079,7 @@ var VirtualizedCommand = ({
|
|
|
13060
13079
|
},
|
|
13061
13080
|
[virtualizer]
|
|
13062
13081
|
);
|
|
13063
|
-
const handleSearch =
|
|
13082
|
+
const handleSearch = React28.useCallback(
|
|
13064
13083
|
(search) => {
|
|
13065
13084
|
setIsKeyboardNavActive(false);
|
|
13066
13085
|
setFilteredOptions(
|
|
@@ -13075,7 +13094,7 @@ var VirtualizedCommand = ({
|
|
|
13075
13094
|
},
|
|
13076
13095
|
[filterOption, getLabelField, internalOptions]
|
|
13077
13096
|
);
|
|
13078
|
-
const handleKeyDown =
|
|
13097
|
+
const handleKeyDown = React28.useCallback(
|
|
13079
13098
|
(event) => {
|
|
13080
13099
|
switch (event.key) {
|
|
13081
13100
|
case "ArrowDown": {
|
|
@@ -13110,7 +13129,7 @@ var VirtualizedCommand = ({
|
|
|
13110
13129
|
},
|
|
13111
13130
|
[filteredOptions, focusedIndex, getValueField, onSelect, scrollToIndex]
|
|
13112
13131
|
);
|
|
13113
|
-
|
|
13132
|
+
React28.useEffect(() => {
|
|
13114
13133
|
if (value) {
|
|
13115
13134
|
const option = filteredOptions.find((option2) => {
|
|
13116
13135
|
const optionValue = getValueField(option2);
|
|
@@ -13237,13 +13256,13 @@ var ComboboxInner = ({
|
|
|
13237
13256
|
defaultValue,
|
|
13238
13257
|
value
|
|
13239
13258
|
});
|
|
13240
|
-
const currentSelectedOption =
|
|
13259
|
+
const currentSelectedOption = React28.useMemo(() => {
|
|
13241
13260
|
return options?.find((option) => {
|
|
13242
13261
|
const optionValue = getValueField(option);
|
|
13243
13262
|
return optionValue === selectedValue;
|
|
13244
13263
|
});
|
|
13245
13264
|
}, [getValueField, options, selectedValue]);
|
|
13246
|
-
const renderValue =
|
|
13265
|
+
const renderValue = React28.useMemo(() => {
|
|
13247
13266
|
if (!selectedValue) return placeholder2;
|
|
13248
13267
|
if (currentSelectedOption) {
|
|
13249
13268
|
return getLabelField(currentSelectedOption);
|
|
@@ -13253,7 +13272,7 @@ var ComboboxInner = ({
|
|
|
13253
13272
|
}
|
|
13254
13273
|
return null;
|
|
13255
13274
|
}, [currentSelectedOption, getLabelField, placeholder2, selectedValue, showValueWhenNoMatch]);
|
|
13256
|
-
const handleSelect =
|
|
13275
|
+
const handleSelect = React28.useCallback(
|
|
13257
13276
|
(selected, option) => {
|
|
13258
13277
|
setSelectedValue(selected);
|
|
13259
13278
|
setOpenPopover(false);
|
|
@@ -13266,7 +13285,7 @@ var ComboboxInner = ({
|
|
|
13266
13285
|
},
|
|
13267
13286
|
[onOpenChange, onSelect, setOpenPopover, setSelectedValue]
|
|
13268
13287
|
);
|
|
13269
|
-
const handleOpenPopover =
|
|
13288
|
+
const handleOpenPopover = React28.useCallback(
|
|
13270
13289
|
(isOpen) => {
|
|
13271
13290
|
if (disabled) return;
|
|
13272
13291
|
setOpenPopover(isOpen);
|
|
@@ -13276,7 +13295,7 @@ var ComboboxInner = ({
|
|
|
13276
13295
|
},
|
|
13277
13296
|
[disabled, onOpenChange, setOpenPopover]
|
|
13278
13297
|
);
|
|
13279
|
-
const handleClear =
|
|
13298
|
+
const handleClear = React28.useCallback(
|
|
13280
13299
|
(event) => {
|
|
13281
13300
|
event.stopPropagation();
|
|
13282
13301
|
setSelectedValue(void 0);
|
|
@@ -13365,7 +13384,7 @@ var ComboboxInner = ({
|
|
|
13365
13384
|
)
|
|
13366
13385
|
] });
|
|
13367
13386
|
};
|
|
13368
|
-
var Combobox =
|
|
13387
|
+
var Combobox = React28.forwardRef(ComboboxInner);
|
|
13369
13388
|
var Combobox_default = Combobox;
|
|
13370
13389
|
var TruncatedMouseEnterDiv = ({
|
|
13371
13390
|
value,
|