@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.
@@ -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-selected {
91
- background-color: #f8f8f8;
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.start-date {
95
- background-color: #f8f8f8;
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: #f8f8f8;
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(56);
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
- const year = getYearFromMonth(month);
201
- title = title ?? `${getMonthNameFromMonth(month)} ${year}`;
202
- let firstDay;
208
+ let T0;
203
209
  let t1;
204
210
  let t2;
205
- let totalDays;
206
- if ($[0] !== month) {
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
- t2 = 7;
212
- t1 = lastDate.getDay();
213
- $[0] = month;
214
- $[1] = firstDay;
215
- $[2] = t1;
216
- $[3] = t2;
217
- $[4] = totalDays;
218
- } else {
219
- firstDay = $[1];
220
- t1 = $[2];
221
- t2 = $[3];
222
- totalDays = $[4];
223
- }
224
- const spacesAfterLastDay = t2 - t1 % 7;
225
- const daySpaces = totalDays + firstDay + spacesAfterLastDay;
226
- let t3;
227
- if ($[5] !== dateEnd || $[6] !== dateEndPreview || $[7] !== dateStart || $[8] !== month || $[9] !== totalDays) {
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
- if (date == null || Number.isNaN(date.getTime())) {
235
- return acc;
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
- const dateMonth = getMonthFromDate(date);
238
- if (dateMonth < month) {
239
- acc[index] = -1;
240
- } else {
241
- if (dateMonth > month) {
242
- acc[index] = totalDays + 1;
243
- } else {
244
- acc[index] = date.getDate();
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
- if (index === 1) {
248
- const startDay = acc[index - 1];
249
- const endDay = acc[index];
250
- if (startDay != null && endDay != null && startDay > endDay) {
251
- acc[index - 1] = endDay;
252
- acc[index] = startDay;
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
- $[11] = month;
258
- $[12] = totalDays;
259
- $[13] = t42;
281
+ $[19] = isRange;
282
+ $[20] = onChangeEndPreview;
283
+ $[21] = t82;
260
284
  } else {
261
- t42 = $[13];
285
+ t82 = $[21];
262
286
  }
263
- t3 = [dateStart, dateEnd, dateEndPreview].reduce(t42, [null, null, null]);
264
- $[5] = dateEnd;
265
- $[6] = dateEndPreview;
266
- $[7] = dateStart;
267
- $[8] = month;
268
- $[9] = totalDays;
269
- $[10] = t3;
270
- } else {
271
- t3 = $[10];
272
- }
273
- const [dateRangeStartDay, dateRangeEndDay, dateRangeEndPreviewDay] = t3;
274
- let t4;
275
- if ($[14] !== onChange) {
276
- t4 = (event) => {
277
- const {
278
- date: date_0
279
- } = event.currentTarget.dataset;
280
- if (date_0 && onChange) {
281
- onChange(date_0);
282
- }
283
- };
284
- $[14] = onChange;
285
- $[15] = t4;
286
- } else {
287
- t4 = $[15];
288
- }
289
- const handleClickDay = t4;
290
- let t5;
291
- if ($[16] !== isRange || $[17] !== onChangeEndPreview) {
292
- t5 = (event_0) => {
293
- if (isRange && onChangeEndPreview) {
294
- const {
295
- date: date_1
296
- } = event_0.currentTarget.dataset;
297
- if (date_1) {
298
- onChangeEndPreview(date_1);
299
- }
300
- }
301
- };
302
- $[16] = isRange;
303
- $[17] = onChangeEndPreview;
304
- $[18] = t5;
305
- } else {
306
- t5 = $[18];
307
- }
308
- const handleMouseEnterDay = t5;
309
- let t6;
310
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
311
- t6 = /* @__PURE__ */ jsx(Style, { href: "@acusti/date-picker/MonthCalendar", children: STYLES$1 });
312
- $[19] = t6;
313
- } else {
314
- t6 = $[19];
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 ($[20] !== className) {
318
- t7 = clsx(ROOT_CLASS_NAME$1, className);
319
- $[20] = className;
320
- $[21] = t7;
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 = $[21];
418
+ t7 = $[37];
323
419
  }
324
420
  let t8;
325
- if ($[22] !== title) {
326
- t8 = /* @__PURE__ */ jsx("div", { className: `${ROOT_CLASS_NAME$1}-month-title`, children: /* @__PURE__ */ jsx("h3", { className: `${ROOT_CLASS_NAME$1}-month-title-text`, children: title }) });
327
- $[22] = title;
328
- $[23] = t8;
329
- } else {
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
- $[30] = t15;
386
- } else {
387
- t15 = $[30];
388
- }
389
- const t16 = Math.floor(daySpaces / 7);
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
- t17 = $[40];
433
+ t8 = $[42];
433
434
  }
434
- let t18;
435
- if ($[50] !== t17) {
436
- t18 = /* @__PURE__ */ jsx("div", { className: `${ROOT_CLASS_NAME$1}-month-days`, children: t17 });
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
- /* @__PURE__ */ jsxs("div", { className: t7, children: [
447
- t8,
448
- t15,
449
- t18
450
- ] })
439
+ t8
451
440
  ] });
452
- $[52] = t18;
453
- $[53] = t7;
454
- $[54] = t8;
455
- $[55] = t19;
441
+ $[43] = T0;
442
+ $[44] = t6;
443
+ $[45] = t8;
444
+ $[46] = t9;
456
445
  } else {
457
- t19 = $[55];
446
+ t9 = $[46];
458
447
  }
459
- return t19;
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 = _dateEnd != null && typeof _dateEnd !== "string" ? new Date(_dateEnd).toISOString() : _dateEnd;
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 = _dateStart != null && typeof _dateStart !== "string" ? new Date(_dateStart).toISOString() : _dateStart;
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 ?? null);
559
- const [dateStart, setDateStart] = useState(dateStartFromProps ?? null);
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 [dateEndPreview, setDateEndPreview] = useState(null);
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("div", { className: t14, onClick: handleClickLeftArrow });
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("div", { className: t17, onClick: handleClickRightArrow });
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;