@acusti/date-picker 0.12.0 → 0.14.0
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/README.md +625 -27
- package/dist/DatePicker.d.ts +2 -2
- package/dist/MonthCalendar.d.ts +1 -1
- package/dist/index.js +249 -253
- package/dist/index.js.map +1 -1
- package/dist/styles/date-picker.d.ts +1 -1
- package/dist/styles/month-calendar.d.ts +1 -1
- package/package.json +11 -11
package/dist/MonthCalendar.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export type Props = {
|
|
|
9
9
|
onChangeEndPreview?: (date: string) => void;
|
|
10
10
|
title?: string;
|
|
11
11
|
};
|
|
12
|
-
export default function MonthCalendar({ className, dateEnd, dateEndPreview, dateStart, isRange, month, onChange, onChangeEndPreview, title, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default function MonthCalendar({ className, dateEnd, dateEndPreview, dateStart, isRange, month: _month, onChange, onChangeEndPreview, title, }: Props): import("react/jsx-runtime").JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -87,12 +87,16 @@ h3.${ROOT_CLASS_NAME$1}-month-title-text {
|
|
|
87
87
|
cursor: auto;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
.${ROOT_CLASS_NAME$1}-month-day-item.is-
|
|
91
|
-
|
|
90
|
+
.${ROOT_CLASS_NAME$1}-month-day-item.is-today span.month-day-item-text {
|
|
91
|
+
color: #eb4e3d;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
.${ROOT_CLASS_NAME$1}-month-day-item.
|
|
95
|
-
background-color: #
|
|
94
|
+
.${ROOT_CLASS_NAME$1}.is-range .${ROOT_CLASS_NAME$1}-month-day-item.is-selected {
|
|
95
|
+
background-color: #f6f6f6;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.${ROOT_CLASS_NAME$1}.is-range .${ROOT_CLASS_NAME$1}-month-day-item.start-date {
|
|
99
|
+
background-color: #f6f6f6;
|
|
96
100
|
border-top-left-radius: 50%;
|
|
97
101
|
border-bottom-left-radius: 50%;
|
|
98
102
|
}
|
|
@@ -102,12 +106,13 @@ h3.${ROOT_CLASS_NAME$1}-month-title-text {
|
|
|
102
106
|
opacity: 1;
|
|
103
107
|
visibility: visible;
|
|
104
108
|
}
|
|
109
|
+
|
|
105
110
|
.${ROOT_CLASS_NAME$1}-month-day-item.start-date span.month-day-item-text {
|
|
106
111
|
color: #fff;
|
|
107
112
|
}
|
|
108
113
|
|
|
109
|
-
.${ROOT_CLASS_NAME$1}-month-day-item.end-date {
|
|
110
|
-
background-color: #
|
|
114
|
+
.${ROOT_CLASS_NAME$1}.is-range .${ROOT_CLASS_NAME$1}-month-day-item.end-date {
|
|
115
|
+
background-color: #f6f6f6;
|
|
111
116
|
border-top-right-radius: 50%;
|
|
112
117
|
border-bottom-right-radius: 50%;
|
|
113
118
|
}
|
|
@@ -117,11 +122,14 @@ h3.${ROOT_CLASS_NAME$1}-month-title-text {
|
|
|
117
122
|
opacity: 1;
|
|
118
123
|
visibility: visible;
|
|
119
124
|
}
|
|
125
|
+
|
|
120
126
|
.${ROOT_CLASS_NAME$1}-month-day-item.end-date span.month-day-item-text {
|
|
121
127
|
color: #fff;
|
|
122
128
|
}
|
|
123
129
|
|
|
124
|
-
.${ROOT_CLASS_NAME$1}-month-day-item:hover:after
|
|
130
|
+
.${ROOT_CLASS_NAME$1}-month-day-item:hover:after,
|
|
131
|
+
.${ROOT_CLASS_NAME$1}-month-day-item.is-today:hover:after {
|
|
132
|
+
border-color: #000;
|
|
125
133
|
opacity: 1;
|
|
126
134
|
visibility: visible;
|
|
127
135
|
}
|
|
@@ -185,278 +193,259 @@ const getLastDateFromMonth = (month, asUTC) => {
|
|
|
185
193
|
};
|
|
186
194
|
const DAYS = Array(7).fill(null);
|
|
187
195
|
function MonthCalendar(t0) {
|
|
188
|
-
const $ = c(
|
|
196
|
+
const $ = c(47);
|
|
189
197
|
let {
|
|
190
198
|
className,
|
|
191
199
|
dateEnd,
|
|
192
200
|
dateEndPreview,
|
|
193
201
|
dateStart,
|
|
194
202
|
isRange,
|
|
195
|
-
month,
|
|
203
|
+
month: _month,
|
|
196
204
|
onChange,
|
|
197
205
|
onChangeEndPreview,
|
|
198
206
|
title
|
|
199
207
|
} = t0;
|
|
200
|
-
|
|
201
|
-
title = title ?? `${getMonthNameFromMonth(month)} ${year}`;
|
|
202
|
-
let firstDay;
|
|
208
|
+
let T0;
|
|
203
209
|
let t1;
|
|
204
210
|
let t2;
|
|
205
|
-
let
|
|
206
|
-
|
|
211
|
+
let t3;
|
|
212
|
+
let t4;
|
|
213
|
+
let t5;
|
|
214
|
+
let t6;
|
|
215
|
+
if ($[0] !== _month || $[1] !== className || $[2] !== dateEnd || $[3] !== dateEndPreview || $[4] !== dateStart || $[5] !== isRange || $[6] !== onChange || $[7] !== onChangeEndPreview || $[8] !== title) {
|
|
216
|
+
const today = /* @__PURE__ */ new Date();
|
|
217
|
+
const month = Number.isFinite(_month) ? Math.max(Number.MIN_SAFE_INTEGER, Math.min(Number.MAX_SAFE_INTEGER, _month)) : getMonthFromDate(today);
|
|
218
|
+
const year = getYearFromMonth(month);
|
|
219
|
+
title = title ?? `${getMonthNameFromMonth(month)} ${year}`;
|
|
207
220
|
const firstDate = getDateFromMonthAndDay(month, 1);
|
|
208
221
|
const lastDate = getLastDateFromMonth(month);
|
|
209
|
-
totalDays = lastDate.getDate();
|
|
210
|
-
firstDay = firstDate.getDay();
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
let t42;
|
|
229
|
-
if ($[11] !== month || $[12] !== totalDays) {
|
|
230
|
-
t42 = (acc, date, index) => {
|
|
231
|
-
if (date != null && !(date instanceof Date)) {
|
|
232
|
-
date = new Date(date);
|
|
222
|
+
const totalDays = lastDate.getDate();
|
|
223
|
+
const firstDay = firstDate.getDay();
|
|
224
|
+
const spacesAfterLastDay = 7 - lastDate.getDay() % 7;
|
|
225
|
+
const daySpaces = totalDays + firstDay + spacesAfterLastDay;
|
|
226
|
+
const [dateRangeStartDay, dateRangeEndDay, dateRangeEndPreviewDay] = [dateStart, dateEnd, dateEndPreview].reduce((acc, date, index) => {
|
|
227
|
+
if (date != null && !(date instanceof Date)) {
|
|
228
|
+
date = new Date(date);
|
|
229
|
+
}
|
|
230
|
+
if (date == null || Number.isNaN(date.getTime())) {
|
|
231
|
+
return acc;
|
|
232
|
+
}
|
|
233
|
+
const dateMonth = getMonthFromDate(date);
|
|
234
|
+
if (dateMonth < month) {
|
|
235
|
+
acc[index] = -1;
|
|
236
|
+
} else {
|
|
237
|
+
if (dateMonth > month) {
|
|
238
|
+
acc[index] = totalDays + 1;
|
|
239
|
+
} else {
|
|
240
|
+
acc[index] = date.getDate();
|
|
233
241
|
}
|
|
234
|
-
|
|
235
|
-
|
|
242
|
+
}
|
|
243
|
+
if (index === 1) {
|
|
244
|
+
const startDay = acc[index - 1];
|
|
245
|
+
const endDay = acc[index];
|
|
246
|
+
if (startDay != null && endDay != null && startDay > endDay) {
|
|
247
|
+
acc[index - 1] = endDay;
|
|
248
|
+
acc[index] = startDay;
|
|
236
249
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
250
|
+
}
|
|
251
|
+
return acc;
|
|
252
|
+
}, [null, null, null]);
|
|
253
|
+
let t72;
|
|
254
|
+
if ($[17] !== onChange) {
|
|
255
|
+
t72 = (event) => {
|
|
256
|
+
const {
|
|
257
|
+
date: date_0
|
|
258
|
+
} = event.currentTarget.dataset;
|
|
259
|
+
if (date_0 && onChange) {
|
|
260
|
+
onChange(date_0);
|
|
246
261
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
262
|
+
};
|
|
263
|
+
$[17] = onChange;
|
|
264
|
+
$[18] = t72;
|
|
265
|
+
} else {
|
|
266
|
+
t72 = $[18];
|
|
267
|
+
}
|
|
268
|
+
const handleClickDay = t72;
|
|
269
|
+
let t82;
|
|
270
|
+
if ($[19] !== isRange || $[20] !== onChangeEndPreview) {
|
|
271
|
+
t82 = (event_0) => {
|
|
272
|
+
if (isRange && onChangeEndPreview) {
|
|
273
|
+
const {
|
|
274
|
+
date: date_1
|
|
275
|
+
} = event_0.currentTarget.dataset;
|
|
276
|
+
if (date_1) {
|
|
277
|
+
onChangeEndPreview(date_1);
|
|
253
278
|
}
|
|
254
279
|
}
|
|
255
|
-
return acc;
|
|
256
280
|
};
|
|
257
|
-
$[
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
281
|
+
$[19] = isRange;
|
|
282
|
+
$[20] = onChangeEndPreview;
|
|
283
|
+
$[21] = t82;
|
|
260
284
|
} else {
|
|
261
|
-
|
|
285
|
+
t82 = $[21];
|
|
262
286
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
$[
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
$[
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
287
|
+
const handleMouseEnterDay = t82;
|
|
288
|
+
T0 = Fragment;
|
|
289
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
290
|
+
t6 = /* @__PURE__ */ jsx(Style, { href: "@acusti/date-picker/MonthCalendar", children: STYLES$1 });
|
|
291
|
+
$[22] = t6;
|
|
292
|
+
} else {
|
|
293
|
+
t6 = $[22];
|
|
294
|
+
}
|
|
295
|
+
if ($[23] !== className || $[24] !== isRange) {
|
|
296
|
+
t3 = clsx(ROOT_CLASS_NAME$1, className, {
|
|
297
|
+
"is-range": isRange
|
|
298
|
+
});
|
|
299
|
+
$[23] = className;
|
|
300
|
+
$[24] = isRange;
|
|
301
|
+
$[25] = t3;
|
|
302
|
+
} else {
|
|
303
|
+
t3 = $[25];
|
|
304
|
+
}
|
|
305
|
+
if ($[26] !== title) {
|
|
306
|
+
t4 = /* @__PURE__ */ jsx("div", { className: `${ROOT_CLASS_NAME$1}-month-title`, children: /* @__PURE__ */ jsx("h3", { className: `${ROOT_CLASS_NAME$1}-month-title-text`, children: title }) });
|
|
307
|
+
$[26] = title;
|
|
308
|
+
$[27] = t4;
|
|
309
|
+
} else {
|
|
310
|
+
t4 = $[27];
|
|
311
|
+
}
|
|
312
|
+
let t92;
|
|
313
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
314
|
+
t92 = /* @__PURE__ */ jsx("div", { className: "week-day-item", children: /* @__PURE__ */ jsx("span", { className: "week-day-item-text", children: "Su" }) });
|
|
315
|
+
$[28] = t92;
|
|
316
|
+
} else {
|
|
317
|
+
t92 = $[28];
|
|
318
|
+
}
|
|
319
|
+
let t10;
|
|
320
|
+
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
321
|
+
t10 = /* @__PURE__ */ jsx("div", { className: "week-day-item", children: /* @__PURE__ */ jsx("span", { className: "week-day-item-text", children: "Mo" }) });
|
|
322
|
+
$[29] = t10;
|
|
323
|
+
} else {
|
|
324
|
+
t10 = $[29];
|
|
325
|
+
}
|
|
326
|
+
let t11;
|
|
327
|
+
if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
|
|
328
|
+
t11 = /* @__PURE__ */ jsx("div", { className: "week-day-item", children: /* @__PURE__ */ jsx("span", { className: "week-day-item-text", children: "Tu" }) });
|
|
329
|
+
$[30] = t11;
|
|
330
|
+
} else {
|
|
331
|
+
t11 = $[30];
|
|
332
|
+
}
|
|
333
|
+
let t12;
|
|
334
|
+
if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
|
|
335
|
+
t12 = /* @__PURE__ */ jsx("div", { className: "week-day-item", children: /* @__PURE__ */ jsx("span", { className: "week-day-item-text", children: "We" }) });
|
|
336
|
+
$[31] = t12;
|
|
337
|
+
} else {
|
|
338
|
+
t12 = $[31];
|
|
339
|
+
}
|
|
340
|
+
let t13;
|
|
341
|
+
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
|
342
|
+
t13 = /* @__PURE__ */ jsx("div", { className: "week-day-item", children: /* @__PURE__ */ jsx("span", { className: "week-day-item-text", children: "Th" }) });
|
|
343
|
+
$[32] = t13;
|
|
344
|
+
} else {
|
|
345
|
+
t13 = $[32];
|
|
346
|
+
}
|
|
347
|
+
let t14;
|
|
348
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
349
|
+
t14 = /* @__PURE__ */ jsx("div", { className: "week-day-item", children: /* @__PURE__ */ jsx("span", { className: "week-day-item-text", children: "Fr" }) });
|
|
350
|
+
$[33] = t14;
|
|
351
|
+
} else {
|
|
352
|
+
t14 = $[33];
|
|
353
|
+
}
|
|
354
|
+
if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
|
|
355
|
+
t5 = /* @__PURE__ */ jsxs("div", { className: `${ROOT_CLASS_NAME$1}-month-week`, children: [
|
|
356
|
+
t92,
|
|
357
|
+
t10,
|
|
358
|
+
t11,
|
|
359
|
+
t12,
|
|
360
|
+
t13,
|
|
361
|
+
t14,
|
|
362
|
+
/* @__PURE__ */ jsx("div", { className: "week-day-item", children: /* @__PURE__ */ jsx("span", { className: "week-day-item-text", children: "Sa" }) })
|
|
363
|
+
] });
|
|
364
|
+
$[34] = t5;
|
|
365
|
+
} else {
|
|
366
|
+
t5 = $[34];
|
|
367
|
+
}
|
|
368
|
+
t1 = `${ROOT_CLASS_NAME$1}-month-days`;
|
|
369
|
+
t2 = Array(Math.floor(daySpaces / 7)).fill(null).map((_, weekIndex) => /* @__PURE__ */ jsx("div", { className: `${ROOT_CLASS_NAME$1}-month-row`, children: DAYS.map((__, dayIndex) => {
|
|
370
|
+
dayIndex = dayIndex + weekIndex * 7;
|
|
371
|
+
const dayNumber = dayIndex - firstDay + 1;
|
|
372
|
+
const isEmpty = dayNumber < 1 || dayNumber > totalDays;
|
|
373
|
+
const date_2 = isEmpty ? null : getDateFromMonthAndDay(month, dayNumber);
|
|
374
|
+
const isAfterDateRangeStart = dateRangeStartDay != null && dayNumber > dateRangeStartDay;
|
|
375
|
+
const isBeforeDateRangeEnd = dateRangeEndDay == null && dateRangeEndPreviewDay != null && dayNumber < dateRangeEndPreviewDay || dateRangeEndDay != null && dayNumber < dateRangeEndDay;
|
|
376
|
+
return /* @__PURE__ */ jsx("button", { className: clsx(`${ROOT_CLASS_NAME$1}-month-day-item`, {
|
|
377
|
+
"end-date": !isEmpty && dayNumber === dateRangeEndDay,
|
|
378
|
+
"is-empty": isEmpty,
|
|
379
|
+
"is-selected": !isEmpty && isAfterDateRangeStart && isBeforeDateRangeEnd,
|
|
380
|
+
"is-today": !isEmpty && month === getMonthFromDate(today) && dayNumber === today.getDate(),
|
|
381
|
+
"start-date": !isEmpty && dayNumber === dateRangeStartDay
|
|
382
|
+
}), "data-date": date_2?.toISOString(), disabled: isEmpty, onClick: handleClickDay, onMouseEnter: handleMouseEnterDay, type: "button", children: isEmpty ? null : /* @__PURE__ */ jsx("span", { className: "month-day-item-text", children: dayNumber }) }, `MonthDayItem-${dayNumber}`);
|
|
383
|
+
}) }, `MonthRow-${weekIndex}`));
|
|
384
|
+
$[0] = _month;
|
|
385
|
+
$[1] = className;
|
|
386
|
+
$[2] = dateEnd;
|
|
387
|
+
$[3] = dateEndPreview;
|
|
388
|
+
$[4] = dateStart;
|
|
389
|
+
$[5] = isRange;
|
|
390
|
+
$[6] = onChange;
|
|
391
|
+
$[7] = onChangeEndPreview;
|
|
392
|
+
$[8] = title;
|
|
393
|
+
$[9] = T0;
|
|
394
|
+
$[10] = t1;
|
|
395
|
+
$[11] = t2;
|
|
396
|
+
$[12] = t3;
|
|
397
|
+
$[13] = t4;
|
|
398
|
+
$[14] = t5;
|
|
399
|
+
$[15] = t6;
|
|
400
|
+
$[16] = title;
|
|
401
|
+
} else {
|
|
402
|
+
T0 = $[9];
|
|
403
|
+
t1 = $[10];
|
|
404
|
+
t2 = $[11];
|
|
405
|
+
t3 = $[12];
|
|
406
|
+
t4 = $[13];
|
|
407
|
+
t5 = $[14];
|
|
408
|
+
t6 = $[15];
|
|
409
|
+
title = $[16];
|
|
315
410
|
}
|
|
316
411
|
let t7;
|
|
317
|
-
if ($[
|
|
318
|
-
t7 =
|
|
319
|
-
$[
|
|
320
|
-
$[
|
|
412
|
+
if ($[35] !== t1 || $[36] !== t2) {
|
|
413
|
+
t7 = /* @__PURE__ */ jsx("div", { className: t1, children: t2 });
|
|
414
|
+
$[35] = t1;
|
|
415
|
+
$[36] = t2;
|
|
416
|
+
$[37] = t7;
|
|
321
417
|
} else {
|
|
322
|
-
t7 = $[
|
|
418
|
+
t7 = $[37];
|
|
323
419
|
}
|
|
324
420
|
let t8;
|
|
325
|
-
if ($[
|
|
326
|
-
t8 = /* @__PURE__ */
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
t8 = $[23];
|
|
331
|
-
}
|
|
332
|
-
let t9;
|
|
333
|
-
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
334
|
-
t9 = /* @__PURE__ */ jsx("div", { className: "week-day-item", children: /* @__PURE__ */ jsx("span", { className: "week-day-item-text", children: "Su" }) });
|
|
335
|
-
$[24] = t9;
|
|
336
|
-
} else {
|
|
337
|
-
t9 = $[24];
|
|
338
|
-
}
|
|
339
|
-
let t10;
|
|
340
|
-
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
341
|
-
t10 = /* @__PURE__ */ jsx("div", { className: "week-day-item", children: /* @__PURE__ */ jsx("span", { className: "week-day-item-text", children: "Mo" }) });
|
|
342
|
-
$[25] = t10;
|
|
343
|
-
} else {
|
|
344
|
-
t10 = $[25];
|
|
345
|
-
}
|
|
346
|
-
let t11;
|
|
347
|
-
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
348
|
-
t11 = /* @__PURE__ */ jsx("div", { className: "week-day-item", children: /* @__PURE__ */ jsx("span", { className: "week-day-item-text", children: "Tu" }) });
|
|
349
|
-
$[26] = t11;
|
|
350
|
-
} else {
|
|
351
|
-
t11 = $[26];
|
|
352
|
-
}
|
|
353
|
-
let t12;
|
|
354
|
-
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
355
|
-
t12 = /* @__PURE__ */ jsx("div", { className: "week-day-item", children: /* @__PURE__ */ jsx("span", { className: "week-day-item-text", children: "We" }) });
|
|
356
|
-
$[27] = t12;
|
|
357
|
-
} else {
|
|
358
|
-
t12 = $[27];
|
|
359
|
-
}
|
|
360
|
-
let t13;
|
|
361
|
-
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
362
|
-
t13 = /* @__PURE__ */ jsx("div", { className: "week-day-item", children: /* @__PURE__ */ jsx("span", { className: "week-day-item-text", children: "Th" }) });
|
|
363
|
-
$[28] = t13;
|
|
364
|
-
} else {
|
|
365
|
-
t13 = $[28];
|
|
366
|
-
}
|
|
367
|
-
let t14;
|
|
368
|
-
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
369
|
-
t14 = /* @__PURE__ */ jsx("div", { className: "week-day-item", children: /* @__PURE__ */ jsx("span", { className: "week-day-item-text", children: "Fr" }) });
|
|
370
|
-
$[29] = t14;
|
|
371
|
-
} else {
|
|
372
|
-
t14 = $[29];
|
|
373
|
-
}
|
|
374
|
-
let t15;
|
|
375
|
-
if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
|
|
376
|
-
t15 = /* @__PURE__ */ jsxs("div", { className: `${ROOT_CLASS_NAME$1}-month-week`, children: [
|
|
377
|
-
t9,
|
|
378
|
-
t10,
|
|
379
|
-
t11,
|
|
380
|
-
t12,
|
|
381
|
-
t13,
|
|
382
|
-
t14,
|
|
383
|
-
/* @__PURE__ */ jsx("div", { className: "week-day-item", children: /* @__PURE__ */ jsx("span", { className: "week-day-item-text", children: "Sa" }) })
|
|
421
|
+
if ($[38] !== t3 || $[39] !== t4 || $[40] !== t5 || $[41] !== t7) {
|
|
422
|
+
t8 = /* @__PURE__ */ jsxs("div", { className: t3, children: [
|
|
423
|
+
t4,
|
|
424
|
+
t5,
|
|
425
|
+
t7
|
|
384
426
|
] });
|
|
385
|
-
$[
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
let t17;
|
|
391
|
-
if ($[31] !== dateRangeEndDay || $[32] !== dateRangeEndPreviewDay || $[33] !== dateRangeStartDay || $[34] !== firstDay || $[35] !== handleClickDay || $[36] !== handleMouseEnterDay || $[37] !== month || $[38] !== t16 || $[39] !== totalDays) {
|
|
392
|
-
let t182;
|
|
393
|
-
if ($[41] !== dateRangeEndDay || $[42] !== dateRangeEndPreviewDay || $[43] !== dateRangeStartDay || $[44] !== firstDay || $[45] !== handleClickDay || $[46] !== handleMouseEnterDay || $[47] !== month || $[48] !== totalDays) {
|
|
394
|
-
t182 = (_, weekIndex) => /* @__PURE__ */ jsx("div", { className: `${ROOT_CLASS_NAME$1}-month-row`, children: DAYS.map((__, dayIndex) => {
|
|
395
|
-
dayIndex = dayIndex + weekIndex * 7;
|
|
396
|
-
const dayNumber = dayIndex - firstDay + 1;
|
|
397
|
-
const isEmpty = dayNumber < 1 || dayNumber > totalDays;
|
|
398
|
-
const date_2 = isEmpty ? null : getDateFromMonthAndDay(month, dayNumber);
|
|
399
|
-
const isAfterDateRangeStart = dateRangeStartDay != null && dayNumber > dateRangeStartDay;
|
|
400
|
-
const isBeforeDateRangeEnd = dateRangeEndDay == null && dateRangeEndPreviewDay != null && dayNumber < dateRangeEndPreviewDay || dateRangeEndDay != null && dayNumber < dateRangeEndDay;
|
|
401
|
-
return /* @__PURE__ */ jsx("button", { className: clsx(`${ROOT_CLASS_NAME$1}-month-day-item`, {
|
|
402
|
-
"end-date": !isEmpty && dayNumber === dateRangeEndDay,
|
|
403
|
-
"is-empty": isEmpty,
|
|
404
|
-
"is-selected": !isEmpty && isAfterDateRangeStart && isBeforeDateRangeEnd,
|
|
405
|
-
"start-date": !isEmpty && dayNumber === dateRangeStartDay
|
|
406
|
-
}), "data-date": date_2 == null ? void 0 : date_2.toISOString(), disabled: isEmpty, onClick: handleClickDay, onMouseEnter: handleMouseEnterDay, type: "button", children: isEmpty ? null : /* @__PURE__ */ jsx("span", { className: "month-day-item-text", children: dayNumber }) }, `MonthDayItem-${dayNumber}`);
|
|
407
|
-
}) }, `MonthRow-${weekIndex}`);
|
|
408
|
-
$[41] = dateRangeEndDay;
|
|
409
|
-
$[42] = dateRangeEndPreviewDay;
|
|
410
|
-
$[43] = dateRangeStartDay;
|
|
411
|
-
$[44] = firstDay;
|
|
412
|
-
$[45] = handleClickDay;
|
|
413
|
-
$[46] = handleMouseEnterDay;
|
|
414
|
-
$[47] = month;
|
|
415
|
-
$[48] = totalDays;
|
|
416
|
-
$[49] = t182;
|
|
417
|
-
} else {
|
|
418
|
-
t182 = $[49];
|
|
419
|
-
}
|
|
420
|
-
t17 = Array(t16).fill(null).map(t182);
|
|
421
|
-
$[31] = dateRangeEndDay;
|
|
422
|
-
$[32] = dateRangeEndPreviewDay;
|
|
423
|
-
$[33] = dateRangeStartDay;
|
|
424
|
-
$[34] = firstDay;
|
|
425
|
-
$[35] = handleClickDay;
|
|
426
|
-
$[36] = handleMouseEnterDay;
|
|
427
|
-
$[37] = month;
|
|
428
|
-
$[38] = t16;
|
|
429
|
-
$[39] = totalDays;
|
|
430
|
-
$[40] = t17;
|
|
427
|
+
$[38] = t3;
|
|
428
|
+
$[39] = t4;
|
|
429
|
+
$[40] = t5;
|
|
430
|
+
$[41] = t7;
|
|
431
|
+
$[42] = t8;
|
|
431
432
|
} else {
|
|
432
|
-
|
|
433
|
+
t8 = $[42];
|
|
433
434
|
}
|
|
434
|
-
let
|
|
435
|
-
if ($[
|
|
436
|
-
|
|
437
|
-
$[50] = t17;
|
|
438
|
-
$[51] = t18;
|
|
439
|
-
} else {
|
|
440
|
-
t18 = $[51];
|
|
441
|
-
}
|
|
442
|
-
let t19;
|
|
443
|
-
if ($[52] !== t18 || $[53] !== t7 || $[54] !== t8) {
|
|
444
|
-
t19 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
435
|
+
let t9;
|
|
436
|
+
if ($[43] !== T0 || $[44] !== t6 || $[45] !== t8) {
|
|
437
|
+
t9 = /* @__PURE__ */ jsxs(T0, { children: [
|
|
445
438
|
t6,
|
|
446
|
-
|
|
447
|
-
t8,
|
|
448
|
-
t15,
|
|
449
|
-
t18
|
|
450
|
-
] })
|
|
439
|
+
t8
|
|
451
440
|
] });
|
|
452
|
-
$[
|
|
453
|
-
$[
|
|
454
|
-
$[
|
|
455
|
-
$[
|
|
441
|
+
$[43] = T0;
|
|
442
|
+
$[44] = t6;
|
|
443
|
+
$[45] = t8;
|
|
444
|
+
$[46] = t9;
|
|
456
445
|
} else {
|
|
457
|
-
|
|
446
|
+
t9 = $[46];
|
|
458
447
|
}
|
|
459
|
-
return
|
|
448
|
+
return t9;
|
|
460
449
|
}
|
|
461
450
|
const ROOT_CLASS_NAME = "uktdatepicker";
|
|
462
451
|
const STYLES = `
|
|
@@ -486,6 +475,8 @@ const STYLES = `
|
|
|
486
475
|
}
|
|
487
476
|
|
|
488
477
|
.${ROOT_CLASS_NAME}-range-arrow {
|
|
478
|
+
background-color: transparent;
|
|
479
|
+
border: 0;
|
|
489
480
|
width: 35px;
|
|
490
481
|
height: 35px;
|
|
491
482
|
text-align: center;
|
|
@@ -506,7 +497,6 @@ const STYLES = `
|
|
|
506
497
|
content: "‹";
|
|
507
498
|
font-size: 24px;
|
|
508
499
|
line-height: 35px;
|
|
509
|
-
font-weight: bold;
|
|
510
500
|
}
|
|
511
501
|
|
|
512
502
|
.${ROOT_CLASS_NAME}-range-arrow.right-arrow:after {
|
|
@@ -520,6 +510,10 @@ const STYLES = `
|
|
|
520
510
|
}
|
|
521
511
|
`;
|
|
522
512
|
const getAbbreviatedMonthTitle = (month) => `${getMonthAbbreviationFromMonth(month)} ${getYearFromMonth(month)}`;
|
|
513
|
+
const normalizeDate = (date) => {
|
|
514
|
+
if (date == null || date === "") return null;
|
|
515
|
+
return typeof date === "string" ? date : new Date(date).toISOString();
|
|
516
|
+
};
|
|
523
517
|
function DatePicker(t0) {
|
|
524
518
|
const $ = c(68);
|
|
525
519
|
let {
|
|
@@ -539,7 +533,7 @@ function DatePicker(t0) {
|
|
|
539
533
|
const monthLimitLast = isTwoUp && _monthLimitLast != null ? _monthLimitLast - 1 : _monthLimitLast;
|
|
540
534
|
let t1;
|
|
541
535
|
if ($[0] !== _dateEnd) {
|
|
542
|
-
t1 =
|
|
536
|
+
t1 = normalizeDate(_dateEnd);
|
|
543
537
|
$[0] = _dateEnd;
|
|
544
538
|
$[1] = t1;
|
|
545
539
|
} else {
|
|
@@ -548,15 +542,15 @@ function DatePicker(t0) {
|
|
|
548
542
|
const dateEndFromProps = t1;
|
|
549
543
|
let t2;
|
|
550
544
|
if ($[2] !== _dateStart) {
|
|
551
|
-
t2 =
|
|
545
|
+
t2 = normalizeDate(_dateStart);
|
|
552
546
|
$[2] = _dateStart;
|
|
553
547
|
$[3] = t2;
|
|
554
548
|
} else {
|
|
555
549
|
t2 = $[3];
|
|
556
550
|
}
|
|
557
551
|
const dateStartFromProps = t2;
|
|
558
|
-
const [dateEnd, setDateEnd] = useState(dateEndFromProps
|
|
559
|
-
const [dateStart, setDateStart] = useState(dateStartFromProps
|
|
552
|
+
const [dateEnd, setDateEnd] = useState(dateEndFromProps);
|
|
553
|
+
const [dateStart, setDateStart] = useState(dateStartFromProps);
|
|
560
554
|
const updatingDateEndRef = useRef(false);
|
|
561
555
|
let t3;
|
|
562
556
|
let t4;
|
|
@@ -610,8 +604,10 @@ function DatePicker(t0) {
|
|
|
610
604
|
initialMonth = initialMonth - 1;
|
|
611
605
|
}
|
|
612
606
|
}
|
|
613
|
-
const
|
|
607
|
+
const maxInitialMonth = (monthLimitLast == null ? Number.MAX_SAFE_INTEGER : monthLimitLast) + (isTwoUp ? -1 : 0);
|
|
608
|
+
initialMonth = Math.max(Math.min(initialMonth, maxInitialMonth), monthLimitFirst ?? Number.MIN_SAFE_INTEGER);
|
|
614
609
|
const [month, setMonth] = useState(initialMonth);
|
|
610
|
+
const [dateEndPreview, setDateEndPreview] = useState(null);
|
|
615
611
|
const delta = isTwoUp ? 2 : 1;
|
|
616
612
|
let t7;
|
|
617
613
|
if ($[12] !== delta || $[13] !== monthLimitFirst) {
|
|
@@ -722,7 +718,7 @@ function DatePicker(t0) {
|
|
|
722
718
|
}
|
|
723
719
|
let t15;
|
|
724
720
|
if ($[30] !== handleClickLeftArrow || $[31] !== t14) {
|
|
725
|
-
t15 = /* @__PURE__ */ jsx("
|
|
721
|
+
t15 = /* @__PURE__ */ jsx("button", { "aria-label": "Previous Month", className: t14, onClick: handleClickLeftArrow, type: "button" });
|
|
726
722
|
$[30] = handleClickLeftArrow;
|
|
727
723
|
$[31] = t14;
|
|
728
724
|
$[32] = t15;
|
|
@@ -742,7 +738,7 @@ function DatePicker(t0) {
|
|
|
742
738
|
}
|
|
743
739
|
let t18;
|
|
744
740
|
if ($[35] !== handleClickRightArrow || $[36] !== t17) {
|
|
745
|
-
t18 = /* @__PURE__ */ jsx("
|
|
741
|
+
t18 = /* @__PURE__ */ jsx("button", { "aria-label": "Next Month", className: t17, onClick: handleClickRightArrow, type: "button" });
|
|
746
742
|
$[35] = handleClickRightArrow;
|
|
747
743
|
$[36] = t17;
|
|
748
744
|
$[37] = t18;
|