@uniai-fe/uds-primitives 0.2.0 → 0.2.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/styles.css +6 -6
- package/package.json +1 -1
- package/src/components/dropdown/markup/Template.tsx +4 -8
- package/src/components/dropdown/markup/foundation/Container.tsx +35 -7
- package/src/components/dropdown/markup/foundation/MenuItem.tsx +10 -10
- package/src/components/dropdown/styles/dropdown.scss +2 -2
- package/src/components/dropdown/styles/variables.scss +4 -4
- package/src/components/dropdown/types/base.ts +13 -0
- package/src/components/dropdown/types/props.ts +23 -27
- package/src/components/select/markup/Default.tsx +4 -4
- package/src/components/select/markup/multiple/Multiple.tsx +4 -4
- package/src/components/select/types/index.ts +1 -0
- package/src/components/select/types/option.ts +43 -0
- package/src/components/select/types/props.ts +5 -4
package/dist/styles.css
CHANGED
|
@@ -214,7 +214,7 @@
|
|
|
214
214
|
--dropdown-text-medium-size: 16px;
|
|
215
215
|
--dropdown-text-medium-line-height: 24px;
|
|
216
216
|
--dropdown-text-medium-letter-spacing: 0;
|
|
217
|
-
--dropdown-text-large-size:
|
|
217
|
+
--dropdown-text-large-size: 19px;
|
|
218
218
|
--dropdown-text-large-line-height: 26px;
|
|
219
219
|
--dropdown-text-large-letter-spacing: 0;
|
|
220
220
|
--dropdown-text-weight: 400;
|
|
@@ -222,9 +222,9 @@
|
|
|
222
222
|
--dropdown-description-color: var(--color-label-neutral);
|
|
223
223
|
--dropdown-description-size: 14px;
|
|
224
224
|
--dropdown-description-line-height: 22px;
|
|
225
|
-
--dropdown-option-height-small:
|
|
226
|
-
--dropdown-option-height-medium:
|
|
227
|
-
--dropdown-option-height-large:
|
|
225
|
+
--dropdown-option-height-small: var(--theme-size-medium-1, 40px);
|
|
226
|
+
--dropdown-option-height-medium: var(--theme-size-medium-2, 48px);
|
|
227
|
+
--dropdown-option-height-large: var(--theme-size-medium-3, 56px);
|
|
228
228
|
/* Input sizing tokens; Button 변수 규칙과 동일한 prefix 패턴을 맞춘다. */
|
|
229
229
|
--input-default-height-small: var(--theme-size-medium-1);
|
|
230
230
|
--input-default-height-medium: var(--theme-size-medium-2);
|
|
@@ -1545,8 +1545,8 @@ figure.chip {
|
|
|
1545
1545
|
color: var(--dropdown-option-color-disabled);
|
|
1546
1546
|
}
|
|
1547
1547
|
|
|
1548
|
-
.dropdown-menu-item-
|
|
1549
|
-
.dropdown-menu-item-
|
|
1548
|
+
.dropdown-menu-item-left,
|
|
1549
|
+
.dropdown-menu-item-right {
|
|
1550
1550
|
display: inline-flex;
|
|
1551
1551
|
align-items: center;
|
|
1552
1552
|
color: inherit;
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ const DropdownTemplate = ({
|
|
|
19
19
|
selectedIds = [],
|
|
20
20
|
onSelect,
|
|
21
21
|
size = "medium",
|
|
22
|
-
|
|
22
|
+
width = "match",
|
|
23
23
|
rootProps,
|
|
24
24
|
containerProps,
|
|
25
25
|
menuListProps,
|
|
@@ -27,11 +27,7 @@ const DropdownTemplate = ({
|
|
|
27
27
|
return (
|
|
28
28
|
<DropdownRoot {...rootProps}>
|
|
29
29
|
<DropdownTrigger asChild>{trigger}</DropdownTrigger>
|
|
30
|
-
<DropdownContainer
|
|
31
|
-
{...containerProps}
|
|
32
|
-
size={size}
|
|
33
|
-
matchTriggerWidth={matchTriggerWidth}
|
|
34
|
-
>
|
|
30
|
+
<DropdownContainer {...containerProps} size={size} width={width}>
|
|
35
31
|
<DropdownMenuList {...menuListProps}>
|
|
36
32
|
{items.map(item => (
|
|
37
33
|
<DropdownMenuItem
|
|
@@ -39,8 +35,8 @@ const DropdownTemplate = ({
|
|
|
39
35
|
label={item.label}
|
|
40
36
|
description={item.description}
|
|
41
37
|
disabled={item.disabled}
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
left={item.left}
|
|
39
|
+
right={item.right}
|
|
44
40
|
multiple={item.multiple}
|
|
45
41
|
isSelected={selectedIds?.includes(item.id)}
|
|
46
42
|
onSelect={event => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
4
4
|
import clsx from "clsx";
|
|
5
|
-
import { forwardRef, useEffect, useState } from "react";
|
|
5
|
+
import { forwardRef, useEffect, useMemo, useState } from "react";
|
|
6
6
|
|
|
7
7
|
import type { DropdownContainerProps } from "../../types/props";
|
|
8
8
|
import { useDropdownContext } from "./Provider";
|
|
@@ -11,8 +11,8 @@ import { useDropdownContext } from "./Provider";
|
|
|
11
11
|
* Dropdown container; trigger width 동기화 및 portal 관리
|
|
12
12
|
* @component
|
|
13
13
|
* @param {DropdownContainerProps} props Dropdown container props
|
|
14
|
-
* @param {
|
|
15
|
-
* @param {
|
|
14
|
+
* @param {DropdownPanelWidth} [props.width="match"] panel width 옵션
|
|
15
|
+
* @param {DropdownSize} [props.size="medium"] option height scale
|
|
16
16
|
*/
|
|
17
17
|
const DropdownContainer = forwardRef<HTMLDivElement, DropdownContainerProps>(
|
|
18
18
|
(
|
|
@@ -20,7 +20,7 @@ const DropdownContainer = forwardRef<HTMLDivElement, DropdownContainerProps>(
|
|
|
20
20
|
children,
|
|
21
21
|
className,
|
|
22
22
|
size = "medium",
|
|
23
|
-
|
|
23
|
+
width = "match",
|
|
24
24
|
portalContainer,
|
|
25
25
|
align = "start",
|
|
26
26
|
side = "bottom",
|
|
@@ -33,9 +33,34 @@ const DropdownContainer = forwardRef<HTMLDivElement, DropdownContainerProps>(
|
|
|
33
33
|
) => {
|
|
34
34
|
const { triggerRef } = useDropdownContext("Dropdown.Container");
|
|
35
35
|
const [panelWidth, setPanelWidth] = useState<number>();
|
|
36
|
+
const shouldMatchTriggerWidth = width === "match";
|
|
37
|
+
|
|
38
|
+
const resolvedMinWidth = useMemo(() => {
|
|
39
|
+
if (shouldMatchTriggerWidth) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (typeof width === "number") {
|
|
44
|
+
return `${width}px`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (typeof width === "string") {
|
|
48
|
+
if (width === "fit-content") {
|
|
49
|
+
return "fit-content";
|
|
50
|
+
}
|
|
51
|
+
if (width === "max-content") {
|
|
52
|
+
return "max-content";
|
|
53
|
+
}
|
|
54
|
+
if (width.trim().length > 0 && width !== "match") {
|
|
55
|
+
return width;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return undefined;
|
|
60
|
+
}, [shouldMatchTriggerWidth, width]);
|
|
36
61
|
|
|
37
62
|
useEffect(() => {
|
|
38
|
-
if (!
|
|
63
|
+
if (!shouldMatchTriggerWidth) {
|
|
39
64
|
return;
|
|
40
65
|
}
|
|
41
66
|
|
|
@@ -60,7 +85,7 @@ const DropdownContainer = forwardRef<HTMLDivElement, DropdownContainerProps>(
|
|
|
60
85
|
return () => {
|
|
61
86
|
observer.disconnect();
|
|
62
87
|
};
|
|
63
|
-
}, [
|
|
88
|
+
}, [shouldMatchTriggerWidth, triggerRef]);
|
|
64
89
|
|
|
65
90
|
const content = (
|
|
66
91
|
<DropdownMenu.Content
|
|
@@ -73,7 +98,10 @@ const DropdownContainer = forwardRef<HTMLDivElement, DropdownContainerProps>(
|
|
|
73
98
|
className={clsx("dropdown-panel", `dropdown-panel-${size}`, className)}
|
|
74
99
|
style={{
|
|
75
100
|
...style,
|
|
76
|
-
width:
|
|
101
|
+
width:
|
|
102
|
+
shouldMatchTriggerWidth && panelWidth ? panelWidth : style?.width,
|
|
103
|
+
minWidth:
|
|
104
|
+
resolvedMinWidth !== undefined ? resolvedMinWidth : style?.minWidth,
|
|
77
105
|
}}
|
|
78
106
|
>
|
|
79
107
|
{children}
|
|
@@ -20,8 +20,8 @@ const DropdownMenuItem = forwardRef<HTMLDivElement, DropdownMenuItemProps>(
|
|
|
20
20
|
{
|
|
21
21
|
label,
|
|
22
22
|
description,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
left,
|
|
24
|
+
right,
|
|
25
25
|
isSelected = false,
|
|
26
26
|
multiple = false,
|
|
27
27
|
className,
|
|
@@ -34,9 +34,9 @@ const DropdownMenuItem = forwardRef<HTMLDivElement, DropdownMenuItemProps>(
|
|
|
34
34
|
) => {
|
|
35
35
|
const labelContent = label ?? children;
|
|
36
36
|
const hasDescription = Boolean(description);
|
|
37
|
-
const shouldRenderCheckbox = multiple && !
|
|
37
|
+
const shouldRenderCheckbox = multiple && !left;
|
|
38
38
|
|
|
39
|
-
const
|
|
39
|
+
const renderLeft = () => {
|
|
40
40
|
if (shouldRenderCheckbox) {
|
|
41
41
|
const checkboxClassName = clsx(
|
|
42
42
|
"dropdown-menu-item-checkbox",
|
|
@@ -53,14 +53,14 @@ const DropdownMenuItem = forwardRef<HTMLDivElement, DropdownMenuItemProps>(
|
|
|
53
53
|
} as CheckboxProps;
|
|
54
54
|
|
|
55
55
|
return (
|
|
56
|
-
<span className="dropdown-menu-item-
|
|
56
|
+
<span className="dropdown-menu-item-left" aria-hidden="true">
|
|
57
57
|
<Checkbox size="medium" {...checkboxAdditionalProps} />
|
|
58
58
|
</span>
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
if (
|
|
63
|
-
return <span className="dropdown-menu-item-
|
|
62
|
+
if (left) {
|
|
63
|
+
return <span className="dropdown-menu-item-left">{left}</span>;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
return null;
|
|
@@ -82,7 +82,7 @@ const DropdownMenuItem = forwardRef<HTMLDivElement, DropdownMenuItemProps>(
|
|
|
82
82
|
onSelectHandler?.(event);
|
|
83
83
|
}}
|
|
84
84
|
>
|
|
85
|
-
{
|
|
85
|
+
{renderLeft()}
|
|
86
86
|
<span className="dropdown-menu-item-body">
|
|
87
87
|
{labelContent ? (
|
|
88
88
|
<span className="dropdown-menu-item-label">{labelContent}</span>
|
|
@@ -93,8 +93,8 @@ const DropdownMenuItem = forwardRef<HTMLDivElement, DropdownMenuItemProps>(
|
|
|
93
93
|
</span>
|
|
94
94
|
) : null}
|
|
95
95
|
</span>
|
|
96
|
-
{
|
|
97
|
-
<span className="dropdown-menu-item-
|
|
96
|
+
{right ? (
|
|
97
|
+
<span className="dropdown-menu-item-right">{right}</span>
|
|
98
98
|
) : null}
|
|
99
99
|
</DropdownMenu.Item>
|
|
100
100
|
</li>
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
--dropdown-text-medium-size: 16px;
|
|
26
26
|
--dropdown-text-medium-line-height: 24px;
|
|
27
27
|
--dropdown-text-medium-letter-spacing: 0;
|
|
28
|
-
--dropdown-text-large-size:
|
|
28
|
+
--dropdown-text-large-size: 19px;
|
|
29
29
|
--dropdown-text-large-line-height: 26px;
|
|
30
30
|
--dropdown-text-large-letter-spacing: 0;
|
|
31
31
|
--dropdown-text-weight: 400;
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
--dropdown-description-size: 14px;
|
|
35
35
|
--dropdown-description-line-height: 22px;
|
|
36
36
|
|
|
37
|
-
--dropdown-option-height-small:
|
|
38
|
-
--dropdown-option-height-medium:
|
|
39
|
-
--dropdown-option-height-large:
|
|
37
|
+
--dropdown-option-height-small: var(--theme-size-medium-1, 40px);
|
|
38
|
+
--dropdown-option-height-medium: var(--theme-size-medium-2, 48px);
|
|
39
|
+
--dropdown-option-height-large: var(--theme-size-medium-3, 56px);
|
|
40
40
|
}
|
|
@@ -6,6 +6,19 @@ import type { DropdownMenuProps } from "@radix-ui/react-dropdown-menu";
|
|
|
6
6
|
*/
|
|
7
7
|
export type DropdownSize = "small" | "medium" | "large";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Dropdown panel width 옵션
|
|
11
|
+
* - "match": trigger width 추적
|
|
12
|
+
* - "fit-content" | "max-content": 고정 넓이 프리셋
|
|
13
|
+
* - string/number: min-width 커스텀 값
|
|
14
|
+
*/
|
|
15
|
+
export type DropdownPanelWidth =
|
|
16
|
+
| "match"
|
|
17
|
+
| "fit-content"
|
|
18
|
+
| "max-content"
|
|
19
|
+
| string
|
|
20
|
+
| number;
|
|
21
|
+
|
|
9
22
|
/**
|
|
10
23
|
* Dropdown root props
|
|
11
24
|
* @property {boolean} [modal] Radix modal 모드 여부
|
|
@@ -6,23 +6,22 @@ import type {
|
|
|
6
6
|
import type { HTMLAttributes, MutableRefObject, ReactNode } from "react";
|
|
7
7
|
|
|
8
8
|
import type { CheckboxProps } from "../../checkbox/types";
|
|
9
|
-
import type {
|
|
9
|
+
import type {
|
|
10
|
+
DropdownPanelWidth,
|
|
11
|
+
DropdownRootProps,
|
|
12
|
+
DropdownSize,
|
|
13
|
+
} from "./base";
|
|
10
14
|
|
|
11
15
|
/**
|
|
12
16
|
* Dropdown trigger props
|
|
13
17
|
* @property {boolean} [asChild=true] trigger를 asChild 패턴으로 감쌀지 여부
|
|
14
18
|
*/
|
|
15
|
-
export
|
|
16
|
-
/**
|
|
17
|
-
* trigger를 asChild 패턴으로 감쌀지 여부
|
|
18
|
-
*/
|
|
19
|
-
asChild?: DropdownMenuTriggerProps["asChild"];
|
|
20
|
-
}
|
|
19
|
+
export type DropdownTriggerProps = DropdownMenuTriggerProps;
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* Dropdown Container props
|
|
24
23
|
* @property {DropdownSize} [size="medium"] option 높이 스케일
|
|
25
|
-
* @property {
|
|
24
|
+
* @property {DropdownPanelWidth} [width="match"] dropdown panel width 옵션
|
|
26
25
|
* @property {HTMLElement | null} [portalContainer] portal을 렌더링할 DOM 컨테이너
|
|
27
26
|
*/
|
|
28
27
|
export interface DropdownContainerProps extends DropdownMenuContentProps {
|
|
@@ -33,7 +32,7 @@ export interface DropdownContainerProps extends DropdownMenuContentProps {
|
|
|
33
32
|
/**
|
|
34
33
|
* trigger 너비에 맞춰 dropdown 너비를 맞출지 여부
|
|
35
34
|
*/
|
|
36
|
-
|
|
35
|
+
width?: DropdownPanelWidth;
|
|
37
36
|
/**
|
|
38
37
|
* portal을 렌더링할 DOM 컨테이너
|
|
39
38
|
*/
|
|
@@ -44,8 +43,8 @@ export interface DropdownContainerProps extends DropdownMenuContentProps {
|
|
|
44
43
|
* Dropdown menu item props
|
|
45
44
|
* @property {ReactNode} [label] 옵션 라벨
|
|
46
45
|
* @property {ReactNode} [description] 보조 텍스트
|
|
47
|
-
* @property {ReactNode} [
|
|
48
|
-
* @property {ReactNode} [
|
|
46
|
+
* @property {ReactNode} [left] 좌측 콘텐츠
|
|
47
|
+
* @property {ReactNode} [right] 우측 콘텐츠
|
|
49
48
|
* @property {boolean} [isSelected] 선택 상태 여부
|
|
50
49
|
* @property {boolean} [multiple] multi select 스타일 여부
|
|
51
50
|
* @property {CheckboxProps} [checkboxProps] multiple 시 Checkbox 커스터마이징 옵션
|
|
@@ -60,13 +59,13 @@ export interface DropdownMenuItemProps extends RadixDropdownMenuItemProps {
|
|
|
60
59
|
*/
|
|
61
60
|
description?: ReactNode;
|
|
62
61
|
/**
|
|
63
|
-
* 좌측
|
|
62
|
+
* 좌측 콘텐츠
|
|
64
63
|
*/
|
|
65
|
-
|
|
64
|
+
left?: ReactNode;
|
|
66
65
|
/**
|
|
67
|
-
* 우측
|
|
66
|
+
* 우측 콘텐츠
|
|
68
67
|
*/
|
|
69
|
-
|
|
68
|
+
right?: ReactNode;
|
|
70
69
|
/**
|
|
71
70
|
* 선택 상태 여부
|
|
72
71
|
*/
|
|
@@ -103,8 +102,8 @@ export interface DropdownContextValue {
|
|
|
103
102
|
* @property {ReactNode} label 옵션 라벨
|
|
104
103
|
* @property {ReactNode} [description] 보조 텍스트
|
|
105
104
|
* @property {boolean} [disabled] 비활성 여부
|
|
106
|
-
* @property {ReactNode} [
|
|
107
|
-
* @property {ReactNode} [
|
|
105
|
+
* @property {ReactNode} [left] 좌측 콘텐츠
|
|
106
|
+
* @property {ReactNode} [right] 우측 콘텐츠
|
|
108
107
|
* @property {boolean} [multiple] multi select 스타일 여부
|
|
109
108
|
*/
|
|
110
109
|
export interface DropdownTemplateItem {
|
|
@@ -125,13 +124,13 @@ export interface DropdownTemplateItem {
|
|
|
125
124
|
*/
|
|
126
125
|
disabled?: boolean;
|
|
127
126
|
/**
|
|
128
|
-
* 좌측
|
|
127
|
+
* 좌측 콘텐츠
|
|
129
128
|
*/
|
|
130
|
-
|
|
129
|
+
left?: ReactNode;
|
|
131
130
|
/**
|
|
132
|
-
* 우측
|
|
131
|
+
* 우측 콘텐츠
|
|
133
132
|
*/
|
|
134
|
-
|
|
133
|
+
right?: ReactNode;
|
|
135
134
|
/**
|
|
136
135
|
* multi select 스타일 여부
|
|
137
136
|
*/
|
|
@@ -144,7 +143,7 @@ export interface DropdownTemplateItem {
|
|
|
144
143
|
* @property {DropdownTemplateItem[]} items 렌더링할 menu item 리스트
|
|
145
144
|
* @property {string[]} [selectedIds] 선택된 item id 배열
|
|
146
145
|
* @property {DropdownSize} [size="medium"] surface height scale
|
|
147
|
-
* @property {
|
|
146
|
+
* @property {DropdownPanelWidth} [width="match"] panel width 옵션
|
|
148
147
|
* @property {DropdownRootProps} [rootProps] Root 에 전달할 props
|
|
149
148
|
* @property {DropdownContainerProps} [containerProps] Container 에 전달할 props
|
|
150
149
|
* @property {DropdownMenuListProps} [menuListProps] MenuList 에 전달할 props
|
|
@@ -155,7 +154,7 @@ export interface DropdownTemplateProps {
|
|
|
155
154
|
selectedIds?: string[];
|
|
156
155
|
onSelect?: (item: DropdownTemplateItem) => void;
|
|
157
156
|
size?: DropdownSize;
|
|
158
|
-
|
|
157
|
+
width?: DropdownPanelWidth;
|
|
159
158
|
/**
|
|
160
159
|
* Root 에 전달할 props
|
|
161
160
|
*/
|
|
@@ -163,10 +162,7 @@ export interface DropdownTemplateProps {
|
|
|
163
162
|
/**
|
|
164
163
|
* Container 에 전달할 props
|
|
165
164
|
*/
|
|
166
|
-
containerProps?: Omit<
|
|
167
|
-
DropdownContainerProps,
|
|
168
|
-
"children" | "size" | "matchTriggerWidth"
|
|
169
|
-
>;
|
|
165
|
+
containerProps?: Omit<DropdownContainerProps, "children" | "size" | "width">;
|
|
170
166
|
/**
|
|
171
167
|
* MenuList 에 전달할 props
|
|
172
168
|
*/
|
|
@@ -43,7 +43,7 @@ const SelectDefault = forwardRef<HTMLElement, SelectDefaultComponentProps>(
|
|
|
43
43
|
selectedOptionIds,
|
|
44
44
|
onOptionSelect,
|
|
45
45
|
dropdownSize,
|
|
46
|
-
|
|
46
|
+
dropdownWidth = "match",
|
|
47
47
|
dropdownRootProps,
|
|
48
48
|
dropdownContainerProps,
|
|
49
49
|
dropdownMenuListProps,
|
|
@@ -117,7 +117,7 @@ const SelectDefault = forwardRef<HTMLElement, SelectDefaultComponentProps>(
|
|
|
117
117
|
<Dropdown.Container
|
|
118
118
|
{...dropdownContainerProps}
|
|
119
119
|
size={panelSize}
|
|
120
|
-
|
|
120
|
+
width={dropdownWidth}
|
|
121
121
|
>
|
|
122
122
|
<Dropdown.Menu.List {...dropdownMenuListProps}>
|
|
123
123
|
{/* Dropdown menu option들을 그대로 매핑해 선택 이벤트를 전달한다. */}
|
|
@@ -127,8 +127,8 @@ const SelectDefault = forwardRef<HTMLElement, SelectDefaultComponentProps>(
|
|
|
127
127
|
label={option.label}
|
|
128
128
|
description={option.description}
|
|
129
129
|
disabled={option.disabled}
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
left={option.left}
|
|
131
|
+
right={option.right}
|
|
132
132
|
multiple={Boolean(option.multiple)}
|
|
133
133
|
isSelected={resolvedSelectedIds.includes(option.id)}
|
|
134
134
|
onSelect={event => {
|
|
@@ -45,7 +45,7 @@ const SelectMultipleTrigger = forwardRef<
|
|
|
45
45
|
selectedOptionIds,
|
|
46
46
|
onOptionSelect,
|
|
47
47
|
dropdownSize,
|
|
48
|
-
|
|
48
|
+
dropdownWidth = "match",
|
|
49
49
|
dropdownRootProps,
|
|
50
50
|
dropdownContainerProps,
|
|
51
51
|
dropdownMenuListProps,
|
|
@@ -168,7 +168,7 @@ const SelectMultipleTrigger = forwardRef<
|
|
|
168
168
|
<Dropdown.Container
|
|
169
169
|
{...dropdownContainerProps}
|
|
170
170
|
size={panelSize}
|
|
171
|
-
|
|
171
|
+
width={dropdownWidth}
|
|
172
172
|
>
|
|
173
173
|
<Dropdown.Menu.List {...dropdownMenuListProps}>
|
|
174
174
|
{/* multi select 전용 옵션을 Dropdown.Menu.Item으로 노출한다. */}
|
|
@@ -178,8 +178,8 @@ const SelectMultipleTrigger = forwardRef<
|
|
|
178
178
|
label={option.label}
|
|
179
179
|
description={option.description}
|
|
180
180
|
disabled={option.disabled}
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
left={option.left}
|
|
182
|
+
right={option.right}
|
|
183
183
|
multiple
|
|
184
184
|
isSelected={resolvedSelectedIds.includes(option.id)}
|
|
185
185
|
onSelect={event => {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Select option 값 타입
|
|
5
|
+
* @typedef {string | number} SelectOptionValue
|
|
6
|
+
*/
|
|
7
|
+
export type SelectOptionValue = string | number;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Select option 데이터 구조; legacy SelectDataType과 호환되는 구조다.
|
|
11
|
+
* @property {string} key 렌더링 키
|
|
12
|
+
* @property {SelectOptionValue} value 실제 값
|
|
13
|
+
* @property {ReactNode} optionName 사용자 노출 라벨
|
|
14
|
+
* @property {boolean} [selected] 선택 여부
|
|
15
|
+
* @property {boolean} [disabled] 비활성 여부
|
|
16
|
+
* @property {OptionData} [data] 추가 데이터 payload
|
|
17
|
+
*/
|
|
18
|
+
export interface SelectOption<OptionData = unknown> {
|
|
19
|
+
/**
|
|
20
|
+
* 렌더링 키
|
|
21
|
+
*/
|
|
22
|
+
key: string;
|
|
23
|
+
/**
|
|
24
|
+
* 실제 값
|
|
25
|
+
*/
|
|
26
|
+
value: SelectOptionValue;
|
|
27
|
+
/**
|
|
28
|
+
* 사용자 노출 라벨
|
|
29
|
+
*/
|
|
30
|
+
optionName: ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* 선택 여부
|
|
33
|
+
*/
|
|
34
|
+
selected?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* 비활성 여부
|
|
37
|
+
*/
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 추가 데이터 payload
|
|
41
|
+
*/
|
|
42
|
+
data?: OptionData;
|
|
43
|
+
}
|
|
@@ -3,6 +3,7 @@ import type { ReactNode } from "react";
|
|
|
3
3
|
import type {
|
|
4
4
|
DropdownContainerProps,
|
|
5
5
|
DropdownMenuListProps,
|
|
6
|
+
DropdownPanelWidth,
|
|
6
7
|
DropdownRootProps,
|
|
7
8
|
DropdownTemplateItem,
|
|
8
9
|
} from "../../dropdown/types";
|
|
@@ -116,7 +117,7 @@ export interface SelectDropdownOption extends DropdownTemplateItem {}
|
|
|
116
117
|
* @property {string[]} [selectedOptionIds] 선택된 option id 리스트
|
|
117
118
|
* @property {(option: SelectDropdownOption) => void} [onOptionSelect] option 선택 콜백
|
|
118
119
|
* @property {SelectSize} [dropdownSize] dropdown surface size 스케일
|
|
119
|
-
* @property {
|
|
120
|
+
* @property {DropdownPanelWidth} [dropdownWidth="match"] dropdown panel width 옵션
|
|
120
121
|
* @property {DropdownRootProps} [dropdownRootProps] Dropdown.Root 전달 props(제어 props 제외)
|
|
121
122
|
* @property {DropdownContainerProps} [dropdownContainerProps] Dropdown.Container 전달 props(children/size 제외)
|
|
122
123
|
* @property {DropdownMenuListProps} [dropdownMenuListProps] Dropdown.Menu.List 전달 props
|
|
@@ -139,9 +140,9 @@ export interface SelectDropdownConfigProps {
|
|
|
139
140
|
*/
|
|
140
141
|
dropdownSize?: SelectSize;
|
|
141
142
|
/**
|
|
142
|
-
*
|
|
143
|
+
* dropdown panel width 옵션
|
|
143
144
|
*/
|
|
144
|
-
|
|
145
|
+
dropdownWidth?: DropdownPanelWidth;
|
|
145
146
|
/**
|
|
146
147
|
* Dropdown.Root 전달 props(제어 props 제외)
|
|
147
148
|
*/
|
|
@@ -154,7 +155,7 @@ export interface SelectDropdownConfigProps {
|
|
|
154
155
|
*/
|
|
155
156
|
dropdownContainerProps?: Omit<
|
|
156
157
|
DropdownContainerProps,
|
|
157
|
-
"children" | "size" | "
|
|
158
|
+
"children" | "size" | "width"
|
|
158
159
|
>;
|
|
159
160
|
/**
|
|
160
161
|
* Dropdown.Menu.List 전달 props
|