@ceed/cds 1.39.0 → 1.40.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/components/Autocomplete/Autocomplete.d.ts +11 -3
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +10 -2
- package/dist/components/DatePicker/DatePicker.d.ts +4 -1
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +4 -1
- package/dist/components/FilterableCheckboxGroup/FilterableCheckboxGroup.d.ts +5 -1
- package/dist/components/Input/Input.d.ts +6 -1
- package/dist/components/MonthPicker/MonthPicker.d.ts +5 -1
- package/dist/components/MonthRangePicker/MonthRangePicker.d.ts +5 -1
- package/dist/components/PercentageInput/PercentageInput.d.ts +10 -2
- package/dist/components/inputs/Autocomplete.md +37 -33
- package/dist/components/inputs/CurrencyInput.md +46 -17
- package/dist/components/inputs/DatePicker.md +4 -2
- package/dist/components/inputs/DateRangePicker.md +4 -2
- package/dist/components/inputs/FilterableCheckboxGroup.md +3 -1
- package/dist/components/inputs/Input.md +32 -3
- package/dist/components/inputs/MonthPicker.md +4 -2
- package/dist/components/inputs/MonthRangePicker.md +4 -2
- package/dist/components/inputs/PercentageInput.md +20 -18
- package/dist/hooks/use-controlled-state/index.d.ts +13 -0
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +3 -3
- package/dist/index.cjs +72 -50
- package/dist/index.js +107 -85
- package/framer/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -270,13 +270,17 @@ var IconButton_default = IconButton;
|
|
|
270
270
|
import { useState, useCallback, useEffect, useRef } from "react";
|
|
271
271
|
function useControlledState(controlledValue, defaultValue, onChange) {
|
|
272
272
|
const { current: isControlled } = useRef(controlledValue !== void 0);
|
|
273
|
-
const [internalValue, setInternalValue] = useState(controlledValue
|
|
274
|
-
const
|
|
273
|
+
const [internalValue, setInternalValue] = useState(controlledValue !== void 0 ? controlledValue : defaultValue);
|
|
274
|
+
const hasWarnedRef = useRef(false);
|
|
275
275
|
useEffect(() => {
|
|
276
|
-
if (
|
|
277
|
-
|
|
278
|
-
|
|
276
|
+
if (false) return;
|
|
277
|
+
if (hasWarnedRef.current || isControlled === (controlledValue !== void 0)) return;
|
|
278
|
+
hasWarnedRef.current = true;
|
|
279
|
+
console.warn(
|
|
280
|
+
isControlled ? "useControlledState: A component is changing a controlled input to be uncontrolled. Pass `null` instead of `undefined` to keep it controlled with an empty value." : "useControlledState: A component is changing an uncontrolled input to be controlled. Pass `null` instead of `undefined` for the initial empty value to make it controlled from the first render."
|
|
281
|
+
);
|
|
279
282
|
}, [isControlled, controlledValue]);
|
|
283
|
+
const displayValue = isControlled ? controlledValue : internalValue;
|
|
280
284
|
const handleChange = useCallback(
|
|
281
285
|
(value) => {
|
|
282
286
|
const newValue = typeof value === "function" ? value(displayValue) : value;
|
|
@@ -383,6 +387,7 @@ var AutocompleteListBox = React5.forwardRef((props, ref) => {
|
|
|
383
387
|
)
|
|
384
388
|
))));
|
|
385
389
|
});
|
|
390
|
+
var EMPTY_MULTIPLE_VALUE = [];
|
|
386
391
|
var autocompleteDeleteSize = {
|
|
387
392
|
sm: "20px",
|
|
388
393
|
md: "24px",
|
|
@@ -425,9 +430,9 @@ function Autocomplete(props) {
|
|
|
425
430
|
className,
|
|
426
431
|
...innerProps
|
|
427
432
|
} = props;
|
|
428
|
-
const [
|
|
433
|
+
const [rawValue, setValue] = useControlledState(
|
|
429
434
|
props.value,
|
|
430
|
-
props.defaultValue
|
|
435
|
+
props.defaultValue ?? null,
|
|
431
436
|
useCallback2(
|
|
432
437
|
(value2) => onChange?.({
|
|
433
438
|
target: {
|
|
@@ -438,6 +443,7 @@ function Autocomplete(props) {
|
|
|
438
443
|
[onChange, props.name]
|
|
439
444
|
)
|
|
440
445
|
);
|
|
446
|
+
const _value = rawValue ?? (props.multiple ? EMPTY_MULTIPLE_VALUE : "");
|
|
441
447
|
const options = useMemo(
|
|
442
448
|
() => props.options.map((option) => {
|
|
443
449
|
if (typeof option !== "object") {
|
|
@@ -498,7 +504,7 @@ function Autocomplete(props) {
|
|
|
498
504
|
(event, value2) => {
|
|
499
505
|
const newValue = value2;
|
|
500
506
|
const _value2 = Array.isArray(newValue) ? newValue.map((value3) => value3.value) : newValue?.value;
|
|
501
|
-
setValue(_value2);
|
|
507
|
+
setValue(_value2 ?? null);
|
|
502
508
|
if (Array.isArray(newValue) && newValue.map((value3) => optionMap.get(value3.value)) || optionMap.get(newValue?.value)) {
|
|
503
509
|
onChangeComplete?.({
|
|
504
510
|
...event,
|
|
@@ -1806,7 +1812,7 @@ var Container = forwardRef5(function Container2(props, ref) {
|
|
|
1806
1812
|
Container.displayName = "Container";
|
|
1807
1813
|
|
|
1808
1814
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1809
|
-
import React17, { useCallback as useCallback8, useMemo as useMemo6
|
|
1815
|
+
import React17, { useCallback as useCallback8, useMemo as useMemo6 } from "react";
|
|
1810
1816
|
import { NumericFormat } from "react-number-format";
|
|
1811
1817
|
|
|
1812
1818
|
// src/components/Input/Input.tsx
|
|
@@ -1830,6 +1836,10 @@ var Input = React16.forwardRef((props, ref) => {
|
|
|
1830
1836
|
onChange,
|
|
1831
1837
|
name,
|
|
1832
1838
|
type,
|
|
1839
|
+
// NOTE: value/defaultValue는 아래에서 직접 다루므로 innerProps 스프레드에서 제외한다.
|
|
1840
|
+
// defaultValue가 스프레드에 남으면 항상 정의되는 value와 함께 DOM input에 도달해 React가 경고한다.
|
|
1841
|
+
value: valueProp,
|
|
1842
|
+
defaultValue: defaultValueProp,
|
|
1833
1843
|
// NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
|
|
1834
1844
|
sx,
|
|
1835
1845
|
className,
|
|
@@ -1842,8 +1852,8 @@ var Input = React16.forwardRef((props, ref) => {
|
|
|
1842
1852
|
}
|
|
1843
1853
|
const [passwordVisible, setPasswordVisible] = useState6(false);
|
|
1844
1854
|
const [value, setValue] = useControlledState(
|
|
1845
|
-
|
|
1846
|
-
|
|
1855
|
+
valueProp,
|
|
1856
|
+
defaultValueProp ?? null,
|
|
1847
1857
|
useCallback7(
|
|
1848
1858
|
(value2) => {
|
|
1849
1859
|
onChange?.({
|
|
@@ -1862,8 +1872,9 @@ var Input = React16.forwardRef((props, ref) => {
|
|
|
1862
1872
|
setValue(e.target.value);
|
|
1863
1873
|
};
|
|
1864
1874
|
const handleClear = () => {
|
|
1865
|
-
setValue(
|
|
1875
|
+
setValue(defaultValueProp || "");
|
|
1866
1876
|
};
|
|
1877
|
+
const displayValue = valueProp !== void 0 ? valueProp : value;
|
|
1867
1878
|
const handleTogglePasswordVisibility = () => {
|
|
1868
1879
|
setPasswordVisible((prev) => !prev);
|
|
1869
1880
|
};
|
|
@@ -1873,7 +1884,7 @@ var Input = React16.forwardRef((props, ref) => {
|
|
|
1873
1884
|
const input = /* @__PURE__ */ React16.createElement(
|
|
1874
1885
|
MotionInput,
|
|
1875
1886
|
{
|
|
1876
|
-
value,
|
|
1887
|
+
value: displayValue ?? "",
|
|
1877
1888
|
name,
|
|
1878
1889
|
onChange: handleChange,
|
|
1879
1890
|
required,
|
|
@@ -1894,7 +1905,7 @@ var Input = React16.forwardRef((props, ref) => {
|
|
|
1894
1905
|
"aria-label": passwordVisible ? "Hide password" : "Show password"
|
|
1895
1906
|
},
|
|
1896
1907
|
passwordVisible ? /* @__PURE__ */ React16.createElement(VisibilityOffIcon, null) : /* @__PURE__ */ React16.createElement(VisibilityIcon, null)
|
|
1897
|
-
)) : null : enableClearable ? /* @__PURE__ */ React16.createElement(Stack_default, { gap: 1, direction: "row" }, innerProps.endDecorator,
|
|
1908
|
+
)) : null : enableClearable ? /* @__PURE__ */ React16.createElement(Stack_default, { gap: 1, direction: "row" }, innerProps.endDecorator, displayValue && /* @__PURE__ */ React16.createElement(
|
|
1898
1909
|
IconButton_default,
|
|
1899
1910
|
{
|
|
1900
1911
|
onMouseDown: (e) => e.preventDefault(),
|
|
@@ -2132,7 +2143,7 @@ var CurrencyInput = React17.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
2132
2143
|
const { symbol, thousandSeparator, decimalSeparator, placeholder, fixedDecimalScale, decimalScale } = useCurrencySetting(props);
|
|
2133
2144
|
const [_value, setValue] = useControlledState(
|
|
2134
2145
|
props.value,
|
|
2135
|
-
props.defaultValue,
|
|
2146
|
+
props.defaultValue ?? null,
|
|
2136
2147
|
useCallback8((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
2137
2148
|
);
|
|
2138
2149
|
const value = useMemo6(() => {
|
|
@@ -2147,22 +2158,17 @@ var CurrencyInput = React17.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
2147
2158
|
}
|
|
2148
2159
|
return props.max;
|
|
2149
2160
|
}, [props.max, useMinorUnit, decimalScale]);
|
|
2150
|
-
const
|
|
2161
|
+
const isOverLimit = useMemo6(() => max != null && value != null && value > max, [max, value]);
|
|
2151
2162
|
const handleChange = useCallback8(
|
|
2152
2163
|
(event) => {
|
|
2153
2164
|
if (event.target.value === "") {
|
|
2154
|
-
setValue(
|
|
2165
|
+
setValue(null);
|
|
2155
2166
|
return;
|
|
2156
2167
|
}
|
|
2157
2168
|
const amount = useMinorUnit ? Number(decimalSeparator ? event.target.value?.replace(decimalSeparator, "") : event.target.value) : Number(event.target.value);
|
|
2158
|
-
if (!!max && Number(event.target.value) > max) {
|
|
2159
|
-
setIsOverLimit(true);
|
|
2160
|
-
} else {
|
|
2161
|
-
setIsOverLimit(false);
|
|
2162
|
-
}
|
|
2163
2169
|
setValue(amount);
|
|
2164
2170
|
},
|
|
2165
|
-
[decimalSeparator,
|
|
2171
|
+
[decimalSeparator, useMinorUnit, setValue]
|
|
2166
2172
|
);
|
|
2167
2173
|
return /* @__PURE__ */ React17.createElement(
|
|
2168
2174
|
CurrencyInputRoot,
|
|
@@ -2626,7 +2632,7 @@ var Resizer = (ref, targetRef = ref, onResizeStateChange, onAutoFit) => /* @__PU
|
|
|
2626
2632
|
// src/components/DataTable/components.tsx
|
|
2627
2633
|
import React23, {
|
|
2628
2634
|
useRef as useRef5,
|
|
2629
|
-
useState as
|
|
2635
|
+
useState as useState8,
|
|
2630
2636
|
useLayoutEffect,
|
|
2631
2637
|
useMemo as useMemo9,
|
|
2632
2638
|
useCallback as useCallback10,
|
|
@@ -2638,7 +2644,7 @@ import { styled as styled12, useTheme } from "@mui/joy";
|
|
|
2638
2644
|
import { AnimatePresence as AnimatePresence2 } from "framer-motion";
|
|
2639
2645
|
|
|
2640
2646
|
// src/components/DatePicker/DatePicker.tsx
|
|
2641
|
-
import React19, { forwardRef as forwardRef6, useCallback as useCallback9, useEffect as useEffect4, useImperativeHandle, useRef as useRef4, useState as
|
|
2647
|
+
import React19, { forwardRef as forwardRef6, useCallback as useCallback9, useEffect as useEffect4, useImperativeHandle, useRef as useRef4, useState as useState7 } from "react";
|
|
2642
2648
|
import { IMaskInput, IMask } from "react-imask";
|
|
2643
2649
|
import CalendarTodayIcon from "@mui/icons-material/CalendarToday";
|
|
2644
2650
|
import { styled as styled10, useThemeProps as useThemeProps5 } from "@mui/joy";
|
|
@@ -2857,16 +2863,20 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2857
2863
|
} = props;
|
|
2858
2864
|
const innerRef = useRef4(null);
|
|
2859
2865
|
const buttonRef = useRef4(null);
|
|
2860
|
-
const [
|
|
2866
|
+
const [rawValue, setValue] = useControlledState(
|
|
2861
2867
|
props.value,
|
|
2862
|
-
props.defaultValue
|
|
2863
|
-
useCallback9(
|
|
2868
|
+
props.defaultValue ?? null,
|
|
2869
|
+
useCallback9(
|
|
2870
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
2871
|
+
[props.name, onChange]
|
|
2872
|
+
)
|
|
2864
2873
|
);
|
|
2874
|
+
const value = rawValue ?? "";
|
|
2865
2875
|
const isAlphabeticDisplay = hasAlphabeticMonth(displayFormat);
|
|
2866
|
-
const [displayValue, setDisplayValue] =
|
|
2876
|
+
const [displayValue, setDisplayValue] = useState7(
|
|
2867
2877
|
() => value ? formatValueString(parseDate(value, format), displayFormat, locale) : ""
|
|
2868
2878
|
);
|
|
2869
|
-
const [anchorEl, setAnchorEl] =
|
|
2879
|
+
const [anchorEl, setAnchorEl] = useState7(null);
|
|
2870
2880
|
const open = Boolean(anchorEl);
|
|
2871
2881
|
useEffect4(() => {
|
|
2872
2882
|
if (!anchorEl) {
|
|
@@ -3319,7 +3329,7 @@ var TextEllipsis = ({
|
|
|
3319
3329
|
...rest
|
|
3320
3330
|
}) => {
|
|
3321
3331
|
const textRef = useRef5(null);
|
|
3322
|
-
const [showTooltip, setShowTooltip] =
|
|
3332
|
+
const [showTooltip, setShowTooltip] = useState8(false);
|
|
3323
3333
|
useLayoutEffect(() => {
|
|
3324
3334
|
const element = textRef.current;
|
|
3325
3335
|
if (!element) return;
|
|
@@ -3336,7 +3346,7 @@ var TextEllipsis = ({
|
|
|
3336
3346
|
};
|
|
3337
3347
|
var CellTextEllipsis = ({ children }) => {
|
|
3338
3348
|
const textRef = useRef5(null);
|
|
3339
|
-
const [showTooltip, setShowTooltip] =
|
|
3349
|
+
const [showTooltip, setShowTooltip] = useState8(false);
|
|
3340
3350
|
useLayoutEffect(() => {
|
|
3341
3351
|
const element = textRef.current;
|
|
3342
3352
|
if (element) {
|
|
@@ -3394,7 +3404,7 @@ var HeadCell = (props) => {
|
|
|
3394
3404
|
useLayoutEffect(() => {
|
|
3395
3405
|
ref.current = localRef.current;
|
|
3396
3406
|
}, [ref]);
|
|
3397
|
-
const [isHovered, setIsHovered] =
|
|
3407
|
+
const [isHovered, setIsHovered] = useState8(false);
|
|
3398
3408
|
const sortable = type === "actions" ? false : _sortable;
|
|
3399
3409
|
const headId = useMemo9(
|
|
3400
3410
|
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
@@ -3523,7 +3533,7 @@ var BodyCell = (props) => {
|
|
|
3523
3533
|
onCellEditStop
|
|
3524
3534
|
} = props;
|
|
3525
3535
|
const theme = useTheme();
|
|
3526
|
-
const [value, setValue] =
|
|
3536
|
+
const [value, setValue] = useState8(row[field]);
|
|
3527
3537
|
const cellRef = useRef5(null);
|
|
3528
3538
|
const params = useMemo9(
|
|
3529
3539
|
() => ({
|
|
@@ -3745,9 +3755,9 @@ var VirtualizedTableRow = memo(StyledTableRow2, (prevProps, nextProps) => {
|
|
|
3745
3755
|
});
|
|
3746
3756
|
|
|
3747
3757
|
// src/components/DataTable/hooks.ts
|
|
3748
|
-
import { useState as
|
|
3758
|
+
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useMemo as useMemo10, useCallback as useCallback11, useEffect as useEffect6, createRef } from "react";
|
|
3749
3759
|
function useColumnWidths(columnsByField) {
|
|
3750
|
-
const [widths, setWidths] =
|
|
3760
|
+
const [widths, setWidths] = useState9({});
|
|
3751
3761
|
const roRef = useRef6();
|
|
3752
3762
|
useLayoutEffect2(() => {
|
|
3753
3763
|
if (roRef.current) roRef.current.disconnect();
|
|
@@ -3808,8 +3818,8 @@ function useDataTableRenderer({
|
|
|
3808
3818
|
}
|
|
3809
3819
|
const onSelectionModelChangeRef = useRef6(onSelectionModelChange);
|
|
3810
3820
|
onSelectionModelChangeRef.current = onSelectionModelChange;
|
|
3811
|
-
const [focusedRowId, setFocusedRowId] =
|
|
3812
|
-
const [selectionAnchor, setSelectionAnchor] =
|
|
3821
|
+
const [focusedRowId, setFocusedRowId] = useState9(null);
|
|
3822
|
+
const [selectionAnchor, setSelectionAnchor] = useState9(null);
|
|
3813
3823
|
const [sortModel, setSortModel] = useControlledState(
|
|
3814
3824
|
controlledSortModel,
|
|
3815
3825
|
initialState?.sorting?.sortModel ?? [],
|
|
@@ -3901,7 +3911,7 @@ function useDataTableRenderer({
|
|
|
3901
3911
|
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3902
3912
|
[_sortOrder]
|
|
3903
3913
|
);
|
|
3904
|
-
const [page, setPage] =
|
|
3914
|
+
const [page, setPage] = useState9(paginationModel?.page || 1);
|
|
3905
3915
|
const pageSize = paginationModel?.pageSize || 20;
|
|
3906
3916
|
const getId = useCallback11(
|
|
3907
3917
|
(row, index) => _getId?.(row) ?? row.id ?? `${(index || 0) + (page - 1) * pageSize}`,
|
|
@@ -3973,8 +3983,10 @@ function useDataTableRenderer({
|
|
|
3973
3983
|
() => pinnedColumns?.right?.filter((f) => visibleFieldSet.has(f)),
|
|
3974
3984
|
[pinnedColumns?.right, visibleFieldSet]
|
|
3975
3985
|
);
|
|
3986
|
+
const inferredFieldsKey = JSON.stringify(Object.keys(rows[0] || {}));
|
|
3987
|
+
const inferredFields = useMemo10(() => JSON.parse(inferredFieldsKey), [inferredFieldsKey]);
|
|
3976
3988
|
const columns = useMemo10(() => {
|
|
3977
|
-
const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] :
|
|
3989
|
+
const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] : inferredFields.map((key) => ({
|
|
3978
3990
|
field: key
|
|
3979
3991
|
}));
|
|
3980
3992
|
return baseColumns.map((column) => {
|
|
@@ -3998,7 +4010,7 @@ function useDataTableRenderer({
|
|
|
3998
4010
|
}, [
|
|
3999
4011
|
visibleColumns,
|
|
4000
4012
|
reorderedColumns,
|
|
4001
|
-
|
|
4013
|
+
inferredFields,
|
|
4002
4014
|
effectivePinnedLeft,
|
|
4003
4015
|
effectivePinnedRight,
|
|
4004
4016
|
visibleColumnsByField,
|
|
@@ -4942,7 +4954,7 @@ var DataTable = forwardRef7(Component);
|
|
|
4942
4954
|
DataTable.displayName = "DataTable";
|
|
4943
4955
|
|
|
4944
4956
|
// src/components/DateRangePicker/DateRangePicker.tsx
|
|
4945
|
-
import React27, { forwardRef as forwardRef8, useCallback as useCallback14, useEffect as useEffect8, useImperativeHandle as useImperativeHandle3, useMemo as useMemo12, useRef as useRef8, useState as
|
|
4957
|
+
import React27, { forwardRef as forwardRef8, useCallback as useCallback14, useEffect as useEffect8, useImperativeHandle as useImperativeHandle3, useMemo as useMemo12, useRef as useRef8, useState as useState10 } from "react";
|
|
4946
4958
|
import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
|
|
4947
4959
|
import CalendarTodayIcon2 from "@mui/icons-material/CalendarToday";
|
|
4948
4960
|
import { styled as styled14, useThemeProps as useThemeProps7 } from "@mui/joy";
|
|
@@ -5149,16 +5161,20 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5149
5161
|
} = props;
|
|
5150
5162
|
const innerRef = useRef8(null);
|
|
5151
5163
|
const buttonRef = useRef8(null);
|
|
5152
|
-
const [
|
|
5164
|
+
const [rawValue, setValue] = useControlledState(
|
|
5153
5165
|
props.value,
|
|
5154
|
-
props.defaultValue
|
|
5155
|
-
useCallback14(
|
|
5166
|
+
props.defaultValue ?? null,
|
|
5167
|
+
useCallback14(
|
|
5168
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
5169
|
+
[props.name, onChange]
|
|
5170
|
+
)
|
|
5156
5171
|
);
|
|
5172
|
+
const value = rawValue ?? "";
|
|
5157
5173
|
const isAlphabeticDisplay = hasAlphabeticMonth2(displayFormat);
|
|
5158
|
-
const [displayValue, setDisplayValue] =
|
|
5174
|
+
const [displayValue, setDisplayValue] = useState10(
|
|
5159
5175
|
() => value ? formatValueString2(parseDates(value, format), displayFormat, locale) : ""
|
|
5160
5176
|
);
|
|
5161
|
-
const [anchorEl, setAnchorEl] =
|
|
5177
|
+
const [anchorEl, setAnchorEl] = useState10(null);
|
|
5162
5178
|
const open = Boolean(anchorEl);
|
|
5163
5179
|
const calendarValue = useMemo12(
|
|
5164
5180
|
() => value ? parseDates(value, format) : void 0,
|
|
@@ -5526,14 +5542,15 @@ var InsetDrawer = styled20(JoyDrawer2)(({ theme }) => ({
|
|
|
5526
5542
|
}));
|
|
5527
5543
|
|
|
5528
5544
|
// src/components/FilterableCheckboxGroup/FilterableCheckboxGroup.tsx
|
|
5529
|
-
import React32, { useCallback as useCallback15, useEffect as useEffect9, useMemo as useMemo13, useRef as useRef9, useState as
|
|
5545
|
+
import React32, { useCallback as useCallback15, useEffect as useEffect9, useMemo as useMemo13, useRef as useRef9, useState as useState11 } from "react";
|
|
5530
5546
|
import SearchIcon from "@mui/icons-material/Search";
|
|
5531
5547
|
import { useThemeProps as useThemeProps8 } from "@mui/joy";
|
|
5532
5548
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
5549
|
+
var EMPTY_VALUE = [];
|
|
5533
5550
|
function LabelWithTooltip(props) {
|
|
5534
5551
|
const { label, size } = props;
|
|
5535
5552
|
const labelContentRef = useRef9(null);
|
|
5536
|
-
const [isOverflowing, setIsOverflowing] =
|
|
5553
|
+
const [isOverflowing, setIsOverflowing] = useState11(false);
|
|
5537
5554
|
const labelContent = /* @__PURE__ */ React32.createElement(
|
|
5538
5555
|
"span",
|
|
5539
5556
|
{
|
|
@@ -5575,13 +5592,14 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5575
5592
|
maxHeight = 300,
|
|
5576
5593
|
disabled
|
|
5577
5594
|
} = props;
|
|
5578
|
-
const [searchTerm, setSearchTerm] =
|
|
5579
|
-
const [sortedOptions, setSortedOptions] =
|
|
5580
|
-
const [
|
|
5595
|
+
const [searchTerm, setSearchTerm] = useState11("");
|
|
5596
|
+
const [sortedOptions, setSortedOptions] = useState11(options);
|
|
5597
|
+
const [rawValue, setInternalValue] = useControlledState(
|
|
5581
5598
|
value,
|
|
5582
|
-
value ??
|
|
5583
|
-
useCallback15((newValue) => onChange?.(newValue), [onChange])
|
|
5599
|
+
value ?? EMPTY_VALUE,
|
|
5600
|
+
useCallback15((newValue) => onChange?.(newValue ?? []), [onChange])
|
|
5584
5601
|
);
|
|
5602
|
+
const internalValue = rawValue ?? EMPTY_VALUE;
|
|
5585
5603
|
const parentRef = useRef9(null);
|
|
5586
5604
|
const isInitialSortRef = useRef9(false);
|
|
5587
5605
|
const prevOptionsRef = useRef9([...options]);
|
|
@@ -5807,13 +5825,13 @@ function IconMenuButton(props) {
|
|
|
5807
5825
|
IconMenuButton.displayName = "IconMenuButton";
|
|
5808
5826
|
|
|
5809
5827
|
// src/components/Markdown/Markdown.tsx
|
|
5810
|
-
import React34, { lazy, Suspense, useEffect as useEffect10, useState as
|
|
5828
|
+
import React34, { lazy, Suspense, useEffect as useEffect10, useState as useState12 } from "react";
|
|
5811
5829
|
import { Skeleton } from "@mui/joy";
|
|
5812
5830
|
import { Link as Link2 } from "@mui/joy";
|
|
5813
5831
|
import remarkGfm from "remark-gfm";
|
|
5814
5832
|
var LazyReactMarkdown = lazy(() => import("react-markdown"));
|
|
5815
5833
|
var Markdown = (props) => {
|
|
5816
|
-
const [rehypeAccent, setRehypeAccent] =
|
|
5834
|
+
const [rehypeAccent, setRehypeAccent] = useState12(null);
|
|
5817
5835
|
useEffect10(() => {
|
|
5818
5836
|
const loadRehypeAccent = async () => {
|
|
5819
5837
|
const module = await import("./chunks/rehype-accent-FZRUD7VI.js");
|
|
@@ -5995,7 +6013,7 @@ function MenuButton2(props) {
|
|
|
5995
6013
|
MenuButton2.displayName = "MenuButton";
|
|
5996
6014
|
|
|
5997
6015
|
// src/components/MonthPicker/MonthPicker.tsx
|
|
5998
|
-
import React36, { forwardRef as forwardRef9, useCallback as useCallback16, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useRef as useRef10, useState as
|
|
6016
|
+
import React36, { forwardRef as forwardRef9, useCallback as useCallback16, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useRef as useRef10, useState as useState13 } from "react";
|
|
5999
6017
|
import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
|
|
6000
6018
|
import { styled as styled21, useThemeProps as useThemeProps9 } from "@mui/joy";
|
|
6001
6019
|
import { FocusTrap as FocusTrap3, ClickAwayListener as ClickAwayListener3, Popper as Popper4 } from "@mui/base";
|
|
@@ -6080,11 +6098,15 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6080
6098
|
} = props;
|
|
6081
6099
|
const innerRef = useRef10(null);
|
|
6082
6100
|
const buttonRef = useRef10(null);
|
|
6083
|
-
const [
|
|
6101
|
+
const [rawValue, setValue, isControlled] = useControlledState(
|
|
6084
6102
|
props.value,
|
|
6085
|
-
props.defaultValue
|
|
6086
|
-
useCallback16(
|
|
6103
|
+
props.defaultValue ?? null,
|
|
6104
|
+
useCallback16(
|
|
6105
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
6106
|
+
[props.name, onChange]
|
|
6107
|
+
)
|
|
6087
6108
|
);
|
|
6109
|
+
const value = rawValue ?? "";
|
|
6088
6110
|
const getFormattedDisplayValue = useCallback16(
|
|
6089
6111
|
(inputValue) => {
|
|
6090
6112
|
if (!inputValue) return "";
|
|
@@ -6096,8 +6118,8 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6096
6118
|
},
|
|
6097
6119
|
[format, displayFormat, locale]
|
|
6098
6120
|
);
|
|
6099
|
-
const [displayValue, setDisplayValue] =
|
|
6100
|
-
const [anchorEl, setAnchorEl] =
|
|
6121
|
+
const [displayValue, setDisplayValue] = useState13(() => getFormattedDisplayValue(value));
|
|
6122
|
+
const [anchorEl, setAnchorEl] = useState13(null);
|
|
6101
6123
|
const open = Boolean(anchorEl);
|
|
6102
6124
|
useEffect11(() => {
|
|
6103
6125
|
if (!anchorEl) {
|
|
@@ -6249,7 +6271,7 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6249
6271
|
});
|
|
6250
6272
|
|
|
6251
6273
|
// src/components/MonthRangePicker/MonthRangePicker.tsx
|
|
6252
|
-
import React37, { forwardRef as forwardRef10, useCallback as useCallback17, useEffect as useEffect12, useImperativeHandle as useImperativeHandle5, useMemo as useMemo14, useRef as useRef11, useState as
|
|
6274
|
+
import React37, { forwardRef as forwardRef10, useCallback as useCallback17, useEffect as useEffect12, useImperativeHandle as useImperativeHandle5, useMemo as useMemo14, useRef as useRef11, useState as useState14 } from "react";
|
|
6253
6275
|
import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
|
|
6254
6276
|
import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
|
|
6255
6277
|
import { styled as styled22, useThemeProps as useThemeProps10 } from "@mui/joy";
|
|
@@ -6366,15 +6388,19 @@ var MonthRangePicker = forwardRef10((inProps, ref) => {
|
|
|
6366
6388
|
const isAlphabeticDisplay = hasAlphabeticMonth3(displayFormat);
|
|
6367
6389
|
const innerRef = useRef11(null);
|
|
6368
6390
|
const buttonRef = useRef11(null);
|
|
6369
|
-
const [
|
|
6391
|
+
const [rawValue, setValue] = useControlledState(
|
|
6370
6392
|
props.value,
|
|
6371
|
-
props.defaultValue
|
|
6372
|
-
useCallback17(
|
|
6393
|
+
props.defaultValue ?? null,
|
|
6394
|
+
useCallback17(
|
|
6395
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
6396
|
+
[props.name, onChange]
|
|
6397
|
+
)
|
|
6373
6398
|
);
|
|
6374
|
-
const
|
|
6399
|
+
const value = rawValue ?? "";
|
|
6400
|
+
const [displayValue, setDisplayValue] = useState14(
|
|
6375
6401
|
() => value ? formatValueString4(parseDates2(value), displayFormat, locale) : ""
|
|
6376
6402
|
);
|
|
6377
|
-
const [anchorEl, setAnchorEl] =
|
|
6403
|
+
const [anchorEl, setAnchorEl] = useState14(null);
|
|
6378
6404
|
const open = Boolean(anchorEl);
|
|
6379
6405
|
const calendarValue = useMemo14(() => value ? parseDates2(value) : void 0, [value]);
|
|
6380
6406
|
useEffect12(() => {
|
|
@@ -6659,7 +6685,7 @@ function Navigator(props) {
|
|
|
6659
6685
|
Navigator.displayName = "Navigator";
|
|
6660
6686
|
|
|
6661
6687
|
// src/components/PercentageInput/PercentageInput.tsx
|
|
6662
|
-
import React41, { useCallback as useCallback18, useMemo as useMemo15
|
|
6688
|
+
import React41, { useCallback as useCallback18, useMemo as useMemo15 } from "react";
|
|
6663
6689
|
import { NumericFormat as NumericFormat2 } from "react-number-format";
|
|
6664
6690
|
import { styled as styled25, useThemeProps as useThemeProps11 } from "@mui/joy";
|
|
6665
6691
|
var padDecimal = (value, decimalScale) => {
|
|
@@ -6715,34 +6741,30 @@ var PercentageInput = React41.forwardRef(
|
|
|
6715
6741
|
} = props;
|
|
6716
6742
|
const [_value, setValue] = useControlledState(
|
|
6717
6743
|
props.value,
|
|
6718
|
-
props.defaultValue,
|
|
6744
|
+
props.defaultValue ?? null,
|
|
6719
6745
|
useCallback18((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
6720
6746
|
);
|
|
6721
|
-
const [internalError, setInternalError] = useState16(
|
|
6722
|
-
max && _value && _value > max || min && _value && _value < min
|
|
6723
|
-
);
|
|
6724
6747
|
const value = useMemo15(() => {
|
|
6725
6748
|
if (_value && useMinorUnit) {
|
|
6726
6749
|
return _value / Math.pow(10, maxDecimalScale);
|
|
6727
6750
|
}
|
|
6728
6751
|
return _value;
|
|
6729
6752
|
}, [_value, useMinorUnit, maxDecimalScale]);
|
|
6753
|
+
const internalError = useMemo15(
|
|
6754
|
+
() => value != null && (max != null && value > max || min != null && value < min),
|
|
6755
|
+
[max, min, value]
|
|
6756
|
+
);
|
|
6730
6757
|
const handleChange = useCallback18(
|
|
6731
6758
|
(event) => {
|
|
6732
6759
|
if (event.target.value === "") {
|
|
6733
|
-
setValue(
|
|
6760
|
+
setValue(null);
|
|
6734
6761
|
return;
|
|
6735
6762
|
}
|
|
6736
6763
|
const originalAmount = Number(event.target.value);
|
|
6737
|
-
if (min && originalAmount < min || max && originalAmount > max) {
|
|
6738
|
-
setInternalError(true);
|
|
6739
|
-
} else {
|
|
6740
|
-
setInternalError(false);
|
|
6741
|
-
}
|
|
6742
6764
|
const amount = useMinorUnit ? padDecimal(originalAmount, maxDecimalScale) : originalAmount;
|
|
6743
6765
|
setValue(amount);
|
|
6744
6766
|
},
|
|
6745
|
-
[setValue, useMinorUnit, maxDecimalScale
|
|
6767
|
+
[setValue, useMinorUnit, maxDecimalScale]
|
|
6746
6768
|
);
|
|
6747
6769
|
return /* @__PURE__ */ React41.createElement(
|
|
6748
6770
|
PercentageInputRoot,
|
|
@@ -7494,7 +7516,7 @@ function ThemeProvider(props) {
|
|
|
7494
7516
|
ThemeProvider.displayName = "ThemeProvider";
|
|
7495
7517
|
|
|
7496
7518
|
// src/components/Uploader/Uploader.tsx
|
|
7497
|
-
import React49, { useCallback as useCallback19, useEffect as useEffect13, useMemo as useMemo16, useRef as useRef12, useState as
|
|
7519
|
+
import React49, { useCallback as useCallback19, useEffect as useEffect13, useMemo as useMemo16, useRef as useRef12, useState as useState16 } from "react";
|
|
7498
7520
|
import { styled as styled31, Input as Input2 } from "@mui/joy";
|
|
7499
7521
|
import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
|
|
7500
7522
|
import MuiUploadFileIcon from "@mui/icons-material/UploadFileRounded";
|
|
@@ -7644,10 +7666,10 @@ var Uploader = React49.memo((props) => {
|
|
|
7644
7666
|
} = props;
|
|
7645
7667
|
const dropZoneRef = useRef12(null);
|
|
7646
7668
|
const inputRef = useRef12(null);
|
|
7647
|
-
const [errorText, setErrorText] =
|
|
7648
|
-
const [files, setFiles] =
|
|
7649
|
-
const [uploaded, setUploaded] =
|
|
7650
|
-
const [previewState, setPreviewState] =
|
|
7669
|
+
const [errorText, setErrorText] = useState16();
|
|
7670
|
+
const [files, setFiles] = useState16([]);
|
|
7671
|
+
const [uploaded, setUploaded] = useState16(props.uploaded || []);
|
|
7672
|
+
const [previewState, setPreviewState] = useState16("idle");
|
|
7651
7673
|
const accepts = useMemo16(() => accept.split(",").map((accept2) => accept2.trim()), [accept]);
|
|
7652
7674
|
const parsedAccepts = useMemo16(
|
|
7653
7675
|
() => accepts.flatMap((type) => {
|