@uniai-fe/uds-primitives 0.12.7 → 0.12.9
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 +15 -2
- package/package.json +4 -4
- package/src/components/alternate/layout/Layout.tsx +3 -0
- package/src/components/alternate/layout/Text.tsx +23 -0
- package/src/components/alternate/styles/layout.scss +11 -0
- package/src/components/alternate/styles/unit.scss +5 -0
- package/src/components/alternate/styles/variables.scss +1 -2
- package/src/components/alternate/types/layout.ts +16 -0
- package/src/components/input/markup/date/Template.tsx +83 -33
- package/src/components/input/markup/date/Trigger.tsx +28 -12
- package/src/components/input/markup/date/range/Template.tsx +94 -35
- package/src/components/input/markup/time/Template.tsx +118 -5
- package/src/components/input/markup/time/Trigger.tsx +35 -2
- package/src/components/input/types/date.ts +176 -33
- package/src/components/input/types/time.ts +10 -4
- package/src/components/time-picker/markup/Footer.tsx +5 -5
- package/src/components/time-picker/markup/HourSection.tsx +7 -7
- package/src/components/time-picker/markup/MinuteSection.tsx +5 -5
- package/src/components/time-picker/markup/Summary.tsx +2 -2
- package/src/components/time-picker/markup/Template.tsx +11 -11
- package/src/components/time-picker/types/time-picker.ts +6 -0
- package/src/components/time-picker/utils/time.ts +21 -9
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ComponentPropsWithoutRef,
|
|
3
|
+
FocusEvent,
|
|
4
|
+
MouseEvent,
|
|
5
|
+
ReactNode,
|
|
6
|
+
} from "react";
|
|
2
7
|
import type { UseFormRegisterReturn } from "react-hook-form";
|
|
3
8
|
import type {
|
|
4
9
|
CalendarColumns,
|
|
@@ -10,7 +15,18 @@ import type {
|
|
|
10
15
|
CalendarRangeValue,
|
|
11
16
|
CalendarValue,
|
|
12
17
|
} from "../../calendar";
|
|
13
|
-
import type {
|
|
18
|
+
import type { FormFieldWidth } from "../../form/types/props";
|
|
19
|
+
import type { InputPriority, InputSize, InputState } from "./foundation";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Input Date hidden input props.
|
|
23
|
+
* @typedef {Omit<ComponentPropsWithoutRef<"input">, "type" | "value" | "defaultValue" | "name">} InputCalendarHiddenInputProps
|
|
24
|
+
* @desc Template이 고정하는 type, value, defaultValue와 name을 제외한 native hidden input 계약
|
|
25
|
+
*/
|
|
26
|
+
export type InputCalendarHiddenInputProps = Omit<
|
|
27
|
+
ComponentPropsWithoutRef<"input">,
|
|
28
|
+
"type" | "value" | "defaultValue" | "name"
|
|
29
|
+
>;
|
|
14
30
|
|
|
15
31
|
/**
|
|
16
32
|
* Calendar trigger(Input) 영역에서 필요한 속성 묶음.
|
|
@@ -22,8 +38,14 @@ import type { InputPriority, InputState } from "./foundation";
|
|
|
22
38
|
* @property {boolean} [disabled] disabled 여부
|
|
23
39
|
* @property {boolean} [readOnly] readOnly 여부
|
|
24
40
|
* @property {string} [placeholder] trigger 내부 placeholder
|
|
25
|
-
* @property {
|
|
26
|
-
* @property {
|
|
41
|
+
* @property {"primary" | "secondary" | "tertiary" | "table"} [priority] trigger input priority
|
|
42
|
+
* @property {"small" | "medium" | "large"} [size] trigger input size
|
|
43
|
+
* @property {"default" | "active" | "focused" | "success" | "error" | "disabled" | "loading"} [state] trigger input state
|
|
44
|
+
* @property {boolean} [block] trigger width 100% 여부
|
|
45
|
+
* @property {"full" | "fit" | "fill" | "auto" | number | string} [width] trigger width preset 또는 custom width
|
|
46
|
+
* @property {(event: FocusEvent<HTMLInputElement>) => void} [onFocus] trigger focus 핸들러
|
|
47
|
+
* @property {(event: FocusEvent<HTMLInputElement>) => void} [onBlur] trigger blur 핸들러
|
|
48
|
+
* @desc Date trigger의 표시·상호작용 입력 계약. Template의 name/register는 hidden input 저장에 사용한다.
|
|
27
49
|
*/
|
|
28
50
|
export interface InputCalendarTriggerProps {
|
|
29
51
|
/**
|
|
@@ -59,16 +81,38 @@ export interface InputCalendarTriggerProps {
|
|
|
59
81
|
* - table일 때 Trigger는 left icon 배치를 사용한다.
|
|
60
82
|
*/
|
|
61
83
|
priority?: InputPriority;
|
|
84
|
+
/**
|
|
85
|
+
* "small" | "medium" | "large".
|
|
86
|
+
*/
|
|
87
|
+
size?: InputSize;
|
|
62
88
|
/**
|
|
63
89
|
* trigger input state
|
|
64
90
|
*/
|
|
65
91
|
state?: InputState;
|
|
92
|
+
/**
|
|
93
|
+
* trigger width 100% 여부.
|
|
94
|
+
*/
|
|
95
|
+
block?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* "full" | "fit" | "fill" | "auto" | number | string.
|
|
98
|
+
*/
|
|
99
|
+
width?: FormFieldWidth;
|
|
100
|
+
/**
|
|
101
|
+
* trigger focus 핸들러.
|
|
102
|
+
*/
|
|
103
|
+
onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
104
|
+
/**
|
|
105
|
+
* trigger blur 핸들러.
|
|
106
|
+
*/
|
|
107
|
+
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
66
108
|
}
|
|
67
109
|
|
|
68
110
|
/**
|
|
69
111
|
* Trigger view에서만 사용하는 부가 props.
|
|
70
112
|
* @property {string} [className] trigger root className
|
|
71
113
|
* @property {string} [displayValue] 표시 값 문자열
|
|
114
|
+
* @see InputCalendarTriggerProps
|
|
115
|
+
* @desc 기본 Date trigger가 InputFoundation.Base에 전달하는 view 계약
|
|
72
116
|
*/
|
|
73
117
|
export interface InputCalendarTriggerViewProps extends InputCalendarTriggerProps {
|
|
74
118
|
/**
|
|
@@ -90,8 +134,14 @@ export interface InputCalendarTriggerViewProps extends InputCalendarTriggerProps
|
|
|
90
134
|
* @property {boolean} [disabled] disabled 여부
|
|
91
135
|
* @property {boolean} [readOnly] readOnly 여부
|
|
92
136
|
* @property {(event: MouseEvent<Element>) => void} [onClick] 트리거 클릭 핸들러
|
|
93
|
-
* @property {
|
|
94
|
-
* @property {
|
|
137
|
+
* @property {"primary" | "secondary" | "tertiary" | "table"} [priority] trigger input priority
|
|
138
|
+
* @property {"small" | "medium" | "large"} [size] trigger input size
|
|
139
|
+
* @property {"default" | "active" | "focused" | "success" | "error" | "disabled" | "loading"} [state] trigger input state
|
|
140
|
+
* @property {boolean} [block] trigger width 100% 여부
|
|
141
|
+
* @property {"full" | "fit" | "fill" | "auto" | number | string} [width] trigger width preset 또는 custom width
|
|
142
|
+
* @property {(event: FocusEvent<HTMLInputElement>) => void} [onFocus] trigger focus 핸들러
|
|
143
|
+
* @property {(event: FocusEvent<HTMLInputElement>) => void} [onBlur] trigger blur 핸들러
|
|
144
|
+
* @desc custom Date trigger에 전달하는 표시·상호작용 계약
|
|
95
145
|
*/
|
|
96
146
|
export interface InputCalendarTriggerRenderProps {
|
|
97
147
|
/**
|
|
@@ -127,57 +177,92 @@ export interface InputCalendarTriggerRenderProps {
|
|
|
127
177
|
* - table일 때 Trigger는 left icon 배치를 사용한다.
|
|
128
178
|
*/
|
|
129
179
|
priority?: InputPriority;
|
|
180
|
+
/**
|
|
181
|
+
* "small" | "medium" | "large".
|
|
182
|
+
*/
|
|
183
|
+
size?: InputSize;
|
|
130
184
|
/**
|
|
131
185
|
* trigger input state
|
|
132
186
|
*/
|
|
133
187
|
state?: InputState;
|
|
188
|
+
/**
|
|
189
|
+
* trigger width 100% 여부.
|
|
190
|
+
*/
|
|
191
|
+
block?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* "full" | "fit" | "fill" | "auto" | number | string.
|
|
194
|
+
*/
|
|
195
|
+
width?: FormFieldWidth;
|
|
196
|
+
/**
|
|
197
|
+
* trigger focus 핸들러.
|
|
198
|
+
*/
|
|
199
|
+
onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
200
|
+
/**
|
|
201
|
+
* trigger blur 핸들러.
|
|
202
|
+
*/
|
|
203
|
+
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
134
204
|
}
|
|
135
205
|
|
|
136
206
|
/**
|
|
137
207
|
* Input Calendar core props.
|
|
138
|
-
* @property {
|
|
139
|
-
* @property {
|
|
140
|
-
* @property {
|
|
141
|
-
* @property {
|
|
142
|
-
* @property {
|
|
143
|
-
* @property {
|
|
208
|
+
* @property {"date" | "date-time" | "time"} [mode="date"] Calendar layout mode. 선택 body는 date로 유지된다.
|
|
209
|
+
* @property {1 | 2} [columns=1] 동시에 노출할 달력 열 수
|
|
210
|
+
* @property {string | null} [value] 제어형 값
|
|
211
|
+
* @property {string | null} [defaultValue] 비제어 초기값
|
|
212
|
+
* @property {(value: string | null) => void} [onChange] 값 변경 핸들러(직렬화 문자열 기준)
|
|
213
|
+
* @property {(value: string | null) => void} [onValueChange] onChange 별칭(추가 파이프라인용)
|
|
144
214
|
* @property {boolean} [readOnly] 읽기 전용 여부
|
|
145
215
|
* @property {boolean} [disabled] disabled 여부
|
|
146
216
|
* @property {CalendarDatePickerProps} [datePickerProps] Mantine DatePicker 직접 옵션
|
|
147
|
-
* @property {
|
|
148
|
-
* @property {
|
|
217
|
+
* @property {string} [id] trigger id
|
|
218
|
+
* @property {string} [name] hidden input form name
|
|
219
|
+
* @property {UseFormRegisterReturn} [register] hidden input react-hook-form register 결과
|
|
220
|
+
* @property {string} [placeholder] trigger 내부 placeholder
|
|
221
|
+
* @property {(event: MouseEvent<Element>) => void} [onClick] trigger 클릭 핸들러
|
|
222
|
+
* @property {"primary" | "secondary" | "tertiary" | "table"} [priority] trigger input priority
|
|
223
|
+
* @property {"small" | "medium" | "large"} [size] trigger input size
|
|
224
|
+
* @property {"default" | "active" | "focused" | "success" | "error" | "disabled" | "loading"} [state] trigger input state
|
|
225
|
+
* @property {boolean} [block] trigger width 100% 여부
|
|
226
|
+
* @property {"full" | "fit" | "fill" | "auto" | number | string} [width] trigger width preset 또는 custom width
|
|
227
|
+
* @property {string} [form] hidden input이 연결될 form id
|
|
228
|
+
* @property {boolean} [required] hidden input required 여부
|
|
229
|
+
* @property {InputCalendarHiddenInputProps} [hiddenInputProps] Template 고정값을 제외한 hidden input native props
|
|
230
|
+
* @property {(event: FocusEvent<HTMLInputElement>) => void} [onFocus] trigger focus 핸들러
|
|
231
|
+
* @property {(event: FocusEvent<HTMLInputElement>) => void} [onBlur] trigger blur 핸들러와 RHF touched 동기화 진입점
|
|
149
232
|
* @property {ReactNode} [header] 커스텀 header 콘텐츠
|
|
150
233
|
* @property {ReactNode} [footer] 커스텀 footer 콘텐츠
|
|
151
234
|
* @property {InputCalendarTexts} [texts] 기본 Date 문구
|
|
152
|
-
* @property {unknown} [timePicker]
|
|
235
|
+
* @property {unknown} [timePicker] 미구현 compatibility prop. 시간 선택에는 Input.Time.Template을 사용한다.
|
|
153
236
|
* @property {boolean} [calendarOpened] calendar 열림 제어 여부
|
|
154
237
|
* @property {(open: boolean) => void} [onCalendarOpen] calendar 열림 변경 이벤트
|
|
155
238
|
* @property {ReactNode} [trigger] 커스텀 trigger 슬롯
|
|
156
239
|
* @property {(props: InputCalendarTriggerRenderProps) => ReactNode} [renderTrigger] 커스텀 trigger 렌더 함수
|
|
240
|
+
* @desc 단일 날짜 trigger, Calendar와 hidden form storage를 조합하는 공개 계약
|
|
157
241
|
*/
|
|
158
242
|
export interface InputCalendarProps extends InputCalendarTriggerProps {
|
|
159
243
|
/**
|
|
160
|
-
*
|
|
244
|
+
* "date" | "date-time" | "time".
|
|
245
|
+
* Calendar layout의 data-mode만 지정하며 선택 body는 date로 유지된다.
|
|
161
246
|
*/
|
|
162
247
|
mode?: CalendarMode;
|
|
163
248
|
/**
|
|
164
|
-
*
|
|
249
|
+
* 1 | 2.
|
|
165
250
|
*/
|
|
166
251
|
columns?: CalendarColumns;
|
|
167
252
|
/**
|
|
168
|
-
*
|
|
253
|
+
* string | null.
|
|
169
254
|
*/
|
|
170
255
|
value?: CalendarValue;
|
|
171
256
|
/**
|
|
172
|
-
*
|
|
257
|
+
* string | null.
|
|
173
258
|
*/
|
|
174
259
|
defaultValue?: CalendarValue;
|
|
175
260
|
/**
|
|
176
|
-
*
|
|
261
|
+
* (value: string | null) => void.
|
|
177
262
|
*/
|
|
178
263
|
onChange?: CalendarOnChange;
|
|
179
264
|
/**
|
|
180
|
-
* onChange
|
|
265
|
+
* (value: string | null) => void. onChange 별칭으로 외부 파이프라인에 사용한다.
|
|
181
266
|
*/
|
|
182
267
|
onValueChange?: CalendarOnChange;
|
|
183
268
|
/**
|
|
@@ -205,8 +290,8 @@ export interface InputCalendarProps extends InputCalendarTriggerProps {
|
|
|
205
290
|
*/
|
|
206
291
|
texts?: InputCalendarTexts;
|
|
207
292
|
/**
|
|
208
|
-
* TimePicker 확장용
|
|
209
|
-
*
|
|
293
|
+
* TimePicker 확장용 미구현 compatibility prop.
|
|
294
|
+
* @deprecated 시간 선택에는 Input.Time.Template을 사용한다.
|
|
210
295
|
*/
|
|
211
296
|
timePicker?: unknown;
|
|
212
297
|
/**
|
|
@@ -226,14 +311,26 @@ export interface InputCalendarProps extends InputCalendarTriggerProps {
|
|
|
226
311
|
* 커스텀 trigger 렌더 함수
|
|
227
312
|
*/
|
|
228
313
|
renderTrigger?: (props: InputCalendarTriggerRenderProps) => ReactNode;
|
|
314
|
+
/**
|
|
315
|
+
* hidden input이 연결될 form id.
|
|
316
|
+
*/
|
|
317
|
+
form?: string;
|
|
318
|
+
/**
|
|
319
|
+
* hidden input required 여부.
|
|
320
|
+
*/
|
|
321
|
+
required?: boolean;
|
|
322
|
+
/**
|
|
323
|
+
* Template 고정값을 제외한 hidden input native props.
|
|
324
|
+
*/
|
|
325
|
+
hiddenInputProps?: InputCalendarHiddenInputProps;
|
|
229
326
|
}
|
|
230
327
|
|
|
231
328
|
/**
|
|
232
329
|
* Input Calendar Range Template props.
|
|
233
|
-
* @property {
|
|
234
|
-
* @property {
|
|
235
|
-
* @property {
|
|
236
|
-
* @property {
|
|
330
|
+
* @property {[string | null, string | null]} [value] 제어형 range 값
|
|
331
|
+
* @property {[string | null, string | null]} [defaultValue] 비제어 range 초기값
|
|
332
|
+
* @property {(value: [string | null, string | null]) => void} [onChange] range 값 변경 핸들러
|
|
333
|
+
* @property {(value: [string | null, string | null]) => void} [onValueChange] onChange 별칭
|
|
237
334
|
* @property {boolean} [readOnly] 읽기 전용 여부
|
|
238
335
|
* @property {boolean} [disabled] disabled 여부
|
|
239
336
|
* @property {CalendarRangeDatePickerProps} [datePickerProps] Mantine range DatePicker 옵션
|
|
@@ -242,8 +339,17 @@ export interface InputCalendarProps extends InputCalendarTriggerProps {
|
|
|
242
339
|
* @property {UseFormRegisterReturn} [startRegister] 시작일 react-hook-form register 결과
|
|
243
340
|
* @property {UseFormRegisterReturn} [endRegister] 종료일 react-hook-form register 결과
|
|
244
341
|
* @property {string} [placeholder] trigger 내부 placeholder
|
|
245
|
-
* @property {
|
|
246
|
-
* @property {
|
|
342
|
+
* @property {"primary" | "secondary" | "tertiary" | "table"} [priority] trigger input priority
|
|
343
|
+
* @property {"small" | "medium" | "large"} [size] trigger input size
|
|
344
|
+
* @property {"default" | "active" | "focused" | "success" | "error" | "disabled" | "loading"} [state] trigger input state
|
|
345
|
+
* @property {boolean} [block] trigger width 100% 여부
|
|
346
|
+
* @property {"full" | "fit" | "fill" | "auto" | number | string} [width] trigger width preset 또는 custom width
|
|
347
|
+
* @property {string} [form] start/end hidden input이 연결될 공통 form id
|
|
348
|
+
* @property {boolean} [required] start/end hidden input required 여부
|
|
349
|
+
* @property {InputCalendarHiddenInputProps} [startHiddenInputProps] 시작일 hidden input native props
|
|
350
|
+
* @property {InputCalendarHiddenInputProps} [endHiddenInputProps] 종료일 hidden input native props
|
|
351
|
+
* @property {(event: FocusEvent<HTMLInputElement>) => void} [onFocus] trigger focus 핸들러
|
|
352
|
+
* @property {(event: FocusEvent<HTMLInputElement>) => void} [onBlur] trigger blur 핸들러와 RHF touched 동기화 진입점
|
|
247
353
|
* @property {ReactNode} [header] 커스텀 header 콘텐츠
|
|
248
354
|
* @property {ReactNode} [footer] 커스텀 footer 콘텐츠
|
|
249
355
|
* @property {InputCalendarTexts} [texts] 기본 Date 문구
|
|
@@ -253,22 +359,23 @@ export interface InputCalendarProps extends InputCalendarTriggerProps {
|
|
|
253
359
|
* @property {ReactNode} [trigger] 커스텀 trigger 슬롯
|
|
254
360
|
* @property {(props: InputCalendarTriggerRenderProps) => ReactNode} [renderTrigger] 커스텀 trigger 렌더 함수
|
|
255
361
|
* @property {(event: MouseEvent<Element>) => void} [onClick] trigger 클릭 핸들러
|
|
362
|
+
* @desc 기간 trigger, Calendar.Range와 start/end hidden form storage를 조합하는 공개 계약
|
|
256
363
|
*/
|
|
257
364
|
export interface InputCalendarRangeProps {
|
|
258
365
|
/**
|
|
259
|
-
*
|
|
366
|
+
* [string | null, string | null].
|
|
260
367
|
*/
|
|
261
368
|
value?: CalendarRangeValue;
|
|
262
369
|
/**
|
|
263
|
-
*
|
|
370
|
+
* [string | null, string | null].
|
|
264
371
|
*/
|
|
265
372
|
defaultValue?: CalendarRangeValue;
|
|
266
373
|
/**
|
|
267
|
-
*
|
|
374
|
+
* (value: [string | null, string | null]) => void.
|
|
268
375
|
*/
|
|
269
376
|
onChange?: CalendarRangeOnChange;
|
|
270
377
|
/**
|
|
271
|
-
* onChange
|
|
378
|
+
* (value: [string | null, string | null]) => void. onChange 별칭으로 외부 파이프라인에 사용한다.
|
|
272
379
|
*/
|
|
273
380
|
onValueChange?: CalendarRangeOnChange;
|
|
274
381
|
/**
|
|
@@ -308,10 +415,46 @@ export interface InputCalendarRangeProps {
|
|
|
308
415
|
* - table일 때 Trigger는 left icon 배치를 사용한다.
|
|
309
416
|
*/
|
|
310
417
|
priority?: InputPriority;
|
|
418
|
+
/**
|
|
419
|
+
* "small" | "medium" | "large".
|
|
420
|
+
*/
|
|
421
|
+
size?: InputSize;
|
|
311
422
|
/**
|
|
312
423
|
* trigger input state
|
|
313
424
|
*/
|
|
314
425
|
state?: InputState;
|
|
426
|
+
/**
|
|
427
|
+
* trigger width 100% 여부.
|
|
428
|
+
*/
|
|
429
|
+
block?: boolean;
|
|
430
|
+
/**
|
|
431
|
+
* "full" | "fit" | "fill" | "auto" | number | string.
|
|
432
|
+
*/
|
|
433
|
+
width?: FormFieldWidth;
|
|
434
|
+
/**
|
|
435
|
+
* start/end hidden input이 연결될 공통 form id.
|
|
436
|
+
*/
|
|
437
|
+
form?: string;
|
|
438
|
+
/**
|
|
439
|
+
* start/end hidden input required 여부.
|
|
440
|
+
*/
|
|
441
|
+
required?: boolean;
|
|
442
|
+
/**
|
|
443
|
+
* 시작일 hidden input native props.
|
|
444
|
+
*/
|
|
445
|
+
startHiddenInputProps?: InputCalendarHiddenInputProps;
|
|
446
|
+
/**
|
|
447
|
+
* 종료일 hidden input native props.
|
|
448
|
+
*/
|
|
449
|
+
endHiddenInputProps?: InputCalendarHiddenInputProps;
|
|
450
|
+
/**
|
|
451
|
+
* trigger focus 핸들러.
|
|
452
|
+
*/
|
|
453
|
+
onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
454
|
+
/**
|
|
455
|
+
* trigger blur 핸들러.
|
|
456
|
+
*/
|
|
457
|
+
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
315
458
|
/**
|
|
316
459
|
* 커스텀 header 콘텐츠
|
|
317
460
|
*/
|
|
@@ -21,6 +21,8 @@ export type InputTimeIconPosition = "left" | "right";
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Input Time hidden input props.
|
|
24
|
+
* @typedef {Omit<ComponentPropsWithoutRef<"input">, "type" | "value" | "defaultValue" | "name">} InputTimeHiddenInputProps
|
|
25
|
+
* @desc Template이 고정하는 type, value, defaultValue와 name을 제외한 native hidden input 계약
|
|
24
26
|
*/
|
|
25
27
|
export type InputTimeHiddenInputProps = Omit<
|
|
26
28
|
ComponentPropsWithoutRef<"input">,
|
|
@@ -32,6 +34,7 @@ export type InputTimeHiddenInputProps = Omit<
|
|
|
32
34
|
* @property {string} hours 시 입력값
|
|
33
35
|
* @property {string} minutes 분 입력값
|
|
34
36
|
* @property {string} seconds 초 입력값
|
|
37
|
+
* @desc 입력 field에 표시하는 시·분·초 draft 문자열
|
|
35
38
|
*/
|
|
36
39
|
export interface InputTimeDraftFields {
|
|
37
40
|
/**
|
|
@@ -52,6 +55,7 @@ export interface InputTimeDraftFields {
|
|
|
52
55
|
* Input Time 편집 중인 시간 값.
|
|
53
56
|
* @property {InputTimeDraftFields} fields 시·분·초 입력값
|
|
54
57
|
* @property {"am" | "pm"} period 오전·오후 구분
|
|
58
|
+
* @desc 저장값 commit 전의 field 문자열과 12시간제 period 상태
|
|
55
59
|
*/
|
|
56
60
|
export interface InputTimeDraft {
|
|
57
61
|
/**
|
|
@@ -99,6 +103,7 @@ export type InputTimeTriggerFields = InputTimeDraftFields;
|
|
|
99
103
|
* @property {(period: "am" | "pm") => void} onPeriodChange 오전·오후 변경 핸들러
|
|
100
104
|
* @property {(amount: 1 | -1) => void} onStep 활성 단위 증감 핸들러
|
|
101
105
|
* @property {(event: FocusEvent<HTMLDivElement>) => void} onRootBlur root blur 핸들러
|
|
106
|
+
* @desc 시·분·초 field, period, stepper와 clock action을 렌더링하기 위한 trigger 계약
|
|
102
107
|
*/
|
|
103
108
|
export interface InputTimeTriggerProps extends Omit<
|
|
104
109
|
ComponentPropsWithoutRef<"div">,
|
|
@@ -225,8 +230,8 @@ export interface InputTimeTriggerProps extends Omit<
|
|
|
225
230
|
* 저장값은 24시간 `HH:mm` 또는 `HH:mm:ss` 문자열을 사용한다.
|
|
226
231
|
* @property {string} [value] 제어형 시간 값
|
|
227
232
|
* @property {string} [defaultValue] 비제어 초기 시간 값
|
|
228
|
-
* @property {(value:string)=>void} [onChange] 값 변경 핸들러
|
|
229
|
-
* @property {(value:string)=>void} [onValueChange] 값 변경 별칭
|
|
233
|
+
* @property {(value: string) => void} [onChange] 값 변경 핸들러
|
|
234
|
+
* @property {(value: string) => void} [onValueChange] 값 변경 별칭
|
|
230
235
|
* @property {string} [name] form name
|
|
231
236
|
* @property {string} [form] form id
|
|
232
237
|
* @property {UseFormRegisterReturn} [register] react-hook-form register 결과
|
|
@@ -257,8 +262,9 @@ export interface InputTimeTriggerProps extends Omit<
|
|
|
257
262
|
* @property {string} [hoursPlaceholder] 시 placeholder
|
|
258
263
|
* @property {string} [minutesPlaceholder] 분 placeholder
|
|
259
264
|
* @property {string} [secondsPlaceholder] 초 placeholder
|
|
260
|
-
* @property {(event:FocusEvent<HTMLInputElement>)=>void} [onFocus] focus 핸들러
|
|
261
|
-
* @property {(event:FocusEvent<HTMLDivElement>)=>void} [onBlur] blur 핸들러
|
|
265
|
+
* @property {(event: FocusEvent<HTMLInputElement>) => void} [onFocus] focus 핸들러
|
|
266
|
+
* @property {(event: FocusEvent<HTMLDivElement>) => void} [onBlur] blur 핸들러
|
|
267
|
+
* @desc 시간 trigger, TimePicker panel과 24시간 문자열 hidden form storage를 조합하는 공개 계약
|
|
262
268
|
*/
|
|
263
269
|
export interface InputTimeTemplateProps {
|
|
264
270
|
/**
|
|
@@ -5,11 +5,11 @@ import type { TimePickerFooterProps } from "../types";
|
|
|
5
5
|
* TimePicker Footer; 삭제와 적용 action을 렌더한다.
|
|
6
6
|
* @component
|
|
7
7
|
* @param {TimePickerFooterProps} props
|
|
8
|
-
* @
|
|
9
|
-
* @
|
|
10
|
-
* @
|
|
11
|
-
* @
|
|
12
|
-
* @
|
|
8
|
+
* @property {boolean} props.clearable 삭제 action 노출 여부
|
|
9
|
+
* @property {boolean} props.disabled 비활성화 여부
|
|
10
|
+
* @property {() => void} props.onClear 삭제 핸들러
|
|
11
|
+
* @property {() => void} props.onApply 적용 핸들러
|
|
12
|
+
* @desc clearable 상태에 따라 삭제 action을 노출하고 적용 action을 유지한다.
|
|
13
13
|
* @example
|
|
14
14
|
* <TimePickerFooter
|
|
15
15
|
* clearable
|
|
@@ -12,13 +12,13 @@ const PERIOD_OPTIONS = [
|
|
|
12
12
|
* TimePicker Hour Section; 오전·오후와 시 선택 grid를 렌더한다.
|
|
13
13
|
* @component
|
|
14
14
|
* @param {TimePickerHourSectionProps} props
|
|
15
|
-
* @
|
|
16
|
-
* @
|
|
17
|
-
* @
|
|
18
|
-
* @
|
|
19
|
-
* @
|
|
20
|
-
* @
|
|
21
|
-
* @
|
|
15
|
+
* @property {"12h" | "24h"} props.format 표시 형식
|
|
16
|
+
* @property {number | null} props.selectedHour 선택한 표시 시
|
|
17
|
+
* @property {"am" | "pm"} props.period 오전·오후
|
|
18
|
+
* @property {boolean} props.disabled 비활성화 여부
|
|
19
|
+
* @property {(hours: number) => void} props.onHourSelect 시 선택 핸들러
|
|
20
|
+
* @property {(period: "am" | "pm") => void} props.onPeriodChange 오전·오후 변경 핸들러
|
|
21
|
+
* @desc 12시간제와 24시간제에 맞는 시 목록과 period control을 렌더한다.
|
|
22
22
|
* @example
|
|
23
23
|
* <TimePickerHourSection
|
|
24
24
|
* format="12h"
|
|
@@ -8,11 +8,11 @@ const MINUTES = Array.from({ length: 12 }, (_, index) => index * 5);
|
|
|
8
8
|
* TimePicker Minute Section; 1분 stepper와 5분 선택 grid를 렌더한다.
|
|
9
9
|
* @component
|
|
10
10
|
* @param {TimePickerMinuteSectionProps} props
|
|
11
|
-
* @
|
|
12
|
-
* @
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
15
|
-
* @
|
|
11
|
+
* @property {number | null} props.selectedMinute 선택한 분
|
|
12
|
+
* @property {boolean} props.disabled 비활성화 여부
|
|
13
|
+
* @property {(amount: 1 | -1) => void} props.onMinuteStep 1분 증감 핸들러
|
|
14
|
+
* @property {(minutes: number) => void} props.onMinuteSelect 분 선택 핸들러
|
|
15
|
+
* @desc 5분 간격 빠른 선택과 1분 단위 미세 조정을 함께 제공한다.
|
|
16
16
|
* @example
|
|
17
17
|
* <TimePickerMinuteSection
|
|
18
18
|
* selectedMinute={30}
|
|
@@ -4,8 +4,8 @@ import type { TimePickerSummaryProps } from "../types";
|
|
|
4
4
|
* TimePicker Summary; 현재 선택한 시간을 표시한다.
|
|
5
5
|
* @component
|
|
6
6
|
* @param {TimePickerSummaryProps} props
|
|
7
|
-
* @
|
|
8
|
-
* @
|
|
7
|
+
* @property {string} props.summary 선택한 시간 표시값
|
|
8
|
+
* @desc TimePicker panel 상단에 현재 선택값 또는 빈 상태를 표시한다.
|
|
9
9
|
* @example
|
|
10
10
|
* <TimePickerSummary summary="09:30 오전" />
|
|
11
11
|
*/
|
|
@@ -11,17 +11,17 @@ import TimePickerSummary from "./Summary";
|
|
|
11
11
|
* TimePicker Template; Figma의 시간·분 선택과 footer action을 렌더한다.
|
|
12
12
|
* @component
|
|
13
13
|
* @param {TimePickerTemplateProps} props
|
|
14
|
-
* @
|
|
15
|
-
* @
|
|
16
|
-
* @
|
|
17
|
-
* @
|
|
18
|
-
* @
|
|
19
|
-
* @
|
|
20
|
-
* @
|
|
21
|
-
* @
|
|
22
|
-
* @
|
|
23
|
-
* @
|
|
24
|
-
* @
|
|
14
|
+
* @property {string} props.value 24시간 형식 시간 값
|
|
15
|
+
* @property {"12h" | "24h"} props.format 표시 형식
|
|
16
|
+
* @property {boolean} props.clearable 삭제 action 노출 여부
|
|
17
|
+
* @property {boolean} props.disabled 비활성화 여부
|
|
18
|
+
* @property {(hours: number) => void} props.onHourSelect 시 선택 핸들러
|
|
19
|
+
* @property {(minutes: number) => void} props.onMinuteSelect 분 선택 핸들러
|
|
20
|
+
* @property {(period: "am" | "pm") => void} props.onPeriodChange 오전·오후 변경 핸들러
|
|
21
|
+
* @property {(amount: 1 | -1) => void} props.onMinuteStep 1분 증감 핸들러
|
|
22
|
+
* @property {() => void} props.onClear 삭제 핸들러
|
|
23
|
+
* @property {() => void} props.onApply 적용 핸들러
|
|
24
|
+
* @desc 24시간 저장값을 표시 형식에 맞춰 시·분 선택 section과 action에 배분한다.
|
|
25
25
|
* @example
|
|
26
26
|
* <TimePicker.Template
|
|
27
27
|
* value="09:30"
|
|
@@ -21,6 +21,7 @@ export type TimePickerUnit = "hours" | "minutes" | "seconds";
|
|
|
21
21
|
* @property {number} hours 시
|
|
22
22
|
* @property {number} minutes 분
|
|
23
23
|
* @property {number} seconds 초
|
|
24
|
+
* @desc 24시간 저장값의 정규화된 시·분·초 숫자 구성
|
|
24
25
|
*/
|
|
25
26
|
export interface TimePickerParts {
|
|
26
27
|
/**
|
|
@@ -49,6 +50,7 @@ export interface TimePickerParts {
|
|
|
49
50
|
* @property {(amount: 1 | -1) => void} onMinuteStep 1분 증감 핸들러
|
|
50
51
|
* @property {() => void} onClear 삭제 핸들러
|
|
51
52
|
* @property {() => void} onApply 적용 핸들러
|
|
53
|
+
* @desc TimePicker panel의 선택값, 표시 형식과 action 계약
|
|
52
54
|
*/
|
|
53
55
|
export interface TimePickerTemplateProps {
|
|
54
56
|
/**
|
|
@@ -96,6 +98,7 @@ export interface TimePickerTemplateProps {
|
|
|
96
98
|
/**
|
|
97
99
|
* TimePicker Summary props.
|
|
98
100
|
* @property {string} summary 선택한 시간 표시값
|
|
101
|
+
* @desc panel 상단의 현재 선택값 표시 계약
|
|
99
102
|
*/
|
|
100
103
|
export interface TimePickerSummaryProps {
|
|
101
104
|
/**
|
|
@@ -112,6 +115,7 @@ export interface TimePickerSummaryProps {
|
|
|
112
115
|
* @property {boolean} disabled 비활성화 여부
|
|
113
116
|
* @property {(hours: number) => void} onHourSelect 시 선택 핸들러
|
|
114
117
|
* @property {(period: "am" | "pm") => void} onPeriodChange 오전·오후 변경 핸들러
|
|
118
|
+
* @desc 표시 형식별 시 목록과 오전·오후 선택 계약
|
|
115
119
|
*/
|
|
116
120
|
export interface TimePickerHourSectionProps {
|
|
117
121
|
/**
|
|
@@ -146,6 +150,7 @@ export interface TimePickerHourSectionProps {
|
|
|
146
150
|
* @property {boolean} disabled 비활성화 여부
|
|
147
151
|
* @property {(amount: 1 | -1) => void} onMinuteStep 1분 증감 핸들러
|
|
148
152
|
* @property {(minutes: number) => void} onMinuteSelect 분 선택 핸들러
|
|
153
|
+
* @desc 분 quick select와 1분 step action 계약
|
|
149
154
|
*/
|
|
150
155
|
export interface TimePickerMinuteSectionProps {
|
|
151
156
|
/**
|
|
@@ -172,6 +177,7 @@ export interface TimePickerMinuteSectionProps {
|
|
|
172
177
|
* @property {boolean} disabled 비활성화 여부
|
|
173
178
|
* @property {() => void} onClear 삭제 핸들러
|
|
174
179
|
* @property {() => void} onApply 적용 핸들러
|
|
180
|
+
* @desc 삭제 노출 여부와 panel footer action 계약
|
|
175
181
|
*/
|
|
176
182
|
export interface TimePickerFooterProps {
|
|
177
183
|
/**
|
|
@@ -12,8 +12,10 @@ const wrapTimePart = (value: number, limit: number) =>
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* TimePicker Utility; 24시간 문자열을 시간 값으로 파싱한다.
|
|
15
|
+
* @utility
|
|
15
16
|
* @param {string} value HH:mm 또는 HH:mm:ss 값
|
|
16
|
-
* @
|
|
17
|
+
* @desc 형식 또는 시·분·초 범위가 유효하지 않으면 null을 반환한다.
|
|
18
|
+
* @return {TimePickerParts | null} 파싱 결과
|
|
17
19
|
*/
|
|
18
20
|
export const parseTimeValue = (value: string): TimePickerParts | null => {
|
|
19
21
|
const match = /^(\d{2}):(\d{2})(?::(\d{2}))?$/.exec(value);
|
|
@@ -33,9 +35,11 @@ export const parseTimeValue = (value: string): TimePickerParts | null => {
|
|
|
33
35
|
|
|
34
36
|
/**
|
|
35
37
|
* TimePicker Utility; 시간 값을 24시간 문자열로 직렬화한다.
|
|
38
|
+
* @utility
|
|
36
39
|
* @param {TimePickerParts} parts 시간 값
|
|
37
40
|
* @param {boolean} withSeconds 초 포함 여부
|
|
38
|
-
* @
|
|
41
|
+
* @desc 각 단위를 두 자리로 맞추고 withSeconds에 따라 초를 포함한다.
|
|
42
|
+
* @return {string} HH:mm 또는 HH:mm:ss 값
|
|
39
43
|
*/
|
|
40
44
|
export const serializeTimeValue = (
|
|
41
45
|
parts: TimePickerParts,
|
|
@@ -47,11 +51,13 @@ export const serializeTimeValue = (
|
|
|
47
51
|
|
|
48
52
|
/**
|
|
49
53
|
* TimePicker Utility; 지정 단위만 순환 증감한다.
|
|
54
|
+
* @utility
|
|
50
55
|
* @param {string} value 시간 값
|
|
51
|
-
* @param {
|
|
56
|
+
* @param {"hours" | "minutes" | "seconds"} unit 증감 단위
|
|
52
57
|
* @param {number} amount 증감량
|
|
53
58
|
* @param {boolean} withSeconds 초 포함 여부
|
|
54
|
-
* @
|
|
59
|
+
* @desc 빈 값은 00:00 기준으로 시작하고 시는 24, 분·초는 60을 경계로 순환한다.
|
|
60
|
+
* @return {string} 증감한 시간 값
|
|
55
61
|
*/
|
|
56
62
|
export const stepTimeValue = (
|
|
57
63
|
value: string,
|
|
@@ -73,27 +79,33 @@ export const stepTimeValue = (
|
|
|
73
79
|
|
|
74
80
|
/**
|
|
75
81
|
* TimePicker Utility; 저장 시를 표시 시로 변환한다.
|
|
82
|
+
* @utility
|
|
76
83
|
* @param {number} hours 24시간 시 값
|
|
77
|
-
* @param {
|
|
78
|
-
* @
|
|
84
|
+
* @param {"12h" | "24h"} format 표시 형식
|
|
85
|
+
* @desc 12시간제에서는 0시와 12시를 12로 표시한다.
|
|
86
|
+
* @return {number} 표시 시 값
|
|
79
87
|
*/
|
|
80
88
|
export const toDisplayHour = (hours: number, format: TimePickerFormat) =>
|
|
81
89
|
format === "12h" ? hours % 12 || 12 : hours;
|
|
82
90
|
|
|
83
91
|
/**
|
|
84
92
|
* TimePicker Utility; 24시간 시 값의 오전·오후를 반환한다.
|
|
93
|
+
* @utility
|
|
85
94
|
* @param {number} hours 24시간 시 값
|
|
86
|
-
* @
|
|
95
|
+
* @desc 12시 이상을 pm, 그 미만을 am으로 분류한다.
|
|
96
|
+
* @return {"am" | "pm"} 오전·오후
|
|
87
97
|
*/
|
|
88
98
|
export const getTimePeriod = (hours: number): TimePickerPeriod =>
|
|
89
99
|
hours >= 12 ? "pm" : "am";
|
|
90
100
|
|
|
91
101
|
/**
|
|
92
102
|
* TimePicker Utility; 오전·오후를 24시간 저장값에 반영한다.
|
|
103
|
+
* @utility
|
|
93
104
|
* @param {string} value 시간 값
|
|
94
|
-
* @param {
|
|
105
|
+
* @param {"am" | "pm"} period 오전·오후
|
|
95
106
|
* @param {boolean} withSeconds 초 포함 여부
|
|
96
|
-
* @
|
|
107
|
+
* @desc 기존 분·초를 보존하고 선택한 period에 맞춰 저장 시만 변환한다.
|
|
108
|
+
* @return {string} 변경한 시간 값
|
|
97
109
|
*/
|
|
98
110
|
export const setTimePeriod = (
|
|
99
111
|
value: string,
|