@uxf/datepicker 13.0.3 → 14.1.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.
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.END_DATE = exports.START_DATE = void 0;
4
4
  exports.useDateRangePicker = useDateRangePicker;
5
+ const compiler_runtime_1 = require("react/compiler-runtime");
5
6
  const react_1 = require("react");
6
7
  const can_select_range_1 = require("../utils/can-select-range");
7
8
  const date_string_1 = require("../utils/date-string");
@@ -16,170 +17,240 @@ const is_start_date_1 = require("../utils/is-start-date");
16
17
  const use_date_picker_navigation_1 = require("./use-date-picker-navigation");
17
18
  exports.START_DATE = "startDate";
18
19
  exports.END_DATE = "endDate";
19
- function useDateRangePicker({ changeActiveMonthOnSelect = false, datesConfig = [], endDate, exactMinBookingDays = false, firstDayOfWeek = 0, focusedInput, initialVisibleMonth, isDateBlocked: isDateBlockedProps, maxBookingDate, minBookingDate, minBookingDays = 1, numberOfMonths = 2, onDatesChange, startDate, unavailableDates = [], }) {
20
- // --- Normalize all Date inputs to DateString at boundary ---
21
- const normalizedStartDate = startDate ? (0, date_string_1.toDateString)(startDate) : null;
20
+ function useDateRangePicker(t0) {
21
+ const $ = (0, compiler_runtime_1.c)(50);
22
+ const { changeActiveMonthOnSelect: t1, datesConfig: t2, endDate, exactMinBookingDays: t3, firstDayOfWeek: t4, focusedInput, initialVisibleMonth, isDateBlocked: isDateBlockedProps, maxBookingDate, minBookingDate, minBookingDays: t5, numberOfMonths: t6, onDatesChange, startDate, unavailableDates: t7 } = t0;
23
+ const changeActiveMonthOnSelect = t1 === undefined ? false : t1;
24
+ const datesConfig = t2 === undefined ? [] : t2;
25
+ const exactMinBookingDays = t3 === undefined ? false : t3;
26
+ const firstDayOfWeek = t4 === undefined ? 0 : t4;
27
+ const minBookingDays = t5 === undefined ? 1 : t5;
28
+ const numberOfMonths = t6 === undefined ? 2 : t6;
29
+ const unavailableDates = t7 === undefined ? [] : t7;
30
+ let t8;
31
+ if ($[0] !== startDate) {
32
+ t8 = startDate ? (0, date_string_1.toDateString)(startDate) : null;
33
+ $[0] = startDate;
34
+ $[1] = t8;
35
+ }
36
+ else {
37
+ t8 = $[1];
38
+ }
39
+ const normalizedStartDate = t8;
22
40
  const normalizedEndDate = endDate ? (0, date_string_1.toDateString)(endDate) : null;
23
41
  const normalizedMinBookingDate = minBookingDate ? (0, date_string_1.toDateString)(minBookingDate) : undefined;
24
42
  const normalizedMaxBookingDate = maxBookingDate ? (0, date_string_1.toDateString)(maxBookingDate) : undefined;
25
- const disabledDatesFromConfig = datesConfig.filter((config) => config.isDisabled).flatMap((config) => config.dates);
26
- const allDisabledDates = [
27
- ...unavailableDates.map(date_string_1.toDateString),
28
- ...disabledDatesFromConfig.map(date_string_1.toDateString),
29
- ];
30
- const [activeMonths, setActiveMonths] = (0, react_1.useState)(() => startDate
31
- ? (0, get_initial_months_1.getInitialMonths)(numberOfMonths, startDate)
32
- : (0, get_initial_months_1.getInitialMonths)(numberOfMonths, initialVisibleMonth || null));
43
+ const disabledDatesFromConfig = datesConfig.filter(_temp).flatMap(_temp2);
44
+ const allDisabledDates = [...unavailableDates.map(date_string_1.toDateString), ...disabledDatesFromConfig.map(date_string_1.toDateString)];
45
+ let t9;
46
+ if ($[2] !== initialVisibleMonth || $[3] !== numberOfMonths || $[4] !== startDate) {
47
+ t9 = () => startDate ? (0, get_initial_months_1.getInitialMonths)(numberOfMonths, startDate) : (0, get_initial_months_1.getInitialMonths)(numberOfMonths, initialVisibleMonth || null);
48
+ $[2] = initialVisibleMonth;
49
+ $[3] = numberOfMonths;
50
+ $[4] = startDate;
51
+ $[5] = t9;
52
+ }
53
+ else {
54
+ t9 = $[5];
55
+ }
56
+ const [activeMonths, setActiveMonths] = (0, react_1.useState)(t9);
33
57
  const [hoveredDate, setHoveredDate] = (0, react_1.useState)(null);
34
58
  const [focusedDate, setFocusedDate] = (0, react_1.useState)(normalizedStartDate);
35
- // Consumer's isDateBlockedProps (Date → boolean) wrapped as DateString → boolean
36
- const disabledDatesByUser = isDateBlockedProps || allDisabledDates.length > 0
37
- ? (date) => {
38
- var _a;
39
- return ((0, is_in_unavailable_dates_1.isInUnavailableDates)(allDisabledDates, date) ||
40
- ((_a = isDateBlockedProps === null || isDateBlockedProps === void 0 ? void 0 : isDateBlockedProps((0, date_string_1.fromDateString)(date))) !== null && _a !== void 0 ? _a : false));
41
- }
42
- : null;
43
- const onDateFocus = (0, react_1.useCallback)((date) => {
44
- const dateStr = (0, date_string_1.toDateString)(date);
45
- setFocusedDate(dateStr);
46
- const focusedYYYYMM = (0, date_string_1.toDateString)(date).slice(0, 7);
47
- if (!focusedDate ||
48
- !activeMonths.some((m) => `${m.year}-${String(m.month + 1).padStart(2, "0")}` === focusedYYYYMM)) {
49
- setActiveMonths((0, get_initial_months_1.getInitialMonths)(numberOfMonths, date));
50
- }
51
- }, [activeMonths, focusedDate, numberOfMonths]);
52
- const _isDateSelected = (date) => {
53
- const dateStr = (0, date_string_1.toDateString)(date);
54
- return ((0, is_date_inside_range_1.isDateInsideRange)(dateStr, normalizedStartDate, normalizedEndDate) ||
55
- (0, is_first_or_last_selected_date_1.isFirstOrLastSelectedDate)(dateStr, normalizedStartDate, normalizedEndDate));
59
+ const disabledDatesByUser = isDateBlockedProps || allDisabledDates.length > 0 ? date => { var _a; return (0, is_in_unavailable_dates_1.isInUnavailableDates)(allDisabledDates, date) || ((_a = isDateBlockedProps === null || isDateBlockedProps === void 0 ? void 0 : isDateBlockedProps((0, date_string_1.fromDateString)(date))) !== null && _a !== void 0 ? _a : false); } : null;
60
+ let t10;
61
+ if ($[6] !== activeMonths || $[7] !== focusedDate || $[8] !== numberOfMonths) {
62
+ t10 = date_0 => {
63
+ const dateStr = (0, date_string_1.toDateString)(date_0);
64
+ setFocusedDate(dateStr);
65
+ const focusedYYYYMM = (0, date_string_1.toDateString)(date_0).slice(0, 7);
66
+ if (!focusedDate || !activeMonths.some(m => `${m.year}-${String(m.month + 1).padStart(2, "0")}` === focusedYYYYMM)) {
67
+ setActiveMonths((0, get_initial_months_1.getInitialMonths)(numberOfMonths, date_0));
68
+ }
69
+ };
70
+ $[6] = activeMonths;
71
+ $[7] = focusedDate;
72
+ $[8] = numberOfMonths;
73
+ $[9] = t10;
74
+ }
75
+ else {
76
+ t10 = $[9];
77
+ }
78
+ const onDateFocus = t10;
79
+ const _isDateSelected = date_1 => {
80
+ const dateStr_0 = (0, date_string_1.toDateString)(date_1);
81
+ return (0, is_date_inside_range_1.isDateInsideRange)(dateStr_0, normalizedStartDate, normalizedEndDate) || (0, is_first_or_last_selected_date_1.isFirstOrLastSelectedDate)(dateStr_0, normalizedStartDate, normalizedEndDate);
56
82
  };
57
- const _isStartDate = (date) => (0, is_start_date_1.isStartDate)((0, date_string_1.toDateString)(date), normalizedStartDate);
58
- const _isEndDate = (date) => (0, is_end_date_1.isEndDate)((0, date_string_1.toDateString)(date), normalizedEndDate);
59
- const _isDateInsideRange = (date) => (0, is_date_inside_range_1.isDateInsideRange)((0, date_string_1.toDateString)(date), normalizedStartDate, normalizedEndDate);
60
- const _isDateBlocked = (date) => (0, is_date_blocked_1.isDateBlocked)({
61
- date: (0, date_string_1.toDateString)(date),
83
+ let t11;
84
+ if ($[10] !== normalizedStartDate) {
85
+ t11 = date_2 => (0, is_start_date_1.isStartDate)((0, date_string_1.toDateString)(date_2), normalizedStartDate);
86
+ $[10] = normalizedStartDate;
87
+ $[11] = t11;
88
+ }
89
+ else {
90
+ t11 = $[11];
91
+ }
92
+ const _isStartDate = t11;
93
+ const _isEndDate = date_3 => (0, is_end_date_1.isEndDate)((0, date_string_1.toDateString)(date_3), normalizedEndDate);
94
+ const _isDateInsideRange = date_4 => (0, is_date_inside_range_1.isDateInsideRange)((0, date_string_1.toDateString)(date_4), normalizedStartDate, normalizedEndDate);
95
+ const _isDateBlocked = date_5 => (0, is_date_blocked_1.isDateBlocked)({
96
+ date: (0, date_string_1.toDateString)(date_5),
62
97
  minBookingDate: normalizedMinBookingDate,
63
98
  maxBookingDate: normalizedMaxBookingDate,
64
99
  startDate: normalizedStartDate,
65
100
  endDate: normalizedEndDate,
66
101
  minBookingDays,
67
102
  isDateBlockedFn: isDateBlockedProps,
68
- unavailableDates: allDisabledDates,
103
+ unavailableDates: allDisabledDates
69
104
  });
70
- const isDateFocused = (date) => focusedDate !== null && (0, date_string_1.toDateString)(date) === focusedDate;
71
- const _isDateHovered = (date) => (0, is_date_hovered_1.isDateHovered)({
72
- date: (0, date_string_1.toDateString)(date),
105
+ let t12;
106
+ if ($[12] !== focusedDate) {
107
+ t12 = date_6 => focusedDate !== null && (0, date_string_1.toDateString)(date_6) === focusedDate;
108
+ $[12] = focusedDate;
109
+ $[13] = t12;
110
+ }
111
+ else {
112
+ t12 = $[13];
113
+ }
114
+ const isDateFocused = t12;
115
+ const _isDateHovered = date_7 => (0, is_date_hovered_1.isDateHovered)({
116
+ date: (0, date_string_1.toDateString)(date_7),
73
117
  hoveredDate,
74
118
  startDate: normalizedStartDate,
75
119
  endDate: normalizedEndDate,
76
120
  minBookingDays,
77
121
  exactMinBookingDays,
78
- isDateBlocked: disabledDatesByUser,
122
+ isDateBlocked: disabledDatesByUser
79
123
  });
80
- (0, react_1.useEffect)(() => {
81
- function handleKeyDown(e) {
124
+ let t13;
125
+ if ($[14] !== activeMonths || $[15] !== focusedDate || $[16] !== numberOfMonths || $[17] !== onDateFocus) {
126
+ t13 = e => {
82
127
  var _a, _b;
83
- if ((e.key === "ArrowRight" || e.key === "ArrowLeft" || e.key === "ArrowDown" || e.key === "ArrowUp") &&
84
- !focusedDate) {
128
+ if ((e.key === "ArrowRight" || e.key === "ArrowLeft" || e.key === "ArrowDown" || e.key === "ArrowUp") && !focusedDate) {
85
129
  const activeMonthDate = (_b = (_a = activeMonths.at(0)) === null || _a === void 0 ? void 0 : _a.date) !== null && _b !== void 0 ? _b : new Date();
86
130
  onDateFocus(activeMonthDate);
87
131
  setActiveMonths((0, get_initial_months_1.getInitialMonths)(numberOfMonths, activeMonthDate));
88
132
  }
89
- }
90
- window.addEventListener("keydown", handleKeyDown);
91
- return () => {
92
- window.removeEventListener("keydown", handleKeyDown);
93
133
  };
94
- }, [activeMonths, focusedDate, numberOfMonths, onDateFocus]);
95
- const onResetDates = (0, react_1.useCallback)(() => {
96
- onDatesChange({
97
- startDate: null,
98
- endDate: null,
99
- focusedInput: exports.START_DATE,
100
- });
101
- }, [onDatesChange]);
102
- // eslint-disable-next-line complexity
103
- function onDateSelect(date) {
104
- const dateStr = (0, date_string_1.toDateString)(date);
105
- if ((focusedInput === exports.END_DATE || focusedInput === exports.START_DATE) &&
106
- minBookingDays > 0 &&
107
- exactMinBookingDays &&
108
- (0, can_select_range_1.canSelectRange)({
109
- minBookingDays,
110
- exactMinBookingDays,
111
- minBookingDate: normalizedMinBookingDate,
112
- maxBookingDate: normalizedMaxBookingDate,
113
- isDateBlocked: disabledDatesByUser,
114
- startDate: dateStr,
115
- endDate: null,
116
- })) {
117
- onDatesChange({
118
- startDate: (0, date_string_1.fromDateString)(dateStr),
119
- endDate: (0, date_string_1.fromDateString)((0, date_string_1.addDays)(dateStr, minBookingDays - 1)),
120
- focusedInput: null,
134
+ $[14] = activeMonths;
135
+ $[15] = focusedDate;
136
+ $[16] = numberOfMonths;
137
+ $[17] = onDateFocus;
138
+ $[18] = t13;
139
+ }
140
+ else {
141
+ t13 = $[18];
142
+ }
143
+ const onKeyDown = (0, react_1.useEffectEvent)(t13);
144
+ let t14;
145
+ if ($[19] !== onKeyDown) {
146
+ t14 = () => {
147
+ const handleKeyDown = e_0 => onKeyDown(e_0);
148
+ const controller = new AbortController();
149
+ window.addEventListener("keydown", handleKeyDown, {
150
+ signal: controller.signal
121
151
  });
122
- }
123
- else if ((((focusedInput === exports.END_DATE && normalizedStartDate && dateStr < normalizedStartDate) ||
124
- (focusedInput === exports.START_DATE && normalizedEndDate && dateStr > normalizedEndDate)) &&
125
- !exactMinBookingDays &&
126
- (0, can_select_range_1.canSelectRange)({
127
- minBookingDays,
128
- isDateBlocked: disabledDatesByUser,
129
- startDate: dateStr,
130
- endDate: null,
131
- })) ||
132
- (focusedInput === exports.START_DATE &&
133
- !exactMinBookingDays &&
134
- (0, can_select_range_1.canSelectRange)({
135
- minBookingDays,
136
- isDateBlocked: disabledDatesByUser,
137
- endDate: normalizedEndDate,
138
- startDate: dateStr,
139
- }))) {
152
+ return () => controller.abort();
153
+ };
154
+ $[19] = onKeyDown;
155
+ $[20] = t14;
156
+ }
157
+ else {
158
+ t14 = $[20];
159
+ }
160
+ let t15;
161
+ if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
162
+ t15 = [];
163
+ $[21] = t15;
164
+ }
165
+ else {
166
+ t15 = $[21];
167
+ }
168
+ (0, react_1.useEffect)(t14, t15);
169
+ let t16;
170
+ if ($[22] !== onDatesChange) {
171
+ t16 = () => {
140
172
  onDatesChange({
173
+ startDate: null,
141
174
  endDate: null,
142
- startDate: (0, date_string_1.fromDateString)(dateStr),
143
- focusedInput: exports.END_DATE,
175
+ focusedInput: exports.START_DATE
144
176
  });
145
- }
146
- else if (focusedInput === exports.START_DATE &&
147
- !exactMinBookingDays &&
148
- (0, can_select_range_1.canSelectRange)({
149
- minBookingDays,
150
- isDateBlocked: disabledDatesByUser,
151
- endDate: null,
152
- startDate: dateStr,
153
- })) {
177
+ };
178
+ $[22] = onDatesChange;
179
+ $[23] = t16;
180
+ }
181
+ else {
182
+ t16 = $[23];
183
+ }
184
+ const onResetDates = t16;
185
+ const onDateSelect = function onDateSelect(date_8) {
186
+ const dateStr_1 = (0, date_string_1.toDateString)(date_8);
187
+ if ((focusedInput === exports.END_DATE || focusedInput === exports.START_DATE) && minBookingDays > 0 && exactMinBookingDays && (0, can_select_range_1.canSelectRange)({
188
+ minBookingDays,
189
+ exactMinBookingDays,
190
+ minBookingDate: normalizedMinBookingDate,
191
+ maxBookingDate: normalizedMaxBookingDate,
192
+ isDateBlocked: disabledDatesByUser,
193
+ startDate: dateStr_1,
194
+ endDate: null
195
+ })) {
154
196
  onDatesChange({
155
- endDate: null,
156
- startDate: (0, date_string_1.fromDateString)(dateStr),
157
- focusedInput: exports.END_DATE,
197
+ startDate: (0, date_string_1.fromDateString)(dateStr_1),
198
+ endDate: (0, date_string_1.fromDateString)((0, date_string_1.addDays)(dateStr_1, minBookingDays - 1)),
199
+ focusedInput: null
158
200
  });
159
201
  }
160
- else if (focusedInput === exports.END_DATE &&
161
- normalizedStartDate &&
162
- dateStr >= normalizedStartDate &&
163
- !exactMinBookingDays &&
164
- (0, can_select_range_1.canSelectRange)({
202
+ else {
203
+ if ((focusedInput === exports.END_DATE && normalizedStartDate && dateStr_1 < normalizedStartDate || focusedInput === exports.START_DATE && normalizedEndDate && dateStr_1 > normalizedEndDate) && !exactMinBookingDays && (0, can_select_range_1.canSelectRange)({
165
204
  minBookingDays,
166
205
  isDateBlocked: disabledDatesByUser,
167
- startDate: normalizedStartDate,
168
- endDate: dateStr,
206
+ startDate: dateStr_1,
207
+ endDate: null
208
+ }) || focusedInput === exports.START_DATE && !exactMinBookingDays && (0, can_select_range_1.canSelectRange)({
209
+ minBookingDays,
210
+ isDateBlocked: disabledDatesByUser,
211
+ endDate: normalizedEndDate,
212
+ startDate: dateStr_1
169
213
  })) {
170
- onDatesChange({
171
- startDate: (0, date_string_1.fromDateString)(normalizedStartDate),
172
- endDate: (0, date_string_1.fromDateString)(dateStr),
173
- focusedInput: null,
174
- });
214
+ onDatesChange({
215
+ endDate: null,
216
+ startDate: (0, date_string_1.fromDateString)(dateStr_1),
217
+ focusedInput: exports.END_DATE
218
+ });
219
+ }
220
+ else {
221
+ if (focusedInput === exports.START_DATE && !exactMinBookingDays && (0, can_select_range_1.canSelectRange)({
222
+ minBookingDays,
223
+ isDateBlocked: disabledDatesByUser,
224
+ endDate: null,
225
+ startDate: dateStr_1
226
+ })) {
227
+ onDatesChange({
228
+ endDate: null,
229
+ startDate: (0, date_string_1.fromDateString)(dateStr_1),
230
+ focusedInput: exports.END_DATE
231
+ });
232
+ }
233
+ else {
234
+ if (focusedInput === exports.END_DATE && normalizedStartDate && dateStr_1 >= normalizedStartDate && !exactMinBookingDays && (0, can_select_range_1.canSelectRange)({
235
+ minBookingDays,
236
+ isDateBlocked: disabledDatesByUser,
237
+ startDate: normalizedStartDate,
238
+ endDate: dateStr_1
239
+ })) {
240
+ onDatesChange({
241
+ startDate: (0, date_string_1.fromDateString)(normalizedStartDate),
242
+ endDate: (0, date_string_1.fromDateString)(dateStr_1),
243
+ focusedInput: null
244
+ });
245
+ }
246
+ }
247
+ }
175
248
  }
176
- if (focusedInput !== exports.END_DATE &&
177
- (!focusedDate || dateStr.slice(0, 7) !== focusedDate.slice(0, 7)) &&
178
- changeActiveMonthOnSelect) {
179
- setActiveMonths((0, get_initial_months_1.getInitialMonths)(numberOfMonths, (0, date_string_1.fromDateString)(dateStr)));
249
+ if (focusedInput !== exports.END_DATE && (!focusedDate || dateStr_1.slice(0, 7) !== focusedDate.slice(0, 7)) && changeActiveMonthOnSelect) {
250
+ setActiveMonths((0, get_initial_months_1.getInitialMonths)(numberOfMonths, (0, date_string_1.fromDateString)(dateStr_1)));
180
251
  }
181
- }
182
- function onDatesSelect(start, end) {
252
+ };
253
+ const onDatesSelect = function onDatesSelect(start, end) {
183
254
  const startStr = (0, date_string_1.toDateString)(start);
184
255
  const endStr = end ? (0, date_string_1.toDateString)(end) : null;
185
256
  if ((0, can_select_range_1.canSelectRange)({
@@ -189,91 +260,133 @@ function useDateRangePicker({ changeActiveMonthOnSelect = false, datesConfig = [
189
260
  maxBookingDate: normalizedMaxBookingDate,
190
261
  isDateBlocked: disabledDatesByUser,
191
262
  startDate: startStr,
192
- endDate: endStr,
263
+ endDate: endStr
193
264
  })) {
194
265
  onDatesChange({
195
266
  endDate: endStr ? (0, date_string_1.fromDateString)(endStr) : null,
196
267
  startDate: (0, date_string_1.fromDateString)(startStr),
197
- focusedInput: exports.START_DATE,
268
+ focusedInput: exports.START_DATE
198
269
  });
199
270
  }
200
- if (focusedInput !== exports.END_DATE &&
201
- (!focusedDate || startStr.slice(0, 7) !== focusedDate.slice(0, 7)) &&
202
- changeActiveMonthOnSelect) {
271
+ if (focusedInput !== exports.END_DATE && (!focusedDate || startStr.slice(0, 7) !== focusedDate.slice(0, 7)) && changeActiveMonthOnSelect) {
203
272
  setActiveMonths((0, get_initial_months_1.getInitialMonths)(numberOfMonths, (0, date_string_1.fromDateString)(startStr)));
204
273
  }
205
- }
206
- // eslint-disable-next-line complexity
207
- function onDateHover(date) {
208
- if (!date) {
274
+ };
275
+ const onDateHover = function onDateHover(date_9) {
276
+ if (!date_9) {
209
277
  setHoveredDate(null);
210
278
  }
211
279
  else {
212
- const dateStr = (0, date_string_1.toDateString)(date);
213
- const isNotBlocked = !_isDateBlocked(date) || (normalizedStartDate && dateStr === normalizedStartDate);
214
- const isHoveredDateAfterOrEqualMinDate = normalizedMinBookingDate
215
- ? dateStr >= (0, date_string_1.addDays)(normalizedMinBookingDate, -1)
216
- : true;
217
- const isHoveredDateBeforeOrEqualMaxDate = normalizedMaxBookingDate
218
- ? dateStr <= normalizedMaxBookingDate
219
- : true;
220
- const potentialEndDateStr = (0, date_string_1.addDays)(dateStr, minBookingDays - 1);
221
- const isPotentialEndDateAfterOrEqualMinDate = normalizedMinBookingDate
222
- ? potentialEndDateStr >= normalizedMinBookingDate
223
- : true;
224
- const isPotentialEndDateBeforeOrEqualMaxDate = normalizedMaxBookingDate
225
- ? potentialEndDateStr <= normalizedMaxBookingDate
226
- : true;
227
- const isExactAndInRange = exactMinBookingDays &&
228
- minBookingDays > 1 &&
229
- isHoveredDateAfterOrEqualMinDate &&
230
- isHoveredDateBeforeOrEqualMaxDate &&
231
- isPotentialEndDateAfterOrEqualMinDate &&
232
- isPotentialEndDateBeforeOrEqualMaxDate;
233
- const isInRange = normalizedStartDate &&
234
- !normalizedEndDate &&
235
- !exactMinBookingDays &&
236
- isHoveredDateAfterOrEqualMinDate &&
237
- isHoveredDateBeforeOrEqualMaxDate;
238
- const isMinBookingDaysInRange = minBookingDays > 1 && normalizedStartDate
239
- ? dateStr > normalizedStartDate && dateStr < (0, date_string_1.addDays)(normalizedStartDate, minBookingDays - 2)
240
- : true;
241
- const isStartDateHoveredAndInRange = normalizedStartDate && dateStr === normalizedStartDate && isMinBookingDaysInRange;
280
+ const dateStr_2 = (0, date_string_1.toDateString)(date_9);
281
+ const isNotBlocked = !_isDateBlocked(date_9) || normalizedStartDate && dateStr_2 === normalizedStartDate;
282
+ const isHoveredDateAfterOrEqualMinDate = normalizedMinBookingDate ? dateStr_2 >= (0, date_string_1.addDays)(normalizedMinBookingDate, -1) : true;
283
+ const isHoveredDateBeforeOrEqualMaxDate = normalizedMaxBookingDate ? dateStr_2 <= normalizedMaxBookingDate : true;
284
+ const potentialEndDateStr = (0, date_string_1.addDays)(dateStr_2, minBookingDays - 1);
285
+ const isPotentialEndDateAfterOrEqualMinDate = normalizedMinBookingDate ? potentialEndDateStr >= normalizedMinBookingDate : true;
286
+ const isPotentialEndDateBeforeOrEqualMaxDate = normalizedMaxBookingDate ? potentialEndDateStr <= normalizedMaxBookingDate : true;
287
+ const isExactAndInRange = exactMinBookingDays && minBookingDays > 1 && isHoveredDateAfterOrEqualMinDate && isHoveredDateBeforeOrEqualMaxDate && isPotentialEndDateAfterOrEqualMinDate && isPotentialEndDateBeforeOrEqualMaxDate;
288
+ const isInRange = normalizedStartDate && !normalizedEndDate && !exactMinBookingDays && isHoveredDateAfterOrEqualMinDate && isHoveredDateBeforeOrEqualMaxDate;
289
+ const isMinBookingDaysInRange = minBookingDays > 1 && normalizedStartDate ? dateStr_2 > normalizedStartDate && dateStr_2 < (0, date_string_1.addDays)(normalizedStartDate, minBookingDays - 2) : true;
290
+ const isStartDateHoveredAndInRange = normalizedStartDate && dateStr_2 === normalizedStartDate && isMinBookingDaysInRange;
242
291
  if (isNotBlocked && (isExactAndInRange || isInRange || isStartDateHoveredAndInRange)) {
243
- setHoveredDate(dateStr);
292
+ setHoveredDate(dateStr_2);
244
293
  }
245
- else if (hoveredDate !== null) {
246
- setHoveredDate(null);
294
+ else {
295
+ if (hoveredDate !== null) {
296
+ setHoveredDate(null);
297
+ }
247
298
  }
248
299
  }
300
+ };
301
+ let t17;
302
+ if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
303
+ t17 = d => setFocusedDate(d ? (0, date_string_1.toDateString)(d) : null);
304
+ $[24] = t17;
249
305
  }
250
- return {
251
- ...(0, use_date_picker_navigation_1.useDatePickerNavigation)({
252
- activeMonths,
253
- maxBookingDate: normalizedMaxBookingDate,
254
- minBookingDate: normalizedMinBookingDate,
255
- numberOfMonths,
256
- setActiveMonths,
257
- setFocusedDate: (d) => setFocusedDate(d ? (0, date_string_1.toDateString)(d) : null),
258
- }),
306
+ else {
307
+ t17 = $[24];
308
+ }
309
+ const t18 = (0, use_date_picker_navigation_1.useDatePickerNavigation)({
259
310
  activeMonths,
260
- datesConfig,
261
- firstDayOfWeek,
262
- focusedDate: focusedDate ? (0, date_string_1.fromDateString)(focusedDate) : null,
263
- hoveredDate: hoveredDate ? (0, date_string_1.fromDateString)(hoveredDate) : null,
264
- isDateBlocked: _isDateBlocked,
265
- isDateFocused,
266
- isDateHovered: _isDateHovered,
267
- isDateInsideRange: _isDateInsideRange,
268
- isDateSelected: _isDateSelected,
269
- isEndDate: _isEndDate,
270
- isStartDate: _isStartDate,
311
+ maxBookingDate: normalizedMaxBookingDate,
312
+ minBookingDate: normalizedMinBookingDate,
271
313
  numberOfMonths,
272
- onDateFocus,
273
- onDateHover,
274
- onDateSelect,
275
- onDatesSelect,
276
- onResetDates,
277
- unavailableDates: allDisabledDates.map(date_string_1.fromDateString),
278
- };
314
+ setActiveMonths,
315
+ setFocusedDate: t17
316
+ });
317
+ let t19;
318
+ if ($[25] !== focusedDate) {
319
+ t19 = focusedDate ? (0, date_string_1.fromDateString)(focusedDate) : null;
320
+ $[25] = focusedDate;
321
+ $[26] = t19;
322
+ }
323
+ else {
324
+ t19 = $[26];
325
+ }
326
+ let t20;
327
+ if ($[27] !== hoveredDate) {
328
+ t20 = hoveredDate ? (0, date_string_1.fromDateString)(hoveredDate) : null;
329
+ $[27] = hoveredDate;
330
+ $[28] = t20;
331
+ }
332
+ else {
333
+ t20 = $[28];
334
+ }
335
+ const t21 = allDisabledDates.map(date_string_1.fromDateString);
336
+ let t22;
337
+ if ($[29] !== _isDateBlocked || $[30] !== _isDateHovered || $[31] !== _isDateInsideRange || $[32] !== _isDateSelected || $[33] !== _isEndDate || $[34] !== _isStartDate || $[35] !== activeMonths || $[36] !== datesConfig || $[37] !== firstDayOfWeek || $[38] !== isDateFocused || $[39] !== numberOfMonths || $[40] !== onDateFocus || $[41] !== onDateHover || $[42] !== onDateSelect || $[43] !== onDatesSelect || $[44] !== onResetDates || $[45] !== t18 || $[46] !== t19 || $[47] !== t20 || $[48] !== t21) {
338
+ t22 = {
339
+ ...t18,
340
+ activeMonths,
341
+ datesConfig,
342
+ firstDayOfWeek,
343
+ focusedDate: t19,
344
+ hoveredDate: t20,
345
+ isDateBlocked: _isDateBlocked,
346
+ isDateFocused,
347
+ isDateHovered: _isDateHovered,
348
+ isDateInsideRange: _isDateInsideRange,
349
+ isDateSelected: _isDateSelected,
350
+ isEndDate: _isEndDate,
351
+ isStartDate: _isStartDate,
352
+ numberOfMonths,
353
+ onDateFocus,
354
+ onDateHover,
355
+ onDateSelect,
356
+ onDatesSelect,
357
+ onResetDates,
358
+ unavailableDates: t21
359
+ };
360
+ $[29] = _isDateBlocked;
361
+ $[30] = _isDateHovered;
362
+ $[31] = _isDateInsideRange;
363
+ $[32] = _isDateSelected;
364
+ $[33] = _isEndDate;
365
+ $[34] = _isStartDate;
366
+ $[35] = activeMonths;
367
+ $[36] = datesConfig;
368
+ $[37] = firstDayOfWeek;
369
+ $[38] = isDateFocused;
370
+ $[39] = numberOfMonths;
371
+ $[40] = onDateFocus;
372
+ $[41] = onDateHover;
373
+ $[42] = onDateSelect;
374
+ $[43] = onDatesSelect;
375
+ $[44] = onResetDates;
376
+ $[45] = t18;
377
+ $[46] = t19;
378
+ $[47] = t20;
379
+ $[48] = t21;
380
+ $[49] = t22;
381
+ }
382
+ else {
383
+ t22 = $[49];
384
+ }
385
+ return t22;
386
+ }
387
+ function _temp2(config_0) {
388
+ return config_0.dates;
389
+ }
390
+ function _temp(config) {
391
+ return config.isDisabled;
279
392
  }