@uniai-fe/uds-primitives 0.12.6 → 0.12.7
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 +251 -838
- package/package.json +9 -9
- package/src/components/button/markup/Base.tsx +3 -2
- package/src/components/button/styles/button.scss +99 -326
- package/src/components/button/styles/round-button.scss +12 -39
- package/src/components/button/styles/text-button.scss +16 -52
- package/src/components/button/styles/variables.scss +33 -55
- package/src/components/button/types/options.ts +7 -4
- package/src/components/button/types/props.ts +11 -14
- package/src/components/button/utils/index.ts +14 -3
- package/src/components/input/markup/date/Template.tsx +33 -83
- package/src/components/input/markup/date/Trigger.tsx +12 -28
- package/src/components/input/markup/date/range/Template.tsx +35 -94
- package/src/components/input/markup/time/Template.tsx +5 -118
- package/src/components/input/markup/time/Trigger.tsx +2 -35
- package/src/components/input/styles/date.scss +1 -1
- package/src/components/input/styles/text.scss +1 -1
- package/src/components/input/types/date.ts +33 -176
- package/src/components/input/types/time.ts +4 -10
- 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 +0 -6
- package/src/components/time-picker/utils/time.ts +9 -21
|
@@ -21,8 +21,6 @@ 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 계약
|
|
26
24
|
*/
|
|
27
25
|
export type InputTimeHiddenInputProps = Omit<
|
|
28
26
|
ComponentPropsWithoutRef<"input">,
|
|
@@ -34,7 +32,6 @@ export type InputTimeHiddenInputProps = Omit<
|
|
|
34
32
|
* @property {string} hours 시 입력값
|
|
35
33
|
* @property {string} minutes 분 입력값
|
|
36
34
|
* @property {string} seconds 초 입력값
|
|
37
|
-
* @desc 입력 field에 표시하는 시·분·초 draft 문자열
|
|
38
35
|
*/
|
|
39
36
|
export interface InputTimeDraftFields {
|
|
40
37
|
/**
|
|
@@ -55,7 +52,6 @@ export interface InputTimeDraftFields {
|
|
|
55
52
|
* Input Time 편집 중인 시간 값.
|
|
56
53
|
* @property {InputTimeDraftFields} fields 시·분·초 입력값
|
|
57
54
|
* @property {"am" | "pm"} period 오전·오후 구분
|
|
58
|
-
* @desc 저장값 commit 전의 field 문자열과 12시간제 period 상태
|
|
59
55
|
*/
|
|
60
56
|
export interface InputTimeDraft {
|
|
61
57
|
/**
|
|
@@ -103,7 +99,6 @@ export type InputTimeTriggerFields = InputTimeDraftFields;
|
|
|
103
99
|
* @property {(period: "am" | "pm") => void} onPeriodChange 오전·오후 변경 핸들러
|
|
104
100
|
* @property {(amount: 1 | -1) => void} onStep 활성 단위 증감 핸들러
|
|
105
101
|
* @property {(event: FocusEvent<HTMLDivElement>) => void} onRootBlur root blur 핸들러
|
|
106
|
-
* @desc 시·분·초 field, period, stepper와 clock action을 렌더링하기 위한 trigger 계약
|
|
107
102
|
*/
|
|
108
103
|
export interface InputTimeTriggerProps extends Omit<
|
|
109
104
|
ComponentPropsWithoutRef<"div">,
|
|
@@ -230,8 +225,8 @@ export interface InputTimeTriggerProps extends Omit<
|
|
|
230
225
|
* 저장값은 24시간 `HH:mm` 또는 `HH:mm:ss` 문자열을 사용한다.
|
|
231
226
|
* @property {string} [value] 제어형 시간 값
|
|
232
227
|
* @property {string} [defaultValue] 비제어 초기 시간 값
|
|
233
|
-
* @property {(value:
|
|
234
|
-
* @property {(value:
|
|
228
|
+
* @property {(value:string)=>void} [onChange] 값 변경 핸들러
|
|
229
|
+
* @property {(value:string)=>void} [onValueChange] 값 변경 별칭
|
|
235
230
|
* @property {string} [name] form name
|
|
236
231
|
* @property {string} [form] form id
|
|
237
232
|
* @property {UseFormRegisterReturn} [register] react-hook-form register 결과
|
|
@@ -262,9 +257,8 @@ export interface InputTimeTriggerProps extends Omit<
|
|
|
262
257
|
* @property {string} [hoursPlaceholder] 시 placeholder
|
|
263
258
|
* @property {string} [minutesPlaceholder] 분 placeholder
|
|
264
259
|
* @property {string} [secondsPlaceholder] 초 placeholder
|
|
265
|
-
* @property {(event:
|
|
266
|
-
* @property {(event:
|
|
267
|
-
* @desc 시간 trigger, TimePicker panel과 24시간 문자열 hidden form storage를 조합하는 공개 계약
|
|
260
|
+
* @property {(event:FocusEvent<HTMLInputElement>)=>void} [onFocus] focus 핸들러
|
|
261
|
+
* @property {(event:FocusEvent<HTMLDivElement>)=>void} [onBlur] blur 핸들러
|
|
268
262
|
*/
|
|
269
263
|
export interface InputTimeTemplateProps {
|
|
270
264
|
/**
|
|
@@ -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
|
+
* @param {boolean} props.clearable 삭제 action 노출 여부
|
|
9
|
+
* @param {boolean} props.disabled 비활성화 여부
|
|
10
|
+
* @param {() => void} props.onClear 삭제 핸들러
|
|
11
|
+
* @param {() => void} props.onApply 적용 핸들러
|
|
12
|
+
* @returns {ReactNode} TimePicker footer
|
|
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
|
+
* @param {"12h" | "24h"} props.format 표시 형식
|
|
16
|
+
* @param {number | null} props.selectedHour 선택한 표시 시
|
|
17
|
+
* @param {"am" | "pm"} props.period 오전·오후
|
|
18
|
+
* @param {boolean} props.disabled 비활성화 여부
|
|
19
|
+
* @param {(hours: number) => void} props.onHourSelect 시 선택 핸들러
|
|
20
|
+
* @param {(period: "am" | "pm") => void} props.onPeriodChange 오전·오후 변경 핸들러
|
|
21
|
+
* @returns {ReactNode} 시간 선택 section
|
|
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
|
+
* @param {number | null} props.selectedMinute 선택한 분
|
|
12
|
+
* @param {boolean} props.disabled 비활성화 여부
|
|
13
|
+
* @param {(amount: 1 | -1) => void} props.onMinuteStep 1분 증감 핸들러
|
|
14
|
+
* @param {(minutes: number) => void} props.onMinuteSelect 분 선택 핸들러
|
|
15
|
+
* @returns {ReactNode} 분 선택 section
|
|
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
|
+
* @param {string} props.summary 선택한 시간 표시값
|
|
8
|
+
* @returns {ReactNode} 선택 시간 요약
|
|
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
|
+
* @param {string} props.value 24시간 형식 시간 값
|
|
15
|
+
* @param {"12h" | "24h"} props.format 표시 형식
|
|
16
|
+
* @param {boolean} props.clearable 삭제 action 노출 여부
|
|
17
|
+
* @param {boolean} props.disabled 비활성화 여부
|
|
18
|
+
* @param {(hours: number) => void} props.onHourSelect 시 선택 핸들러
|
|
19
|
+
* @param {(minutes: number) => void} props.onMinuteSelect 분 선택 핸들러
|
|
20
|
+
* @param {(period: "am" | "pm") => void} props.onPeriodChange 오전·오후 변경 핸들러
|
|
21
|
+
* @param {(amount: 1 | -1) => void} props.onMinuteStep 1분 증감 핸들러
|
|
22
|
+
* @param {() => void} props.onClear 삭제 핸들러
|
|
23
|
+
* @param {() => void} props.onApply 적용 핸들러
|
|
24
|
+
* @returns {ReactNode} 시간 선택 panel
|
|
25
25
|
* @example
|
|
26
26
|
* <TimePicker.Template
|
|
27
27
|
* value="09:30"
|
|
@@ -21,7 +21,6 @@ export type TimePickerUnit = "hours" | "minutes" | "seconds";
|
|
|
21
21
|
* @property {number} hours 시
|
|
22
22
|
* @property {number} minutes 분
|
|
23
23
|
* @property {number} seconds 초
|
|
24
|
-
* @desc 24시간 저장값의 정규화된 시·분·초 숫자 구성
|
|
25
24
|
*/
|
|
26
25
|
export interface TimePickerParts {
|
|
27
26
|
/**
|
|
@@ -50,7 +49,6 @@ export interface TimePickerParts {
|
|
|
50
49
|
* @property {(amount: 1 | -1) => void} onMinuteStep 1분 증감 핸들러
|
|
51
50
|
* @property {() => void} onClear 삭제 핸들러
|
|
52
51
|
* @property {() => void} onApply 적용 핸들러
|
|
53
|
-
* @desc TimePicker panel의 선택값, 표시 형식과 action 계약
|
|
54
52
|
*/
|
|
55
53
|
export interface TimePickerTemplateProps {
|
|
56
54
|
/**
|
|
@@ -98,7 +96,6 @@ export interface TimePickerTemplateProps {
|
|
|
98
96
|
/**
|
|
99
97
|
* TimePicker Summary props.
|
|
100
98
|
* @property {string} summary 선택한 시간 표시값
|
|
101
|
-
* @desc panel 상단의 현재 선택값 표시 계약
|
|
102
99
|
*/
|
|
103
100
|
export interface TimePickerSummaryProps {
|
|
104
101
|
/**
|
|
@@ -115,7 +112,6 @@ export interface TimePickerSummaryProps {
|
|
|
115
112
|
* @property {boolean} disabled 비활성화 여부
|
|
116
113
|
* @property {(hours: number) => void} onHourSelect 시 선택 핸들러
|
|
117
114
|
* @property {(period: "am" | "pm") => void} onPeriodChange 오전·오후 변경 핸들러
|
|
118
|
-
* @desc 표시 형식별 시 목록과 오전·오후 선택 계약
|
|
119
115
|
*/
|
|
120
116
|
export interface TimePickerHourSectionProps {
|
|
121
117
|
/**
|
|
@@ -150,7 +146,6 @@ export interface TimePickerHourSectionProps {
|
|
|
150
146
|
* @property {boolean} disabled 비활성화 여부
|
|
151
147
|
* @property {(amount: 1 | -1) => void} onMinuteStep 1분 증감 핸들러
|
|
152
148
|
* @property {(minutes: number) => void} onMinuteSelect 분 선택 핸들러
|
|
153
|
-
* @desc 분 quick select와 1분 step action 계약
|
|
154
149
|
*/
|
|
155
150
|
export interface TimePickerMinuteSectionProps {
|
|
156
151
|
/**
|
|
@@ -177,7 +172,6 @@ export interface TimePickerMinuteSectionProps {
|
|
|
177
172
|
* @property {boolean} disabled 비활성화 여부
|
|
178
173
|
* @property {() => void} onClear 삭제 핸들러
|
|
179
174
|
* @property {() => void} onApply 적용 핸들러
|
|
180
|
-
* @desc 삭제 노출 여부와 panel footer action 계약
|
|
181
175
|
*/
|
|
182
176
|
export interface TimePickerFooterProps {
|
|
183
177
|
/**
|
|
@@ -12,10 +12,8 @@ const wrapTimePart = (value: number, limit: number) =>
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* TimePicker Utility; 24시간 문자열을 시간 값으로 파싱한다.
|
|
15
|
-
* @utility
|
|
16
15
|
* @param {string} value HH:mm 또는 HH:mm:ss 값
|
|
17
|
-
* @
|
|
18
|
-
* @return {TimePickerParts | null} 파싱 결과
|
|
16
|
+
* @returns {TimePickerParts | null} 파싱 결과
|
|
19
17
|
*/
|
|
20
18
|
export const parseTimeValue = (value: string): TimePickerParts | null => {
|
|
21
19
|
const match = /^(\d{2}):(\d{2})(?::(\d{2}))?$/.exec(value);
|
|
@@ -35,11 +33,9 @@ export const parseTimeValue = (value: string): TimePickerParts | null => {
|
|
|
35
33
|
|
|
36
34
|
/**
|
|
37
35
|
* TimePicker Utility; 시간 값을 24시간 문자열로 직렬화한다.
|
|
38
|
-
* @utility
|
|
39
36
|
* @param {TimePickerParts} parts 시간 값
|
|
40
37
|
* @param {boolean} withSeconds 초 포함 여부
|
|
41
|
-
* @
|
|
42
|
-
* @return {string} HH:mm 또는 HH:mm:ss 값
|
|
38
|
+
* @returns {string} HH:mm 또는 HH:mm:ss 값
|
|
43
39
|
*/
|
|
44
40
|
export const serializeTimeValue = (
|
|
45
41
|
parts: TimePickerParts,
|
|
@@ -51,13 +47,11 @@ export const serializeTimeValue = (
|
|
|
51
47
|
|
|
52
48
|
/**
|
|
53
49
|
* TimePicker Utility; 지정 단위만 순환 증감한다.
|
|
54
|
-
* @utility
|
|
55
50
|
* @param {string} value 시간 값
|
|
56
|
-
* @param {
|
|
51
|
+
* @param {TimePickerUnit} unit 증감 단위
|
|
57
52
|
* @param {number} amount 증감량
|
|
58
53
|
* @param {boolean} withSeconds 초 포함 여부
|
|
59
|
-
* @
|
|
60
|
-
* @return {string} 증감한 시간 값
|
|
54
|
+
* @returns {string} 증감한 시간 값
|
|
61
55
|
*/
|
|
62
56
|
export const stepTimeValue = (
|
|
63
57
|
value: string,
|
|
@@ -79,33 +73,27 @@ export const stepTimeValue = (
|
|
|
79
73
|
|
|
80
74
|
/**
|
|
81
75
|
* TimePicker Utility; 저장 시를 표시 시로 변환한다.
|
|
82
|
-
* @utility
|
|
83
76
|
* @param {number} hours 24시간 시 값
|
|
84
|
-
* @param {
|
|
85
|
-
* @
|
|
86
|
-
* @return {number} 표시 시 값
|
|
77
|
+
* @param {TimePickerFormat} format 표시 형식
|
|
78
|
+
* @returns {number} 표시 시 값
|
|
87
79
|
*/
|
|
88
80
|
export const toDisplayHour = (hours: number, format: TimePickerFormat) =>
|
|
89
81
|
format === "12h" ? hours % 12 || 12 : hours;
|
|
90
82
|
|
|
91
83
|
/**
|
|
92
84
|
* TimePicker Utility; 24시간 시 값의 오전·오후를 반환한다.
|
|
93
|
-
* @utility
|
|
94
85
|
* @param {number} hours 24시간 시 값
|
|
95
|
-
* @
|
|
96
|
-
* @return {"am" | "pm"} 오전·오후
|
|
86
|
+
* @returns {TimePickerPeriod} 오전·오후
|
|
97
87
|
*/
|
|
98
88
|
export const getTimePeriod = (hours: number): TimePickerPeriod =>
|
|
99
89
|
hours >= 12 ? "pm" : "am";
|
|
100
90
|
|
|
101
91
|
/**
|
|
102
92
|
* TimePicker Utility; 오전·오후를 24시간 저장값에 반영한다.
|
|
103
|
-
* @utility
|
|
104
93
|
* @param {string} value 시간 값
|
|
105
|
-
* @param {
|
|
94
|
+
* @param {TimePickerPeriod} period 오전·오후
|
|
106
95
|
* @param {boolean} withSeconds 초 포함 여부
|
|
107
|
-
* @
|
|
108
|
-
* @return {string} 변경한 시간 값
|
|
96
|
+
* @returns {string} 변경한 시간 값
|
|
109
97
|
*/
|
|
110
98
|
export const setTimePeriod = (
|
|
111
99
|
value: string,
|