@soul-refiner/design-system 0.1.18 → 0.1.20
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/package.json +1 -1
- package/src/common/date.ts +30 -0
- package/src/common/index.ts +7 -0
- package/src/common/styles.ts +2 -2
- package/src/components/actions/rate/rate.tsx +1 -1
- package/src/components/atoms/box/box.tsx +1 -0
- package/src/components/atoms/typography/heading.tsx +1 -1
- package/src/components/atoms/typography/paragraph.tsx +0 -1
- package/src/components/card/action/action.tsx +106 -0
- package/src/components/card/action/index.ts +2 -0
- package/src/components/card/audio/audio.tsx +175 -0
- package/src/components/card/audio/index.ts +2 -0
- package/src/components/card/card.tsx +49 -0
- package/src/components/card/feature/feature.tsx +248 -0
- package/src/components/card/feature/index.ts +2 -0
- package/src/components/card/index.ts +2 -0
- package/src/components/card/person/index.ts +2 -0
- package/src/components/card/person/person.tsx +96 -0
- package/src/components/card/price/index.ts +2 -0
- package/src/components/card/price/price.tsx +110 -0
- package/src/components/card/regular/index.ts +2 -0
- package/src/components/card/regular/regular.tsx +52 -0
- package/src/components/card/video/index.ts +2 -0
- package/src/components/card/video/video.tsx +167 -0
- package/src/components/card/written/index.ts +2 -0
- package/src/components/card/written/written.tsx +176 -0
- package/src/components/iconography/avatar/avatar.tsx +4 -1
- package/src/components/index.ts +1 -0
- package/src/components/input/date/date.tsx +694 -0
- package/src/components/input/date/index.ts +2 -0
- package/src/components/input/index.ts +2 -0
- package/src/utils/date.ts +118 -0
- package/src/utils/index.ts +13 -0
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { Button, P } from 'components';
|
|
4
|
+
import { ChevronLeft, ChevronRight } from 'icons';
|
|
5
|
+
import { MONTHS, WEEKDAYS } from 'common';
|
|
6
|
+
import { buildCalendar, getMonthDays, zeroPad } from 'utils';
|
|
7
|
+
|
|
8
|
+
export interface DatePickerProps {
|
|
9
|
+
endDate?: Date;
|
|
10
|
+
label?: React.ReactNode;
|
|
11
|
+
onSelect: ({ type, value }: { type: 'end' | 'start'; value: Date }) => void;
|
|
12
|
+
startDate: Date;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const DatePicker = ({
|
|
16
|
+
endDate,
|
|
17
|
+
label,
|
|
18
|
+
onSelect: parentOnSelect,
|
|
19
|
+
startDate,
|
|
20
|
+
}: DatePickerProps) => {
|
|
21
|
+
const today = new Date();
|
|
22
|
+
today.setHours(0);
|
|
23
|
+
today.setMinutes(0);
|
|
24
|
+
today.setSeconds(0);
|
|
25
|
+
today.setMilliseconds(0);
|
|
26
|
+
const firstOfMonth = new Date(today);
|
|
27
|
+
firstOfMonth.setDate(1);
|
|
28
|
+
const thisMonth = firstOfMonth.getMonth() + 1;
|
|
29
|
+
const thisYear = firstOfMonth.getFullYear();
|
|
30
|
+
|
|
31
|
+
const isSingleDate = !endDate;
|
|
32
|
+
|
|
33
|
+
const pickerRef = React.useRef<HTMLDivElement>(null);
|
|
34
|
+
|
|
35
|
+
const [show, setShow] = React.useState(false);
|
|
36
|
+
const [displayDate, setDisplayDate] = React.useState(
|
|
37
|
+
() => endDate?.toDateString() ?? startDate.toDateString()
|
|
38
|
+
);
|
|
39
|
+
const [componentStartDate, setComponentStartDate] = React.useState(() =>
|
|
40
|
+
startDate.toDateString()
|
|
41
|
+
);
|
|
42
|
+
const [componentEndDate, setComponentEndDate] = React.useState(
|
|
43
|
+
() => endDate?.toDateString() ?? startDate.toDateString()
|
|
44
|
+
);
|
|
45
|
+
const [firstClick, setFirstClick] = React.useState(true);
|
|
46
|
+
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
setComponentStartDate(startDate.toDateString());
|
|
49
|
+
}, [startDate]);
|
|
50
|
+
|
|
51
|
+
React.useEffect(() => {
|
|
52
|
+
setComponentEndDate((endDate ?? new Date())?.toDateString());
|
|
53
|
+
}, [endDate]);
|
|
54
|
+
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
if (
|
|
57
|
+
!isSingleDate &&
|
|
58
|
+
new Date(componentStartDate).getTime() >
|
|
59
|
+
new Date(componentEndDate).getTime()
|
|
60
|
+
) {
|
|
61
|
+
const tempStart = componentStartDate;
|
|
62
|
+
setComponentStartDate(componentEndDate);
|
|
63
|
+
setComponentEndDate(tempStart);
|
|
64
|
+
}
|
|
65
|
+
}, [componentEndDate, componentStartDate]);
|
|
66
|
+
|
|
67
|
+
const handleShow = () => setShow((prev) => !prev);
|
|
68
|
+
|
|
69
|
+
const handleBlur = (event: React.FocusEvent) => {
|
|
70
|
+
if (
|
|
71
|
+
pickerRef?.current &&
|
|
72
|
+
!pickerRef?.current?.contains(event.relatedTarget)
|
|
73
|
+
) {
|
|
74
|
+
setShow(false);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const handlePreviousMonth = () => {
|
|
79
|
+
setDisplayDate((prev) => {
|
|
80
|
+
const newDate = new Date(prev);
|
|
81
|
+
newDate.setMonth(newDate.getMonth() - 1);
|
|
82
|
+
return newDate.toDateString();
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const handleNextMonth = () => {
|
|
87
|
+
setDisplayDate((prev) => {
|
|
88
|
+
const newDate = new Date(prev);
|
|
89
|
+
newDate.setMonth(newDate.getMonth() + 1);
|
|
90
|
+
return newDate.toDateString();
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const handleFirstClick = () =>
|
|
95
|
+
!isSingleDate && setFirstClick((prev) => !prev);
|
|
96
|
+
|
|
97
|
+
const onSelect = ({
|
|
98
|
+
type,
|
|
99
|
+
value,
|
|
100
|
+
}: {
|
|
101
|
+
type: 'start' | 'end';
|
|
102
|
+
value: Date;
|
|
103
|
+
}) => {
|
|
104
|
+
if (type === 'start') {
|
|
105
|
+
setComponentStartDate(value.toDateString());
|
|
106
|
+
} else {
|
|
107
|
+
setComponentEndDate(value.toDateString());
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const handleClick = (event: React.MouseEvent) => {
|
|
112
|
+
handleFirstClick();
|
|
113
|
+
const target = event.target as HTMLElement;
|
|
114
|
+
const type = firstClick ? 'start' : 'end';
|
|
115
|
+
const day = target.getAttribute('data-day');
|
|
116
|
+
const month = target.getAttribute('data-month');
|
|
117
|
+
const year = target.getAttribute('data-year');
|
|
118
|
+
onSelect({ type, value: new Date(`${month}-${day}-${year}`) });
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const handleApply = () => {
|
|
122
|
+
parentOnSelect({ type: 'start', value: new Date(componentStartDate) });
|
|
123
|
+
!isSingleDate &&
|
|
124
|
+
parentOnSelect({ type: 'end', value: new Date(componentEndDate) });
|
|
125
|
+
!isSingleDate && setFirstClick(true);
|
|
126
|
+
setShow(false);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const handleCancel = () => {
|
|
130
|
+
setComponentStartDate(startDate.toDateString());
|
|
131
|
+
setComponentEndDate((endDate ?? new Date())?.toDateString());
|
|
132
|
+
setFirstClick(true);
|
|
133
|
+
setShow(false);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const handleSetToday = () => {
|
|
137
|
+
onSelect({ type: 'start', value: today });
|
|
138
|
+
onSelect({ type: 'end', value: today });
|
|
139
|
+
setDisplayDate(today.toDateString());
|
|
140
|
+
setFirstClick(true);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const handleSetYesterday = () => {
|
|
144
|
+
const yesterday = new Date(
|
|
145
|
+
today.getFullYear(),
|
|
146
|
+
today.getMonth(),
|
|
147
|
+
today.getDate() - 1
|
|
148
|
+
);
|
|
149
|
+
onSelect({ type: 'start', value: yesterday });
|
|
150
|
+
onSelect({ type: 'end', value: yesterday });
|
|
151
|
+
setDisplayDate(today.toDateString());
|
|
152
|
+
setFirstClick(true);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const handleLastSevenDays = () => {
|
|
156
|
+
const lastWeekDate = new Date(
|
|
157
|
+
today.getFullYear(),
|
|
158
|
+
today.getMonth(),
|
|
159
|
+
today.getDate() - 7
|
|
160
|
+
);
|
|
161
|
+
onSelect({ type: 'start', value: lastWeekDate });
|
|
162
|
+
onSelect({ type: 'end', value: today });
|
|
163
|
+
setDisplayDate(today.toDateString());
|
|
164
|
+
setFirstClick(true);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const handleLastThirtyDays = () => {
|
|
168
|
+
const lastMonthDate = new Date(today);
|
|
169
|
+
lastMonthDate.setMonth(thisMonth - 2);
|
|
170
|
+
onSelect({ type: 'start', value: lastMonthDate });
|
|
171
|
+
onSelect({ type: 'end', value: today });
|
|
172
|
+
setDisplayDate(today.toDateString());
|
|
173
|
+
setFirstClick(true);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const handleThisMonth = () => {
|
|
177
|
+
onSelect({ type: 'start', value: firstOfMonth });
|
|
178
|
+
onSelect({
|
|
179
|
+
type: 'end',
|
|
180
|
+
value: new Date(
|
|
181
|
+
firstOfMonth.getFullYear(),
|
|
182
|
+
firstOfMonth.getMonth(),
|
|
183
|
+
getMonthDays()
|
|
184
|
+
),
|
|
185
|
+
});
|
|
186
|
+
setDisplayDate(today.toDateString());
|
|
187
|
+
setFirstClick(true);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const handleLastMonth = () => {
|
|
191
|
+
const lastMonthDate = new Date(firstOfMonth);
|
|
192
|
+
lastMonthDate.setMonth(thisMonth - 2);
|
|
193
|
+
onSelect({ type: 'start', value: lastMonthDate });
|
|
194
|
+
onSelect({
|
|
195
|
+
type: 'end',
|
|
196
|
+
value: new Date(
|
|
197
|
+
lastMonthDate.getFullYear(),
|
|
198
|
+
lastMonthDate.getMonth(),
|
|
199
|
+
getMonthDays(lastMonthDate.getMonth() + 1)
|
|
200
|
+
),
|
|
201
|
+
});
|
|
202
|
+
setDisplayDate(lastMonthDate.toDateString());
|
|
203
|
+
setFirstClick(true);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const handleLastYear = () => {
|
|
207
|
+
const lastYearDate = new Date(today);
|
|
208
|
+
lastYearDate.setFullYear(thisYear - 1);
|
|
209
|
+
onSelect({ type: 'start', value: lastYearDate });
|
|
210
|
+
onSelect({ type: 'end', value: today });
|
|
211
|
+
setDisplayDate(today.toDateString());
|
|
212
|
+
setFirstClick(true);
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const calendar = buildCalendar(
|
|
216
|
+
new Date(displayDate).getMonth() + 1,
|
|
217
|
+
new Date(displayDate).getFullYear()
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
const minRange = new Date(componentStartDate).getTime();
|
|
221
|
+
const maxRange = new Date(componentEndDate).getTime();
|
|
222
|
+
|
|
223
|
+
const displayDateObj = new Date(displayDate);
|
|
224
|
+
const displayFirstOfMonth = new Date(displayDateObj);
|
|
225
|
+
displayFirstOfMonth.setDate(1);
|
|
226
|
+
const displayLastOfMonth = new Date(displayDateObj);
|
|
227
|
+
displayLastOfMonth.setDate(getMonthDays(displayDateObj.getMonth() + 1));
|
|
228
|
+
|
|
229
|
+
return (
|
|
230
|
+
<Wrapper onBlurCapture={handleBlur} ref={pickerRef} tabIndex={0}>
|
|
231
|
+
<Trigger onClick={handleShow}>
|
|
232
|
+
{label && (
|
|
233
|
+
<>
|
|
234
|
+
{label}
|
|
235
|
+
{' | '}
|
|
236
|
+
</>
|
|
237
|
+
)}
|
|
238
|
+
<span>
|
|
239
|
+
{startDate.toLocaleDateString('en-US').replaceAll('/', '-')}
|
|
240
|
+
</span>
|
|
241
|
+
{!!endDate &&
|
|
242
|
+
startDate.toDateString() !== endDate?.toDateString() &&
|
|
243
|
+
' 🡒 '}
|
|
244
|
+
{startDate.toDateString() !== endDate?.toDateString() && (
|
|
245
|
+
<span>
|
|
246
|
+
{endDate?.toLocaleDateString('en-US').replaceAll('/', '-')}
|
|
247
|
+
</span>
|
|
248
|
+
)}
|
|
249
|
+
</Trigger>
|
|
250
|
+
{show && (
|
|
251
|
+
<DateSelector>
|
|
252
|
+
<InnerWrapper>
|
|
253
|
+
{!!endDate && (
|
|
254
|
+
<Left>
|
|
255
|
+
<Button size="small" type="text" onClick={handleSetToday}>
|
|
256
|
+
Today
|
|
257
|
+
</Button>
|
|
258
|
+
<Button size="small" type="text" onClick={handleSetYesterday}>
|
|
259
|
+
Yesterday
|
|
260
|
+
</Button>
|
|
261
|
+
<Button size="small" type="text" onClick={handleLastSevenDays}>
|
|
262
|
+
Last 7 days
|
|
263
|
+
</Button>
|
|
264
|
+
<Button size="small" type="text" onClick={handleLastThirtyDays}>
|
|
265
|
+
Last 30 days
|
|
266
|
+
</Button>
|
|
267
|
+
<Button size="small" type="text" onClick={handleThisMonth}>
|
|
268
|
+
This month
|
|
269
|
+
</Button>
|
|
270
|
+
<Button size="small" type="text" onClick={handleLastMonth}>
|
|
271
|
+
Last month
|
|
272
|
+
</Button>
|
|
273
|
+
<Button size="small" type="text" onClick={handleLastYear}>
|
|
274
|
+
Last Year
|
|
275
|
+
</Button>
|
|
276
|
+
</Left>
|
|
277
|
+
)}
|
|
278
|
+
<div>
|
|
279
|
+
<MonthBar>
|
|
280
|
+
<Arrow onClick={handlePreviousMonth}>
|
|
281
|
+
<ChevronLeft size={24} />
|
|
282
|
+
</Arrow>
|
|
283
|
+
<P>
|
|
284
|
+
{`${
|
|
285
|
+
Object.values(MONTHS)[
|
|
286
|
+
Math.max(
|
|
287
|
+
0,
|
|
288
|
+
Math.min(new Date(displayDate).getMonth(), 11)
|
|
289
|
+
)
|
|
290
|
+
]
|
|
291
|
+
} ${new Date(displayDate).getFullYear()}`}
|
|
292
|
+
</P>
|
|
293
|
+
<Arrow onClick={handleNextMonth}>
|
|
294
|
+
<ChevronRight size={24} />
|
|
295
|
+
</Arrow>
|
|
296
|
+
</MonthBar>
|
|
297
|
+
<WeekdayWrapper>
|
|
298
|
+
{Object.values(WEEKDAYS).map((day) => (
|
|
299
|
+
<P key={day}>{day}</P>
|
|
300
|
+
))}
|
|
301
|
+
</WeekdayWrapper>
|
|
302
|
+
<Calendar>
|
|
303
|
+
{calendar.map((week, index) => {
|
|
304
|
+
return (
|
|
305
|
+
<Week key={'week-' + index.toString(36)}>
|
|
306
|
+
{week.map((day, dayIndex) => {
|
|
307
|
+
const isCurrMonth =
|
|
308
|
+
day[1] !==
|
|
309
|
+
zeroPad(new Date(displayDate).getMonth() + 1, 2);
|
|
310
|
+
const dateObj = new Date(
|
|
311
|
+
`${day[1]}-${day[2]}-${day[0]}`
|
|
312
|
+
);
|
|
313
|
+
const isToday =
|
|
314
|
+
Math.abs(dateObj.getTime() - today.getTime()) < 0.5;
|
|
315
|
+
const time = dateObj.toDateString();
|
|
316
|
+
const isStartDate = time === componentStartDate;
|
|
317
|
+
const isEndDate =
|
|
318
|
+
!isSingleDate && time === componentEndDate;
|
|
319
|
+
const between =
|
|
320
|
+
!isSingleDate &&
|
|
321
|
+
minRange <= dateObj.getTime() &&
|
|
322
|
+
dateObj.getTime() <= maxRange &&
|
|
323
|
+
!isStartDate &&
|
|
324
|
+
!isEndDate;
|
|
325
|
+
const isFirstOfMonth =
|
|
326
|
+
displayFirstOfMonth.toDateString() === time;
|
|
327
|
+
const isLastOfMonth =
|
|
328
|
+
displayLastOfMonth.toDateString() === time;
|
|
329
|
+
|
|
330
|
+
return (
|
|
331
|
+
<Day
|
|
332
|
+
className={`${isToday ? 'today' : ''}${
|
|
333
|
+
isCurrMonth ? ' not-current' : ''
|
|
334
|
+
}${isStartDate ? ' start-date' : ''}${
|
|
335
|
+
isEndDate ? ' end-date' : ''
|
|
336
|
+
}${between ? ' between' : ''}${
|
|
337
|
+
isFirstOfMonth ? ' first-of-month' : ''
|
|
338
|
+
}${isLastOfMonth ? ' last-of-month' : ''}`.trim()}
|
|
339
|
+
data-day={day[2]}
|
|
340
|
+
data-month={day[1]}
|
|
341
|
+
data-year={day[0]}
|
|
342
|
+
key={'day-' + dayIndex.toString(36)}
|
|
343
|
+
onClick={handleClick}
|
|
344
|
+
>
|
|
345
|
+
{`${day[2]}`.startsWith('0')
|
|
346
|
+
? `${day[2]}`[1]
|
|
347
|
+
: day[2]}
|
|
348
|
+
</Day>
|
|
349
|
+
);
|
|
350
|
+
})}
|
|
351
|
+
</Week>
|
|
352
|
+
);
|
|
353
|
+
})}
|
|
354
|
+
</Calendar>
|
|
355
|
+
<BottomWrapper>
|
|
356
|
+
<Button
|
|
357
|
+
onClick={handleCancel}
|
|
358
|
+
size="small"
|
|
359
|
+
sx="width: 80px;"
|
|
360
|
+
type="outlined"
|
|
361
|
+
>
|
|
362
|
+
Cancel
|
|
363
|
+
</Button>
|
|
364
|
+
<Button onClick={handleApply} size="small" sx="width: 80px;">
|
|
365
|
+
Apply
|
|
366
|
+
</Button>
|
|
367
|
+
</BottomWrapper>
|
|
368
|
+
</div>
|
|
369
|
+
</InnerWrapper>
|
|
370
|
+
</DateSelector>
|
|
371
|
+
)}
|
|
372
|
+
</Wrapper>
|
|
373
|
+
);
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
const Wrapper = styled.div`
|
|
377
|
+
position: relative;
|
|
378
|
+
width: fit-content;
|
|
379
|
+
font-family: Inter;
|
|
380
|
+
`;
|
|
381
|
+
|
|
382
|
+
const Trigger = styled.button`
|
|
383
|
+
padding: 12px 24px;
|
|
384
|
+
background-color: #ffffff;
|
|
385
|
+
border: 1px solid var(--color-grey-6);
|
|
386
|
+
border-radius: 24px;
|
|
387
|
+
color: var(--color-grey-3);
|
|
388
|
+
outline: none;
|
|
389
|
+
line-height: 100%;
|
|
390
|
+
font-family: Inter;
|
|
391
|
+
cursor: pointer;
|
|
392
|
+
|
|
393
|
+
span {
|
|
394
|
+
color: var(--color-blue-5);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
&:hover {
|
|
398
|
+
background-color: var(--color-blue-5);
|
|
399
|
+
border-color: var(--color-blue-5);
|
|
400
|
+
color: #ffffff;
|
|
401
|
+
span {
|
|
402
|
+
color: #ffffff;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
&:active {
|
|
407
|
+
background-color: var(--color-blue-3);
|
|
408
|
+
border-color: var(--color-blue-3);
|
|
409
|
+
}
|
|
410
|
+
`;
|
|
411
|
+
|
|
412
|
+
const DateSelector = styled.div`
|
|
413
|
+
transform: translateY(26px);
|
|
414
|
+
position: absolute;
|
|
415
|
+
z-index: 5;
|
|
416
|
+
background-color: #ffffff;
|
|
417
|
+
border-radius: 25px;
|
|
418
|
+
box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.25);
|
|
419
|
+
`;
|
|
420
|
+
|
|
421
|
+
const InnerWrapper = styled.div`
|
|
422
|
+
display: flex;
|
|
423
|
+
gap: 31px;
|
|
424
|
+
padding: 30px;
|
|
425
|
+
position: relative;
|
|
426
|
+
border-radius: 25px;
|
|
427
|
+
|
|
428
|
+
&::before {
|
|
429
|
+
position: absolute;
|
|
430
|
+
content: '';
|
|
431
|
+
width: 24px;
|
|
432
|
+
height: 24px;
|
|
433
|
+
top: -12px;
|
|
434
|
+
left: 48px;
|
|
435
|
+
background-color: #ffffff;
|
|
436
|
+
transform: rotate(45deg);
|
|
437
|
+
box-shadow: -3px -3px 5px rgba(0, 0, 0, 0.1);
|
|
438
|
+
}
|
|
439
|
+
`;
|
|
440
|
+
|
|
441
|
+
const Left = styled.div`
|
|
442
|
+
display: flex;
|
|
443
|
+
flex-flow: column nowrap;
|
|
444
|
+
gap: 24px;
|
|
445
|
+
align-items: flex-start;
|
|
446
|
+
width: max-content;
|
|
447
|
+
margin-bottom: 96px;
|
|
448
|
+
padding-right: 48px;
|
|
449
|
+
border-right: 1px solid var(--color-grey-8);
|
|
450
|
+
user-select: none;
|
|
451
|
+
|
|
452
|
+
button {
|
|
453
|
+
padding: 0px;
|
|
454
|
+
|
|
455
|
+
span {
|
|
456
|
+
font-size: 16px;
|
|
457
|
+
line-height: 24px;
|
|
458
|
+
color: var(--color-grey-5);
|
|
459
|
+
font-weight: 400;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
&:hover {
|
|
463
|
+
span {
|
|
464
|
+
color: var(--color-primary-blue-2);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
`;
|
|
469
|
+
|
|
470
|
+
const MonthBar = styled.div`
|
|
471
|
+
display: flex;
|
|
472
|
+
justify-content: space-between;
|
|
473
|
+
align-items: center;
|
|
474
|
+
margin-bottom: 32px;
|
|
475
|
+
user-select: none;
|
|
476
|
+
`;
|
|
477
|
+
|
|
478
|
+
const Arrow = styled.button`
|
|
479
|
+
appearance: none;
|
|
480
|
+
border: none;
|
|
481
|
+
outline: none;
|
|
482
|
+
padding: 12px;
|
|
483
|
+
display: flex;
|
|
484
|
+
justify-content: center;
|
|
485
|
+
align-items: center;
|
|
486
|
+
border-radius: 50%;
|
|
487
|
+
cursor: pointer;
|
|
488
|
+
background-color: transparent;
|
|
489
|
+
|
|
490
|
+
&:hover {
|
|
491
|
+
background-color: var(--color-primary-blue-2);
|
|
492
|
+
border-color: #ffffff;
|
|
493
|
+
svg {
|
|
494
|
+
fill: #ffffff;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
`;
|
|
498
|
+
|
|
499
|
+
const WeekdayWrapper = styled.div`
|
|
500
|
+
display: flex;
|
|
501
|
+
gap: 32px;
|
|
502
|
+
user-select: none;
|
|
503
|
+
`;
|
|
504
|
+
|
|
505
|
+
const Calendar = styled.div`
|
|
506
|
+
display: flex;
|
|
507
|
+
flex-direction: column;
|
|
508
|
+
gap: 32px;
|
|
509
|
+
margin: 32px 0px;
|
|
510
|
+
user-select: none;
|
|
511
|
+
`;
|
|
512
|
+
|
|
513
|
+
const Week = styled.div`
|
|
514
|
+
display: flex;
|
|
515
|
+
gap: 32px;
|
|
516
|
+
border-radius: 24px;
|
|
517
|
+
`;
|
|
518
|
+
|
|
519
|
+
const Day = styled.button`
|
|
520
|
+
outline: none;
|
|
521
|
+
border: none;
|
|
522
|
+
background: transparent;
|
|
523
|
+
display: flex;
|
|
524
|
+
align-items: center;
|
|
525
|
+
justify-content: center;
|
|
526
|
+
width: 32px;
|
|
527
|
+
height: 32px;
|
|
528
|
+
border-radius: 50%;
|
|
529
|
+
cursor: pointer;
|
|
530
|
+
font-family: Inter;
|
|
531
|
+
font-size: 16px;
|
|
532
|
+
line-height: 24px;
|
|
533
|
+
|
|
534
|
+
&.today {
|
|
535
|
+
color: var(--color-primary-blue-2);
|
|
536
|
+
font-weight: 600;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
&:hover:not(&[class~='start-date']):not(&[class~='end-date']) {
|
|
540
|
+
background-color: var(--color-primary-blue-4);
|
|
541
|
+
color: var(--color-primary-blue-1);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
&[class~='not-current'] {
|
|
545
|
+
color: var(--color-grey-9);
|
|
546
|
+
cursor: default;
|
|
547
|
+
pointer-events: none;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
&[class~='start-date'],
|
|
551
|
+
&[class~='end-date'] {
|
|
552
|
+
background-color: var(--color-primary-blue-2);
|
|
553
|
+
color: #ffffff;
|
|
554
|
+
|
|
555
|
+
&[class~='not-current'] {
|
|
556
|
+
background-color: var(--color-blue-9);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
&[class~='start-date'] + [class~='end-date'] {
|
|
561
|
+
position: relative;
|
|
562
|
+
&::before {
|
|
563
|
+
content: '';
|
|
564
|
+
position: absolute;
|
|
565
|
+
z-index: -2;
|
|
566
|
+
height: 32px;
|
|
567
|
+
width: 64px;
|
|
568
|
+
background-color: var(--color-primary-blue-3);
|
|
569
|
+
right: 16px;
|
|
570
|
+
top: 0;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
&[class~='not-current'] {
|
|
574
|
+
&::before {
|
|
575
|
+
background-color: var(--color-blue-10);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
&[class~='not-current'] {
|
|
581
|
+
position: relative;
|
|
582
|
+
&[class~='end-date']:not(:first-of-type):not(.start-date) {
|
|
583
|
+
&::before {
|
|
584
|
+
content: '';
|
|
585
|
+
position: absolute;
|
|
586
|
+
z-index: -2;
|
|
587
|
+
height: 32px;
|
|
588
|
+
width: 62px;
|
|
589
|
+
background-color: var(--color-blue-10);
|
|
590
|
+
right: 16px;
|
|
591
|
+
top: 0;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
&[class~='first-of-month'] {
|
|
597
|
+
&[class~='end-date'] {
|
|
598
|
+
&::before {
|
|
599
|
+
background-color: var(--color-blue-10);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
&[class~='between'] {
|
|
605
|
+
position: relative;
|
|
606
|
+
|
|
607
|
+
&::before {
|
|
608
|
+
content: '';
|
|
609
|
+
position: absolute;
|
|
610
|
+
z-index: -2;
|
|
611
|
+
height: 32px;
|
|
612
|
+
width: 132px;
|
|
613
|
+
background-color: var(--color-primary-blue-3);
|
|
614
|
+
right: -48px;
|
|
615
|
+
top: 0;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
&:first-of-type::before {
|
|
619
|
+
width: 80px;
|
|
620
|
+
border-radius: 24px 0px 0px 24px;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
&:last-of-type::before {
|
|
624
|
+
width: 80px;
|
|
625
|
+
right: 0px;
|
|
626
|
+
border-radius: 0px 24px 24px 0px;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
&[class~='not-current'] {
|
|
630
|
+
&::before {
|
|
631
|
+
background-color: var(--color-blue-10);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
&[class~='first-of-month']:not(:first-of-type) {
|
|
636
|
+
&::before {
|
|
637
|
+
width: 32px;
|
|
638
|
+
border-top-left-radius: 24px;
|
|
639
|
+
border-bottom-left-radius: 24px;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
&[class~='first-of-month']:not([class~='not-current']):not(
|
|
644
|
+
:first-of-type
|
|
645
|
+
):not(:last-of-type) {
|
|
646
|
+
&::before {
|
|
647
|
+
width: 64px;
|
|
648
|
+
border-top-left-radius: 24px;
|
|
649
|
+
border-bottom-left-radius: 24px;
|
|
650
|
+
background-color: var(--color-blue-10);
|
|
651
|
+
right: 16px;
|
|
652
|
+
}
|
|
653
|
+
&::after {
|
|
654
|
+
content: '';
|
|
655
|
+
position: absolute;
|
|
656
|
+
z-index: -2;
|
|
657
|
+
height: 32px;
|
|
658
|
+
width: 70px;
|
|
659
|
+
background-color: var(--color-primary-blue-3);
|
|
660
|
+
right: -32px;
|
|
661
|
+
top: 0;
|
|
662
|
+
border-top-left-radius: 24px;
|
|
663
|
+
border-bottom-left-radius: 24px;
|
|
664
|
+
}
|
|
665
|
+
&:last-of-type {
|
|
666
|
+
&::before {
|
|
667
|
+
width: 32px;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
&[class~='last-of-month']:not(&[class~='not-current']) {
|
|
673
|
+
&::before {
|
|
674
|
+
z-index: -1;
|
|
675
|
+
border-radius: 0px 24px 24px 0px;
|
|
676
|
+
width: 80px;
|
|
677
|
+
right: 0px;
|
|
678
|
+
}
|
|
679
|
+
&:first-of-type {
|
|
680
|
+
&::before {
|
|
681
|
+
border-top-left-radius: 24px;
|
|
682
|
+
border-bottom-left-radius: 24px;
|
|
683
|
+
width: 32px;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
`;
|
|
689
|
+
|
|
690
|
+
const BottomWrapper = styled.div`
|
|
691
|
+
display: flex;
|
|
692
|
+
justify-content: flex-end;
|
|
693
|
+
gap: 18px;
|
|
694
|
+
`;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { Checkbox } from './checkbox';
|
|
2
2
|
export type { CheckboxProps } from './checkbox';
|
|
3
|
+
export { DatePicker } from './date';
|
|
4
|
+
export type { DatePickerProps } from './date';
|
|
3
5
|
export { Filter } from './filter';
|
|
4
6
|
export type { FilterProps, FilterTriggerProps } from './filter';
|
|
5
7
|
export { Radio } from './radio';
|