@jk-core/components 0.0.63 → 0.0.64
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/index.js +398 -471
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +18 -10
- package/dist/index.umd.cjs.map +1 -1
- package/dist/main.d.ts +1 -0
- package/dist/style.css +402 -1
- package/dist/style.css.map +1 -0
- package/package.json +6 -2
- package/src/Calendar/components/DayTile/index.tsx +12 -15
- package/src/Calendar/components/MonthTile/index.tsx +5 -9
- package/src/Calendar/components/YearTile/index.tsx +6 -12
- package/src/Calendar/index.tsx +17 -41
- package/src/Calendar/{Calendar.module.scss → scss/_calendar.scss} +9 -0
- package/src/Calendar/scss/_tile.scss +214 -0
- package/src/Calendar/scss/_variables.scss +91 -0
- package/src/Calendar/scss/main.scss +3 -0
- package/src/Calendar/style.css +128 -3
- package/src/main.tsx +6 -0
- package/src/Calendar/components/DayTile/DayTile.module.scss +0 -79
- package/src/Calendar/components/MonthTile/MonthTile.module.scss +0 -44
- package/src/Calendar/components/YearTile/YearTile.module.scss +0 -85
package/dist/style.css
CHANGED
|
@@ -1 +1,402 @@
|
|
|
1
|
-
|
|
1
|
+
:root {
|
|
2
|
+
--white: #ffffff;
|
|
3
|
+
--black: #000000;
|
|
4
|
+
--P-5: #eff5ff;
|
|
5
|
+
--P-10: #d3e1fb;
|
|
6
|
+
--P-20: #a7c4f7;
|
|
7
|
+
--P-30: #7ca6f3;
|
|
8
|
+
--P-40: #5089ef;
|
|
9
|
+
--P-50: #246beb;
|
|
10
|
+
--P-60: #1d56bc;
|
|
11
|
+
--P-70: #16408d;
|
|
12
|
+
--P-90: #07152f;
|
|
13
|
+
--P-100: #000000;
|
|
14
|
+
--S-5: #edf1f5;
|
|
15
|
+
--S-10: #cdd7e4;
|
|
16
|
+
--S-20: #b4c4d6;
|
|
17
|
+
--S-30: #99b0cb;
|
|
18
|
+
--S-40: #2a5c96;
|
|
19
|
+
--S-50: #003675;
|
|
20
|
+
--S-60: #002b5e;
|
|
21
|
+
--S-70: #002036;
|
|
22
|
+
--S-80: #00162f;
|
|
23
|
+
--S-90: #000b17;
|
|
24
|
+
--G-5: #f8f8f8;
|
|
25
|
+
--G-10: #f0f0f0;
|
|
26
|
+
--G-20: #e4e4e4;
|
|
27
|
+
--G-30: #d8d8d8;
|
|
28
|
+
--G-40: #c6c6c6;
|
|
29
|
+
--G-50: #8e8e8e;
|
|
30
|
+
--G-60: #717171;
|
|
31
|
+
--G-70: #555555;
|
|
32
|
+
--G-80: #2d2d2d;
|
|
33
|
+
--G-90: #1d1d1d;
|
|
34
|
+
--Point-5: #fdf2f3;
|
|
35
|
+
--Point-10: #f8d6d8;
|
|
36
|
+
--Point-20: #f5a3a8;
|
|
37
|
+
--Point-30: #f1747c;
|
|
38
|
+
--Point-40: #ec4651;
|
|
39
|
+
--Point-50: #e71825;
|
|
40
|
+
--Point-60: #b9131e;
|
|
41
|
+
--Point-70: #8b0e16;
|
|
42
|
+
--Point-80: #5c0a0f;
|
|
43
|
+
--Point-90: #2e0507;
|
|
44
|
+
--Warning-5: #fff8e9;
|
|
45
|
+
--Warning-10: #ffeac1;
|
|
46
|
+
--Warning-20: #ffe2a7;
|
|
47
|
+
--Warning-30: #ffd47c;
|
|
48
|
+
--Warning-40: #ffc550;
|
|
49
|
+
--Warning-50: #ffb724;
|
|
50
|
+
--Warning-60: #98690a;
|
|
51
|
+
--Warning-70: #66490e;
|
|
52
|
+
--Warning-80: #4d370b;
|
|
53
|
+
--Warning-90: #332507;
|
|
54
|
+
--Success-5: #eef7f0;
|
|
55
|
+
--Success-10: #cee9d4;
|
|
56
|
+
--Success-20: #b2dcbb;
|
|
57
|
+
--Success-30: #8cca99;
|
|
58
|
+
--Success-40: #33a14b;
|
|
59
|
+
--Success-50: #008a1e;
|
|
60
|
+
--Success-60: #006e18;
|
|
61
|
+
--Success-70: #005312;
|
|
62
|
+
--Success-80: #00370c;
|
|
63
|
+
--Success-90: #002207;
|
|
64
|
+
--Info-5: #e9f0ff;
|
|
65
|
+
--Info-10: #d4e1ff;
|
|
66
|
+
--Info-20: #a9c3ff;
|
|
67
|
+
--Info-30: #7da4ff;
|
|
68
|
+
--Info-40: #5286ff;
|
|
69
|
+
--Info-50: #2768ff;
|
|
70
|
+
--Info-60: #1f53cc;
|
|
71
|
+
--Info-70: #173e99;
|
|
72
|
+
--Info-80: #0c1f4d;
|
|
73
|
+
--Info-90: #040a1a;
|
|
74
|
+
--Red: #e40000;
|
|
75
|
+
--Red2: #ffe4e4;
|
|
76
|
+
--Green: #2fb400;
|
|
77
|
+
--Green-2: #d7ffe0;
|
|
78
|
+
--Orange: #ff8800;
|
|
79
|
+
--Orange-5: #ffead1;
|
|
80
|
+
--Orange-10: #ffdacc;
|
|
81
|
+
--Orange-30: #ff8f66;
|
|
82
|
+
--Orange-40: #ff6a33;
|
|
83
|
+
--Orange-50: #ff4500;
|
|
84
|
+
--Orange-60: #d53209;
|
|
85
|
+
--Orange-70: #992900;
|
|
86
|
+
--Orange-80: #661c00;
|
|
87
|
+
--Orange-90: #330e00;
|
|
88
|
+
--Modal-Shadow: #0000005a;
|
|
89
|
+
--Modal-Background: #6666663a;
|
|
90
|
+
--Calendar-Background: #ffffff;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
button {
|
|
94
|
+
border: none;
|
|
95
|
+
background-color: transparent;
|
|
96
|
+
user-select: none;
|
|
97
|
+
-webkit-user-select: none;
|
|
98
|
+
-moz-user-select: none;
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.calendar {
|
|
103
|
+
width: 100%;
|
|
104
|
+
min-width: 300px;
|
|
105
|
+
border: 1px solid var(--G-30);
|
|
106
|
+
border-radius: 10px;
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
color: var(--G-80);
|
|
109
|
+
background-color: var(--white);
|
|
110
|
+
}
|
|
111
|
+
.calendar__close {
|
|
112
|
+
display: flex;
|
|
113
|
+
justify-content: flex-end;
|
|
114
|
+
align-items: center;
|
|
115
|
+
padding: 5px 5px 0 0;
|
|
116
|
+
}
|
|
117
|
+
.calendar__close svg {
|
|
118
|
+
width: 15px;
|
|
119
|
+
height: 15px;
|
|
120
|
+
cursor: pointer;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.view {
|
|
124
|
+
position: relative;
|
|
125
|
+
margin: 0 auto;
|
|
126
|
+
width: 90%;
|
|
127
|
+
display: flex;
|
|
128
|
+
justify-content: space-between;
|
|
129
|
+
align-items: center;
|
|
130
|
+
background-color: #f3f4f8;
|
|
131
|
+
border-radius: 10px;
|
|
132
|
+
}
|
|
133
|
+
.view__block {
|
|
134
|
+
position: absolute;
|
|
135
|
+
background-color: #fff;
|
|
136
|
+
left: 0;
|
|
137
|
+
height: 100%;
|
|
138
|
+
border: 2px solid var(--G-30);
|
|
139
|
+
width: 33.3%;
|
|
140
|
+
border-radius: 10px;
|
|
141
|
+
transition: 0.3s;
|
|
142
|
+
}
|
|
143
|
+
.view__block--second {
|
|
144
|
+
left: 33%;
|
|
145
|
+
}
|
|
146
|
+
.view__block--last {
|
|
147
|
+
left: 66.6%;
|
|
148
|
+
}
|
|
149
|
+
.view__selector {
|
|
150
|
+
position: relative;
|
|
151
|
+
height: 40px;
|
|
152
|
+
flex: 1 0;
|
|
153
|
+
display: flex;
|
|
154
|
+
align-items: center;
|
|
155
|
+
justify-content: center;
|
|
156
|
+
color: var(--G-60);
|
|
157
|
+
font-size: 1em;
|
|
158
|
+
font-weight: 400;
|
|
159
|
+
}
|
|
160
|
+
.view__selector--selected {
|
|
161
|
+
color: var(--G-80);
|
|
162
|
+
font-size: 1em;
|
|
163
|
+
font-weight: 600;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.nav {
|
|
167
|
+
height: 60px;
|
|
168
|
+
display: flex;
|
|
169
|
+
justify-content: space-between;
|
|
170
|
+
align-items: center;
|
|
171
|
+
padding: 0 5px;
|
|
172
|
+
border-bottom: 1px solid var(--G-30);
|
|
173
|
+
font-size: 1.3em;
|
|
174
|
+
font-weight: 400;
|
|
175
|
+
}
|
|
176
|
+
.nav__button {
|
|
177
|
+
display: flex;
|
|
178
|
+
align-items: center;
|
|
179
|
+
justify-content: center;
|
|
180
|
+
width: 40px;
|
|
181
|
+
height: 40px;
|
|
182
|
+
padding: 10px;
|
|
183
|
+
border-radius: 100%;
|
|
184
|
+
}
|
|
185
|
+
.nav__button:active {
|
|
186
|
+
background-color: var(--G-30);
|
|
187
|
+
}
|
|
188
|
+
.nav__button:disabled {
|
|
189
|
+
cursor: not-allowed;
|
|
190
|
+
fill: var(--G-40);
|
|
191
|
+
background-color: transparent;
|
|
192
|
+
}
|
|
193
|
+
.nav__label {
|
|
194
|
+
flex: 1 0;
|
|
195
|
+
display: flex;
|
|
196
|
+
align-items: center;
|
|
197
|
+
justify-content: space-around;
|
|
198
|
+
font-size: 1.1em;
|
|
199
|
+
font-weight: 400;
|
|
200
|
+
}
|
|
201
|
+
.nav__label--date {
|
|
202
|
+
display: flex;
|
|
203
|
+
align-items: center;
|
|
204
|
+
justify-content: center;
|
|
205
|
+
border-radius: 5px;
|
|
206
|
+
padding: 5px 10px;
|
|
207
|
+
font-size: 1.2em;
|
|
208
|
+
font-weight: 400;
|
|
209
|
+
}
|
|
210
|
+
.nav__label--date svg {
|
|
211
|
+
width: 15px;
|
|
212
|
+
height: 15px;
|
|
213
|
+
}
|
|
214
|
+
.nav__label--date-selected {
|
|
215
|
+
background-color: var(--S-10);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.day-tile {
|
|
219
|
+
min-height: 310px;
|
|
220
|
+
padding: 5px;
|
|
221
|
+
background-color: var(--white);
|
|
222
|
+
}
|
|
223
|
+
.day-tile__tile {
|
|
224
|
+
display: flex;
|
|
225
|
+
flex-direction: column;
|
|
226
|
+
justify-content: space-between;
|
|
227
|
+
gap: 5px;
|
|
228
|
+
}
|
|
229
|
+
.day-tile__weeks {
|
|
230
|
+
display: flex;
|
|
231
|
+
justify-content: space-between;
|
|
232
|
+
font-weight: 400;
|
|
233
|
+
font-size: 1em;
|
|
234
|
+
}
|
|
235
|
+
.day-tile__weeks--date {
|
|
236
|
+
flex: 1 0;
|
|
237
|
+
display: flex;
|
|
238
|
+
justify-content: center;
|
|
239
|
+
align-items: center;
|
|
240
|
+
min-width: 40px;
|
|
241
|
+
padding: 5px 0;
|
|
242
|
+
}
|
|
243
|
+
.day-tile__week {
|
|
244
|
+
display: flex;
|
|
245
|
+
justify-content: space-between;
|
|
246
|
+
}
|
|
247
|
+
.day-tile__day {
|
|
248
|
+
display: flex;
|
|
249
|
+
justify-content: center;
|
|
250
|
+
align-items: center;
|
|
251
|
+
flex-direction: column;
|
|
252
|
+
width: 100%;
|
|
253
|
+
min-width: 40px;
|
|
254
|
+
min-height: 40px;
|
|
255
|
+
border-radius: 40px;
|
|
256
|
+
padding: 5px;
|
|
257
|
+
border: none;
|
|
258
|
+
font-weight: 400;
|
|
259
|
+
font-size: 1em;
|
|
260
|
+
}
|
|
261
|
+
@media (min-width: 1396px) {
|
|
262
|
+
.day-tile__day:hover {
|
|
263
|
+
background-color: var(--G-5);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
.day-tile__day:active {
|
|
267
|
+
background-color: var(--G-10);
|
|
268
|
+
}
|
|
269
|
+
.day-tile__day--today {
|
|
270
|
+
color: var(--P-50);
|
|
271
|
+
font-weight: 600;
|
|
272
|
+
}
|
|
273
|
+
.day-tile__day--selected {
|
|
274
|
+
background-color: var(--P-50) !important;
|
|
275
|
+
color: var(--white) !important;
|
|
276
|
+
font-weight: 600;
|
|
277
|
+
}
|
|
278
|
+
.day-tile__day--before {
|
|
279
|
+
color: var(--G-40);
|
|
280
|
+
}
|
|
281
|
+
.day-tile__day--tile {
|
|
282
|
+
border-radius: 10px;
|
|
283
|
+
gap: 5px;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.month-tile {
|
|
287
|
+
min-height: 310px;
|
|
288
|
+
padding: 5px;
|
|
289
|
+
background-color: var(--white);
|
|
290
|
+
display: grid;
|
|
291
|
+
grid-template-columns: repeat(3, 1fr);
|
|
292
|
+
grid-template-rows: repeat(4, 1fr);
|
|
293
|
+
gap: 5px;
|
|
294
|
+
}
|
|
295
|
+
.month-tile__month {
|
|
296
|
+
display: flex;
|
|
297
|
+
flex-direction: column;
|
|
298
|
+
justify-content: center;
|
|
299
|
+
align-items: center;
|
|
300
|
+
padding: 5px;
|
|
301
|
+
border-radius: 10px;
|
|
302
|
+
}
|
|
303
|
+
.month-tile__month svg {
|
|
304
|
+
width: 15px;
|
|
305
|
+
height: 15px;
|
|
306
|
+
cursor: pointer;
|
|
307
|
+
}
|
|
308
|
+
@media (min-width: 1396px) {
|
|
309
|
+
.month-tile__month:hover {
|
|
310
|
+
background-color: var(--G-5);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
.month-tile__month:active {
|
|
314
|
+
background-color: var(--G-10);
|
|
315
|
+
}
|
|
316
|
+
.month-tile__month--selected {
|
|
317
|
+
background-color: var(--P-50) !important;
|
|
318
|
+
color: var(--white) !important;
|
|
319
|
+
}
|
|
320
|
+
.month-tile__month--today {
|
|
321
|
+
color: var(--P-50);
|
|
322
|
+
font-weight: 600;
|
|
323
|
+
}
|
|
324
|
+
.month-tile__month--tile {
|
|
325
|
+
justify-content: flex-start;
|
|
326
|
+
gap: 5px;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.year-tile {
|
|
330
|
+
min-height: 310px;
|
|
331
|
+
padding: 5px;
|
|
332
|
+
background-color: var(--white);
|
|
333
|
+
position: relative;
|
|
334
|
+
height: 310px;
|
|
335
|
+
display: flex;
|
|
336
|
+
flex-direction: column;
|
|
337
|
+
align-items: center;
|
|
338
|
+
overflow: auto;
|
|
339
|
+
gap: 10px;
|
|
340
|
+
}
|
|
341
|
+
.year-tile::-webkit-scrollbar {
|
|
342
|
+
display: none;
|
|
343
|
+
}
|
|
344
|
+
.year-tile__blank {
|
|
345
|
+
height: calc(50% - 40px);
|
|
346
|
+
flex-shrink: 0;
|
|
347
|
+
}
|
|
348
|
+
.year-tile__blank:last-child {
|
|
349
|
+
height: 50%;
|
|
350
|
+
}
|
|
351
|
+
.year-tile__year {
|
|
352
|
+
min-width: 50%;
|
|
353
|
+
display: flex;
|
|
354
|
+
flex-direction: column;
|
|
355
|
+
align-items: center;
|
|
356
|
+
justify-content: center;
|
|
357
|
+
min-height: 40px;
|
|
358
|
+
border-radius: 6px;
|
|
359
|
+
flex-shrink: 0;
|
|
360
|
+
overflow: hidden;
|
|
361
|
+
font-weight: 400;
|
|
362
|
+
font-size: 1.2em;
|
|
363
|
+
}
|
|
364
|
+
@media (min-width: 1396px) {
|
|
365
|
+
.year-tile__year:hover {
|
|
366
|
+
background-color: var(--P-5);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
.year-tile__year:active {
|
|
370
|
+
background-color: var(--P-10);
|
|
371
|
+
}
|
|
372
|
+
.year-tile__year--border {
|
|
373
|
+
border: 1px solid var(--G-30);
|
|
374
|
+
background-color: var(--P-5);
|
|
375
|
+
}
|
|
376
|
+
@media (min-width: 1396px) {
|
|
377
|
+
.year-tile__year--border:hover {
|
|
378
|
+
background-color: var(--P-10);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
.year-tile__year--year {
|
|
382
|
+
height: 40px;
|
|
383
|
+
display: flex;
|
|
384
|
+
align-items: center;
|
|
385
|
+
justify-content: center;
|
|
386
|
+
}
|
|
387
|
+
.year-tile__year--selected {
|
|
388
|
+
color: var(--white);
|
|
389
|
+
background-color: var(--P-50) !important;
|
|
390
|
+
}
|
|
391
|
+
.year-tile__year--tile {
|
|
392
|
+
display: flex;
|
|
393
|
+
align-items: center;
|
|
394
|
+
justify-content: center;
|
|
395
|
+
min-height: 40px;
|
|
396
|
+
color: var(--G-80);
|
|
397
|
+
width: 100%;
|
|
398
|
+
background-color: var(--white);
|
|
399
|
+
border-top: var(--P-50);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/*# sourceMappingURL=style.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../src/Calendar/scss/_variables.scss","../src/Calendar/scss/_calendar.scss","../src/Calendar/scss/_tile.scss","../src/styles/mediaQuery.scss"],"names":[],"mappings":"AAAA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;ACzFF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;;AAKN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;;AAKN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;EACA;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAIJ;EACE;;;ACpIN;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;;AAIJ;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;ACzCF;ED2CE;IAEI;;;AAIJ;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;EACA;;;AAKN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AC/FJ;EDkGE;IAEI;;;AAIJ;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;;AAKN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;;AAEA;EACE;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;ACjKF;EDmKE;IAEI;;;AAIJ;EACE;;AAGF;EACE;EACA;;AC/KJ;EDiLI;IAEI;;;AAKN;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA","file":"style.css"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jk-core/components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.64",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.umd.cjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -39,12 +39,15 @@
|
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"react": "^18.3.1",
|
|
42
|
+
"react-dom": "^18.3.1",
|
|
42
43
|
"sass": "^1.79.4"
|
|
43
44
|
},
|
|
44
45
|
"scripts": {
|
|
46
|
+
"start": "vite --host --open",
|
|
45
47
|
"prepack": "yarn build",
|
|
46
48
|
"publish": "npm publish --access public",
|
|
47
|
-
"build": "yarn clean && vite build",
|
|
49
|
+
"build": "yarn clean && vite build && yarn scss",
|
|
50
|
+
"scss": "sass ./src/Calendar/scss/main.scss dist/style.css",
|
|
48
51
|
"clean": "rm -rf dist",
|
|
49
52
|
"lint": "yarn lint:eslint && yarn lint:stylelint",
|
|
50
53
|
"lint:eslint": "eslint ./src/ --ext .tsx,.ts",
|
|
@@ -54,6 +57,7 @@
|
|
|
54
57
|
"@jk-core/utils": "workspace:*",
|
|
55
58
|
"@types/node": "^22.7.4",
|
|
56
59
|
"@types/react": "^18.3.11",
|
|
60
|
+
"@types/react-dom": "^18.3.0",
|
|
57
61
|
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
|
58
62
|
"@typescript-eslint/parser": "^7.2.0",
|
|
59
63
|
"@vitejs/plugin-react-swc": "^3.7.1",
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/* eslint-disable max-len */
|
|
2
2
|
/* eslint-disable react/no-array-index-key */
|
|
3
|
-
import
|
|
4
|
-
import isSameDay from '../../utils/isSameDay';
|
|
5
|
-
import styles from './DayTile.module.scss';
|
|
3
|
+
import isSameDay from 'Calendar/utils/isSameDay';
|
|
6
4
|
|
|
7
5
|
const WEEKS = ['일', '월', '화', '수', '목', '금', '토'];
|
|
8
6
|
|
|
@@ -19,23 +17,22 @@ export default function DayTile({
|
|
|
19
17
|
selectedDate, weeksInMonth, tileContent, handleDayClick,
|
|
20
18
|
}: Props) {
|
|
21
19
|
return (
|
|
22
|
-
<div className=
|
|
23
|
-
<div className=
|
|
24
|
-
{WEEKS.map((week) => (<div className=
|
|
20
|
+
<div className="day-tile">
|
|
21
|
+
<div className="day-tile__weeks">
|
|
22
|
+
{WEEKS.map((week) => (<div className="day-tile__weeks--date" key={week}>{week}</div>))}
|
|
25
23
|
</div>
|
|
26
24
|
|
|
27
|
-
<div className=
|
|
25
|
+
<div className="day-tile__tile">
|
|
28
26
|
{weeksInMonth.map((week, index) => (
|
|
29
|
-
<div key={index} className=
|
|
27
|
+
<div key={index} className="day-tile__week">
|
|
30
28
|
{week.map((day, idx) => (
|
|
31
29
|
<button
|
|
32
|
-
className={
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
})}
|
|
30
|
+
className={`day-tile__day
|
|
31
|
+
${isSameDay(day.date, new Date()) && 'day-tile__day--today'}
|
|
32
|
+
${!!selectedDate && isSameDay(day.date, selectedDate) && 'day-tile__day--selected'}
|
|
33
|
+
${!day.thisMonth && 'day-tile__day--before'}
|
|
34
|
+
${!!(tileContent && tileContent()) && 'day-tile__day--tile'}
|
|
35
|
+
`}
|
|
39
36
|
type="button"
|
|
40
37
|
key={idx}
|
|
41
38
|
onClick={() => handleDayClick(day.date)}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { cn } from '@jk-core/utils';
|
|
2
|
-
import styles from './MonthTile.module.scss';
|
|
3
1
|
import isSameDay from '../../utils/isSameDay';
|
|
4
2
|
import { CalendarView } from '../../type';
|
|
5
3
|
|
|
@@ -15,15 +13,13 @@ export default function MonthTile({
|
|
|
15
13
|
selectedDate, viewDate, handleMonthClick, tileContent = () => false,
|
|
16
14
|
}: Props) {
|
|
17
15
|
return (
|
|
18
|
-
<div className=
|
|
16
|
+
<div className="month-tile">
|
|
19
17
|
{MONTHS.map((month) => (
|
|
20
18
|
<button
|
|
21
|
-
className={
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
[styles['body__month--tile']]: !!tileContent(new Date(viewDate.getFullYear(), month - 1, 1), 'month'),
|
|
26
|
-
})}
|
|
19
|
+
className={`month-tile__month
|
|
20
|
+
${!!selectedDate && isSameDay(selectedDate, new Date(viewDate.getFullYear(), month), 'month') && 'month-tile--selected'}
|
|
21
|
+
${isSameDay(new Date(viewDate.getFullYear(), month), new Date(), 'month') && 'month-tile__month--today'}
|
|
22
|
+
${!!tileContent(new Date(viewDate.getFullYear(), month - 1, 1), 'month') && 'month-tile__month--tile'}`}
|
|
27
23
|
type="button"
|
|
28
24
|
key={month}
|
|
29
25
|
onClick={() => handleMonthClick(month)}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { cn } from '@jk-core/utils';
|
|
2
1
|
import { useEffect, useRef } from 'react';
|
|
3
|
-
import styles from './YearTile.module.scss';
|
|
4
2
|
import { CalendarView } from '../../type';
|
|
5
3
|
|
|
6
4
|
interface Props {
|
|
@@ -32,29 +30,25 @@ export default function YearTile({
|
|
|
32
30
|
}, []);
|
|
33
31
|
|
|
34
32
|
return (
|
|
35
|
-
<div className=
|
|
36
|
-
<div className=
|
|
33
|
+
<div className="year-tile" ref={wrapperRef}>
|
|
34
|
+
<div className="year-tile__blank" />
|
|
37
35
|
{YEARS.map((year) => (
|
|
38
36
|
<button
|
|
39
|
-
className={
|
|
40
|
-
[styles.body__year]: true,
|
|
41
|
-
[styles['body__year--selected']]: !!selectedDate && selectedDate.getFullYear() === year,
|
|
42
|
-
[styles['body__year--border']]: !!tileContent(new Date(year, 1, 1), 'year'),
|
|
43
|
-
})}
|
|
37
|
+
className={`year-tile__year ${selectedDate && selectedDate.getFullYear() === year && 'year-tile__year--selected'} ${tileContent(new Date(year, 1, 1), 'year') && 'year-tile__year--border'}`}
|
|
44
38
|
key={year}
|
|
45
39
|
type="button"
|
|
46
40
|
ref={!!selectedDate && selectedDate.getFullYear() === year ? selectedRef : null}
|
|
47
41
|
onClick={() => onClick(year)}
|
|
48
42
|
>
|
|
49
|
-
<span className=
|
|
43
|
+
<span className="year-tile__year--year">{year}</span>
|
|
50
44
|
{tileContent(new Date(year, 1, 1), 'year') && (
|
|
51
|
-
<div className=
|
|
45
|
+
<div className="year-tile__year--tile">
|
|
52
46
|
{tileContent(new Date(year, 1, 1), 'year')}
|
|
53
47
|
</div>
|
|
54
48
|
)}
|
|
55
49
|
</button>
|
|
56
50
|
))}
|
|
57
|
-
<div className=
|
|
51
|
+
<div className="year-tile__blank" />
|
|
58
52
|
</div>
|
|
59
53
|
);
|
|
60
54
|
}
|
package/src/Calendar/index.tsx
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/* eslint-disable react/no-array-index-key */
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import { cn } from '@jk-core/utils';
|
|
4
3
|
import CloseIcon from '../assets/close.svg';
|
|
5
4
|
import DropIcon from '../assets/drop-arrow.svg';
|
|
6
|
-
import styles from './Calendar.module.scss';
|
|
7
5
|
import { CalendarView } from './type';
|
|
8
6
|
import getWeeksInMonth from './utils/getWeeksInMonth';
|
|
9
7
|
import DayTile from './components/DayTile';
|
|
@@ -12,8 +10,7 @@ import YearTile from './components/YearTile';
|
|
|
12
10
|
import useCalendarNav from './hooks/useCalendarNav';
|
|
13
11
|
import useDateSelect from './hooks/useDateSelect';
|
|
14
12
|
|
|
15
|
-
import './
|
|
16
|
-
import '../styles/color.scss';
|
|
13
|
+
import './scss/main.scss';
|
|
17
14
|
|
|
18
15
|
interface CalendarProps {
|
|
19
16
|
date?: Date;
|
|
@@ -45,67 +42,49 @@ export default function Calendar({
|
|
|
45
42
|
});
|
|
46
43
|
|
|
47
44
|
return (
|
|
48
|
-
<div className=
|
|
49
|
-
<div className=
|
|
50
|
-
{onClose
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
)}
|
|
45
|
+
<div className="calendar">
|
|
46
|
+
<div className="calendar__close">
|
|
47
|
+
{onClose && (
|
|
48
|
+
<CloseIcon onClick={onClose} />
|
|
49
|
+
)}
|
|
54
50
|
</div>
|
|
55
51
|
{/* 일/월/년 선택 버튼 */}
|
|
56
|
-
<div className=
|
|
57
|
-
<div className={
|
|
58
|
-
[styles.view__block]: true,
|
|
59
|
-
[styles['view__block--second']]: method === 'month',
|
|
60
|
-
[styles['view__block--last']]: method === 'year',
|
|
61
|
-
})}
|
|
62
|
-
/>
|
|
52
|
+
<div className="view">
|
|
53
|
+
<div className={`view__block ${method === 'month' && 'view__block--second'} ${method === 'year' && 'view__block--last'}`} />
|
|
63
54
|
<button
|
|
64
|
-
className={
|
|
65
|
-
[styles.view__selector]: true,
|
|
66
|
-
[styles['view__selector--selected']]: method === 'day',
|
|
67
|
-
})}
|
|
55
|
+
className={`view__selector ${method === 'day' && 'view__selector--selected'}`}
|
|
68
56
|
type="button"
|
|
69
57
|
onClick={() => { setMethod('day'); setSelectMode('day'); }}
|
|
70
58
|
>일
|
|
71
59
|
</button>
|
|
72
60
|
<button
|
|
73
|
-
className={
|
|
74
|
-
[styles.view__selector]: true,
|
|
75
|
-
[styles['view__selector--selected']]: method === 'month',
|
|
76
|
-
})}
|
|
61
|
+
className={`view__selector ${method === 'month' && 'view__selector--selected'}`}
|
|
77
62
|
type="button"
|
|
78
63
|
onClick={() => { setMethod('month'); setSelectMode('month'); }}
|
|
79
64
|
>월
|
|
80
65
|
</button>
|
|
81
66
|
<button
|
|
82
|
-
className={
|
|
83
|
-
[styles.view__selector]: true,
|
|
84
|
-
[styles['view__selector--selected']]: method === 'year',
|
|
85
|
-
})}
|
|
67
|
+
className={`view__selector ${method === 'year' && 'view__selector--selected'}`}
|
|
86
68
|
type="button"
|
|
87
69
|
onClick={() => { setMethod('year'); setSelectMode('year'); }}
|
|
88
70
|
>년
|
|
89
71
|
</button>
|
|
90
72
|
</div>
|
|
91
73
|
|
|
92
|
-
<div className=
|
|
74
|
+
<div className="nav">
|
|
93
75
|
<button
|
|
94
|
-
className=
|
|
76
|
+
className="nav__button"
|
|
95
77
|
type="button"
|
|
96
78
|
onClick={() => onArrowClick('prev')}
|
|
97
79
|
disabled={disabled('prev')}
|
|
98
80
|
>
|
|
99
81
|
◀︎
|
|
100
82
|
</button>
|
|
101
|
-
<div className=
|
|
83
|
+
<div className="nav__label">
|
|
102
84
|
{method === 'year' && '연도 선택'}
|
|
103
85
|
{method !== 'year' && (
|
|
104
86
|
<button
|
|
105
|
-
className={
|
|
106
|
-
[styles['nav__label--date']]: true,
|
|
107
|
-
[styles['nav__label--date-selected']]: selectMode === 'year',
|
|
108
|
-
})}
|
|
87
|
+
className={`nav__label--date ${selectMode === 'year' && 'nav__label--date-selected'}`}
|
|
109
88
|
type="button"
|
|
110
89
|
onClick={() => setSelectMode('year')}
|
|
111
90
|
>
|
|
@@ -114,10 +93,7 @@ export default function Calendar({
|
|
|
114
93
|
)}
|
|
115
94
|
{method === 'day' && (
|
|
116
95
|
<button
|
|
117
|
-
className={
|
|
118
|
-
[styles['nav__label--date']]: true,
|
|
119
|
-
[styles['nav__label--date-selected']]: selectMode === 'month',
|
|
120
|
-
})}
|
|
96
|
+
className={`nav__label--date ${selectMode === 'month' && 'nav__label--date-selected'}`}
|
|
121
97
|
type="button"
|
|
122
98
|
onClick={() => setSelectMode('month')}
|
|
123
99
|
>
|
|
@@ -126,7 +102,7 @@ export default function Calendar({
|
|
|
126
102
|
)}
|
|
127
103
|
</div>
|
|
128
104
|
<button
|
|
129
|
-
className=
|
|
105
|
+
className="nav__button"
|
|
130
106
|
type="button"
|
|
131
107
|
onClick={() => onArrowClick('next')}
|
|
132
108
|
disabled={disabled('next')}
|