@ceed/cds 1.17.0 → 1.18.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Autocomplete/Autocomplete.d.ts +1 -0
- package/dist/components/Select/Select.d.ts +1 -0
- package/dist/index.cjs +84 -30
- package/dist/index.js +71 -15
- package/framer/index.js +39 -39
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -341,9 +341,10 @@ Alert.displayName = "Alert";
|
|
|
341
341
|
// src/components/Autocomplete/Autocomplete.tsx
|
|
342
342
|
var import_react6 = __toESM(require("react"));
|
|
343
343
|
var import_joy10 = require("@mui/joy");
|
|
344
|
+
var import_base = require("@mui/base");
|
|
344
345
|
var import_Close = __toESM(require("@mui/icons-material/Close"));
|
|
345
346
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
346
|
-
var
|
|
347
|
+
var import_base2 = require("@mui/base");
|
|
347
348
|
|
|
348
349
|
// src/components/FormControl/FormControl.tsx
|
|
349
350
|
var import_joy5 = require("@mui/joy");
|
|
@@ -432,24 +433,39 @@ function useControlledState(controlledValue, defaultValue, onChange) {
|
|
|
432
433
|
}
|
|
433
434
|
|
|
434
435
|
// src/components/Autocomplete/Autocomplete.tsx
|
|
435
|
-
var AutocompletePopper = (0, import_joy10.styled)(
|
|
436
|
+
var AutocompletePopper = (0, import_joy10.styled)(import_base2.Popper, {
|
|
436
437
|
name: "Autocomplete",
|
|
437
438
|
slot: "Popper"
|
|
438
439
|
})(({ theme }) => ({
|
|
439
440
|
zIndex: theme.zIndex.tooltip
|
|
440
441
|
}));
|
|
442
|
+
var itemHeightMap = {
|
|
443
|
+
sm: { default: 32, secondary: 47 },
|
|
444
|
+
md: { default: 36, secondary: 55 },
|
|
445
|
+
lg: { default: 44, secondary: 65 }
|
|
446
|
+
};
|
|
447
|
+
var optionPaddingMap = {
|
|
448
|
+
sm: { px: "8px", py: "3px" },
|
|
449
|
+
md: { px: "12px", py: "4px" },
|
|
450
|
+
lg: { px: "16px", py: "6px" }
|
|
451
|
+
};
|
|
441
452
|
var AutocompleteListBox = import_react6.default.forwardRef((props, ref) => {
|
|
442
453
|
const {
|
|
443
454
|
anchorEl,
|
|
444
455
|
open,
|
|
445
456
|
modifiers,
|
|
446
457
|
children,
|
|
458
|
+
hasSecondaryText = false,
|
|
447
459
|
ownerState: { loading, size: fontSize = "md" },
|
|
448
460
|
...innerProps
|
|
449
461
|
} = props;
|
|
450
462
|
const parentRef = (0, import_react6.useRef)(null);
|
|
451
463
|
const isGrouped = children[0].every((child) => child.hasOwnProperty("group"));
|
|
452
|
-
const
|
|
464
|
+
const itemHeight = (0, import_react6.useMemo)(() => {
|
|
465
|
+
const heights = itemHeightMap[fontSize ?? "md"];
|
|
466
|
+
return hasSecondaryText ? heights.secondary : heights.default;
|
|
467
|
+
}, [fontSize, hasSecondaryText]);
|
|
468
|
+
const renderTargets = (0, import_react6.useMemo)(() => {
|
|
453
469
|
if (loading) {
|
|
454
470
|
return [children[1]];
|
|
455
471
|
}
|
|
@@ -463,10 +479,10 @@ var AutocompleteListBox = import_react6.default.forwardRef((props, ref) => {
|
|
|
463
479
|
]);
|
|
464
480
|
}
|
|
465
481
|
return children[0];
|
|
466
|
-
})
|
|
482
|
+
}, [loading, children, isGrouped]);
|
|
467
483
|
const virtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
468
484
|
count: renderTargets.length,
|
|
469
|
-
estimateSize: () =>
|
|
485
|
+
estimateSize: () => itemHeight,
|
|
470
486
|
getScrollElement: () => parentRef.current,
|
|
471
487
|
measureElement: (element) => element.clientHeight,
|
|
472
488
|
overscan: 5
|
|
@@ -514,19 +530,24 @@ var AutocompleteListBox = import_react6.default.forwardRef((props, ref) => {
|
|
|
514
530
|
)
|
|
515
531
|
))));
|
|
516
532
|
});
|
|
517
|
-
var
|
|
533
|
+
var autocompleteDeleteSize = {
|
|
518
534
|
sm: "20px",
|
|
519
535
|
md: "24px",
|
|
520
536
|
lg: "28px"
|
|
521
537
|
};
|
|
538
|
+
var secondaryTextLevelMap = {
|
|
539
|
+
sm: "body-xs",
|
|
540
|
+
md: "body-sm",
|
|
541
|
+
lg: "body-md"
|
|
542
|
+
};
|
|
522
543
|
var AutocompleteTagDelete = (0, import_joy10.styled)(IconButton_default, {
|
|
523
544
|
name: "Autocomplete",
|
|
524
545
|
slot: "tagDelete"
|
|
525
546
|
})(({ theme, size = "md" }) => ({
|
|
526
|
-
width:
|
|
527
|
-
height:
|
|
528
|
-
minWidth:
|
|
529
|
-
minHeight:
|
|
547
|
+
width: autocompleteDeleteSize[size],
|
|
548
|
+
height: autocompleteDeleteSize[size],
|
|
549
|
+
minWidth: autocompleteDeleteSize[size],
|
|
550
|
+
minHeight: autocompleteDeleteSize[size],
|
|
530
551
|
borderRadius: "50%"
|
|
531
552
|
}));
|
|
532
553
|
function Autocomplete(props) {
|
|
@@ -646,7 +667,18 @@ function Autocomplete(props) {
|
|
|
646
667
|
slots: {
|
|
647
668
|
listbox: AutocompleteListBox
|
|
648
669
|
},
|
|
649
|
-
|
|
670
|
+
slotProps: {
|
|
671
|
+
listbox: {
|
|
672
|
+
hasSecondaryText: options.some((opt) => opt.secondaryText)
|
|
673
|
+
}
|
|
674
|
+
},
|
|
675
|
+
filterOptions: (0, import_base.createFilterOptions)({
|
|
676
|
+
stringify: (option) => {
|
|
677
|
+
const opt = option;
|
|
678
|
+
return opt.secondaryText ? `${opt.label} ${opt.secondaryText}` : opt.label;
|
|
679
|
+
}
|
|
680
|
+
}),
|
|
681
|
+
renderOption: (props2, option) => /* @__PURE__ */ import_react6.default.createElement(import_joy10.AutocompleteOption, { ...props2, sx: optionPaddingMap[size ?? "md"] }, option.startDecorator && /* @__PURE__ */ import_react6.default.createElement(
|
|
650
682
|
import_joy10.ListItemDecorator,
|
|
651
683
|
{
|
|
652
684
|
sx: (theme) => ({
|
|
@@ -654,7 +686,10 @@ function Autocomplete(props) {
|
|
|
654
686
|
})
|
|
655
687
|
},
|
|
656
688
|
applySize(option.startDecorator)
|
|
657
|
-
), applySize(option.label),
|
|
689
|
+
), option.secondaryText ? /* @__PURE__ */ import_react6.default.createElement(import_joy10.ListItemContent, { sx: { gap: 0.5 } }, /* @__PURE__ */ import_react6.default.createElement(import_joy10.Typography, { level: "inherit" }, applySize(option.label)), /* @__PURE__ */ import_react6.default.createElement(import_joy10.Typography, { level: secondaryTextLevelMap[size ?? "md"], textColor: "text.tertiary" }, option.secondaryText)) : (
|
|
690
|
+
// TODO: haulla에서 사용할 때, label을 ReactNode로 넘기면 에러가 발생함....
|
|
691
|
+
applySize(option.label)
|
|
692
|
+
), option.endDecorator && /* @__PURE__ */ import_react6.default.createElement(
|
|
658
693
|
import_joy10.ListItemDecorator,
|
|
659
694
|
{
|
|
660
695
|
sx: (theme) => ({
|
|
@@ -2216,7 +2251,7 @@ var import_react19 = __toESM(require("react"));
|
|
|
2216
2251
|
var import_react_imask = require("react-imask");
|
|
2217
2252
|
var import_CalendarToday = __toESM(require("@mui/icons-material/CalendarToday"));
|
|
2218
2253
|
var import_joy27 = require("@mui/joy");
|
|
2219
|
-
var
|
|
2254
|
+
var import_base3 = require("@mui/base");
|
|
2220
2255
|
|
|
2221
2256
|
// src/components/Sheet/Sheet.tsx
|
|
2222
2257
|
var import_joy25 = require("@mui/joy");
|
|
@@ -2252,7 +2287,7 @@ var CalendarButton = (0, import_joy27.styled)(IconButton_default, {
|
|
|
2252
2287
|
outline: `${theme.getCssVar("focus-thickness")} solid ${theme.getCssVar("palette-focusVisible")}`
|
|
2253
2288
|
}
|
|
2254
2289
|
}));
|
|
2255
|
-
var StyledPopper = (0, import_joy27.styled)(
|
|
2290
|
+
var StyledPopper = (0, import_joy27.styled)(import_base3.Popper, {
|
|
2256
2291
|
name: "DatePicker",
|
|
2257
2292
|
slot: "popper"
|
|
2258
2293
|
})(({ theme }) => ({
|
|
@@ -2465,7 +2500,7 @@ var DatePicker = (0, import_react19.forwardRef)((inProps, ref) => {
|
|
|
2465
2500
|
},
|
|
2466
2501
|
[inputReadOnly, buttonRef]
|
|
2467
2502
|
);
|
|
2468
|
-
return /* @__PURE__ */ import_react19.default.createElement(DatePickerRoot, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
2503
|
+
return /* @__PURE__ */ import_react19.default.createElement(DatePickerRoot, null, /* @__PURE__ */ import_react19.default.createElement(import_base3.FocusTrap, { open: true }, /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
2469
2504
|
Input_default,
|
|
2470
2505
|
{
|
|
2471
2506
|
...innerProps,
|
|
@@ -2511,7 +2546,7 @@ var DatePicker = (0, import_react19.forwardRef)((inProps, ref) => {
|
|
|
2511
2546
|
helperText,
|
|
2512
2547
|
readOnly: readOnly || inputReadOnly
|
|
2513
2548
|
}
|
|
2514
|
-
), open && /* @__PURE__ */ import_react19.default.createElement(
|
|
2549
|
+
), open && /* @__PURE__ */ import_react19.default.createElement(import_base3.ClickAwayListener, { onClickAway: () => setAnchorEl(null) }, /* @__PURE__ */ import_react19.default.createElement(
|
|
2515
2550
|
StyledPopper,
|
|
2516
2551
|
{
|
|
2517
2552
|
id: "date-picker-popper",
|
|
@@ -2641,6 +2676,11 @@ var import_joy29 = require("@mui/joy");
|
|
|
2641
2676
|
var import_framer_motion19 = require("framer-motion");
|
|
2642
2677
|
var MotionOption = (0, import_framer_motion19.motion)(import_joy29.Option);
|
|
2643
2678
|
var Option = MotionOption;
|
|
2679
|
+
var secondaryTextLevelMap2 = {
|
|
2680
|
+
sm: "body-xs",
|
|
2681
|
+
md: "body-sm",
|
|
2682
|
+
lg: "body-md"
|
|
2683
|
+
};
|
|
2644
2684
|
Option.displayName = "Option";
|
|
2645
2685
|
function Select(props) {
|
|
2646
2686
|
const {
|
|
@@ -2682,6 +2722,13 @@ function Select(props) {
|
|
|
2682
2722
|
};
|
|
2683
2723
|
onChange?.(newEvent, newValue);
|
|
2684
2724
|
};
|
|
2725
|
+
const optionMap = (0, import_react21.useMemo)(() => {
|
|
2726
|
+
const map = /* @__PURE__ */ new Map();
|
|
2727
|
+
options.forEach((option) => {
|
|
2728
|
+
map.set(option.value, option);
|
|
2729
|
+
});
|
|
2730
|
+
return map;
|
|
2731
|
+
}, [options]);
|
|
2685
2732
|
const select = /* @__PURE__ */ import_react21.default.createElement(
|
|
2686
2733
|
import_joy29.Select,
|
|
2687
2734
|
{
|
|
@@ -2690,9 +2737,16 @@ function Select(props) {
|
|
|
2690
2737
|
disabled,
|
|
2691
2738
|
size,
|
|
2692
2739
|
color: error ? "danger" : color,
|
|
2693
|
-
onChange: handleChange
|
|
2740
|
+
onChange: handleChange,
|
|
2741
|
+
renderValue: (selected) => {
|
|
2742
|
+
if (!selected) return null;
|
|
2743
|
+
if (Array.isArray(selected)) {
|
|
2744
|
+
return selected.map((s) => optionMap.get(s.value)?.label).join(", ");
|
|
2745
|
+
}
|
|
2746
|
+
return optionMap.get(selected.value)?.label;
|
|
2747
|
+
}
|
|
2694
2748
|
},
|
|
2695
|
-
options.map((option) => /* @__PURE__ */ import_react21.default.createElement(Option, { key: option.value, value: option.value }, option.label))
|
|
2749
|
+
options.map((option) => /* @__PURE__ */ import_react21.default.createElement(Option, { key: option.value, value: option.value, disabled: option.disabled }, option.secondaryText ? /* @__PURE__ */ import_react21.default.createElement(import_joy29.ListItemContent, { sx: { gap: 0.5 } }, /* @__PURE__ */ import_react21.default.createElement(import_joy29.Typography, { level: "inherit" }, option.label), /* @__PURE__ */ import_react21.default.createElement(import_joy29.Typography, { level: secondaryTextLevelMap2[size ?? "md"], textColor: "text.tertiary" }, option.secondaryText)) : option.label))
|
|
2696
2750
|
);
|
|
2697
2751
|
return /* @__PURE__ */ import_react21.default.createElement(
|
|
2698
2752
|
FormControl_default,
|
|
@@ -4112,7 +4166,7 @@ var import_react29 = __toESM(require("react"));
|
|
|
4112
4166
|
var import_react_imask2 = require("react-imask");
|
|
4113
4167
|
var import_CalendarToday2 = __toESM(require("@mui/icons-material/CalendarToday"));
|
|
4114
4168
|
var import_joy36 = require("@mui/joy");
|
|
4115
|
-
var
|
|
4169
|
+
var import_base4 = require("@mui/base");
|
|
4116
4170
|
var CalendarButton2 = (0, import_joy36.styled)(IconButton_default, {
|
|
4117
4171
|
name: "DateRangePicker",
|
|
4118
4172
|
slot: "calendarButton"
|
|
@@ -4123,7 +4177,7 @@ var CalendarButton2 = (0, import_joy36.styled)(IconButton_default, {
|
|
|
4123
4177
|
outline: `${theme.getCssVar("focus-thickness")} solid ${theme.getCssVar("palette-focusVisible")}`
|
|
4124
4178
|
}
|
|
4125
4179
|
}));
|
|
4126
|
-
var StyledPopper2 = (0, import_joy36.styled)(
|
|
4180
|
+
var StyledPopper2 = (0, import_joy36.styled)(import_base4.Popper, {
|
|
4127
4181
|
name: "DateRangePicker",
|
|
4128
4182
|
slot: "popper"
|
|
4129
4183
|
})(({ theme }) => ({
|
|
@@ -4366,7 +4420,7 @@ var DateRangePicker = (0, import_react29.forwardRef)((inProps, ref) => {
|
|
|
4366
4420
|
},
|
|
4367
4421
|
[inputReadOnly, buttonRef]
|
|
4368
4422
|
);
|
|
4369
|
-
return /* @__PURE__ */ import_react29.default.createElement(DateRangePickerRoot, null, /* @__PURE__ */ import_react29.default.createElement(
|
|
4423
|
+
return /* @__PURE__ */ import_react29.default.createElement(DateRangePickerRoot, null, /* @__PURE__ */ import_react29.default.createElement(import_base4.FocusTrap, { open: true }, /* @__PURE__ */ import_react29.default.createElement(import_react29.default.Fragment, null, /* @__PURE__ */ import_react29.default.createElement(
|
|
4370
4424
|
Input_default,
|
|
4371
4425
|
{
|
|
4372
4426
|
...innerProps,
|
|
@@ -4412,7 +4466,7 @@ var DateRangePicker = (0, import_react29.forwardRef)((inProps, ref) => {
|
|
|
4412
4466
|
helperText,
|
|
4413
4467
|
readOnly: readOnly || inputReadOnly
|
|
4414
4468
|
}
|
|
4415
|
-
), open && /* @__PURE__ */ import_react29.default.createElement(
|
|
4469
|
+
), open && /* @__PURE__ */ import_react29.default.createElement(import_base4.ClickAwayListener, { onClickAway: () => setAnchorEl(null) }, /* @__PURE__ */ import_react29.default.createElement(
|
|
4416
4470
|
StyledPopper2,
|
|
4417
4471
|
{
|
|
4418
4472
|
id: "date-range-picker-popper",
|
|
@@ -4975,8 +5029,8 @@ MenuButton.displayName = "MenuButton";
|
|
|
4975
5029
|
var import_react38 = __toESM(require("react"));
|
|
4976
5030
|
var import_CalendarToday3 = __toESM(require("@mui/icons-material/CalendarToday"));
|
|
4977
5031
|
var import_joy49 = require("@mui/joy");
|
|
4978
|
-
var
|
|
4979
|
-
var StyledPopper3 = (0, import_joy49.styled)(
|
|
5032
|
+
var import_base5 = require("@mui/base");
|
|
5033
|
+
var StyledPopper3 = (0, import_joy49.styled)(import_base5.Popper, {
|
|
4980
5034
|
name: "MonthPicker",
|
|
4981
5035
|
slot: "popper"
|
|
4982
5036
|
})(({ theme }) => ({
|
|
@@ -5108,7 +5162,7 @@ var MonthPicker = (0, import_react38.forwardRef)((inProps, ref) => {
|
|
|
5108
5162
|
},
|
|
5109
5163
|
[buttonRef]
|
|
5110
5164
|
);
|
|
5111
|
-
return /* @__PURE__ */ import_react38.default.createElement(MonthPickerRoot, null, /* @__PURE__ */ import_react38.default.createElement(
|
|
5165
|
+
return /* @__PURE__ */ import_react38.default.createElement(MonthPickerRoot, null, /* @__PURE__ */ import_react38.default.createElement(import_base5.FocusTrap, { open: true }, /* @__PURE__ */ import_react38.default.createElement(import_react38.default.Fragment, null, /* @__PURE__ */ import_react38.default.createElement(
|
|
5112
5166
|
Input_default,
|
|
5113
5167
|
{
|
|
5114
5168
|
...innerProps,
|
|
@@ -5155,7 +5209,7 @@ var MonthPicker = (0, import_react38.forwardRef)((inProps, ref) => {
|
|
|
5155
5209
|
label,
|
|
5156
5210
|
helperText
|
|
5157
5211
|
}
|
|
5158
|
-
), open && /* @__PURE__ */ import_react38.default.createElement(
|
|
5212
|
+
), open && /* @__PURE__ */ import_react38.default.createElement(import_base5.ClickAwayListener, { onClickAway: () => setAnchorEl(null) }, /* @__PURE__ */ import_react38.default.createElement(
|
|
5159
5213
|
StyledPopper3,
|
|
5160
5214
|
{
|
|
5161
5215
|
id: "month-picker-popper",
|
|
@@ -5229,8 +5283,8 @@ var import_react39 = __toESM(require("react"));
|
|
|
5229
5283
|
var import_react_imask3 = require("react-imask");
|
|
5230
5284
|
var import_CalendarToday4 = __toESM(require("@mui/icons-material/CalendarToday"));
|
|
5231
5285
|
var import_joy50 = require("@mui/joy");
|
|
5232
|
-
var
|
|
5233
|
-
var StyledPopper4 = (0, import_joy50.styled)(
|
|
5286
|
+
var import_base6 = require("@mui/base");
|
|
5287
|
+
var StyledPopper4 = (0, import_joy50.styled)(import_base6.Popper, {
|
|
5234
5288
|
name: "MonthRangePicker",
|
|
5235
5289
|
slot: "popper"
|
|
5236
5290
|
})(({ theme }) => ({
|
|
@@ -5369,7 +5423,7 @@ var MonthRangePicker = (0, import_react39.forwardRef)((inProps, ref) => {
|
|
|
5369
5423
|
},
|
|
5370
5424
|
[setValue, setAnchorEl, format]
|
|
5371
5425
|
);
|
|
5372
|
-
return /* @__PURE__ */ import_react39.default.createElement(MonthRangePickerRoot, null, /* @__PURE__ */ import_react39.default.createElement(
|
|
5426
|
+
return /* @__PURE__ */ import_react39.default.createElement(MonthRangePickerRoot, null, /* @__PURE__ */ import_react39.default.createElement(import_base6.FocusTrap, { open: true }, /* @__PURE__ */ import_react39.default.createElement(import_react39.default.Fragment, null, /* @__PURE__ */ import_react39.default.createElement(
|
|
5373
5427
|
Input_default,
|
|
5374
5428
|
{
|
|
5375
5429
|
...innerProps,
|
|
@@ -5406,7 +5460,7 @@ var MonthRangePicker = (0, import_react39.forwardRef)((inProps, ref) => {
|
|
|
5406
5460
|
label,
|
|
5407
5461
|
helperText
|
|
5408
5462
|
}
|
|
5409
|
-
), open && /* @__PURE__ */ import_react39.default.createElement(
|
|
5463
|
+
), open && /* @__PURE__ */ import_react39.default.createElement(import_base6.ClickAwayListener, { onClickAway: () => setAnchorEl(null) }, /* @__PURE__ */ import_react39.default.createElement(
|
|
5410
5464
|
StyledPopper4,
|
|
5411
5465
|
{
|
|
5412
5466
|
id: "month-range-picker-popper",
|
package/dist/index.js
CHANGED
|
@@ -136,7 +136,7 @@ import {
|
|
|
136
136
|
listItemClasses,
|
|
137
137
|
ListItemButton as ListItemButton2,
|
|
138
138
|
listItemButtonClasses as listItemButtonClasses2,
|
|
139
|
-
ListItemContent,
|
|
139
|
+
ListItemContent as ListItemContent3,
|
|
140
140
|
listItemContentClasses,
|
|
141
141
|
ListItemDecorator as ListItemDecorator2,
|
|
142
142
|
listItemDecoratorClasses,
|
|
@@ -249,9 +249,12 @@ import {
|
|
|
249
249
|
ListSubheader as JoyListSubheader,
|
|
250
250
|
AutocompleteListbox as JoyAutocompleteListbox,
|
|
251
251
|
ListItemDecorator,
|
|
252
|
+
ListItemContent,
|
|
253
|
+
Typography as Typography2,
|
|
252
254
|
CircularProgress,
|
|
253
255
|
styled as styled3
|
|
254
256
|
} from "@mui/joy";
|
|
257
|
+
import { createFilterOptions } from "@mui/base";
|
|
255
258
|
import CloseIcon from "@mui/icons-material/Close";
|
|
256
259
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
257
260
|
import { Popper } from "@mui/base";
|
|
@@ -349,18 +352,33 @@ var AutocompletePopper = styled3(Popper, {
|
|
|
349
352
|
})(({ theme }) => ({
|
|
350
353
|
zIndex: theme.zIndex.tooltip
|
|
351
354
|
}));
|
|
355
|
+
var itemHeightMap = {
|
|
356
|
+
sm: { default: 32, secondary: 47 },
|
|
357
|
+
md: { default: 36, secondary: 55 },
|
|
358
|
+
lg: { default: 44, secondary: 65 }
|
|
359
|
+
};
|
|
360
|
+
var optionPaddingMap = {
|
|
361
|
+
sm: { px: "8px", py: "3px" },
|
|
362
|
+
md: { px: "12px", py: "4px" },
|
|
363
|
+
lg: { px: "16px", py: "6px" }
|
|
364
|
+
};
|
|
352
365
|
var AutocompleteListBox = React5.forwardRef((props, ref) => {
|
|
353
366
|
const {
|
|
354
367
|
anchorEl,
|
|
355
368
|
open,
|
|
356
369
|
modifiers,
|
|
357
370
|
children,
|
|
371
|
+
hasSecondaryText = false,
|
|
358
372
|
ownerState: { loading, size: fontSize = "md" },
|
|
359
373
|
...innerProps
|
|
360
374
|
} = props;
|
|
361
375
|
const parentRef = useRef2(null);
|
|
362
376
|
const isGrouped = children[0].every((child) => child.hasOwnProperty("group"));
|
|
363
|
-
const
|
|
377
|
+
const itemHeight = useMemo(() => {
|
|
378
|
+
const heights = itemHeightMap[fontSize ?? "md"];
|
|
379
|
+
return hasSecondaryText ? heights.secondary : heights.default;
|
|
380
|
+
}, [fontSize, hasSecondaryText]);
|
|
381
|
+
const renderTargets = useMemo(() => {
|
|
364
382
|
if (loading) {
|
|
365
383
|
return [children[1]];
|
|
366
384
|
}
|
|
@@ -374,10 +392,10 @@ var AutocompleteListBox = React5.forwardRef((props, ref) => {
|
|
|
374
392
|
]);
|
|
375
393
|
}
|
|
376
394
|
return children[0];
|
|
377
|
-
})
|
|
395
|
+
}, [loading, children, isGrouped]);
|
|
378
396
|
const virtualizer = useVirtualizer({
|
|
379
397
|
count: renderTargets.length,
|
|
380
|
-
estimateSize: () =>
|
|
398
|
+
estimateSize: () => itemHeight,
|
|
381
399
|
getScrollElement: () => parentRef.current,
|
|
382
400
|
measureElement: (element) => element.clientHeight,
|
|
383
401
|
overscan: 5
|
|
@@ -425,19 +443,24 @@ var AutocompleteListBox = React5.forwardRef((props, ref) => {
|
|
|
425
443
|
)
|
|
426
444
|
))));
|
|
427
445
|
});
|
|
428
|
-
var
|
|
446
|
+
var autocompleteDeleteSize = {
|
|
429
447
|
sm: "20px",
|
|
430
448
|
md: "24px",
|
|
431
449
|
lg: "28px"
|
|
432
450
|
};
|
|
451
|
+
var secondaryTextLevelMap = {
|
|
452
|
+
sm: "body-xs",
|
|
453
|
+
md: "body-sm",
|
|
454
|
+
lg: "body-md"
|
|
455
|
+
};
|
|
433
456
|
var AutocompleteTagDelete = styled3(IconButton_default, {
|
|
434
457
|
name: "Autocomplete",
|
|
435
458
|
slot: "tagDelete"
|
|
436
459
|
})(({ theme, size = "md" }) => ({
|
|
437
|
-
width:
|
|
438
|
-
height:
|
|
439
|
-
minWidth:
|
|
440
|
-
minHeight:
|
|
460
|
+
width: autocompleteDeleteSize[size],
|
|
461
|
+
height: autocompleteDeleteSize[size],
|
|
462
|
+
minWidth: autocompleteDeleteSize[size],
|
|
463
|
+
minHeight: autocompleteDeleteSize[size],
|
|
441
464
|
borderRadius: "50%"
|
|
442
465
|
}));
|
|
443
466
|
function Autocomplete(props) {
|
|
@@ -557,7 +580,18 @@ function Autocomplete(props) {
|
|
|
557
580
|
slots: {
|
|
558
581
|
listbox: AutocompleteListBox
|
|
559
582
|
},
|
|
560
|
-
|
|
583
|
+
slotProps: {
|
|
584
|
+
listbox: {
|
|
585
|
+
hasSecondaryText: options.some((opt) => opt.secondaryText)
|
|
586
|
+
}
|
|
587
|
+
},
|
|
588
|
+
filterOptions: createFilterOptions({
|
|
589
|
+
stringify: (option) => {
|
|
590
|
+
const opt = option;
|
|
591
|
+
return opt.secondaryText ? `${opt.label} ${opt.secondaryText}` : opt.label;
|
|
592
|
+
}
|
|
593
|
+
}),
|
|
594
|
+
renderOption: (props2, option) => /* @__PURE__ */ React5.createElement(JoyAutocompleteOption, { ...props2, sx: optionPaddingMap[size ?? "md"] }, option.startDecorator && /* @__PURE__ */ React5.createElement(
|
|
561
595
|
ListItemDecorator,
|
|
562
596
|
{
|
|
563
597
|
sx: (theme) => ({
|
|
@@ -565,7 +599,10 @@ function Autocomplete(props) {
|
|
|
565
599
|
})
|
|
566
600
|
},
|
|
567
601
|
applySize(option.startDecorator)
|
|
568
|
-
), applySize(option.label),
|
|
602
|
+
), 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)) : (
|
|
603
|
+
// TODO: haulla에서 사용할 때, label을 ReactNode로 넘기면 에러가 발생함....
|
|
604
|
+
applySize(option.label)
|
|
605
|
+
), option.endDecorator && /* @__PURE__ */ React5.createElement(
|
|
569
606
|
ListItemDecorator,
|
|
570
607
|
{
|
|
571
608
|
sx: (theme) => ({
|
|
@@ -2575,10 +2612,15 @@ var Textarea_default = Textarea;
|
|
|
2575
2612
|
|
|
2576
2613
|
// src/components/Select/Select.tsx
|
|
2577
2614
|
import React19, { useMemo as useMemo7 } from "react";
|
|
2578
|
-
import { Select as JoySelect, Option as JoyOption } from "@mui/joy";
|
|
2615
|
+
import { Select as JoySelect, Option as JoyOption, ListItemContent as ListItemContent2, Typography as Typography3 } from "@mui/joy";
|
|
2579
2616
|
import { motion as motion19 } from "framer-motion";
|
|
2580
2617
|
var MotionOption = motion19(JoyOption);
|
|
2581
2618
|
var Option = MotionOption;
|
|
2619
|
+
var secondaryTextLevelMap2 = {
|
|
2620
|
+
sm: "body-xs",
|
|
2621
|
+
md: "body-sm",
|
|
2622
|
+
lg: "body-md"
|
|
2623
|
+
};
|
|
2582
2624
|
Option.displayName = "Option";
|
|
2583
2625
|
function Select(props) {
|
|
2584
2626
|
const {
|
|
@@ -2620,6 +2662,13 @@ function Select(props) {
|
|
|
2620
2662
|
};
|
|
2621
2663
|
onChange?.(newEvent, newValue);
|
|
2622
2664
|
};
|
|
2665
|
+
const optionMap = useMemo7(() => {
|
|
2666
|
+
const map = /* @__PURE__ */ new Map();
|
|
2667
|
+
options.forEach((option) => {
|
|
2668
|
+
map.set(option.value, option);
|
|
2669
|
+
});
|
|
2670
|
+
return map;
|
|
2671
|
+
}, [options]);
|
|
2623
2672
|
const select = /* @__PURE__ */ React19.createElement(
|
|
2624
2673
|
JoySelect,
|
|
2625
2674
|
{
|
|
@@ -2628,9 +2677,16 @@ function Select(props) {
|
|
|
2628
2677
|
disabled,
|
|
2629
2678
|
size,
|
|
2630
2679
|
color: error ? "danger" : color,
|
|
2631
|
-
onChange: handleChange
|
|
2680
|
+
onChange: handleChange,
|
|
2681
|
+
renderValue: (selected) => {
|
|
2682
|
+
if (!selected) return null;
|
|
2683
|
+
if (Array.isArray(selected)) {
|
|
2684
|
+
return selected.map((s) => optionMap.get(s.value)?.label).join(", ");
|
|
2685
|
+
}
|
|
2686
|
+
return optionMap.get(selected.value)?.label;
|
|
2687
|
+
}
|
|
2632
2688
|
},
|
|
2633
|
-
options.map((option) => /* @__PURE__ */ React19.createElement(Option, { key: option.value, value: option.value }, option.label))
|
|
2689
|
+
options.map((option) => /* @__PURE__ */ React19.createElement(Option, { key: option.value, value: option.value, disabled: option.disabled }, option.secondaryText ? /* @__PURE__ */ React19.createElement(ListItemContent2, { sx: { gap: 0.5 } }, /* @__PURE__ */ React19.createElement(Typography3, { level: "inherit" }, option.label), /* @__PURE__ */ React19.createElement(Typography3, { level: secondaryTextLevelMap2[size ?? "md"], textColor: "text.tertiary" }, option.secondaryText)) : option.label))
|
|
2634
2690
|
);
|
|
2635
2691
|
return /* @__PURE__ */ React19.createElement(
|
|
2636
2692
|
FormControl_default,
|
|
@@ -6514,7 +6570,7 @@ export {
|
|
|
6514
6570
|
ListDivider,
|
|
6515
6571
|
ListItem,
|
|
6516
6572
|
ListItemButton2 as ListItemButton,
|
|
6517
|
-
ListItemContent,
|
|
6573
|
+
ListItemContent3 as ListItemContent,
|
|
6518
6574
|
ListItemDecorator2 as ListItemDecorator,
|
|
6519
6575
|
ListSubheader,
|
|
6520
6576
|
Markdown,
|