@x-plat/design-system 0.3.7 → 0.3.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/components/Calendar/index.cjs +1216 -0
- package/dist/components/Calendar/index.css +167 -0
- package/dist/components/Calendar/index.d.cts +63 -0
- package/dist/components/Calendar/index.d.ts +63 -0
- package/dist/components/Calendar/index.js +1176 -0
- package/dist/components/DatePicker/index.cjs +435 -10878
- package/dist/components/DatePicker/index.css +113 -788
- package/dist/components/DatePicker/index.d.cts +4 -0
- package/dist/components/DatePicker/index.d.ts +4 -0
- package/dist/components/DatePicker/index.js +441 -10892
- package/dist/components/HtmlTypeWriter/index.cjs +3 -2
- package/dist/components/HtmlTypeWriter/index.js +3 -2
- package/dist/components/index.cjs +1594 -11926
- package/dist/components/index.css +281 -786
- package/dist/components/index.d.cts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1627 -11969
- package/dist/index.cjs +1599 -11931
- package/dist/index.css +281 -786
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1638 -11980
- package/package.json +1 -2
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/* src/components/Calendar/calendar.scss */
|
|
2
|
+
.lib-xplat-calendar {
|
|
3
|
+
width: 100%;
|
|
4
|
+
user-select: none;
|
|
5
|
+
container-type: inline-size;
|
|
6
|
+
}
|
|
7
|
+
.lib-xplat-calendar .calendar-header {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: 0.5rem;
|
|
11
|
+
margin-bottom: 1rem;
|
|
12
|
+
}
|
|
13
|
+
.lib-xplat-calendar .calendar-title {
|
|
14
|
+
font-size: clamp(0.875rem, 3cqi, 1.25rem);
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
color: var(--xplat-neutral-900);
|
|
17
|
+
min-width: 120px;
|
|
18
|
+
text-align: center;
|
|
19
|
+
}
|
|
20
|
+
.lib-xplat-calendar .calendar-nav {
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
width: 28px;
|
|
25
|
+
height: 28px;
|
|
26
|
+
border: none;
|
|
27
|
+
border-radius: 0.375rem;
|
|
28
|
+
background: none;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
color: var(--xplat-neutral-600);
|
|
31
|
+
transition: background-color 0.15s;
|
|
32
|
+
}
|
|
33
|
+
.lib-xplat-calendar .calendar-nav:hover {
|
|
34
|
+
background-color: var(--xplat-neutral-100);
|
|
35
|
+
}
|
|
36
|
+
.lib-xplat-calendar .calendar-nav svg {
|
|
37
|
+
width: 16px;
|
|
38
|
+
height: 16px;
|
|
39
|
+
}
|
|
40
|
+
.lib-xplat-calendar .calendar-today-btn {
|
|
41
|
+
margin-left: auto;
|
|
42
|
+
padding: 0.25rem 0.75rem;
|
|
43
|
+
border: 1px solid var(--xplat-neutral-300);
|
|
44
|
+
border-radius: 0.375rem;
|
|
45
|
+
background: none;
|
|
46
|
+
font-size: clamp(0.75rem, 2cqi, 0.875rem);
|
|
47
|
+
color: var(--xplat-neutral-600);
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
transition: background-color 0.15s;
|
|
50
|
+
}
|
|
51
|
+
.lib-xplat-calendar .calendar-today-btn:hover {
|
|
52
|
+
background-color: var(--xplat-neutral-100);
|
|
53
|
+
}
|
|
54
|
+
.lib-xplat-calendar .calendar-weekdays {
|
|
55
|
+
display: grid;
|
|
56
|
+
grid-template-columns: repeat(7, 1fr);
|
|
57
|
+
margin-bottom: 0.25rem;
|
|
58
|
+
}
|
|
59
|
+
.lib-xplat-calendar .calendar-weekday {
|
|
60
|
+
text-align: center;
|
|
61
|
+
font-size: clamp(0.6875rem, 2cqi, 0.875rem);
|
|
62
|
+
font-weight: 500;
|
|
63
|
+
padding: 0.375rem 0;
|
|
64
|
+
color: var(--xplat-neutral-500);
|
|
65
|
+
}
|
|
66
|
+
.lib-xplat-calendar .calendar-weekday.sunday {
|
|
67
|
+
color: var(--xplat-red-500);
|
|
68
|
+
}
|
|
69
|
+
.lib-xplat-calendar .calendar-weekday.saturday {
|
|
70
|
+
color: var(--xplat-blue-500);
|
|
71
|
+
}
|
|
72
|
+
.lib-xplat-calendar .calendar-grid {
|
|
73
|
+
display: grid;
|
|
74
|
+
grid-template-columns: repeat(7, 1fr);
|
|
75
|
+
}
|
|
76
|
+
.lib-xplat-calendar .calendar-day {
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
aspect-ratio: 1/0.85;
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
border-radius: 0.375rem;
|
|
84
|
+
transition: background-color 0.15s;
|
|
85
|
+
}
|
|
86
|
+
.lib-xplat-calendar .calendar-day:hover:not(.disabled):not(.outside):not(.selected) {
|
|
87
|
+
background-color: var(--xplat-neutral-50);
|
|
88
|
+
}
|
|
89
|
+
.lib-xplat-calendar .calendar-day.outside {
|
|
90
|
+
cursor: default;
|
|
91
|
+
}
|
|
92
|
+
.lib-xplat-calendar .calendar-day.outside .calendar-day-number {
|
|
93
|
+
color: var(--xplat-neutral-300);
|
|
94
|
+
}
|
|
95
|
+
.lib-xplat-calendar .calendar-day.outside.sunday .calendar-day-number {
|
|
96
|
+
color: color-mix(in srgb, var(--xplat-red-500) 35%, transparent);
|
|
97
|
+
}
|
|
98
|
+
.lib-xplat-calendar .calendar-day.outside.saturday .calendar-day-number {
|
|
99
|
+
color: color-mix(in srgb, var(--xplat-blue-500) 35%, transparent);
|
|
100
|
+
}
|
|
101
|
+
.lib-xplat-calendar .calendar-day.disabled {
|
|
102
|
+
cursor: not-allowed;
|
|
103
|
+
}
|
|
104
|
+
.lib-xplat-calendar .calendar-day.disabled .calendar-day-number {
|
|
105
|
+
color: var(--xplat-neutral-300);
|
|
106
|
+
}
|
|
107
|
+
.lib-xplat-calendar .calendar-day.today .calendar-day-number {
|
|
108
|
+
position: relative;
|
|
109
|
+
font-weight: 700;
|
|
110
|
+
color: var(--xplat-blue-600);
|
|
111
|
+
}
|
|
112
|
+
.lib-xplat-calendar .calendar-day.today .calendar-day-number::before {
|
|
113
|
+
content: "";
|
|
114
|
+
position: absolute;
|
|
115
|
+
top: 50%;
|
|
116
|
+
left: -6px;
|
|
117
|
+
transform: translateY(-50%);
|
|
118
|
+
width: 4px;
|
|
119
|
+
height: 4px;
|
|
120
|
+
border-radius: 50%;
|
|
121
|
+
background-color: var(--xplat-blue-600);
|
|
122
|
+
}
|
|
123
|
+
.lib-xplat-calendar .calendar-day.selected {
|
|
124
|
+
background-color: var(--xplat-neutral-900);
|
|
125
|
+
}
|
|
126
|
+
.lib-xplat-calendar .calendar-day.selected .calendar-day-number {
|
|
127
|
+
color: var(--xplat-white);
|
|
128
|
+
font-weight: 600;
|
|
129
|
+
}
|
|
130
|
+
.lib-xplat-calendar .calendar-day.selected:hover {
|
|
131
|
+
background-color: var(--xplat-neutral-800);
|
|
132
|
+
}
|
|
133
|
+
.lib-xplat-calendar .calendar-day.selected.today .calendar-day-number::before {
|
|
134
|
+
background-color: var(--xplat-white);
|
|
135
|
+
}
|
|
136
|
+
.lib-xplat-calendar .calendar-day.sunday:not(.outside) .calendar-day-number {
|
|
137
|
+
color: var(--xplat-red-500);
|
|
138
|
+
}
|
|
139
|
+
.lib-xplat-calendar .calendar-day.saturday:not(.outside) .calendar-day-number {
|
|
140
|
+
color: var(--xplat-blue-500);
|
|
141
|
+
}
|
|
142
|
+
.lib-xplat-calendar .calendar-day.selected .calendar-day-number {
|
|
143
|
+
color: var(--xplat-white);
|
|
144
|
+
}
|
|
145
|
+
.lib-xplat-calendar .calendar-day-number {
|
|
146
|
+
font-size: clamp(0.75rem, 2.5cqi, 1rem);
|
|
147
|
+
line-height: 1;
|
|
148
|
+
color: var(--xplat-neutral-800);
|
|
149
|
+
}
|
|
150
|
+
.lib-xplat-calendar .calendar-day-events {
|
|
151
|
+
display: flex;
|
|
152
|
+
gap: 2px;
|
|
153
|
+
margin-top: 4px;
|
|
154
|
+
align-items: center;
|
|
155
|
+
}
|
|
156
|
+
.lib-xplat-calendar .calendar-event-dot {
|
|
157
|
+
width: 5px;
|
|
158
|
+
height: 5px;
|
|
159
|
+
border-radius: 50%;
|
|
160
|
+
flex-shrink: 0;
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
}
|
|
163
|
+
.lib-xplat-calendar .calendar-event-more {
|
|
164
|
+
font-size: 9px;
|
|
165
|
+
color: var(--xplat-neutral-400);
|
|
166
|
+
line-height: 1;
|
|
167
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
interface CalendarDay {
|
|
5
|
+
date: Date;
|
|
6
|
+
day: number;
|
|
7
|
+
isCurrentMonth: boolean;
|
|
8
|
+
isToday: boolean;
|
|
9
|
+
isSunday: boolean;
|
|
10
|
+
isSaturday: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare function useCalendar(initialYear?: number, initialMonth?: number): {
|
|
13
|
+
year: number;
|
|
14
|
+
month: number;
|
|
15
|
+
days: CalendarDay[];
|
|
16
|
+
goToPrevMonth: () => void;
|
|
17
|
+
goToNextMonth: () => void;
|
|
18
|
+
goToToday: () => void;
|
|
19
|
+
setYear: React.Dispatch<React.SetStateAction<number>>;
|
|
20
|
+
setMonth: React.Dispatch<React.SetStateAction<number>>;
|
|
21
|
+
};
|
|
22
|
+
declare function isSameDay(a: Date, b: Date): boolean;
|
|
23
|
+
declare function isInRange(date: Date, start: Date, end: Date): boolean;
|
|
24
|
+
|
|
25
|
+
interface CalendarEvent {
|
|
26
|
+
date: Date;
|
|
27
|
+
label?: string;
|
|
28
|
+
color?: string;
|
|
29
|
+
data?: unknown;
|
|
30
|
+
}
|
|
31
|
+
interface CalendarProps {
|
|
32
|
+
/** 초기 연도 */
|
|
33
|
+
year?: number;
|
|
34
|
+
/** 초기 월 (0-11) */
|
|
35
|
+
month?: number;
|
|
36
|
+
/** 선택된 날짜 */
|
|
37
|
+
selectedDate?: Date | null;
|
|
38
|
+
/** 날짜 선택 콜백 */
|
|
39
|
+
onSelect?: (date: Date) => void;
|
|
40
|
+
/** 월 변경 콜백 */
|
|
41
|
+
onMonthChange?: (year: number, month: number) => void;
|
|
42
|
+
/** 이벤트 목록 */
|
|
43
|
+
events?: CalendarEvent[];
|
|
44
|
+
/** 날짜별 커스텀 렌더 */
|
|
45
|
+
renderDay?: (day: CalendarDay, events: CalendarEvent[]) => React.ReactNode;
|
|
46
|
+
/** 이벤트 클릭 콜백 */
|
|
47
|
+
onEventClick?: (event: CalendarEvent) => void;
|
|
48
|
+
/** 언어 */
|
|
49
|
+
locale?: "ko" | "en";
|
|
50
|
+
/** 최소 선택 가능 날짜 */
|
|
51
|
+
minDate?: Date;
|
|
52
|
+
/** 최대 선택 가능 날짜 */
|
|
53
|
+
maxDate?: Date;
|
|
54
|
+
/** 오늘 버튼 표시 */
|
|
55
|
+
showToday?: boolean;
|
|
56
|
+
className?: string;
|
|
57
|
+
}
|
|
58
|
+
declare const Calendar: {
|
|
59
|
+
(props: CalendarProps): react_jsx_runtime.JSX.Element;
|
|
60
|
+
displayName: string;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export { Calendar, type CalendarDay, type CalendarEvent, type CalendarProps, isInRange, isSameDay, useCalendar };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
interface CalendarDay {
|
|
5
|
+
date: Date;
|
|
6
|
+
day: number;
|
|
7
|
+
isCurrentMonth: boolean;
|
|
8
|
+
isToday: boolean;
|
|
9
|
+
isSunday: boolean;
|
|
10
|
+
isSaturday: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare function useCalendar(initialYear?: number, initialMonth?: number): {
|
|
13
|
+
year: number;
|
|
14
|
+
month: number;
|
|
15
|
+
days: CalendarDay[];
|
|
16
|
+
goToPrevMonth: () => void;
|
|
17
|
+
goToNextMonth: () => void;
|
|
18
|
+
goToToday: () => void;
|
|
19
|
+
setYear: React.Dispatch<React.SetStateAction<number>>;
|
|
20
|
+
setMonth: React.Dispatch<React.SetStateAction<number>>;
|
|
21
|
+
};
|
|
22
|
+
declare function isSameDay(a: Date, b: Date): boolean;
|
|
23
|
+
declare function isInRange(date: Date, start: Date, end: Date): boolean;
|
|
24
|
+
|
|
25
|
+
interface CalendarEvent {
|
|
26
|
+
date: Date;
|
|
27
|
+
label?: string;
|
|
28
|
+
color?: string;
|
|
29
|
+
data?: unknown;
|
|
30
|
+
}
|
|
31
|
+
interface CalendarProps {
|
|
32
|
+
/** 초기 연도 */
|
|
33
|
+
year?: number;
|
|
34
|
+
/** 초기 월 (0-11) */
|
|
35
|
+
month?: number;
|
|
36
|
+
/** 선택된 날짜 */
|
|
37
|
+
selectedDate?: Date | null;
|
|
38
|
+
/** 날짜 선택 콜백 */
|
|
39
|
+
onSelect?: (date: Date) => void;
|
|
40
|
+
/** 월 변경 콜백 */
|
|
41
|
+
onMonthChange?: (year: number, month: number) => void;
|
|
42
|
+
/** 이벤트 목록 */
|
|
43
|
+
events?: CalendarEvent[];
|
|
44
|
+
/** 날짜별 커스텀 렌더 */
|
|
45
|
+
renderDay?: (day: CalendarDay, events: CalendarEvent[]) => React.ReactNode;
|
|
46
|
+
/** 이벤트 클릭 콜백 */
|
|
47
|
+
onEventClick?: (event: CalendarEvent) => void;
|
|
48
|
+
/** 언어 */
|
|
49
|
+
locale?: "ko" | "en";
|
|
50
|
+
/** 최소 선택 가능 날짜 */
|
|
51
|
+
minDate?: Date;
|
|
52
|
+
/** 최대 선택 가능 날짜 */
|
|
53
|
+
maxDate?: Date;
|
|
54
|
+
/** 오늘 버튼 표시 */
|
|
55
|
+
showToday?: boolean;
|
|
56
|
+
className?: string;
|
|
57
|
+
}
|
|
58
|
+
declare const Calendar: {
|
|
59
|
+
(props: CalendarProps): react_jsx_runtime.JSX.Element;
|
|
60
|
+
displayName: string;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export { Calendar, type CalendarDay, type CalendarEvent, type CalendarProps, isInRange, isSameDay, useCalendar };
|