@sustaina/shared-ui 1.40.4 → 1.41.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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +365 -340
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +201 -176
- 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 React26 from 'react';
|
|
2
|
+
import React26__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';
|
|
@@ -2542,7 +2542,7 @@ var OPERATOR_LABEL = {
|
|
|
2542
2542
|
containsAll: "Contains all of"
|
|
2543
2543
|
};
|
|
2544
2544
|
var OperatorSelect = ({ row, operators, onChangeOperator, error }) => {
|
|
2545
|
-
|
|
2545
|
+
React26__default.useEffect(() => {
|
|
2546
2546
|
if (!operators.length) return;
|
|
2547
2547
|
if (!operators.includes(row.operator)) {
|
|
2548
2548
|
onChangeOperator(operators[0]);
|
|
@@ -2578,15 +2578,15 @@ function Label2({ className, ...props }) {
|
|
|
2578
2578
|
);
|
|
2579
2579
|
}
|
|
2580
2580
|
var Form = FormProvider;
|
|
2581
|
-
var FormFieldContext =
|
|
2581
|
+
var FormFieldContext = React26.createContext({});
|
|
2582
2582
|
var FormField = ({
|
|
2583
2583
|
...props
|
|
2584
2584
|
}) => {
|
|
2585
2585
|
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
2586
2586
|
};
|
|
2587
2587
|
var useFormField = () => {
|
|
2588
|
-
const fieldContext =
|
|
2589
|
-
const itemContext =
|
|
2588
|
+
const fieldContext = React26.useContext(FormFieldContext);
|
|
2589
|
+
const itemContext = React26.useContext(FormItemContext);
|
|
2590
2590
|
const { getFieldState } = useFormContext();
|
|
2591
2591
|
const formState = useFormState({ name: fieldContext.name });
|
|
2592
2592
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -2603,9 +2603,9 @@ var useFormField = () => {
|
|
|
2603
2603
|
...fieldState
|
|
2604
2604
|
};
|
|
2605
2605
|
};
|
|
2606
|
-
var FormItemContext =
|
|
2606
|
+
var FormItemContext = React26.createContext({});
|
|
2607
2607
|
function FormItem({ className, ...props }) {
|
|
2608
|
-
const id =
|
|
2608
|
+
const id = React26.useId();
|
|
2609
2609
|
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
|
|
2610
2610
|
}
|
|
2611
2611
|
function FormLabel({ className, ...props }) {
|
|
@@ -2709,7 +2709,7 @@ var Spinner = ({ className, variant, size = "default", ...props }) => /* @__PURE
|
|
|
2709
2709
|
]
|
|
2710
2710
|
}
|
|
2711
2711
|
);
|
|
2712
|
-
var InputPrimitive =
|
|
2712
|
+
var InputPrimitive = React26.forwardRef(
|
|
2713
2713
|
({ className, type = "text", ...props }, ref) => {
|
|
2714
2714
|
return /* @__PURE__ */ jsx(
|
|
2715
2715
|
"input",
|
|
@@ -2748,7 +2748,7 @@ var inputVariants = cva("", {
|
|
|
2748
2748
|
appearance: "filled"
|
|
2749
2749
|
}
|
|
2750
2750
|
});
|
|
2751
|
-
var Input =
|
|
2751
|
+
var Input = React26.forwardRef(
|
|
2752
2752
|
({
|
|
2753
2753
|
className,
|
|
2754
2754
|
wrapperClassName,
|
|
@@ -2781,8 +2781,8 @@ var Input = React25.forwardRef(
|
|
|
2781
2781
|
onChange: onChangeProp
|
|
2782
2782
|
} = rest;
|
|
2783
2783
|
const ariaInvalid = invalid ?? ariaInvalidProp;
|
|
2784
|
-
const messageId =
|
|
2785
|
-
const handleChange =
|
|
2784
|
+
const messageId = React26.useId();
|
|
2785
|
+
const handleChange = React26.useCallback(
|
|
2786
2786
|
(event) => {
|
|
2787
2787
|
onChangeProp?.(event);
|
|
2788
2788
|
onValueChange?.(event.target.value);
|
|
@@ -3170,20 +3170,20 @@ function DatePicker({
|
|
|
3170
3170
|
className,
|
|
3171
3171
|
...props
|
|
3172
3172
|
}) {
|
|
3173
|
-
const today =
|
|
3174
|
-
const [displayed, setDisplayed] =
|
|
3173
|
+
const today = React26.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
3174
|
+
const [displayed, setDisplayed] = React26.useState(
|
|
3175
3175
|
selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
|
|
3176
3176
|
);
|
|
3177
3177
|
minDate = clampToDay(minDate);
|
|
3178
3178
|
maxDate = clampToDay(maxDate);
|
|
3179
|
-
const disabledSet =
|
|
3179
|
+
const disabledSet = React26.useMemo(() => {
|
|
3180
3180
|
const s = /* @__PURE__ */ new Set();
|
|
3181
3181
|
disabledDates?.forEach((d) => s.add(startOfDay(d).toISOString()));
|
|
3182
3182
|
return s;
|
|
3183
3183
|
}, [disabledDates]);
|
|
3184
3184
|
const displayYear = displayed.getFullYear();
|
|
3185
3185
|
const displayMonth = displayed.getMonth();
|
|
3186
|
-
const weekdays =
|
|
3186
|
+
const weekdays = React26.useMemo(() => {
|
|
3187
3187
|
const labels = [];
|
|
3188
3188
|
for (let i = 0; i < 7; i++) {
|
|
3189
3189
|
const idx = i;
|
|
@@ -3192,7 +3192,7 @@ function DatePicker({
|
|
|
3192
3192
|
}
|
|
3193
3193
|
return labels;
|
|
3194
3194
|
}, [callbacks]);
|
|
3195
|
-
const grid =
|
|
3195
|
+
const grid = React26.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
|
|
3196
3196
|
const isDateDisabled = (date) => {
|
|
3197
3197
|
const d = startOfDay(date);
|
|
3198
3198
|
if (minDate && d < minDate) return true;
|
|
@@ -3202,7 +3202,7 @@ function DatePicker({
|
|
|
3202
3202
|
};
|
|
3203
3203
|
const minYear = minDate?.getFullYear();
|
|
3204
3204
|
const maxYear = maxDate?.getFullYear();
|
|
3205
|
-
const getMonthLabel =
|
|
3205
|
+
const getMonthLabel = React26.useCallback(
|
|
3206
3206
|
(year, monthIndex) => {
|
|
3207
3207
|
const label = callbacks?.monthLabel?.(year, monthIndex);
|
|
3208
3208
|
if (label === null || label === void 0) {
|
|
@@ -3212,7 +3212,7 @@ function DatePicker({
|
|
|
3212
3212
|
},
|
|
3213
3213
|
[callbacks]
|
|
3214
3214
|
);
|
|
3215
|
-
const getYearLabel =
|
|
3215
|
+
const getYearLabel = React26.useCallback(
|
|
3216
3216
|
(year) => {
|
|
3217
3217
|
const label = callbacks?.yearLabel?.(year);
|
|
3218
3218
|
if (label === null || label === void 0) return String(year);
|
|
@@ -3220,7 +3220,7 @@ function DatePicker({
|
|
|
3220
3220
|
},
|
|
3221
3221
|
[callbacks]
|
|
3222
3222
|
);
|
|
3223
|
-
const clampMonthToBounds =
|
|
3223
|
+
const clampMonthToBounds = React26.useCallback(
|
|
3224
3224
|
(year, monthIndex) => {
|
|
3225
3225
|
let output = monthIndex;
|
|
3226
3226
|
if (typeof minYear === "number" && year === minYear && minDate) {
|
|
@@ -3235,7 +3235,7 @@ function DatePicker({
|
|
|
3235
3235
|
},
|
|
3236
3236
|
[maxDate, minDate, maxYear, minYear]
|
|
3237
3237
|
);
|
|
3238
|
-
const yearOptions =
|
|
3238
|
+
const yearOptions = React26.useMemo(() => {
|
|
3239
3239
|
const fallbackWindow = 50;
|
|
3240
3240
|
const start = typeof minYear === "number" ? minYear : displayYear - fallbackWindow;
|
|
3241
3241
|
const end = typeof maxYear === "number" ? maxYear : displayYear + fallbackWindow;
|
|
@@ -3256,7 +3256,7 @@ function DatePicker({
|
|
|
3256
3256
|
}
|
|
3257
3257
|
return years;
|
|
3258
3258
|
}, [displayYear, maxYear, minYear, selectedDate]);
|
|
3259
|
-
const monthOptions =
|
|
3259
|
+
const monthOptions = React26.useMemo(() => {
|
|
3260
3260
|
const months = Array.from({ length: 12 }, (_, monthIndex) => {
|
|
3261
3261
|
const disabled = typeof minYear === "number" && displayYear === minYear && minDate && monthIndex < minDate.getMonth() || typeof maxYear === "number" && displayYear === maxYear && maxDate && monthIndex > maxDate.getMonth();
|
|
3262
3262
|
return {
|
|
@@ -3275,7 +3275,7 @@ function DatePicker({
|
|
|
3275
3275
|
}
|
|
3276
3276
|
return months.sort((a, b) => a.value - b.value).filter((option, index, arr) => index === 0 || option.value !== arr[index - 1].value);
|
|
3277
3277
|
}, [displayMonth, displayYear, getMonthLabel, maxDate, maxYear, minDate, minYear]);
|
|
3278
|
-
const handleMonthSelect =
|
|
3278
|
+
const handleMonthSelect = React26.useCallback((nextValue) => {
|
|
3279
3279
|
const nextMonth = Number.parseInt(nextValue, 10);
|
|
3280
3280
|
if (Number.isNaN(nextMonth)) return;
|
|
3281
3281
|
setDisplayed((prev) => {
|
|
@@ -3285,7 +3285,7 @@ function DatePicker({
|
|
|
3285
3285
|
return next;
|
|
3286
3286
|
});
|
|
3287
3287
|
}, []);
|
|
3288
|
-
const handleYearSelect =
|
|
3288
|
+
const handleYearSelect = React26.useCallback(
|
|
3289
3289
|
(nextValue) => {
|
|
3290
3290
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
3291
3291
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -3433,14 +3433,14 @@ var DatePicker2 = ({
|
|
|
3433
3433
|
ariaLabel,
|
|
3434
3434
|
...calendarProps
|
|
3435
3435
|
}) => {
|
|
3436
|
-
const [open, setOpen] =
|
|
3437
|
-
const parser =
|
|
3438
|
-
const outputFormatter =
|
|
3439
|
-
const labelFormatter =
|
|
3436
|
+
const [open, setOpen] = React26__default.useState(false);
|
|
3437
|
+
const parser = React26__default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
|
|
3438
|
+
const outputFormatter = React26__default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
|
|
3439
|
+
const labelFormatter = React26__default.useMemo(
|
|
3440
3440
|
() => displayFormatter ?? defaultDisplayFormatter,
|
|
3441
3441
|
[displayFormatter]
|
|
3442
3442
|
);
|
|
3443
|
-
const parsedValue =
|
|
3443
|
+
const parsedValue = React26__default.useMemo(() => {
|
|
3444
3444
|
if (value === null || value === void 0) return void 0;
|
|
3445
3445
|
if (value instanceof Date) return value;
|
|
3446
3446
|
const parsed = parser(value);
|
|
@@ -3449,26 +3449,26 @@ var DatePicker2 = ({
|
|
|
3449
3449
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
|
|
3450
3450
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change date, current selection ${labelFormatter(parsedValue)}` : "Open date picker");
|
|
3451
3451
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
3452
|
-
const handleClose =
|
|
3453
|
-
const emitChange =
|
|
3452
|
+
const handleClose = React26__default.useCallback(() => setOpen(false), []);
|
|
3453
|
+
const emitChange = React26__default.useCallback(
|
|
3454
3454
|
(next) => {
|
|
3455
3455
|
onChange?.(next);
|
|
3456
3456
|
onValueChange?.(next ? outputFormatter(next) : void 0);
|
|
3457
3457
|
},
|
|
3458
3458
|
[onChange, onValueChange, outputFormatter]
|
|
3459
3459
|
);
|
|
3460
|
-
const handleSelect =
|
|
3460
|
+
const handleSelect = React26__default.useCallback(
|
|
3461
3461
|
(next) => {
|
|
3462
3462
|
emitChange(next);
|
|
3463
3463
|
if (closeOnSelect && next) handleClose();
|
|
3464
3464
|
},
|
|
3465
3465
|
[closeOnSelect, emitChange, handleClose]
|
|
3466
3466
|
);
|
|
3467
|
-
const handleClear =
|
|
3467
|
+
const handleClear = React26__default.useCallback(() => {
|
|
3468
3468
|
emitChange(void 0);
|
|
3469
3469
|
handleClose();
|
|
3470
3470
|
}, [emitChange, handleClose]);
|
|
3471
|
-
const handleOpenChange =
|
|
3471
|
+
const handleOpenChange = React26__default.useCallback(
|
|
3472
3472
|
(nextOpen) => {
|
|
3473
3473
|
if (disabled && nextOpen) return;
|
|
3474
3474
|
setOpen(nextOpen);
|
|
@@ -3658,15 +3658,15 @@ function MonthCal({
|
|
|
3658
3658
|
onYearBackward,
|
|
3659
3659
|
onYearForward
|
|
3660
3660
|
}) {
|
|
3661
|
-
const today =
|
|
3661
|
+
const today = React26.useMemo(() => {
|
|
3662
3662
|
const now = /* @__PURE__ */ new Date();
|
|
3663
3663
|
now.setDate(1);
|
|
3664
3664
|
now.setHours(0, 0, 0, 0);
|
|
3665
3665
|
return now;
|
|
3666
3666
|
}, []);
|
|
3667
|
-
const selectedMonthDate =
|
|
3668
|
-
const min =
|
|
3669
|
-
const max =
|
|
3667
|
+
const selectedMonthDate = React26.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
|
|
3668
|
+
const min = React26.useMemo(() => normalizeMonth(minDate), [minDate]);
|
|
3669
|
+
const max = React26.useMemo(() => normalizeMonth(maxDate), [maxDate]);
|
|
3670
3670
|
let effectiveMin = min;
|
|
3671
3671
|
if (min && max && min > max) {
|
|
3672
3672
|
effectiveMin = max;
|
|
@@ -3675,10 +3675,10 @@ function MonthCal({
|
|
|
3675
3675
|
const minMonth = effectiveMin?.getMonth();
|
|
3676
3676
|
const maxYear = max?.getFullYear();
|
|
3677
3677
|
const maxMonth = max?.getMonth();
|
|
3678
|
-
const [menuYear, setMenuYear] =
|
|
3678
|
+
const [menuYear, setMenuYear] = React26.useState(
|
|
3679
3679
|
() => selectedMonthDate?.getFullYear() ?? today.getFullYear()
|
|
3680
3680
|
);
|
|
3681
|
-
|
|
3681
|
+
React26.useEffect(() => {
|
|
3682
3682
|
if (selectedMonthDate) {
|
|
3683
3683
|
const year = selectedMonthDate.getFullYear();
|
|
3684
3684
|
if (year !== menuYear) {
|
|
@@ -3686,7 +3686,7 @@ function MonthCal({
|
|
|
3686
3686
|
}
|
|
3687
3687
|
}
|
|
3688
3688
|
}, [selectedMonthDate, menuYear]);
|
|
3689
|
-
|
|
3689
|
+
React26.useEffect(() => {
|
|
3690
3690
|
if (typeof minYear === "number" && menuYear < minYear) {
|
|
3691
3691
|
setMenuYear(minYear);
|
|
3692
3692
|
return;
|
|
@@ -3697,7 +3697,7 @@ function MonthCal({
|
|
|
3697
3697
|
}, [minYear, maxYear, menuYear]);
|
|
3698
3698
|
const disablePrevYear = typeof minYear === "number" ? menuYear <= minYear : false;
|
|
3699
3699
|
const disableNextYear = typeof maxYear === "number" ? menuYear >= maxYear : false;
|
|
3700
|
-
const yearOptions =
|
|
3700
|
+
const yearOptions = React26.useMemo(() => {
|
|
3701
3701
|
const fallbackWindow = 50;
|
|
3702
3702
|
const start = typeof minYear === "number" ? minYear : menuYear - fallbackWindow;
|
|
3703
3703
|
const end = typeof maxYear === "number" ? maxYear : menuYear + fallbackWindow;
|
|
@@ -3711,7 +3711,7 @@ function MonthCal({
|
|
|
3711
3711
|
}
|
|
3712
3712
|
return years;
|
|
3713
3713
|
}, [maxYear, menuYear, minYear]);
|
|
3714
|
-
const formatYearLabel =
|
|
3714
|
+
const formatYearLabel = React26.useCallback(
|
|
3715
3715
|
(year) => {
|
|
3716
3716
|
const raw = callbacks?.yearLabel?.(year);
|
|
3717
3717
|
if (raw === null || raw === void 0) return String(year);
|
|
@@ -3719,7 +3719,7 @@ function MonthCal({
|
|
|
3719
3719
|
},
|
|
3720
3720
|
[callbacks]
|
|
3721
3721
|
);
|
|
3722
|
-
const handleYearSelect =
|
|
3722
|
+
const handleYearSelect = React26.useCallback(
|
|
3723
3723
|
(nextValue) => {
|
|
3724
3724
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
3725
3725
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -3729,7 +3729,7 @@ function MonthCal({
|
|
|
3729
3729
|
},
|
|
3730
3730
|
[maxYear, minYear]
|
|
3731
3731
|
);
|
|
3732
|
-
const disabledPairs =
|
|
3732
|
+
const disabledPairs = React26.useMemo(() => {
|
|
3733
3733
|
if (!disabledDates?.length) return [];
|
|
3734
3734
|
const pairs = [];
|
|
3735
3735
|
disabledDates.forEach((date) => {
|
|
@@ -3874,14 +3874,14 @@ var MonthPicker2 = ({
|
|
|
3874
3874
|
ariaLabel,
|
|
3875
3875
|
...calendarProps
|
|
3876
3876
|
}) => {
|
|
3877
|
-
const [open, setOpen] =
|
|
3878
|
-
const parser =
|
|
3879
|
-
const outputFormatter =
|
|
3880
|
-
const labelFormatter =
|
|
3877
|
+
const [open, setOpen] = React26__default.useState(false);
|
|
3878
|
+
const parser = React26__default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
|
|
3879
|
+
const outputFormatter = React26__default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
|
|
3880
|
+
const labelFormatter = React26__default.useMemo(
|
|
3881
3881
|
() => displayFormatter ?? defaultDisplayFormatter2,
|
|
3882
3882
|
[displayFormatter]
|
|
3883
3883
|
);
|
|
3884
|
-
const parsedValue =
|
|
3884
|
+
const parsedValue = React26__default.useMemo(() => {
|
|
3885
3885
|
if (value === null || value === void 0) return void 0;
|
|
3886
3886
|
if (value instanceof Date) return normalizeMonth2(value);
|
|
3887
3887
|
if (typeof value === "string") {
|
|
@@ -3893,8 +3893,8 @@ var MonthPicker2 = ({
|
|
|
3893
3893
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
|
|
3894
3894
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change month, current selection ${labelFormatter(parsedValue)}` : "Open month picker");
|
|
3895
3895
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
3896
|
-
const handleClose =
|
|
3897
|
-
const emitChange =
|
|
3896
|
+
const handleClose = React26__default.useCallback(() => setOpen(false), []);
|
|
3897
|
+
const emitChange = React26__default.useCallback(
|
|
3898
3898
|
(next) => {
|
|
3899
3899
|
const normalized = next ? normalizeMonth2(next) : void 0;
|
|
3900
3900
|
onChange?.(normalized);
|
|
@@ -3902,18 +3902,18 @@ var MonthPicker2 = ({
|
|
|
3902
3902
|
},
|
|
3903
3903
|
[onChange, onValueChange, outputFormatter]
|
|
3904
3904
|
);
|
|
3905
|
-
const handleSelect =
|
|
3905
|
+
const handleSelect = React26__default.useCallback(
|
|
3906
3906
|
(next) => {
|
|
3907
3907
|
emitChange(next);
|
|
3908
3908
|
if (closeOnSelect && next) handleClose();
|
|
3909
3909
|
},
|
|
3910
3910
|
[closeOnSelect, emitChange, handleClose]
|
|
3911
3911
|
);
|
|
3912
|
-
const handleClear =
|
|
3912
|
+
const handleClear = React26__default.useCallback(() => {
|
|
3913
3913
|
emitChange(void 0);
|
|
3914
3914
|
handleClose();
|
|
3915
3915
|
}, [emitChange, handleClose]);
|
|
3916
|
-
const handleOpenChange =
|
|
3916
|
+
const handleOpenChange = React26__default.useCallback(
|
|
3917
3917
|
(nextOpen) => {
|
|
3918
3918
|
if (disabled && nextOpen) return;
|
|
3919
3919
|
setOpen(nextOpen);
|
|
@@ -5189,7 +5189,7 @@ var AdvanceSearch = ({
|
|
|
5189
5189
|
defaultValues: {}
|
|
5190
5190
|
});
|
|
5191
5191
|
const { handleSubmit, unregister, resetField, getValues, clearErrors, setError } = form;
|
|
5192
|
-
const [operatorErrors, setOperatorErrors] =
|
|
5192
|
+
const [operatorErrors, setOperatorErrors] = React26__default.useState({});
|
|
5193
5193
|
const clearOperatorError = useCallback(
|
|
5194
5194
|
(rowId) => {
|
|
5195
5195
|
setOperatorErrors((prev) => {
|
|
@@ -5610,14 +5610,14 @@ var useControllableState = ({
|
|
|
5610
5610
|
value
|
|
5611
5611
|
}) => {
|
|
5612
5612
|
const isControlled = typeof value !== "undefined";
|
|
5613
|
-
const [internalValue, setInternalValue] =
|
|
5613
|
+
const [internalValue, setInternalValue] = React26.useState(() => {
|
|
5614
5614
|
return isControlled ? value : defaultValue;
|
|
5615
5615
|
});
|
|
5616
|
-
|
|
5616
|
+
React26.useEffect(() => {
|
|
5617
5617
|
if (!isControlled) return;
|
|
5618
5618
|
setInternalValue(value);
|
|
5619
5619
|
}, [isControlled, value]);
|
|
5620
|
-
const setValue =
|
|
5620
|
+
const setValue = React26.useCallback(
|
|
5621
5621
|
(nextValue) => {
|
|
5622
5622
|
if (isControlled) return;
|
|
5623
5623
|
setInternalValue(nextValue);
|
|
@@ -5829,7 +5829,7 @@ var ColumnSeparator = ({ show, className, ...props }) => {
|
|
|
5829
5829
|
}
|
|
5830
5830
|
);
|
|
5831
5831
|
};
|
|
5832
|
-
var ColumnSeparator_default =
|
|
5832
|
+
var ColumnSeparator_default = React26__default.memo(ColumnSeparator);
|
|
5833
5833
|
var StatusContentSlot = ({
|
|
5834
5834
|
content,
|
|
5835
5835
|
icon,
|
|
@@ -5848,7 +5848,7 @@ var StatusContentSlot = ({
|
|
|
5848
5848
|
content
|
|
5849
5849
|
] });
|
|
5850
5850
|
};
|
|
5851
|
-
var StatusContentSlot_default =
|
|
5851
|
+
var StatusContentSlot_default = React26__default.memo(StatusContentSlot);
|
|
5852
5852
|
var stateOptions = [
|
|
5853
5853
|
"columnFilters",
|
|
5854
5854
|
"globalFilter",
|
|
@@ -7372,8 +7372,8 @@ var DISALLOWED_MARKS = ["bold", "italic", "link"];
|
|
|
7372
7372
|
var SUGGESTION_DEBOUNCE = 200;
|
|
7373
7373
|
var DEFAULT_CHIP_CLASS = "outline-1 outline-muted bg-muted/40 text-foreground";
|
|
7374
7374
|
var TokenView = ({ node, editor, getPos }) => {
|
|
7375
|
-
const [isFocused, setIsFocused] =
|
|
7376
|
-
|
|
7375
|
+
const [isFocused, setIsFocused] = React26__default.useState(false);
|
|
7376
|
+
React26__default.useEffect(() => {
|
|
7377
7377
|
const handler = () => {
|
|
7378
7378
|
const { from, to } = editor.state.selection;
|
|
7379
7379
|
const position = getPos();
|
|
@@ -8565,7 +8565,7 @@ function ToolbarPlugin({
|
|
|
8565
8565
|
isLink: hasLink
|
|
8566
8566
|
}));
|
|
8567
8567
|
}, []);
|
|
8568
|
-
|
|
8568
|
+
React26.useEffect(() => {
|
|
8569
8569
|
return mergeRegister(
|
|
8570
8570
|
editor.registerCommand(
|
|
8571
8571
|
CAN_UNDO_COMMAND,
|
|
@@ -9151,7 +9151,7 @@ function ControlledValuePlugin({
|
|
|
9151
9151
|
trackAppliedValue
|
|
9152
9152
|
}) {
|
|
9153
9153
|
const [editor] = useLexicalComposerContext();
|
|
9154
|
-
|
|
9154
|
+
React26.useEffect(() => {
|
|
9155
9155
|
if (value == null || trackAppliedValue.current === value) {
|
|
9156
9156
|
return;
|
|
9157
9157
|
}
|
|
@@ -9175,14 +9175,14 @@ function ControlledValuePlugin({
|
|
|
9175
9175
|
}
|
|
9176
9176
|
function EditableStatePlugin({ editable }) {
|
|
9177
9177
|
const [editor] = useLexicalComposerContext();
|
|
9178
|
-
|
|
9178
|
+
React26.useEffect(() => {
|
|
9179
9179
|
editor.setEditable(editable);
|
|
9180
9180
|
}, [editor, editable]);
|
|
9181
9181
|
return null;
|
|
9182
9182
|
}
|
|
9183
9183
|
function ImagesPlugin() {
|
|
9184
9184
|
const [editor] = useLexicalComposerContext();
|
|
9185
|
-
|
|
9185
|
+
React26.useEffect(() => {
|
|
9186
9186
|
return editor.registerCommand(
|
|
9187
9187
|
INSERT_IMAGE_COMMAND,
|
|
9188
9188
|
(payload) => {
|
|
@@ -9463,9 +9463,9 @@ var SIDEBAR_WIDTH = "16rem";
|
|
|
9463
9463
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
9464
9464
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
9465
9465
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
9466
|
-
var SidebarContext =
|
|
9466
|
+
var SidebarContext = React26.createContext(null);
|
|
9467
9467
|
function useSidebar() {
|
|
9468
|
-
const context =
|
|
9468
|
+
const context = React26.useContext(SidebarContext);
|
|
9469
9469
|
if (!context) {
|
|
9470
9470
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
9471
9471
|
}
|
|
@@ -9481,10 +9481,10 @@ function SidebarProvider({
|
|
|
9481
9481
|
...props
|
|
9482
9482
|
}) {
|
|
9483
9483
|
const isMobile = useIsMobile();
|
|
9484
|
-
const [openMobile, setOpenMobile] =
|
|
9485
|
-
const [_open, _setOpen] =
|
|
9484
|
+
const [openMobile, setOpenMobile] = React26.useState(false);
|
|
9485
|
+
const [_open, _setOpen] = React26.useState(defaultOpen);
|
|
9486
9486
|
const open = openProp ?? _open;
|
|
9487
|
-
const setOpen =
|
|
9487
|
+
const setOpen = React26.useCallback(
|
|
9488
9488
|
(value) => {
|
|
9489
9489
|
const openState = typeof value === "function" ? value(open) : value;
|
|
9490
9490
|
if (setOpenProp) {
|
|
@@ -9496,10 +9496,10 @@ function SidebarProvider({
|
|
|
9496
9496
|
},
|
|
9497
9497
|
[setOpenProp, open]
|
|
9498
9498
|
);
|
|
9499
|
-
const toggleSidebar =
|
|
9499
|
+
const toggleSidebar = React26.useCallback(() => {
|
|
9500
9500
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
9501
9501
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
9502
|
-
|
|
9502
|
+
React26.useEffect(() => {
|
|
9503
9503
|
const handleKeyDown = (event) => {
|
|
9504
9504
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
9505
9505
|
event.preventDefault();
|
|
@@ -9510,7 +9510,7 @@ function SidebarProvider({
|
|
|
9510
9510
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
9511
9511
|
}, [toggleSidebar]);
|
|
9512
9512
|
const state = open ? "expanded" : "collapsed";
|
|
9513
|
-
const contextValue =
|
|
9513
|
+
const contextValue = React26.useMemo(
|
|
9514
9514
|
() => ({
|
|
9515
9515
|
state,
|
|
9516
9516
|
open,
|
|
@@ -9952,7 +9952,7 @@ function SidebarMenuSkeleton({
|
|
|
9952
9952
|
showIcon = false,
|
|
9953
9953
|
...props
|
|
9954
9954
|
}) {
|
|
9955
|
-
const width =
|
|
9955
|
+
const width = React26.useMemo(() => {
|
|
9956
9956
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
9957
9957
|
}, []);
|
|
9958
9958
|
return /* @__PURE__ */ jsxs(
|
|
@@ -10095,8 +10095,8 @@ function TooltipProvider({
|
|
|
10095
10095
|
}) {
|
|
10096
10096
|
return /* @__PURE__ */ jsx(TooltipPrimitive.Provider, { "data-slot": "tooltip-provider", delayDuration, ...props });
|
|
10097
10097
|
}
|
|
10098
|
-
function Tooltip({ ...props }) {
|
|
10099
|
-
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
|
|
10098
|
+
function Tooltip({ children, ...props }) {
|
|
10099
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props, children }) });
|
|
10100
10100
|
}
|
|
10101
10101
|
function TooltipTrigger({ ...props }) {
|
|
10102
10102
|
return /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
@@ -10422,7 +10422,7 @@ function SortableRow({
|
|
|
10422
10422
|
id: value,
|
|
10423
10423
|
disabled: name === "columns.0.id"
|
|
10424
10424
|
});
|
|
10425
|
-
const style =
|
|
10425
|
+
const style = React26.useMemo(
|
|
10426
10426
|
() => ({
|
|
10427
10427
|
transform: CSS.Transform.toString(transform),
|
|
10428
10428
|
transition
|
|
@@ -10824,7 +10824,7 @@ function getCandidateWidths({
|
|
|
10824
10824
|
}
|
|
10825
10825
|
return DEVICE_SIZES;
|
|
10826
10826
|
}
|
|
10827
|
-
var Image2 =
|
|
10827
|
+
var Image2 = React26.forwardRef(function Image3({
|
|
10828
10828
|
src,
|
|
10829
10829
|
alt,
|
|
10830
10830
|
width,
|
|
@@ -10854,34 +10854,34 @@ var Image2 = React25.forwardRef(function Image3({
|
|
|
10854
10854
|
} = imgProps;
|
|
10855
10855
|
const widthNumber = toNumber(width);
|
|
10856
10856
|
const heightNumber = toNumber(height);
|
|
10857
|
-
|
|
10857
|
+
React26.useEffect(() => {
|
|
10858
10858
|
if (!fill && (!widthNumber || !heightNumber)) {
|
|
10859
10859
|
console.warn(
|
|
10860
10860
|
"[Image] When `fill` is false you should provide both `width` and `height` to prevent layout shifts."
|
|
10861
10861
|
);
|
|
10862
10862
|
}
|
|
10863
10863
|
}, [fill, heightNumber, widthNumber]);
|
|
10864
|
-
const candidateWidths =
|
|
10864
|
+
const candidateWidths = React26.useMemo(
|
|
10865
10865
|
() => getCandidateWidths({ width: widthNumber, sizes, fill }),
|
|
10866
10866
|
[fill, sizes, widthNumber]
|
|
10867
10867
|
);
|
|
10868
10868
|
const largestWidth = candidateWidths[candidateWidths.length - 1] ?? widthNumber ?? DEVICE_SIZES[DEVICE_SIZES.length - 1];
|
|
10869
|
-
const computedSrc =
|
|
10869
|
+
const computedSrc = React26.useMemo(() => {
|
|
10870
10870
|
if (unoptimized) {
|
|
10871
10871
|
return src;
|
|
10872
10872
|
}
|
|
10873
10873
|
return loader({ src, width: largestWidth, quality });
|
|
10874
10874
|
}, [largestWidth, loader, quality, src, unoptimized]);
|
|
10875
|
-
const computedSrcSet =
|
|
10875
|
+
const computedSrcSet = React26.useMemo(() => {
|
|
10876
10876
|
if (unoptimized) {
|
|
10877
10877
|
return void 0;
|
|
10878
10878
|
}
|
|
10879
10879
|
return candidateWidths.map((currentWidth) => `${loader({ src, width: currentWidth, quality })} ${currentWidth}w`).join(", ");
|
|
10880
10880
|
}, [candidateWidths, loader, quality, src, unoptimized]);
|
|
10881
10881
|
const sizesValue = sizes ?? (fill ? "100vw" : widthNumber ? `${widthNumber}px` : void 0);
|
|
10882
|
-
const [isLoaded, setIsLoaded] =
|
|
10883
|
-
const internalRef =
|
|
10884
|
-
const setRefs =
|
|
10882
|
+
const [isLoaded, setIsLoaded] = React26.useState(false);
|
|
10883
|
+
const internalRef = React26.useRef(null);
|
|
10884
|
+
const setRefs = React26.useCallback(
|
|
10885
10885
|
(node) => {
|
|
10886
10886
|
internalRef.current = node;
|
|
10887
10887
|
if (!ref) {
|
|
@@ -10895,7 +10895,7 @@ var Image2 = React25.forwardRef(function Image3({
|
|
|
10895
10895
|
},
|
|
10896
10896
|
[ref]
|
|
10897
10897
|
);
|
|
10898
|
-
|
|
10898
|
+
React26.useEffect(() => {
|
|
10899
10899
|
const image = internalRef.current;
|
|
10900
10900
|
if (!image) {
|
|
10901
10901
|
return;
|
|
@@ -10907,7 +10907,7 @@ var Image2 = React25.forwardRef(function Image3({
|
|
|
10907
10907
|
setIsLoaded(false);
|
|
10908
10908
|
}
|
|
10909
10909
|
}, [onLoadingComplete, src]);
|
|
10910
|
-
const handleLoad =
|
|
10910
|
+
const handleLoad = React26.useCallback(
|
|
10911
10911
|
(event) => {
|
|
10912
10912
|
setIsLoaded(true);
|
|
10913
10913
|
onLoadProp?.(event);
|
|
@@ -10919,7 +10919,7 @@ var Image2 = React25.forwardRef(function Image3({
|
|
|
10919
10919
|
const fetchPriority = priority ? "high" : fetchPriorityProp;
|
|
10920
10920
|
const decoding = decodingProp ?? "async";
|
|
10921
10921
|
const resolvedObjectFit = objectFit ?? (fill ? "cover" : void 0);
|
|
10922
|
-
const wrapperStyle =
|
|
10922
|
+
const wrapperStyle = React26.useMemo(
|
|
10923
10923
|
() => ({
|
|
10924
10924
|
position: "relative",
|
|
10925
10925
|
display: fill ? "block" : "inline-block",
|
|
@@ -10929,7 +10929,7 @@ var Image2 = React25.forwardRef(function Image3({
|
|
|
10929
10929
|
}),
|
|
10930
10930
|
[fill, height, width]
|
|
10931
10931
|
);
|
|
10932
|
-
const imageStyle =
|
|
10932
|
+
const imageStyle = React26.useMemo(
|
|
10933
10933
|
() => ({
|
|
10934
10934
|
width: fill ? "100%" : formatDimension(width) ?? void 0,
|
|
10935
10935
|
height: fill ? "100%" : formatDimension(height) ?? void 0,
|
|
@@ -11078,7 +11078,7 @@ var InfoIcon = ({ size = "1em", className, ...props }) => {
|
|
|
11078
11078
|
}
|
|
11079
11079
|
);
|
|
11080
11080
|
};
|
|
11081
|
-
var InfoIcon_default =
|
|
11081
|
+
var InfoIcon_default = React26__default.memo(InfoIcon);
|
|
11082
11082
|
var Navbar = ({
|
|
11083
11083
|
className,
|
|
11084
11084
|
title,
|
|
@@ -11210,7 +11210,7 @@ var Navbar = ({
|
|
|
11210
11210
|
}
|
|
11211
11211
|
);
|
|
11212
11212
|
};
|
|
11213
|
-
var navbar_default =
|
|
11213
|
+
var navbar_default = React26__default.memo(Navbar);
|
|
11214
11214
|
var usePreventPageLeaveStore = create((set) => ({
|
|
11215
11215
|
isPreventing: false,
|
|
11216
11216
|
setPreventing: (value) => set({ isPreventing: value })
|
|
@@ -11249,25 +11249,40 @@ var DefaultHeader = ({
|
|
|
11249
11249
|
icon,
|
|
11250
11250
|
classNames,
|
|
11251
11251
|
rightActions
|
|
11252
|
-
}) =>
|
|
11253
|
-
|
|
11254
|
-
|
|
11255
|
-
|
|
11256
|
-
|
|
11257
|
-
|
|
11258
|
-
|
|
11259
|
-
|
|
11260
|
-
|
|
11261
|
-
|
|
11262
|
-
|
|
11263
|
-
|
|
11264
|
-
/* @__PURE__ */ jsxs("div", { className: "flex
|
|
11265
|
-
|
|
11266
|
-
|
|
11267
|
-
|
|
11268
|
-
|
|
11269
|
-
|
|
11270
|
-
|
|
11252
|
+
}) => {
|
|
11253
|
+
const titleRef = React26.useRef(null);
|
|
11254
|
+
const isTruncated = useTruncated_default({ elementRef: titleRef });
|
|
11255
|
+
const textElement = title ? /* @__PURE__ */ jsx(
|
|
11256
|
+
"span",
|
|
11257
|
+
{
|
|
11258
|
+
ref: titleRef,
|
|
11259
|
+
className: cn("text-lg font-semibold text-sus-green-1 truncate", classNames?.title),
|
|
11260
|
+
children: title
|
|
11261
|
+
}
|
|
11262
|
+
) : null;
|
|
11263
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-start justify-between gap-3", classNames?.header), children: [
|
|
11264
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 min-w-0", children: [
|
|
11265
|
+
icon ? /* @__PURE__ */ jsx(
|
|
11266
|
+
"div",
|
|
11267
|
+
{
|
|
11268
|
+
className: cn(
|
|
11269
|
+
"w-10 h-10 rounded-full bg-sus-green-50 flex items-center justify-center",
|
|
11270
|
+
classNames?.iconWrapper
|
|
11271
|
+
),
|
|
11272
|
+
children: icon
|
|
11273
|
+
}
|
|
11274
|
+
) : null,
|
|
11275
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0", children: [
|
|
11276
|
+
subtitle ? /* @__PURE__ */ jsx("span", { className: cn("text-xs text-gray-500", classNames?.subtitle), children: subtitle }) : null,
|
|
11277
|
+
textElement ? isTruncated ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
11278
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: textElement }),
|
|
11279
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: title })
|
|
11280
|
+
] }) : textElement : null
|
|
11281
|
+
] })
|
|
11282
|
+
] }),
|
|
11283
|
+
rightActions ? /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: rightActions }) : null
|
|
11284
|
+
] });
|
|
11285
|
+
};
|
|
11271
11286
|
var RightPanelContainer = ({
|
|
11272
11287
|
title,
|
|
11273
11288
|
subtitle,
|
|
@@ -11291,19 +11306,28 @@ var RightPanelContainer = ({
|
|
|
11291
11306
|
className,
|
|
11292
11307
|
classNames?.root
|
|
11293
11308
|
),
|
|
11294
|
-
children: /* @__PURE__ */ jsx("div", { className: cn("flex-1 flex min-h-0 px-4 py-6 justify-center", classNames?.body), children: /* @__PURE__ */ jsxs(
|
|
11295
|
-
|
|
11296
|
-
|
|
11297
|
-
|
|
11298
|
-
|
|
11299
|
-
|
|
11300
|
-
|
|
11301
|
-
|
|
11302
|
-
classNames
|
|
11303
|
-
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
|
-
|
|
11309
|
+
children: /* @__PURE__ */ jsx("div", { className: cn("flex-1 flex min-h-0 min-w-0 px-4 py-6 justify-center", classNames?.body), children: /* @__PURE__ */ jsxs(
|
|
11310
|
+
"div",
|
|
11311
|
+
{
|
|
11312
|
+
className: cn(
|
|
11313
|
+
"w-full max-w-3xl min-w-0 overflow-x-hidden overflow-y-auto",
|
|
11314
|
+
classNames?.content
|
|
11315
|
+
),
|
|
11316
|
+
children: [
|
|
11317
|
+
renderHeader ? renderHeader({ title, subtitle, icon, rightActions, classNames }) : Header2 ? /* @__PURE__ */ jsx(
|
|
11318
|
+
Header2,
|
|
11319
|
+
{
|
|
11320
|
+
title,
|
|
11321
|
+
subtitle,
|
|
11322
|
+
icon,
|
|
11323
|
+
rightActions,
|
|
11324
|
+
classNames
|
|
11325
|
+
}
|
|
11326
|
+
) : null,
|
|
11327
|
+
children
|
|
11328
|
+
]
|
|
11329
|
+
}
|
|
11330
|
+
) })
|
|
11307
11331
|
}
|
|
11308
11332
|
);
|
|
11309
11333
|
};
|
|
@@ -11565,7 +11589,7 @@ function isFragment(object) {
|
|
|
11565
11589
|
var isValidText = (val) => ["string", "number"].includes(typeof val);
|
|
11566
11590
|
function toArray(children, option = {}) {
|
|
11567
11591
|
let ret = [];
|
|
11568
|
-
|
|
11592
|
+
React26.Children.forEach(children, (child) => {
|
|
11569
11593
|
if ((child === void 0 || child === null) && !option.keepEmpty) {
|
|
11570
11594
|
return;
|
|
11571
11595
|
}
|
|
@@ -11579,9 +11603,9 @@ function toArray(children, option = {}) {
|
|
|
11579
11603
|
});
|
|
11580
11604
|
return ret;
|
|
11581
11605
|
}
|
|
11582
|
-
var MeasureText =
|
|
11583
|
-
const spanRef =
|
|
11584
|
-
|
|
11606
|
+
var MeasureText = React26.forwardRef(({ style, children }, ref) => {
|
|
11607
|
+
const spanRef = React26.useRef(null);
|
|
11608
|
+
React26.useImperativeHandle(ref, () => ({
|
|
11585
11609
|
isExceed: () => {
|
|
11586
11610
|
const span = spanRef.current;
|
|
11587
11611
|
return span.scrollHeight > span.clientHeight;
|
|
@@ -11639,19 +11663,19 @@ var lineClipStyle = {
|
|
|
11639
11663
|
};
|
|
11640
11664
|
function EllipsisMeasure(props) {
|
|
11641
11665
|
const { enableMeasure, width, text, children, rows, expanded, miscDeps, onEllipsis } = props;
|
|
11642
|
-
const nodeList =
|
|
11643
|
-
const nodeLen =
|
|
11644
|
-
const fullContent =
|
|
11645
|
-
const [ellipsisCutIndex, setEllipsisCutIndex] =
|
|
11646
|
-
const cutMidRef =
|
|
11647
|
-
const measureWhiteSpaceRef =
|
|
11648
|
-
const needEllipsisRef =
|
|
11649
|
-
const descRowsEllipsisRef =
|
|
11650
|
-
const symbolRowEllipsisRef =
|
|
11651
|
-
const [canEllipsis, setCanEllipsis] =
|
|
11652
|
-
const [needEllipsis, setNeedEllipsis] =
|
|
11653
|
-
const [ellipsisHeight, setEllipsisHeight] =
|
|
11654
|
-
const [parentWhiteSpace, setParentWhiteSpace] =
|
|
11666
|
+
const nodeList = React26.useMemo(() => toArray(text), [text]);
|
|
11667
|
+
const nodeLen = React26.useMemo(() => getNodesLen(nodeList), [text]);
|
|
11668
|
+
const fullContent = React26.useMemo(() => children(nodeList, false), [text]);
|
|
11669
|
+
const [ellipsisCutIndex, setEllipsisCutIndex] = React26.useState(null);
|
|
11670
|
+
const cutMidRef = React26.useRef(null);
|
|
11671
|
+
const measureWhiteSpaceRef = React26.useRef(null);
|
|
11672
|
+
const needEllipsisRef = React26.useRef(null);
|
|
11673
|
+
const descRowsEllipsisRef = React26.useRef(null);
|
|
11674
|
+
const symbolRowEllipsisRef = React26.useRef(null);
|
|
11675
|
+
const [canEllipsis, setCanEllipsis] = React26.useState(false);
|
|
11676
|
+
const [needEllipsis, setNeedEllipsis] = React26.useState(STATUS_MEASURE_NONE);
|
|
11677
|
+
const [ellipsisHeight, setEllipsisHeight] = React26.useState(0);
|
|
11678
|
+
const [parentWhiteSpace, setParentWhiteSpace] = React26.useState(null);
|
|
11655
11679
|
useIsomorphicLayoutEffect(() => {
|
|
11656
11680
|
if (enableMeasure && width && nodeLen) {
|
|
11657
11681
|
setNeedEllipsis(STATUS_MEASURE_PREPARE);
|
|
@@ -11694,7 +11718,7 @@ function EllipsisMeasure(props) {
|
|
|
11694
11718
|
setEllipsisCutIndex(isOverflow ? [minIndex, targetMidIndex] : [targetMidIndex, maxIndex]);
|
|
11695
11719
|
}
|
|
11696
11720
|
}, [ellipsisCutIndex, cutMidIndex]);
|
|
11697
|
-
const finalContent =
|
|
11721
|
+
const finalContent = React26.useMemo(() => {
|
|
11698
11722
|
if (!enableMeasure) {
|
|
11699
11723
|
return children(nodeList, false);
|
|
11700
11724
|
}
|
|
@@ -11785,10 +11809,10 @@ var Truncated = ({
|
|
|
11785
11809
|
tooltipProps,
|
|
11786
11810
|
tooltipContentProps
|
|
11787
11811
|
}) => {
|
|
11788
|
-
const elementRef =
|
|
11789
|
-
const [open, setOpen] =
|
|
11790
|
-
const [isTruncated, setIsTruncated] =
|
|
11791
|
-
const [measureWidth, setMeasureWidth] =
|
|
11812
|
+
const elementRef = React26.useRef(null);
|
|
11813
|
+
const [open, setOpen] = React26.useState(false);
|
|
11814
|
+
const [isTruncated, setIsTruncated] = React26.useState(false);
|
|
11815
|
+
const [measureWidth, setMeasureWidth] = React26.useState(0);
|
|
11792
11816
|
const Comp = as;
|
|
11793
11817
|
const normalizedChildren = typeof children === "string" ? children.replace(/>/g, ">\u200B") : children;
|
|
11794
11818
|
const lineClampLines = typeof ellipsis === "number" ? ellipsis : typeof ellipsis === "object" ? ellipsis?.lineClamp ?? 3 : null;
|
|
@@ -11813,13 +11837,13 @@ var Truncated = ({
|
|
|
11813
11837
|
setIsTruncated(false);
|
|
11814
11838
|
}
|
|
11815
11839
|
}, [enableMeasure]);
|
|
11816
|
-
const truncationClass =
|
|
11840
|
+
const truncationClass = React26.useMemo(() => {
|
|
11817
11841
|
if (!ellipsis) return "";
|
|
11818
11842
|
if (typeof ellipsis === "number") return `line-clamp-${ellipsis}`;
|
|
11819
11843
|
if (typeof ellipsis === "object") return `line-clamp-${lineClampLines ?? 3}`;
|
|
11820
11844
|
return "truncate";
|
|
11821
11845
|
}, [ellipsis, lineClampLines]);
|
|
11822
|
-
const clampedStyle =
|
|
11846
|
+
const clampedStyle = React26.useMemo(() => {
|
|
11823
11847
|
if (!lineClampLines) return style;
|
|
11824
11848
|
return {
|
|
11825
11849
|
...style,
|
|
@@ -11881,7 +11905,7 @@ var Truncated = ({
|
|
|
11881
11905
|
);
|
|
11882
11906
|
};
|
|
11883
11907
|
var truncated_default = Truncated;
|
|
11884
|
-
var InputPrimitive2 =
|
|
11908
|
+
var InputPrimitive2 = React26.forwardRef(
|
|
11885
11909
|
({ className, type = "text", ...props }, ref) => {
|
|
11886
11910
|
return /* @__PURE__ */ jsx(
|
|
11887
11911
|
"input",
|
|
@@ -11920,7 +11944,7 @@ var inputVariants2 = cva("", {
|
|
|
11920
11944
|
appearance: "filled"
|
|
11921
11945
|
}
|
|
11922
11946
|
});
|
|
11923
|
-
var Input2 =
|
|
11947
|
+
var Input2 = React26.forwardRef(
|
|
11924
11948
|
({
|
|
11925
11949
|
className,
|
|
11926
11950
|
wrapperClassName,
|
|
@@ -11953,8 +11977,8 @@ var Input2 = React25.forwardRef(
|
|
|
11953
11977
|
onChange: onChangeProp
|
|
11954
11978
|
} = rest;
|
|
11955
11979
|
const ariaInvalid = invalid ?? ariaInvalidProp;
|
|
11956
|
-
const messageId =
|
|
11957
|
-
const handleChange =
|
|
11980
|
+
const messageId = React26.useId();
|
|
11981
|
+
const handleChange = React26.useCallback(
|
|
11958
11982
|
(event) => {
|
|
11959
11983
|
onChangeProp?.(event);
|
|
11960
11984
|
onValueChange?.(event.target.value);
|
|
@@ -12048,16 +12072,16 @@ var InputNumber = ({ customInputProps, ...props }) => {
|
|
|
12048
12072
|
return /* @__PURE__ */ jsx(NumericFormat, { customInput: Input2, ...props, ...customInputProps });
|
|
12049
12073
|
};
|
|
12050
12074
|
var InputNumber_default = InputNumber;
|
|
12051
|
-
var ActionButton = ({ label, onPress, className }) => {
|
|
12052
|
-
const
|
|
12075
|
+
var ActionButton = ({ label, onPress, disabled, className }) => {
|
|
12076
|
+
const isDisabled = disabled || onPress === void 0;
|
|
12053
12077
|
return /* @__PURE__ */ jsx(
|
|
12054
12078
|
"button",
|
|
12055
12079
|
{
|
|
12056
12080
|
type: "button",
|
|
12057
|
-
disabled,
|
|
12081
|
+
disabled: isDisabled,
|
|
12058
12082
|
onClick: (e) => {
|
|
12059
12083
|
e.stopPropagation();
|
|
12060
|
-
if (
|
|
12084
|
+
if (isDisabled || !onPress) {
|
|
12061
12085
|
return;
|
|
12062
12086
|
}
|
|
12063
12087
|
onPress();
|
|
@@ -12065,7 +12089,7 @@ var ActionButton = ({ label, onPress, className }) => {
|
|
|
12065
12089
|
className: cn(
|
|
12066
12090
|
"action-menu-btn flex w-full items-center justify-start px-4 py-3 text-left",
|
|
12067
12091
|
"hover:bg-sus-secondary-green-3 hover:not-disabled:text-sus-primary-green-9 text-gray-800",
|
|
12068
|
-
|
|
12092
|
+
isDisabled && "cursor-not-allowed opacity-50 hover:bg-transparent text-gray-400",
|
|
12069
12093
|
className
|
|
12070
12094
|
),
|
|
12071
12095
|
children: label
|
|
@@ -12128,6 +12152,7 @@ var ActionMenu = ({
|
|
|
12128
12152
|
{
|
|
12129
12153
|
className: actionButtonClassName,
|
|
12130
12154
|
label: btn.label,
|
|
12155
|
+
disabled: btn.disabled,
|
|
12131
12156
|
onPress: btn.onPress ? () => {
|
|
12132
12157
|
btn.onPress?.(id);
|
|
12133
12158
|
setOpen(false);
|
|
@@ -12347,13 +12372,13 @@ var useFieldNames = ({
|
|
|
12347
12372
|
fieldNames
|
|
12348
12373
|
}) => {
|
|
12349
12374
|
const { label: labelFieldKey = "label", value: valueFieldKey = "value" } = fieldNames || {};
|
|
12350
|
-
const getLabelField =
|
|
12375
|
+
const getLabelField = React26__default.useCallback(
|
|
12351
12376
|
(option) => {
|
|
12352
12377
|
return option?.[labelFieldKey];
|
|
12353
12378
|
},
|
|
12354
12379
|
[labelFieldKey]
|
|
12355
12380
|
);
|
|
12356
|
-
const getValueField =
|
|
12381
|
+
const getValueField = React26__default.useCallback(
|
|
12357
12382
|
(option) => {
|
|
12358
12383
|
return option?.[valueFieldKey];
|
|
12359
12384
|
},
|
|
@@ -12385,11 +12410,11 @@ var VirtualizedCommand = ({
|
|
|
12385
12410
|
onFocus
|
|
12386
12411
|
}) => {
|
|
12387
12412
|
const { getLabelField, getValueField } = useFieldNames_default({ fieldNames });
|
|
12388
|
-
const internalOptions =
|
|
12389
|
-
const [filteredOptions, setFilteredOptions] =
|
|
12390
|
-
const [focusedIndex, setFocusedIndex] =
|
|
12391
|
-
const [isKeyboardNavActive, setIsKeyboardNavActive] =
|
|
12392
|
-
const parentRef =
|
|
12413
|
+
const internalOptions = React26.useMemo(() => options ?? [], [options]);
|
|
12414
|
+
const [filteredOptions, setFilteredOptions] = React26.useState(internalOptions);
|
|
12415
|
+
const [focusedIndex, setFocusedIndex] = React26.useState(0);
|
|
12416
|
+
const [isKeyboardNavActive, setIsKeyboardNavActive] = React26.useState(false);
|
|
12417
|
+
const parentRef = React26.useRef(null);
|
|
12393
12418
|
const virtualizer = useVirtualizer({
|
|
12394
12419
|
count: filteredOptions.length,
|
|
12395
12420
|
getScrollElement: () => parentRef.current,
|
|
@@ -12397,14 +12422,14 @@ var VirtualizedCommand = ({
|
|
|
12397
12422
|
overscan: 2
|
|
12398
12423
|
});
|
|
12399
12424
|
const virtualOptions = virtualizer.getVirtualItems();
|
|
12400
|
-
const dynamicHeight =
|
|
12425
|
+
const dynamicHeight = React26.useMemo(() => {
|
|
12401
12426
|
const contentHeight = filteredOptions.length * ROW_HEIGHT;
|
|
12402
12427
|
if (contentHeight <= 0) {
|
|
12403
12428
|
return MIN_HEIGHT_EMPTY;
|
|
12404
12429
|
}
|
|
12405
12430
|
return Math.max(ROW_HEIGHT, Math.min(height, contentHeight));
|
|
12406
12431
|
}, [filteredOptions.length, height]);
|
|
12407
|
-
const scrollToIndex =
|
|
12432
|
+
const scrollToIndex = React26.useCallback(
|
|
12408
12433
|
(index) => {
|
|
12409
12434
|
virtualizer.scrollToIndex(index, {
|
|
12410
12435
|
align: "center"
|
|
@@ -12412,7 +12437,7 @@ var VirtualizedCommand = ({
|
|
|
12412
12437
|
},
|
|
12413
12438
|
[virtualizer]
|
|
12414
12439
|
);
|
|
12415
|
-
const handleSearch =
|
|
12440
|
+
const handleSearch = React26.useCallback(
|
|
12416
12441
|
(search) => {
|
|
12417
12442
|
setIsKeyboardNavActive(false);
|
|
12418
12443
|
setFilteredOptions(
|
|
@@ -12427,7 +12452,7 @@ var VirtualizedCommand = ({
|
|
|
12427
12452
|
},
|
|
12428
12453
|
[filterOption, getLabelField, internalOptions]
|
|
12429
12454
|
);
|
|
12430
|
-
const handleKeyDown =
|
|
12455
|
+
const handleKeyDown = React26.useCallback(
|
|
12431
12456
|
(event) => {
|
|
12432
12457
|
switch (event.key) {
|
|
12433
12458
|
case "ArrowDown": {
|
|
@@ -12462,7 +12487,7 @@ var VirtualizedCommand = ({
|
|
|
12462
12487
|
},
|
|
12463
12488
|
[filteredOptions, focusedIndex, getValueField, onSelect, scrollToIndex]
|
|
12464
12489
|
);
|
|
12465
|
-
|
|
12490
|
+
React26.useEffect(() => {
|
|
12466
12491
|
if (value) {
|
|
12467
12492
|
const option = filteredOptions.find((option2) => {
|
|
12468
12493
|
const optionValue = getValueField(option2);
|
|
@@ -12589,13 +12614,13 @@ var ComboboxInner = ({
|
|
|
12589
12614
|
defaultValue,
|
|
12590
12615
|
value
|
|
12591
12616
|
});
|
|
12592
|
-
const currentSelectedOption =
|
|
12617
|
+
const currentSelectedOption = React26.useMemo(() => {
|
|
12593
12618
|
return options?.find((option) => {
|
|
12594
12619
|
const optionValue = getValueField(option);
|
|
12595
12620
|
return optionValue === selectedValue;
|
|
12596
12621
|
});
|
|
12597
12622
|
}, [getValueField, options, selectedValue]);
|
|
12598
|
-
const renderValue =
|
|
12623
|
+
const renderValue = React26.useMemo(() => {
|
|
12599
12624
|
if (!selectedValue) return placeholder2;
|
|
12600
12625
|
if (currentSelectedOption) {
|
|
12601
12626
|
return getLabelField(currentSelectedOption);
|
|
@@ -12605,7 +12630,7 @@ var ComboboxInner = ({
|
|
|
12605
12630
|
}
|
|
12606
12631
|
return null;
|
|
12607
12632
|
}, [currentSelectedOption, getLabelField, placeholder2, selectedValue, showValueWhenNoMatch]);
|
|
12608
|
-
const handleSelect =
|
|
12633
|
+
const handleSelect = React26.useCallback(
|
|
12609
12634
|
(selected, option) => {
|
|
12610
12635
|
setSelectedValue(selected);
|
|
12611
12636
|
setOpenPopover(false);
|
|
@@ -12618,7 +12643,7 @@ var ComboboxInner = ({
|
|
|
12618
12643
|
},
|
|
12619
12644
|
[onOpenChange, onSelect, setOpenPopover, setSelectedValue]
|
|
12620
12645
|
);
|
|
12621
|
-
const handleOpenPopover =
|
|
12646
|
+
const handleOpenPopover = React26.useCallback(
|
|
12622
12647
|
(isOpen) => {
|
|
12623
12648
|
if (disabled) return;
|
|
12624
12649
|
setOpenPopover(isOpen);
|
|
@@ -12628,7 +12653,7 @@ var ComboboxInner = ({
|
|
|
12628
12653
|
},
|
|
12629
12654
|
[disabled, onOpenChange, setOpenPopover]
|
|
12630
12655
|
);
|
|
12631
|
-
const handleClear =
|
|
12656
|
+
const handleClear = React26.useCallback(
|
|
12632
12657
|
(event) => {
|
|
12633
12658
|
event.stopPropagation();
|
|
12634
12659
|
setSelectedValue(void 0);
|
|
@@ -12717,7 +12742,7 @@ var ComboboxInner = ({
|
|
|
12717
12742
|
)
|
|
12718
12743
|
] });
|
|
12719
12744
|
};
|
|
12720
|
-
var Combobox =
|
|
12745
|
+
var Combobox = React26.forwardRef(ComboboxInner);
|
|
12721
12746
|
var Combobox_default = Combobox;
|
|
12722
12747
|
var TruncatedMouseEnterDiv = ({
|
|
12723
12748
|
value,
|