@ceed/cds 1.39.1 → 1.40.1
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/data-display/DataTable.md +89 -0
- 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 +81 -53
- package/dist/index.js +116 -88
- 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}`,
|
|
@@ -4580,7 +4590,8 @@ function Component(props, apiRef) {
|
|
|
4580
4590
|
const totalSize = virtualizer.getTotalSize();
|
|
4581
4591
|
const virtualizedItems = virtualizer.getVirtualItems();
|
|
4582
4592
|
const showNoRowsOverlay = !loading && rowCount === 0;
|
|
4583
|
-
const
|
|
4593
|
+
const showFillerColumn = columns.length > 0 && columns.every((c) => !!c.width);
|
|
4594
|
+
const totalColCount = Math.max(1, columns.length + (checkboxSelection ? 1 : 0) + (showFillerColumn ? 1 : 0));
|
|
4584
4595
|
const getRowClickHandler = useCallback13(
|
|
4585
4596
|
(row, rowId) => (e) => {
|
|
4586
4597
|
onRowClick?.({ row, rowId }, e);
|
|
@@ -4771,7 +4782,7 @@ function Component(props, apiRef) {
|
|
|
4771
4782
|
minWidth: c.minWidth ?? "50px"
|
|
4772
4783
|
}
|
|
4773
4784
|
}
|
|
4774
|
-
))), /* @__PURE__ */ React26.createElement("thead", null, processedColumnGroups && processedColumnGroups.groups.length > 0 && processedColumnGroups.groups.map((levelGroups, level) => /* @__PURE__ */ React26.createElement("tr", { key: `group-level-${level}` }, checkboxSelection && level === 0 && /* @__PURE__ */ React26.createElement(
|
|
4785
|
+
)), showFillerColumn && /* @__PURE__ */ React26.createElement("col", { style: { minWidth: 0 } })), /* @__PURE__ */ React26.createElement("thead", null, processedColumnGroups && processedColumnGroups.groups.length > 0 && processedColumnGroups.groups.map((levelGroups, level) => /* @__PURE__ */ React26.createElement("tr", { key: `group-level-${level}` }, checkboxSelection && level === 0 && /* @__PURE__ */ React26.createElement(
|
|
4775
4786
|
"th",
|
|
4776
4787
|
{
|
|
4777
4788
|
rowSpan: processedColumnGroups.maxLevel + 2,
|
|
@@ -4800,7 +4811,13 @@ function Component(props, apiRef) {
|
|
|
4800
4811
|
},
|
|
4801
4812
|
group.headerName ?? group.groupId
|
|
4802
4813
|
), emptyCells > 0 && Array.from({ length: emptyCells }).map((_2, i) => /* @__PURE__ */ React26.createElement("th", { key: `empty-between-${level}-${groupIndex}-${i}`, colSpan: 1 })));
|
|
4803
|
-
})
|
|
4814
|
+
}), showFillerColumn && level === 0 && /* @__PURE__ */ React26.createElement(
|
|
4815
|
+
"th",
|
|
4816
|
+
{
|
|
4817
|
+
"aria-hidden": "true",
|
|
4818
|
+
rowSpan: processedColumnGroups.maxLevel + 2
|
|
4819
|
+
}
|
|
4820
|
+
))), /* @__PURE__ */ React26.createElement("tr", null, (!processedColumnGroups || processedColumnGroups.groups.length === 0) && checkboxSelection && /* @__PURE__ */ React26.createElement(
|
|
4804
4821
|
"th",
|
|
4805
4822
|
{
|
|
4806
4823
|
style: {
|
|
@@ -4823,7 +4840,7 @@ function Component(props, apiRef) {
|
|
|
4823
4840
|
...c
|
|
4824
4841
|
}
|
|
4825
4842
|
)
|
|
4826
|
-
)))), /* @__PURE__ */ React26.createElement(
|
|
4843
|
+
)), showFillerColumn && (!processedColumnGroups || processedColumnGroups.groups.length === 0) && /* @__PURE__ */ React26.createElement("th", { "aria-hidden": "true" }))), /* @__PURE__ */ React26.createElement(
|
|
4827
4844
|
VirtualizedTableBody,
|
|
4828
4845
|
{
|
|
4829
4846
|
ref: tableBodyRef,
|
|
@@ -4922,7 +4939,8 @@ function Component(props, apiRef) {
|
|
|
4922
4939
|
editMode,
|
|
4923
4940
|
noWrap: props.noWrap
|
|
4924
4941
|
}
|
|
4925
|
-
)
|
|
4942
|
+
),
|
|
4943
|
+
showFillerColumn && /* @__PURE__ */ React26.createElement("td", { "aria-hidden": "true" })
|
|
4926
4944
|
);
|
|
4927
4945
|
})
|
|
4928
4946
|
), Footer && /* @__PURE__ */ React26.createElement(Footer, null))
|
|
@@ -4944,7 +4962,7 @@ var DataTable = forwardRef7(Component);
|
|
|
4944
4962
|
DataTable.displayName = "DataTable";
|
|
4945
4963
|
|
|
4946
4964
|
// 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
|
|
4965
|
+
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
4966
|
import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
|
|
4949
4967
|
import CalendarTodayIcon2 from "@mui/icons-material/CalendarToday";
|
|
4950
4968
|
import { styled as styled14, useThemeProps as useThemeProps7 } from "@mui/joy";
|
|
@@ -5151,16 +5169,20 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5151
5169
|
} = props;
|
|
5152
5170
|
const innerRef = useRef8(null);
|
|
5153
5171
|
const buttonRef = useRef8(null);
|
|
5154
|
-
const [
|
|
5172
|
+
const [rawValue, setValue] = useControlledState(
|
|
5155
5173
|
props.value,
|
|
5156
|
-
props.defaultValue
|
|
5157
|
-
useCallback14(
|
|
5174
|
+
props.defaultValue ?? null,
|
|
5175
|
+
useCallback14(
|
|
5176
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
5177
|
+
[props.name, onChange]
|
|
5178
|
+
)
|
|
5158
5179
|
);
|
|
5180
|
+
const value = rawValue ?? "";
|
|
5159
5181
|
const isAlphabeticDisplay = hasAlphabeticMonth2(displayFormat);
|
|
5160
|
-
const [displayValue, setDisplayValue] =
|
|
5182
|
+
const [displayValue, setDisplayValue] = useState10(
|
|
5161
5183
|
() => value ? formatValueString2(parseDates(value, format), displayFormat, locale) : ""
|
|
5162
5184
|
);
|
|
5163
|
-
const [anchorEl, setAnchorEl] =
|
|
5185
|
+
const [anchorEl, setAnchorEl] = useState10(null);
|
|
5164
5186
|
const open = Boolean(anchorEl);
|
|
5165
5187
|
const calendarValue = useMemo12(
|
|
5166
5188
|
() => value ? parseDates(value, format) : void 0,
|
|
@@ -5528,14 +5550,15 @@ var InsetDrawer = styled20(JoyDrawer2)(({ theme }) => ({
|
|
|
5528
5550
|
}));
|
|
5529
5551
|
|
|
5530
5552
|
// src/components/FilterableCheckboxGroup/FilterableCheckboxGroup.tsx
|
|
5531
|
-
import React32, { useCallback as useCallback15, useEffect as useEffect9, useMemo as useMemo13, useRef as useRef9, useState as
|
|
5553
|
+
import React32, { useCallback as useCallback15, useEffect as useEffect9, useMemo as useMemo13, useRef as useRef9, useState as useState11 } from "react";
|
|
5532
5554
|
import SearchIcon from "@mui/icons-material/Search";
|
|
5533
5555
|
import { useThemeProps as useThemeProps8 } from "@mui/joy";
|
|
5534
5556
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
5557
|
+
var EMPTY_VALUE = [];
|
|
5535
5558
|
function LabelWithTooltip(props) {
|
|
5536
5559
|
const { label, size } = props;
|
|
5537
5560
|
const labelContentRef = useRef9(null);
|
|
5538
|
-
const [isOverflowing, setIsOverflowing] =
|
|
5561
|
+
const [isOverflowing, setIsOverflowing] = useState11(false);
|
|
5539
5562
|
const labelContent = /* @__PURE__ */ React32.createElement(
|
|
5540
5563
|
"span",
|
|
5541
5564
|
{
|
|
@@ -5577,13 +5600,14 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5577
5600
|
maxHeight = 300,
|
|
5578
5601
|
disabled
|
|
5579
5602
|
} = props;
|
|
5580
|
-
const [searchTerm, setSearchTerm] =
|
|
5581
|
-
const [sortedOptions, setSortedOptions] =
|
|
5582
|
-
const [
|
|
5603
|
+
const [searchTerm, setSearchTerm] = useState11("");
|
|
5604
|
+
const [sortedOptions, setSortedOptions] = useState11(options);
|
|
5605
|
+
const [rawValue, setInternalValue] = useControlledState(
|
|
5583
5606
|
value,
|
|
5584
|
-
value ??
|
|
5585
|
-
useCallback15((newValue) => onChange?.(newValue), [onChange])
|
|
5607
|
+
value ?? EMPTY_VALUE,
|
|
5608
|
+
useCallback15((newValue) => onChange?.(newValue ?? []), [onChange])
|
|
5586
5609
|
);
|
|
5610
|
+
const internalValue = rawValue ?? EMPTY_VALUE;
|
|
5587
5611
|
const parentRef = useRef9(null);
|
|
5588
5612
|
const isInitialSortRef = useRef9(false);
|
|
5589
5613
|
const prevOptionsRef = useRef9([...options]);
|
|
@@ -5809,13 +5833,13 @@ function IconMenuButton(props) {
|
|
|
5809
5833
|
IconMenuButton.displayName = "IconMenuButton";
|
|
5810
5834
|
|
|
5811
5835
|
// src/components/Markdown/Markdown.tsx
|
|
5812
|
-
import React34, { lazy, Suspense, useEffect as useEffect10, useState as
|
|
5836
|
+
import React34, { lazy, Suspense, useEffect as useEffect10, useState as useState12 } from "react";
|
|
5813
5837
|
import { Skeleton } from "@mui/joy";
|
|
5814
5838
|
import { Link as Link2 } from "@mui/joy";
|
|
5815
5839
|
import remarkGfm from "remark-gfm";
|
|
5816
5840
|
var LazyReactMarkdown = lazy(() => import("react-markdown"));
|
|
5817
5841
|
var Markdown = (props) => {
|
|
5818
|
-
const [rehypeAccent, setRehypeAccent] =
|
|
5842
|
+
const [rehypeAccent, setRehypeAccent] = useState12(null);
|
|
5819
5843
|
useEffect10(() => {
|
|
5820
5844
|
const loadRehypeAccent = async () => {
|
|
5821
5845
|
const module = await import("./chunks/rehype-accent-FZRUD7VI.js");
|
|
@@ -5997,7 +6021,7 @@ function MenuButton2(props) {
|
|
|
5997
6021
|
MenuButton2.displayName = "MenuButton";
|
|
5998
6022
|
|
|
5999
6023
|
// 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
|
|
6024
|
+
import React36, { forwardRef as forwardRef9, useCallback as useCallback16, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useRef as useRef10, useState as useState13 } from "react";
|
|
6001
6025
|
import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
|
|
6002
6026
|
import { styled as styled21, useThemeProps as useThemeProps9 } from "@mui/joy";
|
|
6003
6027
|
import { FocusTrap as FocusTrap3, ClickAwayListener as ClickAwayListener3, Popper as Popper4 } from "@mui/base";
|
|
@@ -6082,11 +6106,15 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6082
6106
|
} = props;
|
|
6083
6107
|
const innerRef = useRef10(null);
|
|
6084
6108
|
const buttonRef = useRef10(null);
|
|
6085
|
-
const [
|
|
6109
|
+
const [rawValue, setValue, isControlled] = useControlledState(
|
|
6086
6110
|
props.value,
|
|
6087
|
-
props.defaultValue
|
|
6088
|
-
useCallback16(
|
|
6111
|
+
props.defaultValue ?? null,
|
|
6112
|
+
useCallback16(
|
|
6113
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
6114
|
+
[props.name, onChange]
|
|
6115
|
+
)
|
|
6089
6116
|
);
|
|
6117
|
+
const value = rawValue ?? "";
|
|
6090
6118
|
const getFormattedDisplayValue = useCallback16(
|
|
6091
6119
|
(inputValue) => {
|
|
6092
6120
|
if (!inputValue) return "";
|
|
@@ -6098,8 +6126,8 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6098
6126
|
},
|
|
6099
6127
|
[format, displayFormat, locale]
|
|
6100
6128
|
);
|
|
6101
|
-
const [displayValue, setDisplayValue] =
|
|
6102
|
-
const [anchorEl, setAnchorEl] =
|
|
6129
|
+
const [displayValue, setDisplayValue] = useState13(() => getFormattedDisplayValue(value));
|
|
6130
|
+
const [anchorEl, setAnchorEl] = useState13(null);
|
|
6103
6131
|
const open = Boolean(anchorEl);
|
|
6104
6132
|
useEffect11(() => {
|
|
6105
6133
|
if (!anchorEl) {
|
|
@@ -6251,7 +6279,7 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6251
6279
|
});
|
|
6252
6280
|
|
|
6253
6281
|
// 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
|
|
6282
|
+
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
6283
|
import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
|
|
6256
6284
|
import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
|
|
6257
6285
|
import { styled as styled22, useThemeProps as useThemeProps10 } from "@mui/joy";
|
|
@@ -6368,15 +6396,19 @@ var MonthRangePicker = forwardRef10((inProps, ref) => {
|
|
|
6368
6396
|
const isAlphabeticDisplay = hasAlphabeticMonth3(displayFormat);
|
|
6369
6397
|
const innerRef = useRef11(null);
|
|
6370
6398
|
const buttonRef = useRef11(null);
|
|
6371
|
-
const [
|
|
6399
|
+
const [rawValue, setValue] = useControlledState(
|
|
6372
6400
|
props.value,
|
|
6373
|
-
props.defaultValue
|
|
6374
|
-
useCallback17(
|
|
6401
|
+
props.defaultValue ?? null,
|
|
6402
|
+
useCallback17(
|
|
6403
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
6404
|
+
[props.name, onChange]
|
|
6405
|
+
)
|
|
6375
6406
|
);
|
|
6376
|
-
const
|
|
6407
|
+
const value = rawValue ?? "";
|
|
6408
|
+
const [displayValue, setDisplayValue] = useState14(
|
|
6377
6409
|
() => value ? formatValueString4(parseDates2(value), displayFormat, locale) : ""
|
|
6378
6410
|
);
|
|
6379
|
-
const [anchorEl, setAnchorEl] =
|
|
6411
|
+
const [anchorEl, setAnchorEl] = useState14(null);
|
|
6380
6412
|
const open = Boolean(anchorEl);
|
|
6381
6413
|
const calendarValue = useMemo14(() => value ? parseDates2(value) : void 0, [value]);
|
|
6382
6414
|
useEffect12(() => {
|
|
@@ -6661,7 +6693,7 @@ function Navigator(props) {
|
|
|
6661
6693
|
Navigator.displayName = "Navigator";
|
|
6662
6694
|
|
|
6663
6695
|
// src/components/PercentageInput/PercentageInput.tsx
|
|
6664
|
-
import React41, { useCallback as useCallback18, useMemo as useMemo15
|
|
6696
|
+
import React41, { useCallback as useCallback18, useMemo as useMemo15 } from "react";
|
|
6665
6697
|
import { NumericFormat as NumericFormat2 } from "react-number-format";
|
|
6666
6698
|
import { styled as styled25, useThemeProps as useThemeProps11 } from "@mui/joy";
|
|
6667
6699
|
var padDecimal = (value, decimalScale) => {
|
|
@@ -6717,34 +6749,30 @@ var PercentageInput = React41.forwardRef(
|
|
|
6717
6749
|
} = props;
|
|
6718
6750
|
const [_value, setValue] = useControlledState(
|
|
6719
6751
|
props.value,
|
|
6720
|
-
props.defaultValue,
|
|
6752
|
+
props.defaultValue ?? null,
|
|
6721
6753
|
useCallback18((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
6722
6754
|
);
|
|
6723
|
-
const [internalError, setInternalError] = useState16(
|
|
6724
|
-
max && _value && _value > max || min && _value && _value < min
|
|
6725
|
-
);
|
|
6726
6755
|
const value = useMemo15(() => {
|
|
6727
6756
|
if (_value && useMinorUnit) {
|
|
6728
6757
|
return _value / Math.pow(10, maxDecimalScale);
|
|
6729
6758
|
}
|
|
6730
6759
|
return _value;
|
|
6731
6760
|
}, [_value, useMinorUnit, maxDecimalScale]);
|
|
6761
|
+
const internalError = useMemo15(
|
|
6762
|
+
() => value != null && (max != null && value > max || min != null && value < min),
|
|
6763
|
+
[max, min, value]
|
|
6764
|
+
);
|
|
6732
6765
|
const handleChange = useCallback18(
|
|
6733
6766
|
(event) => {
|
|
6734
6767
|
if (event.target.value === "") {
|
|
6735
|
-
setValue(
|
|
6768
|
+
setValue(null);
|
|
6736
6769
|
return;
|
|
6737
6770
|
}
|
|
6738
6771
|
const originalAmount = Number(event.target.value);
|
|
6739
|
-
if (min && originalAmount < min || max && originalAmount > max) {
|
|
6740
|
-
setInternalError(true);
|
|
6741
|
-
} else {
|
|
6742
|
-
setInternalError(false);
|
|
6743
|
-
}
|
|
6744
6772
|
const amount = useMinorUnit ? padDecimal(originalAmount, maxDecimalScale) : originalAmount;
|
|
6745
6773
|
setValue(amount);
|
|
6746
6774
|
},
|
|
6747
|
-
[setValue, useMinorUnit, maxDecimalScale
|
|
6775
|
+
[setValue, useMinorUnit, maxDecimalScale]
|
|
6748
6776
|
);
|
|
6749
6777
|
return /* @__PURE__ */ React41.createElement(
|
|
6750
6778
|
PercentageInputRoot,
|
|
@@ -7496,7 +7524,7 @@ function ThemeProvider(props) {
|
|
|
7496
7524
|
ThemeProvider.displayName = "ThemeProvider";
|
|
7497
7525
|
|
|
7498
7526
|
// src/components/Uploader/Uploader.tsx
|
|
7499
|
-
import React49, { useCallback as useCallback19, useEffect as useEffect13, useMemo as useMemo16, useRef as useRef12, useState as
|
|
7527
|
+
import React49, { useCallback as useCallback19, useEffect as useEffect13, useMemo as useMemo16, useRef as useRef12, useState as useState16 } from "react";
|
|
7500
7528
|
import { styled as styled31, Input as Input2 } from "@mui/joy";
|
|
7501
7529
|
import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
|
|
7502
7530
|
import MuiUploadFileIcon from "@mui/icons-material/UploadFileRounded";
|
|
@@ -7646,10 +7674,10 @@ var Uploader = React49.memo((props) => {
|
|
|
7646
7674
|
} = props;
|
|
7647
7675
|
const dropZoneRef = useRef12(null);
|
|
7648
7676
|
const inputRef = useRef12(null);
|
|
7649
|
-
const [errorText, setErrorText] =
|
|
7650
|
-
const [files, setFiles] =
|
|
7651
|
-
const [uploaded, setUploaded] =
|
|
7652
|
-
const [previewState, setPreviewState] =
|
|
7677
|
+
const [errorText, setErrorText] = useState16();
|
|
7678
|
+
const [files, setFiles] = useState16([]);
|
|
7679
|
+
const [uploaded, setUploaded] = useState16(props.uploaded || []);
|
|
7680
|
+
const [previewState, setPreviewState] = useState16("idle");
|
|
7653
7681
|
const accepts = useMemo16(() => accept.split(",").map((accept2) => accept2.trim()), [accept]);
|
|
7654
7682
|
const parsedAccepts = useMemo16(
|
|
7655
7683
|
() => accepts.flatMap((type) => {
|