@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.cjs
CHANGED
|
@@ -417,13 +417,17 @@ var IconButton_default = IconButton;
|
|
|
417
417
|
var import_react5 = require("react");
|
|
418
418
|
function useControlledState(controlledValue, defaultValue, onChange) {
|
|
419
419
|
const { current: isControlled } = (0, import_react5.useRef)(controlledValue !== void 0);
|
|
420
|
-
const [internalValue, setInternalValue] = (0, import_react5.useState)(controlledValue
|
|
421
|
-
const
|
|
420
|
+
const [internalValue, setInternalValue] = (0, import_react5.useState)(controlledValue !== void 0 ? controlledValue : defaultValue);
|
|
421
|
+
const hasWarnedRef = (0, import_react5.useRef)(false);
|
|
422
422
|
(0, import_react5.useEffect)(() => {
|
|
423
|
-
if (
|
|
424
|
-
|
|
425
|
-
|
|
423
|
+
if (false) return;
|
|
424
|
+
if (hasWarnedRef.current || isControlled === (controlledValue !== void 0)) return;
|
|
425
|
+
hasWarnedRef.current = true;
|
|
426
|
+
console.warn(
|
|
427
|
+
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."
|
|
428
|
+
);
|
|
426
429
|
}, [isControlled, controlledValue]);
|
|
430
|
+
const displayValue = isControlled ? controlledValue : internalValue;
|
|
427
431
|
const handleChange = (0, import_react5.useCallback)(
|
|
428
432
|
(value) => {
|
|
429
433
|
const newValue = typeof value === "function" ? value(displayValue) : value;
|
|
@@ -530,6 +534,7 @@ var AutocompleteListBox = import_react6.default.forwardRef((props, ref) => {
|
|
|
530
534
|
)
|
|
531
535
|
))));
|
|
532
536
|
});
|
|
537
|
+
var EMPTY_MULTIPLE_VALUE = [];
|
|
533
538
|
var autocompleteDeleteSize = {
|
|
534
539
|
sm: "20px",
|
|
535
540
|
md: "24px",
|
|
@@ -572,9 +577,9 @@ function Autocomplete(props) {
|
|
|
572
577
|
className,
|
|
573
578
|
...innerProps
|
|
574
579
|
} = props;
|
|
575
|
-
const [
|
|
580
|
+
const [rawValue, setValue] = useControlledState(
|
|
576
581
|
props.value,
|
|
577
|
-
props.defaultValue
|
|
582
|
+
props.defaultValue ?? null,
|
|
578
583
|
(0, import_react6.useCallback)(
|
|
579
584
|
(value2) => onChange?.({
|
|
580
585
|
target: {
|
|
@@ -585,6 +590,7 @@ function Autocomplete(props) {
|
|
|
585
590
|
[onChange, props.name]
|
|
586
591
|
)
|
|
587
592
|
);
|
|
593
|
+
const _value = rawValue ?? (props.multiple ? EMPTY_MULTIPLE_VALUE : "");
|
|
588
594
|
const options = (0, import_react6.useMemo)(
|
|
589
595
|
() => props.options.map((option) => {
|
|
590
596
|
if (typeof option !== "object") {
|
|
@@ -645,7 +651,7 @@ function Autocomplete(props) {
|
|
|
645
651
|
(event, value2) => {
|
|
646
652
|
const newValue = value2;
|
|
647
653
|
const _value2 = Array.isArray(newValue) ? newValue.map((value3) => value3.value) : newValue?.value;
|
|
648
|
-
setValue(_value2);
|
|
654
|
+
setValue(_value2 ?? null);
|
|
649
655
|
if (Array.isArray(newValue) && newValue.map((value3) => optionMap.get(value3.value)) || optionMap.get(newValue?.value)) {
|
|
650
656
|
onChangeComplete?.({
|
|
651
657
|
...event,
|
|
@@ -1967,6 +1973,10 @@ var Input = import_react18.default.forwardRef((props, ref) => {
|
|
|
1967
1973
|
onChange,
|
|
1968
1974
|
name,
|
|
1969
1975
|
type,
|
|
1976
|
+
// NOTE: value/defaultValue는 아래에서 직접 다루므로 innerProps 스프레드에서 제외한다.
|
|
1977
|
+
// defaultValue가 스프레드에 남으면 항상 정의되는 value와 함께 DOM input에 도달해 React가 경고한다.
|
|
1978
|
+
value: valueProp,
|
|
1979
|
+
defaultValue: defaultValueProp,
|
|
1970
1980
|
// NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
|
|
1971
1981
|
sx,
|
|
1972
1982
|
className,
|
|
@@ -1979,8 +1989,8 @@ var Input = import_react18.default.forwardRef((props, ref) => {
|
|
|
1979
1989
|
}
|
|
1980
1990
|
const [passwordVisible, setPasswordVisible] = (0, import_react18.useState)(false);
|
|
1981
1991
|
const [value, setValue] = useControlledState(
|
|
1982
|
-
|
|
1983
|
-
|
|
1992
|
+
valueProp,
|
|
1993
|
+
defaultValueProp ?? null,
|
|
1984
1994
|
(0, import_react18.useCallback)(
|
|
1985
1995
|
(value2) => {
|
|
1986
1996
|
onChange?.({
|
|
@@ -1999,8 +2009,9 @@ var Input = import_react18.default.forwardRef((props, ref) => {
|
|
|
1999
2009
|
setValue(e.target.value);
|
|
2000
2010
|
};
|
|
2001
2011
|
const handleClear = () => {
|
|
2002
|
-
setValue(
|
|
2012
|
+
setValue(defaultValueProp || "");
|
|
2003
2013
|
};
|
|
2014
|
+
const displayValue = valueProp !== void 0 ? valueProp : value;
|
|
2004
2015
|
const handleTogglePasswordVisibility = () => {
|
|
2005
2016
|
setPasswordVisible((prev) => !prev);
|
|
2006
2017
|
};
|
|
@@ -2010,7 +2021,7 @@ var Input = import_react18.default.forwardRef((props, ref) => {
|
|
|
2010
2021
|
const input = /* @__PURE__ */ import_react18.default.createElement(
|
|
2011
2022
|
MotionInput,
|
|
2012
2023
|
{
|
|
2013
|
-
value,
|
|
2024
|
+
value: displayValue ?? "",
|
|
2014
2025
|
name,
|
|
2015
2026
|
onChange: handleChange,
|
|
2016
2027
|
required,
|
|
@@ -2031,7 +2042,7 @@ var Input = import_react18.default.forwardRef((props, ref) => {
|
|
|
2031
2042
|
"aria-label": passwordVisible ? "Hide password" : "Show password"
|
|
2032
2043
|
},
|
|
2033
2044
|
passwordVisible ? /* @__PURE__ */ import_react18.default.createElement(import_VisibilityOff.default, null) : /* @__PURE__ */ import_react18.default.createElement(import_Visibility.default, null)
|
|
2034
|
-
)) : null : enableClearable ? /* @__PURE__ */ import_react18.default.createElement(Stack_default, { gap: 1, direction: "row" }, innerProps.endDecorator,
|
|
2045
|
+
)) : null : enableClearable ? /* @__PURE__ */ import_react18.default.createElement(Stack_default, { gap: 1, direction: "row" }, innerProps.endDecorator, displayValue && /* @__PURE__ */ import_react18.default.createElement(
|
|
2035
2046
|
IconButton_default,
|
|
2036
2047
|
{
|
|
2037
2048
|
onMouseDown: (e) => e.preventDefault(),
|
|
@@ -2269,7 +2280,7 @@ var CurrencyInput = import_react19.default.forwardRef(function CurrencyInput2(in
|
|
|
2269
2280
|
const { symbol, thousandSeparator, decimalSeparator, placeholder, fixedDecimalScale, decimalScale } = useCurrencySetting(props);
|
|
2270
2281
|
const [_value, setValue] = useControlledState(
|
|
2271
2282
|
props.value,
|
|
2272
|
-
props.defaultValue,
|
|
2283
|
+
props.defaultValue ?? null,
|
|
2273
2284
|
(0, import_react19.useCallback)((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
2274
2285
|
);
|
|
2275
2286
|
const value = (0, import_react19.useMemo)(() => {
|
|
@@ -2284,22 +2295,17 @@ var CurrencyInput = import_react19.default.forwardRef(function CurrencyInput2(in
|
|
|
2284
2295
|
}
|
|
2285
2296
|
return props.max;
|
|
2286
2297
|
}, [props.max, useMinorUnit, decimalScale]);
|
|
2287
|
-
const
|
|
2298
|
+
const isOverLimit = (0, import_react19.useMemo)(() => max != null && value != null && value > max, [max, value]);
|
|
2288
2299
|
const handleChange = (0, import_react19.useCallback)(
|
|
2289
2300
|
(event) => {
|
|
2290
2301
|
if (event.target.value === "") {
|
|
2291
|
-
setValue(
|
|
2302
|
+
setValue(null);
|
|
2292
2303
|
return;
|
|
2293
2304
|
}
|
|
2294
2305
|
const amount = useMinorUnit ? Number(decimalSeparator ? event.target.value?.replace(decimalSeparator, "") : event.target.value) : Number(event.target.value);
|
|
2295
|
-
if (!!max && Number(event.target.value) > max) {
|
|
2296
|
-
setIsOverLimit(true);
|
|
2297
|
-
} else {
|
|
2298
|
-
setIsOverLimit(false);
|
|
2299
|
-
}
|
|
2300
2306
|
setValue(amount);
|
|
2301
2307
|
},
|
|
2302
|
-
[decimalSeparator,
|
|
2308
|
+
[decimalSeparator, useMinorUnit, setValue]
|
|
2303
2309
|
);
|
|
2304
2310
|
return /* @__PURE__ */ import_react19.default.createElement(
|
|
2305
2311
|
CurrencyInputRoot,
|
|
@@ -2977,11 +2983,15 @@ var DatePicker = (0, import_react21.forwardRef)((inProps, ref) => {
|
|
|
2977
2983
|
} = props;
|
|
2978
2984
|
const innerRef = (0, import_react21.useRef)(null);
|
|
2979
2985
|
const buttonRef = (0, import_react21.useRef)(null);
|
|
2980
|
-
const [
|
|
2986
|
+
const [rawValue, setValue] = useControlledState(
|
|
2981
2987
|
props.value,
|
|
2982
|
-
props.defaultValue
|
|
2983
|
-
(0, import_react21.useCallback)(
|
|
2988
|
+
props.defaultValue ?? null,
|
|
2989
|
+
(0, import_react21.useCallback)(
|
|
2990
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
2991
|
+
[props.name, onChange]
|
|
2992
|
+
)
|
|
2984
2993
|
);
|
|
2994
|
+
const value = rawValue ?? "";
|
|
2985
2995
|
const isAlphabeticDisplay = hasAlphabeticMonth(displayFormat);
|
|
2986
2996
|
const [displayValue, setDisplayValue] = (0, import_react21.useState)(
|
|
2987
2997
|
() => value ? formatValueString(parseDate(value, format), displayFormat, locale) : ""
|
|
@@ -4695,7 +4705,8 @@ function Component(props, apiRef) {
|
|
|
4695
4705
|
const totalSize = virtualizer.getTotalSize();
|
|
4696
4706
|
const virtualizedItems = virtualizer.getVirtualItems();
|
|
4697
4707
|
const showNoRowsOverlay = !loading && rowCount === 0;
|
|
4698
|
-
const
|
|
4708
|
+
const showFillerColumn = columns.length > 0 && columns.every((c) => !!c.width);
|
|
4709
|
+
const totalColCount = Math.max(1, columns.length + (checkboxSelection ? 1 : 0) + (showFillerColumn ? 1 : 0));
|
|
4699
4710
|
const getRowClickHandler = (0, import_react29.useCallback)(
|
|
4700
4711
|
(row, rowId) => (e) => {
|
|
4701
4712
|
onRowClick?.({ row, rowId }, e);
|
|
@@ -4886,7 +4897,7 @@ function Component(props, apiRef) {
|
|
|
4886
4897
|
minWidth: c.minWidth ?? "50px"
|
|
4887
4898
|
}
|
|
4888
4899
|
}
|
|
4889
|
-
))), /* @__PURE__ */ import_react29.default.createElement("thead", null, processedColumnGroups && processedColumnGroups.groups.length > 0 && processedColumnGroups.groups.map((levelGroups, level) => /* @__PURE__ */ import_react29.default.createElement("tr", { key: `group-level-${level}` }, checkboxSelection && level === 0 && /* @__PURE__ */ import_react29.default.createElement(
|
|
4900
|
+
)), showFillerColumn && /* @__PURE__ */ import_react29.default.createElement("col", { style: { minWidth: 0 } })), /* @__PURE__ */ import_react29.default.createElement("thead", null, processedColumnGroups && processedColumnGroups.groups.length > 0 && processedColumnGroups.groups.map((levelGroups, level) => /* @__PURE__ */ import_react29.default.createElement("tr", { key: `group-level-${level}` }, checkboxSelection && level === 0 && /* @__PURE__ */ import_react29.default.createElement(
|
|
4890
4901
|
"th",
|
|
4891
4902
|
{
|
|
4892
4903
|
rowSpan: processedColumnGroups.maxLevel + 2,
|
|
@@ -4915,7 +4926,13 @@ function Component(props, apiRef) {
|
|
|
4915
4926
|
},
|
|
4916
4927
|
group.headerName ?? group.groupId
|
|
4917
4928
|
), emptyCells > 0 && Array.from({ length: emptyCells }).map((_2, i) => /* @__PURE__ */ import_react29.default.createElement("th", { key: `empty-between-${level}-${groupIndex}-${i}`, colSpan: 1 })));
|
|
4918
|
-
})
|
|
4929
|
+
}), showFillerColumn && level === 0 && /* @__PURE__ */ import_react29.default.createElement(
|
|
4930
|
+
"th",
|
|
4931
|
+
{
|
|
4932
|
+
"aria-hidden": "true",
|
|
4933
|
+
rowSpan: processedColumnGroups.maxLevel + 2
|
|
4934
|
+
}
|
|
4935
|
+
))), /* @__PURE__ */ import_react29.default.createElement("tr", null, (!processedColumnGroups || processedColumnGroups.groups.length === 0) && checkboxSelection && /* @__PURE__ */ import_react29.default.createElement(
|
|
4919
4936
|
"th",
|
|
4920
4937
|
{
|
|
4921
4938
|
style: {
|
|
@@ -4938,7 +4955,7 @@ function Component(props, apiRef) {
|
|
|
4938
4955
|
...c
|
|
4939
4956
|
}
|
|
4940
4957
|
)
|
|
4941
|
-
)))), /* @__PURE__ */ import_react29.default.createElement(
|
|
4958
|
+
)), showFillerColumn && (!processedColumnGroups || processedColumnGroups.groups.length === 0) && /* @__PURE__ */ import_react29.default.createElement("th", { "aria-hidden": "true" }))), /* @__PURE__ */ import_react29.default.createElement(
|
|
4942
4959
|
VirtualizedTableBody,
|
|
4943
4960
|
{
|
|
4944
4961
|
ref: tableBodyRef,
|
|
@@ -5037,7 +5054,8 @@ function Component(props, apiRef) {
|
|
|
5037
5054
|
editMode,
|
|
5038
5055
|
noWrap: props.noWrap
|
|
5039
5056
|
}
|
|
5040
|
-
)
|
|
5057
|
+
),
|
|
5058
|
+
showFillerColumn && /* @__PURE__ */ import_react29.default.createElement("td", { "aria-hidden": "true" })
|
|
5041
5059
|
);
|
|
5042
5060
|
})
|
|
5043
5061
|
), Footer && /* @__PURE__ */ import_react29.default.createElement(Footer, null))
|
|
@@ -5266,11 +5284,15 @@ var DateRangePicker = (0, import_react30.forwardRef)((inProps, ref) => {
|
|
|
5266
5284
|
} = props;
|
|
5267
5285
|
const innerRef = (0, import_react30.useRef)(null);
|
|
5268
5286
|
const buttonRef = (0, import_react30.useRef)(null);
|
|
5269
|
-
const [
|
|
5287
|
+
const [rawValue, setValue] = useControlledState(
|
|
5270
5288
|
props.value,
|
|
5271
|
-
props.defaultValue
|
|
5272
|
-
(0, import_react30.useCallback)(
|
|
5289
|
+
props.defaultValue ?? null,
|
|
5290
|
+
(0, import_react30.useCallback)(
|
|
5291
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
5292
|
+
[props.name, onChange]
|
|
5293
|
+
)
|
|
5273
5294
|
);
|
|
5295
|
+
const value = rawValue ?? "";
|
|
5274
5296
|
const isAlphabeticDisplay = hasAlphabeticMonth2(displayFormat);
|
|
5275
5297
|
const [displayValue, setDisplayValue] = (0, import_react30.useState)(
|
|
5276
5298
|
() => value ? formatValueString2(parseDates(value, format), displayFormat, locale) : ""
|
|
@@ -5641,6 +5663,7 @@ var import_react35 = __toESM(require("react"));
|
|
|
5641
5663
|
var import_Search = __toESM(require("@mui/icons-material/Search"));
|
|
5642
5664
|
var import_joy45 = require("@mui/joy");
|
|
5643
5665
|
var import_react_virtual3 = require("@tanstack/react-virtual");
|
|
5666
|
+
var EMPTY_VALUE = [];
|
|
5644
5667
|
function LabelWithTooltip(props) {
|
|
5645
5668
|
const { label, size } = props;
|
|
5646
5669
|
const labelContentRef = (0, import_react35.useRef)(null);
|
|
@@ -5688,11 +5711,12 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5688
5711
|
} = props;
|
|
5689
5712
|
const [searchTerm, setSearchTerm] = (0, import_react35.useState)("");
|
|
5690
5713
|
const [sortedOptions, setSortedOptions] = (0, import_react35.useState)(options);
|
|
5691
|
-
const [
|
|
5714
|
+
const [rawValue, setInternalValue] = useControlledState(
|
|
5692
5715
|
value,
|
|
5693
|
-
value ??
|
|
5694
|
-
(0, import_react35.useCallback)((newValue) => onChange?.(newValue), [onChange])
|
|
5716
|
+
value ?? EMPTY_VALUE,
|
|
5717
|
+
(0, import_react35.useCallback)((newValue) => onChange?.(newValue ?? []), [onChange])
|
|
5695
5718
|
);
|
|
5719
|
+
const internalValue = rawValue ?? EMPTY_VALUE;
|
|
5696
5720
|
const parentRef = (0, import_react35.useRef)(null);
|
|
5697
5721
|
const isInitialSortRef = (0, import_react35.useRef)(false);
|
|
5698
5722
|
const prevOptionsRef = (0, import_react35.useRef)([...options]);
|
|
@@ -6188,11 +6212,15 @@ var MonthPicker = (0, import_react39.forwardRef)((inProps, ref) => {
|
|
|
6188
6212
|
} = props;
|
|
6189
6213
|
const innerRef = (0, import_react39.useRef)(null);
|
|
6190
6214
|
const buttonRef = (0, import_react39.useRef)(null);
|
|
6191
|
-
const [
|
|
6215
|
+
const [rawValue, setValue, isControlled] = useControlledState(
|
|
6192
6216
|
props.value,
|
|
6193
|
-
props.defaultValue
|
|
6194
|
-
(0, import_react39.useCallback)(
|
|
6217
|
+
props.defaultValue ?? null,
|
|
6218
|
+
(0, import_react39.useCallback)(
|
|
6219
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
6220
|
+
[props.name, onChange]
|
|
6221
|
+
)
|
|
6195
6222
|
);
|
|
6223
|
+
const value = rawValue ?? "";
|
|
6196
6224
|
const getFormattedDisplayValue = (0, import_react39.useCallback)(
|
|
6197
6225
|
(inputValue) => {
|
|
6198
6226
|
if (!inputValue) return "";
|
|
@@ -6474,11 +6502,15 @@ var MonthRangePicker = (0, import_react40.forwardRef)((inProps, ref) => {
|
|
|
6474
6502
|
const isAlphabeticDisplay = hasAlphabeticMonth3(displayFormat);
|
|
6475
6503
|
const innerRef = (0, import_react40.useRef)(null);
|
|
6476
6504
|
const buttonRef = (0, import_react40.useRef)(null);
|
|
6477
|
-
const [
|
|
6505
|
+
const [rawValue, setValue] = useControlledState(
|
|
6478
6506
|
props.value,
|
|
6479
|
-
props.defaultValue
|
|
6480
|
-
(0, import_react40.useCallback)(
|
|
6507
|
+
props.defaultValue ?? null,
|
|
6508
|
+
(0, import_react40.useCallback)(
|
|
6509
|
+
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
6510
|
+
[props.name, onChange]
|
|
6511
|
+
)
|
|
6481
6512
|
);
|
|
6513
|
+
const value = rawValue ?? "";
|
|
6482
6514
|
const [displayValue, setDisplayValue] = (0, import_react40.useState)(
|
|
6483
6515
|
() => value ? formatValueString4(parseDates2(value), displayFormat, locale) : ""
|
|
6484
6516
|
);
|
|
@@ -6810,34 +6842,30 @@ var PercentageInput = import_react44.default.forwardRef(
|
|
|
6810
6842
|
} = props;
|
|
6811
6843
|
const [_value, setValue] = useControlledState(
|
|
6812
6844
|
props.value,
|
|
6813
|
-
props.defaultValue,
|
|
6845
|
+
props.defaultValue ?? null,
|
|
6814
6846
|
(0, import_react44.useCallback)((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
6815
6847
|
);
|
|
6816
|
-
const [internalError, setInternalError] = (0, import_react44.useState)(
|
|
6817
|
-
max && _value && _value > max || min && _value && _value < min
|
|
6818
|
-
);
|
|
6819
6848
|
const value = (0, import_react44.useMemo)(() => {
|
|
6820
6849
|
if (_value && useMinorUnit) {
|
|
6821
6850
|
return _value / Math.pow(10, maxDecimalScale);
|
|
6822
6851
|
}
|
|
6823
6852
|
return _value;
|
|
6824
6853
|
}, [_value, useMinorUnit, maxDecimalScale]);
|
|
6854
|
+
const internalError = (0, import_react44.useMemo)(
|
|
6855
|
+
() => value != null && (max != null && value > max || min != null && value < min),
|
|
6856
|
+
[max, min, value]
|
|
6857
|
+
);
|
|
6825
6858
|
const handleChange = (0, import_react44.useCallback)(
|
|
6826
6859
|
(event) => {
|
|
6827
6860
|
if (event.target.value === "") {
|
|
6828
|
-
setValue(
|
|
6861
|
+
setValue(null);
|
|
6829
6862
|
return;
|
|
6830
6863
|
}
|
|
6831
6864
|
const originalAmount = Number(event.target.value);
|
|
6832
|
-
if (min && originalAmount < min || max && originalAmount > max) {
|
|
6833
|
-
setInternalError(true);
|
|
6834
|
-
} else {
|
|
6835
|
-
setInternalError(false);
|
|
6836
|
-
}
|
|
6837
6865
|
const amount = useMinorUnit ? padDecimal(originalAmount, maxDecimalScale) : originalAmount;
|
|
6838
6866
|
setValue(amount);
|
|
6839
6867
|
},
|
|
6840
|
-
[setValue, useMinorUnit, maxDecimalScale
|
|
6868
|
+
[setValue, useMinorUnit, maxDecimalScale]
|
|
6841
6869
|
);
|
|
6842
6870
|
return /* @__PURE__ */ import_react44.default.createElement(
|
|
6843
6871
|
PercentageInputRoot,
|