@shoplflow/base 0.31.7 → 0.31.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/index.cjs +1493 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +147 -3
- package/dist/index.d.ts +147 -3
- package/dist/index.js +1493 -3
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
package/dist/index.cjs
CHANGED
|
@@ -13,6 +13,11 @@ var reactDom = require('@floating-ui/react-dom');
|
|
|
13
13
|
var ShoplAssets = require('@shoplflow/shopl-assets');
|
|
14
14
|
var HadaAssets = require('@shoplflow/hada-assets');
|
|
15
15
|
var core = require('@floating-ui/core');
|
|
16
|
+
var DatePicker2 = require('react-datepicker');
|
|
17
|
+
require('react-datepicker/dist/react-datepicker.css');
|
|
18
|
+
var SimpleBarReact = require('simplebar-react');
|
|
19
|
+
var locale = require('date-fns/locale');
|
|
20
|
+
var dateFns = require('date-fns');
|
|
16
21
|
|
|
17
22
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
23
|
|
|
@@ -39,6 +44,8 @@ var styled6__default = /*#__PURE__*/_interopDefault(styled6);
|
|
|
39
44
|
var Scrollbars__default = /*#__PURE__*/_interopDefault(Scrollbars);
|
|
40
45
|
var ShoplAssets__namespace = /*#__PURE__*/_interopNamespace(ShoplAssets);
|
|
41
46
|
var HadaAssets__namespace = /*#__PURE__*/_interopNamespace(HadaAssets);
|
|
47
|
+
var DatePicker2__default = /*#__PURE__*/_interopDefault(DatePicker2);
|
|
48
|
+
var SimpleBarReact__default = /*#__PURE__*/_interopDefault(SimpleBarReact);
|
|
42
49
|
|
|
43
50
|
var __create = Object.create;
|
|
44
51
|
var __defProp = Object.defineProperty;
|
|
@@ -3158,7 +3165,7 @@ var Input = React3.forwardRef(
|
|
|
3158
3165
|
};
|
|
3159
3166
|
const handleOnBlur = (event) => {
|
|
3160
3167
|
onBlur && onBlur(event);
|
|
3161
|
-
|
|
3168
|
+
setIsFocused(false);
|
|
3162
3169
|
};
|
|
3163
3170
|
const handleOnChange = (event) => {
|
|
3164
3171
|
onChange && onChange(event);
|
|
@@ -4189,6 +4196,1491 @@ exports.ToggleButtonSizeVariants = {
|
|
|
4189
4196
|
S: "S",
|
|
4190
4197
|
M: "M"
|
|
4191
4198
|
};
|
|
4199
|
+
var SmallStyledDayDatepickerWrapper = styled6__default.default.div`
|
|
4200
|
+
display: flex;
|
|
4201
|
+
width: 280px;
|
|
4202
|
+
height: 100%;
|
|
4203
|
+
flex-direction: column;
|
|
4204
|
+
|
|
4205
|
+
& .dayDatepickerArea .react-datepicker {
|
|
4206
|
+
width: 100%;
|
|
4207
|
+
height: 100%;
|
|
4208
|
+
border: none;
|
|
4209
|
+
margin: 0;
|
|
4210
|
+
padding: 16px;
|
|
4211
|
+
box-sizing: border-box;
|
|
4212
|
+
font-family: 'Pretendard', 'Pretendard JP', sans-serif !important;
|
|
4213
|
+
|
|
4214
|
+
& .highlighted-sundays {
|
|
4215
|
+
color: ${exports.colorTokens.red300};
|
|
4216
|
+
}
|
|
4217
|
+
|
|
4218
|
+
&__month-text--selected {
|
|
4219
|
+
color: #fff;
|
|
4220
|
+
}
|
|
4221
|
+
|
|
4222
|
+
&-popper {
|
|
4223
|
+
width: 432px;
|
|
4224
|
+
padding-top: 0;
|
|
4225
|
+
}
|
|
4226
|
+
|
|
4227
|
+
&__month-container {
|
|
4228
|
+
width: 100%;
|
|
4229
|
+
}
|
|
4230
|
+
|
|
4231
|
+
&__month {
|
|
4232
|
+
margin: 0;
|
|
4233
|
+
}
|
|
4234
|
+
|
|
4235
|
+
&__header {
|
|
4236
|
+
border: none;
|
|
4237
|
+
background-color: transparent;
|
|
4238
|
+
padding: 0;
|
|
4239
|
+
font-size: 14px;
|
|
4240
|
+
font-style: normal;
|
|
4241
|
+
line-height: 18px;
|
|
4242
|
+
}
|
|
4243
|
+
|
|
4244
|
+
&__month-wrapper {
|
|
4245
|
+
display: grid;
|
|
4246
|
+
grid-template-columns: 1fr 1fr 1fr 1fr;
|
|
4247
|
+
/* gap: 1.75rem; */
|
|
4248
|
+
}
|
|
4249
|
+
|
|
4250
|
+
&__month-text {
|
|
4251
|
+
display: flex;
|
|
4252
|
+
justify-content: center;
|
|
4253
|
+
align-items: center;
|
|
4254
|
+
width: 48px;
|
|
4255
|
+
height: 48px;
|
|
4256
|
+
border-radius: 50%;
|
|
4257
|
+
font-size: 16px;
|
|
4258
|
+
color: #333;
|
|
4259
|
+
font-weight: 400;
|
|
4260
|
+
|
|
4261
|
+
:hover {
|
|
4262
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4263
|
+
color: ${exports.colorTokens.primary300};
|
|
4264
|
+
}
|
|
4265
|
+
|
|
4266
|
+
&--keyboard-selected {
|
|
4267
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4268
|
+
color: ${exports.colorTokens.neutral700};
|
|
4269
|
+
}
|
|
4270
|
+
|
|
4271
|
+
&--selected:not(.react-datepicker--keyboard-selected) {
|
|
4272
|
+
background-color: ${exports.colorTokens.primary300};
|
|
4273
|
+
color: ${exports.colorTokens.neutral0};
|
|
4274
|
+
}
|
|
4275
|
+
}
|
|
4276
|
+
|
|
4277
|
+
&__week {
|
|
4278
|
+
width: 100%;
|
|
4279
|
+
display: flex;
|
|
4280
|
+
justify-content: space-between;
|
|
4281
|
+
|
|
4282
|
+
&:first-of-type {
|
|
4283
|
+
margin-top: 0;
|
|
4284
|
+
}
|
|
4285
|
+
}
|
|
4286
|
+
|
|
4287
|
+
&__day-names {
|
|
4288
|
+
width: 100%;
|
|
4289
|
+
height: 18px;
|
|
4290
|
+
margin: 8px 0 0;
|
|
4291
|
+
display: flex;
|
|
4292
|
+
justify-content: space-between;
|
|
4293
|
+
align-items: center;
|
|
4294
|
+
}
|
|
4295
|
+
|
|
4296
|
+
&__day-name {
|
|
4297
|
+
color: ${exports.colorTokens.neutral400};
|
|
4298
|
+
width: 32px;
|
|
4299
|
+
margin: 0;
|
|
4300
|
+
font-size: 13px;
|
|
4301
|
+
font-weight: 500;
|
|
4302
|
+
line-height: 1rem;
|
|
4303
|
+
|
|
4304
|
+
:last-of-type {
|
|
4305
|
+
margin: 0;
|
|
4306
|
+
}
|
|
4307
|
+
}
|
|
4308
|
+
|
|
4309
|
+
&__day {
|
|
4310
|
+
width: 32px;
|
|
4311
|
+
height: 32px;
|
|
4312
|
+
display: flex;
|
|
4313
|
+
justify-content: center;
|
|
4314
|
+
align-items: center;
|
|
4315
|
+
line-height: 32px;
|
|
4316
|
+
color: ${exports.colorTokens.neutral700};
|
|
4317
|
+
border-radius: 50%;
|
|
4318
|
+
font-size: 14px;
|
|
4319
|
+
font-weight: 500;
|
|
4320
|
+
margin: 0px;
|
|
4321
|
+
|
|
4322
|
+
&--keyboard-selected {
|
|
4323
|
+
background-color: transparent;
|
|
4324
|
+
}
|
|
4325
|
+
|
|
4326
|
+
&--outside-month {
|
|
4327
|
+
color: ${exports.colorTokens.neutral400};
|
|
4328
|
+
}
|
|
4329
|
+
|
|
4330
|
+
&--today {
|
|
4331
|
+
color: ${exports.colorTokens.primary300};
|
|
4332
|
+
font-weight: ${exports.fontWeightTokens.fontWeightRegular};
|
|
4333
|
+
}
|
|
4334
|
+
|
|
4335
|
+
&--in-selecting-range:not(
|
|
4336
|
+
.react-datepicker__day--in-range,
|
|
4337
|
+
.react-datepicker__month-text--in-range,
|
|
4338
|
+
.react-datepicker__quarter-text--in-range,
|
|
4339
|
+
.react-datepicker__year-text--in-range,
|
|
4340
|
+
.react-datepicker__day--selecting-range-start
|
|
4341
|
+
) {
|
|
4342
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4343
|
+
}
|
|
4344
|
+
|
|
4345
|
+
&--in-range {
|
|
4346
|
+
background-color: ${exports.colorTokens.primary300};
|
|
4347
|
+
color: ${exports.colorTokens.neutral0};
|
|
4348
|
+
position: relative;
|
|
4349
|
+
|
|
4350
|
+
&:not(.react-datepicker__day--range-start):not(.react-datepicker__day--range-end) {
|
|
4351
|
+
border-radius: 0;
|
|
4352
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4353
|
+
color: ${exports.colorTokens.primary300};
|
|
4354
|
+
}
|
|
4355
|
+
|
|
4356
|
+
&:not(.react-datepicker__day--range-end):after {
|
|
4357
|
+
width: 4px;
|
|
4358
|
+
height: 100%;
|
|
4359
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4360
|
+
position: absolute;
|
|
4361
|
+
content: '';
|
|
4362
|
+
right: -4px;
|
|
4363
|
+
top: 0;
|
|
4364
|
+
z-index: 1;
|
|
4365
|
+
}
|
|
4366
|
+
|
|
4367
|
+
&.react-datepicker__day--range-start {
|
|
4368
|
+
width: 32px;
|
|
4369
|
+
height: 32px;
|
|
4370
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4371
|
+
margin-right: 0;
|
|
4372
|
+
box-sizing: border-box;
|
|
4373
|
+
border: unset;
|
|
4374
|
+
border-radius: 50% 0 0 50%;
|
|
4375
|
+
}
|
|
4376
|
+
|
|
4377
|
+
&.react-datepicker__day--range-end {
|
|
4378
|
+
width: 32px;
|
|
4379
|
+
height: 32px;
|
|
4380
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4381
|
+
box-sizing: border-box;
|
|
4382
|
+
border: unset;
|
|
4383
|
+
border-radius: 0 50% 50% 0;
|
|
4384
|
+
}
|
|
4385
|
+
&.react-datepicker__day--range-end.react-datepicker__day--range-start {
|
|
4386
|
+
width: 32px;
|
|
4387
|
+
height: 32px;
|
|
4388
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4389
|
+
box-sizing: border-box;
|
|
4390
|
+
border: unset;
|
|
4391
|
+
border-radius: 50%;
|
|
4392
|
+
}
|
|
4393
|
+
&.react-datepicker__day--range-start .each-day {
|
|
4394
|
+
width: 32px;
|
|
4395
|
+
height: 32px;
|
|
4396
|
+
background-color: ${exports.colorTokens.primary300};
|
|
4397
|
+
border-radius: 100%;
|
|
4398
|
+
}
|
|
4399
|
+
|
|
4400
|
+
&.react-datepicker__day--range-end .each-day {
|
|
4401
|
+
width: 32px;
|
|
4402
|
+
height: 32px;
|
|
4403
|
+
background-color: ${exports.colorTokens.primary300};
|
|
4404
|
+
border-radius: 100%;
|
|
4405
|
+
}
|
|
4406
|
+
}
|
|
4407
|
+
|
|
4408
|
+
&--selected {
|
|
4409
|
+
color: ${exports.colorTokens.neutral0};
|
|
4410
|
+
background-color: ${exports.colorTokens.primary300};
|
|
4411
|
+
}
|
|
4412
|
+
|
|
4413
|
+
&--highlighted {
|
|
4414
|
+
color: ${exports.colorTokens.neutral0};
|
|
4415
|
+
background-color: ${exports.colorTokens.primary300};
|
|
4416
|
+
}
|
|
4417
|
+
|
|
4418
|
+
&--disabled {
|
|
4419
|
+
cursor: not-allowed;
|
|
4420
|
+
opacity: 0.3;
|
|
4421
|
+
color: ${exports.colorTokens.neutral700};
|
|
4422
|
+
|
|
4423
|
+
&.react-datepicker__day--keyboard-selected {
|
|
4424
|
+
background-color: ${exports.colorTokens.neutral200};
|
|
4425
|
+
}
|
|
4426
|
+
&.react-datepicker__day--excluded {
|
|
4427
|
+
color: ${exports.colorTokens.neutral0};
|
|
4428
|
+
}
|
|
4429
|
+
}
|
|
4430
|
+
|
|
4431
|
+
&:not(&--disabled):not(&--selected):not(&--highlighted):not(&--range-end):hover {
|
|
4432
|
+
color: ${exports.colorTokens.primary300};
|
|
4433
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4434
|
+
display: flex;
|
|
4435
|
+
align-items: center;
|
|
4436
|
+
justify-content: center;
|
|
4437
|
+
}
|
|
4438
|
+
}
|
|
4439
|
+
|
|
4440
|
+
&__year {
|
|
4441
|
+
&-wrapper {
|
|
4442
|
+
justify-content: center;
|
|
4443
|
+
}
|
|
4444
|
+
}
|
|
4445
|
+
}
|
|
4446
|
+
`;
|
|
4447
|
+
var StyledDayDatepicker = styled6__default.default.div`
|
|
4448
|
+
display: flex;
|
|
4449
|
+
width: 100%;
|
|
4450
|
+
height: 100%;
|
|
4451
|
+
flex-direction: column;
|
|
4452
|
+
|
|
4453
|
+
& .dayDatepickerArea .react-datepicker {
|
|
4454
|
+
width: 100%;
|
|
4455
|
+
height: 100%;
|
|
4456
|
+
border: none;
|
|
4457
|
+
margin: 0;
|
|
4458
|
+
padding: 16px 30px 16px;
|
|
4459
|
+
box-sizing: border-box;
|
|
4460
|
+
font-family: 'Pretendard', 'Pretendard JP', sans-serif !important;
|
|
4461
|
+
|
|
4462
|
+
& .highlighted-sundays {
|
|
4463
|
+
color: ${exports.colorTokens.red300};
|
|
4464
|
+
}
|
|
4465
|
+
|
|
4466
|
+
&__month-text--selected {
|
|
4467
|
+
color: #fff;
|
|
4468
|
+
}
|
|
4469
|
+
|
|
4470
|
+
&-popper {
|
|
4471
|
+
width: 432px;
|
|
4472
|
+
padding-top: 0;
|
|
4473
|
+
}
|
|
4474
|
+
|
|
4475
|
+
&__month-container {
|
|
4476
|
+
width: 100%;
|
|
4477
|
+
}
|
|
4478
|
+
|
|
4479
|
+
&__month {
|
|
4480
|
+
margin: 12px 0 0;
|
|
4481
|
+
}
|
|
4482
|
+
|
|
4483
|
+
&__header {
|
|
4484
|
+
border: none;
|
|
4485
|
+
background-color: transparent;
|
|
4486
|
+
padding: 0;
|
|
4487
|
+
}
|
|
4488
|
+
|
|
4489
|
+
&__month-wrapper {
|
|
4490
|
+
display: grid;
|
|
4491
|
+
grid-template-columns: 1fr 1fr 1fr 1fr;
|
|
4492
|
+
/* gap: 1.75rem; */
|
|
4493
|
+
}
|
|
4494
|
+
|
|
4495
|
+
&__month-text {
|
|
4496
|
+
display: flex;
|
|
4497
|
+
justify-content: center;
|
|
4498
|
+
align-items: center;
|
|
4499
|
+
width: 48px;
|
|
4500
|
+
height: 48px;
|
|
4501
|
+
border-radius: 50%;
|
|
4502
|
+
font-size: 16px;
|
|
4503
|
+
color: #333;
|
|
4504
|
+
|
|
4505
|
+
:hover {
|
|
4506
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4507
|
+
color: ${exports.colorTokens.primary300};
|
|
4508
|
+
}
|
|
4509
|
+
|
|
4510
|
+
&--keyboard-selected {
|
|
4511
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4512
|
+
color: ${exports.colorTokens.neutral700};
|
|
4513
|
+
}
|
|
4514
|
+
|
|
4515
|
+
&--selected:not(.react-datepicker--keyboard-selected) {
|
|
4516
|
+
background-color: ${exports.colorTokens.primary300};
|
|
4517
|
+
color: ${exports.colorTokens.neutral0};
|
|
4518
|
+
}
|
|
4519
|
+
}
|
|
4520
|
+
|
|
4521
|
+
&__week {
|
|
4522
|
+
margin-top: 8px;
|
|
4523
|
+
|
|
4524
|
+
&:first-of-type {
|
|
4525
|
+
margin-top: 0;
|
|
4526
|
+
}
|
|
4527
|
+
}
|
|
4528
|
+
|
|
4529
|
+
&__day-names {
|
|
4530
|
+
height: 18px;
|
|
4531
|
+
margin: 12px 0 0;
|
|
4532
|
+
}
|
|
4533
|
+
|
|
4534
|
+
&__day-name {
|
|
4535
|
+
width: 40px;
|
|
4536
|
+
margin: 0 10px 0 0;
|
|
4537
|
+
color: ${exports.colorTokens.navy300};
|
|
4538
|
+
font-size: 13px;
|
|
4539
|
+
font-weight: 500;
|
|
4540
|
+
line-height: 1rem;
|
|
4541
|
+
|
|
4542
|
+
:last-of-type {
|
|
4543
|
+
margin: 0;
|
|
4544
|
+
}
|
|
4545
|
+
}
|
|
4546
|
+
|
|
4547
|
+
&__day {
|
|
4548
|
+
width: 40px;
|
|
4549
|
+
height: 40px;
|
|
4550
|
+
line-height: 40px;
|
|
4551
|
+
margin: 0 10px 0 0;
|
|
4552
|
+
color: ${exports.colorTokens.neutral700};
|
|
4553
|
+
border-radius: 50%;
|
|
4554
|
+
font-size: 14px;
|
|
4555
|
+
font-weight: 500;
|
|
4556
|
+
|
|
4557
|
+
&--keyboard-selected {
|
|
4558
|
+
background-color: transparent;
|
|
4559
|
+
}
|
|
4560
|
+
|
|
4561
|
+
&--outside-month {
|
|
4562
|
+
color: ${exports.colorTokens.neutral400};
|
|
4563
|
+
}
|
|
4564
|
+
|
|
4565
|
+
&--today {
|
|
4566
|
+
color: ${exports.colorTokens.primary300};
|
|
4567
|
+
font-weight: ${exports.fontWeightTokens.fontWeightRegular};
|
|
4568
|
+
}
|
|
4569
|
+
|
|
4570
|
+
&--in-selecting-range:not(
|
|
4571
|
+
.react-datepicker__day--in-range,
|
|
4572
|
+
.react-datepicker__month-text--in-range,
|
|
4573
|
+
.react-datepicker__quarter-text--in-range,
|
|
4574
|
+
.react-datepicker__year-text--in-range,
|
|
4575
|
+
.react-datepicker__day--selecting-range-start
|
|
4576
|
+
) {
|
|
4577
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4578
|
+
}
|
|
4579
|
+
|
|
4580
|
+
&--in-range {
|
|
4581
|
+
background-color: ${exports.colorTokens.primary300};
|
|
4582
|
+
color: ${exports.colorTokens.neutral0};
|
|
4583
|
+
position: relative;
|
|
4584
|
+
|
|
4585
|
+
&:not(.react-datepicker__day--range-start):not(.react-datepicker__day--range-end) {
|
|
4586
|
+
border-radius: 0;
|
|
4587
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4588
|
+
color: ${exports.colorTokens.primary300};
|
|
4589
|
+
}
|
|
4590
|
+
|
|
4591
|
+
&:not(.react-datepicker__day--range-end):not(.react-datepicker__day--range-start):after {
|
|
4592
|
+
width: 10px;
|
|
4593
|
+
height: 100%;
|
|
4594
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4595
|
+
position: absolute;
|
|
4596
|
+
content: '';
|
|
4597
|
+
right: -10px;
|
|
4598
|
+
top: 0;
|
|
4599
|
+
z-index: 1;
|
|
4600
|
+
}
|
|
4601
|
+
|
|
4602
|
+
&.react-datepicker__day--range-start {
|
|
4603
|
+
width: 50px;
|
|
4604
|
+
height: 40px;
|
|
4605
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4606
|
+
margin-right: 0;
|
|
4607
|
+
padding-right: 10px;
|
|
4608
|
+
box-sizing: border-box;
|
|
4609
|
+
border: unset;
|
|
4610
|
+
border-radius: 50% 0 0 50%;
|
|
4611
|
+
}
|
|
4612
|
+
|
|
4613
|
+
&.react-datepicker__day--range-end {
|
|
4614
|
+
width: 40px;
|
|
4615
|
+
height: 40px;
|
|
4616
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4617
|
+
box-sizing: border-box;
|
|
4618
|
+
border: unset;
|
|
4619
|
+
border-radius: 0 50% 50% 0;
|
|
4620
|
+
}
|
|
4621
|
+
&.react-datepicker__day--range-end.react-datepicker__day--range-start {
|
|
4622
|
+
width: 40px;
|
|
4623
|
+
height: 40px;
|
|
4624
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4625
|
+
box-sizing: border-box;
|
|
4626
|
+
border: unset;
|
|
4627
|
+
border-radius: 50%;
|
|
4628
|
+
margin-right: 10px;
|
|
4629
|
+
}
|
|
4630
|
+
&.react-datepicker__day--range-start .each-day {
|
|
4631
|
+
width: 40px;
|
|
4632
|
+
height: 40px;
|
|
4633
|
+
background-color: ${exports.colorTokens.primary300};
|
|
4634
|
+
border-radius: 100%;
|
|
4635
|
+
}
|
|
4636
|
+
|
|
4637
|
+
&.react-datepicker__day--range-end .each-day {
|
|
4638
|
+
width: 40px;
|
|
4639
|
+
height: 40px;
|
|
4640
|
+
background-color: ${exports.colorTokens.primary300};
|
|
4641
|
+
border-radius: 100%;
|
|
4642
|
+
}
|
|
4643
|
+
}
|
|
4644
|
+
|
|
4645
|
+
&--selected {
|
|
4646
|
+
color: ${exports.colorTokens.neutral0};
|
|
4647
|
+
background-color: ${exports.colorTokens.primary300};
|
|
4648
|
+
}
|
|
4649
|
+
|
|
4650
|
+
&--highlighted {
|
|
4651
|
+
color: ${exports.colorTokens.neutral0};
|
|
4652
|
+
background-color: ${exports.colorTokens.primary300};
|
|
4653
|
+
}
|
|
4654
|
+
|
|
4655
|
+
&--disabled {
|
|
4656
|
+
cursor: not-allowed;
|
|
4657
|
+
opacity: 0.3;
|
|
4658
|
+
color: ${exports.colorTokens.neutral700};
|
|
4659
|
+
|
|
4660
|
+
&.react-datepicker__day--keyboard-selected {
|
|
4661
|
+
background-color: ${exports.colorTokens.neutral200};
|
|
4662
|
+
}
|
|
4663
|
+
&.react-datepicker__day--excluded {
|
|
4664
|
+
color: ${exports.colorTokens.neutral0};
|
|
4665
|
+
}
|
|
4666
|
+
}
|
|
4667
|
+
|
|
4668
|
+
&:not(&--disabled):not(&--selected):not(&--highlighted):not(&--range-end):hover {
|
|
4669
|
+
color: ${exports.colorTokens.primary300};
|
|
4670
|
+
background-color: ${exports.colorTokens.primary100};
|
|
4671
|
+
}
|
|
4672
|
+
}
|
|
4673
|
+
|
|
4674
|
+
&__year {
|
|
4675
|
+
&-wrapper {
|
|
4676
|
+
justify-content: center;
|
|
4677
|
+
}
|
|
4678
|
+
}
|
|
4679
|
+
}
|
|
4680
|
+
`;
|
|
4681
|
+
var Header = styled6__default.default.div`
|
|
4682
|
+
display: flex;
|
|
4683
|
+
justify-content: center;
|
|
4684
|
+
align-items: center;
|
|
4685
|
+
position: relative;
|
|
4686
|
+
width: 100%;
|
|
4687
|
+
height: 32px;
|
|
4688
|
+
gap: 8px;
|
|
4689
|
+
`;
|
|
4690
|
+
var Month = styled6__default.default.p`
|
|
4691
|
+
font-size: 18px;
|
|
4692
|
+
color: ${exports.colorTokens.neutral700};
|
|
4693
|
+
cursor: pointer;
|
|
4694
|
+
`;
|
|
4695
|
+
var DatePickerWrapper = styled6__default.default.div`
|
|
4696
|
+
position: absolute;
|
|
4697
|
+
z-index: 10;
|
|
4698
|
+
top: 36px;
|
|
4699
|
+
border-radius: 16px;
|
|
4700
|
+
overflow: hidden;
|
|
4701
|
+
box-shadow: 0px 10px 30px 0px rgba(51, 51, 51, 0.2);
|
|
4702
|
+
height: fit-content;
|
|
4703
|
+
padding: 16px 24px 24px 24px;
|
|
4704
|
+
background-color: ${exports.colorTokens.neutral0};
|
|
4705
|
+
|
|
4706
|
+
& .react-datepicker {
|
|
4707
|
+
padding: 0px !important;
|
|
4708
|
+
|
|
4709
|
+
&__header--custom {
|
|
4710
|
+
margin-bottom: 16px;
|
|
4711
|
+
}
|
|
4712
|
+
|
|
4713
|
+
&__month-wrapper {
|
|
4714
|
+
column-gap: 8px;
|
|
4715
|
+
margin-top: 8px;
|
|
4716
|
+
}
|
|
4717
|
+
|
|
4718
|
+
&__month-text--today {
|
|
4719
|
+
font-weight: ${exports.fontWeightTokens.fontWeightRegular};
|
|
4720
|
+
}
|
|
4721
|
+
}
|
|
4722
|
+
`;
|
|
4723
|
+
styled6__default.default.div`
|
|
4724
|
+
display: flex;
|
|
4725
|
+
justify-content: center;
|
|
4726
|
+
align-items: center;
|
|
4727
|
+
position: relative;
|
|
4728
|
+
width: 100%;
|
|
4729
|
+
height: 32px;
|
|
4730
|
+
gap: 8px;
|
|
4731
|
+
`;
|
|
4732
|
+
styled6__default.default.p`
|
|
4733
|
+
font-size: 18px;
|
|
4734
|
+
color: ${exports.colorTokens.neutral700};
|
|
4735
|
+
cursor: pointer;
|
|
4736
|
+
`;
|
|
4737
|
+
styled6__default.default.div`
|
|
4738
|
+
position: absolute;
|
|
4739
|
+
z-index: 10;
|
|
4740
|
+
top: 3rem;
|
|
4741
|
+
|
|
4742
|
+
border: 1px solid #eaeaea;
|
|
4743
|
+
box-shadow: 0px 10px 30px 0px rgba(51, 51, 51, 0.2);
|
|
4744
|
+
.react-datepicker {
|
|
4745
|
+
border: 1px solid #eaeaea;
|
|
4746
|
+
}
|
|
4747
|
+
`;
|
|
4748
|
+
var Container5 = styled6__default.default.div`
|
|
4749
|
+
border-radius: 4px;
|
|
4750
|
+
background-color: ${exports.colorTokens.neutral0};
|
|
4751
|
+
box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.12);
|
|
4752
|
+
padding: 4px;
|
|
4753
|
+
z-index: 10;
|
|
4754
|
+
position: relative;
|
|
4755
|
+
top: 0px;
|
|
4756
|
+
left: 0px;
|
|
4757
|
+
|
|
4758
|
+
& .simplebar-placeholder {
|
|
4759
|
+
height: 0px !important;
|
|
4760
|
+
}
|
|
4761
|
+
`;
|
|
4762
|
+
var OptionList = styled6__default.default.ul`
|
|
4763
|
+
height: fit-content;
|
|
4764
|
+
|
|
4765
|
+
${({ maxHeight }) => {
|
|
4766
|
+
if (maxHeight) {
|
|
4767
|
+
return `
|
|
4768
|
+
max-height: ${maxHeight};
|
|
4769
|
+
overflow: auto;
|
|
4770
|
+
overflow-y: scroll;
|
|
4771
|
+
|
|
4772
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
4773
|
+
scrollbar-width: none; /* Firefox */
|
|
4774
|
+
|
|
4775
|
+
&::-webkit-scrollbar {
|
|
4776
|
+
display: none; /* Chrome, Safari, Opera*/
|
|
4777
|
+
}
|
|
4778
|
+
`;
|
|
4779
|
+
}
|
|
4780
|
+
}}
|
|
4781
|
+
`;
|
|
4782
|
+
var OptionListItem = styled6__default.default.li`
|
|
4783
|
+
padding: 7px 8px;
|
|
4784
|
+
font-size: 14px;
|
|
4785
|
+
font-weight: 500;
|
|
4786
|
+
line-height: 18px;
|
|
4787
|
+
text-align: left;
|
|
4788
|
+
white-space: break-spaces;
|
|
4789
|
+
cursor: pointer;
|
|
4790
|
+
border-radius: 4px;
|
|
4791
|
+
background-color: ${({ isActive }) => isActive && exports.colorTokens.primary300};
|
|
4792
|
+
color: ${({ isActive }) => isActive && exports.colorTokens.neutral0};
|
|
4793
|
+
|
|
4794
|
+
&:hover {
|
|
4795
|
+
background-color: ${({ isActive }) => !isActive && exports.colorTokens.neutral100};
|
|
4796
|
+
}
|
|
4797
|
+
`;
|
|
4798
|
+
var YearSelect = ({ optionList, className, parentClassName, activeValue, maxHeight, onClick }) => {
|
|
4799
|
+
const optionListRef = React3.useRef([]);
|
|
4800
|
+
const parentRef = React3.useRef(null);
|
|
4801
|
+
const [isAllRefMounted, setIsAllRefMounted] = React3.useState(false);
|
|
4802
|
+
const [isOpened, setIsOpened] = utils.useOutsideClick({
|
|
4803
|
+
selector: `.${parentClassName}` || ""
|
|
4804
|
+
});
|
|
4805
|
+
React3.useEffect(() => {
|
|
4806
|
+
setIsOpened(isOpened);
|
|
4807
|
+
}, []);
|
|
4808
|
+
React3.useEffect(() => {
|
|
4809
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4810
|
+
if (!isAllRefMounted || !activeValue || !maxHeight) {
|
|
4811
|
+
return;
|
|
4812
|
+
}
|
|
4813
|
+
const selectedOptionIndex = optionList.findIndex((option) => (option == null ? void 0 : option.value) === activeValue);
|
|
4814
|
+
const heightPerOption = (_b = (_a = optionListRef.current[selectedOptionIndex]) == null ? void 0 : _a.offsetHeight) != null ? _b : 0;
|
|
4815
|
+
const parentHeight = (_e = (_d = (_c = optionListRef.current[selectedOptionIndex]) == null ? void 0 : _c.closest("ul")) == null ? void 0 : _d.clientHeight) != null ? _e : 0;
|
|
4816
|
+
if (heightPerOption * (selectedOptionIndex + 1) >= parentHeight) {
|
|
4817
|
+
(_f = parentRef.current) == null ? void 0 : _f.scrollTo({ top: heightPerOption * selectedOptionIndex });
|
|
4818
|
+
}
|
|
4819
|
+
}, [isAllRefMounted, activeValue, maxHeight]);
|
|
4820
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Container5, { className: `${parentClassName} ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx(OptionList, { ref: parentRef, maxHeight, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4821
|
+
SimpleBarReact__default.default,
|
|
4822
|
+
{
|
|
4823
|
+
style: {
|
|
4824
|
+
maxHeight
|
|
4825
|
+
},
|
|
4826
|
+
placeholder: void 0,
|
|
4827
|
+
children: optionList == null ? void 0 : optionList.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4828
|
+
OptionListItem,
|
|
4829
|
+
{
|
|
4830
|
+
onClick: (event) => {
|
|
4831
|
+
event.stopPropagation();
|
|
4832
|
+
onClick(option);
|
|
4833
|
+
},
|
|
4834
|
+
isActive: activeValue === option.value,
|
|
4835
|
+
ref: (el) => {
|
|
4836
|
+
optionListRef.current[index] = el;
|
|
4837
|
+
index + 1 === optionList.length && setIsAllRefMounted(true);
|
|
4838
|
+
},
|
|
4839
|
+
children: option.label
|
|
4840
|
+
},
|
|
4841
|
+
option.value
|
|
4842
|
+
))
|
|
4843
|
+
}
|
|
4844
|
+
) }) });
|
|
4845
|
+
};
|
|
4846
|
+
var YearSelect_default = YearSelect;
|
|
4847
|
+
var YearStepper = ({
|
|
4848
|
+
date,
|
|
4849
|
+
decreaseYear,
|
|
4850
|
+
prevYearButtonDisabled,
|
|
4851
|
+
nextYearButtonDisabled,
|
|
4852
|
+
increaseYear,
|
|
4853
|
+
changeYear,
|
|
4854
|
+
minDate,
|
|
4855
|
+
maxDate
|
|
4856
|
+
}) => {
|
|
4857
|
+
const [isOpen, setIsOpen] = utils.useOutsideClick({
|
|
4858
|
+
selector: ".react-datepicker-year-stepper"
|
|
4859
|
+
});
|
|
4860
|
+
const startYear = minDate ? minDate.getFullYear() : 2e3;
|
|
4861
|
+
const endYear = maxDate ? maxDate.getFullYear() : 2100;
|
|
4862
|
+
const OptionList2 = React3.useMemo(
|
|
4863
|
+
() => Array.from({ length: endYear - startYear + 1 }).fill(0).map((_, index) => ({ value: startYear + index, label: `${startYear + index}` })),
|
|
4864
|
+
[startYear, endYear]
|
|
4865
|
+
);
|
|
4866
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Header, { className: "calendarHeader", children: [
|
|
4867
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4868
|
+
exports.IconButton,
|
|
4869
|
+
{
|
|
4870
|
+
styleVar: "GHOST",
|
|
4871
|
+
sizeVar: "S",
|
|
4872
|
+
onClick: decreaseYear,
|
|
4873
|
+
disabled: prevYearButtonDisabled || date.getFullYear() === startYear,
|
|
4874
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { iconSource: ShoplAssets.LeftArrowIcon, sizeVar: "XS", color: prevYearButtonDisabled ? "neutral200" : "neutral700" })
|
|
4875
|
+
}
|
|
4876
|
+
),
|
|
4877
|
+
/* @__PURE__ */ jsxRuntime.jsxs(exports.Popper, { placement: "bottom", middlewares: [core.flip(), core.shift({ padding: 5 })], children: [
|
|
4878
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Popper.Trigger, { isOpen, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4879
|
+
Month,
|
|
4880
|
+
{
|
|
4881
|
+
className: "react-datepicker-year-stepper",
|
|
4882
|
+
onClick: (event) => {
|
|
4883
|
+
event.stopPropagation();
|
|
4884
|
+
setIsOpen((prev) => !prev);
|
|
4885
|
+
},
|
|
4886
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "title1_700", children: `${date.getFullYear()}` })
|
|
4887
|
+
}
|
|
4888
|
+
) }),
|
|
4889
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Popper.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4890
|
+
YearSelect_default,
|
|
4891
|
+
{
|
|
4892
|
+
className: "react-datepicker-year-stepper",
|
|
4893
|
+
optionList: OptionList2,
|
|
4894
|
+
onClick: ({ value }) => {
|
|
4895
|
+
changeYear(value);
|
|
4896
|
+
setIsOpen(false);
|
|
4897
|
+
},
|
|
4898
|
+
parentClassName: "react-datepicker-year-stepper",
|
|
4899
|
+
maxHeight: `200px`,
|
|
4900
|
+
activeValue: date.getFullYear()
|
|
4901
|
+
}
|
|
4902
|
+
) })
|
|
4903
|
+
] }),
|
|
4904
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4905
|
+
exports.IconButton,
|
|
4906
|
+
{
|
|
4907
|
+
styleVar: "GHOST",
|
|
4908
|
+
sizeVar: "S",
|
|
4909
|
+
onClick: increaseYear,
|
|
4910
|
+
disabled: nextYearButtonDisabled || date.getFullYear() === endYear,
|
|
4911
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { iconSource: ShoplAssets.RightArrowIcon, sizeVar: "XS", color: nextYearButtonDisabled ? "neutral200" : "neutral700" })
|
|
4912
|
+
}
|
|
4913
|
+
)
|
|
4914
|
+
] });
|
|
4915
|
+
};
|
|
4916
|
+
var YearStepper_default = YearStepper;
|
|
4917
|
+
var MonthStepper = ({
|
|
4918
|
+
date,
|
|
4919
|
+
monthDate,
|
|
4920
|
+
decreaseMonth,
|
|
4921
|
+
increaseMonth,
|
|
4922
|
+
changeYear,
|
|
4923
|
+
changeMonth,
|
|
4924
|
+
minDate,
|
|
4925
|
+
maxDate,
|
|
4926
|
+
locale: locale$1,
|
|
4927
|
+
sizeVar,
|
|
4928
|
+
prevMonthButtonDisabled,
|
|
4929
|
+
nextMonthButtonDisabled
|
|
4930
|
+
}) => {
|
|
4931
|
+
const [isOpen, setIsOpen] = utils.useOutsideClick({
|
|
4932
|
+
selector: ".react-datepicker__header"
|
|
4933
|
+
});
|
|
4934
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Header, { className: "calendarHeader", children: [
|
|
4935
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.IconButton, { styleVar: "GHOST", sizeVar: "S", onClick: decreaseMonth, disabled: prevMonthButtonDisabled, children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { iconSource: ShoplAssets.LeftArrowIcon, sizeVar: "XS", color: prevMonthButtonDisabled ? "neutral200" : "neutral700" }) }),
|
|
4936
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4937
|
+
Month,
|
|
4938
|
+
{
|
|
4939
|
+
className: "react-datepicker__header",
|
|
4940
|
+
onClick: () => {
|
|
4941
|
+
setIsOpen((prev) => !prev);
|
|
4942
|
+
},
|
|
4943
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: sizeVar === "M" ? "title1_700" : "body1_700", children: `${date.getFullYear()}.${monthDate.getMonth() + 1}` })
|
|
4944
|
+
}
|
|
4945
|
+
),
|
|
4946
|
+
isOpen && /* @__PURE__ */ jsxRuntime.jsx(DatePickerWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "datepicker-header-wrapper", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4947
|
+
DatePicker2__default.default,
|
|
4948
|
+
{
|
|
4949
|
+
className: "datepicker-custom-month",
|
|
4950
|
+
onChange: (date2) => {
|
|
4951
|
+
if (!date2) {
|
|
4952
|
+
return;
|
|
4953
|
+
}
|
|
4954
|
+
changeYear && changeYear(date2.getFullYear());
|
|
4955
|
+
changeMonth && changeMonth(date2.getMonth());
|
|
4956
|
+
setIsOpen(false);
|
|
4957
|
+
},
|
|
4958
|
+
inline: true,
|
|
4959
|
+
selectsEnd: true,
|
|
4960
|
+
dateFormat: "mm",
|
|
4961
|
+
selected: date,
|
|
4962
|
+
minDate,
|
|
4963
|
+
maxDate,
|
|
4964
|
+
locale: locale$1 != null ? locale$1 : locale.ko,
|
|
4965
|
+
showMonthYearPicker: true,
|
|
4966
|
+
renderCustomHeader: (props) => /* @__PURE__ */ jsxRuntime.jsx(YearStepper_default, __spreadValues({}, props)),
|
|
4967
|
+
showFourColumnMonthYearPicker: true
|
|
4968
|
+
}
|
|
4969
|
+
) }) }),
|
|
4970
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.IconButton, { styleVar: "GHOST", sizeVar: "S", onClick: increaseMonth, disabled: nextMonthButtonDisabled, children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { iconSource: ShoplAssets.RightArrowIcon, sizeVar: "XS", color: nextMonthButtonDisabled ? "neutral200" : "neutral700" }) })
|
|
4971
|
+
] });
|
|
4972
|
+
};
|
|
4973
|
+
var MonthStepper_default = MonthStepper;
|
|
4974
|
+
var DayDatepicker = (_a) => {
|
|
4975
|
+
var _b = _a, { sizeVar, children, calendarType } = _b, rest = __objRest(_b, ["sizeVar", "children", "calendarType"]);
|
|
4976
|
+
const Wrapper2 = sizeVar === "S" ? SmallStyledDayDatepickerWrapper : StyledDayDatepicker;
|
|
4977
|
+
if (calendarType.type === "range") {
|
|
4978
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Wrapper2, { "data-shoplflow": "DayDatepicker", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dayDatepickerArea", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4979
|
+
DatePicker2__default.default,
|
|
4980
|
+
__spreadProps(__spreadValues({
|
|
4981
|
+
inline: true,
|
|
4982
|
+
renderCustomHeader: (props) => /* @__PURE__ */ jsxRuntime.jsx(MonthStepper_default, __spreadValues({ sizeVar: sizeVar || "M" }, props)),
|
|
4983
|
+
renderDayContents: (dayOfMonth) => {
|
|
4984
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "each-day", children: dayOfMonth });
|
|
4985
|
+
}
|
|
4986
|
+
}, rest), {
|
|
4987
|
+
selectsRange: true,
|
|
4988
|
+
selectsMultiple: void 0,
|
|
4989
|
+
onChange: calendarType.handleDayRangeChange,
|
|
4990
|
+
children
|
|
4991
|
+
})
|
|
4992
|
+
) }) });
|
|
4993
|
+
}
|
|
4994
|
+
if (calendarType.type === "multiple") {
|
|
4995
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Wrapper2, { "data-shoplflow": "DayDatepicker", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dayDatepickerArea", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4996
|
+
DatePicker2__default.default,
|
|
4997
|
+
__spreadProps(__spreadValues({
|
|
4998
|
+
inline: true,
|
|
4999
|
+
renderCustomHeader: (props) => /* @__PURE__ */ jsxRuntime.jsx(MonthStepper_default, __spreadValues({ sizeVar: sizeVar || "M" }, props)),
|
|
5000
|
+
renderDayContents: (dayOfMonth) => {
|
|
5001
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "each-day", children: dayOfMonth });
|
|
5002
|
+
}
|
|
5003
|
+
}, rest), {
|
|
5004
|
+
selectsMultiple: true,
|
|
5005
|
+
onChange: calendarType.handleMutlipleDaysChange,
|
|
5006
|
+
children
|
|
5007
|
+
})
|
|
5008
|
+
) }) });
|
|
5009
|
+
}
|
|
5010
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Wrapper2, { "data-shoplflow": "DayDatepicker", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dayDatepickerArea", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5011
|
+
DatePicker2__default.default,
|
|
5012
|
+
__spreadProps(__spreadValues({
|
|
5013
|
+
inline: true,
|
|
5014
|
+
renderCustomHeader: (props) => /* @__PURE__ */ jsxRuntime.jsx(MonthStepper_default, __spreadValues({ sizeVar: sizeVar || "M" }, props)),
|
|
5015
|
+
renderDayContents: (dayOfMonth) => {
|
|
5016
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "each-day", children: dayOfMonth });
|
|
5017
|
+
}
|
|
5018
|
+
}, rest), {
|
|
5019
|
+
onChange: calendarType.handleDayChange,
|
|
5020
|
+
children
|
|
5021
|
+
})
|
|
5022
|
+
) }) });
|
|
5023
|
+
};
|
|
5024
|
+
exports.DayDatepicker = DayDatepicker;
|
|
5025
|
+
|
|
5026
|
+
// src/components/Datepickers/DayDatepicker/DayDatepicker.types.ts
|
|
5027
|
+
exports.DayDatepickerSizeVariants = {
|
|
5028
|
+
S: "S",
|
|
5029
|
+
M: "M"
|
|
5030
|
+
};
|
|
5031
|
+
var getEachDateStyle = (props) => {
|
|
5032
|
+
const { inRange, isStart, isEnd, disabled } = props;
|
|
5033
|
+
if (isStart || isEnd) {
|
|
5034
|
+
return react$1.css`
|
|
5035
|
+
background-color: ${exports.colorTokens.primary300};
|
|
5036
|
+
color: ${exports.colorTokens.neutral0};
|
|
5037
|
+
`;
|
|
5038
|
+
}
|
|
5039
|
+
if (inRange) {
|
|
5040
|
+
return react$1.css`
|
|
5041
|
+
background-color: ${exports.colorTokens.primary100};
|
|
5042
|
+
color: ${exports.colorTokens.neutral700};
|
|
5043
|
+
`;
|
|
5044
|
+
}
|
|
5045
|
+
if (disabled) {
|
|
5046
|
+
return react$1.css`
|
|
5047
|
+
color: ${exports.colorTokens.neutral400};
|
|
5048
|
+
cursor: not-allowed;
|
|
5049
|
+
`;
|
|
5050
|
+
}
|
|
5051
|
+
return react$1.css`
|
|
5052
|
+
&:hover {
|
|
5053
|
+
background-color: ${exports.colorTokens.primary100};
|
|
5054
|
+
}
|
|
5055
|
+
`;
|
|
5056
|
+
};
|
|
5057
|
+
var getEachMonthAreaStyle = (props) => {
|
|
5058
|
+
const { inRange, isStart, isEnd, isReady, disabled } = props;
|
|
5059
|
+
if (isStart && isReady) {
|
|
5060
|
+
return react$1.css`
|
|
5061
|
+
&::after {
|
|
5062
|
+
content: '';
|
|
5063
|
+
position: absolute;
|
|
5064
|
+
right: 0;
|
|
5065
|
+
top: 0;
|
|
5066
|
+
bottom: 0;
|
|
5067
|
+
width: 48px;
|
|
5068
|
+
background: ${exports.colorTokens.primary100};
|
|
5069
|
+
}
|
|
5070
|
+
`;
|
|
5071
|
+
}
|
|
5072
|
+
if (isEnd && !isStart) {
|
|
5073
|
+
return react$1.css`
|
|
5074
|
+
&::after {
|
|
5075
|
+
content: '';
|
|
5076
|
+
position: absolute;
|
|
5077
|
+
left: 0;
|
|
5078
|
+
top: 0;
|
|
5079
|
+
bottom: 0;
|
|
5080
|
+
width: 48px;
|
|
5081
|
+
background: ${exports.colorTokens.primary100};
|
|
5082
|
+
}
|
|
5083
|
+
`;
|
|
5084
|
+
}
|
|
5085
|
+
if (inRange) {
|
|
5086
|
+
return react$1.css`
|
|
5087
|
+
background-color: ${exports.colorTokens.primary100};
|
|
5088
|
+
color: ${exports.colorTokens.neutral700};
|
|
5089
|
+
`;
|
|
5090
|
+
}
|
|
5091
|
+
if (disabled) {
|
|
5092
|
+
return react$1.css`
|
|
5093
|
+
cursor: not-allowed;
|
|
5094
|
+
`;
|
|
5095
|
+
}
|
|
5096
|
+
};
|
|
5097
|
+
var MonthContainer = styled6__default.default.div`
|
|
5098
|
+
display: flex;
|
|
5099
|
+
flex-direction: column;
|
|
5100
|
+
width: 400px;
|
|
5101
|
+
max-width: 400px;
|
|
5102
|
+
gap: 16px;
|
|
5103
|
+
padding: 16px 24px 24px;
|
|
5104
|
+
`;
|
|
5105
|
+
var MonthArea = styled6__default.default.div`
|
|
5106
|
+
width: 100%;
|
|
5107
|
+
display: grid;
|
|
5108
|
+
grid-template-columns: repeat(4, 1fr);
|
|
5109
|
+
grid-row-gap: 16px;
|
|
5110
|
+
`;
|
|
5111
|
+
var EachMonthArea = styled6__default.default.div`
|
|
5112
|
+
width: 100%;
|
|
5113
|
+
height: 48px;
|
|
5114
|
+
display: flex;
|
|
5115
|
+
justify-content: center;
|
|
5116
|
+
align-items: center;
|
|
5117
|
+
position: relative;
|
|
5118
|
+
|
|
5119
|
+
${(props) => getEachMonthAreaStyle(props)}
|
|
5120
|
+
`;
|
|
5121
|
+
var EachMonthDate = styled6__default.default.div`
|
|
5122
|
+
width: 48px;
|
|
5123
|
+
height: 48px;
|
|
5124
|
+
text-align: center;
|
|
5125
|
+
font-size: 14px;
|
|
5126
|
+
line-height: 48px;
|
|
5127
|
+
padding: 0;
|
|
5128
|
+
border-radius: 50%;
|
|
5129
|
+
cursor: pointer;
|
|
5130
|
+
position: absolute;
|
|
5131
|
+
z-index: 10;
|
|
5132
|
+
|
|
5133
|
+
${(props) => getEachDateStyle(props)}
|
|
5134
|
+
`;
|
|
5135
|
+
var MonthDatepicker = ({
|
|
5136
|
+
handleMonthClick,
|
|
5137
|
+
initStartDate,
|
|
5138
|
+
initEndDate,
|
|
5139
|
+
minDate,
|
|
5140
|
+
maxDate,
|
|
5141
|
+
onlySingleMonth
|
|
5142
|
+
}) => {
|
|
5143
|
+
const [currentDate, setCurrentDate] = React3.useState(initStartDate || /* @__PURE__ */ new Date());
|
|
5144
|
+
const [selectedStartMonthAndYear, setSelectedStartMonthAndYear] = React3.useState(
|
|
5145
|
+
initStartDate ? [initStartDate.getMonth(), initStartDate.getFullYear()] : null
|
|
5146
|
+
);
|
|
5147
|
+
const [selectedEndMonthAndYear, setSelectedEndMonthAndYear] = React3.useState(
|
|
5148
|
+
initEndDate ? [initEndDate.getMonth(), initEndDate.getFullYear()] : null
|
|
5149
|
+
);
|
|
5150
|
+
const Months = React3.useMemo(() => {
|
|
5151
|
+
return Array.from({ length: 12 }).map((_, index) => index + 1);
|
|
5152
|
+
}, []);
|
|
5153
|
+
const clickMonth = (month, year) => {
|
|
5154
|
+
if (onlySingleMonth) {
|
|
5155
|
+
setSelectedStartMonthAndYear([month, year]);
|
|
5156
|
+
handleMonthClick({
|
|
5157
|
+
startDate: dateFns.startOfMonth(new Date(year, month - 1)),
|
|
5158
|
+
endDate: dateFns.endOfMonth(new Date(year, month - 1)),
|
|
5159
|
+
selectedMonthRange: 1
|
|
5160
|
+
});
|
|
5161
|
+
return;
|
|
5162
|
+
}
|
|
5163
|
+
if (!selectedStartMonthAndYear || selectedStartMonthAndYear && selectedEndMonthAndYear) {
|
|
5164
|
+
const startDate = dateFns.startOfMonth(new Date(year, month - 1));
|
|
5165
|
+
const endDate = dateFns.endOfMonth(new Date(year, month - 1));
|
|
5166
|
+
setSelectedStartMonthAndYear([month, year]);
|
|
5167
|
+
setSelectedEndMonthAndYear(null);
|
|
5168
|
+
handleMonthClick({
|
|
5169
|
+
startDate,
|
|
5170
|
+
endDate,
|
|
5171
|
+
// 현재 달 까지 포함
|
|
5172
|
+
selectedMonthRange: dateFns.differenceInCalendarMonths(endDate, startDate) + 1
|
|
5173
|
+
});
|
|
5174
|
+
return;
|
|
5175
|
+
}
|
|
5176
|
+
if (selectedStartMonthAndYear && !selectedEndMonthAndYear) {
|
|
5177
|
+
const [selectedMonth, selectedYear] = selectedStartMonthAndYear;
|
|
5178
|
+
if (selectedYear > year || selectedYear === year && selectedMonth > month) {
|
|
5179
|
+
const startDate2 = dateFns.startOfMonth(new Date(year, month - 1));
|
|
5180
|
+
const endDate2 = dateFns.endOfMonth(new Date(selectedYear, selectedMonth - 1));
|
|
5181
|
+
setSelectedStartMonthAndYear([month, year]);
|
|
5182
|
+
setSelectedEndMonthAndYear([selectedMonth, selectedYear]);
|
|
5183
|
+
handleMonthClick({
|
|
5184
|
+
startDate: startDate2,
|
|
5185
|
+
endDate: endDate2,
|
|
5186
|
+
// 현재 달 까지 포함
|
|
5187
|
+
selectedMonthRange: dateFns.differenceInCalendarMonths(endDate2, startDate2) + 1
|
|
5188
|
+
});
|
|
5189
|
+
return;
|
|
5190
|
+
}
|
|
5191
|
+
if (selectedMonth !== month || selectedYear !== year) {
|
|
5192
|
+
setSelectedEndMonthAndYear([month, year]);
|
|
5193
|
+
}
|
|
5194
|
+
const startDate = dateFns.startOfMonth(new Date(selectedYear, selectedMonth - 1));
|
|
5195
|
+
const endDate = dateFns.endOfMonth(new Date(year, month - 1));
|
|
5196
|
+
handleMonthClick({
|
|
5197
|
+
startDate,
|
|
5198
|
+
endDate,
|
|
5199
|
+
// 현재 달까지 포함
|
|
5200
|
+
selectedMonthRange: dateFns.differenceInCalendarMonths(endDate, startDate) + 1
|
|
5201
|
+
});
|
|
5202
|
+
}
|
|
5203
|
+
};
|
|
5204
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(MonthContainer, { "data-shoplflow": "MonthDatepicker", children: [
|
|
5205
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5206
|
+
YearStepper_default,
|
|
5207
|
+
{
|
|
5208
|
+
date: currentDate,
|
|
5209
|
+
decreaseYear: () => {
|
|
5210
|
+
setCurrentDate(new Date(currentDate.getFullYear() - 1, currentDate.getMonth(), currentDate.getDate()));
|
|
5211
|
+
},
|
|
5212
|
+
minDate,
|
|
5213
|
+
maxDate,
|
|
5214
|
+
prevYearButtonDisabled: minDate ? minDate.getFullYear() === currentDate.getFullYear() : false,
|
|
5215
|
+
nextYearButtonDisabled: maxDate ? maxDate.getFullYear() === currentDate.getFullYear() : false,
|
|
5216
|
+
increaseYear: () => {
|
|
5217
|
+
setCurrentDate(new Date(currentDate.getFullYear() + 1, currentDate.getMonth(), currentDate.getDate()));
|
|
5218
|
+
},
|
|
5219
|
+
changeYear: (year) => {
|
|
5220
|
+
setCurrentDate(new Date(year, currentDate.getMonth(), currentDate.getDate()));
|
|
5221
|
+
}
|
|
5222
|
+
}
|
|
5223
|
+
),
|
|
5224
|
+
/* @__PURE__ */ jsxRuntime.jsx(MonthArea, { children: Months.map((month) => {
|
|
5225
|
+
const currentYear = currentDate.getFullYear();
|
|
5226
|
+
const isStart = currentYear === (selectedStartMonthAndYear == null ? void 0 : selectedStartMonthAndYear[1]) && month === (selectedStartMonthAndYear == null ? void 0 : selectedStartMonthAndYear[0]);
|
|
5227
|
+
const isEnd = (selectedEndMonthAndYear == null ? void 0 : selectedEndMonthAndYear[1]) === currentYear && (selectedEndMonthAndYear == null ? void 0 : selectedEndMonthAndYear[0]) === month;
|
|
5228
|
+
const isReady = isStart && Boolean(selectedEndMonthAndYear);
|
|
5229
|
+
let inRange = false;
|
|
5230
|
+
let disabled = false;
|
|
5231
|
+
if (minDate) {
|
|
5232
|
+
const minMonth = minDate.getMonth() + 1;
|
|
5233
|
+
const minYear = minDate.getFullYear();
|
|
5234
|
+
if (currentYear < minYear) {
|
|
5235
|
+
disabled = true;
|
|
5236
|
+
}
|
|
5237
|
+
if (currentYear === minYear) {
|
|
5238
|
+
if (month <= minMonth) {
|
|
5239
|
+
disabled = true;
|
|
5240
|
+
}
|
|
5241
|
+
}
|
|
5242
|
+
}
|
|
5243
|
+
if (maxDate) {
|
|
5244
|
+
const maxMonth = maxDate.getMonth() + 1;
|
|
5245
|
+
const maxYear = maxDate.getFullYear();
|
|
5246
|
+
if (currentYear > maxYear) {
|
|
5247
|
+
disabled = true;
|
|
5248
|
+
}
|
|
5249
|
+
if (currentYear === maxYear) {
|
|
5250
|
+
if (month >= maxMonth) {
|
|
5251
|
+
disabled = true;
|
|
5252
|
+
}
|
|
5253
|
+
}
|
|
5254
|
+
}
|
|
5255
|
+
if (selectedStartMonthAndYear && selectedEndMonthAndYear) {
|
|
5256
|
+
const [startMonth, startYear] = selectedStartMonthAndYear;
|
|
5257
|
+
const [endMonth, endYear] = selectedEndMonthAndYear;
|
|
5258
|
+
if (currentYear > startYear && currentYear < endYear) {
|
|
5259
|
+
inRange = true;
|
|
5260
|
+
}
|
|
5261
|
+
if (currentYear === startYear && currentYear === endYear) {
|
|
5262
|
+
if (month >= startMonth && month <= endMonth) {
|
|
5263
|
+
inRange = true;
|
|
5264
|
+
}
|
|
5265
|
+
}
|
|
5266
|
+
if (currentYear === startYear && currentYear !== endYear) {
|
|
5267
|
+
if (month >= startMonth) {
|
|
5268
|
+
inRange = true;
|
|
5269
|
+
}
|
|
5270
|
+
}
|
|
5271
|
+
if (currentYear === endYear && currentYear !== startYear) {
|
|
5272
|
+
if (month <= endMonth) {
|
|
5273
|
+
inRange = true;
|
|
5274
|
+
}
|
|
5275
|
+
}
|
|
5276
|
+
}
|
|
5277
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5278
|
+
EachMonthArea,
|
|
5279
|
+
{
|
|
5280
|
+
inRange,
|
|
5281
|
+
isStart,
|
|
5282
|
+
isReady,
|
|
5283
|
+
isEnd,
|
|
5284
|
+
disabled,
|
|
5285
|
+
onClick: () => {
|
|
5286
|
+
if (disabled) {
|
|
5287
|
+
return;
|
|
5288
|
+
}
|
|
5289
|
+
clickMonth(month, currentDate.getFullYear());
|
|
5290
|
+
},
|
|
5291
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(EachMonthDate, { inRange, isStart, isEnd, disabled, children: month })
|
|
5292
|
+
},
|
|
5293
|
+
month
|
|
5294
|
+
);
|
|
5295
|
+
}) })
|
|
5296
|
+
] });
|
|
5297
|
+
};
|
|
5298
|
+
exports.MonthDatepicker = MonthDatepicker;
|
|
5299
|
+
var getEachDateStyle2 = (props) => {
|
|
5300
|
+
const { isSelected, disabled } = props;
|
|
5301
|
+
if (isSelected) {
|
|
5302
|
+
return react$1.css`
|
|
5303
|
+
background-color: ${exports.colorTokens.primary300};
|
|
5304
|
+
color: ${exports.colorTokens.neutral0};
|
|
5305
|
+
`;
|
|
5306
|
+
}
|
|
5307
|
+
if (disabled) {
|
|
5308
|
+
return react$1.css`
|
|
5309
|
+
color: ${exports.colorTokens.neutral400};
|
|
5310
|
+
cursor: not-allowed;
|
|
5311
|
+
`;
|
|
5312
|
+
}
|
|
5313
|
+
return react$1.css`
|
|
5314
|
+
&:hover {
|
|
5315
|
+
background-color: ${exports.colorTokens.primary100};
|
|
5316
|
+
}
|
|
5317
|
+
`;
|
|
5318
|
+
};
|
|
5319
|
+
var getEachYearAreaStyle = (props) => {
|
|
5320
|
+
const { disabled } = props;
|
|
5321
|
+
if (disabled) {
|
|
5322
|
+
return react$1.css`
|
|
5323
|
+
cursor: not-allowed;
|
|
5324
|
+
`;
|
|
5325
|
+
}
|
|
5326
|
+
};
|
|
5327
|
+
var YearContainer = styled6__default.default.div`
|
|
5328
|
+
display: flex;
|
|
5329
|
+
flex-direction: column;
|
|
5330
|
+
width: 400px;
|
|
5331
|
+
max-width: 400px;
|
|
5332
|
+
gap: 16px;
|
|
5333
|
+
padding: 16px 24px 24px;
|
|
5334
|
+
`;
|
|
5335
|
+
var YearArea = styled6__default.default.div`
|
|
5336
|
+
width: 100%;
|
|
5337
|
+
display: grid;
|
|
5338
|
+
grid-template-columns: repeat(4, 1fr);
|
|
5339
|
+
grid-row-gap: 16px;
|
|
5340
|
+
`;
|
|
5341
|
+
var EachYearArea = styled6__default.default.div`
|
|
5342
|
+
width: 100%;
|
|
5343
|
+
height: 48px;
|
|
5344
|
+
display: flex;
|
|
5345
|
+
justify-content: center;
|
|
5346
|
+
align-items: center;
|
|
5347
|
+
position: relative;
|
|
5348
|
+
|
|
5349
|
+
${(props) => getEachYearAreaStyle(props)}
|
|
5350
|
+
`;
|
|
5351
|
+
var EachYearDate = styled6__default.default.div`
|
|
5352
|
+
width: 48px;
|
|
5353
|
+
height: 48px;
|
|
5354
|
+
text-align: center;
|
|
5355
|
+
font-size: 14px;
|
|
5356
|
+
line-height: 48px;
|
|
5357
|
+
padding: 0;
|
|
5358
|
+
border-radius: 50%;
|
|
5359
|
+
cursor: pointer;
|
|
5360
|
+
position: absolute;
|
|
5361
|
+
z-index: 10;
|
|
5362
|
+
|
|
5363
|
+
${(props) => getEachDateStyle2(props)}
|
|
5364
|
+
`;
|
|
5365
|
+
var AnnualDatepicker = ({
|
|
5366
|
+
startYear = 2e3,
|
|
5367
|
+
endYear = 2100,
|
|
5368
|
+
currentYear,
|
|
5369
|
+
handleYearClick
|
|
5370
|
+
}) => {
|
|
5371
|
+
const [selectedYear, setSelectedYear] = React3.useState(currentYear || (/* @__PURE__ */ new Date()).getFullYear());
|
|
5372
|
+
const Years = Array.from({ length: endYear - startYear + 1 }).map((_, index) => startYear + index);
|
|
5373
|
+
const clickYear = (year) => {
|
|
5374
|
+
setSelectedYear(year);
|
|
5375
|
+
handleYearClick(year);
|
|
5376
|
+
};
|
|
5377
|
+
return /* @__PURE__ */ jsxRuntime.jsx(YearContainer, { "data-shoplflow": "AnnualDatepicker", children: /* @__PURE__ */ jsxRuntime.jsx(YearArea, { children: Years.map((year) => {
|
|
5378
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5379
|
+
EachYearArea,
|
|
5380
|
+
{
|
|
5381
|
+
isSelected: selectedYear === year,
|
|
5382
|
+
onClick: () => {
|
|
5383
|
+
clickYear(year);
|
|
5384
|
+
},
|
|
5385
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(EachYearDate, { isSelected: selectedYear === year, children: year })
|
|
5386
|
+
},
|
|
5387
|
+
year
|
|
5388
|
+
);
|
|
5389
|
+
}) }) });
|
|
5390
|
+
};
|
|
5391
|
+
exports.AnnualDatepicker = AnnualDatepicker;
|
|
5392
|
+
var getEachDateStyle3 = (props) => {
|
|
5393
|
+
const { inRange, isStart, isEnd, disabled } = props;
|
|
5394
|
+
if (isStart || isEnd) {
|
|
5395
|
+
return react$1.css`
|
|
5396
|
+
background-color: ${exports.colorTokens.primary300};
|
|
5397
|
+
color: ${exports.colorTokens.neutral0};
|
|
5398
|
+
`;
|
|
5399
|
+
}
|
|
5400
|
+
if (inRange) {
|
|
5401
|
+
return react$1.css`
|
|
5402
|
+
background-color: ${exports.colorTokens.primary100};
|
|
5403
|
+
color: ${exports.colorTokens.neutral700};
|
|
5404
|
+
`;
|
|
5405
|
+
}
|
|
5406
|
+
if (disabled) {
|
|
5407
|
+
return react$1.css`
|
|
5408
|
+
color: ${exports.colorTokens.neutral400};
|
|
5409
|
+
cursor: not-allowed;
|
|
5410
|
+
`;
|
|
5411
|
+
}
|
|
5412
|
+
return react$1.css`
|
|
5413
|
+
&:hover {
|
|
5414
|
+
background-color: ${exports.colorTokens.primary100};
|
|
5415
|
+
}
|
|
5416
|
+
`;
|
|
5417
|
+
};
|
|
5418
|
+
var getEachWeekAreaStyle = (props) => {
|
|
5419
|
+
const { inRange, isStart, isEnd, isReady, disabled } = props;
|
|
5420
|
+
if (isStart && isReady) {
|
|
5421
|
+
return react$1.css`
|
|
5422
|
+
&::after {
|
|
5423
|
+
content: '';
|
|
5424
|
+
position: absolute;
|
|
5425
|
+
right: 0;
|
|
5426
|
+
top: 0;
|
|
5427
|
+
bottom: 0;
|
|
5428
|
+
width: 24px;
|
|
5429
|
+
background: ${exports.colorTokens.primary100};
|
|
5430
|
+
}
|
|
5431
|
+
`;
|
|
5432
|
+
}
|
|
5433
|
+
if (isEnd && !isStart) {
|
|
5434
|
+
return react$1.css`
|
|
5435
|
+
&::after {
|
|
5436
|
+
content: '';
|
|
5437
|
+
position: absolute;
|
|
5438
|
+
left: 0;
|
|
5439
|
+
top: 0;
|
|
5440
|
+
bottom: 0;
|
|
5441
|
+
width: 24px;
|
|
5442
|
+
background: ${exports.colorTokens.primary100};
|
|
5443
|
+
}
|
|
5444
|
+
`;
|
|
5445
|
+
}
|
|
5446
|
+
if (inRange) {
|
|
5447
|
+
return react$1.css`
|
|
5448
|
+
background-color: ${exports.colorTokens.primary100};
|
|
5449
|
+
color: ${exports.colorTokens.neutral700};
|
|
5450
|
+
`;
|
|
5451
|
+
}
|
|
5452
|
+
if (disabled) {
|
|
5453
|
+
return react$1.css`
|
|
5454
|
+
cursor: not-allowed;
|
|
5455
|
+
`;
|
|
5456
|
+
}
|
|
5457
|
+
};
|
|
5458
|
+
var WeekContainer = styled6__default.default.div`
|
|
5459
|
+
display: flex;
|
|
5460
|
+
flex-direction: column;
|
|
5461
|
+
width: 400px;
|
|
5462
|
+
max-width: 400px;
|
|
5463
|
+
gap: 16px;
|
|
5464
|
+
padding: 16px 24px 24px;
|
|
5465
|
+
`;
|
|
5466
|
+
var WeekArea = styled6__default.default.div`
|
|
5467
|
+
width: 100%;
|
|
5468
|
+
display: grid;
|
|
5469
|
+
grid-template-columns: repeat(7, 1fr);
|
|
5470
|
+
grid-row-gap: 8px;
|
|
5471
|
+
`;
|
|
5472
|
+
var EachWeekArea = styled6__default.default.div`
|
|
5473
|
+
width: 100%;
|
|
5474
|
+
height: 48px;
|
|
5475
|
+
display: flex;
|
|
5476
|
+
justify-content: center;
|
|
5477
|
+
align-items: center;
|
|
5478
|
+
position: relative;
|
|
5479
|
+
|
|
5480
|
+
${(props) => getEachWeekAreaStyle(props)}
|
|
5481
|
+
`;
|
|
5482
|
+
var EachWeekDate = styled6__default.default.div`
|
|
5483
|
+
width: 48px;
|
|
5484
|
+
height: 48px;
|
|
5485
|
+
text-align: center;
|
|
5486
|
+
font-size: 14px;
|
|
5487
|
+
line-height: 48px;
|
|
5488
|
+
padding: 0;
|
|
5489
|
+
border-radius: 50%;
|
|
5490
|
+
cursor: pointer;
|
|
5491
|
+
position: absolute;
|
|
5492
|
+
z-index: 10;
|
|
5493
|
+
|
|
5494
|
+
${(props) => getEachDateStyle3(props)}
|
|
5495
|
+
`;
|
|
5496
|
+
function getWeeksInYear(year) {
|
|
5497
|
+
return dateFns.getISOWeeksInYear(new Date(year, 5, 5));
|
|
5498
|
+
}
|
|
5499
|
+
var getStartOfISOWeek = (week, year) => {
|
|
5500
|
+
const januaryFourth = new Date(year, 0, 4);
|
|
5501
|
+
const firstWeekStart = dateFns.startOfISOWeek(januaryFourth);
|
|
5502
|
+
const startOfWeek = dateFns.addWeeks(firstWeekStart, week - 1);
|
|
5503
|
+
return startOfWeek;
|
|
5504
|
+
};
|
|
5505
|
+
var getEndOfISOWeek = (week, year) => {
|
|
5506
|
+
const januaryFourth = new Date(year, 0, 4);
|
|
5507
|
+
const firstWeekStart = dateFns.startOfISOWeek(januaryFourth);
|
|
5508
|
+
const startOfWeek = dateFns.addWeeks(firstWeekStart, week - 1);
|
|
5509
|
+
const endOfWeek = dateFns.endOfISOWeek(startOfWeek);
|
|
5510
|
+
return endOfWeek;
|
|
5511
|
+
};
|
|
5512
|
+
var WeekDatepicker = ({
|
|
5513
|
+
handleWeekClick,
|
|
5514
|
+
initStartDate,
|
|
5515
|
+
initEndDate,
|
|
5516
|
+
minDate,
|
|
5517
|
+
maxDate,
|
|
5518
|
+
onlySingleWeek
|
|
5519
|
+
}) => {
|
|
5520
|
+
const year = (initStartDate == null ? void 0 : initStartDate.getFullYear()) || (/* @__PURE__ */ new Date()).getFullYear();
|
|
5521
|
+
const [currentDate, setCurrentDate] = React3.useState(new Date(year, 5, 5));
|
|
5522
|
+
const [selectedStartWeekAndYear, setSelectedStartWeekAndYear] = React3.useState(
|
|
5523
|
+
initStartDate ? [dateFns.getISOWeek(initStartDate || /* @__PURE__ */ new Date()), dateFns.getISOWeekYear(initStartDate || /* @__PURE__ */ new Date())] : null
|
|
5524
|
+
);
|
|
5525
|
+
const [selectedEndWeekAndYear, setSelectedEndWeekAndYear] = React3.useState(
|
|
5526
|
+
initEndDate ? [dateFns.getISOWeek(initEndDate || /* @__PURE__ */ new Date()), dateFns.getISOWeekYear(initEndDate || /* @__PURE__ */ new Date())] : null
|
|
5527
|
+
);
|
|
5528
|
+
const selectedYear = currentDate.getFullYear();
|
|
5529
|
+
const Years = React3.useMemo(() => {
|
|
5530
|
+
return Array.from({ length: getWeeksInYear(selectedYear) }).map((_, index) => {
|
|
5531
|
+
return String(index + 1).padStart(2, "0");
|
|
5532
|
+
});
|
|
5533
|
+
}, [selectedYear]);
|
|
5534
|
+
const clickWeek = (week, year2) => {
|
|
5535
|
+
if (onlySingleWeek || !selectedStartWeekAndYear || selectedStartWeekAndYear && selectedEndWeekAndYear) {
|
|
5536
|
+
setSelectedStartWeekAndYear([week, year2]);
|
|
5537
|
+
setSelectedEndWeekAndYear(null);
|
|
5538
|
+
handleWeekClick({
|
|
5539
|
+
startYear: year2,
|
|
5540
|
+
startWeek: week,
|
|
5541
|
+
startDate: getStartOfISOWeek(week, year2),
|
|
5542
|
+
endYear: year2,
|
|
5543
|
+
endWeek: week,
|
|
5544
|
+
endDate: getEndOfISOWeek(week, year2),
|
|
5545
|
+
selectedWeeksRange: 1
|
|
5546
|
+
});
|
|
5547
|
+
return;
|
|
5548
|
+
}
|
|
5549
|
+
if (selectedStartWeekAndYear && !selectedEndWeekAndYear) {
|
|
5550
|
+
const [selectedWeek, selectedYear2] = selectedStartWeekAndYear;
|
|
5551
|
+
if (selectedYear2 > year2 || selectedYear2 === year2 && selectedWeek > week) {
|
|
5552
|
+
const startDate2 = getStartOfISOWeek(week, year2);
|
|
5553
|
+
const endDate2 = getEndOfISOWeek(selectedWeek, selectedYear2);
|
|
5554
|
+
setSelectedStartWeekAndYear([week, year2]);
|
|
5555
|
+
setSelectedEndWeekAndYear([selectedWeek, selectedYear2]);
|
|
5556
|
+
handleWeekClick({
|
|
5557
|
+
startYear: year2,
|
|
5558
|
+
startWeek: week,
|
|
5559
|
+
startDate: startDate2,
|
|
5560
|
+
endYear: selectedYear2,
|
|
5561
|
+
endWeek: selectedWeek,
|
|
5562
|
+
endDate: endDate2,
|
|
5563
|
+
// 현재 주까지 포함
|
|
5564
|
+
selectedWeeksRange: dateFns.differenceInCalendarISOWeeks(endDate2, startDate2) + 1
|
|
5565
|
+
});
|
|
5566
|
+
return;
|
|
5567
|
+
}
|
|
5568
|
+
if (selectedWeek !== week || selectedYear2 !== year2) {
|
|
5569
|
+
setSelectedEndWeekAndYear([week, year2]);
|
|
5570
|
+
}
|
|
5571
|
+
const startDate = getStartOfISOWeek(selectedWeek, selectedYear2);
|
|
5572
|
+
const endDate = getEndOfISOWeek(week, year2);
|
|
5573
|
+
handleWeekClick({
|
|
5574
|
+
startYear: selectedYear2,
|
|
5575
|
+
startWeek: selectedWeek,
|
|
5576
|
+
startDate,
|
|
5577
|
+
endYear: year2,
|
|
5578
|
+
endWeek: week,
|
|
5579
|
+
endDate,
|
|
5580
|
+
// 현재 주까지 포함
|
|
5581
|
+
selectedWeeksRange: dateFns.differenceInCalendarISOWeeks(endDate, startDate) + 1
|
|
5582
|
+
});
|
|
5583
|
+
}
|
|
5584
|
+
};
|
|
5585
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(WeekContainer, { children: [
|
|
5586
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5587
|
+
YearStepper_default,
|
|
5588
|
+
{
|
|
5589
|
+
date: currentDate,
|
|
5590
|
+
decreaseYear: () => {
|
|
5591
|
+
setCurrentDate(new Date(currentDate.getFullYear() - 1, currentDate.getMonth(), currentDate.getDate()));
|
|
5592
|
+
},
|
|
5593
|
+
minDate,
|
|
5594
|
+
maxDate,
|
|
5595
|
+
prevYearButtonDisabled: minDate ? minDate.getFullYear() === currentDate.getFullYear() : false,
|
|
5596
|
+
nextYearButtonDisabled: maxDate ? maxDate.getFullYear() === currentDate.getFullYear() : false,
|
|
5597
|
+
increaseYear: () => {
|
|
5598
|
+
setCurrentDate(new Date(currentDate.getFullYear() + 1, currentDate.getMonth(), currentDate.getDate()));
|
|
5599
|
+
},
|
|
5600
|
+
changeYear: (year2) => {
|
|
5601
|
+
setCurrentDate(new Date(year2, currentDate.getMonth(), currentDate.getDate()));
|
|
5602
|
+
}
|
|
5603
|
+
}
|
|
5604
|
+
),
|
|
5605
|
+
/* @__PURE__ */ jsxRuntime.jsx(WeekArea, { children: Years.map((each, index) => {
|
|
5606
|
+
const currentYear = currentDate.getFullYear();
|
|
5607
|
+
const currentWeek = Number(each);
|
|
5608
|
+
const isStart = currentYear === (selectedStartWeekAndYear == null ? void 0 : selectedStartWeekAndYear[1]) && currentWeek === (selectedStartWeekAndYear == null ? void 0 : selectedStartWeekAndYear[0]);
|
|
5609
|
+
const isEnd = (selectedEndWeekAndYear == null ? void 0 : selectedEndWeekAndYear[1]) === currentYear && (selectedEndWeekAndYear == null ? void 0 : selectedEndWeekAndYear[0]) === currentWeek;
|
|
5610
|
+
const isReady = isStart && Boolean(selectedEndWeekAndYear);
|
|
5611
|
+
let inRange = false;
|
|
5612
|
+
let disabled = false;
|
|
5613
|
+
if (minDate) {
|
|
5614
|
+
const minWeek = dateFns.getISOWeek(minDate);
|
|
5615
|
+
const minYear = dateFns.getISOWeekYear(minDate);
|
|
5616
|
+
if (currentYear < minYear) {
|
|
5617
|
+
disabled = true;
|
|
5618
|
+
}
|
|
5619
|
+
if (currentYear === minYear) {
|
|
5620
|
+
if (currentWeek <= minWeek) {
|
|
5621
|
+
disabled = true;
|
|
5622
|
+
}
|
|
5623
|
+
}
|
|
5624
|
+
}
|
|
5625
|
+
if (maxDate) {
|
|
5626
|
+
const maxWeek = dateFns.getISOWeek(maxDate);
|
|
5627
|
+
const maxYear = dateFns.getISOWeekYear(maxDate);
|
|
5628
|
+
if (currentYear > maxYear) {
|
|
5629
|
+
disabled = true;
|
|
5630
|
+
}
|
|
5631
|
+
if (currentYear === maxYear) {
|
|
5632
|
+
if (currentWeek >= maxWeek) {
|
|
5633
|
+
disabled = true;
|
|
5634
|
+
}
|
|
5635
|
+
}
|
|
5636
|
+
}
|
|
5637
|
+
if (selectedStartWeekAndYear && selectedEndWeekAndYear) {
|
|
5638
|
+
const [startWeek, startYear] = selectedStartWeekAndYear;
|
|
5639
|
+
const [endWeek, endYear] = selectedEndWeekAndYear;
|
|
5640
|
+
if (currentYear > startYear && currentYear < endYear) {
|
|
5641
|
+
inRange = true;
|
|
5642
|
+
}
|
|
5643
|
+
if (currentYear === startYear && currentYear === endYear) {
|
|
5644
|
+
if (currentWeek >= startWeek && currentWeek <= endWeek) {
|
|
5645
|
+
inRange = true;
|
|
5646
|
+
}
|
|
5647
|
+
}
|
|
5648
|
+
if (currentYear === startYear && currentYear !== endYear) {
|
|
5649
|
+
if (currentWeek >= startWeek) {
|
|
5650
|
+
inRange = true;
|
|
5651
|
+
}
|
|
5652
|
+
}
|
|
5653
|
+
if (currentYear === endYear && currentYear !== startYear) {
|
|
5654
|
+
if (currentWeek <= endWeek) {
|
|
5655
|
+
inRange = true;
|
|
5656
|
+
}
|
|
5657
|
+
}
|
|
5658
|
+
}
|
|
5659
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5660
|
+
EachWeekArea,
|
|
5661
|
+
{
|
|
5662
|
+
inRange,
|
|
5663
|
+
isStart,
|
|
5664
|
+
isReady,
|
|
5665
|
+
isEnd,
|
|
5666
|
+
disabled,
|
|
5667
|
+
onClick: () => {
|
|
5668
|
+
if (disabled) {
|
|
5669
|
+
return;
|
|
5670
|
+
}
|
|
5671
|
+
clickWeek(Number(each), currentDate.getFullYear());
|
|
5672
|
+
},
|
|
5673
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(EachWeekDate, { inRange, isStart, isEnd, disabled, children: [
|
|
5674
|
+
"W",
|
|
5675
|
+
each
|
|
5676
|
+
] })
|
|
5677
|
+
},
|
|
5678
|
+
index
|
|
5679
|
+
);
|
|
5680
|
+
}) })
|
|
5681
|
+
] });
|
|
5682
|
+
};
|
|
5683
|
+
exports.WeekDatepicker = WeekDatepicker;
|
|
4192
5684
|
var SpaceMarginWrapper = styled6__default.default(framerMotion.motion.div)`
|
|
4193
5685
|
position: relative;
|
|
4194
5686
|
display: flex;
|