@uniai-fe/uds-primitives 0.1.13 → 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/README.md +2 -2
- package/dist/styles.css +1112 -385
- package/package.json +12 -15
- package/src/components/button/index.scss +1 -0
- package/src/components/button/markup/{ButtonRounded.tsx → Rounded.tsx} +1 -1
- package/src/components/button/markup/{ButtonText.tsx → Text.tsx} +1 -1
- package/src/components/button/markup/index.ts +3 -3
- package/src/components/button/styles/button.scss +113 -229
- package/src/components/button/styles/round-button.scss +11 -14
- package/src/components/button/styles/text-button.scss +23 -23
- package/src/components/button/styles/variables.scss +145 -0
- package/src/components/dropdown/index.tsx +3 -3
- package/src/components/dropdown/markup/Template.tsx +57 -0
- package/src/components/dropdown/markup/foundation/Container.tsx +125 -0
- package/src/components/dropdown/markup/foundation/MenuItem.tsx +107 -0
- package/src/components/dropdown/markup/foundation/MenuList.tsx +27 -0
- package/src/components/dropdown/markup/foundation/Provider.tsx +46 -0
- package/src/components/dropdown/markup/foundation/Root.tsx +30 -0
- package/src/components/dropdown/markup/foundation/Trigger.tsx +34 -0
- package/src/components/dropdown/markup/foundation/index.tsx +25 -0
- package/src/components/dropdown/markup/index.tsx +8 -2
- package/src/components/dropdown/styles/dropdown.scss +166 -0
- package/src/components/dropdown/styles/index.scss +2 -0
- package/src/components/dropdown/styles/variables.scss +40 -0
- package/src/components/dropdown/types/base.ts +31 -0
- package/src/components/dropdown/types/index.ts +2 -4
- package/src/components/dropdown/types/props.ts +170 -0
- package/src/components/dropdown/utils/index.ts +1 -4
- package/src/components/dropdown/utils/refs.ts +20 -0
- package/src/components/form/index.scss +1 -0
- package/src/components/form/index.tsx +18 -2
- package/src/components/form/markup/form-field/Body.tsx +18 -0
- package/src/components/form/markup/form-field/Container.tsx +58 -0
- package/src/components/form/markup/form-field/Footer.tsx +21 -0
- package/src/components/form/markup/form-field/Header.tsx +39 -0
- package/src/components/form/markup/form-field/Template.tsx +56 -0
- package/src/components/form/markup/form-field/index.tsx +22 -0
- package/src/components/form/styles/form-field/layout.scss +67 -0
- package/src/components/form/styles/form-field/variables.scss +17 -0
- package/src/components/form/styles/index.scss +2 -0
- package/src/components/form/types/index.ts +1 -0
- package/src/components/form/types/props.ts +125 -0
- package/src/components/form/utils/form-field.ts +42 -0
- package/src/components/input/hooks/index.ts +1 -4
- package/src/components/input/hooks/useDigitField.ts +63 -0
- package/src/components/input/img/calendar/calendar.svg +7 -0
- package/src/components/input/img/calendar/chevron-down.svg +3 -0
- package/src/components/input/img/calendar/chevron-left.svg +3 -0
- package/src/components/input/img/calendar/chevron-right.svg +3 -0
- package/src/components/input/img/calendar/chevron-up.svg +3 -0
- package/src/components/input/index.tsx +2 -1
- package/src/components/input/markup/calendar/Base.tsx +329 -0
- package/src/components/input/markup/calendar/index.tsx +8 -0
- package/src/components/input/markup/{text/InputUtilityButton.tsx → foundation/Button.tsx} +5 -15
- package/src/components/input/markup/foundation/Input.tsx +245 -0
- package/src/components/input/markup/foundation/SideSlot.tsx +30 -0
- package/src/components/input/markup/foundation/StatusIcon.tsx +21 -0
- package/src/components/input/markup/foundation/Utility.tsx +103 -0
- package/src/components/input/markup/foundation/index.tsx +15 -0
- package/src/components/input/markup/index.tsx +11 -1
- package/src/components/input/markup/text/AuthCode.tsx +41 -59
- package/src/components/input/markup/text/Email.tsx +25 -115
- package/src/components/input/markup/text/Password.tsx +30 -39
- package/src/components/input/markup/text/Phone.tsx +35 -122
- package/src/components/input/markup/text/Search.tsx +17 -18
- package/src/components/input/markup/text/index.ts +15 -12
- package/src/components/input/styles/calendar.scss +110 -0
- package/src/components/input/styles/foundation.scss +345 -0
- package/src/components/input/styles/index.scss +4 -476
- package/src/components/input/styles/text.scss +89 -0
- package/src/components/input/styles/variables.scss +41 -0
- package/src/components/input/types/calendar.ts +208 -0
- package/src/components/input/types/foundation.ts +194 -0
- package/src/components/input/types/hooks.ts +43 -0
- package/src/components/input/types/index.ts +5 -87
- package/src/components/input/types/text.ts +203 -0
- package/src/components/input/types/verification.ts +23 -0
- package/src/components/input/utils/index.tsx +1 -0
- package/src/components/input/utils/verification.tsx +35 -0
- package/src/components/select/hooks/index.ts +43 -2
- package/src/components/select/img/chevron/primary/large.svg +3 -0
- package/src/components/select/img/chevron/primary/medium.svg +3 -0
- package/src/components/select/img/chevron/primary/small.svg +3 -0
- package/src/components/select/img/chevron/secondary/large.svg +3 -0
- package/src/components/select/img/chevron/secondary/medium.svg +3 -0
- package/src/components/select/img/chevron/secondary/small.svg +3 -0
- package/src/components/select/img/remove.svg +3 -0
- package/src/components/select/index.scss +2 -1
- package/src/components/select/index.tsx +5 -0
- package/src/components/select/markup/Default.tsx +154 -0
- package/src/components/select/markup/foundation/Base.tsx +90 -0
- package/src/components/select/markup/foundation/Container.tsx +30 -0
- package/src/components/select/markup/foundation/Icon.tsx +78 -0
- package/src/components/select/markup/foundation/Selected.tsx +34 -0
- package/src/components/select/markup/foundation/index.ts +2 -0
- package/src/components/select/markup/index.tsx +36 -2
- package/src/components/select/markup/multiple/Multiple.tsx +205 -0
- package/src/components/select/markup/multiple/SelectedChip.tsx +58 -0
- package/src/components/select/markup/multiple/index.ts +2 -0
- package/src/components/select/styles/select.scss +316 -0
- package/src/components/select/styles/variables.scss +91 -0
- package/src/components/select/types/base.ts +34 -0
- package/src/components/select/types/icon.ts +45 -0
- package/src/components/select/types/index.ts +6 -4
- package/src/components/select/types/multiple.ts +57 -0
- package/src/components/select/types/option.ts +43 -0
- package/src/components/select/types/props.ts +209 -0
- package/src/components/select/types/trigger.ts +196 -0
- package/src/index.scss +3 -2
- package/src/components/input/markup/text/Base.tsx +0 -454
- package/src/components/input/utils/index.ts +0 -60
- package/src/components/select/styles/index.scss +0 -0
- /package/src/components/button/markup/{ButtonDefault.tsx → Base.tsx} +0 -0
- /package/src/components/form/{Provider.tsx → markup/Provider.tsx} +0 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DatePickerProps as MantineDatePickerProps,
|
|
3
|
+
DatePickerType,
|
|
4
|
+
DatePickerValue,
|
|
5
|
+
} from "@mantine/dates";
|
|
6
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
7
|
+
import type { UseFormRegisterReturn } from "react-hook-form";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Calendar 모드; 날짜/시간 조합을 구분한다.
|
|
11
|
+
*/
|
|
12
|
+
export type InputCalendarMode = "date" | "date-time" | "time";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Calendar가 한 번에 렌더링할 열 개수.
|
|
16
|
+
* 단일/듀얼 달력을 명시적으로 구분한다.
|
|
17
|
+
*/
|
|
18
|
+
export type InputCalendarColumns = 1 | 2;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Mantine DatePicker 값 타입을 문자열 기반으로 재정의한다.
|
|
22
|
+
*/
|
|
23
|
+
export type InputCalendarValue<Type extends DatePickerType = "default"> =
|
|
24
|
+
DatePickerValue<Type, string>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Calendar 값 변경 핸들러 시그니처.
|
|
28
|
+
* @template Type Mantine DatePickerType string literal
|
|
29
|
+
* @property {InputCalendarValue<Type>} value 현재 선택된 값
|
|
30
|
+
*/
|
|
31
|
+
export type InputCalendarOnChange<Type extends DatePickerType = "default"> = (
|
|
32
|
+
value: InputCalendarValue<Type>,
|
|
33
|
+
) => void;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* footer 버튼 기본 속성.
|
|
37
|
+
* 공통 disabled/label 정책을 공유한다.
|
|
38
|
+
* @property {ReactNode} [label] 버튼 라벨
|
|
39
|
+
* @property {boolean} [disabled] 버튼 disabled 상태
|
|
40
|
+
* @property {boolean} [visible] 버튼 노출 여부. false면 숨김
|
|
41
|
+
*/
|
|
42
|
+
export interface InputCalendarActionButtonProps {
|
|
43
|
+
/**
|
|
44
|
+
* 버튼 라벨
|
|
45
|
+
*/
|
|
46
|
+
label?: ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* 버튼 disabled 상태
|
|
49
|
+
*/
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* 버튼 노출 여부. false면 숨김
|
|
53
|
+
*/
|
|
54
|
+
visible?: boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* footer 액션 핸들러 묶음.
|
|
59
|
+
* @property {() => void} [onClear] 삭제 버튼 클릭 시 호출
|
|
60
|
+
* @property {() => void} [onToday] 오늘 버튼 클릭 시 호출
|
|
61
|
+
* @property {(value: InputCalendarValue) => void} [onApply] 적용 버튼 클릭 시 호출
|
|
62
|
+
*/
|
|
63
|
+
export interface InputCalendarActionHandlers<
|
|
64
|
+
Type extends DatePickerType = "default",
|
|
65
|
+
> {
|
|
66
|
+
/**
|
|
67
|
+
* 삭제/초기화 버튼 핸들러
|
|
68
|
+
*/
|
|
69
|
+
onClear?: () => void;
|
|
70
|
+
/**
|
|
71
|
+
* 오늘 버튼 핸들러
|
|
72
|
+
*/
|
|
73
|
+
onToday?: () => void;
|
|
74
|
+
/**
|
|
75
|
+
* 적용 버튼 핸들러 (현재 값 전달)
|
|
76
|
+
*/
|
|
77
|
+
onApply?: InputCalendarOnChange<Type>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* footer 액션 구성을 선언한다.
|
|
82
|
+
* @property {InputCalendarActionButtonProps} [clear] 삭제 버튼 옵션
|
|
83
|
+
* @property {InputCalendarActionButtonProps} [today] 오늘 버튼 옵션
|
|
84
|
+
* @property {InputCalendarActionButtonProps} [apply] 적용 버튼 옵션
|
|
85
|
+
*/
|
|
86
|
+
export interface InputCalendarActionOptions {
|
|
87
|
+
/**
|
|
88
|
+
* 삭제/초기화 버튼 옵션
|
|
89
|
+
*/
|
|
90
|
+
clear?: InputCalendarActionButtonProps;
|
|
91
|
+
/**
|
|
92
|
+
* 오늘 버튼 옵션
|
|
93
|
+
*/
|
|
94
|
+
today?: InputCalendarActionButtonProps;
|
|
95
|
+
/**
|
|
96
|
+
* 적용 버튼 옵션
|
|
97
|
+
*/
|
|
98
|
+
apply?: InputCalendarActionButtonProps;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Mantine DatePicker props 중 Input 레이어에서 그대로 노출하지 않을 항목을 제외한 타입.
|
|
103
|
+
*/
|
|
104
|
+
export type InputCalendarMantineProps<Type extends DatePickerType = "default"> =
|
|
105
|
+
Partial<
|
|
106
|
+
Omit<
|
|
107
|
+
MantineDatePickerProps<Type>,
|
|
108
|
+
"value" | "defaultValue" | "onChange" | "type" | "classNames" | "styles"
|
|
109
|
+
>
|
|
110
|
+
>;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Calendar trigger(Input) 영역에서 필요한 속성 묶음.
|
|
114
|
+
* FormField와의 조합을 고려해 label/helper 등을 상위 Template에 위임한다.
|
|
115
|
+
* @property {string} [id] trigger id (label htmlFor 연동)
|
|
116
|
+
* @property {string} [name] form name; register 미사용 시 수동 지정
|
|
117
|
+
* @property {UseFormRegisterReturn} [register] react-hook-form register 결과
|
|
118
|
+
* @property {ReactNode} [placeholder] trigger 내부 placeholder
|
|
119
|
+
* @property {string} [triggerClassName] trigger className (예: InputFoundation box)
|
|
120
|
+
*/
|
|
121
|
+
export interface InputCalendarTriggerProps extends Pick<
|
|
122
|
+
ComponentPropsWithoutRef<"button">,
|
|
123
|
+
"onClick" | "disabled"
|
|
124
|
+
> {
|
|
125
|
+
/**
|
|
126
|
+
* trigger id (label htmlFor 연동)
|
|
127
|
+
*/
|
|
128
|
+
id?: string;
|
|
129
|
+
/**
|
|
130
|
+
* form name; register 미사용 시 수동 지정
|
|
131
|
+
*/
|
|
132
|
+
name?: string;
|
|
133
|
+
/**
|
|
134
|
+
* react-hook-form register 결과
|
|
135
|
+
*/
|
|
136
|
+
register?: UseFormRegisterReturn;
|
|
137
|
+
/**
|
|
138
|
+
* trigger 내부 placeholder
|
|
139
|
+
*/
|
|
140
|
+
placeholder?: ReactNode;
|
|
141
|
+
/**
|
|
142
|
+
* trigger className (예: InputFoundation box)
|
|
143
|
+
*/
|
|
144
|
+
triggerClassName?: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Input Calendar core props.
|
|
149
|
+
* @property {InputCalendarMode} [mode="date"] 날짜/시간 모드
|
|
150
|
+
* @property {DatePickerType} [type="default"] Mantine range/multiple 모드
|
|
151
|
+
* @property {InputCalendarColumns} [columns=1] 동시에 노출할 달력 열 수
|
|
152
|
+
* @property {InputCalendarValue} [value] 제어형 값
|
|
153
|
+
* @property {InputCalendarValue} [defaultValue] 비제어 초기값
|
|
154
|
+
* @property {InputCalendarOnChange} [onChange] 값 변경 핸들러(직렬화 문자열 기준)
|
|
155
|
+
* @property {InputCalendarOnChange} [onValueChange] onChange 별칭(추가 파이프라인용)
|
|
156
|
+
* @property {boolean} [readOnly] 읽기 전용 여부
|
|
157
|
+
* @property {boolean} [disabled] disabled 여부
|
|
158
|
+
* @property {InputCalendarMantineProps} [datePickerProps] Mantine DatePicker 직접 옵션
|
|
159
|
+
* @property {InputCalendarActionOptions} [actions] footer 액션 옵션
|
|
160
|
+
* @property {InputCalendarActionHandlers} [actionHandlers] footer 버튼 핸들러
|
|
161
|
+
*/
|
|
162
|
+
export interface InputCalendarProps<Type extends DatePickerType = "default">
|
|
163
|
+
extends InputCalendarActionHandlers<Type>, InputCalendarTriggerProps {
|
|
164
|
+
/**
|
|
165
|
+
* 날짜/시간 모드
|
|
166
|
+
*/
|
|
167
|
+
mode?: InputCalendarMode;
|
|
168
|
+
/**
|
|
169
|
+
* Mantine DatePicker type
|
|
170
|
+
*/
|
|
171
|
+
type?: Type;
|
|
172
|
+
/**
|
|
173
|
+
* 동시에 노출할 달력 열 수
|
|
174
|
+
*/
|
|
175
|
+
columns?: InputCalendarColumns;
|
|
176
|
+
/**
|
|
177
|
+
* 제어형 값
|
|
178
|
+
*/
|
|
179
|
+
value?: InputCalendarValue<Type>;
|
|
180
|
+
/**
|
|
181
|
+
* 비제어 초기값
|
|
182
|
+
*/
|
|
183
|
+
defaultValue?: InputCalendarValue<Type>;
|
|
184
|
+
/**
|
|
185
|
+
* 값 변경 핸들러
|
|
186
|
+
*/
|
|
187
|
+
onChange?: InputCalendarOnChange<Type>;
|
|
188
|
+
/**
|
|
189
|
+
* onChange 별칭; 외부 파이프라인 시 사용
|
|
190
|
+
*/
|
|
191
|
+
onValueChange?: InputCalendarOnChange<Type>;
|
|
192
|
+
/**
|
|
193
|
+
* 읽기 전용 여부
|
|
194
|
+
*/
|
|
195
|
+
readOnly?: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* disabled 여부
|
|
198
|
+
*/
|
|
199
|
+
disabled?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Mantine DatePicker 옵션
|
|
202
|
+
*/
|
|
203
|
+
datePickerProps?: InputCalendarMantineProps<Type>;
|
|
204
|
+
/**
|
|
205
|
+
* footer 버튼 옵션
|
|
206
|
+
*/
|
|
207
|
+
actions?: InputCalendarActionOptions;
|
|
208
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ComponentPropsWithoutRef,
|
|
3
|
+
MouseEvent,
|
|
4
|
+
PointerEvent,
|
|
5
|
+
ReactNode,
|
|
6
|
+
} from "react";
|
|
7
|
+
import type { UseFormRegisterReturn } from "react-hook-form";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* input; priority option
|
|
11
|
+
*/
|
|
12
|
+
export type InputPriority = "primary" | "secondary" | "tertiary";
|
|
13
|
+
/**
|
|
14
|
+
* input; size option
|
|
15
|
+
*/
|
|
16
|
+
export type InputSize = "small" | "medium" | "large";
|
|
17
|
+
/**
|
|
18
|
+
* input; state option
|
|
19
|
+
*/
|
|
20
|
+
export type InputState =
|
|
21
|
+
| "default"
|
|
22
|
+
| "active"
|
|
23
|
+
| "focused"
|
|
24
|
+
| "success"
|
|
25
|
+
| "error"
|
|
26
|
+
| "disabled"
|
|
27
|
+
| "loading";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* priority 축은 tokens 기반 테마 계층을 지정한다.
|
|
31
|
+
*/
|
|
32
|
+
export const INPUT_PRIORITIES: InputPriority[] = [
|
|
33
|
+
"primary",
|
|
34
|
+
"secondary",
|
|
35
|
+
"tertiary",
|
|
36
|
+
];
|
|
37
|
+
/**
|
|
38
|
+
* size 축은 높이/타이포/spacing을 결정한다.
|
|
39
|
+
*/
|
|
40
|
+
export const INPUT_SIZES: InputSize[] = ["small", "medium", "large"];
|
|
41
|
+
/**
|
|
42
|
+
* 시각 상태는 success/error/disabled 를 포함한다.
|
|
43
|
+
*/
|
|
44
|
+
export const INPUT_STATES: InputState[] = [
|
|
45
|
+
"default",
|
|
46
|
+
"active",
|
|
47
|
+
"focused",
|
|
48
|
+
"success",
|
|
49
|
+
"error",
|
|
50
|
+
"disabled",
|
|
51
|
+
"loading",
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
type NativeInputProps = ComponentPropsWithoutRef<"input">;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* input; icon options
|
|
58
|
+
* @property {React.ReactNode} [left] input 왼쪽 컨텐츠
|
|
59
|
+
* @property {React.ReactNode} [right] input 오른쪽 컨텐츠
|
|
60
|
+
* @property {React.ReactNode} [clear] input reset버튼 커스텀 컨텐츠
|
|
61
|
+
* @property {React.ReactNode} [success] input 입력상태 성공시 커스텀 컨텐츠
|
|
62
|
+
* @property {React.ReactNode} [error] input 입력상태 에러시 커스텀 컨텐츠
|
|
63
|
+
*/
|
|
64
|
+
export interface InputIcon {
|
|
65
|
+
/**
|
|
66
|
+
* 왼쪽 슬롯 콘텐츠
|
|
67
|
+
*/
|
|
68
|
+
left?: React.ReactNode;
|
|
69
|
+
/**
|
|
70
|
+
* 오른쪽 슬롯 콘텐츠
|
|
71
|
+
*/
|
|
72
|
+
right?: React.ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* clear 버튼 아이콘
|
|
75
|
+
*/
|
|
76
|
+
clear?: React.ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* success 상태 아이콘
|
|
79
|
+
*/
|
|
80
|
+
success?: React.ReactNode;
|
|
81
|
+
/**
|
|
82
|
+
* error 상태 아이콘
|
|
83
|
+
*/
|
|
84
|
+
error?: React.ReactNode;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Input; input base props
|
|
89
|
+
* @property {NativeInputProps} ... <input /> native attrs
|
|
90
|
+
* @property {InputPriority} [priority] 스타일 카테고리 타입
|
|
91
|
+
* @property {InputSize} [size] 스타일 사이즈 타입
|
|
92
|
+
* @property {InputState} [state] input 상태
|
|
93
|
+
* @property {boolean} [block] width: 100% 여부
|
|
94
|
+
* @property {string} [inputClassName]
|
|
95
|
+
* @property {string} [boxClassName]
|
|
96
|
+
* @property {UseFormRegisterReturn} [register]
|
|
97
|
+
* @property {React.ReactNode} [left] input 왼쪽 컨텐츠
|
|
98
|
+
* @property {React.ReactNode} [right] input 오른쪽 컨텐츠
|
|
99
|
+
* @property {React.ReactNode} [clear] input reset버튼 커스텀 컨텐츠
|
|
100
|
+
* @property {React.ReactNode} [success] input 입력상태 성공시 커스텀 컨텐츠
|
|
101
|
+
* @property {React.ReactNode} [error] input 입력상태 에러시 커스텀 컨텐츠
|
|
102
|
+
*/
|
|
103
|
+
export interface InputProps extends Omit<NativeInputProps, "size">, InputIcon {
|
|
104
|
+
/**
|
|
105
|
+
* semantic color/token 세트
|
|
106
|
+
*/
|
|
107
|
+
priority?: InputPriority;
|
|
108
|
+
/**
|
|
109
|
+
* 높이/타이포 세트
|
|
110
|
+
*/
|
|
111
|
+
size?: InputSize;
|
|
112
|
+
/**
|
|
113
|
+
* 시각 상태. disabled prop과 조합된다
|
|
114
|
+
*/
|
|
115
|
+
state?: InputState;
|
|
116
|
+
/**
|
|
117
|
+
* true면 width:100%
|
|
118
|
+
*/
|
|
119
|
+
block?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* 실제 `<input>` className
|
|
122
|
+
*/
|
|
123
|
+
inputClassName?: string;
|
|
124
|
+
/**
|
|
125
|
+
* `.input-box` className
|
|
126
|
+
*/
|
|
127
|
+
boxClassName?: string;
|
|
128
|
+
/**
|
|
129
|
+
* react-hook-form register 반환값
|
|
130
|
+
*/
|
|
131
|
+
register?: UseFormRegisterReturn;
|
|
132
|
+
/**
|
|
133
|
+
* Storybook 등에서 강제 상태 표현용
|
|
134
|
+
*/
|
|
135
|
+
"data-simulated-state"?: InputState;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Input 오른쪽 유틸리티 props.
|
|
140
|
+
* @property {ReactNode} [children] right 슬롯 콘텐츠
|
|
141
|
+
* @property {ReactNode} [clear] clear 버튼 아이콘
|
|
142
|
+
* @property {ReactNode} [success] success 상태 아이콘
|
|
143
|
+
* @property {ReactNode} [error] error 상태 아이콘
|
|
144
|
+
* @property {InputState} state 현재 상태
|
|
145
|
+
* @property {boolean} isDisabled disabled 여부
|
|
146
|
+
* @property {boolean} isFocused focus 여부
|
|
147
|
+
* @property {boolean} hasValue 값 존재 여부
|
|
148
|
+
* @property {boolean} [readOnly] readOnly 여부
|
|
149
|
+
* @property {(event:MouseEvent|PointerEvent)=>void} [onClear] clear 버튼 핸들러
|
|
150
|
+
*/
|
|
151
|
+
export interface InputUtilityProps {
|
|
152
|
+
/**
|
|
153
|
+
* 오른쪽 슬롯 콘텐츠
|
|
154
|
+
*/
|
|
155
|
+
children?: ReactNode;
|
|
156
|
+
/**
|
|
157
|
+
* clear 버튼 아이콘
|
|
158
|
+
*/
|
|
159
|
+
clear?: ReactNode;
|
|
160
|
+
/**
|
|
161
|
+
* success 상태 아이콘
|
|
162
|
+
*/
|
|
163
|
+
success?: ReactNode;
|
|
164
|
+
/**
|
|
165
|
+
* error 상태 아이콘
|
|
166
|
+
*/
|
|
167
|
+
error?: ReactNode;
|
|
168
|
+
/**
|
|
169
|
+
* 현재 input 상태
|
|
170
|
+
*/
|
|
171
|
+
state: InputState;
|
|
172
|
+
/**
|
|
173
|
+
* disabled 여부
|
|
174
|
+
*/
|
|
175
|
+
isDisabled: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* focus 여부
|
|
178
|
+
*/
|
|
179
|
+
isFocused: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* 값 존재 여부
|
|
182
|
+
*/
|
|
183
|
+
hasValue: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* readOnly 여부
|
|
186
|
+
*/
|
|
187
|
+
readOnly?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* clear 버튼 핸들러
|
|
190
|
+
*/
|
|
191
|
+
onClear?: (
|
|
192
|
+
event: MouseEvent<HTMLButtonElement> | PointerEvent<HTMLButtonElement>,
|
|
193
|
+
) => void;
|
|
194
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ChangeEvent } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 숫자 입력 필드 옵션.
|
|
5
|
+
* @property {string} [value] 제어형 값
|
|
6
|
+
* @property {string} [defaultValue] 비제어 초기값
|
|
7
|
+
* @property {number} [maxLength] 자리수 제한
|
|
8
|
+
*/
|
|
9
|
+
export interface UseDigitFieldOptions {
|
|
10
|
+
/**
|
|
11
|
+
* 제어형 값
|
|
12
|
+
*/
|
|
13
|
+
value?: string;
|
|
14
|
+
/**
|
|
15
|
+
* 비제어 초기값
|
|
16
|
+
*/
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
/**
|
|
19
|
+
* 최대 자리수
|
|
20
|
+
*/
|
|
21
|
+
maxLength?: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 숫자 필드 hook 반환값.
|
|
26
|
+
* @property {string} digits 현재 숫자 문자열
|
|
27
|
+
* @property {boolean} isControlled 제어형 여부
|
|
28
|
+
* @property {(event:ChangeEvent<HTMLInputElement>)=>string} handleDigitsChange 입력 핸들러
|
|
29
|
+
*/
|
|
30
|
+
export interface UseDigitFieldResult {
|
|
31
|
+
/**
|
|
32
|
+
* 현재 숫자 문자열
|
|
33
|
+
*/
|
|
34
|
+
digits: string;
|
|
35
|
+
/**
|
|
36
|
+
* 제어형 여부
|
|
37
|
+
*/
|
|
38
|
+
isControlled: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* onChange 핸들러
|
|
41
|
+
*/
|
|
42
|
+
handleDigitsChange: (event: ChangeEvent<HTMLInputElement>) => string;
|
|
43
|
+
}
|
|
@@ -1,87 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
export const INPUT_PRIORITIES = ["primary", "secondary", "tertiary"] as const;
|
|
8
|
-
/**
|
|
9
|
-
* size 축은 높이/타이포/spacing을 결정한다.
|
|
10
|
-
*/
|
|
11
|
-
export const INPUT_SIZES = ["small", "medium", "large"] as const;
|
|
12
|
-
/**
|
|
13
|
-
* 시각 상태는 success/error/disabled 를 포함한다.
|
|
14
|
-
*/
|
|
15
|
-
export const INPUT_STATES = [
|
|
16
|
-
"default",
|
|
17
|
-
"active",
|
|
18
|
-
"focused",
|
|
19
|
-
"success",
|
|
20
|
-
"error",
|
|
21
|
-
"disabled",
|
|
22
|
-
"loading",
|
|
23
|
-
] as const;
|
|
24
|
-
|
|
25
|
-
export type InputPriority = (typeof INPUT_PRIORITIES)[number];
|
|
26
|
-
export type InputSize = (typeof INPUT_SIZES)[number];
|
|
27
|
-
export type InputState = (typeof INPUT_STATES)[number];
|
|
28
|
-
|
|
29
|
-
type NativeInputProps = ComponentPropsWithoutRef<"input">;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* 좌우 슬롯과 status 아이콘 정의.
|
|
33
|
-
*/
|
|
34
|
-
export interface InputIcon {
|
|
35
|
-
left?: ReactNode;
|
|
36
|
-
right?: ReactNode;
|
|
37
|
-
clear?: ReactNode;
|
|
38
|
-
success?: ReactNode;
|
|
39
|
-
error?: ReactNode;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* label/helper 등 피드백 슬롯 정의.
|
|
44
|
-
*/
|
|
45
|
-
export interface InputFeedback {
|
|
46
|
-
label?: ReactNode;
|
|
47
|
-
helper?: ReactNode;
|
|
48
|
-
hideHelper?: boolean;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* 텍스트 입력의 핵심 props. native input 속성에서 size는 제외하고 left/right 등 슬롯을 별도로 정의한다.
|
|
53
|
-
*/
|
|
54
|
-
export interface InputProps
|
|
55
|
-
extends Omit<NativeInputProps, "size">, InputIcon, InputFeedback {
|
|
56
|
-
/** semantic color/token 세트 */
|
|
57
|
-
priority?: InputPriority;
|
|
58
|
-
/** 높이/타이포 세트 */
|
|
59
|
-
size?: InputSize;
|
|
60
|
-
/** 시각 상태. disabled prop과 조합된다 */
|
|
61
|
-
state?: InputState;
|
|
62
|
-
/** true면 width:100% */
|
|
63
|
-
block?: boolean;
|
|
64
|
-
/** 실제 `<input>` className */
|
|
65
|
-
inputClassName?: string;
|
|
66
|
-
/** `.input-box` className */
|
|
67
|
-
boxClassName?: string;
|
|
68
|
-
/** label attr 커스터마이즈 */
|
|
69
|
-
labelProps?: ComponentPropsWithoutRef<"label">;
|
|
70
|
-
/** helper attr 커스터마이즈 */
|
|
71
|
-
helperProps?: ComponentPropsWithoutRef<"div">;
|
|
72
|
-
/** react-hook-form register 반환값 */
|
|
73
|
-
register?: UseFormRegisterReturn;
|
|
74
|
-
/** Storybook 등에서 강제 상태 표현용 */
|
|
75
|
-
"data-simulated-state"?: InputState;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* className composer helper가 필요로 하는 파라미터 집합.
|
|
80
|
-
*/
|
|
81
|
-
export interface InputClassNameOptions {
|
|
82
|
-
priority: InputPriority;
|
|
83
|
-
size: InputSize;
|
|
84
|
-
state: InputState;
|
|
85
|
-
block: boolean;
|
|
86
|
-
className?: string;
|
|
87
|
-
}
|
|
1
|
+
export type * from "./foundation";
|
|
2
|
+
export type * from "./text";
|
|
3
|
+
export type * from "./calendar";
|
|
4
|
+
export type * from "./verification";
|
|
5
|
+
export type * from "./hooks";
|