@ceed/cds 1.39.1 → 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 +68 -48
- package/dist/index.js +103 -83
- 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}`,
|
|
@@ -4944,7 +4954,7 @@ var DataTable = forwardRef7(Component);
|
|
|
4944
4954
|
DataTable.displayName = "DataTable";
|
|
4945
4955
|
|
|
4946
4956
|
// src/components/DateRangePicker/DateRangePicker.tsx
|
|
4947
|
-
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";
|
|
4948
4958
|
import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
|
|
4949
4959
|
import CalendarTodayIcon2 from "@mui/icons-material/CalendarToday";
|
|
4950
4960
|
import { styled as styled14, useThemeProps as useThemeProps7 } from "@mui/joy";
|
|
@@ -5151,16 +5161,20 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5151
5161
|
} = props;
|
|
5152
5162
|
const innerRef = useRef8(null);
|
|
5153
5163
|
const buttonRef = useRef8(null);
|
|
5154
|
-
const [
|
|
5164
|
+
const [rawValue, setValue] = useControlledState(
|
|
5155
5165
|
props.value,
|
|
5156
|
-
props.defaultValue
|
|
5157
|
-
useCallback14(
|
|
5166
|
+
props.defaultValue ?? null,
|
|
5167
|
+
useCallback14(
|
|
5168
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
5169
|
+
[props.name, onChange]
|
|
5170
|
+
)
|
|
5158
5171
|
);
|
|
5172
|
+
const value = rawValue ?? "";
|
|
5159
5173
|
const isAlphabeticDisplay = hasAlphabeticMonth2(displayFormat);
|
|
5160
|
-
const [displayValue, setDisplayValue] =
|
|
5174
|
+
const [displayValue, setDisplayValue] = useState10(
|
|
5161
5175
|
() => value ? formatValueString2(parseDates(value, format), displayFormat, locale) : ""
|
|
5162
5176
|
);
|
|
5163
|
-
const [anchorEl, setAnchorEl] =
|
|
5177
|
+
const [anchorEl, setAnchorEl] = useState10(null);
|
|
5164
5178
|
const open = Boolean(anchorEl);
|
|
5165
5179
|
const calendarValue = useMemo12(
|
|
5166
5180
|
() => value ? parseDates(value, format) : void 0,
|
|
@@ -5528,14 +5542,15 @@ var InsetDrawer = styled20(JoyDrawer2)(({ theme }) => ({
|
|
|
5528
5542
|
}));
|
|
5529
5543
|
|
|
5530
5544
|
// src/components/FilterableCheckboxGroup/FilterableCheckboxGroup.tsx
|
|
5531
|
-
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";
|
|
5532
5546
|
import SearchIcon from "@mui/icons-material/Search";
|
|
5533
5547
|
import { useThemeProps as useThemeProps8 } from "@mui/joy";
|
|
5534
5548
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
5549
|
+
var EMPTY_VALUE = [];
|
|
5535
5550
|
function LabelWithTooltip(props) {
|
|
5536
5551
|
const { label, size } = props;
|
|
5537
5552
|
const labelContentRef = useRef9(null);
|
|
5538
|
-
const [isOverflowing, setIsOverflowing] =
|
|
5553
|
+
const [isOverflowing, setIsOverflowing] = useState11(false);
|
|
5539
5554
|
const labelContent = /* @__PURE__ */ React32.createElement(
|
|
5540
5555
|
"span",
|
|
5541
5556
|
{
|
|
@@ -5577,13 +5592,14 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5577
5592
|
maxHeight = 300,
|
|
5578
5593
|
disabled
|
|
5579
5594
|
} = props;
|
|
5580
|
-
const [searchTerm, setSearchTerm] =
|
|
5581
|
-
const [sortedOptions, setSortedOptions] =
|
|
5582
|
-
const [
|
|
5595
|
+
const [searchTerm, setSearchTerm] = useState11("");
|
|
5596
|
+
const [sortedOptions, setSortedOptions] = useState11(options);
|
|
5597
|
+
const [rawValue, setInternalValue] = useControlledState(
|
|
5583
5598
|
value,
|
|
5584
|
-
value ??
|
|
5585
|
-
useCallback15((newValue) => onChange?.(newValue), [onChange])
|
|
5599
|
+
value ?? EMPTY_VALUE,
|
|
5600
|
+
useCallback15((newValue) => onChange?.(newValue ?? []), [onChange])
|
|
5586
5601
|
);
|
|
5602
|
+
const internalValue = rawValue ?? EMPTY_VALUE;
|
|
5587
5603
|
const parentRef = useRef9(null);
|
|
5588
5604
|
const isInitialSortRef = useRef9(false);
|
|
5589
5605
|
const prevOptionsRef = useRef9([...options]);
|
|
@@ -5809,13 +5825,13 @@ function IconMenuButton(props) {
|
|
|
5809
5825
|
IconMenuButton.displayName = "IconMenuButton";
|
|
5810
5826
|
|
|
5811
5827
|
// src/components/Markdown/Markdown.tsx
|
|
5812
|
-
import React34, { lazy, Suspense, useEffect as useEffect10, useState as
|
|
5828
|
+
import React34, { lazy, Suspense, useEffect as useEffect10, useState as useState12 } from "react";
|
|
5813
5829
|
import { Skeleton } from "@mui/joy";
|
|
5814
5830
|
import { Link as Link2 } from "@mui/joy";
|
|
5815
5831
|
import remarkGfm from "remark-gfm";
|
|
5816
5832
|
var LazyReactMarkdown = lazy(() => import("react-markdown"));
|
|
5817
5833
|
var Markdown = (props) => {
|
|
5818
|
-
const [rehypeAccent, setRehypeAccent] =
|
|
5834
|
+
const [rehypeAccent, setRehypeAccent] = useState12(null);
|
|
5819
5835
|
useEffect10(() => {
|
|
5820
5836
|
const loadRehypeAccent = async () => {
|
|
5821
5837
|
const module = await import("./chunks/rehype-accent-FZRUD7VI.js");
|
|
@@ -5997,7 +6013,7 @@ function MenuButton2(props) {
|
|
|
5997
6013
|
MenuButton2.displayName = "MenuButton";
|
|
5998
6014
|
|
|
5999
6015
|
// src/components/MonthPicker/MonthPicker.tsx
|
|
6000
|
-
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";
|
|
6001
6017
|
import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
|
|
6002
6018
|
import { styled as styled21, useThemeProps as useThemeProps9 } from "@mui/joy";
|
|
6003
6019
|
import { FocusTrap as FocusTrap3, ClickAwayListener as ClickAwayListener3, Popper as Popper4 } from "@mui/base";
|
|
@@ -6082,11 +6098,15 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6082
6098
|
} = props;
|
|
6083
6099
|
const innerRef = useRef10(null);
|
|
6084
6100
|
const buttonRef = useRef10(null);
|
|
6085
|
-
const [
|
|
6101
|
+
const [rawValue, setValue, isControlled] = useControlledState(
|
|
6086
6102
|
props.value,
|
|
6087
|
-
props.defaultValue
|
|
6088
|
-
useCallback16(
|
|
6103
|
+
props.defaultValue ?? null,
|
|
6104
|
+
useCallback16(
|
|
6105
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
6106
|
+
[props.name, onChange]
|
|
6107
|
+
)
|
|
6089
6108
|
);
|
|
6109
|
+
const value = rawValue ?? "";
|
|
6090
6110
|
const getFormattedDisplayValue = useCallback16(
|
|
6091
6111
|
(inputValue) => {
|
|
6092
6112
|
if (!inputValue) return "";
|
|
@@ -6098,8 +6118,8 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6098
6118
|
},
|
|
6099
6119
|
[format, displayFormat, locale]
|
|
6100
6120
|
);
|
|
6101
|
-
const [displayValue, setDisplayValue] =
|
|
6102
|
-
const [anchorEl, setAnchorEl] =
|
|
6121
|
+
const [displayValue, setDisplayValue] = useState13(() => getFormattedDisplayValue(value));
|
|
6122
|
+
const [anchorEl, setAnchorEl] = useState13(null);
|
|
6103
6123
|
const open = Boolean(anchorEl);
|
|
6104
6124
|
useEffect11(() => {
|
|
6105
6125
|
if (!anchorEl) {
|
|
@@ -6251,7 +6271,7 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6251
6271
|
});
|
|
6252
6272
|
|
|
6253
6273
|
// src/components/MonthRangePicker/MonthRangePicker.tsx
|
|
6254
|
-
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";
|
|
6255
6275
|
import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
|
|
6256
6276
|
import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
|
|
6257
6277
|
import { styled as styled22, useThemeProps as useThemeProps10 } from "@mui/joy";
|
|
@@ -6368,15 +6388,19 @@ var MonthRangePicker = forwardRef10((inProps, ref) => {
|
|
|
6368
6388
|
const isAlphabeticDisplay = hasAlphabeticMonth3(displayFormat);
|
|
6369
6389
|
const innerRef = useRef11(null);
|
|
6370
6390
|
const buttonRef = useRef11(null);
|
|
6371
|
-
const [
|
|
6391
|
+
const [rawValue, setValue] = useControlledState(
|
|
6372
6392
|
props.value,
|
|
6373
|
-
props.defaultValue
|
|
6374
|
-
useCallback17(
|
|
6393
|
+
props.defaultValue ?? null,
|
|
6394
|
+
useCallback17(
|
|
6395
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
6396
|
+
[props.name, onChange]
|
|
6397
|
+
)
|
|
6375
6398
|
);
|
|
6376
|
-
const
|
|
6399
|
+
const value = rawValue ?? "";
|
|
6400
|
+
const [displayValue, setDisplayValue] = useState14(
|
|
6377
6401
|
() => value ? formatValueString4(parseDates2(value), displayFormat, locale) : ""
|
|
6378
6402
|
);
|
|
6379
|
-
const [anchorEl, setAnchorEl] =
|
|
6403
|
+
const [anchorEl, setAnchorEl] = useState14(null);
|
|
6380
6404
|
const open = Boolean(anchorEl);
|
|
6381
6405
|
const calendarValue = useMemo14(() => value ? parseDates2(value) : void 0, [value]);
|
|
6382
6406
|
useEffect12(() => {
|
|
@@ -6661,7 +6685,7 @@ function Navigator(props) {
|
|
|
6661
6685
|
Navigator.displayName = "Navigator";
|
|
6662
6686
|
|
|
6663
6687
|
// src/components/PercentageInput/PercentageInput.tsx
|
|
6664
|
-
import React41, { useCallback as useCallback18, useMemo as useMemo15
|
|
6688
|
+
import React41, { useCallback as useCallback18, useMemo as useMemo15 } from "react";
|
|
6665
6689
|
import { NumericFormat as NumericFormat2 } from "react-number-format";
|
|
6666
6690
|
import { styled as styled25, useThemeProps as useThemeProps11 } from "@mui/joy";
|
|
6667
6691
|
var padDecimal = (value, decimalScale) => {
|
|
@@ -6717,34 +6741,30 @@ var PercentageInput = React41.forwardRef(
|
|
|
6717
6741
|
} = props;
|
|
6718
6742
|
const [_value, setValue] = useControlledState(
|
|
6719
6743
|
props.value,
|
|
6720
|
-
props.defaultValue,
|
|
6744
|
+
props.defaultValue ?? null,
|
|
6721
6745
|
useCallback18((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
6722
6746
|
);
|
|
6723
|
-
const [internalError, setInternalError] = useState16(
|
|
6724
|
-
max && _value && _value > max || min && _value && _value < min
|
|
6725
|
-
);
|
|
6726
6747
|
const value = useMemo15(() => {
|
|
6727
6748
|
if (_value && useMinorUnit) {
|
|
6728
6749
|
return _value / Math.pow(10, maxDecimalScale);
|
|
6729
6750
|
}
|
|
6730
6751
|
return _value;
|
|
6731
6752
|
}, [_value, useMinorUnit, maxDecimalScale]);
|
|
6753
|
+
const internalError = useMemo15(
|
|
6754
|
+
() => value != null && (max != null && value > max || min != null && value < min),
|
|
6755
|
+
[max, min, value]
|
|
6756
|
+
);
|
|
6732
6757
|
const handleChange = useCallback18(
|
|
6733
6758
|
(event) => {
|
|
6734
6759
|
if (event.target.value === "") {
|
|
6735
|
-
setValue(
|
|
6760
|
+
setValue(null);
|
|
6736
6761
|
return;
|
|
6737
6762
|
}
|
|
6738
6763
|
const originalAmount = Number(event.target.value);
|
|
6739
|
-
if (min && originalAmount < min || max && originalAmount > max) {
|
|
6740
|
-
setInternalError(true);
|
|
6741
|
-
} else {
|
|
6742
|
-
setInternalError(false);
|
|
6743
|
-
}
|
|
6744
6764
|
const amount = useMinorUnit ? padDecimal(originalAmount, maxDecimalScale) : originalAmount;
|
|
6745
6765
|
setValue(amount);
|
|
6746
6766
|
},
|
|
6747
|
-
[setValue, useMinorUnit, maxDecimalScale
|
|
6767
|
+
[setValue, useMinorUnit, maxDecimalScale]
|
|
6748
6768
|
);
|
|
6749
6769
|
return /* @__PURE__ */ React41.createElement(
|
|
6750
6770
|
PercentageInputRoot,
|
|
@@ -7496,7 +7516,7 @@ function ThemeProvider(props) {
|
|
|
7496
7516
|
ThemeProvider.displayName = "ThemeProvider";
|
|
7497
7517
|
|
|
7498
7518
|
// src/components/Uploader/Uploader.tsx
|
|
7499
|
-
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";
|
|
7500
7520
|
import { styled as styled31, Input as Input2 } from "@mui/joy";
|
|
7501
7521
|
import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
|
|
7502
7522
|
import MuiUploadFileIcon from "@mui/icons-material/UploadFileRounded";
|
|
@@ -7646,10 +7666,10 @@ var Uploader = React49.memo((props) => {
|
|
|
7646
7666
|
} = props;
|
|
7647
7667
|
const dropZoneRef = useRef12(null);
|
|
7648
7668
|
const inputRef = useRef12(null);
|
|
7649
|
-
const [errorText, setErrorText] =
|
|
7650
|
-
const [files, setFiles] =
|
|
7651
|
-
const [uploaded, setUploaded] =
|
|
7652
|
-
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");
|
|
7653
7673
|
const accepts = useMemo16(() => accept.split(",").map((accept2) => accept2.trim()), [accept]);
|
|
7654
7674
|
const parsedAccepts = useMemo16(
|
|
7655
7675
|
() => accepts.flatMap((type) => {
|