@x-plat/design-system 0.3.6 → 0.3.8

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.
@@ -0,0 +1,161 @@
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.disabled {
96
+ cursor: not-allowed;
97
+ }
98
+ .lib-xplat-calendar .calendar-day.disabled .calendar-day-number {
99
+ color: var(--xplat-neutral-300);
100
+ }
101
+ .lib-xplat-calendar .calendar-day.today .calendar-day-number {
102
+ position: relative;
103
+ font-weight: 700;
104
+ color: var(--xplat-blue-600);
105
+ }
106
+ .lib-xplat-calendar .calendar-day.today .calendar-day-number::after {
107
+ content: "";
108
+ position: absolute;
109
+ bottom: -2px;
110
+ left: 50%;
111
+ transform: translateX(-50%);
112
+ width: 4px;
113
+ height: 4px;
114
+ border-radius: 50%;
115
+ background-color: var(--xplat-blue-600);
116
+ }
117
+ .lib-xplat-calendar .calendar-day.selected {
118
+ background-color: var(--xplat-neutral-900);
119
+ }
120
+ .lib-xplat-calendar .calendar-day.selected .calendar-day-number {
121
+ color: var(--xplat-white);
122
+ font-weight: 600;
123
+ }
124
+ .lib-xplat-calendar .calendar-day.selected:hover {
125
+ background-color: var(--xplat-neutral-800);
126
+ }
127
+ .lib-xplat-calendar .calendar-day.selected.today .calendar-day-number::after {
128
+ background-color: var(--xplat-white);
129
+ }
130
+ .lib-xplat-calendar .calendar-day.sunday .calendar-day-number {
131
+ color: var(--xplat-red-500);
132
+ }
133
+ .lib-xplat-calendar .calendar-day.saturday .calendar-day-number {
134
+ color: var(--xplat-blue-500);
135
+ }
136
+ .lib-xplat-calendar .calendar-day.selected .calendar-day-number {
137
+ color: var(--xplat-white);
138
+ }
139
+ .lib-xplat-calendar .calendar-day-number {
140
+ font-size: clamp(0.75rem, 2.5cqi, 1rem);
141
+ line-height: 1;
142
+ color: var(--xplat-neutral-800);
143
+ }
144
+ .lib-xplat-calendar .calendar-day-events {
145
+ display: flex;
146
+ gap: 2px;
147
+ margin-top: 4px;
148
+ align-items: center;
149
+ }
150
+ .lib-xplat-calendar .calendar-event-dot {
151
+ width: 5px;
152
+ height: 5px;
153
+ border-radius: 50%;
154
+ flex-shrink: 0;
155
+ cursor: pointer;
156
+ }
157
+ .lib-xplat-calendar .calendar-event-more {
158
+ font-size: 9px;
159
+ color: var(--xplat-neutral-400);
160
+ line-height: 1;
161
+ }
@@ -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 };