@idbrnd/design-system 3.3.0 → 4.0.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 +376 -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/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 +6 -0
- package/dist/index.js +4638 -3304
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -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
|
@@ -29,6 +29,8 @@ export type { CheckBoxProps, CheckBoxVariant, CheckBoxSize, CheckBoxDensity, } f
|
|
|
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
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";
|
|
32
34
|
export { default as PushBadge } from "./components/Feedback/PushBadge/PushBadge";
|
|
33
35
|
export { dismissToast, showToast } from "./components/Feedback/Toast/Toast";
|
|
34
36
|
export { dismissSnackbar, showSnackbar, } from "./components/Feedback/Snackbar/Snackbar";
|
|
@@ -48,6 +50,10 @@ export { default as StateBadge } from "./components/Content/StateBadge/StateBadg
|
|
|
48
50
|
export type { StateBadgeProps, StateBadgeVariant, StateBadgeSize, } from "./components/Content/StateBadge/StateBadge";
|
|
49
51
|
export { default as Select } from "./components/Select/Select";
|
|
50
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";
|
|
51
57
|
export { default as Dropdown } from "./components/Dropdown/Dropdown";
|
|
52
58
|
export type { DropdownProps, DropdownType, DropdownAlign, DropdownOption, } from "./components/Dropdown/Dropdown.types";
|
|
53
59
|
export { default as Chip } from "./components/Chip/Chip/Chip";
|