@ceed/ads 1.41.3 → 1.41.4
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 +4 -4
- package/dist/components/Autocomplete/index.d.ts +2 -1
- package/dist/components/DataTable/hooks.d.ts +3 -5
- package/dist/components/DataTable/types.d.ts +1 -0
- package/dist/components/DataTable/utils.d.ts +11 -0
- package/dist/components/IconMenuButton/IconMenuButton.d.ts +9 -8
- package/dist/components/IconMenuButton/IconMenuButton.type-test.d.ts +5 -0
- package/dist/components/IconMenuButton/index.d.ts +2 -1
- package/dist/components/Modal/Modal.d.ts +1 -4
- package/dist/components/Select/Select.d.ts +7 -4
- package/dist/components/Select/index.d.ts +2 -1
- package/dist/components/Textarea/Textarea.d.ts +1 -4
- package/dist/components/Textarea/index.d.ts +2 -1
- package/dist/components/data-display/DataTable.md +25 -23
- package/dist/components/inputs/Calendar.md +17 -17
- package/dist/components/navigation/IconMenuButton.md +17 -12
- package/dist/index.browser.js +6 -6
- package/dist/index.browser.js.map +4 -4
- package/dist/index.cjs +774 -692
- package/dist/index.js +378 -296
- package/dist/libs/slot-props.d.ts +22 -0
- package/framer/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -182,7 +182,7 @@ function Alert(inProps) {
|
|
|
182
182
|
Alert.displayName = "Alert";
|
|
183
183
|
|
|
184
184
|
// src/components/Autocomplete/Autocomplete.tsx
|
|
185
|
-
import React5, { useCallback as
|
|
185
|
+
import React5, { useCallback as useCallback3, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef3 } from "react";
|
|
186
186
|
import {
|
|
187
187
|
Autocomplete as JoyAutocomplete,
|
|
188
188
|
AutocompleteOption as JoyAutocompleteOption,
|
|
@@ -284,6 +284,46 @@ function useControlledState(controlledValue, defaultValue, onChange) {
|
|
|
284
284
|
return [displayValue, handleChange, isControlled];
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
// src/libs/slot-props.ts
|
|
288
|
+
import { useCallback as useCallback2, useMemo, useRef as useRef2 } from "react";
|
|
289
|
+
function assignRef(ref, value) {
|
|
290
|
+
if (typeof ref === "function") ref(value);
|
|
291
|
+
else if (ref) ref.current = value;
|
|
292
|
+
}
|
|
293
|
+
function mergeRefs(...refs) {
|
|
294
|
+
const live = refs.filter((r) => r != null);
|
|
295
|
+
if (live.length === 0) return void 0;
|
|
296
|
+
if (live.length === 1) return live[0];
|
|
297
|
+
return (value) => live.forEach((r) => assignRef(r, value));
|
|
298
|
+
}
|
|
299
|
+
function useMergedRef(a, b) {
|
|
300
|
+
return useMemo(() => mergeRefs(a, b), [a, b]);
|
|
301
|
+
}
|
|
302
|
+
function useSlotRef(slotProp, ref) {
|
|
303
|
+
const isFunctionForm = typeof slotProp === "function";
|
|
304
|
+
const slotRef = isFunctionForm ? void 0 : slotProp?.ref;
|
|
305
|
+
const mergedRef = useMergedRef(slotRef, ref);
|
|
306
|
+
const latestSlotRef = useRef2(null);
|
|
307
|
+
const stableMergedRef = useCallback2(
|
|
308
|
+
(value) => {
|
|
309
|
+
assignRef(latestSlotRef.current, value);
|
|
310
|
+
assignRef(ref, value);
|
|
311
|
+
},
|
|
312
|
+
[ref]
|
|
313
|
+
);
|
|
314
|
+
return useMemo(() => {
|
|
315
|
+
if (isFunctionForm) {
|
|
316
|
+
return ((ownerState) => {
|
|
317
|
+
const resolved = slotProp(ownerState) ?? {};
|
|
318
|
+
const resolvedRef = resolved.ref;
|
|
319
|
+
latestSlotRef.current = resolvedRef ?? null;
|
|
320
|
+
return resolvedRef || ref ? { ...resolved, ref: stableMergedRef } : { ...resolved };
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
return mergedRef ? { ...slotProp, ref: mergedRef } : { ...slotProp };
|
|
324
|
+
}, [isFunctionForm, slotProp, mergedRef, ref, stableMergedRef]);
|
|
325
|
+
}
|
|
326
|
+
|
|
287
327
|
// src/components/Autocomplete/Autocomplete.tsx
|
|
288
328
|
var AutocompletePopper = styled3(Popper, {
|
|
289
329
|
name: "Autocomplete",
|
|
@@ -306,13 +346,13 @@ var AutocompleteListBox = React5.forwardRef((props, ref) => {
|
|
|
306
346
|
ownerState: { loading, size: fontSize },
|
|
307
347
|
...innerProps
|
|
308
348
|
} = props;
|
|
309
|
-
const parentRef =
|
|
349
|
+
const parentRef = useRef3(null);
|
|
310
350
|
const isGrouped = children[0].every((child) => child.hasOwnProperty("group"));
|
|
311
|
-
const itemHeight =
|
|
351
|
+
const itemHeight = useMemo2(() => {
|
|
312
352
|
const heights = itemHeightMap[fontSize ?? "md"];
|
|
313
353
|
return hasSecondaryText ? heights.secondary : heights.default;
|
|
314
354
|
}, [fontSize, hasSecondaryText]);
|
|
315
|
-
const renderTargets =
|
|
355
|
+
const renderTargets = useMemo2(() => {
|
|
316
356
|
if (loading) {
|
|
317
357
|
return [children[1]];
|
|
318
358
|
}
|
|
@@ -404,7 +444,7 @@ var autocompleteFilterOptions = createFilterOptions({
|
|
|
404
444
|
}
|
|
405
445
|
});
|
|
406
446
|
var getOptionLabel = (option) => `${option.label ?? ""}`;
|
|
407
|
-
function
|
|
447
|
+
function AutocompleteInner(props, ref) {
|
|
408
448
|
const {
|
|
409
449
|
label,
|
|
410
450
|
error,
|
|
@@ -423,7 +463,7 @@ function Autocomplete(props) {
|
|
|
423
463
|
const [rawValue, setValue] = useControlledState(
|
|
424
464
|
props.value,
|
|
425
465
|
props.defaultValue ?? null,
|
|
426
|
-
|
|
466
|
+
useCallback3(
|
|
427
467
|
(value2) => onChange?.({
|
|
428
468
|
target: {
|
|
429
469
|
value: value2,
|
|
@@ -434,7 +474,7 @@ function Autocomplete(props) {
|
|
|
434
474
|
)
|
|
435
475
|
);
|
|
436
476
|
const _value = rawValue ?? (props.multiple ? EMPTY_MULTIPLE_VALUE : "");
|
|
437
|
-
const options =
|
|
477
|
+
const options = useMemo2(
|
|
438
478
|
() => props.options.map((option) => {
|
|
439
479
|
if (typeof option !== "object") {
|
|
440
480
|
return {
|
|
@@ -446,14 +486,14 @@ function Autocomplete(props) {
|
|
|
446
486
|
}),
|
|
447
487
|
[props.options]
|
|
448
488
|
);
|
|
449
|
-
const optionMap =
|
|
489
|
+
const optionMap = useMemo2(() => {
|
|
450
490
|
const map = /* @__PURE__ */ new Map();
|
|
451
491
|
options.forEach((option) => {
|
|
452
492
|
map.set(option.value, option);
|
|
453
493
|
});
|
|
454
494
|
return map;
|
|
455
495
|
}, [options]);
|
|
456
|
-
const value =
|
|
496
|
+
const value = useMemo2(() => {
|
|
457
497
|
if (props.loading) {
|
|
458
498
|
return {
|
|
459
499
|
value: "",
|
|
@@ -466,31 +506,33 @@ function Autocomplete(props) {
|
|
|
466
506
|
}
|
|
467
507
|
return optionMap.get(_value);
|
|
468
508
|
}, [_value, optionMap, props.loading]);
|
|
469
|
-
const applySize =
|
|
509
|
+
const applySize = useCallback3(
|
|
470
510
|
(node) => {
|
|
471
511
|
return React5.isValidElement(node) && !props.loading ? React5.cloneElement(node, { ...{ size } }) : node;
|
|
472
512
|
},
|
|
473
513
|
[size, props.loading]
|
|
474
514
|
);
|
|
475
|
-
const startDecorator =
|
|
515
|
+
const startDecorator = useMemo2(
|
|
476
516
|
() => applySize(value?.startDecorator || props.startDecorator),
|
|
477
517
|
[value, applySize, props.startDecorator]
|
|
478
518
|
);
|
|
479
|
-
const endDecorator =
|
|
519
|
+
const endDecorator = useMemo2(
|
|
480
520
|
() => applySize(value?.endDecorator || props.endDecorator),
|
|
481
521
|
[value, applySize, props.endDecorator]
|
|
482
522
|
);
|
|
483
|
-
const
|
|
523
|
+
const inputSlotProps = useSlotRef(props.slotProps?.input, ref);
|
|
524
|
+
const slotProps = useMemo2(
|
|
484
525
|
() => ({
|
|
485
526
|
...props.slotProps,
|
|
486
527
|
listbox: {
|
|
487
528
|
...props.slotProps?.listbox,
|
|
488
529
|
hasSecondaryText: options.some((opt) => opt.secondaryText)
|
|
489
|
-
}
|
|
530
|
+
},
|
|
531
|
+
input: inputSlotProps
|
|
490
532
|
}),
|
|
491
|
-
[options, props.slotProps]
|
|
533
|
+
[options, props.slotProps, inputSlotProps]
|
|
492
534
|
);
|
|
493
|
-
const handleChange =
|
|
535
|
+
const handleChange = useCallback3(
|
|
494
536
|
(event, value2) => {
|
|
495
537
|
const newValue = value2;
|
|
496
538
|
const _value2 = Array.isArray(newValue) ? newValue.map((value3) => value3.value) : newValue?.value;
|
|
@@ -522,9 +564,9 @@ function Autocomplete(props) {
|
|
|
522
564
|
endDecorator,
|
|
523
565
|
getOptionLabel,
|
|
524
566
|
renderTags: (tags, getTagProps) => tags.map((tag, index) => {
|
|
525
|
-
const { onClick, ...rest } = getTagProps({ index });
|
|
567
|
+
const { onClick, key, ...rest } = getTagProps({ index });
|
|
526
568
|
return applySize(
|
|
527
|
-
/* @__PURE__ */ React5.createElement(Chip_default, { color: "primary", ...rest }, /* @__PURE__ */ React5.createElement(Stack_default, { direction: "row", alignItems: "center", gap: 2, py: 0.5 }, tag.value, applySize(
|
|
569
|
+
/* @__PURE__ */ React5.createElement(Chip_default, { key, color: "primary", ...rest }, /* @__PURE__ */ React5.createElement(Stack_default, { direction: "row", alignItems: "center", gap: 2, py: 0.5 }, tag.value, applySize(
|
|
528
570
|
/* @__PURE__ */ React5.createElement(AutocompleteTagDelete, { color: "primary", variant: "soft", onClick, size }, /* @__PURE__ */ React5.createElement(CloseIcon, null))
|
|
529
571
|
)))
|
|
530
572
|
);
|
|
@@ -534,26 +576,29 @@ function Autocomplete(props) {
|
|
|
534
576
|
},
|
|
535
577
|
slotProps,
|
|
536
578
|
filterOptions: autocompleteFilterOptions,
|
|
537
|
-
renderOption: (props2, option) =>
|
|
538
|
-
|
|
539
|
-
{
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
applySize(option.label)
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
579
|
+
renderOption: (props2, option) => {
|
|
580
|
+
const { key, ...optionProps } = props2;
|
|
581
|
+
return /* @__PURE__ */ React5.createElement(JoyAutocompleteOption, { key, ...optionProps }, option.startDecorator && /* @__PURE__ */ React5.createElement(
|
|
582
|
+
ListItemDecorator,
|
|
583
|
+
{
|
|
584
|
+
sx: (theme) => ({
|
|
585
|
+
marginInlineEnd: `var(--Input-gap, ${theme.spacing(1)})`
|
|
586
|
+
})
|
|
587
|
+
},
|
|
588
|
+
applySize(option.startDecorator)
|
|
589
|
+
), option.secondaryText ? /* @__PURE__ */ React5.createElement(ListItemContent, { sx: { gap: 0.5 } }, /* @__PURE__ */ React5.createElement(Typography2, { level: "inherit" }, applySize(option.label)), /* @__PURE__ */ React5.createElement(Typography2, { level: secondaryTextLevelMap[size ?? "md"], textColor: "text.tertiary" }, option.secondaryText)) : (
|
|
590
|
+
// TODO: haulla에서 사용할 때, label을 ReactNode로 넘기면 에러가 발생함....
|
|
591
|
+
applySize(option.label)
|
|
592
|
+
), option.endDecorator && /* @__PURE__ */ React5.createElement(
|
|
593
|
+
ListItemDecorator,
|
|
594
|
+
{
|
|
595
|
+
sx: (theme) => ({
|
|
596
|
+
marginInlineStart: `var(--Input-gap, ${theme.spacing(1)})`
|
|
597
|
+
})
|
|
598
|
+
},
|
|
599
|
+
applySize(option.endDecorator)
|
|
600
|
+
));
|
|
601
|
+
},
|
|
557
602
|
renderGroup: (params) => params
|
|
558
603
|
}
|
|
559
604
|
);
|
|
@@ -573,13 +618,14 @@ function Autocomplete(props) {
|
|
|
573
618
|
helperText && /* @__PURE__ */ React5.createElement(FormHelperText_default, null, helperText)
|
|
574
619
|
);
|
|
575
620
|
}
|
|
621
|
+
var Autocomplete = React5.forwardRef(AutocompleteInner);
|
|
576
622
|
Autocomplete.displayName = "Autocomplete";
|
|
577
623
|
|
|
578
624
|
// src/components/Autocomplete/index.ts
|
|
579
625
|
var Autocomplete_default = Autocomplete;
|
|
580
626
|
|
|
581
627
|
// src/components/Avatar/Avatar.tsx
|
|
582
|
-
import React6, { forwardRef as forwardRef2, useMemo as
|
|
628
|
+
import React6, { forwardRef as forwardRef2, useMemo as useMemo3 } from "react";
|
|
583
629
|
import { Avatar as JoyAvatar, AvatarGroup, styled as styled4, useThemeProps as useThemeProps2 } from "@mui/joy";
|
|
584
630
|
var StyledAvatar = styled4(JoyAvatar, {
|
|
585
631
|
name: "Avatar",
|
|
@@ -607,7 +653,7 @@ var Avatar = forwardRef2(function Avatar2(inProps, ref) {
|
|
|
607
653
|
name: "Avatar"
|
|
608
654
|
});
|
|
609
655
|
const { children, getInitial = defaultGetInitial, ...inheritProps } = props;
|
|
610
|
-
const calcChildren =
|
|
656
|
+
const calcChildren = useMemo3(() => {
|
|
611
657
|
if (typeof children === "string") {
|
|
612
658
|
return getInitial?.(children) ?? "";
|
|
613
659
|
}
|
|
@@ -649,7 +695,7 @@ var MenuItem = JoyMenuItem;
|
|
|
649
695
|
var Menu_default = Menu;
|
|
650
696
|
|
|
651
697
|
// src/components/Dropdown/Dropdown.tsx
|
|
652
|
-
import React8, { createContext, useCallback as
|
|
698
|
+
import React8, { createContext, useCallback as useCallback4, useMemo as useMemo4, useState as useState2 } from "react";
|
|
653
699
|
import { Dropdown as JoyDropdown } from "@mui/joy";
|
|
654
700
|
import { MenuButton } from "@mui/joy";
|
|
655
701
|
import { useMenuButton } from "@mui/base/useMenuButton";
|
|
@@ -657,14 +703,14 @@ var DropdownNestedRegistryContext = createContext(null);
|
|
|
657
703
|
function Dropdown({ open: openProp, defaultOpen = false, onOpenChange, ...rest }) {
|
|
658
704
|
const [nestedCount, setNestedCount] = useState2(0);
|
|
659
705
|
const [open, setOpen] = useControlledState(openProp, defaultOpen);
|
|
660
|
-
const registry =
|
|
706
|
+
const registry = useMemo4(
|
|
661
707
|
() => ({
|
|
662
708
|
register: () => setNestedCount((c) => c + 1),
|
|
663
709
|
unregister: () => setNestedCount((c) => Math.max(0, c - 1))
|
|
664
710
|
}),
|
|
665
711
|
[]
|
|
666
712
|
);
|
|
667
|
-
const handleOpenChange =
|
|
713
|
+
const handleOpenChange = useCallback4(
|
|
668
714
|
(event, isOpen) => {
|
|
669
715
|
if (nestedCount > 0 && !isOpen && event?.type === "blur") {
|
|
670
716
|
return;
|
|
@@ -727,7 +773,7 @@ Button.displayName = "Button";
|
|
|
727
773
|
var Button_default = Button;
|
|
728
774
|
|
|
729
775
|
// src/components/Calendar/Calendar.tsx
|
|
730
|
-
import React13, { Fragment, forwardRef as forwardRef4, useCallback as
|
|
776
|
+
import React13, { Fragment, forwardRef as forwardRef4, useCallback as useCallback7, useEffect as useEffect3, useMemo as useMemo6, useRef as useRef4, useState as useState5 } from "react";
|
|
731
777
|
import { styled as styled5 } from "@mui/joy";
|
|
732
778
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
733
779
|
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
|
@@ -821,7 +867,7 @@ var isSameMonth = (date1, date2) => {
|
|
|
821
867
|
};
|
|
822
868
|
|
|
823
869
|
// src/components/Calendar/hooks/use-calendar-props.ts
|
|
824
|
-
import { useCallback as
|
|
870
|
+
import { useCallback as useCallback5, useMemo as useMemo5, useState as useState3 } from "react";
|
|
825
871
|
import { useThemeProps as useThemeProps3 } from "@mui/joy";
|
|
826
872
|
var resolveView = (view, views) => {
|
|
827
873
|
return views.includes(view) ? view : views[0];
|
|
@@ -841,23 +887,23 @@ var useCalendarProps = (inProps) => {
|
|
|
841
887
|
});
|
|
842
888
|
const [[page, direction], setPage] = useState3([0, 0]);
|
|
843
889
|
const resolvedView = inProps.view ?? uncontrolledView;
|
|
844
|
-
const resolvedMinDate =
|
|
890
|
+
const resolvedMinDate = useMemo5(() => {
|
|
845
891
|
const minDate = inProps.minDate || /* @__PURE__ */ new Date(0);
|
|
846
892
|
minDate.setHours(0, 0, 0, 0);
|
|
847
893
|
return minDate;
|
|
848
894
|
}, [inProps.minDate]);
|
|
849
|
-
const resolvedMaxDate =
|
|
895
|
+
const resolvedMaxDate = useMemo5(() => {
|
|
850
896
|
const maxDate = inProps.maxDate || /* @__PURE__ */ new Date(864e13);
|
|
851
897
|
maxDate.setHours(0, 0, 0, 0);
|
|
852
898
|
return maxDate;
|
|
853
899
|
}, [inProps.maxDate]);
|
|
854
|
-
const paginate =
|
|
900
|
+
const paginate = useCallback5(
|
|
855
901
|
(newDirection) => {
|
|
856
902
|
setPage([page + newDirection, newDirection]);
|
|
857
903
|
},
|
|
858
904
|
[page]
|
|
859
905
|
);
|
|
860
|
-
const handleViewMonthChange =
|
|
906
|
+
const handleViewMonthChange = useCallback5(
|
|
861
907
|
(newMonth) => {
|
|
862
908
|
setViewMonth(newMonth);
|
|
863
909
|
if (resolvedView === "month") {
|
|
@@ -905,12 +951,12 @@ var useCalendarProps = (inProps) => {
|
|
|
905
951
|
},
|
|
906
952
|
name: "Calendar"
|
|
907
953
|
});
|
|
908
|
-
const ownerState =
|
|
954
|
+
const ownerState = useMemo5(() => ({ ...props, viewMonth, direction }), [props, viewMonth, direction]);
|
|
909
955
|
return [props, ownerState];
|
|
910
956
|
};
|
|
911
957
|
|
|
912
958
|
// src/components/Calendar/hooks/use-calendar.ts
|
|
913
|
-
import { useCallback as
|
|
959
|
+
import { useCallback as useCallback6, useState as useState4 } from "react";
|
|
914
960
|
var useCalendar = (ownerState) => {
|
|
915
961
|
const [localHoverDay, setLocalHoverDay] = useState4(null);
|
|
916
962
|
const [localHoverMonth, setLocalHoverMonth] = useState4(null);
|
|
@@ -920,7 +966,7 @@ var useCalendar = (ownerState) => {
|
|
|
920
966
|
const setHoverMonth = ownerState.onHoverMonthChange ?? setLocalHoverMonth;
|
|
921
967
|
return {
|
|
922
968
|
calendarTitle: ownerState.view === "month" ? getYearName(ownerState.viewMonth, ownerState.locale || "default") : getMonthName(ownerState.viewMonth, ownerState.locale || "default"),
|
|
923
|
-
onPrev:
|
|
969
|
+
onPrev: useCallback6(() => {
|
|
924
970
|
if (ownerState.view === "day") {
|
|
925
971
|
const currentDate = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
926
972
|
const currentYear = currentDate.getFullYear();
|
|
@@ -937,7 +983,7 @@ var useCalendar = (ownerState) => {
|
|
|
937
983
|
ownerState.onMonthChange?.(prevYear);
|
|
938
984
|
}
|
|
939
985
|
}, [ownerState.onMonthChange, ownerState.viewMonth, ownerState.view]),
|
|
940
|
-
onNext:
|
|
986
|
+
onNext: useCallback6(() => {
|
|
941
987
|
if (ownerState.view === "day") {
|
|
942
988
|
const currentDate = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
943
989
|
const currentYear = currentDate.getFullYear();
|
|
@@ -954,7 +1000,7 @@ var useCalendar = (ownerState) => {
|
|
|
954
1000
|
ownerState.onMonthChange?.(nextYear);
|
|
955
1001
|
}
|
|
956
1002
|
}, [ownerState.onMonthChange, ownerState.viewMonth, ownerState.view]),
|
|
957
|
-
getDayCellProps:
|
|
1003
|
+
getDayCellProps: useCallback6(
|
|
958
1004
|
(day) => {
|
|
959
1005
|
const thisDay = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
960
1006
|
thisDay.setHours(0, 0, 0, 0);
|
|
@@ -969,7 +1015,7 @@ var useCalendar = (ownerState) => {
|
|
|
969
1015
|
},
|
|
970
1016
|
[ownerState.rangeSelection, ownerState.value, ownerState.viewMonth, hoverDay]
|
|
971
1017
|
),
|
|
972
|
-
getMonthCellProps:
|
|
1018
|
+
getMonthCellProps: useCallback6(
|
|
973
1019
|
(monthIndex) => {
|
|
974
1020
|
const thisMonth = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
975
1021
|
thisMonth.setDate(1);
|
|
@@ -986,7 +1032,7 @@ var useCalendar = (ownerState) => {
|
|
|
986
1032
|
},
|
|
987
1033
|
[ownerState.rangeSelection, ownerState.value, ownerState.viewMonth, hoverMonth]
|
|
988
1034
|
),
|
|
989
|
-
getPickerDayProps:
|
|
1035
|
+
getPickerDayProps: useCallback6(
|
|
990
1036
|
(day) => {
|
|
991
1037
|
const thisDay = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
992
1038
|
thisDay.setHours(0, 0, 0, 0);
|
|
@@ -1040,7 +1086,7 @@ var useCalendar = (ownerState) => {
|
|
|
1040
1086
|
hoverDay
|
|
1041
1087
|
]
|
|
1042
1088
|
),
|
|
1043
|
-
getPickerMonthProps:
|
|
1089
|
+
getPickerMonthProps: useCallback6(
|
|
1044
1090
|
(monthIndex) => {
|
|
1045
1091
|
const thisMonth = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
1046
1092
|
thisMonth.setDate(1);
|
|
@@ -1337,8 +1383,8 @@ var swipePower = (offset, velocity) => {
|
|
|
1337
1383
|
var PickerDays = (props) => {
|
|
1338
1384
|
const { ownerState } = props;
|
|
1339
1385
|
const { getPickerDayProps, getDayCellProps } = useCalendar(ownerState);
|
|
1340
|
-
const calendarDates =
|
|
1341
|
-
const weekdayNames =
|
|
1386
|
+
const calendarDates = useMemo6(() => getCalendarDates(ownerState.viewMonth), [ownerState.viewMonth]);
|
|
1387
|
+
const weekdayNames = useMemo6(() => getWeekdayNames(ownerState.locale || "default"), [ownerState.locale]);
|
|
1342
1388
|
return /* @__PURE__ */ React13.createElement(CalendarViewContainer, { calendarType: "datePicker" }, /* @__PURE__ */ React13.createElement(AnimatePresence, { initial: false, custom: ownerState.direction }, /* @__PURE__ */ React13.createElement(
|
|
1343
1389
|
CalendarViewTable,
|
|
1344
1390
|
{
|
|
@@ -1422,8 +1468,8 @@ var PickerMonths = (props) => {
|
|
|
1422
1468
|
};
|
|
1423
1469
|
var PlainPickerDays = ({ ownerState }) => {
|
|
1424
1470
|
const { getPickerDayProps, getDayCellProps } = useCalendar(ownerState);
|
|
1425
|
-
const calendarDates =
|
|
1426
|
-
const weekdayNames =
|
|
1471
|
+
const calendarDates = useMemo6(() => getCalendarDates(ownerState.viewMonth), [ownerState.viewMonth]);
|
|
1472
|
+
const weekdayNames = useMemo6(() => getWeekdayNames(ownerState.locale || "default"), [ownerState.locale]);
|
|
1427
1473
|
return /* @__PURE__ */ React13.createElement(StaticCalendarViewTable, null, /* @__PURE__ */ React13.createElement(CalendarWeekHeaderContainer, null, /* @__PURE__ */ React13.createElement("tr", null, weekdayNames.map((name, i) => /* @__PURE__ */ React13.createElement(Fragment, { key: `${ownerState.viewMonth}_${name}_${i}` }, /* @__PURE__ */ React13.createElement("th", null, /* @__PURE__ */ React13.createElement(Typography_default, { level: "body-xs", textAlign: "center" }, name)), i < 6 && /* @__PURE__ */ React13.createElement("th", { style: { width: 4 }, "aria-hidden": "true", "aria-description": "cell-gap" }))))), /* @__PURE__ */ React13.createElement(CalendarDayPickerContainer, null, calendarDates.map((weekDates, rowIndex) => /* @__PURE__ */ React13.createElement(Fragment, { key: `${ownerState.viewMonth}_${rowIndex}` }, /* @__PURE__ */ React13.createElement("tr", null, weekDates.map(
|
|
1428
1474
|
(date, i) => date ? /* @__PURE__ */ React13.createElement(Fragment, { key: `${ownerState.viewMonth}_${date}_${i}` }, /* @__PURE__ */ React13.createElement(CalendarDayCell, { ...getDayCellProps(date) }, /* @__PURE__ */ React13.createElement(CalendarDay, { size: "sm", variant: "plain", color: "neutral", ...getPickerDayProps(date) }, date)), i < 6 && /* @__PURE__ */ React13.createElement("td", { "aria-hidden": "true", "aria-description": "cell-gap" })) : /* @__PURE__ */ React13.createElement(Fragment, { key: `${ownerState.viewMonth}_${i}` }, /* @__PURE__ */ React13.createElement("td", null), i < 6 && /* @__PURE__ */ React13.createElement("td", { "aria-hidden": "true", "aria-description": "cell-gap" }))
|
|
1429
1475
|
)), rowIndex < calendarDates.length - 1 && /* @__PURE__ */ React13.createElement("tr", { "aria-hidden": "true", "aria-description": "row-gap" }, /* @__PURE__ */ React13.createElement("td", { colSpan: 13, style: { height: 4 } }))))));
|
|
@@ -1563,14 +1609,16 @@ var Calendar = forwardRef4((inProps, ref) => {
|
|
|
1563
1609
|
maxDate,
|
|
1564
1610
|
disableFuture,
|
|
1565
1611
|
disablePast,
|
|
1612
|
+
shouldDisableDate,
|
|
1613
|
+
slots,
|
|
1566
1614
|
numberOfMonths,
|
|
1567
1615
|
...others
|
|
1568
1616
|
} = props;
|
|
1569
1617
|
const { calendarTitle, onPrev, onNext } = useCalendar(ownerState);
|
|
1570
1618
|
const [isMonthViewAssistHintOpen, setIsMonthViewAssistHintOpen] = useState5(false);
|
|
1571
|
-
const monthNavClickTimestampsRef =
|
|
1572
|
-
const monthViewAssistHintShownInSessionRef =
|
|
1573
|
-
const monthViewAssistHintTimeoutRef =
|
|
1619
|
+
const monthNavClickTimestampsRef = useRef4([]);
|
|
1620
|
+
const monthViewAssistHintShownInSessionRef = useRef4(false);
|
|
1621
|
+
const monthViewAssistHintTimeoutRef = useRef4(null);
|
|
1574
1622
|
const [hoverDay, setHoverDay] = useState5(null);
|
|
1575
1623
|
const [hoverMonth, setHoverMonth] = useState5(null);
|
|
1576
1624
|
const resolvedNumberOfMonths = numberOfMonths ?? 1;
|
|
@@ -1591,14 +1639,14 @@ var Calendar = forwardRef4((inProps, ref) => {
|
|
|
1591
1639
|
}
|
|
1592
1640
|
};
|
|
1593
1641
|
}, []);
|
|
1594
|
-
const closeMonthViewAssistHint =
|
|
1642
|
+
const closeMonthViewAssistHint = useCallback7(() => {
|
|
1595
1643
|
if (monthViewAssistHintTimeoutRef.current) {
|
|
1596
1644
|
clearTimeout(monthViewAssistHintTimeoutRef.current);
|
|
1597
1645
|
monthViewAssistHintTimeoutRef.current = null;
|
|
1598
1646
|
}
|
|
1599
1647
|
setIsMonthViewAssistHintOpen(false);
|
|
1600
1648
|
}, []);
|
|
1601
|
-
const showMonthViewAssistHint =
|
|
1649
|
+
const showMonthViewAssistHint = useCallback7(() => {
|
|
1602
1650
|
const now = Date.now();
|
|
1603
1651
|
if (monthViewAssistHintShownInSessionRef.current) return;
|
|
1604
1652
|
if (now - lastMonthViewAssistHintShownAt < MONTH_VIEW_HINT_COOLDOWN_MS) return;
|
|
@@ -1613,7 +1661,7 @@ var Calendar = forwardRef4((inProps, ref) => {
|
|
|
1613
1661
|
monthViewAssistHintTimeoutRef.current = null;
|
|
1614
1662
|
}, MONTH_VIEW_HINT_DURATION_MS);
|
|
1615
1663
|
}, []);
|
|
1616
|
-
const trackFastMonthNavigation =
|
|
1664
|
+
const trackFastMonthNavigation = useCallback7(() => {
|
|
1617
1665
|
if (!isHintEligible) return;
|
|
1618
1666
|
const now = Date.now();
|
|
1619
1667
|
monthNavClickTimestampsRef.current = [
|
|
@@ -1624,15 +1672,15 @@ var Calendar = forwardRef4((inProps, ref) => {
|
|
|
1624
1672
|
showMonthViewAssistHint();
|
|
1625
1673
|
}
|
|
1626
1674
|
}, [isHintEligible, showMonthViewAssistHint]);
|
|
1627
|
-
const handlePrevClick =
|
|
1675
|
+
const handlePrevClick = useCallback7(() => {
|
|
1628
1676
|
onPrev();
|
|
1629
1677
|
trackFastMonthNavigation();
|
|
1630
1678
|
}, [onPrev, trackFastMonthNavigation]);
|
|
1631
|
-
const handleNextClick =
|
|
1679
|
+
const handleNextClick = useCallback7(() => {
|
|
1632
1680
|
onNext();
|
|
1633
1681
|
trackFastMonthNavigation();
|
|
1634
1682
|
}, [onNext, trackFastMonthNavigation]);
|
|
1635
|
-
const handleSwitchViewClick =
|
|
1683
|
+
const handleSwitchViewClick = useCallback7(() => {
|
|
1636
1684
|
closeMonthViewAssistHint();
|
|
1637
1685
|
onViewChange?.();
|
|
1638
1686
|
}, [closeMonthViewAssistHint, onViewChange]);
|
|
@@ -1802,11 +1850,11 @@ var Container = forwardRef5(function Container2(props, ref) {
|
|
|
1802
1850
|
Container.displayName = "Container";
|
|
1803
1851
|
|
|
1804
1852
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1805
|
-
import React17, { useCallback as
|
|
1853
|
+
import React17, { useCallback as useCallback9, useMemo as useMemo7 } from "react";
|
|
1806
1854
|
import { NumericFormat } from "react-number-format";
|
|
1807
1855
|
|
|
1808
1856
|
// src/components/Input/Input.tsx
|
|
1809
|
-
import React16, { useCallback as
|
|
1857
|
+
import React16, { useCallback as useCallback8, useState as useState6 } from "react";
|
|
1810
1858
|
import { Input as JoyInput } from "@mui/joy";
|
|
1811
1859
|
import { motion as motion16 } from "framer-motion";
|
|
1812
1860
|
import ClearIcon from "@mui/icons-material/Close";
|
|
@@ -1844,7 +1892,7 @@ var Input = React16.forwardRef((props, ref) => {
|
|
|
1844
1892
|
const [value, setValue] = useControlledState(
|
|
1845
1893
|
valueProp,
|
|
1846
1894
|
defaultValueProp ?? null,
|
|
1847
|
-
|
|
1895
|
+
useCallback8(
|
|
1848
1896
|
(value2) => {
|
|
1849
1897
|
onChange?.({
|
|
1850
1898
|
/**
|
|
@@ -2134,22 +2182,22 @@ var CurrencyInput = React17.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
2134
2182
|
const [_value, setValue] = useControlledState(
|
|
2135
2183
|
props.value,
|
|
2136
2184
|
props.defaultValue ?? null,
|
|
2137
|
-
|
|
2185
|
+
useCallback9((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
2138
2186
|
);
|
|
2139
|
-
const value =
|
|
2187
|
+
const value = useMemo7(() => {
|
|
2140
2188
|
if (_value && useMinorUnit) {
|
|
2141
2189
|
return _value / Math.pow(10, decimalScale);
|
|
2142
2190
|
}
|
|
2143
2191
|
return _value;
|
|
2144
2192
|
}, [_value, useMinorUnit, decimalScale]);
|
|
2145
|
-
const max =
|
|
2193
|
+
const max = useMemo7(() => {
|
|
2146
2194
|
if (props.max && useMinorUnit) {
|
|
2147
2195
|
return props.max / Math.pow(10, decimalScale);
|
|
2148
2196
|
}
|
|
2149
2197
|
return props.max;
|
|
2150
2198
|
}, [props.max, useMinorUnit, decimalScale]);
|
|
2151
|
-
const isOverLimit =
|
|
2152
|
-
const handleChange =
|
|
2199
|
+
const isOverLimit = useMemo7(() => max != null && value != null && value > max, [max, value]);
|
|
2200
|
+
const handleChange = useCallback9(
|
|
2153
2201
|
(event) => {
|
|
2154
2202
|
if (event.target.value === "") {
|
|
2155
2203
|
setValue(null);
|
|
@@ -2198,9 +2246,9 @@ var CurrencyInput_default = CurrencyInput;
|
|
|
2198
2246
|
|
|
2199
2247
|
// src/components/DataTable/DataTable.tsx
|
|
2200
2248
|
import React26, {
|
|
2201
|
-
useCallback as
|
|
2202
|
-
useMemo as
|
|
2203
|
-
useRef as
|
|
2249
|
+
useCallback as useCallback14,
|
|
2250
|
+
useMemo as useMemo12,
|
|
2251
|
+
useRef as useRef8,
|
|
2204
2252
|
useId,
|
|
2205
2253
|
forwardRef as forwardRef7,
|
|
2206
2254
|
useImperativeHandle as useImperativeHandle2,
|
|
@@ -2433,6 +2481,12 @@ function computeAutoFitWidth(params) {
|
|
|
2433
2481
|
if (!isNaN(maxPx) && maxPx > 0) finalWidth = Math.min(finalWidth, maxPx);
|
|
2434
2482
|
return finalWidth;
|
|
2435
2483
|
}
|
|
2484
|
+
function getHeaderCellId(tableId, field) {
|
|
2485
|
+
return `${tableId}_header_${sanitizeColumnId(field)}`;
|
|
2486
|
+
}
|
|
2487
|
+
function sanitizeColumnId(field) {
|
|
2488
|
+
return String(field).trim().replace(/\s+/g, "_");
|
|
2489
|
+
}
|
|
2436
2490
|
|
|
2437
2491
|
// src/components/DataTable/styled.tsx
|
|
2438
2492
|
import React18 from "react";
|
|
@@ -2621,11 +2675,11 @@ var Resizer = (ref, targetRef = ref, onResizeStateChange, onAutoFit) => /* @__PU
|
|
|
2621
2675
|
|
|
2622
2676
|
// src/components/DataTable/components.tsx
|
|
2623
2677
|
import React23, {
|
|
2624
|
-
useRef as
|
|
2678
|
+
useRef as useRef6,
|
|
2625
2679
|
useState as useState8,
|
|
2626
2680
|
useLayoutEffect,
|
|
2627
|
-
useMemo as
|
|
2628
|
-
useCallback as
|
|
2681
|
+
useMemo as useMemo10,
|
|
2682
|
+
useCallback as useCallback11,
|
|
2629
2683
|
useEffect as useEffect5,
|
|
2630
2684
|
memo,
|
|
2631
2685
|
createElement
|
|
@@ -2634,7 +2688,7 @@ import { styled as styled12, useTheme } from "@mui/joy";
|
|
|
2634
2688
|
import { AnimatePresence as AnimatePresence2 } from "framer-motion";
|
|
2635
2689
|
|
|
2636
2690
|
// src/components/DatePicker/DatePicker.tsx
|
|
2637
|
-
import React19, { forwardRef as forwardRef6, useCallback as
|
|
2691
|
+
import React19, { forwardRef as forwardRef6, useCallback as useCallback10, useEffect as useEffect4, useImperativeHandle, useRef as useRef5, useState as useState7 } from "react";
|
|
2638
2692
|
import { IMaskInput, IMask } from "react-imask";
|
|
2639
2693
|
import CalendarTodayIcon from "@mui/icons-material/CalendarToday";
|
|
2640
2694
|
import { styled as styled10, useThemeProps as useThemeProps5 } from "@mui/joy";
|
|
@@ -2851,12 +2905,12 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2851
2905
|
presets,
|
|
2852
2906
|
...innerProps
|
|
2853
2907
|
} = props;
|
|
2854
|
-
const innerRef =
|
|
2855
|
-
const buttonRef =
|
|
2908
|
+
const innerRef = useRef5(null);
|
|
2909
|
+
const buttonRef = useRef5(null);
|
|
2856
2910
|
const [rawValue, setValue] = useControlledState(
|
|
2857
2911
|
props.value,
|
|
2858
2912
|
props.defaultValue ?? null,
|
|
2859
|
-
|
|
2913
|
+
useCallback10(
|
|
2860
2914
|
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
2861
2915
|
[props.name, onChange]
|
|
2862
2916
|
)
|
|
@@ -2884,7 +2938,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2884
2938
|
}
|
|
2885
2939
|
}, [displayFormat, displayValue, format, locale, value]);
|
|
2886
2940
|
useImperativeHandle(ref, () => innerRef.current, [innerRef]);
|
|
2887
|
-
const handleChange =
|
|
2941
|
+
const handleChange = useCallback10(
|
|
2888
2942
|
(event) => {
|
|
2889
2943
|
const value2 = event.target.value;
|
|
2890
2944
|
setDisplayValue(value2 ? formatValueString(parseDate(value2, format), displayFormat, locale) : value2);
|
|
@@ -2892,7 +2946,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2892
2946
|
},
|
|
2893
2947
|
[displayFormat, format, locale, setValue]
|
|
2894
2948
|
);
|
|
2895
|
-
const handleDisplayInputChange =
|
|
2949
|
+
const handleDisplayInputChange = useCallback10(
|
|
2896
2950
|
(event) => {
|
|
2897
2951
|
if (event.target.value === "") {
|
|
2898
2952
|
handleChange({
|
|
@@ -2917,7 +2971,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2917
2971
|
},
|
|
2918
2972
|
[displayFormat, format, handleChange, props.name]
|
|
2919
2973
|
);
|
|
2920
|
-
const handleCalendarToggle =
|
|
2974
|
+
const handleCalendarToggle = useCallback10(
|
|
2921
2975
|
(event) => {
|
|
2922
2976
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
2923
2977
|
setTimeout(() => {
|
|
@@ -2926,7 +2980,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2926
2980
|
},
|
|
2927
2981
|
[anchorEl, setAnchorEl, innerRef]
|
|
2928
2982
|
);
|
|
2929
|
-
const handleInputMouseDown =
|
|
2983
|
+
const handleInputMouseDown = useCallback10(
|
|
2930
2984
|
(event) => {
|
|
2931
2985
|
if (inputReadOnly || isAlphabeticDisplay) {
|
|
2932
2986
|
event.preventDefault();
|
|
@@ -2935,7 +2989,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2935
2989
|
},
|
|
2936
2990
|
[inputReadOnly, isAlphabeticDisplay, buttonRef]
|
|
2937
2991
|
);
|
|
2938
|
-
const handleInputClick =
|
|
2992
|
+
const handleInputClick = useCallback10(
|
|
2939
2993
|
(event) => {
|
|
2940
2994
|
if (inputReadOnly && !readOnly) {
|
|
2941
2995
|
handleCalendarToggle(event);
|
|
@@ -2943,7 +2997,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2943
2997
|
},
|
|
2944
2998
|
[inputReadOnly, readOnly, handleCalendarToggle]
|
|
2945
2999
|
);
|
|
2946
|
-
const handlePresetClick =
|
|
3000
|
+
const handlePresetClick = useCallback10(
|
|
2947
3001
|
(presetValue) => {
|
|
2948
3002
|
handleChange({
|
|
2949
3003
|
target: {
|
|
@@ -2955,7 +3009,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2955
3009
|
},
|
|
2956
3010
|
[handleChange, props.name]
|
|
2957
3011
|
);
|
|
2958
|
-
const isPresetDisabled =
|
|
3012
|
+
const isPresetDisabled = useCallback10(
|
|
2959
3013
|
(presetValue) => {
|
|
2960
3014
|
try {
|
|
2961
3015
|
const date = parseDate(presetValue, format);
|
|
@@ -3108,7 +3162,7 @@ import React20 from "react";
|
|
|
3108
3162
|
import { Textarea as JoyTextarea } from "@mui/joy";
|
|
3109
3163
|
import { motion as motion19 } from "framer-motion";
|
|
3110
3164
|
var MotionTextarea = motion19(JoyTextarea);
|
|
3111
|
-
var
|
|
3165
|
+
var TextareaBase = (props) => {
|
|
3112
3166
|
const {
|
|
3113
3167
|
label,
|
|
3114
3168
|
error,
|
|
@@ -3152,13 +3206,17 @@ var Textarea = (props) => {
|
|
|
3152
3206
|
helperText && /* @__PURE__ */ React20.createElement(FormHelperText_default, null, helperText)
|
|
3153
3207
|
);
|
|
3154
3208
|
};
|
|
3209
|
+
var Textarea = React20.forwardRef((props, ref) => {
|
|
3210
|
+
const textareaSlotProps = useSlotRef(props.slotProps?.textarea, ref);
|
|
3211
|
+
return /* @__PURE__ */ React20.createElement(TextareaBase, { ...props, slotProps: { ...props.slotProps, textarea: textareaSlotProps } });
|
|
3212
|
+
});
|
|
3155
3213
|
Textarea.displayName = "Textarea";
|
|
3156
3214
|
|
|
3157
3215
|
// src/components/Textarea/index.ts
|
|
3158
3216
|
var Textarea_default = Textarea;
|
|
3159
3217
|
|
|
3160
3218
|
// src/components/Select/Select.tsx
|
|
3161
|
-
import React21, { useMemo as
|
|
3219
|
+
import React21, { useMemo as useMemo9 } from "react";
|
|
3162
3220
|
import {
|
|
3163
3221
|
Select as JoySelect,
|
|
3164
3222
|
Option as JoyOption,
|
|
@@ -3174,7 +3232,7 @@ var secondaryTextLevelMap2 = {
|
|
|
3174
3232
|
lg: "body-md"
|
|
3175
3233
|
};
|
|
3176
3234
|
Option.displayName = "Option";
|
|
3177
|
-
function
|
|
3235
|
+
function SelectInner(props, ref) {
|
|
3178
3236
|
const {
|
|
3179
3237
|
label,
|
|
3180
3238
|
helperText,
|
|
@@ -3200,7 +3258,7 @@ function Select(props) {
|
|
|
3200
3258
|
formHelperText: formHelperTextProps,
|
|
3201
3259
|
...joySlotProps
|
|
3202
3260
|
} = slotProps ?? {};
|
|
3203
|
-
const options =
|
|
3261
|
+
const options = useMemo9(
|
|
3204
3262
|
() => props.options.map((option) => {
|
|
3205
3263
|
if (option.hasOwnProperty("value") && option.hasOwnProperty("label")) {
|
|
3206
3264
|
return option;
|
|
@@ -3225,13 +3283,14 @@ function Select(props) {
|
|
|
3225
3283
|
};
|
|
3226
3284
|
onChange?.(newEvent, newValue);
|
|
3227
3285
|
};
|
|
3228
|
-
const optionMap =
|
|
3286
|
+
const optionMap = useMemo9(() => {
|
|
3229
3287
|
const map = /* @__PURE__ */ new Map();
|
|
3230
3288
|
options.forEach((option) => {
|
|
3231
3289
|
map.set(option.value, option);
|
|
3232
3290
|
});
|
|
3233
3291
|
return map;
|
|
3234
3292
|
}, [options]);
|
|
3293
|
+
const buttonSlotProps = useSlotRef(joySlotProps.button, ref);
|
|
3235
3294
|
const select = /* @__PURE__ */ React21.createElement(
|
|
3236
3295
|
JoySelect,
|
|
3237
3296
|
{
|
|
@@ -3240,7 +3299,7 @@ function Select(props) {
|
|
|
3240
3299
|
disabled,
|
|
3241
3300
|
size,
|
|
3242
3301
|
color: error ? "danger" : color,
|
|
3243
|
-
slotProps: joySlotProps,
|
|
3302
|
+
slotProps: { ...joySlotProps, button: buttonSlotProps },
|
|
3244
3303
|
onChange: handleChange,
|
|
3245
3304
|
renderValue: (selected) => {
|
|
3246
3305
|
if (!selected) return null;
|
|
@@ -3270,6 +3329,7 @@ function Select(props) {
|
|
|
3270
3329
|
helperText && /* @__PURE__ */ React21.createElement(FormHelperText_default, { ...formHelperTextProps }, helperText)
|
|
3271
3330
|
);
|
|
3272
3331
|
}
|
|
3332
|
+
var Select = React21.forwardRef(SelectInner);
|
|
3273
3333
|
Select.displayName = "Select";
|
|
3274
3334
|
|
|
3275
3335
|
// src/components/Select/index.ts
|
|
@@ -3317,7 +3377,7 @@ var TextEllipsis = ({
|
|
|
3317
3377
|
lineClamp,
|
|
3318
3378
|
...rest
|
|
3319
3379
|
}) => {
|
|
3320
|
-
const textRef =
|
|
3380
|
+
const textRef = useRef6(null);
|
|
3321
3381
|
const [showTooltip, setShowTooltip] = useState8(false);
|
|
3322
3382
|
useLayoutEffect(() => {
|
|
3323
3383
|
const element = textRef.current;
|
|
@@ -3334,7 +3394,7 @@ var TextEllipsis = ({
|
|
|
3334
3394
|
return /* @__PURE__ */ React23.createElement(Tooltip_default, { title: showTooltip ? children : "", placement: "top" }, /* @__PURE__ */ React23.createElement(EllipsisDiv, { ref: textRef, lineClamp, ...rest }, children));
|
|
3335
3395
|
};
|
|
3336
3396
|
var CellTextEllipsis = ({ children }) => {
|
|
3337
|
-
const textRef =
|
|
3397
|
+
const textRef = useRef6(null);
|
|
3338
3398
|
const [showTooltip, setShowTooltip] = useState8(false);
|
|
3339
3399
|
useLayoutEffect(() => {
|
|
3340
3400
|
const element = textRef.current;
|
|
@@ -3389,18 +3449,15 @@ var HeadCell = (props) => {
|
|
|
3389
3449
|
const theme = useTheme();
|
|
3390
3450
|
const ref = headerRef;
|
|
3391
3451
|
const colRef = tableColRef;
|
|
3392
|
-
const localRef =
|
|
3452
|
+
const localRef = useRef6(null);
|
|
3393
3453
|
useLayoutEffect(() => {
|
|
3394
3454
|
ref.current = localRef.current;
|
|
3395
3455
|
}, [ref]);
|
|
3396
3456
|
const [isHovered, setIsHovered] = useState8(false);
|
|
3397
3457
|
const sortable = type === "actions" ? false : _sortable;
|
|
3398
|
-
const headId =
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
);
|
|
3402
|
-
const isResizingRef = useRef5(false);
|
|
3403
|
-
const resizer = useMemo9(
|
|
3458
|
+
const headId = useMemo10(() => getHeaderCellId(tableId, field), [tableId, field]);
|
|
3459
|
+
const isResizingRef = useRef6(false);
|
|
3460
|
+
const resizer = useMemo10(
|
|
3404
3461
|
() => resizable ?? true ? Resizer(
|
|
3405
3462
|
ref,
|
|
3406
3463
|
colRef,
|
|
@@ -3411,7 +3468,7 @@ var HeadCell = (props) => {
|
|
|
3411
3468
|
) : null,
|
|
3412
3469
|
[resizable, ref, colRef, onAutoFit, field]
|
|
3413
3470
|
);
|
|
3414
|
-
const style =
|
|
3471
|
+
const style = useMemo10(
|
|
3415
3472
|
() => ({
|
|
3416
3473
|
width,
|
|
3417
3474
|
minWidth: minWidth ?? "50px",
|
|
@@ -3429,7 +3486,7 @@ var HeadCell = (props) => {
|
|
|
3429
3486
|
);
|
|
3430
3487
|
const textAlign = getTextAlign(props);
|
|
3431
3488
|
const initialSort = sortOrder[0];
|
|
3432
|
-
const sortIcon =
|
|
3489
|
+
const sortIcon = useMemo10(() => {
|
|
3433
3490
|
const isSorted = !!sort;
|
|
3434
3491
|
const isVisible = sortable && (isSorted || isHovered);
|
|
3435
3492
|
return /* @__PURE__ */ React23.createElement(AnimatePresence2, { mode: "wait" }, isVisible && /* @__PURE__ */ React23.createElement(
|
|
@@ -3460,17 +3517,17 @@ var HeadCell = (props) => {
|
|
|
3460
3517
|
}
|
|
3461
3518
|
));
|
|
3462
3519
|
}, [headId, initialSort, sort, sortable, isHovered]);
|
|
3463
|
-
const infoSign =
|
|
3520
|
+
const infoSign = useMemo10(
|
|
3464
3521
|
() => description ? /* @__PURE__ */ React23.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null,
|
|
3465
3522
|
[description]
|
|
3466
3523
|
);
|
|
3467
|
-
const params =
|
|
3524
|
+
const params = useMemo10(
|
|
3468
3525
|
() => ({
|
|
3469
3526
|
field
|
|
3470
3527
|
}),
|
|
3471
3528
|
[field]
|
|
3472
3529
|
);
|
|
3473
|
-
const computedHeaderClassName =
|
|
3530
|
+
const computedHeaderClassName = useMemo10(
|
|
3474
3531
|
() => (typeof headerClassName === "function" ? headerClassName(params) : headerClassName) || void 0,
|
|
3475
3532
|
[headerClassName, params]
|
|
3476
3533
|
);
|
|
@@ -3483,7 +3540,7 @@ var HeadCell = (props) => {
|
|
|
3483
3540
|
ref: localRef,
|
|
3484
3541
|
key: field,
|
|
3485
3542
|
style,
|
|
3486
|
-
onClick:
|
|
3543
|
+
onClick: useCallback11(
|
|
3487
3544
|
(e) => {
|
|
3488
3545
|
if (isResizingRef.current) return;
|
|
3489
3546
|
if (!(e.target instanceof Element) || !e.currentTarget.contains(e.target)) return;
|
|
@@ -3523,8 +3580,8 @@ var BodyCell = (props) => {
|
|
|
3523
3580
|
} = props;
|
|
3524
3581
|
const theme = useTheme();
|
|
3525
3582
|
const [value, setValue] = useState8(row[field]);
|
|
3526
|
-
const cellRef =
|
|
3527
|
-
const params =
|
|
3583
|
+
const cellRef = useRef6(null);
|
|
3584
|
+
const params = useMemo10(
|
|
3528
3585
|
() => ({
|
|
3529
3586
|
row,
|
|
3530
3587
|
value,
|
|
@@ -3533,20 +3590,20 @@ var BodyCell = (props) => {
|
|
|
3533
3590
|
}),
|
|
3534
3591
|
[row, rowId, value, field]
|
|
3535
3592
|
);
|
|
3536
|
-
const editMode =
|
|
3593
|
+
const editMode = useMemo10(
|
|
3537
3594
|
() => !!(props.editMode && (typeof isCellEditable === "function" ? isCellEditable(params) : isCellEditable ?? true)),
|
|
3538
3595
|
[props.editMode, isCellEditable, params]
|
|
3539
3596
|
);
|
|
3540
3597
|
const propsComponentProps = "componentProps" in props ? props.componentProps : null;
|
|
3541
3598
|
const hasComponentProps = "componentProps" in props;
|
|
3542
|
-
const componentProps =
|
|
3599
|
+
const componentProps = useMemo10(
|
|
3543
3600
|
() => ({
|
|
3544
3601
|
...hasComponentProps && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
|
|
3545
3602
|
size: "sm"
|
|
3546
3603
|
}),
|
|
3547
3604
|
[hasComponentProps, propsComponentProps, params]
|
|
3548
3605
|
);
|
|
3549
|
-
const editModeComponentProps =
|
|
3606
|
+
const editModeComponentProps = useMemo10(
|
|
3550
3607
|
() => ({
|
|
3551
3608
|
...componentProps,
|
|
3552
3609
|
onChange: (e) => {
|
|
@@ -3608,9 +3665,9 @@ var BodyCell = (props) => {
|
|
|
3608
3665
|
}),
|
|
3609
3666
|
[params, row, field, value, componentProps, type, onCellEditStop, onCellEditStart]
|
|
3610
3667
|
);
|
|
3611
|
-
const MemoizedRenderEditCell =
|
|
3612
|
-
const MemoizedRenderCell =
|
|
3613
|
-
const EditModeComponent =
|
|
3668
|
+
const MemoizedRenderEditCell = useMemo10(() => renderEditCell ? memo(renderEditCell) : null, [renderEditCell]);
|
|
3669
|
+
const MemoizedRenderCell = useMemo10(() => renderCell ? memo(renderCell) : null, [renderCell]);
|
|
3670
|
+
const EditModeComponent = useMemo10(() => {
|
|
3614
3671
|
if (MemoizedRenderEditCell) {
|
|
3615
3672
|
return createElement(MemoizedRenderEditCell, params);
|
|
3616
3673
|
}
|
|
@@ -3645,7 +3702,7 @@ var BodyCell = (props) => {
|
|
|
3645
3702
|
}[type || "text"];
|
|
3646
3703
|
}, [value, editModeComponentProps, type, MemoizedRenderEditCell, params]);
|
|
3647
3704
|
const linkComponentFromProps = props.component;
|
|
3648
|
-
const ReadModeComponent =
|
|
3705
|
+
const ReadModeComponent = useMemo10(() => {
|
|
3649
3706
|
if (MemoizedRenderCell) {
|
|
3650
3707
|
return createElement(MemoizedRenderCell, params);
|
|
3651
3708
|
}
|
|
@@ -3659,15 +3716,15 @@ var BodyCell = (props) => {
|
|
|
3659
3716
|
return typedComponent || innerText;
|
|
3660
3717
|
}, [value, MemoizedRenderCell, params, type, componentProps, linkComponentFromProps]);
|
|
3661
3718
|
const getActions = props.getActions;
|
|
3662
|
-
const CellComponent =
|
|
3719
|
+
const CellComponent = useMemo10(() => {
|
|
3663
3720
|
if (type === "actions") {
|
|
3664
3721
|
return /* @__PURE__ */ React23.createElement(Stack_default, { direction: "row", gap: 1, justifyContent: "center", alignItems: "center" }, getActions?.(params));
|
|
3665
3722
|
}
|
|
3666
3723
|
return editMode && EditModeComponent ? EditModeComponent : ReadModeComponent;
|
|
3667
3724
|
}, [type, getActions, params, editMode, EditModeComponent, ReadModeComponent]);
|
|
3668
|
-
const showTooltip =
|
|
3725
|
+
const showTooltip = useMemo10(() => noWrap && type === "longText", [noWrap, type]);
|
|
3669
3726
|
const isBoundary = props.isLastStartPinnedColumn || props.isLastEndPinnedColumn;
|
|
3670
|
-
const computedCellClassName =
|
|
3727
|
+
const computedCellClassName = useMemo10(
|
|
3671
3728
|
() => (typeof cellClassName === "function" ? cellClassName(params) : cellClassName) || "",
|
|
3672
3729
|
[cellClassName, params]
|
|
3673
3730
|
);
|
|
@@ -3679,7 +3736,7 @@ var BodyCell = (props) => {
|
|
|
3679
3736
|
{
|
|
3680
3737
|
ref: cellRef,
|
|
3681
3738
|
key: field,
|
|
3682
|
-
headers:
|
|
3739
|
+
headers: getHeaderCellId(tableId, field),
|
|
3683
3740
|
sx: {
|
|
3684
3741
|
textAlign: getTextAlign({ type }),
|
|
3685
3742
|
verticalAlign: editMode ? "top" : "middle",
|
|
@@ -3691,7 +3748,7 @@ var BodyCell = (props) => {
|
|
|
3691
3748
|
},
|
|
3692
3749
|
className: [isLastStartPinnedColumn && "is-last-left", isLastEndPinnedColumn && "is-last-right", computedCellClassName].filter(Boolean).join(" ") || ""
|
|
3693
3750
|
},
|
|
3694
|
-
|
|
3751
|
+
useMemo10(
|
|
3695
3752
|
() => showTooltip ? /* @__PURE__ */ React23.createElement(CellTextEllipsis, null, CellComponent) : CellComponent,
|
|
3696
3753
|
[CellComponent, showTooltip]
|
|
3697
3754
|
)
|
|
@@ -3744,19 +3801,20 @@ var VirtualizedTableRow = memo(StyledTableRow2, (prevProps, nextProps) => {
|
|
|
3744
3801
|
});
|
|
3745
3802
|
|
|
3746
3803
|
// src/components/DataTable/hooks.ts
|
|
3747
|
-
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as
|
|
3804
|
+
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as useRef7, useMemo as useMemo11, useCallback as useCallback12, useEffect as useEffect6, createRef } from "react";
|
|
3748
3805
|
function useColumnWidths(columnsByField) {
|
|
3749
3806
|
const [widths, setWidths] = useState9({});
|
|
3750
|
-
const roRef =
|
|
3807
|
+
const roRef = useRef7();
|
|
3751
3808
|
useLayoutEffect2(() => {
|
|
3752
3809
|
if (roRef.current) roRef.current.disconnect();
|
|
3753
3810
|
roRef.current = new ResizeObserver((entries) => {
|
|
3754
|
-
let changed = false;
|
|
3755
3811
|
setWidths((prev) => {
|
|
3812
|
+
let changed = false;
|
|
3756
3813
|
const next = { ...prev };
|
|
3757
3814
|
entries.forEach((entry) => {
|
|
3758
3815
|
const field = entry.target.dataset.field;
|
|
3759
3816
|
const w = Math.round(entry.target.getBoundingClientRect().width);
|
|
3817
|
+
if (w === 0) return;
|
|
3760
3818
|
if (next[field] !== w) {
|
|
3761
3819
|
next[field] = w;
|
|
3762
3820
|
changed = true;
|
|
@@ -3765,13 +3823,21 @@ function useColumnWidths(columnsByField) {
|
|
|
3765
3823
|
return changed ? next : prev;
|
|
3766
3824
|
});
|
|
3767
3825
|
});
|
|
3826
|
+
const measured = {};
|
|
3768
3827
|
Object.entries(columnsByField).forEach(([field, def]) => {
|
|
3769
3828
|
const el = def.headerRef.current;
|
|
3770
3829
|
if (el) {
|
|
3771
3830
|
el.dataset.field = field;
|
|
3831
|
+
const w = Math.round(el.getBoundingClientRect().width);
|
|
3832
|
+
if (w > 0) measured[field] = w;
|
|
3772
3833
|
roRef.current.observe(el);
|
|
3773
3834
|
}
|
|
3774
3835
|
});
|
|
3836
|
+
setWidths((prev) => {
|
|
3837
|
+
const keys = Object.keys(measured);
|
|
3838
|
+
const same = keys.every((key) => prev[key] === measured[key]);
|
|
3839
|
+
return same ? prev : { ...prev, ...measured };
|
|
3840
|
+
});
|
|
3775
3841
|
return () => roRef.current?.disconnect();
|
|
3776
3842
|
}, [columnsByField]);
|
|
3777
3843
|
return widths;
|
|
@@ -3805,33 +3871,40 @@ function useDataTableRenderer({
|
|
|
3805
3871
|
"You cannot use both `pinnedColumns` and `columnGroupingModel` at the same time. Please choose one of them."
|
|
3806
3872
|
);
|
|
3807
3873
|
}
|
|
3808
|
-
const
|
|
3874
|
+
const duplicatedField = useMemo11(() => {
|
|
3875
|
+
const ids = columnsProp.map((column) => sanitizeColumnId(column.field));
|
|
3876
|
+
const index = ids.findIndex((id, i) => ids.indexOf(id) !== i);
|
|
3877
|
+
return index === -1 ? void 0 : columnsProp[index].field;
|
|
3878
|
+
}, [columnsProp]);
|
|
3879
|
+
if (duplicatedField !== void 0)
|
|
3880
|
+
throw new Error(`DataTable: column \`field\` must be unique. Duplicated: "${String(duplicatedField)}"`);
|
|
3881
|
+
const onSelectionModelChangeRef = useRef7(onSelectionModelChange);
|
|
3809
3882
|
onSelectionModelChangeRef.current = onSelectionModelChange;
|
|
3810
3883
|
const [focusedRowId, setFocusedRowId] = useState9(null);
|
|
3811
3884
|
const [selectionAnchor, setSelectionAnchor] = useState9(null);
|
|
3812
3885
|
const [sortModel, setSortModel] = useControlledState(
|
|
3813
3886
|
controlledSortModel,
|
|
3814
3887
|
initialState?.sorting?.sortModel ?? [],
|
|
3815
|
-
|
|
3888
|
+
useCallback12((sortModel2) => onSortModelChange?.(sortModel2), [onSortModelChange])
|
|
3816
3889
|
);
|
|
3817
3890
|
const [visibilityModel] = useControlledState(
|
|
3818
3891
|
columnVisibilityModel,
|
|
3819
3892
|
initialState?.columns?.columnVisibilityModel ?? {},
|
|
3820
|
-
|
|
3893
|
+
useCallback12(
|
|
3821
3894
|
(model) => onColumnVisibilityModelChange?.(model),
|
|
3822
3895
|
[onColumnVisibilityModelChange]
|
|
3823
3896
|
)
|
|
3824
3897
|
);
|
|
3825
|
-
const reorderedColumns =
|
|
3898
|
+
const reorderedColumns = useMemo11(() => {
|
|
3826
3899
|
if (!columnGroupingModel) return columnsProp;
|
|
3827
3900
|
return reorderColumnsByGroupingModel(columnsProp, columnGroupingModel);
|
|
3828
3901
|
}, [columnsProp, columnGroupingModel]);
|
|
3829
|
-
const visibleColumns =
|
|
3902
|
+
const visibleColumns = useMemo11(
|
|
3830
3903
|
() => reorderedColumns.filter((col) => visibilityModel[col.field] !== false),
|
|
3831
3904
|
[reorderedColumns, visibilityModel]
|
|
3832
3905
|
);
|
|
3833
|
-
const visibleFieldSet =
|
|
3834
|
-
const tableMinWidth =
|
|
3906
|
+
const visibleFieldSet = useMemo11(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3907
|
+
const tableMinWidth = useMemo11(() => {
|
|
3835
3908
|
const DEFAULT_MIN = 50;
|
|
3836
3909
|
let total = checkboxSelection ? 40 : 0;
|
|
3837
3910
|
for (const col of visibleColumns) {
|
|
@@ -3839,7 +3912,7 @@ function useDataTableRenderer({
|
|
|
3839
3912
|
}
|
|
3840
3913
|
return total;
|
|
3841
3914
|
}, [visibleColumns, checkboxSelection]);
|
|
3842
|
-
const allColumnsByField =
|
|
3915
|
+
const allColumnsByField = useMemo11(
|
|
3843
3916
|
() => reorderedColumns.reduce(
|
|
3844
3917
|
(acc, curr) => ({
|
|
3845
3918
|
...acc,
|
|
@@ -3849,21 +3922,20 @@ function useDataTableRenderer({
|
|
|
3849
3922
|
),
|
|
3850
3923
|
[reorderedColumns]
|
|
3851
3924
|
);
|
|
3852
|
-
const visibleColumnsByField =
|
|
3853
|
-
() =>
|
|
3854
|
-
(
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
...
|
|
3925
|
+
const visibleColumnsByField = useMemo11(
|
|
3926
|
+
() => Object.fromEntries(
|
|
3927
|
+
visibleColumns.map((column) => [
|
|
3928
|
+
column.field,
|
|
3929
|
+
{
|
|
3930
|
+
...column,
|
|
3858
3931
|
headerRef: createRef(),
|
|
3859
3932
|
tableColRef: createRef()
|
|
3860
3933
|
}
|
|
3861
|
-
|
|
3862
|
-
{}
|
|
3934
|
+
])
|
|
3863
3935
|
),
|
|
3864
3936
|
[visibleColumns]
|
|
3865
3937
|
);
|
|
3866
|
-
const sortComparator =
|
|
3938
|
+
const sortComparator = useCallback12(
|
|
3867
3939
|
(rowA, rowB) => {
|
|
3868
3940
|
for (const sort of sortModel) {
|
|
3869
3941
|
const { field, sort: direction } = sort;
|
|
@@ -3892,33 +3964,33 @@ function useDataTableRenderer({
|
|
|
3892
3964
|
},
|
|
3893
3965
|
[sortModel, allColumnsByField]
|
|
3894
3966
|
);
|
|
3895
|
-
const rows =
|
|
3967
|
+
const rows = useMemo11(
|
|
3896
3968
|
() => sortModel.length ? [..._rows].sort(sortComparator) : _rows,
|
|
3897
3969
|
[_rows, sortModel, sortComparator]
|
|
3898
3970
|
);
|
|
3899
|
-
const sortOrder =
|
|
3971
|
+
const sortOrder = useMemo11(
|
|
3900
3972
|
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3901
3973
|
[_sortOrder]
|
|
3902
3974
|
);
|
|
3903
3975
|
const [page, setPage] = useState9(paginationModel?.page || 1);
|
|
3904
3976
|
const pageSize = paginationModel?.pageSize || 20;
|
|
3905
|
-
const getId =
|
|
3977
|
+
const getId = useCallback12(
|
|
3906
3978
|
(row, index) => _getId?.(row) ?? row.id ?? `${(index || 0) + (page - 1) * pageSize}`,
|
|
3907
3979
|
[_getId, page, pageSize]
|
|
3908
3980
|
);
|
|
3909
|
-
const selectedModelSet =
|
|
3910
|
-
const dataInPage =
|
|
3981
|
+
const selectedModelSet = useMemo11(() => new Set(selectionModel || []), [selectionModel]);
|
|
3982
|
+
const dataInPage = useMemo11(
|
|
3911
3983
|
() => !pagination || paginationMode === "server" ? rows : rows.slice((page - 1) * pageSize, (page - 1) * pageSize + pageSize),
|
|
3912
3984
|
[rows, page, pageSize, paginationMode, pagination]
|
|
3913
3985
|
);
|
|
3914
|
-
const selectableDataInPage =
|
|
3986
|
+
const selectableDataInPage = useMemo11(
|
|
3915
3987
|
() => dataInPage.filter((row, i) => {
|
|
3916
3988
|
if (!isRowSelectable) return true;
|
|
3917
3989
|
return isRowSelectable({ row, id: getId(row, i) });
|
|
3918
3990
|
}),
|
|
3919
3991
|
[dataInPage, isRowSelectable, getId]
|
|
3920
3992
|
);
|
|
3921
|
-
const handleRangeSelection =
|
|
3993
|
+
const handleRangeSelection = useCallback12(
|
|
3922
3994
|
(anchor, targetIndex) => {
|
|
3923
3995
|
const startIndex = Math.min(anchor.rowIndex, targetIndex);
|
|
3924
3996
|
const endIndex = Math.max(anchor.rowIndex, targetIndex);
|
|
@@ -3941,40 +4013,41 @@ function useDataTableRenderer({
|
|
|
3941
4013
|
},
|
|
3942
4014
|
[dataInPage, getId, isRowSelectable, selectionModel, onSelectionModelChange]
|
|
3943
4015
|
);
|
|
3944
|
-
const isAllSelected =
|
|
4016
|
+
const isAllSelected = useMemo11(
|
|
3945
4017
|
() => selectableDataInPage.length > 0 && selectableDataInPage.every((row, i) => selectedModelSet.has(getId(row, i))),
|
|
3946
4018
|
[selectableDataInPage, selectedModelSet, getId]
|
|
3947
4019
|
);
|
|
3948
4020
|
const rowCount = totalRowsProp || rows.length;
|
|
3949
|
-
const selectableRowCount =
|
|
4021
|
+
const selectableRowCount = useMemo11(() => {
|
|
3950
4022
|
if (!isRowSelectable) return rowCount;
|
|
3951
4023
|
return rows.filter((row, i) => isRowSelectable({ row, id: getId(row, i) })).length;
|
|
3952
4024
|
}, [rows, isRowSelectable, getId, rowCount]);
|
|
3953
|
-
const isTotalSelected =
|
|
4025
|
+
const isTotalSelected = useMemo11(
|
|
3954
4026
|
() => _isTotalSelected ?? (selectableRowCount > 0 && (selectionModel?.length || 0) === selectableRowCount),
|
|
3955
4027
|
[_isTotalSelected, selectionModel, selectableRowCount]
|
|
3956
4028
|
);
|
|
3957
4029
|
const columnWidths = useColumnWidths(visibleColumnsByField);
|
|
3958
|
-
const getWidth =
|
|
3959
|
-
|
|
3960
|
-
allColumnsByField[f]?.
|
|
4030
|
+
const getWidth = useCallback12(
|
|
4031
|
+
// 반환값은 pinned offset으로 더해지므로 반드시 숫자여야 한다. width/minWidth는 '500px' 같은 문자열.
|
|
4032
|
+
(f) => columnWidths[f] ?? parsePxValue(allColumnsByField[f]?.width) ?? // Column prop 으로 지정된 width
|
|
4033
|
+
parsePxValue(allColumnsByField[f]?.minWidth) ?? 0,
|
|
3961
4034
|
[columnWidths, allColumnsByField]
|
|
3962
4035
|
);
|
|
3963
|
-
const processedColumnGroups =
|
|
4036
|
+
const processedColumnGroups = useMemo11(() => {
|
|
3964
4037
|
if (!columnGroupingModel) return null;
|
|
3965
4038
|
return calculateColumnGroups(columnGroupingModel, visibleColumns, visibleFieldSet);
|
|
3966
4039
|
}, [columnGroupingModel, visibleColumns, visibleFieldSet]);
|
|
3967
|
-
const effectivePinnedLeft =
|
|
4040
|
+
const effectivePinnedLeft = useMemo11(
|
|
3968
4041
|
() => pinnedColumns?.left?.filter((f) => visibleFieldSet.has(f)),
|
|
3969
4042
|
[pinnedColumns?.left, visibleFieldSet]
|
|
3970
4043
|
);
|
|
3971
|
-
const effectivePinnedRight =
|
|
4044
|
+
const effectivePinnedRight = useMemo11(
|
|
3972
4045
|
() => pinnedColumns?.right?.filter((f) => visibleFieldSet.has(f)),
|
|
3973
4046
|
[pinnedColumns?.right, visibleFieldSet]
|
|
3974
4047
|
);
|
|
3975
4048
|
const inferredFieldsKey = JSON.stringify(Object.keys(rows[0] || {}));
|
|
3976
|
-
const inferredFields =
|
|
3977
|
-
const columns =
|
|
4049
|
+
const inferredFields = useMemo11(() => JSON.parse(inferredFieldsKey), [inferredFieldsKey]);
|
|
4050
|
+
const columns = useMemo11(() => {
|
|
3978
4051
|
const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] : inferredFields.map((key) => ({
|
|
3979
4052
|
field: key
|
|
3980
4053
|
}));
|
|
@@ -4009,14 +4082,14 @@ function useDataTableRenderer({
|
|
|
4009
4082
|
sortOrder,
|
|
4010
4083
|
getWidth
|
|
4011
4084
|
]);
|
|
4012
|
-
const handlePageChange =
|
|
4085
|
+
const handlePageChange = useCallback12(
|
|
4013
4086
|
(newPage) => {
|
|
4014
4087
|
setPage(newPage);
|
|
4015
4088
|
onPaginationModelChange?.({ page: newPage, pageSize });
|
|
4016
4089
|
},
|
|
4017
4090
|
[onPaginationModelChange, pageSize]
|
|
4018
4091
|
);
|
|
4019
|
-
const handleSortChange =
|
|
4092
|
+
const handleSortChange = useCallback12(
|
|
4020
4093
|
(props) => {
|
|
4021
4094
|
const { field, currentSort, multiple } = props;
|
|
4022
4095
|
const column = allColumnsByField[field];
|
|
@@ -4054,23 +4127,22 @@ function useDataTableRenderer({
|
|
|
4054
4127
|
onSelectionModelChangeRef.current?.([]);
|
|
4055
4128
|
setSelectionAnchor(null);
|
|
4056
4129
|
}, [page]);
|
|
4057
|
-
const prevRowsRef =
|
|
4130
|
+
const prevRowsRef = useRef7(_rows);
|
|
4058
4131
|
useEffect6(() => {
|
|
4059
4132
|
if (prevRowsRef.current !== _rows) {
|
|
4060
4133
|
setSelectionAnchor(null);
|
|
4061
4134
|
prevRowsRef.current = _rows;
|
|
4062
4135
|
}
|
|
4063
4136
|
}, [_rows]);
|
|
4064
|
-
const handleAutoFit =
|
|
4137
|
+
const handleAutoFit = useCallback12(
|
|
4065
4138
|
(field) => {
|
|
4066
4139
|
const colDef = visibleColumnsByField[field];
|
|
4067
4140
|
if (!colDef?.headerRef.current) return;
|
|
4068
|
-
const
|
|
4069
|
-
const columnType = column && "type" in column ? column.type : void 0;
|
|
4141
|
+
const columnType = "type" in colDef ? colDef.type : void 0;
|
|
4070
4142
|
if (columnType === "actions") return;
|
|
4071
4143
|
const optimalWidth = computeAutoFitWidth({
|
|
4072
4144
|
headerEl: colDef.headerRef.current,
|
|
4073
|
-
field,
|
|
4145
|
+
field: colDef.field,
|
|
4074
4146
|
dataInPage
|
|
4075
4147
|
});
|
|
4076
4148
|
if (optimalWidth == null) return;
|
|
@@ -4078,7 +4150,7 @@ function useDataTableRenderer({
|
|
|
4078
4150
|
colDef.headerRef.current.style.width = widthPx;
|
|
4079
4151
|
if (colDef.tableColRef.current) colDef.tableColRef.current.style.width = widthPx;
|
|
4080
4152
|
},
|
|
4081
|
-
[visibleColumnsByField,
|
|
4153
|
+
[visibleColumnsByField, dataInPage]
|
|
4082
4154
|
);
|
|
4083
4155
|
return {
|
|
4084
4156
|
rowCount,
|
|
@@ -4094,8 +4166,8 @@ function useDataTableRenderer({
|
|
|
4094
4166
|
handleAutoFit,
|
|
4095
4167
|
isAllSelected,
|
|
4096
4168
|
isTotalSelected,
|
|
4097
|
-
isSelectedRow:
|
|
4098
|
-
isRowSelectable:
|
|
4169
|
+
isSelectedRow: useCallback12((model) => selectedModelSet.has(model), [selectedModelSet]),
|
|
4170
|
+
isRowSelectable: useCallback12(
|
|
4099
4171
|
(rowId, row) => {
|
|
4100
4172
|
if (!isRowSelectable) return true;
|
|
4101
4173
|
return isRowSelectable({ row, id: rowId });
|
|
@@ -4103,13 +4175,13 @@ function useDataTableRenderer({
|
|
|
4103
4175
|
[isRowSelectable]
|
|
4104
4176
|
),
|
|
4105
4177
|
focusedRowId,
|
|
4106
|
-
onRowFocus:
|
|
4178
|
+
onRowFocus: useCallback12((rowId) => {
|
|
4107
4179
|
setFocusedRowId(rowId);
|
|
4108
4180
|
}, []),
|
|
4109
|
-
onAllCheckboxChange:
|
|
4181
|
+
onAllCheckboxChange: useCallback12(() => {
|
|
4110
4182
|
onSelectionModelChange?.(isAllSelected ? [] : selectableDataInPage.map(getId));
|
|
4111
4183
|
}, [isAllSelected, selectableDataInPage, onSelectionModelChange, getId]),
|
|
4112
|
-
onCheckboxChange:
|
|
4184
|
+
onCheckboxChange: useCallback12(
|
|
4113
4185
|
(event, selectedModel) => {
|
|
4114
4186
|
const isShiftClick = "shiftKey" in event && event.shiftKey;
|
|
4115
4187
|
const rowIndex = dataInPage.findIndex((row, i) => getId(row, i) === selectedModel);
|
|
@@ -4143,7 +4215,7 @@ function useDataTableRenderer({
|
|
|
4143
4215
|
columns,
|
|
4144
4216
|
tableMinWidth,
|
|
4145
4217
|
processedColumnGroups,
|
|
4146
|
-
onTotalSelect:
|
|
4218
|
+
onTotalSelect: useCallback12(() => {
|
|
4147
4219
|
const selectableRows = rows.filter((row, i) => {
|
|
4148
4220
|
if (!isRowSelectable) return true;
|
|
4149
4221
|
return isRowSelectable({ row, id: getId(row, i) });
|
|
@@ -4228,7 +4300,7 @@ function TableBody(props) {
|
|
|
4228
4300
|
TableBody.displayName = "TableBody";
|
|
4229
4301
|
|
|
4230
4302
|
// src/components/Pagination/Pagination.tsx
|
|
4231
|
-
import React25, { useCallback as
|
|
4303
|
+
import React25, { useCallback as useCallback13, useEffect as useEffect7 } from "react";
|
|
4232
4304
|
import PreviousIcon from "@mui/icons-material/ChevronLeftRounded";
|
|
4233
4305
|
import NextIcon from "@mui/icons-material/ChevronRightRounded";
|
|
4234
4306
|
import FirstPageIcon from "@mui/icons-material/FirstPageRounded";
|
|
@@ -4298,7 +4370,7 @@ function Pagination(inProps) {
|
|
|
4298
4370
|
const [paginationModel, setPaginationModel] = useControlledState(
|
|
4299
4371
|
_paginationModel,
|
|
4300
4372
|
defaultPaginationModel,
|
|
4301
|
-
|
|
4373
|
+
useCallback13(
|
|
4302
4374
|
(newPage) => {
|
|
4303
4375
|
onPageChange(newPage.page);
|
|
4304
4376
|
},
|
|
@@ -4516,8 +4588,8 @@ function Component(props, apiRef) {
|
|
|
4516
4588
|
...innerProps
|
|
4517
4589
|
} = props;
|
|
4518
4590
|
const tableId = useId();
|
|
4519
|
-
const parentRef =
|
|
4520
|
-
const tableBodyRef =
|
|
4591
|
+
const parentRef = useRef8(null);
|
|
4592
|
+
const tableBodyRef = useRef8(null);
|
|
4521
4593
|
const {
|
|
4522
4594
|
columns,
|
|
4523
4595
|
processedColumnGroups,
|
|
@@ -4553,9 +4625,9 @@ function Component(props, apiRef) {
|
|
|
4553
4625
|
measureElement: (element) => element.clientHeight,
|
|
4554
4626
|
overscan: 10
|
|
4555
4627
|
});
|
|
4556
|
-
const paginationModel =
|
|
4628
|
+
const paginationModel = useMemo12(() => ({ page, pageSize }), [page, pageSize]);
|
|
4557
4629
|
const columnsKey = getObjectVersion(columns);
|
|
4558
|
-
const headerCheckboxElement =
|
|
4630
|
+
const headerCheckboxElement = useMemo12(
|
|
4559
4631
|
() => /* @__PURE__ */ React26.createElement(
|
|
4560
4632
|
RenderCheckbox,
|
|
4561
4633
|
{
|
|
@@ -4581,20 +4653,20 @@ function Component(props, apiRef) {
|
|
|
4581
4653
|
const showNoRowsOverlay = !loading && rowCount === 0;
|
|
4582
4654
|
const showFillerColumn = columns.length > 0 && columns.every((c) => !!c.width);
|
|
4583
4655
|
const totalColCount = Math.max(1, columns.length + (checkboxSelection ? 1 : 0) + (showFillerColumn ? 1 : 0));
|
|
4584
|
-
const getRowClickHandler =
|
|
4656
|
+
const getRowClickHandler = useCallback14(
|
|
4585
4657
|
(row, rowId) => (e) => {
|
|
4586
4658
|
onRowClick?.({ row, rowId }, e);
|
|
4587
4659
|
checkboxSelection && !disableSelectionOnClick && isRowSelectableCheck(rowId, row) && onCheckboxChange(e, rowId);
|
|
4588
4660
|
},
|
|
4589
4661
|
[onRowClick, checkboxSelection, disableSelectionOnClick, onCheckboxChange, isRowSelectableCheck]
|
|
4590
4662
|
);
|
|
4591
|
-
const getRowFocusHandler =
|
|
4663
|
+
const getRowFocusHandler = useCallback14(
|
|
4592
4664
|
(rowId) => () => {
|
|
4593
4665
|
onRowFocus(rowId);
|
|
4594
4666
|
},
|
|
4595
4667
|
[onRowFocus]
|
|
4596
4668
|
);
|
|
4597
|
-
const getCheckboxClickHandler =
|
|
4669
|
+
const getCheckboxClickHandler = useCallback14(
|
|
4598
4670
|
(rowId, row) => (e) => {
|
|
4599
4671
|
e.stopPropagation();
|
|
4600
4672
|
if (isRowSelectableCheck(rowId, row)) {
|
|
@@ -4604,7 +4676,7 @@ function Component(props, apiRef) {
|
|
|
4604
4676
|
},
|
|
4605
4677
|
[onCheckboxChange, isRowSelectableCheck, onRowFocus]
|
|
4606
4678
|
);
|
|
4607
|
-
const handleTableKeyDown =
|
|
4679
|
+
const handleTableKeyDown = useCallback14(
|
|
4608
4680
|
(e) => {
|
|
4609
4681
|
const supportedKeys = ["ArrowUp", "ArrowDown", " ", "Home", "End", "PageUp", "PageDown"];
|
|
4610
4682
|
if (!supportedKeys.includes(e.key)) return;
|
|
@@ -4765,7 +4837,7 @@ function Component(props, apiRef) {
|
|
|
4765
4837
|
"col",
|
|
4766
4838
|
{
|
|
4767
4839
|
ref: c.tableColRef,
|
|
4768
|
-
key:
|
|
4840
|
+
key: c.field.toString(),
|
|
4769
4841
|
style: {
|
|
4770
4842
|
width: c.width,
|
|
4771
4843
|
minWidth: c.minWidth ?? "50px"
|
|
@@ -4815,13 +4887,13 @@ function Component(props, apiRef) {
|
|
|
4815
4887
|
}
|
|
4816
4888
|
},
|
|
4817
4889
|
headerCheckboxElement
|
|
4818
|
-
), columns.map((c
|
|
4890
|
+
), columns.map((c) => (
|
|
4819
4891
|
// @ts-ignore
|
|
4820
4892
|
/* @__PURE__ */ React26.createElement(
|
|
4821
4893
|
HeadCell2,
|
|
4822
4894
|
{
|
|
4823
4895
|
tableId,
|
|
4824
|
-
key:
|
|
4896
|
+
key: c.field.toString(),
|
|
4825
4897
|
stickyHeader: props.stickyHeader,
|
|
4826
4898
|
editMode: !!c.isCellEditable,
|
|
4827
4899
|
onSortChange: handleSortChange,
|
|
@@ -4951,7 +5023,7 @@ var DataTable = forwardRef7(Component);
|
|
|
4951
5023
|
DataTable.displayName = "DataTable";
|
|
4952
5024
|
|
|
4953
5025
|
// src/components/DateRangePicker/DateRangePicker.tsx
|
|
4954
|
-
import React27, { forwardRef as forwardRef8, useCallback as
|
|
5026
|
+
import React27, { forwardRef as forwardRef8, useCallback as useCallback15, useEffect as useEffect8, useImperativeHandle as useImperativeHandle3, useMemo as useMemo13, useRef as useRef9, useState as useState10 } from "react";
|
|
4955
5027
|
import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
|
|
4956
5028
|
import CalendarTodayIcon2 from "@mui/icons-material/CalendarToday";
|
|
4957
5029
|
import { styled as styled14, useThemeProps as useThemeProps7 } from "@mui/joy";
|
|
@@ -5156,12 +5228,12 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5156
5228
|
numberOfMonths,
|
|
5157
5229
|
...innerProps
|
|
5158
5230
|
} = props;
|
|
5159
|
-
const innerRef =
|
|
5160
|
-
const buttonRef =
|
|
5231
|
+
const innerRef = useRef9(null);
|
|
5232
|
+
const buttonRef = useRef9(null);
|
|
5161
5233
|
const [rawValue, setValue] = useControlledState(
|
|
5162
5234
|
props.value,
|
|
5163
5235
|
props.defaultValue ?? null,
|
|
5164
|
-
|
|
5236
|
+
useCallback15(
|
|
5165
5237
|
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
5166
5238
|
[props.name, onChange]
|
|
5167
5239
|
)
|
|
@@ -5173,7 +5245,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5173
5245
|
);
|
|
5174
5246
|
const [anchorEl, setAnchorEl] = useState10(null);
|
|
5175
5247
|
const open = Boolean(anchorEl);
|
|
5176
|
-
const calendarValue =
|
|
5248
|
+
const calendarValue = useMemo13(
|
|
5177
5249
|
() => value ? parseDates(value, format) : void 0,
|
|
5178
5250
|
[value, format]
|
|
5179
5251
|
);
|
|
@@ -5195,7 +5267,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5195
5267
|
}
|
|
5196
5268
|
}, [anchorEl, innerRef]);
|
|
5197
5269
|
useImperativeHandle3(ref, () => innerRef.current, [innerRef]);
|
|
5198
|
-
const handleChange =
|
|
5270
|
+
const handleChange = useCallback15(
|
|
5199
5271
|
(event) => {
|
|
5200
5272
|
const value2 = event.target.value;
|
|
5201
5273
|
setDisplayValue(value2 ? formatValueString2(parseDates(value2, format), displayFormat, locale) : value2);
|
|
@@ -5203,7 +5275,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5203
5275
|
},
|
|
5204
5276
|
[displayFormat, format, locale, setValue]
|
|
5205
5277
|
);
|
|
5206
|
-
const handleDisplayInputChange =
|
|
5278
|
+
const handleDisplayInputChange = useCallback15(
|
|
5207
5279
|
(event) => {
|
|
5208
5280
|
if (event.target.value === "") {
|
|
5209
5281
|
handleChange({
|
|
@@ -5228,14 +5300,14 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5228
5300
|
},
|
|
5229
5301
|
[displayFormat, format, handleChange, props.name]
|
|
5230
5302
|
);
|
|
5231
|
-
const handleCalendarToggle =
|
|
5303
|
+
const handleCalendarToggle = useCallback15(
|
|
5232
5304
|
(event) => {
|
|
5233
5305
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
5234
5306
|
innerRef.current?.focus();
|
|
5235
5307
|
},
|
|
5236
5308
|
[anchorEl, setAnchorEl, innerRef]
|
|
5237
5309
|
);
|
|
5238
|
-
const handleCalendarChange =
|
|
5310
|
+
const handleCalendarChange = useCallback15(
|
|
5239
5311
|
([date1, date2]) => {
|
|
5240
5312
|
if (!date1 || !date2) return;
|
|
5241
5313
|
const formattedValue = formatValueString2([date1, date2], format);
|
|
@@ -5249,7 +5321,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5249
5321
|
},
|
|
5250
5322
|
[props.value, props.name, onChange, setValue, setAnchorEl, format, displayFormat, locale]
|
|
5251
5323
|
);
|
|
5252
|
-
const handleInputMouseDown =
|
|
5324
|
+
const handleInputMouseDown = useCallback15(
|
|
5253
5325
|
(event) => {
|
|
5254
5326
|
if (inputReadOnly || isAlphabeticDisplay) {
|
|
5255
5327
|
event.preventDefault();
|
|
@@ -5258,7 +5330,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5258
5330
|
},
|
|
5259
5331
|
[inputReadOnly, isAlphabeticDisplay, buttonRef]
|
|
5260
5332
|
);
|
|
5261
|
-
const handleInputClick =
|
|
5333
|
+
const handleInputClick = useCallback15(
|
|
5262
5334
|
(event) => {
|
|
5263
5335
|
if (inputReadOnly && !readOnly) {
|
|
5264
5336
|
handleCalendarToggle(event);
|
|
@@ -5266,7 +5338,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5266
5338
|
},
|
|
5267
5339
|
[inputReadOnly, readOnly, handleCalendarToggle]
|
|
5268
5340
|
);
|
|
5269
|
-
const handlePresetClick =
|
|
5341
|
+
const handlePresetClick = useCallback15(
|
|
5270
5342
|
(presetValue) => {
|
|
5271
5343
|
if (props.value !== void 0) {
|
|
5272
5344
|
onChange?.({ target: { name: props.name, value: presetValue } });
|
|
@@ -5279,7 +5351,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5279
5351
|
},
|
|
5280
5352
|
[props.value, props.name, onChange, setValue, setAnchorEl, format, displayFormat, locale]
|
|
5281
5353
|
);
|
|
5282
|
-
const isPresetDisabled =
|
|
5354
|
+
const isPresetDisabled = useCallback15(
|
|
5283
5355
|
(presetValue) => {
|
|
5284
5356
|
try {
|
|
5285
5357
|
const dates = parseDates(presetValue, format);
|
|
@@ -5467,10 +5539,10 @@ var ModalClose = JoyModalClose;
|
|
|
5467
5539
|
var MotionModalOverflow = motion23(JoyModalOverflow);
|
|
5468
5540
|
var ModalOverflow = MotionModalOverflow;
|
|
5469
5541
|
ModalOverflow.displayName = "ModalOverflow";
|
|
5470
|
-
|
|
5542
|
+
var ModalFrame = React28.forwardRef((props, ref) => {
|
|
5471
5543
|
const { title, children, titleStartDecorator, onClose, ...innerProps } = props;
|
|
5472
|
-
return /* @__PURE__ */ React28.createElement(StyledModalDialog, { ...innerProps }, /* @__PURE__ */ React28.createElement(ModalClose, { onClick: onClose }), /* @__PURE__ */ React28.createElement(DialogTitle_default, null, titleStartDecorator, title), /* @__PURE__ */ React28.createElement(DialogContent_default, null, children));
|
|
5473
|
-
}
|
|
5544
|
+
return /* @__PURE__ */ React28.createElement(StyledModalDialog, { ...innerProps, ref }, /* @__PURE__ */ React28.createElement(ModalClose, { onClick: onClose }), /* @__PURE__ */ React28.createElement(DialogTitle_default, null, titleStartDecorator, title), /* @__PURE__ */ React28.createElement(DialogContent_default, null, children));
|
|
5545
|
+
});
|
|
5474
5546
|
ModalFrame.displayName = "ModalFrame";
|
|
5475
5547
|
|
|
5476
5548
|
// src/components/DialogFrame/DialogFrame.tsx
|
|
@@ -5515,14 +5587,14 @@ var InsetDrawer = styled19(JoyDrawer)(({ theme }) => ({
|
|
|
5515
5587
|
}));
|
|
5516
5588
|
|
|
5517
5589
|
// src/components/FilterableCheckboxGroup/FilterableCheckboxGroup.tsx
|
|
5518
|
-
import React31, { useCallback as
|
|
5590
|
+
import React31, { useCallback as useCallback16, useEffect as useEffect9, useMemo as useMemo14, useRef as useRef10, useState as useState11 } from "react";
|
|
5519
5591
|
import SearchIcon from "@mui/icons-material/Search";
|
|
5520
5592
|
import { useThemeProps as useThemeProps8 } from "@mui/joy";
|
|
5521
5593
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
5522
5594
|
var EMPTY_VALUE = [];
|
|
5523
5595
|
function LabelWithTooltip(props) {
|
|
5524
5596
|
const { label, size } = props;
|
|
5525
|
-
const labelContentRef =
|
|
5597
|
+
const labelContentRef = useRef10(null);
|
|
5526
5598
|
const [isOverflowing, setIsOverflowing] = useState11(false);
|
|
5527
5599
|
const labelContent = /* @__PURE__ */ React31.createElement(
|
|
5528
5600
|
"span",
|
|
@@ -5570,17 +5642,17 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5570
5642
|
const [rawValue, setInternalValue] = useControlledState(
|
|
5571
5643
|
value,
|
|
5572
5644
|
value ?? EMPTY_VALUE,
|
|
5573
|
-
|
|
5645
|
+
useCallback16((newValue) => onChange?.(newValue ?? []), [onChange])
|
|
5574
5646
|
);
|
|
5575
5647
|
const internalValue = rawValue ?? EMPTY_VALUE;
|
|
5576
|
-
const parentRef =
|
|
5577
|
-
const isInitialSortRef =
|
|
5578
|
-
const prevOptionsRef =
|
|
5579
|
-
const filteredOptions =
|
|
5648
|
+
const parentRef = useRef10(null);
|
|
5649
|
+
const isInitialSortRef = useRef10(false);
|
|
5650
|
+
const prevOptionsRef = useRef10([...options]);
|
|
5651
|
+
const filteredOptions = useMemo14(() => {
|
|
5580
5652
|
if (!searchTerm) return sortedOptions;
|
|
5581
5653
|
return sortedOptions.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
5582
5654
|
}, [sortedOptions, searchTerm]);
|
|
5583
|
-
const itemSize =
|
|
5655
|
+
const itemSize = useMemo14(() => {
|
|
5584
5656
|
switch (size) {
|
|
5585
5657
|
case "sm":
|
|
5586
5658
|
return 28;
|
|
@@ -5627,10 +5699,10 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5627
5699
|
useEffect9(() => {
|
|
5628
5700
|
virtualizer.measure();
|
|
5629
5701
|
}, [virtualizer, filteredOptions, size]);
|
|
5630
|
-
const handleSearchChange =
|
|
5702
|
+
const handleSearchChange = useCallback16((event) => {
|
|
5631
5703
|
setSearchTerm(event.target.value);
|
|
5632
5704
|
}, []);
|
|
5633
|
-
const handleCheckboxChange =
|
|
5705
|
+
const handleCheckboxChange = useCallback16(
|
|
5634
5706
|
(optionValue) => (event) => {
|
|
5635
5707
|
const checked = event.target.checked;
|
|
5636
5708
|
const newValue = checked ? [...internalValue, optionValue] : internalValue.filter((v) => v !== optionValue);
|
|
@@ -5638,7 +5710,7 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5638
5710
|
},
|
|
5639
5711
|
[internalValue, setInternalValue]
|
|
5640
5712
|
);
|
|
5641
|
-
const handleSelectAll =
|
|
5713
|
+
const handleSelectAll = useCallback16(
|
|
5642
5714
|
(event) => {
|
|
5643
5715
|
const checked = event.target.checked;
|
|
5644
5716
|
const enabledOptions = filteredOptions.filter((option) => !option.disabled);
|
|
@@ -5654,7 +5726,7 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5654
5726
|
},
|
|
5655
5727
|
[filteredOptions, internalValue, setInternalValue]
|
|
5656
5728
|
);
|
|
5657
|
-
const enabledFilteredOptions =
|
|
5729
|
+
const enabledFilteredOptions = useMemo14(() => filteredOptions.filter((option) => !option.disabled), [filteredOptions]);
|
|
5658
5730
|
const isAllSelected = enabledFilteredOptions.length > 0 && enabledFilteredOptions.every((option) => internalValue.includes(option.value));
|
|
5659
5731
|
const isIndeterminate = !isAllSelected && enabledFilteredOptions.some((option) => internalValue.includes(option.value));
|
|
5660
5732
|
return /* @__PURE__ */ React31.createElement("div", { style: { width: "100%" } }, /* @__PURE__ */ React31.createElement(
|
|
@@ -5742,16 +5814,16 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5742
5814
|
FilterableCheckboxGroup.displayName = "FilterableCheckboxGroup";
|
|
5743
5815
|
|
|
5744
5816
|
// src/components/FilterMenu/FilterMenu.tsx
|
|
5745
|
-
import React44, { useCallback as
|
|
5817
|
+
import React44, { useCallback as useCallback28, useContext, useEffect as useEffect12 } from "react";
|
|
5746
5818
|
import { Button as Button2, Stack as Stack12 } from "@mui/joy";
|
|
5747
5819
|
|
|
5748
5820
|
// src/components/FilterMenu/components/CheckboxGroup.tsx
|
|
5749
|
-
import React32, { useCallback as
|
|
5821
|
+
import React32, { useCallback as useCallback17 } from "react";
|
|
5750
5822
|
import { Stack as Stack2 } from "@mui/joy";
|
|
5751
5823
|
function CheckboxGroup(props) {
|
|
5752
5824
|
const { id, label, options, value, onChange, hidden } = props;
|
|
5753
5825
|
const [internalValue, setInternalValue] = useControlledState(value, [], onChange);
|
|
5754
|
-
const handleCheckboxChange =
|
|
5826
|
+
const handleCheckboxChange = useCallback17(
|
|
5755
5827
|
(optionValue) => (event) => {
|
|
5756
5828
|
const checked = event.target.checked;
|
|
5757
5829
|
let newValue;
|
|
@@ -5780,12 +5852,12 @@ function CheckboxGroup(props) {
|
|
|
5780
5852
|
CheckboxGroup.displayName = "CheckboxGroup";
|
|
5781
5853
|
|
|
5782
5854
|
// src/components/FilterMenu/components/FilterableCheckboxGroup.tsx
|
|
5783
|
-
import React33, { useCallback as
|
|
5855
|
+
import React33, { useCallback as useCallback18 } from "react";
|
|
5784
5856
|
import { Stack as Stack3 } from "@mui/joy";
|
|
5785
5857
|
function FilterableCheckboxGroup2(props) {
|
|
5786
5858
|
const { id, label, options, value, onChange, hidden, placeholder, maxHeight } = props;
|
|
5787
5859
|
const [internalValue, setInternalValue] = useControlledState(value, [], onChange);
|
|
5788
|
-
const handleChange =
|
|
5860
|
+
const handleChange = useCallback18(
|
|
5789
5861
|
(newValue) => {
|
|
5790
5862
|
setInternalValue(newValue);
|
|
5791
5863
|
},
|
|
@@ -5809,7 +5881,7 @@ function FilterableCheckboxGroup2(props) {
|
|
|
5809
5881
|
FilterableCheckboxGroup2.displayName = "FilterableCheckboxGroup";
|
|
5810
5882
|
|
|
5811
5883
|
// src/components/FilterMenu/components/RadioGroup.tsx
|
|
5812
|
-
import React34, { useCallback as
|
|
5884
|
+
import React34, { useCallback as useCallback19 } from "react";
|
|
5813
5885
|
|
|
5814
5886
|
// src/components/Radio/Radio.tsx
|
|
5815
5887
|
import { Radio as JoyRadio, RadioGroup as JoyRadioGroup } from "@mui/joy";
|
|
@@ -5826,7 +5898,7 @@ import { Stack as Stack4 } from "@mui/joy";
|
|
|
5826
5898
|
function RadioGroup2(props) {
|
|
5827
5899
|
const { id, label, options, value, onChange, hidden } = props;
|
|
5828
5900
|
const [internalValue, setInternalValue] = useControlledState(value, value ?? "", onChange);
|
|
5829
|
-
const handleRadioChange =
|
|
5901
|
+
const handleRadioChange = useCallback19(
|
|
5830
5902
|
(event) => {
|
|
5831
5903
|
const newValue = event.target.value;
|
|
5832
5904
|
const option = options.find((opt) => opt.value.toString() === newValue);
|
|
@@ -5843,7 +5915,7 @@ function RadioGroup2(props) {
|
|
|
5843
5915
|
RadioGroup2.displayName = "RadioGroup";
|
|
5844
5916
|
|
|
5845
5917
|
// src/components/FilterMenu/components/DateRange.tsx
|
|
5846
|
-
import React35, { useCallback as
|
|
5918
|
+
import React35, { useCallback as useCallback20, useMemo as useMemo15, useState as useState12, useEffect as useEffect10 } from "react";
|
|
5847
5919
|
import { Stack as Stack5 } from "@mui/joy";
|
|
5848
5920
|
function DateRange(props) {
|
|
5849
5921
|
const {
|
|
@@ -5862,7 +5934,7 @@ function DateRange(props) {
|
|
|
5862
5934
|
} = props;
|
|
5863
5935
|
const [internalValue, setInternalValue] = useControlledState(value, null, onChange);
|
|
5864
5936
|
const [selectedOption, setSelectedOption] = useState12("all-time");
|
|
5865
|
-
const dateRangeOptions =
|
|
5937
|
+
const dateRangeOptions = useMemo15(
|
|
5866
5938
|
() => [
|
|
5867
5939
|
{ label: "All Time", value: "all-time" },
|
|
5868
5940
|
{ label: "This Month", value: "this-month" },
|
|
@@ -5872,7 +5944,7 @@ function DateRange(props) {
|
|
|
5872
5944
|
],
|
|
5873
5945
|
[]
|
|
5874
5946
|
);
|
|
5875
|
-
const getDateRangeForOption =
|
|
5947
|
+
const getDateRangeForOption = useCallback20(
|
|
5876
5948
|
(option) => {
|
|
5877
5949
|
const now = /* @__PURE__ */ new Date();
|
|
5878
5950
|
const currentYear = now.getFullYear();
|
|
@@ -5911,7 +5983,7 @@ function DateRange(props) {
|
|
|
5911
5983
|
},
|
|
5912
5984
|
[internalValue]
|
|
5913
5985
|
);
|
|
5914
|
-
const determineOptionFromValue =
|
|
5986
|
+
const determineOptionFromValue = useCallback20(
|
|
5915
5987
|
(value2) => {
|
|
5916
5988
|
if (!value2) {
|
|
5917
5989
|
return "all-time";
|
|
@@ -5927,7 +5999,7 @@ function DateRange(props) {
|
|
|
5927
5999
|
},
|
|
5928
6000
|
[getDateRangeForOption]
|
|
5929
6001
|
);
|
|
5930
|
-
const customDateRangeValue =
|
|
6002
|
+
const customDateRangeValue = useMemo15(() => {
|
|
5931
6003
|
if (selectedOption === "custom" && internalValue) {
|
|
5932
6004
|
return `${internalValue[0]} - ${internalValue[1]}`;
|
|
5933
6005
|
}
|
|
@@ -5937,7 +6009,7 @@ function DateRange(props) {
|
|
|
5937
6009
|
const newOption = determineOptionFromValue(internalValue);
|
|
5938
6010
|
setSelectedOption(newOption);
|
|
5939
6011
|
}, [internalValue, determineOptionFromValue]);
|
|
5940
|
-
const handleOptionChange =
|
|
6012
|
+
const handleOptionChange = useCallback20(
|
|
5941
6013
|
(event) => {
|
|
5942
6014
|
const newOption = event.target.value;
|
|
5943
6015
|
setSelectedOption(newOption);
|
|
@@ -5946,7 +6018,7 @@ function DateRange(props) {
|
|
|
5946
6018
|
},
|
|
5947
6019
|
[getDateRangeForOption, setInternalValue]
|
|
5948
6020
|
);
|
|
5949
|
-
const handleCustomDateChange =
|
|
6021
|
+
const handleCustomDateChange = useCallback20(
|
|
5950
6022
|
(event) => {
|
|
5951
6023
|
const dateRangeString = event.target.value;
|
|
5952
6024
|
if (dateRangeString && dateRangeString.includes(" - ")) {
|
|
@@ -5986,11 +6058,11 @@ function DateRange(props) {
|
|
|
5986
6058
|
DateRange.displayName = "DateRange";
|
|
5987
6059
|
|
|
5988
6060
|
// src/components/FilterMenu/components/MonthRange.tsx
|
|
5989
|
-
import React37, { useCallback as
|
|
6061
|
+
import React37, { useCallback as useCallback22, useMemo as useMemo17 } from "react";
|
|
5990
6062
|
import { Stack as Stack6 } from "@mui/joy";
|
|
5991
6063
|
|
|
5992
6064
|
// src/components/MonthRangePicker/MonthRangePicker.tsx
|
|
5993
|
-
import React36, { forwardRef as forwardRef9, useCallback as
|
|
6065
|
+
import React36, { forwardRef as forwardRef9, useCallback as useCallback21, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useMemo as useMemo16, useRef as useRef11, useState as useState13 } from "react";
|
|
5994
6066
|
import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
|
|
5995
6067
|
import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
|
|
5996
6068
|
import { styled as styled20, useThemeProps as useThemeProps9 } from "@mui/joy";
|
|
@@ -6105,12 +6177,12 @@ var MonthRangePicker = forwardRef9((inProps, ref) => {
|
|
|
6105
6177
|
} = props;
|
|
6106
6178
|
const displayFormat = displayFormatProp ?? format;
|
|
6107
6179
|
const isAlphabeticDisplay = hasAlphabeticMonth3(displayFormat);
|
|
6108
|
-
const innerRef =
|
|
6109
|
-
const buttonRef =
|
|
6180
|
+
const innerRef = useRef11(null);
|
|
6181
|
+
const buttonRef = useRef11(null);
|
|
6110
6182
|
const [rawValue, setValue] = useControlledState(
|
|
6111
6183
|
props.value,
|
|
6112
6184
|
props.defaultValue ?? null,
|
|
6113
|
-
|
|
6185
|
+
useCallback21(
|
|
6114
6186
|
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
6115
6187
|
[props.name, onChange]
|
|
6116
6188
|
)
|
|
@@ -6121,7 +6193,7 @@ var MonthRangePicker = forwardRef9((inProps, ref) => {
|
|
|
6121
6193
|
);
|
|
6122
6194
|
const [anchorEl, setAnchorEl] = useState13(null);
|
|
6123
6195
|
const open = Boolean(anchorEl);
|
|
6124
|
-
const calendarValue =
|
|
6196
|
+
const calendarValue = useMemo16(() => value ? parseDates2(value) : void 0, [value]);
|
|
6125
6197
|
useEffect11(() => {
|
|
6126
6198
|
if (value) {
|
|
6127
6199
|
try {
|
|
@@ -6140,7 +6212,7 @@ var MonthRangePicker = forwardRef9((inProps, ref) => {
|
|
|
6140
6212
|
}
|
|
6141
6213
|
}, [anchorEl, innerRef]);
|
|
6142
6214
|
useImperativeHandle4(ref, () => innerRef.current, [innerRef]);
|
|
6143
|
-
const handleChange =
|
|
6215
|
+
const handleChange = useCallback21(
|
|
6144
6216
|
(event) => {
|
|
6145
6217
|
setDisplayValue(
|
|
6146
6218
|
event.target.value ? formatValueString3(parseDates2(event.target.value), displayFormat, locale) : ""
|
|
@@ -6149,7 +6221,7 @@ var MonthRangePicker = forwardRef9((inProps, ref) => {
|
|
|
6149
6221
|
},
|
|
6150
6222
|
[displayFormat, locale, setValue]
|
|
6151
6223
|
);
|
|
6152
|
-
const handleInputMouseDown =
|
|
6224
|
+
const handleInputMouseDown = useCallback21(
|
|
6153
6225
|
(event) => {
|
|
6154
6226
|
if (isAlphabeticDisplay) {
|
|
6155
6227
|
event.preventDefault();
|
|
@@ -6158,14 +6230,14 @@ var MonthRangePicker = forwardRef9((inProps, ref) => {
|
|
|
6158
6230
|
},
|
|
6159
6231
|
[isAlphabeticDisplay, buttonRef]
|
|
6160
6232
|
);
|
|
6161
|
-
const handleCalendarToggle =
|
|
6233
|
+
const handleCalendarToggle = useCallback21(
|
|
6162
6234
|
(event) => {
|
|
6163
6235
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
6164
6236
|
innerRef.current?.focus();
|
|
6165
6237
|
},
|
|
6166
6238
|
[anchorEl, setAnchorEl, innerRef]
|
|
6167
6239
|
);
|
|
6168
|
-
const handleCalendarChange =
|
|
6240
|
+
const handleCalendarChange = useCallback21(
|
|
6169
6241
|
([date1, date2]) => {
|
|
6170
6242
|
if (!date1 || !date2) return;
|
|
6171
6243
|
const formattedValue = formatValueString3([date1, date2], format);
|
|
@@ -6296,11 +6368,11 @@ function MonthRange(props) {
|
|
|
6296
6368
|
locale
|
|
6297
6369
|
} = props;
|
|
6298
6370
|
const [internalValue, setInternalValue] = useControlledState(value, null, onChange);
|
|
6299
|
-
const pickerValue =
|
|
6371
|
+
const pickerValue = useMemo17(
|
|
6300
6372
|
() => internalValue ? `${internalValue[0]} - ${internalValue[1]}` : "",
|
|
6301
6373
|
[internalValue]
|
|
6302
6374
|
);
|
|
6303
|
-
const handleChange =
|
|
6375
|
+
const handleChange = useCallback22(
|
|
6304
6376
|
(event) => {
|
|
6305
6377
|
const rangeString = event.target.value;
|
|
6306
6378
|
if (rangeString && rangeString.includes(" - ")) {
|
|
@@ -6335,12 +6407,12 @@ function MonthRange(props) {
|
|
|
6335
6407
|
MonthRange.displayName = "MonthRange";
|
|
6336
6408
|
|
|
6337
6409
|
// src/components/FilterMenu/components/CurrencyInput.tsx
|
|
6338
|
-
import React38, { useCallback as
|
|
6410
|
+
import React38, { useCallback as useCallback23 } from "react";
|
|
6339
6411
|
import { Stack as Stack7 } from "@mui/joy";
|
|
6340
6412
|
function CurrencyInput3(props) {
|
|
6341
6413
|
const { id, label, value, onChange, hidden, max, placeholder, useMinorUnit, currency = "USD" } = props;
|
|
6342
6414
|
const [internalValue, setInternalValue] = useControlledState(value, value, onChange);
|
|
6343
|
-
const handleCurrencyChange =
|
|
6415
|
+
const handleCurrencyChange = useCallback23(
|
|
6344
6416
|
(event) => {
|
|
6345
6417
|
const newValue = event.target.value ?? void 0;
|
|
6346
6418
|
setInternalValue(newValue);
|
|
@@ -6366,14 +6438,14 @@ function CurrencyInput3(props) {
|
|
|
6366
6438
|
CurrencyInput3.displayName = "CurrencyInput";
|
|
6367
6439
|
|
|
6368
6440
|
// src/components/FilterMenu/components/CurrencyRange.tsx
|
|
6369
|
-
import React39, { useCallback as
|
|
6441
|
+
import React39, { useCallback as useCallback24 } from "react";
|
|
6370
6442
|
import { Stack as Stack8 } from "@mui/joy";
|
|
6371
6443
|
function CurrencyRange(props) {
|
|
6372
6444
|
const { id, label, value, onChange, hidden, max, placeholder, useMinorUnit, currency = "USD" } = props;
|
|
6373
6445
|
const [internalValue, setInternalValue] = useControlledState(value, null, onChange);
|
|
6374
6446
|
const minValue = internalValue?.[0];
|
|
6375
6447
|
const maxValue = internalValue?.[1];
|
|
6376
|
-
const handleMinChange =
|
|
6448
|
+
const handleMinChange = useCallback24(
|
|
6377
6449
|
(event) => {
|
|
6378
6450
|
const newMinValue = event.target.value ?? void 0;
|
|
6379
6451
|
const currentMaxValue = maxValue;
|
|
@@ -6387,7 +6459,7 @@ function CurrencyRange(props) {
|
|
|
6387
6459
|
},
|
|
6388
6460
|
[maxValue, setInternalValue]
|
|
6389
6461
|
);
|
|
6390
|
-
const handleMaxChange =
|
|
6462
|
+
const handleMaxChange = useCallback24(
|
|
6391
6463
|
(event) => {
|
|
6392
6464
|
const newMaxValue = event.target.value ?? void 0;
|
|
6393
6465
|
const currentMinValue = minValue;
|
|
@@ -6439,7 +6511,7 @@ import React41 from "react";
|
|
|
6439
6511
|
import { Stack as Stack9, Typography as Typography5 } from "@mui/joy";
|
|
6440
6512
|
|
|
6441
6513
|
// src/components/PercentageInput/PercentageInput.tsx
|
|
6442
|
-
import React40, { useCallback as
|
|
6514
|
+
import React40, { useCallback as useCallback25, useMemo as useMemo18 } from "react";
|
|
6443
6515
|
import { NumericFormat as NumericFormat2 } from "react-number-format";
|
|
6444
6516
|
import { styled as styled21, useThemeProps as useThemeProps10 } from "@mui/joy";
|
|
6445
6517
|
var padDecimal = (value, decimalScale) => {
|
|
@@ -6496,19 +6568,19 @@ var PercentageInput = React40.forwardRef(
|
|
|
6496
6568
|
const [_value, setValue] = useControlledState(
|
|
6497
6569
|
props.value,
|
|
6498
6570
|
props.defaultValue ?? null,
|
|
6499
|
-
|
|
6571
|
+
useCallback25((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
6500
6572
|
);
|
|
6501
|
-
const value =
|
|
6573
|
+
const value = useMemo18(() => {
|
|
6502
6574
|
if (_value && useMinorUnit) {
|
|
6503
6575
|
return _value / Math.pow(10, maxDecimalScale);
|
|
6504
6576
|
}
|
|
6505
6577
|
return _value;
|
|
6506
6578
|
}, [_value, useMinorUnit, maxDecimalScale]);
|
|
6507
|
-
const internalError =
|
|
6579
|
+
const internalError = useMemo18(
|
|
6508
6580
|
() => value != null && (max != null && value > max || min != null && value < min),
|
|
6509
6581
|
[max, min, value]
|
|
6510
6582
|
);
|
|
6511
|
-
const handleChange =
|
|
6583
|
+
const handleChange = useCallback25(
|
|
6512
6584
|
(event) => {
|
|
6513
6585
|
if (event.target.value === "") {
|
|
6514
6586
|
setValue(null);
|
|
@@ -6582,7 +6654,7 @@ var PercentageInput3 = ({
|
|
|
6582
6654
|
};
|
|
6583
6655
|
|
|
6584
6656
|
// src/components/FilterMenu/components/PercentageRange.tsx
|
|
6585
|
-
import React42, { useCallback as
|
|
6657
|
+
import React42, { useCallback as useCallback26 } from "react";
|
|
6586
6658
|
import { Stack as Stack10 } from "@mui/joy";
|
|
6587
6659
|
function PercentageRange(props) {
|
|
6588
6660
|
const { id, label, value, onChange, hidden, useMinorUnit, maxDecimalScale, min, max } = props;
|
|
@@ -6593,7 +6665,7 @@ function PercentageRange(props) {
|
|
|
6593
6665
|
);
|
|
6594
6666
|
const minValue = internalValue?.[0];
|
|
6595
6667
|
const maxValue = internalValue?.[1];
|
|
6596
|
-
const handleMinChange =
|
|
6668
|
+
const handleMinChange = useCallback26(
|
|
6597
6669
|
(event) => {
|
|
6598
6670
|
const newMinValue = event.target.value ?? void 0;
|
|
6599
6671
|
const currentMaxValue = maxValue;
|
|
@@ -6605,7 +6677,7 @@ function PercentageRange(props) {
|
|
|
6605
6677
|
},
|
|
6606
6678
|
[maxValue, setInternalValue]
|
|
6607
6679
|
);
|
|
6608
|
-
const handleMaxChange =
|
|
6680
|
+
const handleMaxChange = useCallback26(
|
|
6609
6681
|
(event) => {
|
|
6610
6682
|
const newMaxValue = event.target.value ?? void 0;
|
|
6611
6683
|
const currentMinValue = minValue;
|
|
@@ -6653,13 +6725,13 @@ function PercentageRange(props) {
|
|
|
6653
6725
|
PercentageRange.displayName = "PercentageRange";
|
|
6654
6726
|
|
|
6655
6727
|
// src/components/FilterMenu/components/Autocomplete.tsx
|
|
6656
|
-
import React43, { useCallback as
|
|
6728
|
+
import React43, { useCallback as useCallback27 } from "react";
|
|
6657
6729
|
import { Stack as Stack11 } from "@mui/joy";
|
|
6658
6730
|
function Autocomplete2(props) {
|
|
6659
6731
|
const { id, label, value, onChange, options, multiple, hidden, placeholder } = props;
|
|
6660
6732
|
const [internalValue, setInternalValue] = useControlledState(value, void 0, onChange);
|
|
6661
6733
|
const autocompleteValue = typeof internalValue === "string" || typeof internalValue === "number" ? String(internalValue) : void 0;
|
|
6662
|
-
const handleChange =
|
|
6734
|
+
const handleChange = useCallback27(
|
|
6663
6735
|
(event) => {
|
|
6664
6736
|
const val = event.target.value ?? void 0;
|
|
6665
6737
|
if (val) {
|
|
@@ -6715,7 +6787,7 @@ function FilterMenu(props) {
|
|
|
6715
6787
|
dropdownRegistry.register();
|
|
6716
6788
|
return () => dropdownRegistry.unregister();
|
|
6717
6789
|
}, [dropdownRegistry]);
|
|
6718
|
-
const handleFilterChange =
|
|
6790
|
+
const handleFilterChange = useCallback28(
|
|
6719
6791
|
(filterId, value) => {
|
|
6720
6792
|
setInternalValues((prev) => ({
|
|
6721
6793
|
...prev,
|
|
@@ -6724,11 +6796,11 @@ function FilterMenu(props) {
|
|
|
6724
6796
|
},
|
|
6725
6797
|
[setInternalValues]
|
|
6726
6798
|
);
|
|
6727
|
-
const handleApply =
|
|
6799
|
+
const handleApply = useCallback28(() => {
|
|
6728
6800
|
onChange?.(internalValues);
|
|
6729
6801
|
onClose?.();
|
|
6730
6802
|
}, [onChange, onClose, internalValues]);
|
|
6731
|
-
const handleClear =
|
|
6803
|
+
const handleClear = useCallback28(() => {
|
|
6732
6804
|
const clearedValues = resetValues || {};
|
|
6733
6805
|
setInternalValues(clearedValues);
|
|
6734
6806
|
onChange?.(clearedValues);
|
|
@@ -6764,7 +6836,7 @@ function FilterMenu(props) {
|
|
|
6764
6836
|
FilterMenu.displayName = "FilterMenu";
|
|
6765
6837
|
|
|
6766
6838
|
// src/components/Uploader/Uploader.tsx
|
|
6767
|
-
import React45, { useCallback as
|
|
6839
|
+
import React45, { useCallback as useCallback29, useEffect as useEffect13, useMemo as useMemo19, useRef as useRef12, useState as useState14 } from "react";
|
|
6768
6840
|
import { styled as styled22, Input as Input2 } from "@mui/joy";
|
|
6769
6841
|
import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
|
|
6770
6842
|
import MuiUploadFileIcon from "@mui/icons-material/UploadFileRounded";
|
|
@@ -6898,14 +6970,14 @@ var Uploader = React45.memo((props) => {
|
|
|
6898
6970
|
error: errorProp,
|
|
6899
6971
|
helperText: helperTextProp
|
|
6900
6972
|
} = props;
|
|
6901
|
-
const dropZoneRef =
|
|
6902
|
-
const inputRef =
|
|
6973
|
+
const dropZoneRef = useRef12(null);
|
|
6974
|
+
const inputRef = useRef12(null);
|
|
6903
6975
|
const [errorText, setErrorText] = useState14();
|
|
6904
6976
|
const [files, setFiles] = useState14([]);
|
|
6905
6977
|
const [uploaded, setUploaded] = useState14(props.uploaded || []);
|
|
6906
6978
|
const [previewState, setPreviewState] = useState14("idle");
|
|
6907
|
-
const accepts =
|
|
6908
|
-
const parsedAccepts =
|
|
6979
|
+
const accepts = useMemo19(() => accept.split(",").map((accept2) => accept2.trim()), [accept]);
|
|
6980
|
+
const parsedAccepts = useMemo19(
|
|
6909
6981
|
() => accepts.flatMap((type) => {
|
|
6910
6982
|
if (["image/*", "video/*", "audio/*"].includes(type)) {
|
|
6911
6983
|
return ALL_EXTENSIONS_BY_TYPE[type];
|
|
@@ -6914,7 +6986,7 @@ var Uploader = React45.memo((props) => {
|
|
|
6914
6986
|
}),
|
|
6915
6987
|
[accepts]
|
|
6916
6988
|
);
|
|
6917
|
-
const helperText =
|
|
6989
|
+
const helperText = useMemo19(() => {
|
|
6918
6990
|
if (helperTextProp) {
|
|
6919
6991
|
return helperTextProp;
|
|
6920
6992
|
}
|
|
@@ -6944,12 +7016,12 @@ var Uploader = React45.memo((props) => {
|
|
|
6944
7016
|
}
|
|
6945
7017
|
return helperTexts.join(", ");
|
|
6946
7018
|
}, [accepts, maxFileTotalSize, maxCount, helperTextProp]);
|
|
6947
|
-
const error =
|
|
6948
|
-
const showDropZone =
|
|
7019
|
+
const error = useMemo19(() => !!errorText || errorProp, [errorProp, errorText]);
|
|
7020
|
+
const showDropZone = useMemo19(
|
|
6949
7021
|
() => !maxCount || maxCount && [...uploaded, ...files].length !== maxCount,
|
|
6950
7022
|
[files, maxCount, uploaded]
|
|
6951
7023
|
);
|
|
6952
|
-
const addFiles =
|
|
7024
|
+
const addFiles = useCallback29(
|
|
6953
7025
|
(uploads) => {
|
|
6954
7026
|
try {
|
|
6955
7027
|
const types = parsedAccepts.map((type) => type.replace(".", "")) || [];
|
|
@@ -7031,14 +7103,14 @@ var Uploader = React45.memo((props) => {
|
|
|
7031
7103
|
}
|
|
7032
7104
|
}
|
|
7033
7105
|
}, [inputRef, files, minCount]);
|
|
7034
|
-
const handleFileChanged =
|
|
7106
|
+
const handleFileChanged = useCallback29(
|
|
7035
7107
|
(event) => {
|
|
7036
7108
|
const files2 = Array.from(event.target.files || []);
|
|
7037
7109
|
addFiles(files2);
|
|
7038
7110
|
},
|
|
7039
7111
|
[addFiles]
|
|
7040
7112
|
);
|
|
7041
|
-
const handleDeleteFile =
|
|
7113
|
+
const handleDeleteFile = useCallback29(
|
|
7042
7114
|
(deletedFile) => {
|
|
7043
7115
|
if (deletedFile instanceof File) {
|
|
7044
7116
|
setFiles((current) => {
|
|
@@ -7058,7 +7130,7 @@ var Uploader = React45.memo((props) => {
|
|
|
7058
7130
|
},
|
|
7059
7131
|
[name, onChange, onDelete]
|
|
7060
7132
|
);
|
|
7061
|
-
const handleUploaderButtonClick =
|
|
7133
|
+
const handleUploaderButtonClick = useCallback29(() => {
|
|
7062
7134
|
inputRef.current?.click();
|
|
7063
7135
|
}, []);
|
|
7064
7136
|
const uploader = /* @__PURE__ */ React45.createElement(
|
|
@@ -7107,7 +7179,10 @@ import {
|
|
|
7107
7179
|
MenuButton as JoyMenuButton2,
|
|
7108
7180
|
IconButton as JoyIconButton2
|
|
7109
7181
|
} from "@mui/joy";
|
|
7110
|
-
function
|
|
7182
|
+
var MenuButtonRootSlot = React46.forwardRef(function MenuButtonRootSlot2({ as, ownerState: _ownerState, ...rest }, ref) {
|
|
7183
|
+
return /* @__PURE__ */ React46.createElement(JoyIconButton2, { ...rest, component: as ?? "button", ref });
|
|
7184
|
+
});
|
|
7185
|
+
function IconMenuButtonInner(props, ref) {
|
|
7111
7186
|
const {
|
|
7112
7187
|
size,
|
|
7113
7188
|
icon,
|
|
@@ -7118,6 +7193,8 @@ function IconMenuButton(props) {
|
|
|
7118
7193
|
variant = "plain",
|
|
7119
7194
|
placement = "bottom"
|
|
7120
7195
|
} = props;
|
|
7196
|
+
const { ref: buttonComponentRef, ...buttonComponentProps } = props.buttonComponentProps ?? {};
|
|
7197
|
+
const mergedButtonRef = useMergedRef(buttonComponentRef, ref);
|
|
7121
7198
|
if (!items.length) {
|
|
7122
7199
|
return /* @__PURE__ */ React46.createElement(
|
|
7123
7200
|
JoyIconButton2,
|
|
@@ -7128,7 +7205,8 @@ function IconMenuButton(props) {
|
|
|
7128
7205
|
color,
|
|
7129
7206
|
disabled,
|
|
7130
7207
|
loading,
|
|
7131
|
-
...
|
|
7208
|
+
...buttonComponentProps,
|
|
7209
|
+
ref: mergedButtonRef
|
|
7132
7210
|
},
|
|
7133
7211
|
icon
|
|
7134
7212
|
);
|
|
@@ -7136,22 +7214,26 @@ function IconMenuButton(props) {
|
|
|
7136
7214
|
return /* @__PURE__ */ React46.createElement(Dropdown_default, null, /* @__PURE__ */ React46.createElement(
|
|
7137
7215
|
JoyMenuButton2,
|
|
7138
7216
|
{
|
|
7139
|
-
slots: { root:
|
|
7217
|
+
slots: { root: MenuButtonRootSlot },
|
|
7140
7218
|
slotProps: {
|
|
7141
7219
|
root: {
|
|
7142
|
-
|
|
7220
|
+
// 기본값 'button'은 MenuButtonRootSlot 한 곳에만 둔다.
|
|
7221
|
+
component: props.buttonComponent,
|
|
7143
7222
|
size,
|
|
7144
7223
|
variant,
|
|
7145
7224
|
color,
|
|
7146
7225
|
disabled,
|
|
7147
7226
|
loading,
|
|
7148
|
-
...
|
|
7227
|
+
...buttonComponentProps,
|
|
7228
|
+
// Joy의 useSlot이 내부 ref와 이 ref를 합쳐준다. 위 no-items 분기와 같은 경로로 ref를 넘긴다.
|
|
7229
|
+
ref: mergedButtonRef
|
|
7149
7230
|
}
|
|
7150
7231
|
}
|
|
7151
7232
|
},
|
|
7152
7233
|
icon
|
|
7153
7234
|
), /* @__PURE__ */ React46.createElement(Menu, { placement, size }, items.map((i) => /* @__PURE__ */ React46.createElement(MenuItem, { key: i.text, component: i.component, ...i.componentProps ?? {} }, i.text))));
|
|
7154
7235
|
}
|
|
7236
|
+
var IconMenuButton = React46.forwardRef(IconMenuButtonInner);
|
|
7155
7237
|
IconMenuButton.displayName = "IconMenuButton";
|
|
7156
7238
|
|
|
7157
7239
|
// src/components/Markdown/Markdown.tsx
|
|
@@ -7343,7 +7425,7 @@ function MenuButton2(props) {
|
|
|
7343
7425
|
MenuButton2.displayName = "MenuButton";
|
|
7344
7426
|
|
|
7345
7427
|
// src/components/MonthPicker/MonthPicker.tsx
|
|
7346
|
-
import React49, { forwardRef as forwardRef10, useCallback as
|
|
7428
|
+
import React49, { forwardRef as forwardRef10, useCallback as useCallback30, useEffect as useEffect15, useImperativeHandle as useImperativeHandle5, useRef as useRef13, useState as useState16 } from "react";
|
|
7347
7429
|
import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
|
|
7348
7430
|
import { styled as styled23, useThemeProps as useThemeProps11 } from "@mui/joy";
|
|
7349
7431
|
import { FocusTrap as FocusTrap4, ClickAwayListener as ClickAwayListener4, Popper as Popper5 } from "@mui/base";
|
|
@@ -7426,18 +7508,18 @@ var MonthPicker = forwardRef10((inProps, ref) => {
|
|
|
7426
7508
|
locale,
|
|
7427
7509
|
...innerProps
|
|
7428
7510
|
} = props;
|
|
7429
|
-
const innerRef =
|
|
7430
|
-
const buttonRef =
|
|
7511
|
+
const innerRef = useRef13(null);
|
|
7512
|
+
const buttonRef = useRef13(null);
|
|
7431
7513
|
const [rawValue, setValue, isControlled] = useControlledState(
|
|
7432
7514
|
props.value,
|
|
7433
7515
|
props.defaultValue ?? null,
|
|
7434
|
-
|
|
7516
|
+
useCallback30(
|
|
7435
7517
|
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
7436
7518
|
[props.name, onChange]
|
|
7437
7519
|
)
|
|
7438
7520
|
);
|
|
7439
7521
|
const value = rawValue ?? "";
|
|
7440
|
-
const getFormattedDisplayValue =
|
|
7522
|
+
const getFormattedDisplayValue = useCallback30(
|
|
7441
7523
|
(inputValue) => {
|
|
7442
7524
|
if (!inputValue) return "";
|
|
7443
7525
|
try {
|
|
@@ -7460,7 +7542,7 @@ var MonthPicker = forwardRef10((inProps, ref) => {
|
|
|
7460
7542
|
useEffect15(() => {
|
|
7461
7543
|
setDisplayValue(getFormattedDisplayValue(value));
|
|
7462
7544
|
}, [value, getFormattedDisplayValue]);
|
|
7463
|
-
const handleChange =
|
|
7545
|
+
const handleChange = useCallback30(
|
|
7464
7546
|
(event) => {
|
|
7465
7547
|
const newValue = event.target.value;
|
|
7466
7548
|
setValue(newValue);
|
|
@@ -7470,14 +7552,14 @@ var MonthPicker = forwardRef10((inProps, ref) => {
|
|
|
7470
7552
|
},
|
|
7471
7553
|
[setValue, getFormattedDisplayValue, isControlled]
|
|
7472
7554
|
);
|
|
7473
|
-
const handleCalendarToggle =
|
|
7555
|
+
const handleCalendarToggle = useCallback30(
|
|
7474
7556
|
(event) => {
|
|
7475
7557
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
7476
7558
|
innerRef.current?.focus();
|
|
7477
7559
|
},
|
|
7478
7560
|
[anchorEl, setAnchorEl, innerRef]
|
|
7479
7561
|
);
|
|
7480
|
-
const handleInputMouseDown =
|
|
7562
|
+
const handleInputMouseDown = useCallback30(
|
|
7481
7563
|
(event) => {
|
|
7482
7564
|
event.preventDefault();
|
|
7483
7565
|
buttonRef.current?.focus();
|
|
@@ -7725,7 +7807,7 @@ function Navigator(props) {
|
|
|
7725
7807
|
Navigator.displayName = "Navigator";
|
|
7726
7808
|
|
|
7727
7809
|
// src/components/ProfileMenu/ProfileMenu.tsx
|
|
7728
|
-
import React53, { useCallback as
|
|
7810
|
+
import React53, { useCallback as useCallback31, useMemo as useMemo20 } from "react";
|
|
7729
7811
|
import { Dropdown as Dropdown2, ListDivider, menuItemClasses, styled as styled26, MenuButton as MenuButton3, useThemeProps as useThemeProps12 } from "@mui/joy";
|
|
7730
7812
|
import { ClickAwayListener as ClickAwayListener5 } from "@mui/base";
|
|
7731
7813
|
import DropdownIcon from "@mui/icons-material/ArrowDropDown";
|
|
@@ -7735,8 +7817,8 @@ var StyledProfileCard = styled26(Stack, {
|
|
|
7735
7817
|
})({});
|
|
7736
7818
|
function ProfileCard(props) {
|
|
7737
7819
|
const { children, chip, caption, size } = props;
|
|
7738
|
-
const captionLevel =
|
|
7739
|
-
const nameLevel =
|
|
7820
|
+
const captionLevel = useMemo20(() => size === "sm" ? "body-xs" : "body-sm", [size]);
|
|
7821
|
+
const nameLevel = useMemo20(() => size === "sm" ? "body-sm" : "body-md", [size]);
|
|
7740
7822
|
return /* @__PURE__ */ React53.createElement(StyledProfileCard, { px: 4, py: 2 }, /* @__PURE__ */ React53.createElement(Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React53.createElement(Typography, { level: nameLevel, fontWeight: "bold", textColor: "text.primary" }, children), chip && /* @__PURE__ */ React53.createElement(Chip, { size, color: "neutral", variant: "outlined" }, chip)), caption && /* @__PURE__ */ React53.createElement(Typography, { level: captionLevel, textColor: "text.tertiary" }, caption));
|
|
7741
7823
|
}
|
|
7742
7824
|
ProfileCard.displayName = "ProfileCard";
|
|
@@ -7778,7 +7860,7 @@ function ProfileMenu(inProps) {
|
|
|
7778
7860
|
const [open, setOpen] = useControlledState(
|
|
7779
7861
|
_open,
|
|
7780
7862
|
defaultOpen ?? false,
|
|
7781
|
-
|
|
7863
|
+
useCallback31((value) => onOpenChange?.(value), [onOpenChange])
|
|
7782
7864
|
);
|
|
7783
7865
|
return /* @__PURE__ */ React53.createElement(ClickAwayListener5, { onClickAway: () => setOpen(false) }, /* @__PURE__ */ React53.createElement("div", null, /* @__PURE__ */ React53.createElement(Dropdown2, { open }, /* @__PURE__ */ React53.createElement(
|
|
7784
7866
|
ProfileMenuButton,
|