@uniai-fe/uds-primitives 0.3.19 → 0.3.21
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 +171 -87
- package/package.json +1 -1
- package/src/components/dropdown/markup/Template.tsx +20 -50
- package/src/components/dropdown/styles/dropdown.scss +44 -23
- package/src/components/dropdown/styles/variables.scss +25 -0
- package/src/components/dropdown/types/base.ts +2 -2
- package/src/components/dropdown/types/props.ts +0 -12
- package/src/components/select/hooks/interaction.ts +5 -5
- package/src/components/select/img/chevron/primary/xsmall.svg +3 -0
- package/src/components/select/markup/Default.tsx +183 -214
- package/src/components/select/markup/foundation/Base.tsx +16 -4
- package/src/components/select/markup/foundation/Icon.tsx +9 -3
- package/src/components/select/markup/foundation/Selected.tsx +115 -11
- package/src/components/select/markup/multiple/Multiple.tsx +64 -138
- package/src/components/select/styles/select.scss +128 -72
- package/src/components/select/styles/variables.scss +11 -0
- package/src/components/select/types/base.ts +3 -2
- package/src/components/select/types/icon.ts +34 -3
- package/src/components/select/types/interaction.ts +1 -1
- package/src/components/select/types/option.ts +0 -80
- package/src/components/select/types/props.ts +171 -96
- package/src/components/select/types/trigger.ts +54 -3
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ComponentPropsWithoutRef,
|
|
3
|
+
HTMLAttributes,
|
|
4
|
+
ReactNode,
|
|
5
|
+
} from "react";
|
|
2
6
|
import type { DropdownMenuProps } from "@radix-ui/react-dropdown-menu";
|
|
7
|
+
import type { UseFormRegisterReturn } from "react-hook-form";
|
|
3
8
|
|
|
4
9
|
import type {
|
|
5
10
|
DropdownContainerProps,
|
|
@@ -8,7 +13,7 @@ import type {
|
|
|
8
13
|
} from "../../dropdown/types";
|
|
9
14
|
import type { FormFieldWidth } from "../../form/types";
|
|
10
15
|
import type { SelectPriority, SelectSize, SelectState } from "./base";
|
|
11
|
-
import type { SelectDropdownOption
|
|
16
|
+
import type { SelectDropdownOption } from "./option";
|
|
12
17
|
import type {
|
|
13
18
|
SelectTriggerDefaultProps,
|
|
14
19
|
SelectTriggerMultipleProps,
|
|
@@ -24,7 +29,6 @@ import type {
|
|
|
24
29
|
export interface SelectStyleOptions {
|
|
25
30
|
/**
|
|
26
31
|
* priority scale
|
|
27
|
-
* - table 우선순위는 width 미지정 시 기본 block(full)로 동작한다.
|
|
28
32
|
*/
|
|
29
33
|
priority?: SelectPriority;
|
|
30
34
|
/**
|
|
@@ -69,13 +73,13 @@ export interface SelectValueOptions {
|
|
|
69
73
|
|
|
70
74
|
/**
|
|
71
75
|
* Select; 상태 옵션
|
|
72
|
-
* @property {boolean} [
|
|
76
|
+
* @property {boolean} [open] dropdown open 여부
|
|
73
77
|
*/
|
|
74
78
|
export interface SelectComponentState {
|
|
75
79
|
/**
|
|
76
80
|
* dropdown open 여부
|
|
77
81
|
*/
|
|
78
|
-
|
|
82
|
+
open?: boolean;
|
|
79
83
|
}
|
|
80
84
|
|
|
81
85
|
/**
|
|
@@ -83,6 +87,7 @@ export interface SelectComponentState {
|
|
|
83
87
|
* @property {string} [className] 사용자 정의 className
|
|
84
88
|
* @property {ReactNode} children trigger/Dropdown 등 내부 콘텐츠
|
|
85
89
|
* @property {boolean} [block] block 여부
|
|
90
|
+
* @property {FormFieldWidth} [width] width preset
|
|
86
91
|
*/
|
|
87
92
|
export interface SelectContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
88
93
|
/**
|
|
@@ -115,147 +120,222 @@ export interface SelectWidthOption {
|
|
|
115
120
|
}
|
|
116
121
|
|
|
117
122
|
/**
|
|
118
|
-
* Select
|
|
119
|
-
* @
|
|
120
|
-
* @property {
|
|
121
|
-
* @property {SelectSize} [size] size scale
|
|
122
|
-
* @property {SelectState} [state] visual state
|
|
123
|
-
* @property {boolean} [block] block 여부
|
|
124
|
-
* @property {ReactNode} [displayLabel] 선택된 라벨
|
|
125
|
-
* @property {ReactNode} [placeholder] placeholder 텍스트
|
|
126
|
-
* @property {ReactNode[]} [tags] multi select 태그 리스트
|
|
127
|
-
* @property {boolean} [multiple] multi select 여부
|
|
128
|
-
* @property {boolean} [isOpen] dropdown open 여부
|
|
129
|
-
* @property {FormFieldWidth} [width] width preset 옵션
|
|
130
|
-
*/
|
|
131
|
-
export type SelectProps = SelectStyleOptions &
|
|
132
|
-
SelectValueOptions &
|
|
133
|
-
SelectComponentState &
|
|
134
|
-
SelectWidthOption;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Select dropdown 옵션 구성 props; 옵션 모델/이벤트/하위호환 제어 축을 정의한다.
|
|
138
|
-
* @property {SelectDropdownOption[]} [options] dropdown option 리스트(권장: options[].selected로 초기값 선언)
|
|
139
|
-
* @property {string[]} [selectedOptionIds] 선택된 option id 리스트(legacy controlled)
|
|
140
|
-
* @property {(payload: SelectOptionChangePayload) => void} [onChange] 선택 결과 변경 콜백(권장)
|
|
141
|
-
* @property {(option: SelectDropdownOption) => void} [onOptionSelect] option 선택 콜백(legacy)
|
|
142
|
-
* @property {SelectSize} [dropdownSize] dropdown surface size 스케일
|
|
143
|
-
* @property {DropdownPanelWidth} [dropdownWidth="match"] dropdown panel width 옵션
|
|
144
|
-
* @property {DropdownMenuProps} [dropdownRootProps] Dropdown.Root 전달 props(제어 props 제외)
|
|
145
|
-
* @property {DropdownContainerProps} [dropdownContainerProps] Dropdown.Container 전달 props(children/size 제외)
|
|
146
|
-
* @property {DropdownMenuListProps} [dropdownMenuListProps] Dropdown.Menu.List 전달 props
|
|
147
|
-
* @property {ReactNode} [alt] option이 비어 있을 때 렌더링할 alternate 콘텐츠
|
|
123
|
+
* Select custom option props
|
|
124
|
+
* @property {string} [placeholder] 직접입력 모드 전용 placeholder
|
|
125
|
+
* @property {ReactNode} [optionName] dropdown의 "직접 입력" 옵션 문구
|
|
148
126
|
*/
|
|
149
|
-
export interface
|
|
127
|
+
export interface SelectCustomOptions {
|
|
150
128
|
/**
|
|
151
|
-
*
|
|
152
|
-
* -
|
|
129
|
+
* 직접입력 모드 전용 placeholder
|
|
130
|
+
* - 미지정 시 Select root placeholder를 재사용한다.
|
|
153
131
|
*/
|
|
154
|
-
|
|
132
|
+
placeholder?: string;
|
|
155
133
|
/**
|
|
156
|
-
*
|
|
157
|
-
*
|
|
134
|
+
* dropdown의 "직접 입력" 옵션 문구
|
|
135
|
+
* - 미지정 시 "직접 입력"을 기본값으로 사용한다.
|
|
158
136
|
*/
|
|
159
|
-
|
|
137
|
+
optionName?: ReactNode;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Select custom input props
|
|
142
|
+
* @property {ComponentPropsWithoutRef<"input">} [native] label input native 속성
|
|
143
|
+
*/
|
|
144
|
+
export interface SelectCustomInputProps extends ComponentPropsWithoutRef<"input"> {
|
|
145
|
+
placeholder?: never;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Select form register extension
|
|
150
|
+
* @property {UseFormRegisterReturn} [register] source field register(기본: hidden value input)
|
|
151
|
+
* @property {UseFormRegisterReturn} [customRegister] custom field register(직접입력 label input)
|
|
152
|
+
*/
|
|
153
|
+
export interface SelectFormRegisterExtension {
|
|
160
154
|
/**
|
|
161
|
-
*
|
|
162
|
-
* -
|
|
155
|
+
* source field register
|
|
156
|
+
* - Select value 제출 필드(`select-input-value`)에 연결한다.
|
|
163
157
|
*/
|
|
164
|
-
|
|
158
|
+
register?: UseFormRegisterReturn;
|
|
165
159
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
160
|
+
* custom field register
|
|
161
|
+
* - 직접입력 label 필드(`select-input-label`)에 연결한다.
|
|
168
162
|
*/
|
|
169
|
-
|
|
163
|
+
customRegister?: UseFormRegisterReturn;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Select callback params
|
|
168
|
+
* @property {SelectDropdownOption} [nextOption] 현재 상호작용한 option
|
|
169
|
+
* @property {SelectDropdownOption} [prevOption] 이전 기준 option
|
|
170
|
+
* @property {Event} [event] 원본 메뉴 선택 이벤트
|
|
171
|
+
*/
|
|
172
|
+
export type SelectCallbackParams = (
|
|
173
|
+
nextOption?: SelectDropdownOption,
|
|
174
|
+
prevOption?: SelectDropdownOption,
|
|
175
|
+
event?: Event,
|
|
176
|
+
) => void;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Select dropdown 확장 props
|
|
180
|
+
* @property {SelectSize} [size] dropdown surface size 스케일
|
|
181
|
+
* @property {DropdownPanelWidth} [width] dropdown panel width 옵션
|
|
182
|
+
* @property {Omit<DropdownMenuProps, "open" | "defaultOpen" | "onOpenChange">} [rootProps] Dropdown.Root 전달 props
|
|
183
|
+
* @property {Omit<DropdownContainerProps, "children" | "size" | "width">} [containerProps] Dropdown.Container 전달 props
|
|
184
|
+
* @property {DropdownMenuListProps} [menuListProps] Dropdown.Menu.List 전달 props
|
|
185
|
+
* @property {ReactNode} [alt] option이 비어 있을 때 렌더링할 alternate 콘텐츠
|
|
186
|
+
*/
|
|
187
|
+
export interface SelectDropdownExtension {
|
|
170
188
|
/**
|
|
171
189
|
* dropdown surface size 스케일
|
|
172
190
|
*/
|
|
173
|
-
|
|
191
|
+
size?: SelectSize;
|
|
174
192
|
/**
|
|
175
193
|
* dropdown panel width 옵션
|
|
176
194
|
*/
|
|
177
|
-
|
|
195
|
+
width?: DropdownPanelWidth;
|
|
178
196
|
/**
|
|
179
197
|
* Dropdown.Root 전달 props(제어 props 제외)
|
|
180
|
-
* - 타입 출처를 명확히 하기 위해 Radix 원본 타입을 직접 사용한다.
|
|
181
198
|
*/
|
|
182
|
-
|
|
183
|
-
DropdownMenuProps,
|
|
184
|
-
"open" | "defaultOpen" | "onOpenChange"
|
|
185
|
-
>;
|
|
199
|
+
rootProps?: Omit<DropdownMenuProps, "open" | "defaultOpen" | "onOpenChange">;
|
|
186
200
|
/**
|
|
187
|
-
* Dropdown.Container 전달 props(children/size 제외)
|
|
201
|
+
* Dropdown.Container 전달 props(children/size/width 제외)
|
|
188
202
|
*/
|
|
189
|
-
|
|
190
|
-
DropdownContainerProps,
|
|
191
|
-
"children" | "size" | "width"
|
|
192
|
-
>;
|
|
203
|
+
containerProps?: Omit<DropdownContainerProps, "children" | "size" | "width">;
|
|
193
204
|
/**
|
|
194
205
|
* Dropdown.Menu.List 전달 props
|
|
195
206
|
*/
|
|
196
|
-
|
|
207
|
+
menuListProps?: DropdownMenuListProps;
|
|
197
208
|
/**
|
|
198
|
-
*
|
|
209
|
+
* item이 비어 있을 때 렌더링할 alternate 콘텐츠
|
|
199
210
|
*/
|
|
200
211
|
alt?: ReactNode;
|
|
201
212
|
}
|
|
202
213
|
|
|
203
214
|
/**
|
|
204
|
-
* Select dropdown
|
|
215
|
+
* Select dropdown 옵션 구성 props
|
|
216
|
+
* @property {SelectDropdownOption[]} [items] dropdown item 리스트(권장: items[].selected 초기값)
|
|
217
|
+
* @property {SelectCallbackParams} [onSelectOption] option 선택 액션 콜백
|
|
218
|
+
* @property {SelectCallbackParams} [onSelectChange] 선택값 변경 콜백
|
|
219
|
+
* @property {SelectDropdownExtension} [dropdown] dropdown 확장 옵션
|
|
220
|
+
*/
|
|
221
|
+
export interface SelectDropdownConfigProps {
|
|
222
|
+
/**
|
|
223
|
+
* dropdown item 리스트
|
|
224
|
+
*/
|
|
225
|
+
items: SelectDropdownOption[];
|
|
226
|
+
/**
|
|
227
|
+
* option 선택 액션 콜백
|
|
228
|
+
*/
|
|
229
|
+
onSelectOption?: SelectCallbackParams;
|
|
230
|
+
/**
|
|
231
|
+
* 선택값 변경 콜백
|
|
232
|
+
*/
|
|
233
|
+
onSelectChange?: SelectCallbackParams;
|
|
234
|
+
/**
|
|
235
|
+
* dropdown 확장 옵션
|
|
236
|
+
*/
|
|
237
|
+
dropdownOptions?: SelectDropdownExtension;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Select dropdown 개방 제어 props
|
|
205
242
|
* @property {boolean} [open] dropdown open 상태
|
|
206
243
|
* @property {boolean} [defaultOpen] uncontrolled 초기 open 상태
|
|
207
|
-
* @property {(open: boolean) => void} [
|
|
244
|
+
* @property {(open: boolean) => void} [onOpen] open state change 콜백
|
|
208
245
|
*/
|
|
209
246
|
export interface SelectDropdownBehaviorProps {
|
|
210
247
|
/**
|
|
211
248
|
* dropdown open 상태
|
|
212
|
-
* - 값이 있으면 controlled open 모드로 동작한다.
|
|
213
249
|
*/
|
|
214
250
|
open?: boolean;
|
|
215
251
|
/**
|
|
216
252
|
* uncontrolled 초기 open 상태
|
|
217
|
-
* - open prop이 없을 때만 초기값으로 사용된다.
|
|
218
253
|
*/
|
|
219
254
|
defaultOpen?: boolean;
|
|
220
255
|
/**
|
|
221
256
|
* open state change 콜백
|
|
222
|
-
* - controlled/uncontrolled 모두에서 호출된다.
|
|
223
257
|
*/
|
|
224
|
-
|
|
258
|
+
onOpen?: (open: boolean) => void;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Select trigger native event props
|
|
263
|
+
* @property {HTMLAttributes<HTMLElement>} [triggerProps] trigger native 속성/이벤트
|
|
264
|
+
*/
|
|
265
|
+
export interface SelectTriggerEventProps {
|
|
266
|
+
/**
|
|
267
|
+
* trigger native 속성/이벤트
|
|
268
|
+
*/
|
|
269
|
+
triggerProps?: HTMLAttributes<HTMLElement>;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Select custom option extension
|
|
274
|
+
* @property {SelectCustomOptions} [customOptions] 직접 입력 옵션 구성
|
|
275
|
+
* @property {SelectCustomInputProps} [inputProps] 직접 입력 input 구성
|
|
276
|
+
*/
|
|
277
|
+
export interface SelectCustomOptionExtension {
|
|
278
|
+
/**
|
|
279
|
+
* 직접 입력 옵션 구성
|
|
280
|
+
*/
|
|
281
|
+
customOptions?: SelectCustomOptions;
|
|
282
|
+
/**
|
|
283
|
+
* 직접 입력 input 구성
|
|
284
|
+
*/
|
|
285
|
+
inputProps?: SelectCustomInputProps;
|
|
225
286
|
}
|
|
226
287
|
|
|
288
|
+
/**
|
|
289
|
+
* Select root props
|
|
290
|
+
* @property {SelectPriority} [priority] priority scale
|
|
291
|
+
* @property {SelectSize} [size] size scale
|
|
292
|
+
* @property {SelectState} [state] visual state
|
|
293
|
+
* @property {boolean} [block] block 여부
|
|
294
|
+
* @property {ReactNode} [displayLabel] 선택된 라벨
|
|
295
|
+
* @property {ReactNode} [placeholder] placeholder 텍스트
|
|
296
|
+
* @property {ReactNode[]} [tags] multi select 태그 리스트
|
|
297
|
+
* @property {boolean} [multiple] multi select 여부
|
|
298
|
+
* @property {boolean} [open] dropdown open 여부
|
|
299
|
+
* @property {FormFieldWidth} [width] width preset 옵션
|
|
300
|
+
*/
|
|
301
|
+
export type SelectProps = SelectStyleOptions &
|
|
302
|
+
SelectValueOptions &
|
|
303
|
+
SelectComponentState &
|
|
304
|
+
SelectWidthOption;
|
|
305
|
+
|
|
227
306
|
/**
|
|
228
307
|
* Select.Default 컴포넌트 props
|
|
229
|
-
* @typedef {SelectTriggerDefaultProps & SelectDropdownConfigProps & SelectDropdownBehaviorProps & SelectWidthOption} SelectDefaultComponentProps
|
|
230
308
|
* @property {ReactNode} [displayLabel] 선택된 라벨
|
|
231
309
|
* @property {ReactNode} [placeholder] placeholder 텍스트
|
|
232
310
|
* @property {SelectPriority} [priority] priority scale
|
|
233
311
|
* @property {SelectSize} [size] size scale
|
|
234
312
|
* @property {SelectState} [state] visual state
|
|
235
313
|
* @property {boolean} [block] block 여부
|
|
236
|
-
* @property {boolean} [
|
|
314
|
+
* @property {boolean} [open] dropdown open 여부
|
|
237
315
|
* @property {boolean} [disabled] disabled 여부
|
|
238
316
|
* @property {boolean} [readOnly] readOnly 여부
|
|
239
317
|
* @property {SelectTriggerButtonType} [buttonType] button type
|
|
240
318
|
* @property {FormFieldWidth} [width] width preset 옵션
|
|
241
|
-
* @property {SelectDropdownOption[]} [
|
|
242
|
-
* @property {
|
|
243
|
-
* @property {
|
|
244
|
-
* @property {
|
|
245
|
-
* @property {SelectSize} [dropdownSize] dropdown surface size 스케일
|
|
246
|
-
* @property {DropdownPanelWidth} [dropdownWidth="match"] dropdown panel width 옵션
|
|
247
|
-
* @property {Omit<DropdownMenuProps, "open" | "defaultOpen" | "onOpenChange">} [dropdownRootProps] Dropdown.Root 전달 props
|
|
248
|
-
* @property {Omit<DropdownContainerProps, "children" | "size" | "width">} [dropdownContainerProps] Dropdown.Container 전달 props
|
|
249
|
-
* @property {DropdownMenuListProps} [dropdownMenuListProps] Dropdown.Menu.List 전달 props
|
|
250
|
-
* @property {ReactNode} [alt] option이 비어 있을 때 렌더링할 alternate 콘텐츠
|
|
319
|
+
* @property {SelectDropdownOption[]} [items] dropdown item 리스트
|
|
320
|
+
* @property {SelectCallbackParams} [onSelectOption] option 선택 액션 콜백
|
|
321
|
+
* @property {SelectCallbackParams} [onSelectChange] 선택값 변경 콜백
|
|
322
|
+
* @property {SelectDropdownExtension} [dropdown] dropdown 확장 옵션
|
|
251
323
|
* @property {boolean} [open] dropdown open 상태
|
|
252
324
|
* @property {boolean} [defaultOpen] uncontrolled 초기 open 상태
|
|
253
|
-
* @property {(open: boolean) => void} [
|
|
325
|
+
* @property {(open: boolean) => void} [onOpen] open state change 콜백
|
|
326
|
+
* @property {HTMLAttributes<HTMLElement>} [triggerProps] trigger native 속성/이벤트
|
|
327
|
+
* @property {SelectCustomOptions} [customOptions] 직접 입력 옵션 구성
|
|
328
|
+
* @property {SelectCustomInputProps} [inputProps] 직접 입력 input 구성
|
|
329
|
+
* @property {UseFormRegisterReturn} [register] source field register
|
|
330
|
+
* @property {UseFormRegisterReturn} [customRegister] custom field register
|
|
254
331
|
*/
|
|
255
332
|
export type SelectDefaultComponentProps = SelectTriggerDefaultProps &
|
|
256
333
|
SelectDropdownConfigProps &
|
|
257
334
|
SelectDropdownBehaviorProps &
|
|
258
|
-
SelectWidthOption
|
|
335
|
+
SelectWidthOption &
|
|
336
|
+
SelectTriggerEventProps &
|
|
337
|
+
SelectCustomOptionExtension &
|
|
338
|
+
SelectFormRegisterExtension;
|
|
259
339
|
|
|
260
340
|
/**
|
|
261
341
|
* Select.Multiple 전체 선택 옵션 props
|
|
@@ -275,7 +355,6 @@ export interface SelectMultipleAllOptionProps {
|
|
|
275
355
|
|
|
276
356
|
/**
|
|
277
357
|
* Select.Multiple 컴포넌트 props
|
|
278
|
-
* @typedef {SelectTriggerMultipleProps & SelectDropdownConfigProps & SelectDropdownBehaviorProps & SelectWidthOption & SelectMultipleAllOptionProps} SelectMultipleComponentProps
|
|
279
358
|
* @property {ReactNode} [displayLabel] 선택된 라벨
|
|
280
359
|
* @property {ReactNode} [placeholder] placeholder 텍스트
|
|
281
360
|
* @property {SelectMultipleTag[]} [tags] multi select tag 리스트
|
|
@@ -283,23 +362,18 @@ export interface SelectMultipleAllOptionProps {
|
|
|
283
362
|
* @property {SelectSize} [size] size scale
|
|
284
363
|
* @property {SelectState} [state] visual state
|
|
285
364
|
* @property {boolean} [block] block 여부
|
|
286
|
-
* @property {boolean} [
|
|
365
|
+
* @property {boolean} [open] dropdown open 여부
|
|
287
366
|
* @property {boolean} [disabled] disabled 여부
|
|
288
367
|
* @property {boolean} [readOnly] readOnly 여부
|
|
289
368
|
* @property {FormFieldWidth} [width] width preset 옵션
|
|
290
|
-
* @property {SelectDropdownOption[]} [
|
|
291
|
-
* @property {
|
|
292
|
-
* @property {
|
|
293
|
-
* @property {
|
|
294
|
-
* @property {SelectSize} [dropdownSize] dropdown surface size 스케일
|
|
295
|
-
* @property {DropdownPanelWidth} [dropdownWidth="match"] dropdown panel width 옵션
|
|
296
|
-
* @property {Omit<DropdownMenuProps, "open" | "defaultOpen" | "onOpenChange">} [dropdownRootProps] Dropdown.Root 전달 props
|
|
297
|
-
* @property {Omit<DropdownContainerProps, "children" | "size" | "width">} [dropdownContainerProps] Dropdown.Container 전달 props
|
|
298
|
-
* @property {DropdownMenuListProps} [dropdownMenuListProps] Dropdown.Menu.List 전달 props
|
|
299
|
-
* @property {ReactNode} [alt] option이 비어 있을 때 렌더링할 alternate 콘텐츠
|
|
369
|
+
* @property {SelectDropdownOption[]} [items] dropdown item 리스트
|
|
370
|
+
* @property {SelectCallbackParams} [onSelectOption] option 선택 액션 콜백
|
|
371
|
+
* @property {SelectCallbackParams} [onSelectChange] 선택값 변경 콜백
|
|
372
|
+
* @property {SelectDropdownExtension} [dropdown] dropdown 확장 옵션
|
|
300
373
|
* @property {boolean} [open] dropdown open 상태
|
|
301
374
|
* @property {boolean} [defaultOpen] uncontrolled 초기 open 상태
|
|
302
|
-
* @property {(open: boolean) => void} [
|
|
375
|
+
* @property {(open: boolean) => void} [onOpen] open state change 콜백
|
|
376
|
+
* @property {HTMLAttributes<HTMLElement>} [triggerProps] trigger native 속성/이벤트
|
|
303
377
|
* @property {boolean} [showSelectAllOption] dropdown 첫 행에 "전체" 옵션 노출 여부
|
|
304
378
|
* @property {ReactNode} [selectAllLabel] "전체" 옵션 라벨 커스터마이징
|
|
305
379
|
*/
|
|
@@ -307,4 +381,5 @@ export type SelectMultipleComponentProps = SelectTriggerMultipleProps &
|
|
|
307
381
|
SelectDropdownConfigProps &
|
|
308
382
|
SelectDropdownBehaviorProps &
|
|
309
383
|
SelectWidthOption &
|
|
310
|
-
SelectMultipleAllOptionProps
|
|
384
|
+
SelectMultipleAllOptionProps &
|
|
385
|
+
SelectTriggerEventProps;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ComponentPropsWithoutRef,
|
|
3
|
+
ElementType,
|
|
4
|
+
HTMLAttributes,
|
|
5
|
+
ReactNode,
|
|
6
|
+
} from "react";
|
|
7
|
+
import type { UseFormRegisterReturn } from "react-hook-form";
|
|
8
|
+
import type { SelectOptionValue } from "./option";
|
|
2
9
|
|
|
3
10
|
import type {
|
|
4
11
|
SelectPriority,
|
|
@@ -32,6 +39,7 @@ export interface SelectTriggerBaseProps extends HTMLAttributes<HTMLElement> {
|
|
|
32
39
|
priority?: SelectPriority;
|
|
33
40
|
/**
|
|
34
41
|
* size scale
|
|
42
|
+
* - xsmall (primary 전용)
|
|
35
43
|
* - small
|
|
36
44
|
* - medium
|
|
37
45
|
* - large
|
|
@@ -101,6 +109,7 @@ export interface SelectTriggerDefaultProps extends HTMLAttributes<HTMLElement> {
|
|
|
101
109
|
priority?: SelectPriority;
|
|
102
110
|
/**
|
|
103
111
|
* size scale
|
|
112
|
+
* - xsmall (primary 전용)
|
|
104
113
|
* - small
|
|
105
114
|
* - medium
|
|
106
115
|
* - large
|
|
@@ -120,7 +129,7 @@ export interface SelectTriggerDefaultProps extends HTMLAttributes<HTMLElement> {
|
|
|
120
129
|
/**
|
|
121
130
|
* dropdown open 여부
|
|
122
131
|
*/
|
|
123
|
-
|
|
132
|
+
open?: boolean;
|
|
124
133
|
/**
|
|
125
134
|
* disabled 여부
|
|
126
135
|
*/
|
|
@@ -161,6 +170,7 @@ export interface SelectTriggerMultipleProps extends HTMLAttributes<HTMLElement>
|
|
|
161
170
|
priority?: SelectPriority;
|
|
162
171
|
/**
|
|
163
172
|
* size scale
|
|
173
|
+
* - xsmall (primary 전용)
|
|
164
174
|
* - small
|
|
165
175
|
* - medium
|
|
166
176
|
* - large
|
|
@@ -180,7 +190,7 @@ export interface SelectTriggerMultipleProps extends HTMLAttributes<HTMLElement>
|
|
|
180
190
|
/**
|
|
181
191
|
* dropdown open 여부
|
|
182
192
|
*/
|
|
183
|
-
|
|
193
|
+
open?: boolean;
|
|
184
194
|
/**
|
|
185
195
|
* disabled 여부
|
|
186
196
|
*/
|
|
@@ -196,6 +206,14 @@ export interface SelectTriggerMultipleProps extends HTMLAttributes<HTMLElement>
|
|
|
196
206
|
* @property {ReactNode} [label] 표시할 라벨
|
|
197
207
|
* @property {ReactNode} [placeholder] placeholder 텍스트
|
|
198
208
|
* @property {boolean} [isPlaceholder] placeholder 상태 여부
|
|
209
|
+
* @property {boolean} [readOnly] readOnly 여부
|
|
210
|
+
* @property {UseFormRegisterReturn} [register] source field register
|
|
211
|
+
* @property {UseFormRegisterReturn} [customRegister] custom field register
|
|
212
|
+
* @property {ComponentPropsWithoutRef<"input">} [inputProps] label input native 속성
|
|
213
|
+
* @property {string} [valueText] label input 표시 문자열
|
|
214
|
+
* @property {SelectOptionValue | ""} [valueFieldValue] hidden value input 값
|
|
215
|
+
* @property {boolean} [shouldFocusInput] custom mode 진입 시 label input focus 여부
|
|
216
|
+
* @property {(value: string) => void} [onLabelChange] label 입력 변경 콜백
|
|
199
217
|
*/
|
|
200
218
|
export interface SelectSelectedProps {
|
|
201
219
|
/**
|
|
@@ -210,4 +228,37 @@ export interface SelectSelectedProps {
|
|
|
210
228
|
* placeholder 상태 여부
|
|
211
229
|
*/
|
|
212
230
|
isPlaceholder?: boolean;
|
|
231
|
+
/**
|
|
232
|
+
* readOnly 여부
|
|
233
|
+
*/
|
|
234
|
+
readOnly?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* source field register
|
|
237
|
+
*/
|
|
238
|
+
register?: UseFormRegisterReturn;
|
|
239
|
+
/**
|
|
240
|
+
* custom field register
|
|
241
|
+
*/
|
|
242
|
+
customRegister?: UseFormRegisterReturn;
|
|
243
|
+
/**
|
|
244
|
+
* label input native 속성
|
|
245
|
+
* - placeholder는 root/customOptions 경로가 우선하므로 제외한다.
|
|
246
|
+
*/
|
|
247
|
+
inputProps?: Omit<ComponentPropsWithoutRef<"input">, "placeholder">;
|
|
248
|
+
/**
|
|
249
|
+
* label input 표시 문자열
|
|
250
|
+
*/
|
|
251
|
+
valueText?: string;
|
|
252
|
+
/**
|
|
253
|
+
* hidden value input 값
|
|
254
|
+
*/
|
|
255
|
+
valueFieldValue?: SelectOptionValue | "";
|
|
256
|
+
/**
|
|
257
|
+
* custom mode 진입 시 label input focus 여부
|
|
258
|
+
*/
|
|
259
|
+
shouldFocusInput?: boolean;
|
|
260
|
+
/**
|
|
261
|
+
* label 입력 변경 콜백
|
|
262
|
+
*/
|
|
263
|
+
onLabelChange?: (value: string) => void;
|
|
213
264
|
}
|