@ceed/ads 1.41.3-next.4 → 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 -806
- package/dist/index.js +171 -268
- 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 } }))))));
|
|
@@ -1839,7 +1802,7 @@ var Container = forwardRef5(function Container2(props, ref) {
|
|
|
1839
1802
|
Container.displayName = "Container";
|
|
1840
1803
|
|
|
1841
1804
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1842
|
-
import React17, { useCallback as useCallback8, useMemo as
|
|
1805
|
+
import React17, { useCallback as useCallback8, useMemo as useMemo6 } from "react";
|
|
1843
1806
|
import { NumericFormat } from "react-number-format";
|
|
1844
1807
|
|
|
1845
1808
|
// src/components/Input/Input.tsx
|
|
@@ -2173,19 +2136,19 @@ var CurrencyInput = React17.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
2173
2136
|
props.defaultValue ?? null,
|
|
2174
2137
|
useCallback8((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
2175
2138
|
);
|
|
2176
|
-
const value =
|
|
2139
|
+
const value = useMemo6(() => {
|
|
2177
2140
|
if (_value && useMinorUnit) {
|
|
2178
2141
|
return _value / Math.pow(10, decimalScale);
|
|
2179
2142
|
}
|
|
2180
2143
|
return _value;
|
|
2181
2144
|
}, [_value, useMinorUnit, decimalScale]);
|
|
2182
|
-
const max =
|
|
2145
|
+
const max = useMemo6(() => {
|
|
2183
2146
|
if (props.max && useMinorUnit) {
|
|
2184
2147
|
return props.max / Math.pow(10, decimalScale);
|
|
2185
2148
|
}
|
|
2186
2149
|
return props.max;
|
|
2187
2150
|
}, [props.max, useMinorUnit, decimalScale]);
|
|
2188
|
-
const isOverLimit =
|
|
2151
|
+
const isOverLimit = useMemo6(() => max != null && value != null && value > max, [max, value]);
|
|
2189
2152
|
const handleChange = useCallback8(
|
|
2190
2153
|
(event) => {
|
|
2191
2154
|
if (event.target.value === "") {
|
|
@@ -2236,7 +2199,7 @@ var CurrencyInput_default = CurrencyInput;
|
|
|
2236
2199
|
// src/components/DataTable/DataTable.tsx
|
|
2237
2200
|
import React26, {
|
|
2238
2201
|
useCallback as useCallback13,
|
|
2239
|
-
useMemo as
|
|
2202
|
+
useMemo as useMemo11,
|
|
2240
2203
|
useRef as useRef7,
|
|
2241
2204
|
useId,
|
|
2242
2205
|
forwardRef as forwardRef7,
|
|
@@ -2470,9 +2433,6 @@ function computeAutoFitWidth(params) {
|
|
|
2470
2433
|
if (!isNaN(maxPx) && maxPx > 0) finalWidth = Math.min(finalWidth, maxPx);
|
|
2471
2434
|
return finalWidth;
|
|
2472
2435
|
}
|
|
2473
|
-
function getHeaderCellId(tableId, columnId) {
|
|
2474
|
-
return `${tableId}_header_${columnId}`.trim();
|
|
2475
|
-
}
|
|
2476
2436
|
|
|
2477
2437
|
// src/components/DataTable/styled.tsx
|
|
2478
2438
|
import React18 from "react";
|
|
@@ -2664,7 +2624,7 @@ import React23, {
|
|
|
2664
2624
|
useRef as useRef5,
|
|
2665
2625
|
useState as useState8,
|
|
2666
2626
|
useLayoutEffect,
|
|
2667
|
-
useMemo as
|
|
2627
|
+
useMemo as useMemo9,
|
|
2668
2628
|
useCallback as useCallback10,
|
|
2669
2629
|
useEffect as useEffect5,
|
|
2670
2630
|
memo,
|
|
@@ -3148,7 +3108,7 @@ import React20 from "react";
|
|
|
3148
3108
|
import { Textarea as JoyTextarea } from "@mui/joy";
|
|
3149
3109
|
import { motion as motion19 } from "framer-motion";
|
|
3150
3110
|
var MotionTextarea = motion19(JoyTextarea);
|
|
3151
|
-
var
|
|
3111
|
+
var Textarea = (props) => {
|
|
3152
3112
|
const {
|
|
3153
3113
|
label,
|
|
3154
3114
|
error,
|
|
@@ -3192,17 +3152,13 @@ var TextareaBase = (props) => {
|
|
|
3192
3152
|
helperText && /* @__PURE__ */ React20.createElement(FormHelperText_default, null, helperText)
|
|
3193
3153
|
);
|
|
3194
3154
|
};
|
|
3195
|
-
var Textarea = React20.forwardRef((props, ref) => {
|
|
3196
|
-
const textareaSlotProps = useSlotRef(props.slotProps?.textarea, ref);
|
|
3197
|
-
return /* @__PURE__ */ React20.createElement(TextareaBase, { ...props, slotProps: { ...props.slotProps, textarea: textareaSlotProps } });
|
|
3198
|
-
});
|
|
3199
3155
|
Textarea.displayName = "Textarea";
|
|
3200
3156
|
|
|
3201
3157
|
// src/components/Textarea/index.ts
|
|
3202
3158
|
var Textarea_default = Textarea;
|
|
3203
3159
|
|
|
3204
3160
|
// src/components/Select/Select.tsx
|
|
3205
|
-
import React21, { useMemo as
|
|
3161
|
+
import React21, { useMemo as useMemo8 } from "react";
|
|
3206
3162
|
import {
|
|
3207
3163
|
Select as JoySelect,
|
|
3208
3164
|
Option as JoyOption,
|
|
@@ -3218,7 +3174,7 @@ var secondaryTextLevelMap2 = {
|
|
|
3218
3174
|
lg: "body-md"
|
|
3219
3175
|
};
|
|
3220
3176
|
Option.displayName = "Option";
|
|
3221
|
-
function
|
|
3177
|
+
function Select(props) {
|
|
3222
3178
|
const {
|
|
3223
3179
|
label,
|
|
3224
3180
|
helperText,
|
|
@@ -3244,7 +3200,7 @@ function SelectInner(props, ref) {
|
|
|
3244
3200
|
formHelperText: formHelperTextProps,
|
|
3245
3201
|
...joySlotProps
|
|
3246
3202
|
} = slotProps ?? {};
|
|
3247
|
-
const options =
|
|
3203
|
+
const options = useMemo8(
|
|
3248
3204
|
() => props.options.map((option) => {
|
|
3249
3205
|
if (option.hasOwnProperty("value") && option.hasOwnProperty("label")) {
|
|
3250
3206
|
return option;
|
|
@@ -3269,14 +3225,13 @@ function SelectInner(props, ref) {
|
|
|
3269
3225
|
};
|
|
3270
3226
|
onChange?.(newEvent, newValue);
|
|
3271
3227
|
};
|
|
3272
|
-
const optionMap =
|
|
3228
|
+
const optionMap = useMemo8(() => {
|
|
3273
3229
|
const map = /* @__PURE__ */ new Map();
|
|
3274
3230
|
options.forEach((option) => {
|
|
3275
3231
|
map.set(option.value, option);
|
|
3276
3232
|
});
|
|
3277
3233
|
return map;
|
|
3278
3234
|
}, [options]);
|
|
3279
|
-
const buttonSlotProps = useSlotRef(joySlotProps.button, ref);
|
|
3280
3235
|
const select = /* @__PURE__ */ React21.createElement(
|
|
3281
3236
|
JoySelect,
|
|
3282
3237
|
{
|
|
@@ -3285,7 +3240,7 @@ function SelectInner(props, ref) {
|
|
|
3285
3240
|
disabled,
|
|
3286
3241
|
size,
|
|
3287
3242
|
color: error ? "danger" : color,
|
|
3288
|
-
slotProps:
|
|
3243
|
+
slotProps: joySlotProps,
|
|
3289
3244
|
onChange: handleChange,
|
|
3290
3245
|
renderValue: (selected) => {
|
|
3291
3246
|
if (!selected) return null;
|
|
@@ -3315,7 +3270,6 @@ function SelectInner(props, ref) {
|
|
|
3315
3270
|
helperText && /* @__PURE__ */ React21.createElement(FormHelperText_default, { ...formHelperTextProps }, helperText)
|
|
3316
3271
|
);
|
|
3317
3272
|
}
|
|
3318
|
-
var Select = React21.forwardRef(SelectInner);
|
|
3319
3273
|
Select.displayName = "Select";
|
|
3320
3274
|
|
|
3321
3275
|
// src/components/Select/index.ts
|
|
@@ -3430,8 +3384,7 @@ var HeadCell = (props) => {
|
|
|
3430
3384
|
tableColRef,
|
|
3431
3385
|
headerClassName,
|
|
3432
3386
|
headerLineClamp,
|
|
3433
|
-
onAutoFit
|
|
3434
|
-
columnId
|
|
3387
|
+
onAutoFit
|
|
3435
3388
|
} = props;
|
|
3436
3389
|
const theme = useTheme();
|
|
3437
3390
|
const ref = headerRef;
|
|
@@ -3442,20 +3395,23 @@ var HeadCell = (props) => {
|
|
|
3442
3395
|
}, [ref]);
|
|
3443
3396
|
const [isHovered, setIsHovered] = useState8(false);
|
|
3444
3397
|
const sortable = type === "actions" ? false : _sortable;
|
|
3445
|
-
const headId =
|
|
3398
|
+
const headId = useMemo9(
|
|
3399
|
+
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
3400
|
+
[tableId, headerName, field]
|
|
3401
|
+
);
|
|
3446
3402
|
const isResizingRef = useRef5(false);
|
|
3447
|
-
const resizer =
|
|
3403
|
+
const resizer = useMemo9(
|
|
3448
3404
|
() => resizable ?? true ? Resizer(
|
|
3449
3405
|
ref,
|
|
3450
3406
|
colRef,
|
|
3451
3407
|
(isResizing) => {
|
|
3452
3408
|
isResizingRef.current = isResizing;
|
|
3453
3409
|
},
|
|
3454
|
-
onAutoFit ? () => onAutoFit(
|
|
3410
|
+
onAutoFit ? () => onAutoFit(field) : void 0
|
|
3455
3411
|
) : null,
|
|
3456
|
-
[resizable, ref, colRef, onAutoFit,
|
|
3412
|
+
[resizable, ref, colRef, onAutoFit, field]
|
|
3457
3413
|
);
|
|
3458
|
-
const style =
|
|
3414
|
+
const style = useMemo9(
|
|
3459
3415
|
() => ({
|
|
3460
3416
|
width,
|
|
3461
3417
|
minWidth: minWidth ?? "50px",
|
|
@@ -3473,7 +3429,7 @@ var HeadCell = (props) => {
|
|
|
3473
3429
|
);
|
|
3474
3430
|
const textAlign = getTextAlign(props);
|
|
3475
3431
|
const initialSort = sortOrder[0];
|
|
3476
|
-
const sortIcon =
|
|
3432
|
+
const sortIcon = useMemo9(() => {
|
|
3477
3433
|
const isSorted = !!sort;
|
|
3478
3434
|
const isVisible = sortable && (isSorted || isHovered);
|
|
3479
3435
|
return /* @__PURE__ */ React23.createElement(AnimatePresence2, { mode: "wait" }, isVisible && /* @__PURE__ */ React23.createElement(
|
|
@@ -3504,17 +3460,17 @@ var HeadCell = (props) => {
|
|
|
3504
3460
|
}
|
|
3505
3461
|
));
|
|
3506
3462
|
}, [headId, initialSort, sort, sortable, isHovered]);
|
|
3507
|
-
const infoSign =
|
|
3463
|
+
const infoSign = useMemo9(
|
|
3508
3464
|
() => description ? /* @__PURE__ */ React23.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null,
|
|
3509
3465
|
[description]
|
|
3510
3466
|
);
|
|
3511
|
-
const params =
|
|
3467
|
+
const params = useMemo9(
|
|
3512
3468
|
() => ({
|
|
3513
3469
|
field
|
|
3514
3470
|
}),
|
|
3515
3471
|
[field]
|
|
3516
3472
|
);
|
|
3517
|
-
const computedHeaderClassName =
|
|
3473
|
+
const computedHeaderClassName = useMemo9(
|
|
3518
3474
|
() => (typeof headerClassName === "function" ? headerClassName(params) : headerClassName) || void 0,
|
|
3519
3475
|
[headerClassName, params]
|
|
3520
3476
|
);
|
|
@@ -3568,7 +3524,7 @@ var BodyCell = (props) => {
|
|
|
3568
3524
|
const theme = useTheme();
|
|
3569
3525
|
const [value, setValue] = useState8(row[field]);
|
|
3570
3526
|
const cellRef = useRef5(null);
|
|
3571
|
-
const params =
|
|
3527
|
+
const params = useMemo9(
|
|
3572
3528
|
() => ({
|
|
3573
3529
|
row,
|
|
3574
3530
|
value,
|
|
@@ -3577,20 +3533,20 @@ var BodyCell = (props) => {
|
|
|
3577
3533
|
}),
|
|
3578
3534
|
[row, rowId, value, field]
|
|
3579
3535
|
);
|
|
3580
|
-
const editMode =
|
|
3536
|
+
const editMode = useMemo9(
|
|
3581
3537
|
() => !!(props.editMode && (typeof isCellEditable === "function" ? isCellEditable(params) : isCellEditable ?? true)),
|
|
3582
3538
|
[props.editMode, isCellEditable, params]
|
|
3583
3539
|
);
|
|
3584
3540
|
const propsComponentProps = "componentProps" in props ? props.componentProps : null;
|
|
3585
3541
|
const hasComponentProps = "componentProps" in props;
|
|
3586
|
-
const componentProps =
|
|
3542
|
+
const componentProps = useMemo9(
|
|
3587
3543
|
() => ({
|
|
3588
3544
|
...hasComponentProps && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
|
|
3589
3545
|
size: "sm"
|
|
3590
3546
|
}),
|
|
3591
3547
|
[hasComponentProps, propsComponentProps, params]
|
|
3592
3548
|
);
|
|
3593
|
-
const editModeComponentProps =
|
|
3549
|
+
const editModeComponentProps = useMemo9(
|
|
3594
3550
|
() => ({
|
|
3595
3551
|
...componentProps,
|
|
3596
3552
|
onChange: (e) => {
|
|
@@ -3652,9 +3608,9 @@ var BodyCell = (props) => {
|
|
|
3652
3608
|
}),
|
|
3653
3609
|
[params, row, field, value, componentProps, type, onCellEditStop, onCellEditStart]
|
|
3654
3610
|
);
|
|
3655
|
-
const MemoizedRenderEditCell =
|
|
3656
|
-
const MemoizedRenderCell =
|
|
3657
|
-
const EditModeComponent =
|
|
3611
|
+
const MemoizedRenderEditCell = useMemo9(() => renderEditCell ? memo(renderEditCell) : null, [renderEditCell]);
|
|
3612
|
+
const MemoizedRenderCell = useMemo9(() => renderCell ? memo(renderCell) : null, [renderCell]);
|
|
3613
|
+
const EditModeComponent = useMemo9(() => {
|
|
3658
3614
|
if (MemoizedRenderEditCell) {
|
|
3659
3615
|
return createElement(MemoizedRenderEditCell, params);
|
|
3660
3616
|
}
|
|
@@ -3689,7 +3645,7 @@ var BodyCell = (props) => {
|
|
|
3689
3645
|
}[type || "text"];
|
|
3690
3646
|
}, [value, editModeComponentProps, type, MemoizedRenderEditCell, params]);
|
|
3691
3647
|
const linkComponentFromProps = props.component;
|
|
3692
|
-
const ReadModeComponent =
|
|
3648
|
+
const ReadModeComponent = useMemo9(() => {
|
|
3693
3649
|
if (MemoizedRenderCell) {
|
|
3694
3650
|
return createElement(MemoizedRenderCell, params);
|
|
3695
3651
|
}
|
|
@@ -3703,15 +3659,15 @@ var BodyCell = (props) => {
|
|
|
3703
3659
|
return typedComponent || innerText;
|
|
3704
3660
|
}, [value, MemoizedRenderCell, params, type, componentProps, linkComponentFromProps]);
|
|
3705
3661
|
const getActions = props.getActions;
|
|
3706
|
-
const CellComponent =
|
|
3662
|
+
const CellComponent = useMemo9(() => {
|
|
3707
3663
|
if (type === "actions") {
|
|
3708
3664
|
return /* @__PURE__ */ React23.createElement(Stack_default, { direction: "row", gap: 1, justifyContent: "center", alignItems: "center" }, getActions?.(params));
|
|
3709
3665
|
}
|
|
3710
3666
|
return editMode && EditModeComponent ? EditModeComponent : ReadModeComponent;
|
|
3711
3667
|
}, [type, getActions, params, editMode, EditModeComponent, ReadModeComponent]);
|
|
3712
|
-
const showTooltip =
|
|
3668
|
+
const showTooltip = useMemo9(() => noWrap && type === "longText", [noWrap, type]);
|
|
3713
3669
|
const isBoundary = props.isLastStartPinnedColumn || props.isLastEndPinnedColumn;
|
|
3714
|
-
const computedCellClassName =
|
|
3670
|
+
const computedCellClassName = useMemo9(
|
|
3715
3671
|
() => (typeof cellClassName === "function" ? cellClassName(params) : cellClassName) || "",
|
|
3716
3672
|
[cellClassName, params]
|
|
3717
3673
|
);
|
|
@@ -3723,7 +3679,7 @@ var BodyCell = (props) => {
|
|
|
3723
3679
|
{
|
|
3724
3680
|
ref: cellRef,
|
|
3725
3681
|
key: field,
|
|
3726
|
-
headers:
|
|
3682
|
+
headers: `${tableId}_header_${props.headerName ?? field}`,
|
|
3727
3683
|
sx: {
|
|
3728
3684
|
textAlign: getTextAlign({ type }),
|
|
3729
3685
|
verticalAlign: editMode ? "top" : "middle",
|
|
@@ -3735,7 +3691,7 @@ var BodyCell = (props) => {
|
|
|
3735
3691
|
},
|
|
3736
3692
|
className: [isLastStartPinnedColumn && "is-last-left", isLastEndPinnedColumn && "is-last-right", computedCellClassName].filter(Boolean).join(" ") || ""
|
|
3737
3693
|
},
|
|
3738
|
-
|
|
3694
|
+
useMemo9(
|
|
3739
3695
|
() => showTooltip ? /* @__PURE__ */ React23.createElement(CellTextEllipsis, null, CellComponent) : CellComponent,
|
|
3740
3696
|
[CellComponent, showTooltip]
|
|
3741
3697
|
)
|
|
@@ -3788,46 +3744,36 @@ var VirtualizedTableRow = memo(StyledTableRow2, (prevProps, nextProps) => {
|
|
|
3788
3744
|
});
|
|
3789
3745
|
|
|
3790
3746
|
// src/components/DataTable/hooks.ts
|
|
3791
|
-
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useMemo as
|
|
3792
|
-
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) {
|
|
3793
3749
|
const [widths, setWidths] = useState9({});
|
|
3794
3750
|
const roRef = useRef6();
|
|
3795
3751
|
useLayoutEffect2(() => {
|
|
3796
3752
|
if (roRef.current) roRef.current.disconnect();
|
|
3797
3753
|
roRef.current = new ResizeObserver((entries) => {
|
|
3754
|
+
let changed = false;
|
|
3798
3755
|
setWidths((prev) => {
|
|
3799
|
-
let changed = false;
|
|
3800
3756
|
const next = { ...prev };
|
|
3801
3757
|
entries.forEach((entry) => {
|
|
3802
|
-
const
|
|
3758
|
+
const field = entry.target.dataset.field;
|
|
3803
3759
|
const w = Math.round(entry.target.getBoundingClientRect().width);
|
|
3804
|
-
if (
|
|
3805
|
-
|
|
3806
|
-
next[columnId] = w;
|
|
3760
|
+
if (next[field] !== w) {
|
|
3761
|
+
next[field] = w;
|
|
3807
3762
|
changed = true;
|
|
3808
3763
|
}
|
|
3809
3764
|
});
|
|
3810
3765
|
return changed ? next : prev;
|
|
3811
3766
|
});
|
|
3812
3767
|
});
|
|
3813
|
-
|
|
3814
|
-
Object.entries(columnsById).forEach(([columnId, def]) => {
|
|
3768
|
+
Object.entries(columnsByField).forEach(([field, def]) => {
|
|
3815
3769
|
const el = def.headerRef.current;
|
|
3816
3770
|
if (el) {
|
|
3817
|
-
el.dataset.
|
|
3818
|
-
el.dataset.field = String(def.field);
|
|
3819
|
-
const w = Math.round(el.getBoundingClientRect().width);
|
|
3820
|
-
if (w > 0) measured[columnId] = w;
|
|
3771
|
+
el.dataset.field = field;
|
|
3821
3772
|
roRef.current.observe(el);
|
|
3822
3773
|
}
|
|
3823
3774
|
});
|
|
3824
|
-
setWidths((prev) => {
|
|
3825
|
-
const keys = Object.keys(measured);
|
|
3826
|
-
const same = keys.length === Object.keys(prev).length && keys.every((key) => prev[key] === measured[key]);
|
|
3827
|
-
return same ? prev : measured;
|
|
3828
|
-
});
|
|
3829
3775
|
return () => roRef.current?.disconnect();
|
|
3830
|
-
}, [
|
|
3776
|
+
}, [columnsByField]);
|
|
3831
3777
|
return widths;
|
|
3832
3778
|
}
|
|
3833
3779
|
function useDataTableRenderer({
|
|
@@ -3876,23 +3822,16 @@ function useDataTableRenderer({
|
|
|
3876
3822
|
[onColumnVisibilityModelChange]
|
|
3877
3823
|
)
|
|
3878
3824
|
);
|
|
3879
|
-
const reorderedColumns =
|
|
3825
|
+
const reorderedColumns = useMemo10(() => {
|
|
3880
3826
|
if (!columnGroupingModel) return columnsProp;
|
|
3881
3827
|
return reorderColumnsByGroupingModel(columnsProp, columnGroupingModel);
|
|
3882
3828
|
}, [columnsProp, columnGroupingModel]);
|
|
3883
|
-
const
|
|
3884
|
-
() => reorderedColumns.
|
|
3885
|
-
if (visibilityModel[col.field] !== false) acc.push(index);
|
|
3886
|
-
return acc;
|
|
3887
|
-
}, []),
|
|
3829
|
+
const visibleColumns = useMemo10(
|
|
3830
|
+
() => reorderedColumns.filter((col) => visibilityModel[col.field] !== false),
|
|
3888
3831
|
[reorderedColumns, visibilityModel]
|
|
3889
3832
|
);
|
|
3890
|
-
const
|
|
3891
|
-
|
|
3892
|
-
[visibleColumnIndexes, reorderedColumns]
|
|
3893
|
-
);
|
|
3894
|
-
const visibleFieldSet = useMemo11(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3895
|
-
const tableMinWidth = useMemo11(() => {
|
|
3833
|
+
const visibleFieldSet = useMemo10(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3834
|
+
const tableMinWidth = useMemo10(() => {
|
|
3896
3835
|
const DEFAULT_MIN = 50;
|
|
3897
3836
|
let total = checkboxSelection ? 40 : 0;
|
|
3898
3837
|
for (const col of visibleColumns) {
|
|
@@ -3900,7 +3839,7 @@ function useDataTableRenderer({
|
|
|
3900
3839
|
}
|
|
3901
3840
|
return total;
|
|
3902
3841
|
}, [visibleColumns, checkboxSelection]);
|
|
3903
|
-
const allColumnsByField =
|
|
3842
|
+
const allColumnsByField = useMemo10(
|
|
3904
3843
|
() => reorderedColumns.reduce(
|
|
3905
3844
|
(acc, curr) => ({
|
|
3906
3845
|
...acc,
|
|
@@ -3910,37 +3849,19 @@ function useDataTableRenderer({
|
|
|
3910
3849
|
),
|
|
3911
3850
|
[reorderedColumns]
|
|
3912
3851
|
);
|
|
3913
|
-
const
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
assigned.add(field);
|
|
3920
|
-
return field;
|
|
3921
|
-
}
|
|
3922
|
-
let n = 2;
|
|
3923
|
-
while (taken.has(`${field}__${n}`)) n += 1;
|
|
3924
|
-
taken.add(`${field}__${n}`);
|
|
3925
|
-
return `${field}__${n}`;
|
|
3926
|
-
});
|
|
3927
|
-
}, [reorderedColumns]);
|
|
3928
|
-
const columnIds = useMemo11(
|
|
3929
|
-
() => visibleColumnIndexes.map((index) => allColumnIds[index]),
|
|
3930
|
-
[visibleColumnIndexes, allColumnIds]
|
|
3931
|
-
);
|
|
3932
|
-
const visibleColumnsById = useMemo11(
|
|
3933
|
-
() => Object.fromEntries(
|
|
3934
|
-
visibleColumns.map((column, index) => [
|
|
3935
|
-
columnIds[index],
|
|
3936
|
-
{
|
|
3937
|
-
...column,
|
|
3852
|
+
const visibleColumnsByField = useMemo10(
|
|
3853
|
+
() => visibleColumns.reduce(
|
|
3854
|
+
(acc, curr) => ({
|
|
3855
|
+
...acc,
|
|
3856
|
+
[curr.field]: {
|
|
3857
|
+
...curr,
|
|
3938
3858
|
headerRef: createRef(),
|
|
3939
3859
|
tableColRef: createRef()
|
|
3940
3860
|
}
|
|
3941
|
-
|
|
3861
|
+
}),
|
|
3862
|
+
{}
|
|
3942
3863
|
),
|
|
3943
|
-
[visibleColumns
|
|
3864
|
+
[visibleColumns]
|
|
3944
3865
|
);
|
|
3945
3866
|
const sortComparator = useCallback11(
|
|
3946
3867
|
(rowA, rowB) => {
|
|
@@ -3971,11 +3892,11 @@ function useDataTableRenderer({
|
|
|
3971
3892
|
},
|
|
3972
3893
|
[sortModel, allColumnsByField]
|
|
3973
3894
|
);
|
|
3974
|
-
const rows =
|
|
3895
|
+
const rows = useMemo10(
|
|
3975
3896
|
() => sortModel.length ? [..._rows].sort(sortComparator) : _rows,
|
|
3976
3897
|
[_rows, sortModel, sortComparator]
|
|
3977
3898
|
);
|
|
3978
|
-
const sortOrder =
|
|
3899
|
+
const sortOrder = useMemo10(
|
|
3979
3900
|
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3980
3901
|
[_sortOrder]
|
|
3981
3902
|
);
|
|
@@ -3985,12 +3906,12 @@ function useDataTableRenderer({
|
|
|
3985
3906
|
(row, index) => _getId?.(row) ?? row.id ?? `${(index || 0) + (page - 1) * pageSize}`,
|
|
3986
3907
|
[_getId, page, pageSize]
|
|
3987
3908
|
);
|
|
3988
|
-
const selectedModelSet =
|
|
3989
|
-
const dataInPage =
|
|
3909
|
+
const selectedModelSet = useMemo10(() => new Set(selectionModel || []), [selectionModel]);
|
|
3910
|
+
const dataInPage = useMemo10(
|
|
3990
3911
|
() => !pagination || paginationMode === "server" ? rows : rows.slice((page - 1) * pageSize, (page - 1) * pageSize + pageSize),
|
|
3991
3912
|
[rows, page, pageSize, paginationMode, pagination]
|
|
3992
3913
|
);
|
|
3993
|
-
const selectableDataInPage =
|
|
3914
|
+
const selectableDataInPage = useMemo10(
|
|
3994
3915
|
() => dataInPage.filter((row, i) => {
|
|
3995
3916
|
if (!isRowSelectable) return true;
|
|
3996
3917
|
return isRowSelectable({ row, id: getId(row, i) });
|
|
@@ -4020,60 +3941,51 @@ function useDataTableRenderer({
|
|
|
4020
3941
|
},
|
|
4021
3942
|
[dataInPage, getId, isRowSelectable, selectionModel, onSelectionModelChange]
|
|
4022
3943
|
);
|
|
4023
|
-
const isAllSelected =
|
|
3944
|
+
const isAllSelected = useMemo10(
|
|
4024
3945
|
() => selectableDataInPage.length > 0 && selectableDataInPage.every((row, i) => selectedModelSet.has(getId(row, i))),
|
|
4025
3946
|
[selectableDataInPage, selectedModelSet, getId]
|
|
4026
3947
|
);
|
|
4027
3948
|
const rowCount = totalRowsProp || rows.length;
|
|
4028
|
-
const selectableRowCount =
|
|
3949
|
+
const selectableRowCount = useMemo10(() => {
|
|
4029
3950
|
if (!isRowSelectable) return rowCount;
|
|
4030
3951
|
return rows.filter((row, i) => isRowSelectable({ row, id: getId(row, i) })).length;
|
|
4031
3952
|
}, [rows, isRowSelectable, getId, rowCount]);
|
|
4032
|
-
const isTotalSelected =
|
|
3953
|
+
const isTotalSelected = useMemo10(
|
|
4033
3954
|
() => _isTotalSelected ?? (selectableRowCount > 0 && (selectionModel?.length || 0) === selectableRowCount),
|
|
4034
3955
|
[_isTotalSelected, selectionModel, selectableRowCount]
|
|
4035
3956
|
);
|
|
4036
|
-
const columnWidths = useColumnWidths(
|
|
4037
|
-
const measuredWidthByField = useMemo11(
|
|
4038
|
-
() => Object.fromEntries(
|
|
4039
|
-
Object.entries(visibleColumnsById).map(([columnId, column]) => [column.field, columnWidths[columnId]])
|
|
4040
|
-
),
|
|
4041
|
-
[visibleColumnsById, columnWidths]
|
|
4042
|
-
);
|
|
3957
|
+
const columnWidths = useColumnWidths(visibleColumnsByField);
|
|
4043
3958
|
const getWidth = useCallback11(
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
[measuredWidthByField, allColumnsByField]
|
|
3959
|
+
(f) => columnWidths[f] ?? allColumnsByField[f]?.width ?? // Column prop 으로 지정된 width
|
|
3960
|
+
allColumnsByField[f]?.minWidth ?? 0,
|
|
3961
|
+
[columnWidths, allColumnsByField]
|
|
4048
3962
|
);
|
|
4049
|
-
const processedColumnGroups =
|
|
3963
|
+
const processedColumnGroups = useMemo10(() => {
|
|
4050
3964
|
if (!columnGroupingModel) return null;
|
|
4051
3965
|
return calculateColumnGroups(columnGroupingModel, visibleColumns, visibleFieldSet);
|
|
4052
3966
|
}, [columnGroupingModel, visibleColumns, visibleFieldSet]);
|
|
4053
|
-
const effectivePinnedLeft =
|
|
3967
|
+
const effectivePinnedLeft = useMemo10(
|
|
4054
3968
|
() => pinnedColumns?.left?.filter((f) => visibleFieldSet.has(f)),
|
|
4055
3969
|
[pinnedColumns?.left, visibleFieldSet]
|
|
4056
3970
|
);
|
|
4057
|
-
const effectivePinnedRight =
|
|
3971
|
+
const effectivePinnedRight = useMemo10(
|
|
4058
3972
|
() => pinnedColumns?.right?.filter((f) => visibleFieldSet.has(f)),
|
|
4059
3973
|
[pinnedColumns?.right, visibleFieldSet]
|
|
4060
3974
|
);
|
|
4061
3975
|
const inferredFieldsKey = JSON.stringify(Object.keys(rows[0] || {}));
|
|
4062
|
-
const inferredFields =
|
|
4063
|
-
const columns =
|
|
3976
|
+
const inferredFields = useMemo10(() => JSON.parse(inferredFieldsKey), [inferredFieldsKey]);
|
|
3977
|
+
const columns = useMemo10(() => {
|
|
4064
3978
|
const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] : inferredFields.map((key) => ({
|
|
4065
3979
|
field: key
|
|
4066
3980
|
}));
|
|
4067
|
-
return baseColumns.map((column
|
|
4068
|
-
const columnId = columnIds[index] ?? String(column.field);
|
|
3981
|
+
return baseColumns.map((column) => {
|
|
4069
3982
|
const isLeftPinned = effectivePinnedLeft?.includes(column.field);
|
|
4070
3983
|
const isRightPinned = effectivePinnedRight?.includes(column.field);
|
|
4071
3984
|
const isPinned = isLeftPinned || isRightPinned;
|
|
4072
3985
|
return {
|
|
4073
3986
|
...column,
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
tableColRef: visibleColumnsById[columnId]?.tableColRef,
|
|
3987
|
+
headerRef: visibleColumnsByField[column.field]?.headerRef,
|
|
3988
|
+
tableColRef: visibleColumnsByField[column.field]?.tableColRef,
|
|
4077
3989
|
isCellEditable: editMode && (typeof column.isCellEditable === "function" ? column.isCellEditable : column.isCellEditable ?? true),
|
|
4078
3990
|
sort: sortModel.find((sort) => sort.field === column.field)?.sort,
|
|
4079
3991
|
sortOrder: allColumnsByField[column.field]?.sortOrder || sortOrder,
|
|
@@ -4090,8 +4002,7 @@ function useDataTableRenderer({
|
|
|
4090
4002
|
inferredFields,
|
|
4091
4003
|
effectivePinnedLeft,
|
|
4092
4004
|
effectivePinnedRight,
|
|
4093
|
-
|
|
4094
|
-
visibleColumnsById,
|
|
4005
|
+
visibleColumnsByField,
|
|
4095
4006
|
allColumnsByField,
|
|
4096
4007
|
editMode,
|
|
4097
4008
|
sortModel,
|
|
@@ -4151,14 +4062,15 @@ function useDataTableRenderer({
|
|
|
4151
4062
|
}
|
|
4152
4063
|
}, [_rows]);
|
|
4153
4064
|
const handleAutoFit = useCallback11(
|
|
4154
|
-
(
|
|
4155
|
-
const colDef =
|
|
4065
|
+
(field) => {
|
|
4066
|
+
const colDef = visibleColumnsByField[field];
|
|
4156
4067
|
if (!colDef?.headerRef.current) return;
|
|
4157
|
-
const
|
|
4068
|
+
const column = allColumnsByField[field];
|
|
4069
|
+
const columnType = column && "type" in column ? column.type : void 0;
|
|
4158
4070
|
if (columnType === "actions") return;
|
|
4159
4071
|
const optimalWidth = computeAutoFitWidth({
|
|
4160
4072
|
headerEl: colDef.headerRef.current,
|
|
4161
|
-
field
|
|
4073
|
+
field,
|
|
4162
4074
|
dataInPage
|
|
4163
4075
|
});
|
|
4164
4076
|
if (optimalWidth == null) return;
|
|
@@ -4166,7 +4078,7 @@ function useDataTableRenderer({
|
|
|
4166
4078
|
colDef.headerRef.current.style.width = widthPx;
|
|
4167
4079
|
if (colDef.tableColRef.current) colDef.tableColRef.current.style.width = widthPx;
|
|
4168
4080
|
},
|
|
4169
|
-
[
|
|
4081
|
+
[visibleColumnsByField, allColumnsByField, dataInPage]
|
|
4170
4082
|
);
|
|
4171
4083
|
return {
|
|
4172
4084
|
rowCount,
|
|
@@ -4641,9 +4553,9 @@ function Component(props, apiRef) {
|
|
|
4641
4553
|
measureElement: (element) => element.clientHeight,
|
|
4642
4554
|
overscan: 10
|
|
4643
4555
|
});
|
|
4644
|
-
const paginationModel =
|
|
4556
|
+
const paginationModel = useMemo11(() => ({ page, pageSize }), [page, pageSize]);
|
|
4645
4557
|
const columnsKey = getObjectVersion(columns);
|
|
4646
|
-
const headerCheckboxElement =
|
|
4558
|
+
const headerCheckboxElement = useMemo11(
|
|
4647
4559
|
() => /* @__PURE__ */ React26.createElement(
|
|
4648
4560
|
RenderCheckbox,
|
|
4649
4561
|
{
|
|
@@ -4853,7 +4765,7 @@ function Component(props, apiRef) {
|
|
|
4853
4765
|
"col",
|
|
4854
4766
|
{
|
|
4855
4767
|
ref: c.tableColRef,
|
|
4856
|
-
key: c.
|
|
4768
|
+
key: `${c.field.toString()}_${c.width}`,
|
|
4857
4769
|
style: {
|
|
4858
4770
|
width: c.width,
|
|
4859
4771
|
minWidth: c.minWidth ?? "50px"
|
|
@@ -5039,7 +4951,7 @@ var DataTable = forwardRef7(Component);
|
|
|
5039
4951
|
DataTable.displayName = "DataTable";
|
|
5040
4952
|
|
|
5041
4953
|
// src/components/DateRangePicker/DateRangePicker.tsx
|
|
5042
|
-
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";
|
|
5043
4955
|
import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
|
|
5044
4956
|
import CalendarTodayIcon2 from "@mui/icons-material/CalendarToday";
|
|
5045
4957
|
import { styled as styled14, useThemeProps as useThemeProps7 } from "@mui/joy";
|
|
@@ -5261,7 +5173,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5261
5173
|
);
|
|
5262
5174
|
const [anchorEl, setAnchorEl] = useState10(null);
|
|
5263
5175
|
const open = Boolean(anchorEl);
|
|
5264
|
-
const calendarValue =
|
|
5176
|
+
const calendarValue = useMemo12(
|
|
5265
5177
|
() => value ? parseDates(value, format) : void 0,
|
|
5266
5178
|
[value, format]
|
|
5267
5179
|
);
|
|
@@ -5555,10 +5467,10 @@ var ModalClose = JoyModalClose;
|
|
|
5555
5467
|
var MotionModalOverflow = motion23(JoyModalOverflow);
|
|
5556
5468
|
var ModalOverflow = MotionModalOverflow;
|
|
5557
5469
|
ModalOverflow.displayName = "ModalOverflow";
|
|
5558
|
-
|
|
5470
|
+
function ModalFrame(props) {
|
|
5559
5471
|
const { title, children, titleStartDecorator, onClose, ...innerProps } = props;
|
|
5560
|
-
return /* @__PURE__ */ React28.createElement(StyledModalDialog, {
|
|
5561
|
-
}
|
|
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
|
+
}
|
|
5562
5474
|
ModalFrame.displayName = "ModalFrame";
|
|
5563
5475
|
|
|
5564
5476
|
// src/components/DialogFrame/DialogFrame.tsx
|
|
@@ -5603,7 +5515,7 @@ var InsetDrawer = styled19(JoyDrawer)(({ theme }) => ({
|
|
|
5603
5515
|
}));
|
|
5604
5516
|
|
|
5605
5517
|
// src/components/FilterableCheckboxGroup/FilterableCheckboxGroup.tsx
|
|
5606
|
-
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";
|
|
5607
5519
|
import SearchIcon from "@mui/icons-material/Search";
|
|
5608
5520
|
import { useThemeProps as useThemeProps8 } from "@mui/joy";
|
|
5609
5521
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
@@ -5664,11 +5576,11 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5664
5576
|
const parentRef = useRef9(null);
|
|
5665
5577
|
const isInitialSortRef = useRef9(false);
|
|
5666
5578
|
const prevOptionsRef = useRef9([...options]);
|
|
5667
|
-
const filteredOptions =
|
|
5579
|
+
const filteredOptions = useMemo13(() => {
|
|
5668
5580
|
if (!searchTerm) return sortedOptions;
|
|
5669
5581
|
return sortedOptions.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
5670
5582
|
}, [sortedOptions, searchTerm]);
|
|
5671
|
-
const itemSize =
|
|
5583
|
+
const itemSize = useMemo13(() => {
|
|
5672
5584
|
switch (size) {
|
|
5673
5585
|
case "sm":
|
|
5674
5586
|
return 28;
|
|
@@ -5742,7 +5654,7 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5742
5654
|
},
|
|
5743
5655
|
[filteredOptions, internalValue, setInternalValue]
|
|
5744
5656
|
);
|
|
5745
|
-
const enabledFilteredOptions =
|
|
5657
|
+
const enabledFilteredOptions = useMemo13(() => filteredOptions.filter((option) => !option.disabled), [filteredOptions]);
|
|
5746
5658
|
const isAllSelected = enabledFilteredOptions.length > 0 && enabledFilteredOptions.every((option) => internalValue.includes(option.value));
|
|
5747
5659
|
const isIndeterminate = !isAllSelected && enabledFilteredOptions.some((option) => internalValue.includes(option.value));
|
|
5748
5660
|
return /* @__PURE__ */ React31.createElement("div", { style: { width: "100%" } }, /* @__PURE__ */ React31.createElement(
|
|
@@ -5931,7 +5843,7 @@ function RadioGroup2(props) {
|
|
|
5931
5843
|
RadioGroup2.displayName = "RadioGroup";
|
|
5932
5844
|
|
|
5933
5845
|
// src/components/FilterMenu/components/DateRange.tsx
|
|
5934
|
-
import React35, { useCallback as useCallback19, useMemo as
|
|
5846
|
+
import React35, { useCallback as useCallback19, useMemo as useMemo14, useState as useState12, useEffect as useEffect10 } from "react";
|
|
5935
5847
|
import { Stack as Stack5 } from "@mui/joy";
|
|
5936
5848
|
function DateRange(props) {
|
|
5937
5849
|
const {
|
|
@@ -5950,7 +5862,7 @@ function DateRange(props) {
|
|
|
5950
5862
|
} = props;
|
|
5951
5863
|
const [internalValue, setInternalValue] = useControlledState(value, null, onChange);
|
|
5952
5864
|
const [selectedOption, setSelectedOption] = useState12("all-time");
|
|
5953
|
-
const dateRangeOptions =
|
|
5865
|
+
const dateRangeOptions = useMemo14(
|
|
5954
5866
|
() => [
|
|
5955
5867
|
{ label: "All Time", value: "all-time" },
|
|
5956
5868
|
{ label: "This Month", value: "this-month" },
|
|
@@ -6015,7 +5927,7 @@ function DateRange(props) {
|
|
|
6015
5927
|
},
|
|
6016
5928
|
[getDateRangeForOption]
|
|
6017
5929
|
);
|
|
6018
|
-
const customDateRangeValue =
|
|
5930
|
+
const customDateRangeValue = useMemo14(() => {
|
|
6019
5931
|
if (selectedOption === "custom" && internalValue) {
|
|
6020
5932
|
return `${internalValue[0]} - ${internalValue[1]}`;
|
|
6021
5933
|
}
|
|
@@ -6074,11 +5986,11 @@ function DateRange(props) {
|
|
|
6074
5986
|
DateRange.displayName = "DateRange";
|
|
6075
5987
|
|
|
6076
5988
|
// src/components/FilterMenu/components/MonthRange.tsx
|
|
6077
|
-
import React37, { useCallback as useCallback21, useMemo as
|
|
5989
|
+
import React37, { useCallback as useCallback21, useMemo as useMemo16 } from "react";
|
|
6078
5990
|
import { Stack as Stack6 } from "@mui/joy";
|
|
6079
5991
|
|
|
6080
5992
|
// src/components/MonthRangePicker/MonthRangePicker.tsx
|
|
6081
|
-
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";
|
|
6082
5994
|
import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
|
|
6083
5995
|
import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
|
|
6084
5996
|
import { styled as styled20, useThemeProps as useThemeProps9 } from "@mui/joy";
|
|
@@ -6209,7 +6121,7 @@ var MonthRangePicker = forwardRef9((inProps, ref) => {
|
|
|
6209
6121
|
);
|
|
6210
6122
|
const [anchorEl, setAnchorEl] = useState13(null);
|
|
6211
6123
|
const open = Boolean(anchorEl);
|
|
6212
|
-
const calendarValue =
|
|
6124
|
+
const calendarValue = useMemo15(() => value ? parseDates2(value) : void 0, [value]);
|
|
6213
6125
|
useEffect11(() => {
|
|
6214
6126
|
if (value) {
|
|
6215
6127
|
try {
|
|
@@ -6384,7 +6296,7 @@ function MonthRange(props) {
|
|
|
6384
6296
|
locale
|
|
6385
6297
|
} = props;
|
|
6386
6298
|
const [internalValue, setInternalValue] = useControlledState(value, null, onChange);
|
|
6387
|
-
const pickerValue =
|
|
6299
|
+
const pickerValue = useMemo16(
|
|
6388
6300
|
() => internalValue ? `${internalValue[0]} - ${internalValue[1]}` : "",
|
|
6389
6301
|
[internalValue]
|
|
6390
6302
|
);
|
|
@@ -6527,7 +6439,7 @@ import React41 from "react";
|
|
|
6527
6439
|
import { Stack as Stack9, Typography as Typography5 } from "@mui/joy";
|
|
6528
6440
|
|
|
6529
6441
|
// src/components/PercentageInput/PercentageInput.tsx
|
|
6530
|
-
import React40, { useCallback as useCallback24, useMemo as
|
|
6442
|
+
import React40, { useCallback as useCallback24, useMemo as useMemo17 } from "react";
|
|
6531
6443
|
import { NumericFormat as NumericFormat2 } from "react-number-format";
|
|
6532
6444
|
import { styled as styled21, useThemeProps as useThemeProps10 } from "@mui/joy";
|
|
6533
6445
|
var padDecimal = (value, decimalScale) => {
|
|
@@ -6586,13 +6498,13 @@ var PercentageInput = React40.forwardRef(
|
|
|
6586
6498
|
props.defaultValue ?? null,
|
|
6587
6499
|
useCallback24((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
6588
6500
|
);
|
|
6589
|
-
const value =
|
|
6501
|
+
const value = useMemo17(() => {
|
|
6590
6502
|
if (_value && useMinorUnit) {
|
|
6591
6503
|
return _value / Math.pow(10, maxDecimalScale);
|
|
6592
6504
|
}
|
|
6593
6505
|
return _value;
|
|
6594
6506
|
}, [_value, useMinorUnit, maxDecimalScale]);
|
|
6595
|
-
const internalError =
|
|
6507
|
+
const internalError = useMemo17(
|
|
6596
6508
|
() => value != null && (max != null && value > max || min != null && value < min),
|
|
6597
6509
|
[max, min, value]
|
|
6598
6510
|
);
|
|
@@ -6852,7 +6764,7 @@ function FilterMenu(props) {
|
|
|
6852
6764
|
FilterMenu.displayName = "FilterMenu";
|
|
6853
6765
|
|
|
6854
6766
|
// src/components/Uploader/Uploader.tsx
|
|
6855
|
-
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";
|
|
6856
6768
|
import { styled as styled22, Input as Input2 } from "@mui/joy";
|
|
6857
6769
|
import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
|
|
6858
6770
|
import MuiUploadFileIcon from "@mui/icons-material/UploadFileRounded";
|
|
@@ -6992,8 +6904,8 @@ var Uploader = React45.memo((props) => {
|
|
|
6992
6904
|
const [files, setFiles] = useState14([]);
|
|
6993
6905
|
const [uploaded, setUploaded] = useState14(props.uploaded || []);
|
|
6994
6906
|
const [previewState, setPreviewState] = useState14("idle");
|
|
6995
|
-
const accepts =
|
|
6996
|
-
const parsedAccepts =
|
|
6907
|
+
const accepts = useMemo18(() => accept.split(",").map((accept2) => accept2.trim()), [accept]);
|
|
6908
|
+
const parsedAccepts = useMemo18(
|
|
6997
6909
|
() => accepts.flatMap((type) => {
|
|
6998
6910
|
if (["image/*", "video/*", "audio/*"].includes(type)) {
|
|
6999
6911
|
return ALL_EXTENSIONS_BY_TYPE[type];
|
|
@@ -7002,7 +6914,7 @@ var Uploader = React45.memo((props) => {
|
|
|
7002
6914
|
}),
|
|
7003
6915
|
[accepts]
|
|
7004
6916
|
);
|
|
7005
|
-
const helperText =
|
|
6917
|
+
const helperText = useMemo18(() => {
|
|
7006
6918
|
if (helperTextProp) {
|
|
7007
6919
|
return helperTextProp;
|
|
7008
6920
|
}
|
|
@@ -7032,8 +6944,8 @@ var Uploader = React45.memo((props) => {
|
|
|
7032
6944
|
}
|
|
7033
6945
|
return helperTexts.join(", ");
|
|
7034
6946
|
}, [accepts, maxFileTotalSize, maxCount, helperTextProp]);
|
|
7035
|
-
const error =
|
|
7036
|
-
const showDropZone =
|
|
6947
|
+
const error = useMemo18(() => !!errorText || errorProp, [errorProp, errorText]);
|
|
6948
|
+
const showDropZone = useMemo18(
|
|
7037
6949
|
() => !maxCount || maxCount && [...uploaded, ...files].length !== maxCount,
|
|
7038
6950
|
[files, maxCount, uploaded]
|
|
7039
6951
|
);
|
|
@@ -7195,10 +7107,7 @@ import {
|
|
|
7195
7107
|
MenuButton as JoyMenuButton2,
|
|
7196
7108
|
IconButton as JoyIconButton2
|
|
7197
7109
|
} from "@mui/joy";
|
|
7198
|
-
|
|
7199
|
-
return /* @__PURE__ */ React46.createElement(JoyIconButton2, { ...rest, component: as ?? "button", ref });
|
|
7200
|
-
});
|
|
7201
|
-
function IconMenuButtonInner(props, ref) {
|
|
7110
|
+
function IconMenuButton(props) {
|
|
7202
7111
|
const {
|
|
7203
7112
|
size,
|
|
7204
7113
|
icon,
|
|
@@ -7209,8 +7118,6 @@ function IconMenuButtonInner(props, ref) {
|
|
|
7209
7118
|
variant = "plain",
|
|
7210
7119
|
placement = "bottom"
|
|
7211
7120
|
} = props;
|
|
7212
|
-
const { ref: buttonComponentRef, ...buttonComponentProps } = props.buttonComponentProps ?? {};
|
|
7213
|
-
const mergedButtonRef = useMergedRef(buttonComponentRef, ref);
|
|
7214
7121
|
if (!items.length) {
|
|
7215
7122
|
return /* @__PURE__ */ React46.createElement(
|
|
7216
7123
|
JoyIconButton2,
|
|
@@ -7221,8 +7128,7 @@ function IconMenuButtonInner(props, ref) {
|
|
|
7221
7128
|
color,
|
|
7222
7129
|
disabled,
|
|
7223
7130
|
loading,
|
|
7224
|
-
...buttonComponentProps
|
|
7225
|
-
ref: mergedButtonRef
|
|
7131
|
+
...props.buttonComponentProps ?? {}
|
|
7226
7132
|
},
|
|
7227
7133
|
icon
|
|
7228
7134
|
);
|
|
@@ -7230,7 +7136,7 @@ function IconMenuButtonInner(props, ref) {
|
|
|
7230
7136
|
return /* @__PURE__ */ React46.createElement(Dropdown_default, null, /* @__PURE__ */ React46.createElement(
|
|
7231
7137
|
JoyMenuButton2,
|
|
7232
7138
|
{
|
|
7233
|
-
slots: { root:
|
|
7139
|
+
slots: { root: JoyIconButton2 },
|
|
7234
7140
|
slotProps: {
|
|
7235
7141
|
root: {
|
|
7236
7142
|
component: props.buttonComponent ?? "button",
|
|
@@ -7239,16 +7145,13 @@ function IconMenuButtonInner(props, ref) {
|
|
|
7239
7145
|
color,
|
|
7240
7146
|
disabled,
|
|
7241
7147
|
loading,
|
|
7242
|
-
...buttonComponentProps
|
|
7243
|
-
// Joy의 useSlot이 내부 ref와 이 ref를 합쳐준다. 위 no-items 분기와 같은 경로로 ref를 넘긴다.
|
|
7244
|
-
ref: mergedButtonRef
|
|
7148
|
+
...props.buttonComponentProps ?? {}
|
|
7245
7149
|
}
|
|
7246
7150
|
}
|
|
7247
7151
|
},
|
|
7248
7152
|
icon
|
|
7249
7153
|
), /* @__PURE__ */ React46.createElement(Menu, { placement, size }, items.map((i) => /* @__PURE__ */ React46.createElement(MenuItem, { key: i.text, component: i.component, ...i.componentProps ?? {} }, i.text))));
|
|
7250
7154
|
}
|
|
7251
|
-
var IconMenuButton = React46.forwardRef(IconMenuButtonInner);
|
|
7252
7155
|
IconMenuButton.displayName = "IconMenuButton";
|
|
7253
7156
|
|
|
7254
7157
|
// src/components/Markdown/Markdown.tsx
|
|
@@ -7822,7 +7725,7 @@ function Navigator(props) {
|
|
|
7822
7725
|
Navigator.displayName = "Navigator";
|
|
7823
7726
|
|
|
7824
7727
|
// src/components/ProfileMenu/ProfileMenu.tsx
|
|
7825
|
-
import React53, { useCallback as useCallback30, useMemo as
|
|
7728
|
+
import React53, { useCallback as useCallback30, useMemo as useMemo19 } from "react";
|
|
7826
7729
|
import { Dropdown as Dropdown2, ListDivider, menuItemClasses, styled as styled26, MenuButton as MenuButton3, useThemeProps as useThemeProps12 } from "@mui/joy";
|
|
7827
7730
|
import { ClickAwayListener as ClickAwayListener5 } from "@mui/base";
|
|
7828
7731
|
import DropdownIcon from "@mui/icons-material/ArrowDropDown";
|
|
@@ -7832,8 +7735,8 @@ var StyledProfileCard = styled26(Stack, {
|
|
|
7832
7735
|
})({});
|
|
7833
7736
|
function ProfileCard(props) {
|
|
7834
7737
|
const { children, chip, caption, size } = props;
|
|
7835
|
-
const captionLevel =
|
|
7836
|
-
const nameLevel =
|
|
7738
|
+
const captionLevel = useMemo19(() => size === "sm" ? "body-xs" : "body-sm", [size]);
|
|
7739
|
+
const nameLevel = useMemo19(() => size === "sm" ? "body-sm" : "body-md", [size]);
|
|
7837
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));
|
|
7838
7741
|
}
|
|
7839
7742
|
ProfileCard.displayName = "ProfileCard";
|