@idbrnd/design-system 3.2.0 → 4.0.0
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 +486 -1
- package/dist/components/DatePicker/Calendar.d.ts +37 -0
- package/dist/components/DatePicker/DatePicker.d.ts +4 -0
- package/dist/components/DatePicker/DatePicker.types.d.ts +118 -0
- package/dist/components/DatePicker/MonthYearSelect.d.ts +15 -0
- package/dist/components/DatePicker/dateUtils.d.ts +33 -0
- package/dist/components/Feedback/EmptyState/EmptyState.d.ts +30 -0
- package/dist/components/Feedback/Modal/Modal.d.ts +3 -0
- package/dist/components/Feedback/Modal/Modal.types.d.ts +48 -0
- package/dist/components/TimePicker/TimePicker.d.ts +4 -0
- package/dist/components/TimePicker/TimePicker.types.d.ts +88 -0
- package/dist/components/TimePicker/timeUtils.d.ts +27 -0
- package/dist/components/shared/WheelColumn.d.ts +11 -0
- package/dist/icons/generated/CalendarIcon.d.ts +3 -0
- package/dist/icons/generated/index.d.ts +1 -0
- package/dist/icons/iconMap.d.ts +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +4678 -3313
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import type { TimePickerVariant } from '../TimePicker/TimePicker.types';
|
|
3
|
+
/**
|
|
4
|
+
* - `normal`: 단일 날짜 선택, 달력 1개월 노출
|
|
5
|
+
* - `period`: 시작/종료 날짜 선택, 달력 1개월 노출
|
|
6
|
+
* - `range`: 시작/종료 날짜 선택, 연속된 2개월 동시 노출
|
|
7
|
+
* @defaultValue `'normal'`
|
|
8
|
+
*/
|
|
9
|
+
export type DatePickerVariant = 'normal' | 'period' | 'range';
|
|
10
|
+
/**
|
|
11
|
+
* - `icon`: 아이콘 버튼 트리거. 텍스트 필드에 날짜 직접 입력 가능
|
|
12
|
+
* - `field`: 텍스트 필드 트리거. 클릭 시에만 달력이 열리고 직접 입력 불가
|
|
13
|
+
* @defaultValue `'icon'`
|
|
14
|
+
*/
|
|
15
|
+
export type DatePickerTrigger = 'icon' | 'field';
|
|
16
|
+
/** Action area의 Main 버튼(적용) 스타일. @defaultValue `'fill'` */
|
|
17
|
+
export type DatePickerActionMainType = 'fill' | 'text';
|
|
18
|
+
export interface DatePickerDateRange {
|
|
19
|
+
start: Date | null;
|
|
20
|
+
end: Date | null;
|
|
21
|
+
}
|
|
22
|
+
/** Action area 커스텀 콘텐츠 함수형에 전달되는 인자 */
|
|
23
|
+
export interface DatePickerActionRenderProps {
|
|
24
|
+
/** 기본 동작(오늘로 이동 / 적용)을 그대로 실행하는 핸들러. 커스텀 요소에 연결해 재사용할 수 있다 */
|
|
25
|
+
onClick: () => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Action area 슬롯 콘텐츠.
|
|
29
|
+
* - 미지정: 기본 콘텐츠(오늘 텍스트 버튼 / 적용 버튼) 노출
|
|
30
|
+
* - ReactNode: 완전히 다른 요소(체크박스, 아이콘 버튼 등)로 교체. 동작은 직접 구현해야 한다
|
|
31
|
+
* - 함수: 기본 동작 핸들러(`onClick`)를 전달받아, i18n 라벨 등 텍스트만 바꾼 커스텀 요소에 그대로 재사용할 수 있다
|
|
32
|
+
*/
|
|
33
|
+
export type DatePickerActionContent = ReactNode | ((props: DatePickerActionRenderProps) => ReactNode);
|
|
34
|
+
interface DatePickerBaseProps {
|
|
35
|
+
/** 상단 heading(라벨) 텍스트. 미지정 시 라벨 영역이 노출되지 않는다. */
|
|
36
|
+
heading?: string;
|
|
37
|
+
/** 필수 입력 여부. heading 노출 시 `*`를 함께 표시한다. @defaultValue `false` */
|
|
38
|
+
required?: boolean;
|
|
39
|
+
/** 트리거 placeholder. @defaultValue `'YYYY-MM-DD'` */
|
|
40
|
+
placeholder?: string;
|
|
41
|
+
/** @defaultValue `'normal'` */
|
|
42
|
+
variant?: DatePickerVariant;
|
|
43
|
+
/** @defaultValue `'icon'` */
|
|
44
|
+
trigger?: DatePickerTrigger;
|
|
45
|
+
/** 전체 비활성화 여부. @defaultValue `false` */
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/** 날짜 하단에 시간 입력(HH:MM)을 함께 노출할지 여부. @defaultValue `false` */
|
|
48
|
+
hasTime?: boolean;
|
|
49
|
+
/** hasTime일 때 시작/종료 시간 선택에 사용하는 TimePicker의 variant. @defaultValue `'aa-hh-mm'` */
|
|
50
|
+
timeVariant?: TimePickerVariant;
|
|
51
|
+
/** 팝오버 하단 액션 영역 노출 여부. `false`면 날짜 선택 즉시 onChange가 호출된다. @defaultValue `true` */
|
|
52
|
+
actionArea?: boolean;
|
|
53
|
+
/** Action area 내 보조 영역(기본: "오늘" 텍스트 버튼) 노출 여부. @defaultValue `true` */
|
|
54
|
+
actionSub?: boolean;
|
|
55
|
+
/** Action area 보조 영역 커스텀 콘텐츠. 미지정 시 기본 "오늘" 텍스트 버튼이 노출된다 */
|
|
56
|
+
actionSubContent?: DatePickerActionContent;
|
|
57
|
+
/** Action area 내 메인 영역(기본: "적용" 버튼) 노출 여부. @defaultValue `true` */
|
|
58
|
+
actionMain?: boolean;
|
|
59
|
+
/** Action area 메인 버튼 스타일. actionMainContent 지정 시 무시된다. @defaultValue `'text'` */
|
|
60
|
+
actionMainType?: DatePickerActionMainType;
|
|
61
|
+
/** Action area 메인 영역 커스텀 콘텐츠. 미지정 시 actionMainType에 따른 기본 "적용" 버튼이 노출된다 */
|
|
62
|
+
actionMainContent?: DatePickerActionContent;
|
|
63
|
+
/** 헤더의 년/월 라벨 클릭 시 년/월 빠른 선택 뷰로 전환할지 여부. @defaultValue `true` */
|
|
64
|
+
monthYearActionArea?: boolean;
|
|
65
|
+
/** 특정 날짜를 선택 불가 처리하는 판별 함수 */
|
|
66
|
+
isDateDisabled?: (date: Date) => boolean;
|
|
67
|
+
/** hasTime일 때 시작 시간 행의 라벨. @defaultValue `'시작'` */
|
|
68
|
+
startLabel?: string;
|
|
69
|
+
/** hasTime && (period|range)일 때 종료 시간 행의 라벨. @defaultValue `'종료'` */
|
|
70
|
+
endLabel?: string;
|
|
71
|
+
/**
|
|
72
|
+
* 캘린더 헤더/월·년 선택 라벨("2026년 8월") 포맷을 재정의한다. i18n 등에 사용.
|
|
73
|
+
* month는 1~12 값으로 전달된다. 미지정 시 `${year}년 ${month}월` 형식을 사용한다.
|
|
74
|
+
*/
|
|
75
|
+
formatMonthYear?: (year: number, month: number) => string;
|
|
76
|
+
/**
|
|
77
|
+
* 트리거/시간 선택 박스에 표시되는 시간("오전 08:06") 포맷을 재정의한다. i18n 등에 사용.
|
|
78
|
+
* hours는 0~23(24시간제) 값으로 전달된다. 미지정 시 `오전/오후 HH:MM` 형식을 사용한다.
|
|
79
|
+
*/
|
|
80
|
+
formatTime?: (hours: number, minutes: number) => string;
|
|
81
|
+
/** 시간 선택 휠 팝오버의 "현재" 버튼 라벨. @defaultValue `'현재'` */
|
|
82
|
+
timeNowLabel?: string;
|
|
83
|
+
/** 연/월 선택 드롭다운의 "초기화" 버튼 라벨. @defaultValue `'초기화'` */
|
|
84
|
+
monthYearResetLabel?: string;
|
|
85
|
+
/** 시간/연·월 선택 휠 팝오버 공용 "적용" 버튼 라벨. @defaultValue `'적용'` */
|
|
86
|
+
wheelApplyLabel?: string;
|
|
87
|
+
/**
|
|
88
|
+
* 캘린더 요일 라벨. 월요일을 첫 컬럼으로 배치하므로 월요일부터 순서대로 7개를 전달해야 한다.
|
|
89
|
+
* 미지정 시 `['월', '화', '수', '목', '금', '토', '일']`을 사용한다.
|
|
90
|
+
*/
|
|
91
|
+
weekdayLabels?: readonly string[];
|
|
92
|
+
/** 시간 선택 휠의 오전(AM) 라벨. @defaultValue `'오전'` */
|
|
93
|
+
amLabel?: string;
|
|
94
|
+
/** 시간 선택 휠의 오후(PM) 라벨. @defaultValue `'오후'` */
|
|
95
|
+
pmLabel?: string;
|
|
96
|
+
/** 이전 달 이동 버튼의 aria-label. @defaultValue `'이전 달'` */
|
|
97
|
+
prevMonthLabel?: string;
|
|
98
|
+
/** 다음 달 이동 버튼의 aria-label. @defaultValue `'다음 달'` */
|
|
99
|
+
nextMonthLabel?: string;
|
|
100
|
+
/** 트리거의 달력 열기 아이콘 버튼 aria-label. @defaultValue `'달력 열기'` */
|
|
101
|
+
openCalendarLabel?: string;
|
|
102
|
+
/** hasTime일 때 시간 선택 박스에 값이 없을 때 노출되는 placeholder. @defaultValue `'AA HH:MM'` */
|
|
103
|
+
timePlaceholder?: string;
|
|
104
|
+
/** 루트 컨테이너에 적용할 추가 style */
|
|
105
|
+
customStyle?: CSSProperties;
|
|
106
|
+
}
|
|
107
|
+
export interface DatePickerNormalProps extends DatePickerBaseProps {
|
|
108
|
+
variant?: 'normal';
|
|
109
|
+
value: Date | null;
|
|
110
|
+
onChange: (value: Date | null) => void;
|
|
111
|
+
}
|
|
112
|
+
export interface DatePickerPeriodProps extends DatePickerBaseProps {
|
|
113
|
+
variant: 'period' | 'range';
|
|
114
|
+
value: DatePickerDateRange;
|
|
115
|
+
onChange: (value: DatePickerDateRange) => void;
|
|
116
|
+
}
|
|
117
|
+
export type DatePickerProps = DatePickerNormalProps | DatePickerPeriodProps;
|
|
118
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface MonthYearSelectProps {
|
|
2
|
+
year: number;
|
|
3
|
+
month: number;
|
|
4
|
+
onChange: (year: number, month: number) => void;
|
|
5
|
+
/** false면 클릭해도 열리지 않는 정적 라벨로 렌더링한다 */
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
/** "2026년 8월" 라벨 포맷을 재정의한다. month는 1~12 값으로 전달된다 */
|
|
8
|
+
formatLabel?: (year: number, month: number) => string;
|
|
9
|
+
/** 드롭다운의 "초기화" 버튼 라벨. @defaultValue '초기화' */
|
|
10
|
+
resetLabel?: string;
|
|
11
|
+
/** 드롭다운의 "적용" 버튼 라벨. @defaultValue '적용' */
|
|
12
|
+
applyLabel?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function MonthYearSelect({ year, month, onChange, disabled, formatLabel, resetLabel, applyLabel, }: MonthYearSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default MonthYearSelect;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** buildMonthGrid가 월요일을 첫 컬럼으로 배치하므로 라벨도 월요일부터 시작해야 한다 */
|
|
2
|
+
export declare const WEEKDAY_LABELS: readonly ["월", "화", "수", "목", "금", "토", "일"];
|
|
3
|
+
export interface CalendarDay {
|
|
4
|
+
date: Date;
|
|
5
|
+
inCurrentMonth: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function startOfDay(date: Date): Date;
|
|
8
|
+
export declare function isSameDay(a: Date | null, b: Date | null): boolean;
|
|
9
|
+
export declare function isSameMonth(a: Date, b: Date): boolean;
|
|
10
|
+
export declare function isBefore(a: Date, b: Date): boolean;
|
|
11
|
+
export declare function isAfter(a: Date, b: Date): boolean;
|
|
12
|
+
export declare function isWithinRange(date: Date, start: Date | null, end: Date | null): boolean;
|
|
13
|
+
export declare function addMonths(year: number, month: number, delta: number): {
|
|
14
|
+
year: number;
|
|
15
|
+
month: number;
|
|
16
|
+
};
|
|
17
|
+
/** 항상 6주(6x7)로 구성된 달력 그리드를 생성한다 (앞/뒤 달 날짜 포함) */
|
|
18
|
+
export declare function buildMonthGrid(year: number, month: number): CalendarDay[][];
|
|
19
|
+
export declare function formatDate(date: Date | null): string;
|
|
20
|
+
export declare function parseDate(value: string): Date | null;
|
|
21
|
+
export declare function parseTime(value: string): {
|
|
22
|
+
hours: number;
|
|
23
|
+
minutes: number;
|
|
24
|
+
} | null;
|
|
25
|
+
export declare function withTime(date: Date, hours: number, minutes: number): Date;
|
|
26
|
+
export declare function today(): Date;
|
|
27
|
+
/**
|
|
28
|
+
* 날짜 직접 입력 필드에 숫자를 입력하면 4번째, 6번째 자리 뒤에 "-"를 자동으로 붙인다.
|
|
29
|
+
* "~"로 구분된 두 번째 날짜(기간 선택)에도 동일하게 적용된다.
|
|
30
|
+
* 자동으로 붙은 "-"를 backspace로 지웠을 때 아무 반응이 없어 보이는 걸 막기 위해,
|
|
31
|
+
* 직전 값과 비교해 실제로는 숫자 하나가 지워진 것으로 처리한다.
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatDateInputMask(nextRaw: string, prevRaw: string): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
export type EmptyStateSize = 'large' | 'medium' | 'small';
|
|
3
|
+
export interface EmptyStateProps {
|
|
4
|
+
/** 배치 구역의 크기·위계에 따른 사이즈 */
|
|
5
|
+
size?: EmptyStateSize;
|
|
6
|
+
/**
|
|
7
|
+
* 상단 시각 요소 슬롯. 일러스트·아이콘·이미지·임의의 컴포넌트를 모두 받는다.
|
|
8
|
+
* 넘기지 않으면 영역 자체를 렌더하지 않는다.
|
|
9
|
+
*/
|
|
10
|
+
visualContent?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* 타이틀. 상황을 짧게 요약하며 단일 행을 권장한다.
|
|
13
|
+
* 넘기지 않으면 영역 자체를 렌더하지 않는다.
|
|
14
|
+
*/
|
|
15
|
+
headingContent?: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* 설명. 개행(`\n`)이 그대로 반영되며, 줄 수는 제한하지 않는다 (가이드상 두 줄 권장).
|
|
18
|
+
* 넘기지 않으면 영역 자체를 렌더하지 않는다.
|
|
19
|
+
*/
|
|
20
|
+
descriptionContent?: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* CTA 버튼 슬롯. 소비처가 원하는 버튼 컴포넌트를 직접 넣는다.
|
|
23
|
+
* 넘기지 않으면 영역 자체를 렌더하지 않는다.
|
|
24
|
+
*/
|
|
25
|
+
buttonContent?: ReactNode;
|
|
26
|
+
customStyle?: CSSProperties;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
declare function EmptyState({ size, visualContent, headingContent, descriptionContent, buttonContent, customStyle, className }: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export default EmptyState;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ModalProps } from "./Modal.types";
|
|
2
|
+
declare function Modal({ open, onClose, size, type, heading, navBar, showClose, navLeadingSlot, navTrailingSlot, mainAction, subAction, actionSlot, closeOnEsc, closeOnDimClick, customStyle, className, children, }: ModalProps): import("react").ReactPortal | null;
|
|
3
|
+
export default Modal;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
+
export type ModalSize = "small" | "medium" | "large";
|
|
3
|
+
export type ModalType = "fixed" | "hug";
|
|
4
|
+
export interface ModalAction {
|
|
5
|
+
label: string;
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ModalProps {
|
|
11
|
+
/** 모달 표시 여부 (controlled) */
|
|
12
|
+
open: boolean;
|
|
13
|
+
/** ESC 키·닫기 버튼·딤 클릭으로 닫힐 때 호출 */
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
/** 모달 너비 프리셋 @defaultValue 'medium' */
|
|
16
|
+
size?: ModalSize;
|
|
17
|
+
/**
|
|
18
|
+
* 너비 결정 방식
|
|
19
|
+
* - `fixed`: size별 고정 너비 (440 / 840 / 1440)
|
|
20
|
+
* - `hug`: 콘텐츠에 맞춰 size별 min~max 범위에서 결정
|
|
21
|
+
* @defaultValue 'fixed'
|
|
22
|
+
*/
|
|
23
|
+
type?: ModalType;
|
|
24
|
+
/** 헤더 타이틀 — 문자열 또는 임의의 ReactNode */
|
|
25
|
+
heading?: ReactNode;
|
|
26
|
+
/** 헤더(Nav Bar) 노출 여부 @defaultValue true */
|
|
27
|
+
navBar?: boolean;
|
|
28
|
+
/** 헤더 우측 끝 닫기(X) 버튼 노출 여부 @defaultValue true */
|
|
29
|
+
showClose?: boolean;
|
|
30
|
+
/** 헤더 좌측 슬롯 */
|
|
31
|
+
navLeadingSlot?: ReactNode;
|
|
32
|
+
/** 헤더 우측 슬롯 (닫기 버튼 왼쪽에 배치) */
|
|
33
|
+
navTrailingSlot?: ReactNode;
|
|
34
|
+
/** 메인 액션 — FillButton으로 렌더링 */
|
|
35
|
+
mainAction?: ModalAction;
|
|
36
|
+
/** 서브 액션 — OutlineButton으로 렌더링 (메인 액션 좌측) */
|
|
37
|
+
subAction?: ModalAction;
|
|
38
|
+
/** 지정 시 mainAction/subAction 대신 액션 영역을 통째로 교체 */
|
|
39
|
+
actionSlot?: ReactNode;
|
|
40
|
+
/** ESC 키로 닫기 허용 @defaultValue true */
|
|
41
|
+
closeOnEsc?: boolean;
|
|
42
|
+
/** 딤 클릭으로 닫기 허용 @defaultValue false */
|
|
43
|
+
closeOnDimClick?: boolean;
|
|
44
|
+
customStyle?: CSSProperties;
|
|
45
|
+
className?: string;
|
|
46
|
+
/** 콘텐츠 영역 */
|
|
47
|
+
children?: ReactNode;
|
|
48
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TimePickerProps } from "./TimePicker.types";
|
|
2
|
+
export type { TimePickerActionContent, TimePickerActionMainType, TimePickerActionRenderProps, TimePickerProps, TimePickerTrigger, TimePickerValue, TimePickerVariant, } from "./TimePicker.types";
|
|
3
|
+
declare function TimePicker(props: TimePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default TimePicker;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import type { TimePickerValue, TimePickerVariant } from './timeUtils';
|
|
3
|
+
export type { TimePickerValue, TimePickerVariant } from './timeUtils';
|
|
4
|
+
/**
|
|
5
|
+
* - `icon`: 아이콘 버튼 트리거. 텍스트 필드에 시간 직접 입력 가능.
|
|
6
|
+
* 단, variant가 `aa-hh-mm`/`aa-hh`(오전/오후 컬럼 포함)면 amLabel/pmLabel 문자열을 그대로
|
|
7
|
+
* 입력받아야 해서 국제화가 불가능하므로 직접 입력이 비활성화되고 `field`처럼 동작한다.
|
|
8
|
+
* `hh-mm`(24시간제)에서만 실제로 직접 입력이 가능하다.
|
|
9
|
+
* - `field`: 텍스트 필드 트리거. 클릭 시에만 팝오버가 열리고 직접 입력 불가
|
|
10
|
+
* - `compact`: heading 없이 값/placeholder만 노출하는 작은 셀렉트박스 트리거.
|
|
11
|
+
* 직접 입력은 지원하지 않는다. DatePicker의 시작/종료 시간 필드처럼 다른 컴포넌트 안에
|
|
12
|
+
* 인라인으로 임베드할 때 사용한다.
|
|
13
|
+
* @defaultValue `'icon'`
|
|
14
|
+
*/
|
|
15
|
+
export type TimePickerTrigger = 'icon' | 'field' | 'compact';
|
|
16
|
+
/** Action area의 Main 버튼(적용) 스타일. @defaultValue `'text'` */
|
|
17
|
+
export type TimePickerActionMainType = 'fill' | 'text';
|
|
18
|
+
/** Action area 커스텀 콘텐츠 함수형에 전달되는 인자 */
|
|
19
|
+
export interface TimePickerActionRenderProps {
|
|
20
|
+
/** 기본 동작(현재 시각으로 이동 / 적용)을 그대로 실행하는 핸들러. 커스텀 요소에 연결해 재사용할 수 있다 */
|
|
21
|
+
onClick: () => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Action area 슬롯 콘텐츠.
|
|
25
|
+
* - 미지정: 기본 콘텐츠(현재 텍스트 버튼 / 적용 버튼) 노출
|
|
26
|
+
* - ReactNode: 완전히 다른 요소로 교체. 동작은 직접 구현해야 한다
|
|
27
|
+
* - 함수: 기본 동작 핸들러(`onClick`)를 전달받아, i18n 라벨 등 텍스트만 바꾼 커스텀 요소에 그대로 재사용할 수 있다
|
|
28
|
+
*/
|
|
29
|
+
export type TimePickerActionContent = ReactNode | ((props: TimePickerActionRenderProps) => ReactNode);
|
|
30
|
+
export interface TimePickerProps {
|
|
31
|
+
/** 현재 선택된 값 */
|
|
32
|
+
value: TimePickerValue | null;
|
|
33
|
+
/** 값 변경 시 호출되는 콜백 */
|
|
34
|
+
onChange: (value: TimePickerValue) => void;
|
|
35
|
+
/**
|
|
36
|
+
* - `aa-hh-mm`: 오전/오후 + 12시간제 시 + 분 (3열)
|
|
37
|
+
* - `aa-hh`: 오전/오후 + 12시간제 시 (분 없음, 2열)
|
|
38
|
+
* - `hh-mm`: 24시간제 시 + 분 (오전/오후 없음, 2열)
|
|
39
|
+
* @defaultValue `'aa-hh-mm'`
|
|
40
|
+
*/
|
|
41
|
+
variant?: TimePickerVariant;
|
|
42
|
+
/** @defaultValue `'icon'` */
|
|
43
|
+
trigger?: TimePickerTrigger;
|
|
44
|
+
/** 상단 heading(라벨) 텍스트. 미지정 시 라벨 영역이 노출되지 않는다. */
|
|
45
|
+
heading?: string;
|
|
46
|
+
/** 필수 입력 여부. heading 노출 시 `*`를 함께 표시한다. @defaultValue `false` */
|
|
47
|
+
required?: boolean;
|
|
48
|
+
/** 트리거 placeholder. 미지정 시 variant에 맞는 형식(`"AA HH:MM"` 등)을 사용한다 */
|
|
49
|
+
placeholder?: string;
|
|
50
|
+
/** 전체 비활성화 여부. @defaultValue `false` */
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
/** 팝오버 하단 액션 영역 노출 여부. `false`면 값 선택 즉시 onChange가 호출된다. @defaultValue `true` */
|
|
53
|
+
actionArea?: boolean;
|
|
54
|
+
/** Action area 내 보조 영역(기본: "현재" 텍스트 버튼) 노출 여부. @defaultValue `true` */
|
|
55
|
+
actionSub?: boolean;
|
|
56
|
+
/** Action area 보조 영역 커스텀 콘텐츠. 미지정 시 기본 "현재" 텍스트 버튼이 노출된다 */
|
|
57
|
+
actionSubContent?: TimePickerActionContent;
|
|
58
|
+
/** Action area 내 메인 영역(기본: "적용" 버튼) 노출 여부. @defaultValue `true` */
|
|
59
|
+
actionMain?: boolean;
|
|
60
|
+
/** Action area 메인 버튼 스타일. actionMainContent 지정 시 무시된다. @defaultValue `'text'` */
|
|
61
|
+
actionMainType?: TimePickerActionMainType;
|
|
62
|
+
/** Action area 메인 영역 커스텀 콘텐츠. 미지정 시 actionMainType에 따른 기본 "적용" 버튼이 노출된다 */
|
|
63
|
+
actionMainContent?: TimePickerActionContent;
|
|
64
|
+
/** 휠 팝오버의 "현재" 버튼 라벨. @defaultValue `'현재'` */
|
|
65
|
+
nowLabel?: string;
|
|
66
|
+
/** 휠 팝오버의 "적용" 버튼 라벨. @defaultValue `'적용'` */
|
|
67
|
+
applyLabel?: string;
|
|
68
|
+
/** 오전(AM) 라벨. @defaultValue `'오전'` */
|
|
69
|
+
amLabel?: string;
|
|
70
|
+
/** 오후(PM) 라벨. @defaultValue `'오후'` */
|
|
71
|
+
pmLabel?: string;
|
|
72
|
+
/**
|
|
73
|
+
* 트리거에 표시되는 시간("오전 08:06") 포맷을 재정의한다. i18n 등에 사용.
|
|
74
|
+
* hours는 0~23(24시간제) 값으로 전달된다. 미지정 시 variant에 맞는 기본 형식을 사용한다.
|
|
75
|
+
*/
|
|
76
|
+
formatTime?: (hours: number, minutes: number) => string;
|
|
77
|
+
/** 트리거의 시간 선택 아이콘 버튼 aria-label. @defaultValue `'시간 선택 열기'` */
|
|
78
|
+
openLabel?: string;
|
|
79
|
+
/** 루트 컨테이너에 적용할 추가 style */
|
|
80
|
+
customStyle?: CSSProperties;
|
|
81
|
+
/**
|
|
82
|
+
* @internal 팝오버 DOM 노드가 마운트/언마운트될 때 호출된다.
|
|
83
|
+
* TimePicker를 다른 컴포넌트(DatePicker 등)에 임베드할 때, 팝오버가 `document.body`에
|
|
84
|
+
* 별도로 포탈되어 부모의 outside-click/scroll 판정에서 "바깥"으로 오인되는 것을 막기 위해
|
|
85
|
+
* 부모가 이 팝오버 노드를 자신의 컨테인먼트 체크에 포함시킬 수 있도록 노출한다.
|
|
86
|
+
*/
|
|
87
|
+
onPopoverRef?: (node: HTMLDivElement | null) => void;
|
|
88
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface TimePickerValue {
|
|
2
|
+
hours: number;
|
|
3
|
+
minutes: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* - `aa-hh-mm`: 오전/오후 + 12시간제 시 + 분 (3열)
|
|
7
|
+
* - `aa-hh`: 오전/오후 + 12시간제 시 (분 없음, 2열)
|
|
8
|
+
* - `hh-mm`: 24시간제 시 + 분 (오전/오후 없음, 2열)
|
|
9
|
+
*/
|
|
10
|
+
export type TimePickerVariant = 'aa-hh-mm' | 'aa-hh' | 'hh-mm';
|
|
11
|
+
type Period = 'AM' | 'PM';
|
|
12
|
+
export declare function hasMinuteColumn(variant: TimePickerVariant): boolean;
|
|
13
|
+
export declare function hasPeriodColumn(variant: TimePickerVariant): boolean;
|
|
14
|
+
export declare function toPeriod(hours: number): Period;
|
|
15
|
+
export declare function toHour12(hours: number): number;
|
|
16
|
+
export declare function toHours24(period: Period, hour12: number): number;
|
|
17
|
+
/** 트리거/텍스트에 노출되는 기본 표시 포맷. amLabel/pmLabel로 i18n 라벨을 대체할 수 있다 */
|
|
18
|
+
export declare function formatTimePickerValue(value: TimePickerValue, variant: TimePickerVariant, amLabel?: string, pmLabel?: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* 직접 입력 마스킹. 선행 비-숫자 문자(예: "오전")는 그대로 접두로 보존하고,
|
|
21
|
+
* 숫자 부분만 variant에 맞춰(HH 또는 HH:MM) 자동으로 ":"를 붙인다.
|
|
22
|
+
* 자동으로 붙은 ":"를 backspace로 지웠을 때도 숫자 하나가 지워지도록 보정한다.
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatTimeInputMask(nextRaw: string, prevRaw: string, variant: TimePickerVariant): string;
|
|
25
|
+
/** 직접 입력된 텍스트를 파싱한다. 형식이 맞지 않으면 null을 반환한다 */
|
|
26
|
+
export declare function parseTimeInput(text: string, variant: TimePickerVariant, amLabel?: string, pmLabel?: string): TimePickerValue | null;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type WheelColumnAlign = 'center' | 'top';
|
|
2
|
+
interface WheelColumnProps<T extends string | number> {
|
|
3
|
+
items: T[];
|
|
4
|
+
value: T;
|
|
5
|
+
onChange: (value: T) => void;
|
|
6
|
+
format?: (item: T) => string;
|
|
7
|
+
/** 활성 항목을 컬럼의 중앙(center) 또는 최상단(top)에 정렬한다. @defaultValue 'center' */
|
|
8
|
+
align?: WheelColumnAlign;
|
|
9
|
+
}
|
|
10
|
+
declare function WheelColumn<T extends string | number>({ items, value, onChange, format, align, }: WheelColumnProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default WheelColumn;
|
|
@@ -14,6 +14,7 @@ export { default as BookFillIcon } from "./BookFillIcon";
|
|
|
14
14
|
export { default as BookIcon } from "./BookIcon";
|
|
15
15
|
export { default as BotIcon } from "./BotIcon";
|
|
16
16
|
export { default as BuildingIcon } from "./BuildingIcon";
|
|
17
|
+
export { default as CalendarIcon } from "./CalendarIcon";
|
|
17
18
|
export { default as CarbonIcon } from "./CarbonIcon";
|
|
18
19
|
export { default as CaretDownIcon } from "./CaretDownIcon";
|
|
19
20
|
export { default as CaretUpIcon } from "./CaretUpIcon";
|
package/dist/icons/iconMap.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare const iconMap: {
|
|
|
15
15
|
readonly book: ({ size, color, style, ...props }: import("./Icon.types").IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
readonly bot: ({ size, color, style, ...props }: import("./Icon.types").IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
readonly building: ({ size, color, style, ...props }: import("./Icon.types").IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
readonly calendar: ({ size, color, style, ...props }: import("./Icon.types").IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
readonly carbon: ({ size, color, style, ...props }: import("./Icon.types").IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
readonly "caret-down": ({ size, color, style, ...props }: import("./Icon.types").IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
21
|
readonly "caret-up": ({ size, color, style, ...props }: import("./Icon.types").IconProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -28,10 +28,14 @@ export { default as ToggleSwitch } from "./components/Control/ToggleSwitch/Toggl
|
|
|
28
28
|
export type { CheckBoxProps, CheckBoxVariant, CheckBoxSize, CheckBoxDensity, } from "./components/Control/CheckBox/CheckBox";
|
|
29
29
|
export type { RadioProps, RadioVariant, RadioSize, RadioDensity, } from "./components/Control/Radio/Radio";
|
|
30
30
|
export type { ToggleSwitchProps, ToggleSwitchSize, } from "./components/Control/ToggleSwitch/ToggleSwitch";
|
|
31
|
+
export { default as EmptyState } from "./components/Feedback/EmptyState/EmptyState";
|
|
32
|
+
export { default as Modal } from "./components/Feedback/Modal/Modal";
|
|
33
|
+
export type { ModalProps, ModalSize, ModalType, ModalAction, } from "./components/Feedback/Modal/Modal.types";
|
|
31
34
|
export { default as PushBadge } from "./components/Feedback/PushBadge/PushBadge";
|
|
32
35
|
export { dismissToast, showToast } from "./components/Feedback/Toast/Toast";
|
|
33
36
|
export { dismissSnackbar, showSnackbar, } from "./components/Feedback/Snackbar/Snackbar";
|
|
34
37
|
export { default as Spinner, Clip, CustomSpinner, FadeSpinner, } from "./components/Spinner/Spinner";
|
|
38
|
+
export type { EmptyStateProps, EmptyStateSize, } from "./components/Feedback/EmptyState/EmptyState";
|
|
35
39
|
export type { PushBadgeProps, PushBadgeVariant, } from "./components/Feedback/PushBadge/PushBadge";
|
|
36
40
|
export type { ToastShowOptions, ToastVariant, } from "./components/Feedback/Toast/Toast";
|
|
37
41
|
export type { SnackbarShowOptions, SnackbarVariant, } from "./components/Feedback/Snackbar/Snackbar";
|
|
@@ -46,6 +50,10 @@ export { default as StateBadge } from "./components/Content/StateBadge/StateBadg
|
|
|
46
50
|
export type { StateBadgeProps, StateBadgeVariant, StateBadgeSize, } from "./components/Content/StateBadge/StateBadge";
|
|
47
51
|
export { default as Select } from "./components/Select/Select";
|
|
48
52
|
export type { SelectProps, SelectVariant, SelectSize, SelectType, SelectAlign, } from "./components/Select/Select";
|
|
53
|
+
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
54
|
+
export type { DatePickerActionContent, DatePickerActionMainType, DatePickerActionRenderProps, DatePickerDateRange, DatePickerProps, DatePickerTrigger, DatePickerVariant, } from "./components/DatePicker/DatePicker";
|
|
55
|
+
export { default as TimePicker } from "./components/TimePicker/TimePicker";
|
|
56
|
+
export type { TimePickerActionContent, TimePickerActionMainType, TimePickerActionRenderProps, TimePickerProps, TimePickerTrigger, TimePickerValue, TimePickerVariant, } from "./components/TimePicker/TimePicker";
|
|
49
57
|
export { default as Dropdown } from "./components/Dropdown/Dropdown";
|
|
50
58
|
export type { DropdownProps, DropdownType, DropdownAlign, DropdownOption, } from "./components/Dropdown/Dropdown.types";
|
|
51
59
|
export { default as Chip } from "./components/Chip/Chip/Chip";
|