@ceed/ads 1.40.1 → 1.41.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 +38 -34
- 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 +88 -60
- package/dist/index.js +125 -97
- package/framer/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -260,13 +260,17 @@ var IconButton_default = IconButton;
|
|
|
260
260
|
import { useState, useCallback, useEffect, useRef } from "react";
|
|
261
261
|
function useControlledState(controlledValue, defaultValue, onChange) {
|
|
262
262
|
const { current: isControlled } = useRef(controlledValue !== void 0);
|
|
263
|
-
const [internalValue, setInternalValue] = useState(controlledValue
|
|
264
|
-
const
|
|
263
|
+
const [internalValue, setInternalValue] = useState(controlledValue !== void 0 ? controlledValue : defaultValue);
|
|
264
|
+
const hasWarnedRef = useRef(false);
|
|
265
265
|
useEffect(() => {
|
|
266
|
-
if (
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
if (false) return;
|
|
267
|
+
if (hasWarnedRef.current || isControlled === (controlledValue !== void 0)) return;
|
|
268
|
+
hasWarnedRef.current = true;
|
|
269
|
+
console.warn(
|
|
270
|
+
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."
|
|
271
|
+
);
|
|
269
272
|
}, [isControlled, controlledValue]);
|
|
273
|
+
const displayValue = isControlled ? controlledValue : internalValue;
|
|
270
274
|
const handleChange = useCallback(
|
|
271
275
|
(value) => {
|
|
272
276
|
const newValue = typeof value === "function" ? value(displayValue) : value;
|
|
@@ -373,6 +377,7 @@ var AutocompleteListBox = React5.forwardRef((props, ref) => {
|
|
|
373
377
|
)
|
|
374
378
|
))));
|
|
375
379
|
});
|
|
380
|
+
var EMPTY_MULTIPLE_VALUE = [];
|
|
376
381
|
var autocompleteDeleteSize = {
|
|
377
382
|
sm: "20px",
|
|
378
383
|
md: "24px",
|
|
@@ -415,9 +420,9 @@ function Autocomplete(props) {
|
|
|
415
420
|
className,
|
|
416
421
|
...innerProps
|
|
417
422
|
} = props;
|
|
418
|
-
const [
|
|
423
|
+
const [rawValue, setValue] = useControlledState(
|
|
419
424
|
props.value,
|
|
420
|
-
props.defaultValue
|
|
425
|
+
props.defaultValue ?? null,
|
|
421
426
|
useCallback2(
|
|
422
427
|
(value2) => onChange?.({
|
|
423
428
|
target: {
|
|
@@ -428,6 +433,7 @@ function Autocomplete(props) {
|
|
|
428
433
|
[onChange, props.name]
|
|
429
434
|
)
|
|
430
435
|
);
|
|
436
|
+
const _value = rawValue ?? (props.multiple ? EMPTY_MULTIPLE_VALUE : "");
|
|
431
437
|
const options = useMemo(
|
|
432
438
|
() => props.options.map((option) => {
|
|
433
439
|
if (typeof option !== "object") {
|
|
@@ -488,7 +494,7 @@ function Autocomplete(props) {
|
|
|
488
494
|
(event, value2) => {
|
|
489
495
|
const newValue = value2;
|
|
490
496
|
const _value2 = Array.isArray(newValue) ? newValue.map((value3) => value3.value) : newValue?.value;
|
|
491
|
-
setValue(_value2);
|
|
497
|
+
setValue(_value2 ?? null);
|
|
492
498
|
if (Array.isArray(newValue) && newValue.map((value3) => optionMap.get(value3.value)) || optionMap.get(newValue?.value)) {
|
|
493
499
|
onChangeComplete?.({
|
|
494
500
|
...event,
|
|
@@ -1796,7 +1802,7 @@ var Container = forwardRef5(function Container2(props, ref) {
|
|
|
1796
1802
|
Container.displayName = "Container";
|
|
1797
1803
|
|
|
1798
1804
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1799
|
-
import React17, { useCallback as useCallback8, useMemo as useMemo6
|
|
1805
|
+
import React17, { useCallback as useCallback8, useMemo as useMemo6 } from "react";
|
|
1800
1806
|
import { NumericFormat } from "react-number-format";
|
|
1801
1807
|
|
|
1802
1808
|
// src/components/Input/Input.tsx
|
|
@@ -1820,6 +1826,10 @@ var Input = React16.forwardRef((props, ref) => {
|
|
|
1820
1826
|
onChange,
|
|
1821
1827
|
name,
|
|
1822
1828
|
type,
|
|
1829
|
+
// NOTE: value/defaultValue는 아래에서 직접 다루므로 innerProps 스프레드에서 제외한다.
|
|
1830
|
+
// defaultValue가 스프레드에 남으면 항상 정의되는 value와 함께 DOM input에 도달해 React가 경고한다.
|
|
1831
|
+
value: valueProp,
|
|
1832
|
+
defaultValue: defaultValueProp,
|
|
1823
1833
|
// NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
|
|
1824
1834
|
sx,
|
|
1825
1835
|
className,
|
|
@@ -1832,8 +1842,8 @@ var Input = React16.forwardRef((props, ref) => {
|
|
|
1832
1842
|
}
|
|
1833
1843
|
const [passwordVisible, setPasswordVisible] = useState6(false);
|
|
1834
1844
|
const [value, setValue] = useControlledState(
|
|
1835
|
-
|
|
1836
|
-
|
|
1845
|
+
valueProp,
|
|
1846
|
+
defaultValueProp ?? null,
|
|
1837
1847
|
useCallback7(
|
|
1838
1848
|
(value2) => {
|
|
1839
1849
|
onChange?.({
|
|
@@ -1852,8 +1862,9 @@ var Input = React16.forwardRef((props, ref) => {
|
|
|
1852
1862
|
setValue(e.target.value);
|
|
1853
1863
|
};
|
|
1854
1864
|
const handleClear = () => {
|
|
1855
|
-
setValue(
|
|
1865
|
+
setValue(defaultValueProp || "");
|
|
1856
1866
|
};
|
|
1867
|
+
const displayValue = valueProp !== void 0 ? valueProp : value;
|
|
1857
1868
|
const handleTogglePasswordVisibility = () => {
|
|
1858
1869
|
setPasswordVisible((prev) => !prev);
|
|
1859
1870
|
};
|
|
@@ -1863,7 +1874,7 @@ var Input = React16.forwardRef((props, ref) => {
|
|
|
1863
1874
|
const input = /* @__PURE__ */ React16.createElement(
|
|
1864
1875
|
MotionInput,
|
|
1865
1876
|
{
|
|
1866
|
-
value,
|
|
1877
|
+
value: displayValue ?? "",
|
|
1867
1878
|
name,
|
|
1868
1879
|
onChange: handleChange,
|
|
1869
1880
|
required,
|
|
@@ -1884,7 +1895,7 @@ var Input = React16.forwardRef((props, ref) => {
|
|
|
1884
1895
|
"aria-label": passwordVisible ? "Hide password" : "Show password"
|
|
1885
1896
|
},
|
|
1886
1897
|
passwordVisible ? /* @__PURE__ */ React16.createElement(VisibilityOffIcon, null) : /* @__PURE__ */ React16.createElement(VisibilityIcon, null)
|
|
1887
|
-
)) : null : enableClearable ? /* @__PURE__ */ React16.createElement(Stack_default, { gap: 1, direction: "row" }, innerProps.endDecorator,
|
|
1898
|
+
)) : null : enableClearable ? /* @__PURE__ */ React16.createElement(Stack_default, { gap: 1, direction: "row" }, innerProps.endDecorator, displayValue && /* @__PURE__ */ React16.createElement(
|
|
1888
1899
|
IconButton_default,
|
|
1889
1900
|
{
|
|
1890
1901
|
onMouseDown: (e) => e.preventDefault(),
|
|
@@ -2122,7 +2133,7 @@ var CurrencyInput = React17.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
2122
2133
|
const { symbol, thousandSeparator, decimalSeparator, placeholder, fixedDecimalScale, decimalScale } = useCurrencySetting(props);
|
|
2123
2134
|
const [_value, setValue] = useControlledState(
|
|
2124
2135
|
props.value,
|
|
2125
|
-
props.defaultValue,
|
|
2136
|
+
props.defaultValue ?? null,
|
|
2126
2137
|
useCallback8((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
2127
2138
|
);
|
|
2128
2139
|
const value = useMemo6(() => {
|
|
@@ -2137,22 +2148,17 @@ var CurrencyInput = React17.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
2137
2148
|
}
|
|
2138
2149
|
return props.max;
|
|
2139
2150
|
}, [props.max, useMinorUnit, decimalScale]);
|
|
2140
|
-
const
|
|
2151
|
+
const isOverLimit = useMemo6(() => max != null && value != null && value > max, [max, value]);
|
|
2141
2152
|
const handleChange = useCallback8(
|
|
2142
2153
|
(event) => {
|
|
2143
2154
|
if (event.target.value === "") {
|
|
2144
|
-
setValue(
|
|
2155
|
+
setValue(null);
|
|
2145
2156
|
return;
|
|
2146
2157
|
}
|
|
2147
2158
|
const amount = useMinorUnit ? Number(decimalSeparator ? event.target.value?.replace(decimalSeparator, "") : event.target.value) : Number(event.target.value);
|
|
2148
|
-
if (!!max && Number(event.target.value) > max) {
|
|
2149
|
-
setIsOverLimit(true);
|
|
2150
|
-
} else {
|
|
2151
|
-
setIsOverLimit(false);
|
|
2152
|
-
}
|
|
2153
2159
|
setValue(amount);
|
|
2154
2160
|
},
|
|
2155
|
-
[decimalSeparator,
|
|
2161
|
+
[decimalSeparator, useMinorUnit, setValue]
|
|
2156
2162
|
);
|
|
2157
2163
|
return /* @__PURE__ */ React17.createElement(
|
|
2158
2164
|
CurrencyInputRoot,
|
|
@@ -2616,7 +2622,7 @@ var Resizer = (ref, targetRef = ref, onResizeStateChange, onAutoFit) => /* @__PU
|
|
|
2616
2622
|
// src/components/DataTable/components.tsx
|
|
2617
2623
|
import React23, {
|
|
2618
2624
|
useRef as useRef5,
|
|
2619
|
-
useState as
|
|
2625
|
+
useState as useState8,
|
|
2620
2626
|
useLayoutEffect,
|
|
2621
2627
|
useMemo as useMemo9,
|
|
2622
2628
|
useCallback as useCallback10,
|
|
@@ -2628,7 +2634,7 @@ import { styled as styled12, useTheme } from "@mui/joy";
|
|
|
2628
2634
|
import { AnimatePresence as AnimatePresence2 } from "framer-motion";
|
|
2629
2635
|
|
|
2630
2636
|
// src/components/DatePicker/DatePicker.tsx
|
|
2631
|
-
import React19, { forwardRef as forwardRef6, useCallback as useCallback9, useEffect as useEffect4, useImperativeHandle, useRef as useRef4, useState as
|
|
2637
|
+
import React19, { forwardRef as forwardRef6, useCallback as useCallback9, useEffect as useEffect4, useImperativeHandle, useRef as useRef4, useState as useState7 } from "react";
|
|
2632
2638
|
import { IMaskInput, IMask } from "react-imask";
|
|
2633
2639
|
import CalendarTodayIcon from "@mui/icons-material/CalendarToday";
|
|
2634
2640
|
import { styled as styled10, useThemeProps as useThemeProps5 } from "@mui/joy";
|
|
@@ -2847,16 +2853,20 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2847
2853
|
} = props;
|
|
2848
2854
|
const innerRef = useRef4(null);
|
|
2849
2855
|
const buttonRef = useRef4(null);
|
|
2850
|
-
const [
|
|
2856
|
+
const [rawValue, setValue] = useControlledState(
|
|
2851
2857
|
props.value,
|
|
2852
|
-
props.defaultValue
|
|
2853
|
-
useCallback9(
|
|
2858
|
+
props.defaultValue ?? null,
|
|
2859
|
+
useCallback9(
|
|
2860
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
2861
|
+
[props.name, onChange]
|
|
2862
|
+
)
|
|
2854
2863
|
);
|
|
2864
|
+
const value = rawValue ?? "";
|
|
2855
2865
|
const isAlphabeticDisplay = hasAlphabeticMonth(displayFormat);
|
|
2856
|
-
const [displayValue, setDisplayValue] =
|
|
2866
|
+
const [displayValue, setDisplayValue] = useState7(
|
|
2857
2867
|
() => value ? formatValueString(parseDate(value, format), displayFormat, locale) : ""
|
|
2858
2868
|
);
|
|
2859
|
-
const [anchorEl, setAnchorEl] =
|
|
2869
|
+
const [anchorEl, setAnchorEl] = useState7(null);
|
|
2860
2870
|
const open = Boolean(anchorEl);
|
|
2861
2871
|
useEffect4(() => {
|
|
2862
2872
|
if (!anchorEl) {
|
|
@@ -3309,7 +3319,7 @@ var TextEllipsis = ({
|
|
|
3309
3319
|
...rest
|
|
3310
3320
|
}) => {
|
|
3311
3321
|
const textRef = useRef5(null);
|
|
3312
|
-
const [showTooltip, setShowTooltip] =
|
|
3322
|
+
const [showTooltip, setShowTooltip] = useState8(false);
|
|
3313
3323
|
useLayoutEffect(() => {
|
|
3314
3324
|
const element = textRef.current;
|
|
3315
3325
|
if (!element) return;
|
|
@@ -3326,7 +3336,7 @@ var TextEllipsis = ({
|
|
|
3326
3336
|
};
|
|
3327
3337
|
var CellTextEllipsis = ({ children }) => {
|
|
3328
3338
|
const textRef = useRef5(null);
|
|
3329
|
-
const [showTooltip, setShowTooltip] =
|
|
3339
|
+
const [showTooltip, setShowTooltip] = useState8(false);
|
|
3330
3340
|
useLayoutEffect(() => {
|
|
3331
3341
|
const element = textRef.current;
|
|
3332
3342
|
if (element) {
|
|
@@ -3384,7 +3394,7 @@ var HeadCell = (props) => {
|
|
|
3384
3394
|
useLayoutEffect(() => {
|
|
3385
3395
|
ref.current = localRef.current;
|
|
3386
3396
|
}, [ref]);
|
|
3387
|
-
const [isHovered, setIsHovered] =
|
|
3397
|
+
const [isHovered, setIsHovered] = useState8(false);
|
|
3388
3398
|
const sortable = type === "actions" ? false : _sortable;
|
|
3389
3399
|
const headId = useMemo9(
|
|
3390
3400
|
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
@@ -3513,7 +3523,7 @@ var BodyCell = (props) => {
|
|
|
3513
3523
|
onCellEditStop
|
|
3514
3524
|
} = props;
|
|
3515
3525
|
const theme = useTheme();
|
|
3516
|
-
const [value, setValue] =
|
|
3526
|
+
const [value, setValue] = useState8(row[field]);
|
|
3517
3527
|
const cellRef = useRef5(null);
|
|
3518
3528
|
const params = useMemo9(
|
|
3519
3529
|
() => ({
|
|
@@ -3735,9 +3745,9 @@ var VirtualizedTableRow = memo(StyledTableRow2, (prevProps, nextProps) => {
|
|
|
3735
3745
|
});
|
|
3736
3746
|
|
|
3737
3747
|
// src/components/DataTable/hooks.ts
|
|
3738
|
-
import { useState as
|
|
3748
|
+
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useMemo as useMemo10, useCallback as useCallback11, useEffect as useEffect6, createRef } from "react";
|
|
3739
3749
|
function useColumnWidths(columnsByField) {
|
|
3740
|
-
const [widths, setWidths] =
|
|
3750
|
+
const [widths, setWidths] = useState9({});
|
|
3741
3751
|
const roRef = useRef6();
|
|
3742
3752
|
useLayoutEffect2(() => {
|
|
3743
3753
|
if (roRef.current) roRef.current.disconnect();
|
|
@@ -3798,8 +3808,8 @@ function useDataTableRenderer({
|
|
|
3798
3808
|
}
|
|
3799
3809
|
const onSelectionModelChangeRef = useRef6(onSelectionModelChange);
|
|
3800
3810
|
onSelectionModelChangeRef.current = onSelectionModelChange;
|
|
3801
|
-
const [focusedRowId, setFocusedRowId] =
|
|
3802
|
-
const [selectionAnchor, setSelectionAnchor] =
|
|
3811
|
+
const [focusedRowId, setFocusedRowId] = useState9(null);
|
|
3812
|
+
const [selectionAnchor, setSelectionAnchor] = useState9(null);
|
|
3803
3813
|
const [sortModel, setSortModel] = useControlledState(
|
|
3804
3814
|
controlledSortModel,
|
|
3805
3815
|
initialState?.sorting?.sortModel ?? [],
|
|
@@ -3891,7 +3901,7 @@ function useDataTableRenderer({
|
|
|
3891
3901
|
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3892
3902
|
[_sortOrder]
|
|
3893
3903
|
);
|
|
3894
|
-
const [page, setPage] =
|
|
3904
|
+
const [page, setPage] = useState9(paginationModel?.page || 1);
|
|
3895
3905
|
const pageSize = paginationModel?.pageSize || 20;
|
|
3896
3906
|
const getId = useCallback11(
|
|
3897
3907
|
(row, index) => _getId?.(row) ?? row.id ?? `${(index || 0) + (page - 1) * pageSize}`,
|
|
@@ -4570,7 +4580,8 @@ function Component(props, apiRef) {
|
|
|
4570
4580
|
const totalSize = virtualizer.getTotalSize();
|
|
4571
4581
|
const virtualizedItems = virtualizer.getVirtualItems();
|
|
4572
4582
|
const showNoRowsOverlay = !loading && rowCount === 0;
|
|
4573
|
-
const
|
|
4583
|
+
const showFillerColumn = columns.length > 0 && columns.every((c) => !!c.width);
|
|
4584
|
+
const totalColCount = Math.max(1, columns.length + (checkboxSelection ? 1 : 0) + (showFillerColumn ? 1 : 0));
|
|
4574
4585
|
const getRowClickHandler = useCallback13(
|
|
4575
4586
|
(row, rowId) => (e) => {
|
|
4576
4587
|
onRowClick?.({ row, rowId }, e);
|
|
@@ -4761,7 +4772,7 @@ function Component(props, apiRef) {
|
|
|
4761
4772
|
minWidth: c.minWidth ?? "50px"
|
|
4762
4773
|
}
|
|
4763
4774
|
}
|
|
4764
|
-
))), /* @__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
|
+
)), 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(
|
|
4765
4776
|
"th",
|
|
4766
4777
|
{
|
|
4767
4778
|
rowSpan: processedColumnGroups.maxLevel + 2,
|
|
@@ -4790,7 +4801,13 @@ function Component(props, apiRef) {
|
|
|
4790
4801
|
},
|
|
4791
4802
|
group.headerName ?? group.groupId
|
|
4792
4803
|
), emptyCells > 0 && Array.from({ length: emptyCells }).map((_2, i) => /* @__PURE__ */ React26.createElement("th", { key: `empty-between-${level}-${groupIndex}-${i}`, colSpan: 1 })));
|
|
4793
|
-
})
|
|
4804
|
+
}), showFillerColumn && level === 0 && /* @__PURE__ */ React26.createElement(
|
|
4805
|
+
"th",
|
|
4806
|
+
{
|
|
4807
|
+
"aria-hidden": "true",
|
|
4808
|
+
rowSpan: processedColumnGroups.maxLevel + 2
|
|
4809
|
+
}
|
|
4810
|
+
))), /* @__PURE__ */ React26.createElement("tr", null, (!processedColumnGroups || processedColumnGroups.groups.length === 0) && checkboxSelection && /* @__PURE__ */ React26.createElement(
|
|
4794
4811
|
"th",
|
|
4795
4812
|
{
|
|
4796
4813
|
style: {
|
|
@@ -4813,7 +4830,7 @@ function Component(props, apiRef) {
|
|
|
4813
4830
|
...c
|
|
4814
4831
|
}
|
|
4815
4832
|
)
|
|
4816
|
-
)))), /* @__PURE__ */ React26.createElement(
|
|
4833
|
+
)), showFillerColumn && (!processedColumnGroups || processedColumnGroups.groups.length === 0) && /* @__PURE__ */ React26.createElement("th", { "aria-hidden": "true" }))), /* @__PURE__ */ React26.createElement(
|
|
4817
4834
|
VirtualizedTableBody,
|
|
4818
4835
|
{
|
|
4819
4836
|
ref: tableBodyRef,
|
|
@@ -4912,7 +4929,8 @@ function Component(props, apiRef) {
|
|
|
4912
4929
|
editMode,
|
|
4913
4930
|
noWrap: props.noWrap
|
|
4914
4931
|
}
|
|
4915
|
-
)
|
|
4932
|
+
),
|
|
4933
|
+
showFillerColumn && /* @__PURE__ */ React26.createElement("td", { "aria-hidden": "true" })
|
|
4916
4934
|
);
|
|
4917
4935
|
})
|
|
4918
4936
|
), Footer && /* @__PURE__ */ React26.createElement(Footer, null))
|
|
@@ -4934,7 +4952,7 @@ var DataTable = forwardRef7(Component);
|
|
|
4934
4952
|
DataTable.displayName = "DataTable";
|
|
4935
4953
|
|
|
4936
4954
|
// src/components/DateRangePicker/DateRangePicker.tsx
|
|
4937
|
-
import React27, { forwardRef as forwardRef8, useCallback as useCallback14, useEffect as useEffect8, useImperativeHandle as useImperativeHandle3, useMemo as useMemo12, useRef as useRef8, useState as
|
|
4955
|
+
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";
|
|
4938
4956
|
import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
|
|
4939
4957
|
import CalendarTodayIcon2 from "@mui/icons-material/CalendarToday";
|
|
4940
4958
|
import { styled as styled14, useThemeProps as useThemeProps7 } from "@mui/joy";
|
|
@@ -5141,16 +5159,20 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5141
5159
|
} = props;
|
|
5142
5160
|
const innerRef = useRef8(null);
|
|
5143
5161
|
const buttonRef = useRef8(null);
|
|
5144
|
-
const [
|
|
5162
|
+
const [rawValue, setValue] = useControlledState(
|
|
5145
5163
|
props.value,
|
|
5146
|
-
props.defaultValue
|
|
5147
|
-
useCallback14(
|
|
5164
|
+
props.defaultValue ?? null,
|
|
5165
|
+
useCallback14(
|
|
5166
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
5167
|
+
[props.name, onChange]
|
|
5168
|
+
)
|
|
5148
5169
|
);
|
|
5170
|
+
const value = rawValue ?? "";
|
|
5149
5171
|
const isAlphabeticDisplay = hasAlphabeticMonth2(displayFormat);
|
|
5150
|
-
const [displayValue, setDisplayValue] =
|
|
5172
|
+
const [displayValue, setDisplayValue] = useState10(
|
|
5151
5173
|
() => value ? formatValueString2(parseDates(value, format), displayFormat, locale) : ""
|
|
5152
5174
|
);
|
|
5153
|
-
const [anchorEl, setAnchorEl] =
|
|
5175
|
+
const [anchorEl, setAnchorEl] = useState10(null);
|
|
5154
5176
|
const open = Boolean(anchorEl);
|
|
5155
5177
|
const calendarValue = useMemo12(
|
|
5156
5178
|
() => value ? parseDates(value, format) : void 0,
|
|
@@ -5495,14 +5517,15 @@ var InsetDrawer = styled19(JoyDrawer)(({ theme }) => ({
|
|
|
5495
5517
|
}));
|
|
5496
5518
|
|
|
5497
5519
|
// src/components/FilterableCheckboxGroup/FilterableCheckboxGroup.tsx
|
|
5498
|
-
import React31, { useCallback as useCallback15, useEffect as useEffect9, useMemo as useMemo13, useRef as useRef9, useState as
|
|
5520
|
+
import React31, { useCallback as useCallback15, useEffect as useEffect9, useMemo as useMemo13, useRef as useRef9, useState as useState11 } from "react";
|
|
5499
5521
|
import SearchIcon from "@mui/icons-material/Search";
|
|
5500
5522
|
import { useThemeProps as useThemeProps8 } from "@mui/joy";
|
|
5501
5523
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
5524
|
+
var EMPTY_VALUE = [];
|
|
5502
5525
|
function LabelWithTooltip(props) {
|
|
5503
5526
|
const { label, size } = props;
|
|
5504
5527
|
const labelContentRef = useRef9(null);
|
|
5505
|
-
const [isOverflowing, setIsOverflowing] =
|
|
5528
|
+
const [isOverflowing, setIsOverflowing] = useState11(false);
|
|
5506
5529
|
const labelContent = /* @__PURE__ */ React31.createElement(
|
|
5507
5530
|
"span",
|
|
5508
5531
|
{
|
|
@@ -5544,13 +5567,14 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5544
5567
|
maxHeight = 300,
|
|
5545
5568
|
disabled
|
|
5546
5569
|
} = props;
|
|
5547
|
-
const [searchTerm, setSearchTerm] =
|
|
5548
|
-
const [sortedOptions, setSortedOptions] =
|
|
5549
|
-
const [
|
|
5570
|
+
const [searchTerm, setSearchTerm] = useState11("");
|
|
5571
|
+
const [sortedOptions, setSortedOptions] = useState11(options);
|
|
5572
|
+
const [rawValue, setInternalValue] = useControlledState(
|
|
5550
5573
|
value,
|
|
5551
|
-
value ??
|
|
5552
|
-
useCallback15((newValue) => onChange?.(newValue), [onChange])
|
|
5574
|
+
value ?? EMPTY_VALUE,
|
|
5575
|
+
useCallback15((newValue) => onChange?.(newValue ?? []), [onChange])
|
|
5553
5576
|
);
|
|
5577
|
+
const internalValue = rawValue ?? EMPTY_VALUE;
|
|
5554
5578
|
const parentRef = useRef9(null);
|
|
5555
5579
|
const isInitialSortRef = useRef9(false);
|
|
5556
5580
|
const prevOptionsRef = useRef9([...options]);
|
|
@@ -5821,7 +5845,7 @@ function RadioGroup2(props) {
|
|
|
5821
5845
|
RadioGroup2.displayName = "RadioGroup";
|
|
5822
5846
|
|
|
5823
5847
|
// src/components/FilterMenu/components/DateRange.tsx
|
|
5824
|
-
import React35, { useCallback as useCallback19, useMemo as useMemo14, useState as
|
|
5848
|
+
import React35, { useCallback as useCallback19, useMemo as useMemo14, useState as useState12, useEffect as useEffect10 } from "react";
|
|
5825
5849
|
import { Stack as Stack5 } from "@mui/joy";
|
|
5826
5850
|
function DateRange(props) {
|
|
5827
5851
|
const {
|
|
@@ -5839,7 +5863,7 @@ function DateRange(props) {
|
|
|
5839
5863
|
hideClearButton
|
|
5840
5864
|
} = props;
|
|
5841
5865
|
const [internalValue, setInternalValue] = useControlledState(value, null, onChange);
|
|
5842
|
-
const [selectedOption, setSelectedOption] =
|
|
5866
|
+
const [selectedOption, setSelectedOption] = useState12("all-time");
|
|
5843
5867
|
const dateRangeOptions = useMemo14(
|
|
5844
5868
|
() => [
|
|
5845
5869
|
{ label: "All Time", value: "all-time" },
|
|
@@ -5968,7 +5992,7 @@ import React37, { useCallback as useCallback21, useMemo as useMemo16 } from "rea
|
|
|
5968
5992
|
import { Stack as Stack6 } from "@mui/joy";
|
|
5969
5993
|
|
|
5970
5994
|
// src/components/MonthRangePicker/MonthRangePicker.tsx
|
|
5971
|
-
import React36, { forwardRef as forwardRef9, useCallback as useCallback20, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useMemo as useMemo15, useRef as useRef10, useState as
|
|
5995
|
+
import React36, { forwardRef as forwardRef9, useCallback as useCallback20, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useMemo as useMemo15, useRef as useRef10, useState as useState13 } from "react";
|
|
5972
5996
|
import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
|
|
5973
5997
|
import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
|
|
5974
5998
|
import { styled as styled20, useThemeProps as useThemeProps9 } from "@mui/joy";
|
|
@@ -6085,15 +6109,19 @@ var MonthRangePicker = forwardRef9((inProps, ref) => {
|
|
|
6085
6109
|
const isAlphabeticDisplay = hasAlphabeticMonth3(displayFormat);
|
|
6086
6110
|
const innerRef = useRef10(null);
|
|
6087
6111
|
const buttonRef = useRef10(null);
|
|
6088
|
-
const [
|
|
6112
|
+
const [rawValue, setValue] = useControlledState(
|
|
6089
6113
|
props.value,
|
|
6090
|
-
props.defaultValue
|
|
6091
|
-
useCallback20(
|
|
6114
|
+
props.defaultValue ?? null,
|
|
6115
|
+
useCallback20(
|
|
6116
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
6117
|
+
[props.name, onChange]
|
|
6118
|
+
)
|
|
6092
6119
|
);
|
|
6093
|
-
const
|
|
6120
|
+
const value = rawValue ?? "";
|
|
6121
|
+
const [displayValue, setDisplayValue] = useState13(
|
|
6094
6122
|
() => value ? formatValueString3(parseDates2(value), displayFormat, locale) : ""
|
|
6095
6123
|
);
|
|
6096
|
-
const [anchorEl, setAnchorEl] =
|
|
6124
|
+
const [anchorEl, setAnchorEl] = useState13(null);
|
|
6097
6125
|
const open = Boolean(anchorEl);
|
|
6098
6126
|
const calendarValue = useMemo15(() => value ? parseDates2(value) : void 0, [value]);
|
|
6099
6127
|
useEffect11(() => {
|
|
@@ -6316,7 +6344,7 @@ function CurrencyInput3(props) {
|
|
|
6316
6344
|
const [internalValue, setInternalValue] = useControlledState(value, value, onChange);
|
|
6317
6345
|
const handleCurrencyChange = useCallback22(
|
|
6318
6346
|
(event) => {
|
|
6319
|
-
const newValue = event.target.value;
|
|
6347
|
+
const newValue = event.target.value ?? void 0;
|
|
6320
6348
|
setInternalValue(newValue);
|
|
6321
6349
|
},
|
|
6322
6350
|
[setInternalValue]
|
|
@@ -6349,7 +6377,7 @@ function CurrencyRange(props) {
|
|
|
6349
6377
|
const maxValue = internalValue?.[1];
|
|
6350
6378
|
const handleMinChange = useCallback23(
|
|
6351
6379
|
(event) => {
|
|
6352
|
-
const newMinValue = event.target.value;
|
|
6380
|
+
const newMinValue = event.target.value ?? void 0;
|
|
6353
6381
|
const currentMaxValue = maxValue;
|
|
6354
6382
|
if (newMinValue !== void 0 && currentMaxValue !== void 0) {
|
|
6355
6383
|
setInternalValue([newMinValue, currentMaxValue]);
|
|
@@ -6363,7 +6391,7 @@ function CurrencyRange(props) {
|
|
|
6363
6391
|
);
|
|
6364
6392
|
const handleMaxChange = useCallback23(
|
|
6365
6393
|
(event) => {
|
|
6366
|
-
const newMaxValue = event.target.value;
|
|
6394
|
+
const newMaxValue = event.target.value ?? void 0;
|
|
6367
6395
|
const currentMinValue = minValue;
|
|
6368
6396
|
if (currentMinValue !== void 0 && newMaxValue !== void 0) {
|
|
6369
6397
|
setInternalValue([currentMinValue, newMaxValue]);
|
|
@@ -6413,7 +6441,7 @@ import React41 from "react";
|
|
|
6413
6441
|
import { Stack as Stack9, Typography as Typography5 } from "@mui/joy";
|
|
6414
6442
|
|
|
6415
6443
|
// src/components/PercentageInput/PercentageInput.tsx
|
|
6416
|
-
import React40, { useCallback as useCallback24, useMemo as useMemo17
|
|
6444
|
+
import React40, { useCallback as useCallback24, useMemo as useMemo17 } from "react";
|
|
6417
6445
|
import { NumericFormat as NumericFormat2 } from "react-number-format";
|
|
6418
6446
|
import { styled as styled21, useThemeProps as useThemeProps10 } from "@mui/joy";
|
|
6419
6447
|
var padDecimal = (value, decimalScale) => {
|
|
@@ -6469,34 +6497,30 @@ var PercentageInput = React40.forwardRef(
|
|
|
6469
6497
|
} = props;
|
|
6470
6498
|
const [_value, setValue] = useControlledState(
|
|
6471
6499
|
props.value,
|
|
6472
|
-
props.defaultValue,
|
|
6500
|
+
props.defaultValue ?? null,
|
|
6473
6501
|
useCallback24((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
6474
6502
|
);
|
|
6475
|
-
const [internalError, setInternalError] = useState15(
|
|
6476
|
-
max && _value && _value > max || min && _value && _value < min
|
|
6477
|
-
);
|
|
6478
6503
|
const value = useMemo17(() => {
|
|
6479
6504
|
if (_value && useMinorUnit) {
|
|
6480
6505
|
return _value / Math.pow(10, maxDecimalScale);
|
|
6481
6506
|
}
|
|
6482
6507
|
return _value;
|
|
6483
6508
|
}, [_value, useMinorUnit, maxDecimalScale]);
|
|
6509
|
+
const internalError = useMemo17(
|
|
6510
|
+
() => value != null && (max != null && value > max || min != null && value < min),
|
|
6511
|
+
[max, min, value]
|
|
6512
|
+
);
|
|
6484
6513
|
const handleChange = useCallback24(
|
|
6485
6514
|
(event) => {
|
|
6486
6515
|
if (event.target.value === "") {
|
|
6487
|
-
setValue(
|
|
6516
|
+
setValue(null);
|
|
6488
6517
|
return;
|
|
6489
6518
|
}
|
|
6490
6519
|
const originalAmount = Number(event.target.value);
|
|
6491
|
-
if (min && originalAmount < min || max && originalAmount > max) {
|
|
6492
|
-
setInternalError(true);
|
|
6493
|
-
} else {
|
|
6494
|
-
setInternalError(false);
|
|
6495
|
-
}
|
|
6496
6520
|
const amount = useMinorUnit ? padDecimal(originalAmount, maxDecimalScale) : originalAmount;
|
|
6497
6521
|
setValue(amount);
|
|
6498
6522
|
},
|
|
6499
|
-
[setValue, useMinorUnit, maxDecimalScale
|
|
6523
|
+
[setValue, useMinorUnit, maxDecimalScale]
|
|
6500
6524
|
);
|
|
6501
6525
|
return /* @__PURE__ */ React40.createElement(
|
|
6502
6526
|
PercentageInputRoot,
|
|
@@ -6549,7 +6573,7 @@ var PercentageInput3 = ({
|
|
|
6549
6573
|
PercentageInput,
|
|
6550
6574
|
{
|
|
6551
6575
|
value: _value,
|
|
6552
|
-
onChange: (event) => setValue(event.target.value),
|
|
6576
|
+
onChange: (event) => setValue(event.target.value ?? void 0),
|
|
6553
6577
|
useMinorUnit,
|
|
6554
6578
|
maxDecimalScale,
|
|
6555
6579
|
min,
|
|
@@ -6573,7 +6597,7 @@ function PercentageRange(props) {
|
|
|
6573
6597
|
const maxValue = internalValue?.[1];
|
|
6574
6598
|
const handleMinChange = useCallback25(
|
|
6575
6599
|
(event) => {
|
|
6576
|
-
const newMinValue = event.target.value;
|
|
6600
|
+
const newMinValue = event.target.value ?? void 0;
|
|
6577
6601
|
const currentMaxValue = maxValue;
|
|
6578
6602
|
if (newMinValue !== void 0) {
|
|
6579
6603
|
setInternalValue([newMinValue, currentMaxValue || null]);
|
|
@@ -6585,7 +6609,7 @@ function PercentageRange(props) {
|
|
|
6585
6609
|
);
|
|
6586
6610
|
const handleMaxChange = useCallback25(
|
|
6587
6611
|
(event) => {
|
|
6588
|
-
const newMaxValue = event.target.value;
|
|
6612
|
+
const newMaxValue = event.target.value ?? void 0;
|
|
6589
6613
|
const currentMinValue = minValue;
|
|
6590
6614
|
if (newMaxValue !== void 0) {
|
|
6591
6615
|
setInternalValue([currentMinValue || null, newMaxValue]);
|
|
@@ -6639,7 +6663,7 @@ function Autocomplete2(props) {
|
|
|
6639
6663
|
const autocompleteValue = typeof internalValue === "string" || typeof internalValue === "number" ? String(internalValue) : void 0;
|
|
6640
6664
|
const handleChange = useCallback26(
|
|
6641
6665
|
(event) => {
|
|
6642
|
-
const val = event.target.value;
|
|
6666
|
+
const val = event.target.value ?? void 0;
|
|
6643
6667
|
if (val) {
|
|
6644
6668
|
const numVal = Number(val);
|
|
6645
6669
|
setInternalValue(!isNaN(numVal) && isFinite(numVal) ? numVal : val);
|
|
@@ -6742,7 +6766,7 @@ function FilterMenu(props) {
|
|
|
6742
6766
|
FilterMenu.displayName = "FilterMenu";
|
|
6743
6767
|
|
|
6744
6768
|
// src/components/Uploader/Uploader.tsx
|
|
6745
|
-
import React45, { useCallback as useCallback28, useEffect as useEffect13, useMemo as useMemo18, useRef as useRef11, useState as
|
|
6769
|
+
import React45, { useCallback as useCallback28, useEffect as useEffect13, useMemo as useMemo18, useRef as useRef11, useState as useState14 } from "react";
|
|
6746
6770
|
import { styled as styled22, Input as Input2 } from "@mui/joy";
|
|
6747
6771
|
import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
|
|
6748
6772
|
import MuiUploadFileIcon from "@mui/icons-material/UploadFileRounded";
|
|
@@ -6892,10 +6916,10 @@ var Uploader = React45.memo((props) => {
|
|
|
6892
6916
|
} = props;
|
|
6893
6917
|
const dropZoneRef = useRef11(null);
|
|
6894
6918
|
const inputRef = useRef11(null);
|
|
6895
|
-
const [errorText, setErrorText] =
|
|
6896
|
-
const [files, setFiles] =
|
|
6897
|
-
const [uploaded, setUploaded] =
|
|
6898
|
-
const [previewState, setPreviewState] =
|
|
6919
|
+
const [errorText, setErrorText] = useState14();
|
|
6920
|
+
const [files, setFiles] = useState14([]);
|
|
6921
|
+
const [uploaded, setUploaded] = useState14(props.uploaded || []);
|
|
6922
|
+
const [previewState, setPreviewState] = useState14("idle");
|
|
6899
6923
|
const accepts = useMemo18(() => accept.split(",").map((accept2) => accept2.trim()), [accept]);
|
|
6900
6924
|
const parsedAccepts = useMemo18(
|
|
6901
6925
|
() => accepts.flatMap((type) => {
|
|
@@ -7157,13 +7181,13 @@ function IconMenuButton(props) {
|
|
|
7157
7181
|
IconMenuButton.displayName = "IconMenuButton";
|
|
7158
7182
|
|
|
7159
7183
|
// src/components/Markdown/Markdown.tsx
|
|
7160
|
-
import React47, { lazy, Suspense, useEffect as useEffect14, useState as
|
|
7184
|
+
import React47, { lazy, Suspense, useEffect as useEffect14, useState as useState15 } from "react";
|
|
7161
7185
|
import { Skeleton } from "@mui/joy";
|
|
7162
7186
|
import { Link as Link2 } from "@mui/joy";
|
|
7163
7187
|
import remarkGfm from "remark-gfm";
|
|
7164
7188
|
var LazyReactMarkdown = lazy(() => import("react-markdown"));
|
|
7165
7189
|
var Markdown = (props) => {
|
|
7166
|
-
const [rehypeAccent, setRehypeAccent] =
|
|
7190
|
+
const [rehypeAccent, setRehypeAccent] = useState15(null);
|
|
7167
7191
|
useEffect14(() => {
|
|
7168
7192
|
const loadRehypeAccent = async () => {
|
|
7169
7193
|
const module = await import("./chunks/rehype-accent-FZRUD7VI.js");
|
|
@@ -7345,7 +7369,7 @@ function MenuButton2(props) {
|
|
|
7345
7369
|
MenuButton2.displayName = "MenuButton";
|
|
7346
7370
|
|
|
7347
7371
|
// src/components/MonthPicker/MonthPicker.tsx
|
|
7348
|
-
import React49, { forwardRef as forwardRef10, useCallback as useCallback29, useEffect as useEffect15, useImperativeHandle as useImperativeHandle5, useRef as useRef12, useState as
|
|
7372
|
+
import React49, { forwardRef as forwardRef10, useCallback as useCallback29, useEffect as useEffect15, useImperativeHandle as useImperativeHandle5, useRef as useRef12, useState as useState16 } from "react";
|
|
7349
7373
|
import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
|
|
7350
7374
|
import { styled as styled23, useThemeProps as useThemeProps11 } from "@mui/joy";
|
|
7351
7375
|
import { FocusTrap as FocusTrap4, ClickAwayListener as ClickAwayListener4, Popper as Popper5 } from "@mui/base";
|
|
@@ -7430,11 +7454,15 @@ var MonthPicker = forwardRef10((inProps, ref) => {
|
|
|
7430
7454
|
} = props;
|
|
7431
7455
|
const innerRef = useRef12(null);
|
|
7432
7456
|
const buttonRef = useRef12(null);
|
|
7433
|
-
const [
|
|
7457
|
+
const [rawValue, setValue, isControlled] = useControlledState(
|
|
7434
7458
|
props.value,
|
|
7435
|
-
props.defaultValue
|
|
7436
|
-
useCallback29(
|
|
7459
|
+
props.defaultValue ?? null,
|
|
7460
|
+
useCallback29(
|
|
7461
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
7462
|
+
[props.name, onChange]
|
|
7463
|
+
)
|
|
7437
7464
|
);
|
|
7465
|
+
const value = rawValue ?? "";
|
|
7438
7466
|
const getFormattedDisplayValue = useCallback29(
|
|
7439
7467
|
(inputValue) => {
|
|
7440
7468
|
if (!inputValue) return "";
|
|
@@ -7446,8 +7474,8 @@ var MonthPicker = forwardRef10((inProps, ref) => {
|
|
|
7446
7474
|
},
|
|
7447
7475
|
[format, displayFormat, locale]
|
|
7448
7476
|
);
|
|
7449
|
-
const [displayValue, setDisplayValue] =
|
|
7450
|
-
const [anchorEl, setAnchorEl] =
|
|
7477
|
+
const [displayValue, setDisplayValue] = useState16(() => getFormattedDisplayValue(value));
|
|
7478
|
+
const [anchorEl, setAnchorEl] = useState16(null);
|
|
7451
7479
|
const open = Boolean(anchorEl);
|
|
7452
7480
|
useEffect15(() => {
|
|
7453
7481
|
if (!anchorEl) {
|