@ceed/ads 1.41.3-next.5 → 1.41.3
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 +1 -2
- package/dist/components/DataTable/components.d.ts +1 -1
- package/dist/components/DataTable/hooks.d.ts +7 -6
- package/dist/components/DataTable/types.d.ts +0 -7
- package/dist/components/DataTable/utils.d.ts +0 -5
- package/dist/components/IconMenuButton/IconMenuButton.d.ts +8 -9
- package/dist/components/IconMenuButton/index.d.ts +1 -2
- package/dist/components/Modal/Modal.d.ts +4 -1
- package/dist/components/Select/Select.d.ts +4 -3
- package/dist/components/Textarea/Textarea.d.ts +4 -1
- package/dist/components/Textarea/index.d.ts +1 -2
- package/dist/components/data-display/DataTable.md +0 -4
- package/dist/components/navigation/IconMenuButton.md +12 -12
- package/dist/index.browser.js +6 -6
- package/dist/index.browser.js.map +4 -4
- package/dist/index.cjs +709 -808
- package/dist/index.js +171 -270
- package/framer/index.js +1 -1
- package/package.json +1 -1
- package/dist/libs/slot-props.d.ts +0 -22
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 useCallback2, useEffect as useEffect2, useMemo
|
|
185
|
+
import React5, { useCallback as useCallback2, useEffect as useEffect2, useMemo, useRef as useRef2 } from "react";
|
|
186
186
|
import {
|
|
187
187
|
Autocomplete as JoyAutocomplete,
|
|
188
188
|
AutocompleteOption as JoyAutocompleteOption,
|
|
@@ -284,37 +284,6 @@ function useControlledState(controlledValue, defaultValue, onChange) {
|
|
|
284
284
|
return [displayValue, handleChange, isControlled];
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
// src/libs/slot-props.ts
|
|
288
|
-
import { useMemo } 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
|
-
return useMemo(() => {
|
|
307
|
-
if (isFunctionForm) {
|
|
308
|
-
return ((ownerState) => {
|
|
309
|
-
const resolved = slotProp(ownerState) ?? {};
|
|
310
|
-
const merged = mergeRefs(resolved.ref, ref);
|
|
311
|
-
return merged ? { ...resolved, ref: merged } : { ...resolved };
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
return mergedRef ? { ...slotProp, ref: mergedRef } : { ...slotProp };
|
|
315
|
-
}, [isFunctionForm, slotProp, mergedRef, ref]);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
287
|
// src/components/Autocomplete/Autocomplete.tsx
|
|
319
288
|
var AutocompletePopper = styled3(Popper, {
|
|
320
289
|
name: "Autocomplete",
|
|
@@ -339,11 +308,11 @@ var AutocompleteListBox = React5.forwardRef((props, ref) => {
|
|
|
339
308
|
} = props;
|
|
340
309
|
const parentRef = useRef2(null);
|
|
341
310
|
const isGrouped = children[0].every((child) => child.hasOwnProperty("group"));
|
|
342
|
-
const itemHeight =
|
|
311
|
+
const itemHeight = useMemo(() => {
|
|
343
312
|
const heights = itemHeightMap[fontSize ?? "md"];
|
|
344
313
|
return hasSecondaryText ? heights.secondary : heights.default;
|
|
345
314
|
}, [fontSize, hasSecondaryText]);
|
|
346
|
-
const renderTargets =
|
|
315
|
+
const renderTargets = useMemo(() => {
|
|
347
316
|
if (loading) {
|
|
348
317
|
return [children[1]];
|
|
349
318
|
}
|
|
@@ -435,7 +404,7 @@ var autocompleteFilterOptions = createFilterOptions({
|
|
|
435
404
|
}
|
|
436
405
|
});
|
|
437
406
|
var getOptionLabel = (option) => `${option.label ?? ""}`;
|
|
438
|
-
function
|
|
407
|
+
function Autocomplete(props) {
|
|
439
408
|
const {
|
|
440
409
|
label,
|
|
441
410
|
error,
|
|
@@ -465,7 +434,7 @@ function AutocompleteInner(props, ref) {
|
|
|
465
434
|
)
|
|
466
435
|
);
|
|
467
436
|
const _value = rawValue ?? (props.multiple ? EMPTY_MULTIPLE_VALUE : "");
|
|
468
|
-
const options =
|
|
437
|
+
const options = useMemo(
|
|
469
438
|
() => props.options.map((option) => {
|
|
470
439
|
if (typeof option !== "object") {
|
|
471
440
|
return {
|
|
@@ -477,14 +446,14 @@ function AutocompleteInner(props, ref) {
|
|
|
477
446
|
}),
|
|
478
447
|
[props.options]
|
|
479
448
|
);
|
|
480
|
-
const optionMap =
|
|
449
|
+
const optionMap = useMemo(() => {
|
|
481
450
|
const map = /* @__PURE__ */ new Map();
|
|
482
451
|
options.forEach((option) => {
|
|
483
452
|
map.set(option.value, option);
|
|
484
453
|
});
|
|
485
454
|
return map;
|
|
486
455
|
}, [options]);
|
|
487
|
-
const value =
|
|
456
|
+
const value = useMemo(() => {
|
|
488
457
|
if (props.loading) {
|
|
489
458
|
return {
|
|
490
459
|
value: "",
|
|
@@ -503,25 +472,23 @@ function AutocompleteInner(props, ref) {
|
|
|
503
472
|
},
|
|
504
473
|
[size, props.loading]
|
|
505
474
|
);
|
|
506
|
-
const startDecorator =
|
|
475
|
+
const startDecorator = useMemo(
|
|
507
476
|
() => applySize(value?.startDecorator || props.startDecorator),
|
|
508
477
|
[value, applySize, props.startDecorator]
|
|
509
478
|
);
|
|
510
|
-
const endDecorator =
|
|
479
|
+
const endDecorator = useMemo(
|
|
511
480
|
() => applySize(value?.endDecorator || props.endDecorator),
|
|
512
481
|
[value, applySize, props.endDecorator]
|
|
513
482
|
);
|
|
514
|
-
const
|
|
515
|
-
const slotProps = useMemo2(
|
|
483
|
+
const slotProps = useMemo(
|
|
516
484
|
() => ({
|
|
517
485
|
...props.slotProps,
|
|
518
486
|
listbox: {
|
|
519
487
|
...props.slotProps?.listbox,
|
|
520
488
|
hasSecondaryText: options.some((opt) => opt.secondaryText)
|
|
521
|
-
}
|
|
522
|
-
input: inputSlotProps
|
|
489
|
+
}
|
|
523
490
|
}),
|
|
524
|
-
[options, props.slotProps
|
|
491
|
+
[options, props.slotProps]
|
|
525
492
|
);
|
|
526
493
|
const handleChange = useCallback2(
|
|
527
494
|
(event, value2) => {
|
|
@@ -555,9 +522,9 @@ function AutocompleteInner(props, ref) {
|
|
|
555
522
|
endDecorator,
|
|
556
523
|
getOptionLabel,
|
|
557
524
|
renderTags: (tags, getTagProps) => tags.map((tag, index) => {
|
|
558
|
-
const { onClick,
|
|
525
|
+
const { onClick, ...rest } = getTagProps({ index });
|
|
559
526
|
return applySize(
|
|
560
|
-
/* @__PURE__ */ React5.createElement(Chip_default, {
|
|
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(
|
|
561
528
|
/* @__PURE__ */ React5.createElement(AutocompleteTagDelete, { color: "primary", variant: "soft", onClick, size }, /* @__PURE__ */ React5.createElement(CloseIcon, null))
|
|
562
529
|
)))
|
|
563
530
|
);
|
|
@@ -567,29 +534,26 @@ function AutocompleteInner(props, ref) {
|
|
|
567
534
|
},
|
|
568
535
|
slotProps,
|
|
569
536
|
filterOptions: autocompleteFilterOptions,
|
|
570
|
-
renderOption: (props2, option) => {
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
applySize(option.endDecorator)
|
|
591
|
-
));
|
|
592
|
-
},
|
|
537
|
+
renderOption: (props2, option) => /* @__PURE__ */ React5.createElement(JoyAutocompleteOption, { ...props2 }, option.startDecorator && /* @__PURE__ */ React5.createElement(
|
|
538
|
+
ListItemDecorator,
|
|
539
|
+
{
|
|
540
|
+
sx: (theme) => ({
|
|
541
|
+
marginInlineEnd: `var(--Input-gap, ${theme.spacing(1)})`
|
|
542
|
+
})
|
|
543
|
+
},
|
|
544
|
+
applySize(option.startDecorator)
|
|
545
|
+
), 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)) : (
|
|
546
|
+
// TODO: haulla에서 사용할 때, label을 ReactNode로 넘기면 에러가 발생함....
|
|
547
|
+
applySize(option.label)
|
|
548
|
+
), option.endDecorator && /* @__PURE__ */ React5.createElement(
|
|
549
|
+
ListItemDecorator,
|
|
550
|
+
{
|
|
551
|
+
sx: (theme) => ({
|
|
552
|
+
marginInlineStart: `var(--Input-gap, ${theme.spacing(1)})`
|
|
553
|
+
})
|
|
554
|
+
},
|
|
555
|
+
applySize(option.endDecorator)
|
|
556
|
+
)),
|
|
593
557
|
renderGroup: (params) => params
|
|
594
558
|
}
|
|
595
559
|
);
|
|
@@ -609,14 +573,13 @@ function AutocompleteInner(props, ref) {
|
|
|
609
573
|
helperText && /* @__PURE__ */ React5.createElement(FormHelperText_default, null, helperText)
|
|
610
574
|
);
|
|
611
575
|
}
|
|
612
|
-
var Autocomplete = React5.forwardRef(AutocompleteInner);
|
|
613
576
|
Autocomplete.displayName = "Autocomplete";
|
|
614
577
|
|
|
615
578
|
// src/components/Autocomplete/index.ts
|
|
616
579
|
var Autocomplete_default = Autocomplete;
|
|
617
580
|
|
|
618
581
|
// src/components/Avatar/Avatar.tsx
|
|
619
|
-
import React6, { forwardRef as forwardRef2, useMemo as
|
|
582
|
+
import React6, { forwardRef as forwardRef2, useMemo as useMemo2 } from "react";
|
|
620
583
|
import { Avatar as JoyAvatar, AvatarGroup, styled as styled4, useThemeProps as useThemeProps2 } from "@mui/joy";
|
|
621
584
|
var StyledAvatar = styled4(JoyAvatar, {
|
|
622
585
|
name: "Avatar",
|
|
@@ -644,7 +607,7 @@ var Avatar = forwardRef2(function Avatar2(inProps, ref) {
|
|
|
644
607
|
name: "Avatar"
|
|
645
608
|
});
|
|
646
609
|
const { children, getInitial = defaultGetInitial, ...inheritProps } = props;
|
|
647
|
-
const calcChildren =
|
|
610
|
+
const calcChildren = useMemo2(() => {
|
|
648
611
|
if (typeof children === "string") {
|
|
649
612
|
return getInitial?.(children) ?? "";
|
|
650
613
|
}
|
|
@@ -686,7 +649,7 @@ var MenuItem = JoyMenuItem;
|
|
|
686
649
|
var Menu_default = Menu;
|
|
687
650
|
|
|
688
651
|
// src/components/Dropdown/Dropdown.tsx
|
|
689
|
-
import React8, { createContext, useCallback as useCallback3, useMemo as
|
|
652
|
+
import React8, { createContext, useCallback as useCallback3, useMemo as useMemo3, useState as useState2 } from "react";
|
|
690
653
|
import { Dropdown as JoyDropdown } from "@mui/joy";
|
|
691
654
|
import { MenuButton } from "@mui/joy";
|
|
692
655
|
import { useMenuButton } from "@mui/base/useMenuButton";
|
|
@@ -694,7 +657,7 @@ var DropdownNestedRegistryContext = createContext(null);
|
|
|
694
657
|
function Dropdown({ open: openProp, defaultOpen = false, onOpenChange, ...rest }) {
|
|
695
658
|
const [nestedCount, setNestedCount] = useState2(0);
|
|
696
659
|
const [open, setOpen] = useControlledState(openProp, defaultOpen);
|
|
697
|
-
const registry =
|
|
660
|
+
const registry = useMemo3(
|
|
698
661
|
() => ({
|
|
699
662
|
register: () => setNestedCount((c) => c + 1),
|
|
700
663
|
unregister: () => setNestedCount((c) => Math.max(0, c - 1))
|
|
@@ -764,7 +727,7 @@ Button.displayName = "Button";
|
|
|
764
727
|
var Button_default = Button;
|
|
765
728
|
|
|
766
729
|
// src/components/Calendar/Calendar.tsx
|
|
767
|
-
import React13, { Fragment, forwardRef as forwardRef4, useCallback as useCallback6, useEffect as useEffect3, useMemo as
|
|
730
|
+
import React13, { Fragment, forwardRef as forwardRef4, useCallback as useCallback6, useEffect as useEffect3, useMemo as useMemo5, useRef as useRef3, useState as useState5 } from "react";
|
|
768
731
|
import { styled as styled5 } from "@mui/joy";
|
|
769
732
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
770
733
|
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
|
@@ -858,7 +821,7 @@ var isSameMonth = (date1, date2) => {
|
|
|
858
821
|
};
|
|
859
822
|
|
|
860
823
|
// src/components/Calendar/hooks/use-calendar-props.ts
|
|
861
|
-
import { useCallback as useCallback4, useMemo as
|
|
824
|
+
import { useCallback as useCallback4, useMemo as useMemo4, useState as useState3 } from "react";
|
|
862
825
|
import { useThemeProps as useThemeProps3 } from "@mui/joy";
|
|
863
826
|
var resolveView = (view, views) => {
|
|
864
827
|
return views.includes(view) ? view : views[0];
|
|
@@ -878,12 +841,12 @@ var useCalendarProps = (inProps) => {
|
|
|
878
841
|
});
|
|
879
842
|
const [[page, direction], setPage] = useState3([0, 0]);
|
|
880
843
|
const resolvedView = inProps.view ?? uncontrolledView;
|
|
881
|
-
const resolvedMinDate =
|
|
844
|
+
const resolvedMinDate = useMemo4(() => {
|
|
882
845
|
const minDate = inProps.minDate || /* @__PURE__ */ new Date(0);
|
|
883
846
|
minDate.setHours(0, 0, 0, 0);
|
|
884
847
|
return minDate;
|
|
885
848
|
}, [inProps.minDate]);
|
|
886
|
-
const resolvedMaxDate =
|
|
849
|
+
const resolvedMaxDate = useMemo4(() => {
|
|
887
850
|
const maxDate = inProps.maxDate || /* @__PURE__ */ new Date(864e13);
|
|
888
851
|
maxDate.setHours(0, 0, 0, 0);
|
|
889
852
|
return maxDate;
|
|
@@ -942,7 +905,7 @@ var useCalendarProps = (inProps) => {
|
|
|
942
905
|
},
|
|
943
906
|
name: "Calendar"
|
|
944
907
|
});
|
|
945
|
-
const ownerState =
|
|
908
|
+
const ownerState = useMemo4(() => ({ ...props, viewMonth, direction }), [props, viewMonth, direction]);
|
|
946
909
|
return [props, ownerState];
|
|
947
910
|
};
|
|
948
911
|
|
|
@@ -1374,8 +1337,8 @@ var swipePower = (offset, velocity) => {
|
|
|
1374
1337
|
var PickerDays = (props) => {
|
|
1375
1338
|
const { ownerState } = props;
|
|
1376
1339
|
const { getPickerDayProps, getDayCellProps } = useCalendar(ownerState);
|
|
1377
|
-
const calendarDates =
|
|
1378
|
-
const weekdayNames =
|
|
1340
|
+
const calendarDates = useMemo5(() => getCalendarDates(ownerState.viewMonth), [ownerState.viewMonth]);
|
|
1341
|
+
const weekdayNames = useMemo5(() => getWeekdayNames(ownerState.locale || "default"), [ownerState.locale]);
|
|
1379
1342
|
return /* @__PURE__ */ React13.createElement(CalendarViewContainer, { calendarType: "datePicker" }, /* @__PURE__ */ React13.createElement(AnimatePresence, { initial: false, custom: ownerState.direction }, /* @__PURE__ */ React13.createElement(
|
|
1380
1343
|
CalendarViewTable,
|
|
1381
1344
|
{
|
|
@@ -1459,8 +1422,8 @@ var PickerMonths = (props) => {
|
|
|
1459
1422
|
};
|
|
1460
1423
|
var PlainPickerDays = ({ ownerState }) => {
|
|
1461
1424
|
const { getPickerDayProps, getDayCellProps } = useCalendar(ownerState);
|
|
1462
|
-
const calendarDates =
|
|
1463
|
-
const weekdayNames =
|
|
1425
|
+
const calendarDates = useMemo5(() => getCalendarDates(ownerState.viewMonth), [ownerState.viewMonth]);
|
|
1426
|
+
const weekdayNames = useMemo5(() => getWeekdayNames(ownerState.locale || "default"), [ownerState.locale]);
|
|
1464
1427
|
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(
|
|
1465
1428
|
(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" }))
|
|
1466
1429
|
)), rowIndex < calendarDates.length - 1 && /* @__PURE__ */ React13.createElement("tr", { "aria-hidden": "true", "aria-description": "row-gap" }, /* @__PURE__ */ React13.createElement("td", { colSpan: 13, style: { height: 4 } }))))));
|
|
@@ -1600,8 +1563,6 @@ var Calendar = forwardRef4((inProps, ref) => {
|
|
|
1600
1563
|
maxDate,
|
|
1601
1564
|
disableFuture,
|
|
1602
1565
|
disablePast,
|
|
1603
|
-
shouldDisableDate,
|
|
1604
|
-
slots,
|
|
1605
1566
|
numberOfMonths,
|
|
1606
1567
|
...others
|
|
1607
1568
|
} = props;
|
|
@@ -1841,7 +1802,7 @@ var Container = forwardRef5(function Container2(props, ref) {
|
|
|
1841
1802
|
Container.displayName = "Container";
|
|
1842
1803
|
|
|
1843
1804
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1844
|
-
import React17, { useCallback as useCallback8, useMemo as
|
|
1805
|
+
import React17, { useCallback as useCallback8, useMemo as useMemo6 } from "react";
|
|
1845
1806
|
import { NumericFormat } from "react-number-format";
|
|
1846
1807
|
|
|
1847
1808
|
// src/components/Input/Input.tsx
|
|
@@ -2175,19 +2136,19 @@ var CurrencyInput = React17.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
2175
2136
|
props.defaultValue ?? null,
|
|
2176
2137
|
useCallback8((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
2177
2138
|
);
|
|
2178
|
-
const value =
|
|
2139
|
+
const value = useMemo6(() => {
|
|
2179
2140
|
if (_value && useMinorUnit) {
|
|
2180
2141
|
return _value / Math.pow(10, decimalScale);
|
|
2181
2142
|
}
|
|
2182
2143
|
return _value;
|
|
2183
2144
|
}, [_value, useMinorUnit, decimalScale]);
|
|
2184
|
-
const max =
|
|
2145
|
+
const max = useMemo6(() => {
|
|
2185
2146
|
if (props.max && useMinorUnit) {
|
|
2186
2147
|
return props.max / Math.pow(10, decimalScale);
|
|
2187
2148
|
}
|
|
2188
2149
|
return props.max;
|
|
2189
2150
|
}, [props.max, useMinorUnit, decimalScale]);
|
|
2190
|
-
const isOverLimit =
|
|
2151
|
+
const isOverLimit = useMemo6(() => max != null && value != null && value > max, [max, value]);
|
|
2191
2152
|
const handleChange = useCallback8(
|
|
2192
2153
|
(event) => {
|
|
2193
2154
|
if (event.target.value === "") {
|
|
@@ -2238,7 +2199,7 @@ var CurrencyInput_default = CurrencyInput;
|
|
|
2238
2199
|
// src/components/DataTable/DataTable.tsx
|
|
2239
2200
|
import React26, {
|
|
2240
2201
|
useCallback as useCallback13,
|
|
2241
|
-
useMemo as
|
|
2202
|
+
useMemo as useMemo11,
|
|
2242
2203
|
useRef as useRef7,
|
|
2243
2204
|
useId,
|
|
2244
2205
|
forwardRef as forwardRef7,
|
|
@@ -2472,9 +2433,6 @@ function computeAutoFitWidth(params) {
|
|
|
2472
2433
|
if (!isNaN(maxPx) && maxPx > 0) finalWidth = Math.min(finalWidth, maxPx);
|
|
2473
2434
|
return finalWidth;
|
|
2474
2435
|
}
|
|
2475
|
-
function getHeaderCellId(tableId, columnId) {
|
|
2476
|
-
return `${tableId}_header_${columnId}`.trim();
|
|
2477
|
-
}
|
|
2478
2436
|
|
|
2479
2437
|
// src/components/DataTable/styled.tsx
|
|
2480
2438
|
import React18 from "react";
|
|
@@ -2666,7 +2624,7 @@ import React23, {
|
|
|
2666
2624
|
useRef as useRef5,
|
|
2667
2625
|
useState as useState8,
|
|
2668
2626
|
useLayoutEffect,
|
|
2669
|
-
useMemo as
|
|
2627
|
+
useMemo as useMemo9,
|
|
2670
2628
|
useCallback as useCallback10,
|
|
2671
2629
|
useEffect as useEffect5,
|
|
2672
2630
|
memo,
|
|
@@ -3150,7 +3108,7 @@ import React20 from "react";
|
|
|
3150
3108
|
import { Textarea as JoyTextarea } from "@mui/joy";
|
|
3151
3109
|
import { motion as motion19 } from "framer-motion";
|
|
3152
3110
|
var MotionTextarea = motion19(JoyTextarea);
|
|
3153
|
-
var
|
|
3111
|
+
var Textarea = (props) => {
|
|
3154
3112
|
const {
|
|
3155
3113
|
label,
|
|
3156
3114
|
error,
|
|
@@ -3194,17 +3152,13 @@ var TextareaBase = (props) => {
|
|
|
3194
3152
|
helperText && /* @__PURE__ */ React20.createElement(FormHelperText_default, null, helperText)
|
|
3195
3153
|
);
|
|
3196
3154
|
};
|
|
3197
|
-
var Textarea = React20.forwardRef((props, ref) => {
|
|
3198
|
-
const textareaSlotProps = useSlotRef(props.slotProps?.textarea, ref);
|
|
3199
|
-
return /* @__PURE__ */ React20.createElement(TextareaBase, { ...props, slotProps: { ...props.slotProps, textarea: textareaSlotProps } });
|
|
3200
|
-
});
|
|
3201
3155
|
Textarea.displayName = "Textarea";
|
|
3202
3156
|
|
|
3203
3157
|
// src/components/Textarea/index.ts
|
|
3204
3158
|
var Textarea_default = Textarea;
|
|
3205
3159
|
|
|
3206
3160
|
// src/components/Select/Select.tsx
|
|
3207
|
-
import React21, { useMemo as
|
|
3161
|
+
import React21, { useMemo as useMemo8 } from "react";
|
|
3208
3162
|
import {
|
|
3209
3163
|
Select as JoySelect,
|
|
3210
3164
|
Option as JoyOption,
|
|
@@ -3220,7 +3174,7 @@ var secondaryTextLevelMap2 = {
|
|
|
3220
3174
|
lg: "body-md"
|
|
3221
3175
|
};
|
|
3222
3176
|
Option.displayName = "Option";
|
|
3223
|
-
function
|
|
3177
|
+
function Select(props) {
|
|
3224
3178
|
const {
|
|
3225
3179
|
label,
|
|
3226
3180
|
helperText,
|
|
@@ -3246,7 +3200,7 @@ function SelectInner(props, ref) {
|
|
|
3246
3200
|
formHelperText: formHelperTextProps,
|
|
3247
3201
|
...joySlotProps
|
|
3248
3202
|
} = slotProps ?? {};
|
|
3249
|
-
const options =
|
|
3203
|
+
const options = useMemo8(
|
|
3250
3204
|
() => props.options.map((option) => {
|
|
3251
3205
|
if (option.hasOwnProperty("value") && option.hasOwnProperty("label")) {
|
|
3252
3206
|
return option;
|
|
@@ -3271,14 +3225,13 @@ function SelectInner(props, ref) {
|
|
|
3271
3225
|
};
|
|
3272
3226
|
onChange?.(newEvent, newValue);
|
|
3273
3227
|
};
|
|
3274
|
-
const optionMap =
|
|
3228
|
+
const optionMap = useMemo8(() => {
|
|
3275
3229
|
const map = /* @__PURE__ */ new Map();
|
|
3276
3230
|
options.forEach((option) => {
|
|
3277
3231
|
map.set(option.value, option);
|
|
3278
3232
|
});
|
|
3279
3233
|
return map;
|
|
3280
3234
|
}, [options]);
|
|
3281
|
-
const buttonSlotProps = useSlotRef(joySlotProps.button, ref);
|
|
3282
3235
|
const select = /* @__PURE__ */ React21.createElement(
|
|
3283
3236
|
JoySelect,
|
|
3284
3237
|
{
|
|
@@ -3287,7 +3240,7 @@ function SelectInner(props, ref) {
|
|
|
3287
3240
|
disabled,
|
|
3288
3241
|
size,
|
|
3289
3242
|
color: error ? "danger" : color,
|
|
3290
|
-
slotProps:
|
|
3243
|
+
slotProps: joySlotProps,
|
|
3291
3244
|
onChange: handleChange,
|
|
3292
3245
|
renderValue: (selected) => {
|
|
3293
3246
|
if (!selected) return null;
|
|
@@ -3317,7 +3270,6 @@ function SelectInner(props, ref) {
|
|
|
3317
3270
|
helperText && /* @__PURE__ */ React21.createElement(FormHelperText_default, { ...formHelperTextProps }, helperText)
|
|
3318
3271
|
);
|
|
3319
3272
|
}
|
|
3320
|
-
var Select = React21.forwardRef(SelectInner);
|
|
3321
3273
|
Select.displayName = "Select";
|
|
3322
3274
|
|
|
3323
3275
|
// src/components/Select/index.ts
|
|
@@ -3432,8 +3384,7 @@ var HeadCell = (props) => {
|
|
|
3432
3384
|
tableColRef,
|
|
3433
3385
|
headerClassName,
|
|
3434
3386
|
headerLineClamp,
|
|
3435
|
-
onAutoFit
|
|
3436
|
-
columnId
|
|
3387
|
+
onAutoFit
|
|
3437
3388
|
} = props;
|
|
3438
3389
|
const theme = useTheme();
|
|
3439
3390
|
const ref = headerRef;
|
|
@@ -3444,20 +3395,23 @@ var HeadCell = (props) => {
|
|
|
3444
3395
|
}, [ref]);
|
|
3445
3396
|
const [isHovered, setIsHovered] = useState8(false);
|
|
3446
3397
|
const sortable = type === "actions" ? false : _sortable;
|
|
3447
|
-
const headId =
|
|
3398
|
+
const headId = useMemo9(
|
|
3399
|
+
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
3400
|
+
[tableId, headerName, field]
|
|
3401
|
+
);
|
|
3448
3402
|
const isResizingRef = useRef5(false);
|
|
3449
|
-
const resizer =
|
|
3403
|
+
const resizer = useMemo9(
|
|
3450
3404
|
() => resizable ?? true ? Resizer(
|
|
3451
3405
|
ref,
|
|
3452
3406
|
colRef,
|
|
3453
3407
|
(isResizing) => {
|
|
3454
3408
|
isResizingRef.current = isResizing;
|
|
3455
3409
|
},
|
|
3456
|
-
onAutoFit ? () => onAutoFit(
|
|
3410
|
+
onAutoFit ? () => onAutoFit(field) : void 0
|
|
3457
3411
|
) : null,
|
|
3458
|
-
[resizable, ref, colRef, onAutoFit,
|
|
3412
|
+
[resizable, ref, colRef, onAutoFit, field]
|
|
3459
3413
|
);
|
|
3460
|
-
const style =
|
|
3414
|
+
const style = useMemo9(
|
|
3461
3415
|
() => ({
|
|
3462
3416
|
width,
|
|
3463
3417
|
minWidth: minWidth ?? "50px",
|
|
@@ -3475,7 +3429,7 @@ var HeadCell = (props) => {
|
|
|
3475
3429
|
);
|
|
3476
3430
|
const textAlign = getTextAlign(props);
|
|
3477
3431
|
const initialSort = sortOrder[0];
|
|
3478
|
-
const sortIcon =
|
|
3432
|
+
const sortIcon = useMemo9(() => {
|
|
3479
3433
|
const isSorted = !!sort;
|
|
3480
3434
|
const isVisible = sortable && (isSorted || isHovered);
|
|
3481
3435
|
return /* @__PURE__ */ React23.createElement(AnimatePresence2, { mode: "wait" }, isVisible && /* @__PURE__ */ React23.createElement(
|
|
@@ -3506,17 +3460,17 @@ var HeadCell = (props) => {
|
|
|
3506
3460
|
}
|
|
3507
3461
|
));
|
|
3508
3462
|
}, [headId, initialSort, sort, sortable, isHovered]);
|
|
3509
|
-
const infoSign =
|
|
3463
|
+
const infoSign = useMemo9(
|
|
3510
3464
|
() => description ? /* @__PURE__ */ React23.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null,
|
|
3511
3465
|
[description]
|
|
3512
3466
|
);
|
|
3513
|
-
const params =
|
|
3467
|
+
const params = useMemo9(
|
|
3514
3468
|
() => ({
|
|
3515
3469
|
field
|
|
3516
3470
|
}),
|
|
3517
3471
|
[field]
|
|
3518
3472
|
);
|
|
3519
|
-
const computedHeaderClassName =
|
|
3473
|
+
const computedHeaderClassName = useMemo9(
|
|
3520
3474
|
() => (typeof headerClassName === "function" ? headerClassName(params) : headerClassName) || void 0,
|
|
3521
3475
|
[headerClassName, params]
|
|
3522
3476
|
);
|
|
@@ -3570,7 +3524,7 @@ var BodyCell = (props) => {
|
|
|
3570
3524
|
const theme = useTheme();
|
|
3571
3525
|
const [value, setValue] = useState8(row[field]);
|
|
3572
3526
|
const cellRef = useRef5(null);
|
|
3573
|
-
const params =
|
|
3527
|
+
const params = useMemo9(
|
|
3574
3528
|
() => ({
|
|
3575
3529
|
row,
|
|
3576
3530
|
value,
|
|
@@ -3579,20 +3533,20 @@ var BodyCell = (props) => {
|
|
|
3579
3533
|
}),
|
|
3580
3534
|
[row, rowId, value, field]
|
|
3581
3535
|
);
|
|
3582
|
-
const editMode =
|
|
3536
|
+
const editMode = useMemo9(
|
|
3583
3537
|
() => !!(props.editMode && (typeof isCellEditable === "function" ? isCellEditable(params) : isCellEditable ?? true)),
|
|
3584
3538
|
[props.editMode, isCellEditable, params]
|
|
3585
3539
|
);
|
|
3586
3540
|
const propsComponentProps = "componentProps" in props ? props.componentProps : null;
|
|
3587
3541
|
const hasComponentProps = "componentProps" in props;
|
|
3588
|
-
const componentProps =
|
|
3542
|
+
const componentProps = useMemo9(
|
|
3589
3543
|
() => ({
|
|
3590
3544
|
...hasComponentProps && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
|
|
3591
3545
|
size: "sm"
|
|
3592
3546
|
}),
|
|
3593
3547
|
[hasComponentProps, propsComponentProps, params]
|
|
3594
3548
|
);
|
|
3595
|
-
const editModeComponentProps =
|
|
3549
|
+
const editModeComponentProps = useMemo9(
|
|
3596
3550
|
() => ({
|
|
3597
3551
|
...componentProps,
|
|
3598
3552
|
onChange: (e) => {
|
|
@@ -3654,9 +3608,9 @@ var BodyCell = (props) => {
|
|
|
3654
3608
|
}),
|
|
3655
3609
|
[params, row, field, value, componentProps, type, onCellEditStop, onCellEditStart]
|
|
3656
3610
|
);
|
|
3657
|
-
const MemoizedRenderEditCell =
|
|
3658
|
-
const MemoizedRenderCell =
|
|
3659
|
-
const EditModeComponent =
|
|
3611
|
+
const MemoizedRenderEditCell = useMemo9(() => renderEditCell ? memo(renderEditCell) : null, [renderEditCell]);
|
|
3612
|
+
const MemoizedRenderCell = useMemo9(() => renderCell ? memo(renderCell) : null, [renderCell]);
|
|
3613
|
+
const EditModeComponent = useMemo9(() => {
|
|
3660
3614
|
if (MemoizedRenderEditCell) {
|
|
3661
3615
|
return createElement(MemoizedRenderEditCell, params);
|
|
3662
3616
|
}
|
|
@@ -3691,7 +3645,7 @@ var BodyCell = (props) => {
|
|
|
3691
3645
|
}[type || "text"];
|
|
3692
3646
|
}, [value, editModeComponentProps, type, MemoizedRenderEditCell, params]);
|
|
3693
3647
|
const linkComponentFromProps = props.component;
|
|
3694
|
-
const ReadModeComponent =
|
|
3648
|
+
const ReadModeComponent = useMemo9(() => {
|
|
3695
3649
|
if (MemoizedRenderCell) {
|
|
3696
3650
|
return createElement(MemoizedRenderCell, params);
|
|
3697
3651
|
}
|
|
@@ -3705,15 +3659,15 @@ var BodyCell = (props) => {
|
|
|
3705
3659
|
return typedComponent || innerText;
|
|
3706
3660
|
}, [value, MemoizedRenderCell, params, type, componentProps, linkComponentFromProps]);
|
|
3707
3661
|
const getActions = props.getActions;
|
|
3708
|
-
const CellComponent =
|
|
3662
|
+
const CellComponent = useMemo9(() => {
|
|
3709
3663
|
if (type === "actions") {
|
|
3710
3664
|
return /* @__PURE__ */ React23.createElement(Stack_default, { direction: "row", gap: 1, justifyContent: "center", alignItems: "center" }, getActions?.(params));
|
|
3711
3665
|
}
|
|
3712
3666
|
return editMode && EditModeComponent ? EditModeComponent : ReadModeComponent;
|
|
3713
3667
|
}, [type, getActions, params, editMode, EditModeComponent, ReadModeComponent]);
|
|
3714
|
-
const showTooltip =
|
|
3668
|
+
const showTooltip = useMemo9(() => noWrap && type === "longText", [noWrap, type]);
|
|
3715
3669
|
const isBoundary = props.isLastStartPinnedColumn || props.isLastEndPinnedColumn;
|
|
3716
|
-
const computedCellClassName =
|
|
3670
|
+
const computedCellClassName = useMemo9(
|
|
3717
3671
|
() => (typeof cellClassName === "function" ? cellClassName(params) : cellClassName) || "",
|
|
3718
3672
|
[cellClassName, params]
|
|
3719
3673
|
);
|
|
@@ -3725,7 +3679,7 @@ var BodyCell = (props) => {
|
|
|
3725
3679
|
{
|
|
3726
3680
|
ref: cellRef,
|
|
3727
3681
|
key: field,
|
|
3728
|
-
headers:
|
|
3682
|
+
headers: `${tableId}_header_${props.headerName ?? field}`,
|
|
3729
3683
|
sx: {
|
|
3730
3684
|
textAlign: getTextAlign({ type }),
|
|
3731
3685
|
verticalAlign: editMode ? "top" : "middle",
|
|
@@ -3737,7 +3691,7 @@ var BodyCell = (props) => {
|
|
|
3737
3691
|
},
|
|
3738
3692
|
className: [isLastStartPinnedColumn && "is-last-left", isLastEndPinnedColumn && "is-last-right", computedCellClassName].filter(Boolean).join(" ") || ""
|
|
3739
3693
|
},
|
|
3740
|
-
|
|
3694
|
+
useMemo9(
|
|
3741
3695
|
() => showTooltip ? /* @__PURE__ */ React23.createElement(CellTextEllipsis, null, CellComponent) : CellComponent,
|
|
3742
3696
|
[CellComponent, showTooltip]
|
|
3743
3697
|
)
|
|
@@ -3790,46 +3744,36 @@ var VirtualizedTableRow = memo(StyledTableRow2, (prevProps, nextProps) => {
|
|
|
3790
3744
|
});
|
|
3791
3745
|
|
|
3792
3746
|
// src/components/DataTable/hooks.ts
|
|
3793
|
-
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useMemo as
|
|
3794
|
-
function useColumnWidths(
|
|
3747
|
+
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useMemo as useMemo10, useCallback as useCallback11, useEffect as useEffect6, createRef } from "react";
|
|
3748
|
+
function useColumnWidths(columnsByField) {
|
|
3795
3749
|
const [widths, setWidths] = useState9({});
|
|
3796
3750
|
const roRef = useRef6();
|
|
3797
3751
|
useLayoutEffect2(() => {
|
|
3798
3752
|
if (roRef.current) roRef.current.disconnect();
|
|
3799
3753
|
roRef.current = new ResizeObserver((entries) => {
|
|
3754
|
+
let changed = false;
|
|
3800
3755
|
setWidths((prev) => {
|
|
3801
|
-
let changed = false;
|
|
3802
3756
|
const next = { ...prev };
|
|
3803
3757
|
entries.forEach((entry) => {
|
|
3804
|
-
const
|
|
3758
|
+
const field = entry.target.dataset.field;
|
|
3805
3759
|
const w = Math.round(entry.target.getBoundingClientRect().width);
|
|
3806
|
-
if (
|
|
3807
|
-
|
|
3808
|
-
next[columnId] = w;
|
|
3760
|
+
if (next[field] !== w) {
|
|
3761
|
+
next[field] = w;
|
|
3809
3762
|
changed = true;
|
|
3810
3763
|
}
|
|
3811
3764
|
});
|
|
3812
3765
|
return changed ? next : prev;
|
|
3813
3766
|
});
|
|
3814
3767
|
});
|
|
3815
|
-
|
|
3816
|
-
Object.entries(columnsById).forEach(([columnId, def]) => {
|
|
3768
|
+
Object.entries(columnsByField).forEach(([field, def]) => {
|
|
3817
3769
|
const el = def.headerRef.current;
|
|
3818
3770
|
if (el) {
|
|
3819
|
-
el.dataset.
|
|
3820
|
-
el.dataset.field = String(def.field);
|
|
3821
|
-
const w = Math.round(el.getBoundingClientRect().width);
|
|
3822
|
-
if (w > 0) measured[columnId] = w;
|
|
3771
|
+
el.dataset.field = field;
|
|
3823
3772
|
roRef.current.observe(el);
|
|
3824
3773
|
}
|
|
3825
3774
|
});
|
|
3826
|
-
setWidths((prev) => {
|
|
3827
|
-
const keys = Object.keys(measured);
|
|
3828
|
-
const same = keys.length === Object.keys(prev).length && keys.every((key) => prev[key] === measured[key]);
|
|
3829
|
-
return same ? prev : measured;
|
|
3830
|
-
});
|
|
3831
3775
|
return () => roRef.current?.disconnect();
|
|
3832
|
-
}, [
|
|
3776
|
+
}, [columnsByField]);
|
|
3833
3777
|
return widths;
|
|
3834
3778
|
}
|
|
3835
3779
|
function useDataTableRenderer({
|
|
@@ -3878,23 +3822,16 @@ function useDataTableRenderer({
|
|
|
3878
3822
|
[onColumnVisibilityModelChange]
|
|
3879
3823
|
)
|
|
3880
3824
|
);
|
|
3881
|
-
const reorderedColumns =
|
|
3825
|
+
const reorderedColumns = useMemo10(() => {
|
|
3882
3826
|
if (!columnGroupingModel) return columnsProp;
|
|
3883
3827
|
return reorderColumnsByGroupingModel(columnsProp, columnGroupingModel);
|
|
3884
3828
|
}, [columnsProp, columnGroupingModel]);
|
|
3885
|
-
const
|
|
3886
|
-
() => reorderedColumns.
|
|
3887
|
-
if (visibilityModel[col.field] !== false) acc.push(index);
|
|
3888
|
-
return acc;
|
|
3889
|
-
}, []),
|
|
3829
|
+
const visibleColumns = useMemo10(
|
|
3830
|
+
() => reorderedColumns.filter((col) => visibilityModel[col.field] !== false),
|
|
3890
3831
|
[reorderedColumns, visibilityModel]
|
|
3891
3832
|
);
|
|
3892
|
-
const
|
|
3893
|
-
|
|
3894
|
-
[visibleColumnIndexes, reorderedColumns]
|
|
3895
|
-
);
|
|
3896
|
-
const visibleFieldSet = useMemo11(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3897
|
-
const tableMinWidth = useMemo11(() => {
|
|
3833
|
+
const visibleFieldSet = useMemo10(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3834
|
+
const tableMinWidth = useMemo10(() => {
|
|
3898
3835
|
const DEFAULT_MIN = 50;
|
|
3899
3836
|
let total = checkboxSelection ? 40 : 0;
|
|
3900
3837
|
for (const col of visibleColumns) {
|
|
@@ -3902,7 +3839,7 @@ function useDataTableRenderer({
|
|
|
3902
3839
|
}
|
|
3903
3840
|
return total;
|
|
3904
3841
|
}, [visibleColumns, checkboxSelection]);
|
|
3905
|
-
const allColumnsByField =
|
|
3842
|
+
const allColumnsByField = useMemo10(
|
|
3906
3843
|
() => reorderedColumns.reduce(
|
|
3907
3844
|
(acc, curr) => ({
|
|
3908
3845
|
...acc,
|
|
@@ -3912,37 +3849,19 @@ function useDataTableRenderer({
|
|
|
3912
3849
|
),
|
|
3913
3850
|
[reorderedColumns]
|
|
3914
3851
|
);
|
|
3915
|
-
const
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
assigned.add(field);
|
|
3922
|
-
return field;
|
|
3923
|
-
}
|
|
3924
|
-
let n = 2;
|
|
3925
|
-
while (taken.has(`${field}__${n}`)) n += 1;
|
|
3926
|
-
taken.add(`${field}__${n}`);
|
|
3927
|
-
return `${field}__${n}`;
|
|
3928
|
-
});
|
|
3929
|
-
}, [reorderedColumns]);
|
|
3930
|
-
const columnIds = useMemo11(
|
|
3931
|
-
() => visibleColumnIndexes.map((index) => allColumnIds[index]),
|
|
3932
|
-
[visibleColumnIndexes, allColumnIds]
|
|
3933
|
-
);
|
|
3934
|
-
const visibleColumnsById = useMemo11(
|
|
3935
|
-
() => Object.fromEntries(
|
|
3936
|
-
visibleColumns.map((column, index) => [
|
|
3937
|
-
columnIds[index],
|
|
3938
|
-
{
|
|
3939
|
-
...column,
|
|
3852
|
+
const visibleColumnsByField = useMemo10(
|
|
3853
|
+
() => visibleColumns.reduce(
|
|
3854
|
+
(acc, curr) => ({
|
|
3855
|
+
...acc,
|
|
3856
|
+
[curr.field]: {
|
|
3857
|
+
...curr,
|
|
3940
3858
|
headerRef: createRef(),
|
|
3941
3859
|
tableColRef: createRef()
|
|
3942
3860
|
}
|
|
3943
|
-
|
|
3861
|
+
}),
|
|
3862
|
+
{}
|
|
3944
3863
|
),
|
|
3945
|
-
[visibleColumns
|
|
3864
|
+
[visibleColumns]
|
|
3946
3865
|
);
|
|
3947
3866
|
const sortComparator = useCallback11(
|
|
3948
3867
|
(rowA, rowB) => {
|
|
@@ -3973,11 +3892,11 @@ function useDataTableRenderer({
|
|
|
3973
3892
|
},
|
|
3974
3893
|
[sortModel, allColumnsByField]
|
|
3975
3894
|
);
|
|
3976
|
-
const rows =
|
|
3895
|
+
const rows = useMemo10(
|
|
3977
3896
|
() => sortModel.length ? [..._rows].sort(sortComparator) : _rows,
|
|
3978
3897
|
[_rows, sortModel, sortComparator]
|
|
3979
3898
|
);
|
|
3980
|
-
const sortOrder =
|
|
3899
|
+
const sortOrder = useMemo10(
|
|
3981
3900
|
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3982
3901
|
[_sortOrder]
|
|
3983
3902
|
);
|
|
@@ -3987,12 +3906,12 @@ function useDataTableRenderer({
|
|
|
3987
3906
|
(row, index) => _getId?.(row) ?? row.id ?? `${(index || 0) + (page - 1) * pageSize}`,
|
|
3988
3907
|
[_getId, page, pageSize]
|
|
3989
3908
|
);
|
|
3990
|
-
const selectedModelSet =
|
|
3991
|
-
const dataInPage =
|
|
3909
|
+
const selectedModelSet = useMemo10(() => new Set(selectionModel || []), [selectionModel]);
|
|
3910
|
+
const dataInPage = useMemo10(
|
|
3992
3911
|
() => !pagination || paginationMode === "server" ? rows : rows.slice((page - 1) * pageSize, (page - 1) * pageSize + pageSize),
|
|
3993
3912
|
[rows, page, pageSize, paginationMode, pagination]
|
|
3994
3913
|
);
|
|
3995
|
-
const selectableDataInPage =
|
|
3914
|
+
const selectableDataInPage = useMemo10(
|
|
3996
3915
|
() => dataInPage.filter((row, i) => {
|
|
3997
3916
|
if (!isRowSelectable) return true;
|
|
3998
3917
|
return isRowSelectable({ row, id: getId(row, i) });
|
|
@@ -4022,60 +3941,51 @@ function useDataTableRenderer({
|
|
|
4022
3941
|
},
|
|
4023
3942
|
[dataInPage, getId, isRowSelectable, selectionModel, onSelectionModelChange]
|
|
4024
3943
|
);
|
|
4025
|
-
const isAllSelected =
|
|
3944
|
+
const isAllSelected = useMemo10(
|
|
4026
3945
|
() => selectableDataInPage.length > 0 && selectableDataInPage.every((row, i) => selectedModelSet.has(getId(row, i))),
|
|
4027
3946
|
[selectableDataInPage, selectedModelSet, getId]
|
|
4028
3947
|
);
|
|
4029
3948
|
const rowCount = totalRowsProp || rows.length;
|
|
4030
|
-
const selectableRowCount =
|
|
3949
|
+
const selectableRowCount = useMemo10(() => {
|
|
4031
3950
|
if (!isRowSelectable) return rowCount;
|
|
4032
3951
|
return rows.filter((row, i) => isRowSelectable({ row, id: getId(row, i) })).length;
|
|
4033
3952
|
}, [rows, isRowSelectable, getId, rowCount]);
|
|
4034
|
-
const isTotalSelected =
|
|
3953
|
+
const isTotalSelected = useMemo10(
|
|
4035
3954
|
() => _isTotalSelected ?? (selectableRowCount > 0 && (selectionModel?.length || 0) === selectableRowCount),
|
|
4036
3955
|
[_isTotalSelected, selectionModel, selectableRowCount]
|
|
4037
3956
|
);
|
|
4038
|
-
const columnWidths = useColumnWidths(
|
|
4039
|
-
const measuredWidthByField = useMemo11(
|
|
4040
|
-
() => Object.fromEntries(
|
|
4041
|
-
Object.entries(visibleColumnsById).map(([columnId, column]) => [column.field, columnWidths[columnId]])
|
|
4042
|
-
),
|
|
4043
|
-
[visibleColumnsById, columnWidths]
|
|
4044
|
-
);
|
|
3957
|
+
const columnWidths = useColumnWidths(visibleColumnsByField);
|
|
4045
3958
|
const getWidth = useCallback11(
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
[measuredWidthByField, allColumnsByField]
|
|
3959
|
+
(f) => columnWidths[f] ?? allColumnsByField[f]?.width ?? // Column prop 으로 지정된 width
|
|
3960
|
+
allColumnsByField[f]?.minWidth ?? 0,
|
|
3961
|
+
[columnWidths, allColumnsByField]
|
|
4050
3962
|
);
|
|
4051
|
-
const processedColumnGroups =
|
|
3963
|
+
const processedColumnGroups = useMemo10(() => {
|
|
4052
3964
|
if (!columnGroupingModel) return null;
|
|
4053
3965
|
return calculateColumnGroups(columnGroupingModel, visibleColumns, visibleFieldSet);
|
|
4054
3966
|
}, [columnGroupingModel, visibleColumns, visibleFieldSet]);
|
|
4055
|
-
const effectivePinnedLeft =
|
|
3967
|
+
const effectivePinnedLeft = useMemo10(
|
|
4056
3968
|
() => pinnedColumns?.left?.filter((f) => visibleFieldSet.has(f)),
|
|
4057
3969
|
[pinnedColumns?.left, visibleFieldSet]
|
|
4058
3970
|
);
|
|
4059
|
-
const effectivePinnedRight =
|
|
3971
|
+
const effectivePinnedRight = useMemo10(
|
|
4060
3972
|
() => pinnedColumns?.right?.filter((f) => visibleFieldSet.has(f)),
|
|
4061
3973
|
[pinnedColumns?.right, visibleFieldSet]
|
|
4062
3974
|
);
|
|
4063
3975
|
const inferredFieldsKey = JSON.stringify(Object.keys(rows[0] || {}));
|
|
4064
|
-
const inferredFields =
|
|
4065
|
-
const columns =
|
|
3976
|
+
const inferredFields = useMemo10(() => JSON.parse(inferredFieldsKey), [inferredFieldsKey]);
|
|
3977
|
+
const columns = useMemo10(() => {
|
|
4066
3978
|
const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] : inferredFields.map((key) => ({
|
|
4067
3979
|
field: key
|
|
4068
3980
|
}));
|
|
4069
|
-
return baseColumns.map((column
|
|
4070
|
-
const columnId = columnIds[index] ?? String(column.field);
|
|
3981
|
+
return baseColumns.map((column) => {
|
|
4071
3982
|
const isLeftPinned = effectivePinnedLeft?.includes(column.field);
|
|
4072
3983
|
const isRightPinned = effectivePinnedRight?.includes(column.field);
|
|
4073
3984
|
const isPinned = isLeftPinned || isRightPinned;
|
|
4074
3985
|
return {
|
|
4075
3986
|
...column,
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
tableColRef: visibleColumnsById[columnId]?.tableColRef,
|
|
3987
|
+
headerRef: visibleColumnsByField[column.field]?.headerRef,
|
|
3988
|
+
tableColRef: visibleColumnsByField[column.field]?.tableColRef,
|
|
4079
3989
|
isCellEditable: editMode && (typeof column.isCellEditable === "function" ? column.isCellEditable : column.isCellEditable ?? true),
|
|
4080
3990
|
sort: sortModel.find((sort) => sort.field === column.field)?.sort,
|
|
4081
3991
|
sortOrder: allColumnsByField[column.field]?.sortOrder || sortOrder,
|
|
@@ -4092,8 +4002,7 @@ function useDataTableRenderer({
|
|
|
4092
4002
|
inferredFields,
|
|
4093
4003
|
effectivePinnedLeft,
|
|
4094
4004
|
effectivePinnedRight,
|
|
4095
|
-
|
|
4096
|
-
visibleColumnsById,
|
|
4005
|
+
visibleColumnsByField,
|
|
4097
4006
|
allColumnsByField,
|
|
4098
4007
|
editMode,
|
|
4099
4008
|
sortModel,
|
|
@@ -4153,14 +4062,15 @@ function useDataTableRenderer({
|
|
|
4153
4062
|
}
|
|
4154
4063
|
}, [_rows]);
|
|
4155
4064
|
const handleAutoFit = useCallback11(
|
|
4156
|
-
(
|
|
4157
|
-
const colDef =
|
|
4065
|
+
(field) => {
|
|
4066
|
+
const colDef = visibleColumnsByField[field];
|
|
4158
4067
|
if (!colDef?.headerRef.current) return;
|
|
4159
|
-
const
|
|
4068
|
+
const column = allColumnsByField[field];
|
|
4069
|
+
const columnType = column && "type" in column ? column.type : void 0;
|
|
4160
4070
|
if (columnType === "actions") return;
|
|
4161
4071
|
const optimalWidth = computeAutoFitWidth({
|
|
4162
4072
|
headerEl: colDef.headerRef.current,
|
|
4163
|
-
field
|
|
4073
|
+
field,
|
|
4164
4074
|
dataInPage
|
|
4165
4075
|
});
|
|
4166
4076
|
if (optimalWidth == null) return;
|
|
@@ -4168,7 +4078,7 @@ function useDataTableRenderer({
|
|
|
4168
4078
|
colDef.headerRef.current.style.width = widthPx;
|
|
4169
4079
|
if (colDef.tableColRef.current) colDef.tableColRef.current.style.width = widthPx;
|
|
4170
4080
|
},
|
|
4171
|
-
[
|
|
4081
|
+
[visibleColumnsByField, allColumnsByField, dataInPage]
|
|
4172
4082
|
);
|
|
4173
4083
|
return {
|
|
4174
4084
|
rowCount,
|
|
@@ -4643,9 +4553,9 @@ function Component(props, apiRef) {
|
|
|
4643
4553
|
measureElement: (element) => element.clientHeight,
|
|
4644
4554
|
overscan: 10
|
|
4645
4555
|
});
|
|
4646
|
-
const paginationModel =
|
|
4556
|
+
const paginationModel = useMemo11(() => ({ page, pageSize }), [page, pageSize]);
|
|
4647
4557
|
const columnsKey = getObjectVersion(columns);
|
|
4648
|
-
const headerCheckboxElement =
|
|
4558
|
+
const headerCheckboxElement = useMemo11(
|
|
4649
4559
|
() => /* @__PURE__ */ React26.createElement(
|
|
4650
4560
|
RenderCheckbox,
|
|
4651
4561
|
{
|
|
@@ -4855,7 +4765,7 @@ function Component(props, apiRef) {
|
|
|
4855
4765
|
"col",
|
|
4856
4766
|
{
|
|
4857
4767
|
ref: c.tableColRef,
|
|
4858
|
-
key: c.
|
|
4768
|
+
key: `${c.field.toString()}_${c.width}`,
|
|
4859
4769
|
style: {
|
|
4860
4770
|
width: c.width,
|
|
4861
4771
|
minWidth: c.minWidth ?? "50px"
|
|
@@ -5041,7 +4951,7 @@ var DataTable = forwardRef7(Component);
|
|
|
5041
4951
|
DataTable.displayName = "DataTable";
|
|
5042
4952
|
|
|
5043
4953
|
// src/components/DateRangePicker/DateRangePicker.tsx
|
|
5044
|
-
import React27, { forwardRef as forwardRef8, useCallback as useCallback14, useEffect as useEffect8, useImperativeHandle as useImperativeHandle3, useMemo as
|
|
4954
|
+
import React27, { forwardRef as forwardRef8, useCallback as useCallback14, useEffect as useEffect8, useImperativeHandle as useImperativeHandle3, useMemo as useMemo12, useRef as useRef8, useState as useState10 } from "react";
|
|
5045
4955
|
import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
|
|
5046
4956
|
import CalendarTodayIcon2 from "@mui/icons-material/CalendarToday";
|
|
5047
4957
|
import { styled as styled14, useThemeProps as useThemeProps7 } from "@mui/joy";
|
|
@@ -5263,7 +5173,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5263
5173
|
);
|
|
5264
5174
|
const [anchorEl, setAnchorEl] = useState10(null);
|
|
5265
5175
|
const open = Boolean(anchorEl);
|
|
5266
|
-
const calendarValue =
|
|
5176
|
+
const calendarValue = useMemo12(
|
|
5267
5177
|
() => value ? parseDates(value, format) : void 0,
|
|
5268
5178
|
[value, format]
|
|
5269
5179
|
);
|
|
@@ -5557,10 +5467,10 @@ var ModalClose = JoyModalClose;
|
|
|
5557
5467
|
var MotionModalOverflow = motion23(JoyModalOverflow);
|
|
5558
5468
|
var ModalOverflow = MotionModalOverflow;
|
|
5559
5469
|
ModalOverflow.displayName = "ModalOverflow";
|
|
5560
|
-
|
|
5470
|
+
function ModalFrame(props) {
|
|
5561
5471
|
const { title, children, titleStartDecorator, onClose, ...innerProps } = props;
|
|
5562
|
-
return /* @__PURE__ */ React28.createElement(StyledModalDialog, {
|
|
5563
|
-
}
|
|
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
|
+
}
|
|
5564
5474
|
ModalFrame.displayName = "ModalFrame";
|
|
5565
5475
|
|
|
5566
5476
|
// src/components/DialogFrame/DialogFrame.tsx
|
|
@@ -5605,7 +5515,7 @@ var InsetDrawer = styled19(JoyDrawer)(({ theme }) => ({
|
|
|
5605
5515
|
}));
|
|
5606
5516
|
|
|
5607
5517
|
// src/components/FilterableCheckboxGroup/FilterableCheckboxGroup.tsx
|
|
5608
|
-
import React31, { useCallback as useCallback15, useEffect as useEffect9, useMemo as
|
|
5518
|
+
import React31, { useCallback as useCallback15, useEffect as useEffect9, useMemo as useMemo13, useRef as useRef9, useState as useState11 } from "react";
|
|
5609
5519
|
import SearchIcon from "@mui/icons-material/Search";
|
|
5610
5520
|
import { useThemeProps as useThemeProps8 } from "@mui/joy";
|
|
5611
5521
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
@@ -5666,11 +5576,11 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5666
5576
|
const parentRef = useRef9(null);
|
|
5667
5577
|
const isInitialSortRef = useRef9(false);
|
|
5668
5578
|
const prevOptionsRef = useRef9([...options]);
|
|
5669
|
-
const filteredOptions =
|
|
5579
|
+
const filteredOptions = useMemo13(() => {
|
|
5670
5580
|
if (!searchTerm) return sortedOptions;
|
|
5671
5581
|
return sortedOptions.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
5672
5582
|
}, [sortedOptions, searchTerm]);
|
|
5673
|
-
const itemSize =
|
|
5583
|
+
const itemSize = useMemo13(() => {
|
|
5674
5584
|
switch (size) {
|
|
5675
5585
|
case "sm":
|
|
5676
5586
|
return 28;
|
|
@@ -5744,7 +5654,7 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5744
5654
|
},
|
|
5745
5655
|
[filteredOptions, internalValue, setInternalValue]
|
|
5746
5656
|
);
|
|
5747
|
-
const enabledFilteredOptions =
|
|
5657
|
+
const enabledFilteredOptions = useMemo13(() => filteredOptions.filter((option) => !option.disabled), [filteredOptions]);
|
|
5748
5658
|
const isAllSelected = enabledFilteredOptions.length > 0 && enabledFilteredOptions.every((option) => internalValue.includes(option.value));
|
|
5749
5659
|
const isIndeterminate = !isAllSelected && enabledFilteredOptions.some((option) => internalValue.includes(option.value));
|
|
5750
5660
|
return /* @__PURE__ */ React31.createElement("div", { style: { width: "100%" } }, /* @__PURE__ */ React31.createElement(
|
|
@@ -5933,7 +5843,7 @@ function RadioGroup2(props) {
|
|
|
5933
5843
|
RadioGroup2.displayName = "RadioGroup";
|
|
5934
5844
|
|
|
5935
5845
|
// src/components/FilterMenu/components/DateRange.tsx
|
|
5936
|
-
import React35, { useCallback as useCallback19, useMemo as
|
|
5846
|
+
import React35, { useCallback as useCallback19, useMemo as useMemo14, useState as useState12, useEffect as useEffect10 } from "react";
|
|
5937
5847
|
import { Stack as Stack5 } from "@mui/joy";
|
|
5938
5848
|
function DateRange(props) {
|
|
5939
5849
|
const {
|
|
@@ -5952,7 +5862,7 @@ function DateRange(props) {
|
|
|
5952
5862
|
} = props;
|
|
5953
5863
|
const [internalValue, setInternalValue] = useControlledState(value, null, onChange);
|
|
5954
5864
|
const [selectedOption, setSelectedOption] = useState12("all-time");
|
|
5955
|
-
const dateRangeOptions =
|
|
5865
|
+
const dateRangeOptions = useMemo14(
|
|
5956
5866
|
() => [
|
|
5957
5867
|
{ label: "All Time", value: "all-time" },
|
|
5958
5868
|
{ label: "This Month", value: "this-month" },
|
|
@@ -6017,7 +5927,7 @@ function DateRange(props) {
|
|
|
6017
5927
|
},
|
|
6018
5928
|
[getDateRangeForOption]
|
|
6019
5929
|
);
|
|
6020
|
-
const customDateRangeValue =
|
|
5930
|
+
const customDateRangeValue = useMemo14(() => {
|
|
6021
5931
|
if (selectedOption === "custom" && internalValue) {
|
|
6022
5932
|
return `${internalValue[0]} - ${internalValue[1]}`;
|
|
6023
5933
|
}
|
|
@@ -6076,11 +5986,11 @@ function DateRange(props) {
|
|
|
6076
5986
|
DateRange.displayName = "DateRange";
|
|
6077
5987
|
|
|
6078
5988
|
// src/components/FilterMenu/components/MonthRange.tsx
|
|
6079
|
-
import React37, { useCallback as useCallback21, useMemo as
|
|
5989
|
+
import React37, { useCallback as useCallback21, useMemo as useMemo16 } from "react";
|
|
6080
5990
|
import { Stack as Stack6 } from "@mui/joy";
|
|
6081
5991
|
|
|
6082
5992
|
// src/components/MonthRangePicker/MonthRangePicker.tsx
|
|
6083
|
-
import React36, { forwardRef as forwardRef9, useCallback as useCallback20, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useMemo as
|
|
5993
|
+
import React36, { forwardRef as forwardRef9, useCallback as useCallback20, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useMemo as useMemo15, useRef as useRef10, useState as useState13 } from "react";
|
|
6084
5994
|
import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
|
|
6085
5995
|
import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
|
|
6086
5996
|
import { styled as styled20, useThemeProps as useThemeProps9 } from "@mui/joy";
|
|
@@ -6211,7 +6121,7 @@ var MonthRangePicker = forwardRef9((inProps, ref) => {
|
|
|
6211
6121
|
);
|
|
6212
6122
|
const [anchorEl, setAnchorEl] = useState13(null);
|
|
6213
6123
|
const open = Boolean(anchorEl);
|
|
6214
|
-
const calendarValue =
|
|
6124
|
+
const calendarValue = useMemo15(() => value ? parseDates2(value) : void 0, [value]);
|
|
6215
6125
|
useEffect11(() => {
|
|
6216
6126
|
if (value) {
|
|
6217
6127
|
try {
|
|
@@ -6386,7 +6296,7 @@ function MonthRange(props) {
|
|
|
6386
6296
|
locale
|
|
6387
6297
|
} = props;
|
|
6388
6298
|
const [internalValue, setInternalValue] = useControlledState(value, null, onChange);
|
|
6389
|
-
const pickerValue =
|
|
6299
|
+
const pickerValue = useMemo16(
|
|
6390
6300
|
() => internalValue ? `${internalValue[0]} - ${internalValue[1]}` : "",
|
|
6391
6301
|
[internalValue]
|
|
6392
6302
|
);
|
|
@@ -6529,7 +6439,7 @@ import React41 from "react";
|
|
|
6529
6439
|
import { Stack as Stack9, Typography as Typography5 } from "@mui/joy";
|
|
6530
6440
|
|
|
6531
6441
|
// src/components/PercentageInput/PercentageInput.tsx
|
|
6532
|
-
import React40, { useCallback as useCallback24, useMemo as
|
|
6442
|
+
import React40, { useCallback as useCallback24, useMemo as useMemo17 } from "react";
|
|
6533
6443
|
import { NumericFormat as NumericFormat2 } from "react-number-format";
|
|
6534
6444
|
import { styled as styled21, useThemeProps as useThemeProps10 } from "@mui/joy";
|
|
6535
6445
|
var padDecimal = (value, decimalScale) => {
|
|
@@ -6588,13 +6498,13 @@ var PercentageInput = React40.forwardRef(
|
|
|
6588
6498
|
props.defaultValue ?? null,
|
|
6589
6499
|
useCallback24((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
6590
6500
|
);
|
|
6591
|
-
const value =
|
|
6501
|
+
const value = useMemo17(() => {
|
|
6592
6502
|
if (_value && useMinorUnit) {
|
|
6593
6503
|
return _value / Math.pow(10, maxDecimalScale);
|
|
6594
6504
|
}
|
|
6595
6505
|
return _value;
|
|
6596
6506
|
}, [_value, useMinorUnit, maxDecimalScale]);
|
|
6597
|
-
const internalError =
|
|
6507
|
+
const internalError = useMemo17(
|
|
6598
6508
|
() => value != null && (max != null && value > max || min != null && value < min),
|
|
6599
6509
|
[max, min, value]
|
|
6600
6510
|
);
|
|
@@ -6854,7 +6764,7 @@ function FilterMenu(props) {
|
|
|
6854
6764
|
FilterMenu.displayName = "FilterMenu";
|
|
6855
6765
|
|
|
6856
6766
|
// src/components/Uploader/Uploader.tsx
|
|
6857
|
-
import React45, { useCallback as useCallback28, useEffect as useEffect13, useMemo as
|
|
6767
|
+
import React45, { useCallback as useCallback28, useEffect as useEffect13, useMemo as useMemo18, useRef as useRef11, useState as useState14 } from "react";
|
|
6858
6768
|
import { styled as styled22, Input as Input2 } from "@mui/joy";
|
|
6859
6769
|
import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
|
|
6860
6770
|
import MuiUploadFileIcon from "@mui/icons-material/UploadFileRounded";
|
|
@@ -6994,8 +6904,8 @@ var Uploader = React45.memo((props) => {
|
|
|
6994
6904
|
const [files, setFiles] = useState14([]);
|
|
6995
6905
|
const [uploaded, setUploaded] = useState14(props.uploaded || []);
|
|
6996
6906
|
const [previewState, setPreviewState] = useState14("idle");
|
|
6997
|
-
const accepts =
|
|
6998
|
-
const parsedAccepts =
|
|
6907
|
+
const accepts = useMemo18(() => accept.split(",").map((accept2) => accept2.trim()), [accept]);
|
|
6908
|
+
const parsedAccepts = useMemo18(
|
|
6999
6909
|
() => accepts.flatMap((type) => {
|
|
7000
6910
|
if (["image/*", "video/*", "audio/*"].includes(type)) {
|
|
7001
6911
|
return ALL_EXTENSIONS_BY_TYPE[type];
|
|
@@ -7004,7 +6914,7 @@ var Uploader = React45.memo((props) => {
|
|
|
7004
6914
|
}),
|
|
7005
6915
|
[accepts]
|
|
7006
6916
|
);
|
|
7007
|
-
const helperText =
|
|
6917
|
+
const helperText = useMemo18(() => {
|
|
7008
6918
|
if (helperTextProp) {
|
|
7009
6919
|
return helperTextProp;
|
|
7010
6920
|
}
|
|
@@ -7034,8 +6944,8 @@ var Uploader = React45.memo((props) => {
|
|
|
7034
6944
|
}
|
|
7035
6945
|
return helperTexts.join(", ");
|
|
7036
6946
|
}, [accepts, maxFileTotalSize, maxCount, helperTextProp]);
|
|
7037
|
-
const error =
|
|
7038
|
-
const showDropZone =
|
|
6947
|
+
const error = useMemo18(() => !!errorText || errorProp, [errorProp, errorText]);
|
|
6948
|
+
const showDropZone = useMemo18(
|
|
7039
6949
|
() => !maxCount || maxCount && [...uploaded, ...files].length !== maxCount,
|
|
7040
6950
|
[files, maxCount, uploaded]
|
|
7041
6951
|
);
|
|
@@ -7197,10 +7107,7 @@ import {
|
|
|
7197
7107
|
MenuButton as JoyMenuButton2,
|
|
7198
7108
|
IconButton as JoyIconButton2
|
|
7199
7109
|
} from "@mui/joy";
|
|
7200
|
-
|
|
7201
|
-
return /* @__PURE__ */ React46.createElement(JoyIconButton2, { ...rest, component: as ?? "button", ref });
|
|
7202
|
-
});
|
|
7203
|
-
function IconMenuButtonInner(props, ref) {
|
|
7110
|
+
function IconMenuButton(props) {
|
|
7204
7111
|
const {
|
|
7205
7112
|
size,
|
|
7206
7113
|
icon,
|
|
@@ -7211,8 +7118,6 @@ function IconMenuButtonInner(props, ref) {
|
|
|
7211
7118
|
variant = "plain",
|
|
7212
7119
|
placement = "bottom"
|
|
7213
7120
|
} = props;
|
|
7214
|
-
const { ref: buttonComponentRef, ...buttonComponentProps } = props.buttonComponentProps ?? {};
|
|
7215
|
-
const mergedButtonRef = useMergedRef(buttonComponentRef, ref);
|
|
7216
7121
|
if (!items.length) {
|
|
7217
7122
|
return /* @__PURE__ */ React46.createElement(
|
|
7218
7123
|
JoyIconButton2,
|
|
@@ -7223,8 +7128,7 @@ function IconMenuButtonInner(props, ref) {
|
|
|
7223
7128
|
color,
|
|
7224
7129
|
disabled,
|
|
7225
7130
|
loading,
|
|
7226
|
-
...buttonComponentProps
|
|
7227
|
-
ref: mergedButtonRef
|
|
7131
|
+
...props.buttonComponentProps ?? {}
|
|
7228
7132
|
},
|
|
7229
7133
|
icon
|
|
7230
7134
|
);
|
|
@@ -7232,7 +7136,7 @@ function IconMenuButtonInner(props, ref) {
|
|
|
7232
7136
|
return /* @__PURE__ */ React46.createElement(Dropdown_default, null, /* @__PURE__ */ React46.createElement(
|
|
7233
7137
|
JoyMenuButton2,
|
|
7234
7138
|
{
|
|
7235
|
-
slots: { root:
|
|
7139
|
+
slots: { root: JoyIconButton2 },
|
|
7236
7140
|
slotProps: {
|
|
7237
7141
|
root: {
|
|
7238
7142
|
component: props.buttonComponent ?? "button",
|
|
@@ -7241,16 +7145,13 @@ function IconMenuButtonInner(props, ref) {
|
|
|
7241
7145
|
color,
|
|
7242
7146
|
disabled,
|
|
7243
7147
|
loading,
|
|
7244
|
-
...buttonComponentProps
|
|
7245
|
-
// Joy의 useSlot이 내부 ref와 이 ref를 합쳐준다. 위 no-items 분기와 같은 경로로 ref를 넘긴다.
|
|
7246
|
-
ref: mergedButtonRef
|
|
7148
|
+
...props.buttonComponentProps ?? {}
|
|
7247
7149
|
}
|
|
7248
7150
|
}
|
|
7249
7151
|
},
|
|
7250
7152
|
icon
|
|
7251
7153
|
), /* @__PURE__ */ React46.createElement(Menu, { placement, size }, items.map((i) => /* @__PURE__ */ React46.createElement(MenuItem, { key: i.text, component: i.component, ...i.componentProps ?? {} }, i.text))));
|
|
7252
7154
|
}
|
|
7253
|
-
var IconMenuButton = React46.forwardRef(IconMenuButtonInner);
|
|
7254
7155
|
IconMenuButton.displayName = "IconMenuButton";
|
|
7255
7156
|
|
|
7256
7157
|
// src/components/Markdown/Markdown.tsx
|
|
@@ -7824,7 +7725,7 @@ function Navigator(props) {
|
|
|
7824
7725
|
Navigator.displayName = "Navigator";
|
|
7825
7726
|
|
|
7826
7727
|
// src/components/ProfileMenu/ProfileMenu.tsx
|
|
7827
|
-
import React53, { useCallback as useCallback30, useMemo as
|
|
7728
|
+
import React53, { useCallback as useCallback30, useMemo as useMemo19 } from "react";
|
|
7828
7729
|
import { Dropdown as Dropdown2, ListDivider, menuItemClasses, styled as styled26, MenuButton as MenuButton3, useThemeProps as useThemeProps12 } from "@mui/joy";
|
|
7829
7730
|
import { ClickAwayListener as ClickAwayListener5 } from "@mui/base";
|
|
7830
7731
|
import DropdownIcon from "@mui/icons-material/ArrowDropDown";
|
|
@@ -7834,8 +7735,8 @@ var StyledProfileCard = styled26(Stack, {
|
|
|
7834
7735
|
})({});
|
|
7835
7736
|
function ProfileCard(props) {
|
|
7836
7737
|
const { children, chip, caption, size } = props;
|
|
7837
|
-
const captionLevel =
|
|
7838
|
-
const nameLevel =
|
|
7738
|
+
const captionLevel = useMemo19(() => size === "sm" ? "body-xs" : "body-sm", [size]);
|
|
7739
|
+
const nameLevel = useMemo19(() => size === "sm" ? "body-sm" : "body-md", [size]);
|
|
7839
7740
|
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));
|
|
7840
7741
|
}
|
|
7841
7742
|
ProfileCard.displayName = "ProfileCard";
|