@ceed/ads 1.40.0 → 1.41.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/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 ?? defaultValue);
264
- const displayValue = isControlled ? controlledValue : internalValue;
263
+ const [internalValue, setInternalValue] = useState(controlledValue !== void 0 ? controlledValue : defaultValue);
264
+ const hasWarnedRef = useRef(false);
265
265
  useEffect(() => {
266
- if (isControlled) {
267
- setInternalValue(controlledValue);
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 [_value, setValue] = useControlledState(
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, useState as useState7 } from "react";
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
- props.value,
1836
- props.defaultValue,
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(props.defaultValue || "");
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, value && /* @__PURE__ */ React16.createElement(
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 [isOverLimit, setIsOverLimit] = useState7(!!max && !!value && value > max);
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(void 0);
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, max, useMinorUnit, setValue]
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 useState9,
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 useState8 } from "react";
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 [value, setValue] = useControlledState(
2856
+ const [rawValue, setValue] = useControlledState(
2851
2857
  props.value,
2852
- props.defaultValue || "",
2853
- useCallback9((value2) => onChange?.({ target: { name: props.name, value: value2 } }), [props.name, onChange])
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] = useState8(
2866
+ const [displayValue, setDisplayValue] = useState7(
2857
2867
  () => value ? formatValueString(parseDate(value, format), displayFormat, locale) : ""
2858
2868
  );
2859
- const [anchorEl, setAnchorEl] = useState8(null);
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] = useState9(false);
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] = useState9(false);
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] = useState9(false);
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] = useState9(row[field]);
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 useState10, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useMemo as useMemo10, useCallback as useCallback11, useEffect as useEffect6, createRef } from "react";
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] = useState10({});
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] = useState10(null);
3802
- const [selectionAnchor, setSelectionAnchor] = useState10(null);
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] = useState10(paginationModel?.page || 1);
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}`,
@@ -3963,8 +3973,10 @@ function useDataTableRenderer({
3963
3973
  () => pinnedColumns?.right?.filter((f) => visibleFieldSet.has(f)),
3964
3974
  [pinnedColumns?.right, visibleFieldSet]
3965
3975
  );
3976
+ const inferredFieldsKey = JSON.stringify(Object.keys(rows[0] || {}));
3977
+ const inferredFields = useMemo10(() => JSON.parse(inferredFieldsKey), [inferredFieldsKey]);
3966
3978
  const columns = useMemo10(() => {
3967
- const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] : Object.keys(rows[0] || {}).map((key) => ({
3979
+ const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] : inferredFields.map((key) => ({
3968
3980
  field: key
3969
3981
  }));
3970
3982
  return baseColumns.map((column) => {
@@ -3988,7 +4000,7 @@ function useDataTableRenderer({
3988
4000
  }, [
3989
4001
  visibleColumns,
3990
4002
  reorderedColumns,
3991
- rows,
4003
+ inferredFields,
3992
4004
  effectivePinnedLeft,
3993
4005
  effectivePinnedRight,
3994
4006
  visibleColumnsByField,
@@ -4932,7 +4944,7 @@ var DataTable = forwardRef7(Component);
4932
4944
  DataTable.displayName = "DataTable";
4933
4945
 
4934
4946
  // src/components/DateRangePicker/DateRangePicker.tsx
4935
- import React27, { forwardRef as forwardRef8, useCallback as useCallback14, useEffect as useEffect8, useImperativeHandle as useImperativeHandle3, useMemo as useMemo12, useRef as useRef8, useState as useState11 } from "react";
4947
+ 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";
4936
4948
  import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
4937
4949
  import CalendarTodayIcon2 from "@mui/icons-material/CalendarToday";
4938
4950
  import { styled as styled14, useThemeProps as useThemeProps7 } from "@mui/joy";
@@ -5139,16 +5151,20 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
5139
5151
  } = props;
5140
5152
  const innerRef = useRef8(null);
5141
5153
  const buttonRef = useRef8(null);
5142
- const [value, setValue] = useControlledState(
5154
+ const [rawValue, setValue] = useControlledState(
5143
5155
  props.value,
5144
- props.defaultValue || "",
5145
- useCallback14((value2) => onChange?.({ target: { name: props.name, value: value2 } }), [props.name, onChange])
5156
+ props.defaultValue ?? null,
5157
+ useCallback14(
5158
+ (value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
5159
+ [props.name, onChange]
5160
+ )
5146
5161
  );
5162
+ const value = rawValue ?? "";
5147
5163
  const isAlphabeticDisplay = hasAlphabeticMonth2(displayFormat);
5148
- const [displayValue, setDisplayValue] = useState11(
5164
+ const [displayValue, setDisplayValue] = useState10(
5149
5165
  () => value ? formatValueString2(parseDates(value, format), displayFormat, locale) : ""
5150
5166
  );
5151
- const [anchorEl, setAnchorEl] = useState11(null);
5167
+ const [anchorEl, setAnchorEl] = useState10(null);
5152
5168
  const open = Boolean(anchorEl);
5153
5169
  const calendarValue = useMemo12(
5154
5170
  () => value ? parseDates(value, format) : void 0,
@@ -5493,14 +5509,15 @@ var InsetDrawer = styled19(JoyDrawer)(({ theme }) => ({
5493
5509
  }));
5494
5510
 
5495
5511
  // src/components/FilterableCheckboxGroup/FilterableCheckboxGroup.tsx
5496
- import React31, { useCallback as useCallback15, useEffect as useEffect9, useMemo as useMemo13, useRef as useRef9, useState as useState12 } from "react";
5512
+ import React31, { useCallback as useCallback15, useEffect as useEffect9, useMemo as useMemo13, useRef as useRef9, useState as useState11 } from "react";
5497
5513
  import SearchIcon from "@mui/icons-material/Search";
5498
5514
  import { useThemeProps as useThemeProps8 } from "@mui/joy";
5499
5515
  import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
5516
+ var EMPTY_VALUE = [];
5500
5517
  function LabelWithTooltip(props) {
5501
5518
  const { label, size } = props;
5502
5519
  const labelContentRef = useRef9(null);
5503
- const [isOverflowing, setIsOverflowing] = useState12(false);
5520
+ const [isOverflowing, setIsOverflowing] = useState11(false);
5504
5521
  const labelContent = /* @__PURE__ */ React31.createElement(
5505
5522
  "span",
5506
5523
  {
@@ -5542,13 +5559,14 @@ function FilterableCheckboxGroup(inProps) {
5542
5559
  maxHeight = 300,
5543
5560
  disabled
5544
5561
  } = props;
5545
- const [searchTerm, setSearchTerm] = useState12("");
5546
- const [sortedOptions, setSortedOptions] = useState12(options);
5547
- const [internalValue, setInternalValue] = useControlledState(
5562
+ const [searchTerm, setSearchTerm] = useState11("");
5563
+ const [sortedOptions, setSortedOptions] = useState11(options);
5564
+ const [rawValue, setInternalValue] = useControlledState(
5548
5565
  value,
5549
- value ?? [],
5550
- useCallback15((newValue) => onChange?.(newValue), [onChange])
5566
+ value ?? EMPTY_VALUE,
5567
+ useCallback15((newValue) => onChange?.(newValue ?? []), [onChange])
5551
5568
  );
5569
+ const internalValue = rawValue ?? EMPTY_VALUE;
5552
5570
  const parentRef = useRef9(null);
5553
5571
  const isInitialSortRef = useRef9(false);
5554
5572
  const prevOptionsRef = useRef9([...options]);
@@ -5819,7 +5837,7 @@ function RadioGroup2(props) {
5819
5837
  RadioGroup2.displayName = "RadioGroup";
5820
5838
 
5821
5839
  // src/components/FilterMenu/components/DateRange.tsx
5822
- import React35, { useCallback as useCallback19, useMemo as useMemo14, useState as useState13, useEffect as useEffect10 } from "react";
5840
+ import React35, { useCallback as useCallback19, useMemo as useMemo14, useState as useState12, useEffect as useEffect10 } from "react";
5823
5841
  import { Stack as Stack5 } from "@mui/joy";
5824
5842
  function DateRange(props) {
5825
5843
  const {
@@ -5837,7 +5855,7 @@ function DateRange(props) {
5837
5855
  hideClearButton
5838
5856
  } = props;
5839
5857
  const [internalValue, setInternalValue] = useControlledState(value, null, onChange);
5840
- const [selectedOption, setSelectedOption] = useState13("all-time");
5858
+ const [selectedOption, setSelectedOption] = useState12("all-time");
5841
5859
  const dateRangeOptions = useMemo14(
5842
5860
  () => [
5843
5861
  { label: "All Time", value: "all-time" },
@@ -5966,7 +5984,7 @@ import React37, { useCallback as useCallback21, useMemo as useMemo16 } from "rea
5966
5984
  import { Stack as Stack6 } from "@mui/joy";
5967
5985
 
5968
5986
  // src/components/MonthRangePicker/MonthRangePicker.tsx
5969
- import React36, { forwardRef as forwardRef9, useCallback as useCallback20, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useMemo as useMemo15, useRef as useRef10, useState as useState14 } from "react";
5987
+ 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";
5970
5988
  import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
5971
5989
  import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
5972
5990
  import { styled as styled20, useThemeProps as useThemeProps9 } from "@mui/joy";
@@ -6083,15 +6101,19 @@ var MonthRangePicker = forwardRef9((inProps, ref) => {
6083
6101
  const isAlphabeticDisplay = hasAlphabeticMonth3(displayFormat);
6084
6102
  const innerRef = useRef10(null);
6085
6103
  const buttonRef = useRef10(null);
6086
- const [value, setValue] = useControlledState(
6104
+ const [rawValue, setValue] = useControlledState(
6087
6105
  props.value,
6088
- props.defaultValue || "",
6089
- useCallback20((value2) => onChange?.({ target: { name: props.name, value: value2 } }), [props.name, onChange])
6106
+ props.defaultValue ?? null,
6107
+ useCallback20(
6108
+ (value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
6109
+ [props.name, onChange]
6110
+ )
6090
6111
  );
6091
- const [displayValue, setDisplayValue] = useState14(
6112
+ const value = rawValue ?? "";
6113
+ const [displayValue, setDisplayValue] = useState13(
6092
6114
  () => value ? formatValueString3(parseDates2(value), displayFormat, locale) : ""
6093
6115
  );
6094
- const [anchorEl, setAnchorEl] = useState14(null);
6116
+ const [anchorEl, setAnchorEl] = useState13(null);
6095
6117
  const open = Boolean(anchorEl);
6096
6118
  const calendarValue = useMemo15(() => value ? parseDates2(value) : void 0, [value]);
6097
6119
  useEffect11(() => {
@@ -6314,7 +6336,7 @@ function CurrencyInput3(props) {
6314
6336
  const [internalValue, setInternalValue] = useControlledState(value, value, onChange);
6315
6337
  const handleCurrencyChange = useCallback22(
6316
6338
  (event) => {
6317
- const newValue = event.target.value;
6339
+ const newValue = event.target.value ?? void 0;
6318
6340
  setInternalValue(newValue);
6319
6341
  },
6320
6342
  [setInternalValue]
@@ -6347,7 +6369,7 @@ function CurrencyRange(props) {
6347
6369
  const maxValue = internalValue?.[1];
6348
6370
  const handleMinChange = useCallback23(
6349
6371
  (event) => {
6350
- const newMinValue = event.target.value;
6372
+ const newMinValue = event.target.value ?? void 0;
6351
6373
  const currentMaxValue = maxValue;
6352
6374
  if (newMinValue !== void 0 && currentMaxValue !== void 0) {
6353
6375
  setInternalValue([newMinValue, currentMaxValue]);
@@ -6361,7 +6383,7 @@ function CurrencyRange(props) {
6361
6383
  );
6362
6384
  const handleMaxChange = useCallback23(
6363
6385
  (event) => {
6364
- const newMaxValue = event.target.value;
6386
+ const newMaxValue = event.target.value ?? void 0;
6365
6387
  const currentMinValue = minValue;
6366
6388
  if (currentMinValue !== void 0 && newMaxValue !== void 0) {
6367
6389
  setInternalValue([currentMinValue, newMaxValue]);
@@ -6411,7 +6433,7 @@ import React41 from "react";
6411
6433
  import { Stack as Stack9, Typography as Typography5 } from "@mui/joy";
6412
6434
 
6413
6435
  // src/components/PercentageInput/PercentageInput.tsx
6414
- import React40, { useCallback as useCallback24, useMemo as useMemo17, useState as useState15 } from "react";
6436
+ import React40, { useCallback as useCallback24, useMemo as useMemo17 } from "react";
6415
6437
  import { NumericFormat as NumericFormat2 } from "react-number-format";
6416
6438
  import { styled as styled21, useThemeProps as useThemeProps10 } from "@mui/joy";
6417
6439
  var padDecimal = (value, decimalScale) => {
@@ -6467,34 +6489,30 @@ var PercentageInput = React40.forwardRef(
6467
6489
  } = props;
6468
6490
  const [_value, setValue] = useControlledState(
6469
6491
  props.value,
6470
- props.defaultValue,
6492
+ props.defaultValue ?? null,
6471
6493
  useCallback24((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
6472
6494
  );
6473
- const [internalError, setInternalError] = useState15(
6474
- max && _value && _value > max || min && _value && _value < min
6475
- );
6476
6495
  const value = useMemo17(() => {
6477
6496
  if (_value && useMinorUnit) {
6478
6497
  return _value / Math.pow(10, maxDecimalScale);
6479
6498
  }
6480
6499
  return _value;
6481
6500
  }, [_value, useMinorUnit, maxDecimalScale]);
6501
+ const internalError = useMemo17(
6502
+ () => value != null && (max != null && value > max || min != null && value < min),
6503
+ [max, min, value]
6504
+ );
6482
6505
  const handleChange = useCallback24(
6483
6506
  (event) => {
6484
6507
  if (event.target.value === "") {
6485
- setValue(void 0);
6508
+ setValue(null);
6486
6509
  return;
6487
6510
  }
6488
6511
  const originalAmount = Number(event.target.value);
6489
- if (min && originalAmount < min || max && originalAmount > max) {
6490
- setInternalError(true);
6491
- } else {
6492
- setInternalError(false);
6493
- }
6494
6512
  const amount = useMinorUnit ? padDecimal(originalAmount, maxDecimalScale) : originalAmount;
6495
6513
  setValue(amount);
6496
6514
  },
6497
- [setValue, useMinorUnit, maxDecimalScale, min, max]
6515
+ [setValue, useMinorUnit, maxDecimalScale]
6498
6516
  );
6499
6517
  return /* @__PURE__ */ React40.createElement(
6500
6518
  PercentageInputRoot,
@@ -6547,7 +6565,7 @@ var PercentageInput3 = ({
6547
6565
  PercentageInput,
6548
6566
  {
6549
6567
  value: _value,
6550
- onChange: (event) => setValue(event.target.value),
6568
+ onChange: (event) => setValue(event.target.value ?? void 0),
6551
6569
  useMinorUnit,
6552
6570
  maxDecimalScale,
6553
6571
  min,
@@ -6571,7 +6589,7 @@ function PercentageRange(props) {
6571
6589
  const maxValue = internalValue?.[1];
6572
6590
  const handleMinChange = useCallback25(
6573
6591
  (event) => {
6574
- const newMinValue = event.target.value;
6592
+ const newMinValue = event.target.value ?? void 0;
6575
6593
  const currentMaxValue = maxValue;
6576
6594
  if (newMinValue !== void 0) {
6577
6595
  setInternalValue([newMinValue, currentMaxValue || null]);
@@ -6583,7 +6601,7 @@ function PercentageRange(props) {
6583
6601
  );
6584
6602
  const handleMaxChange = useCallback25(
6585
6603
  (event) => {
6586
- const newMaxValue = event.target.value;
6604
+ const newMaxValue = event.target.value ?? void 0;
6587
6605
  const currentMinValue = minValue;
6588
6606
  if (newMaxValue !== void 0) {
6589
6607
  setInternalValue([currentMinValue || null, newMaxValue]);
@@ -6637,7 +6655,7 @@ function Autocomplete2(props) {
6637
6655
  const autocompleteValue = typeof internalValue === "string" || typeof internalValue === "number" ? String(internalValue) : void 0;
6638
6656
  const handleChange = useCallback26(
6639
6657
  (event) => {
6640
- const val = event.target.value;
6658
+ const val = event.target.value ?? void 0;
6641
6659
  if (val) {
6642
6660
  const numVal = Number(val);
6643
6661
  setInternalValue(!isNaN(numVal) && isFinite(numVal) ? numVal : val);
@@ -6740,7 +6758,7 @@ function FilterMenu(props) {
6740
6758
  FilterMenu.displayName = "FilterMenu";
6741
6759
 
6742
6760
  // src/components/Uploader/Uploader.tsx
6743
- import React45, { useCallback as useCallback28, useEffect as useEffect13, useMemo as useMemo18, useRef as useRef11, useState as useState16 } from "react";
6761
+ import React45, { useCallback as useCallback28, useEffect as useEffect13, useMemo as useMemo18, useRef as useRef11, useState as useState14 } from "react";
6744
6762
  import { styled as styled22, Input as Input2 } from "@mui/joy";
6745
6763
  import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
6746
6764
  import MuiUploadFileIcon from "@mui/icons-material/UploadFileRounded";
@@ -6890,10 +6908,10 @@ var Uploader = React45.memo((props) => {
6890
6908
  } = props;
6891
6909
  const dropZoneRef = useRef11(null);
6892
6910
  const inputRef = useRef11(null);
6893
- const [errorText, setErrorText] = useState16();
6894
- const [files, setFiles] = useState16([]);
6895
- const [uploaded, setUploaded] = useState16(props.uploaded || []);
6896
- const [previewState, setPreviewState] = useState16("idle");
6911
+ const [errorText, setErrorText] = useState14();
6912
+ const [files, setFiles] = useState14([]);
6913
+ const [uploaded, setUploaded] = useState14(props.uploaded || []);
6914
+ const [previewState, setPreviewState] = useState14("idle");
6897
6915
  const accepts = useMemo18(() => accept.split(",").map((accept2) => accept2.trim()), [accept]);
6898
6916
  const parsedAccepts = useMemo18(
6899
6917
  () => accepts.flatMap((type) => {
@@ -7155,13 +7173,13 @@ function IconMenuButton(props) {
7155
7173
  IconMenuButton.displayName = "IconMenuButton";
7156
7174
 
7157
7175
  // src/components/Markdown/Markdown.tsx
7158
- import React47, { lazy, Suspense, useEffect as useEffect14, useState as useState17 } from "react";
7176
+ import React47, { lazy, Suspense, useEffect as useEffect14, useState as useState15 } from "react";
7159
7177
  import { Skeleton } from "@mui/joy";
7160
7178
  import { Link as Link2 } from "@mui/joy";
7161
7179
  import remarkGfm from "remark-gfm";
7162
7180
  var LazyReactMarkdown = lazy(() => import("react-markdown"));
7163
7181
  var Markdown = (props) => {
7164
- const [rehypeAccent, setRehypeAccent] = useState17(null);
7182
+ const [rehypeAccent, setRehypeAccent] = useState15(null);
7165
7183
  useEffect14(() => {
7166
7184
  const loadRehypeAccent = async () => {
7167
7185
  const module = await import("./chunks/rehype-accent-FZRUD7VI.js");
@@ -7343,7 +7361,7 @@ function MenuButton2(props) {
7343
7361
  MenuButton2.displayName = "MenuButton";
7344
7362
 
7345
7363
  // src/components/MonthPicker/MonthPicker.tsx
7346
- import React49, { forwardRef as forwardRef10, useCallback as useCallback29, useEffect as useEffect15, useImperativeHandle as useImperativeHandle5, useRef as useRef12, useState as useState18 } from "react";
7364
+ import React49, { forwardRef as forwardRef10, useCallback as useCallback29, useEffect as useEffect15, useImperativeHandle as useImperativeHandle5, useRef as useRef12, useState as useState16 } from "react";
7347
7365
  import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
7348
7366
  import { styled as styled23, useThemeProps as useThemeProps11 } from "@mui/joy";
7349
7367
  import { FocusTrap as FocusTrap4, ClickAwayListener as ClickAwayListener4, Popper as Popper5 } from "@mui/base";
@@ -7428,11 +7446,15 @@ var MonthPicker = forwardRef10((inProps, ref) => {
7428
7446
  } = props;
7429
7447
  const innerRef = useRef12(null);
7430
7448
  const buttonRef = useRef12(null);
7431
- const [value, setValue, isControlled] = useControlledState(
7449
+ const [rawValue, setValue, isControlled] = useControlledState(
7432
7450
  props.value,
7433
- props.defaultValue || "",
7434
- useCallback29((value2) => onChange?.({ target: { name: props.name, value: value2 } }), [props.name, onChange])
7451
+ props.defaultValue ?? null,
7452
+ useCallback29(
7453
+ (value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
7454
+ [props.name, onChange]
7455
+ )
7435
7456
  );
7457
+ const value = rawValue ?? "";
7436
7458
  const getFormattedDisplayValue = useCallback29(
7437
7459
  (inputValue) => {
7438
7460
  if (!inputValue) return "";
@@ -7444,8 +7466,8 @@ var MonthPicker = forwardRef10((inProps, ref) => {
7444
7466
  },
7445
7467
  [format, displayFormat, locale]
7446
7468
  );
7447
- const [displayValue, setDisplayValue] = useState18(() => getFormattedDisplayValue(value));
7448
- const [anchorEl, setAnchorEl] = useState18(null);
7469
+ const [displayValue, setDisplayValue] = useState16(() => getFormattedDisplayValue(value));
7470
+ const [anchorEl, setAnchorEl] = useState16(null);
7449
7471
  const open = Boolean(anchorEl);
7450
7472
  useEffect15(() => {
7451
7473
  if (!anchorEl) {