@uxf/datepicker 14.0.0 → 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,171 +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,
79
- });
80
- // An effect event, so the listener stays attached while the focused date and the visible months change.
81
- const onKeyDown = (0, react_1.useEffectEvent)((e) => {
82
- var _a, _b;
83
- if ((e.key === "ArrowRight" || e.key === "ArrowLeft" || e.key === "ArrowDown" || e.key === "ArrowUp") &&
84
- !focusedDate) {
85
- const activeMonthDate = (_b = (_a = activeMonths.at(0)) === null || _a === void 0 ? void 0 : _a.date) !== null && _b !== void 0 ? _b : new Date();
86
- onDateFocus(activeMonthDate);
87
- setActiveMonths((0, get_initial_months_1.getInitialMonths)(numberOfMonths, activeMonthDate));
88
- }
122
+ isDateBlocked: disabledDatesByUser
89
123
  });
90
- (0, react_1.useEffect)(() => {
91
- const handleKeyDown = (e) => onKeyDown(e);
92
- const controller = new AbortController();
93
- window.addEventListener("keydown", handleKeyDown, { signal: controller.signal });
94
- return () => controller.abort();
95
- }, []);
96
- const onResetDates = (0, react_1.useCallback)(() => {
97
- onDatesChange({
98
- startDate: null,
99
- endDate: null,
100
- focusedInput: exports.START_DATE,
101
- });
102
- }, [onDatesChange]);
103
- // eslint-disable-next-line complexity
104
- function onDateSelect(date) {
105
- const dateStr = (0, date_string_1.toDateString)(date);
106
- if ((focusedInput === exports.END_DATE || focusedInput === exports.START_DATE) &&
107
- minBookingDays > 0 &&
108
- exactMinBookingDays &&
109
- (0, can_select_range_1.canSelectRange)({
110
- minBookingDays,
111
- exactMinBookingDays,
112
- minBookingDate: normalizedMinBookingDate,
113
- maxBookingDate: normalizedMaxBookingDate,
114
- isDateBlocked: disabledDatesByUser,
115
- startDate: dateStr,
116
- endDate: null,
117
- })) {
118
- onDatesChange({
119
- startDate: (0, date_string_1.fromDateString)(dateStr),
120
- endDate: (0, date_string_1.fromDateString)((0, date_string_1.addDays)(dateStr, minBookingDays - 1)),
121
- focusedInput: null,
124
+ let t13;
125
+ if ($[14] !== activeMonths || $[15] !== focusedDate || $[16] !== numberOfMonths || $[17] !== onDateFocus) {
126
+ t13 = e => {
127
+ var _a, _b;
128
+ if ((e.key === "ArrowRight" || e.key === "ArrowLeft" || e.key === "ArrowDown" || e.key === "ArrowUp") && !focusedDate) {
129
+ const activeMonthDate = (_b = (_a = activeMonths.at(0)) === null || _a === void 0 ? void 0 : _a.date) !== null && _b !== void 0 ? _b : new Date();
130
+ onDateFocus(activeMonthDate);
131
+ setActiveMonths((0, get_initial_months_1.getInitialMonths)(numberOfMonths, activeMonthDate));
132
+ }
133
+ };
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
122
151
  });
123
- }
124
- else if ((((focusedInput === exports.END_DATE && normalizedStartDate && dateStr < normalizedStartDate) ||
125
- (focusedInput === exports.START_DATE && normalizedEndDate && dateStr > normalizedEndDate)) &&
126
- !exactMinBookingDays &&
127
- (0, can_select_range_1.canSelectRange)({
128
- minBookingDays,
129
- isDateBlocked: disabledDatesByUser,
130
- startDate: dateStr,
131
- endDate: null,
132
- })) ||
133
- (focusedInput === exports.START_DATE &&
134
- !exactMinBookingDays &&
135
- (0, can_select_range_1.canSelectRange)({
136
- minBookingDays,
137
- isDateBlocked: disabledDatesByUser,
138
- endDate: normalizedEndDate,
139
- startDate: dateStr,
140
- }))) {
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 = () => {
141
172
  onDatesChange({
173
+ startDate: null,
142
174
  endDate: null,
143
- startDate: (0, date_string_1.fromDateString)(dateStr),
144
- focusedInput: exports.END_DATE,
175
+ focusedInput: exports.START_DATE
145
176
  });
146
- }
147
- else if (focusedInput === exports.START_DATE &&
148
- !exactMinBookingDays &&
149
- (0, can_select_range_1.canSelectRange)({
150
- minBookingDays,
151
- isDateBlocked: disabledDatesByUser,
152
- endDate: null,
153
- startDate: dateStr,
154
- })) {
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
+ })) {
155
196
  onDatesChange({
156
- endDate: null,
157
- startDate: (0, date_string_1.fromDateString)(dateStr),
158
- 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
159
200
  });
160
201
  }
161
- else if (focusedInput === exports.END_DATE &&
162
- normalizedStartDate &&
163
- dateStr >= normalizedStartDate &&
164
- !exactMinBookingDays &&
165
- (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)({
204
+ minBookingDays,
205
+ isDateBlocked: disabledDatesByUser,
206
+ startDate: dateStr_1,
207
+ endDate: null
208
+ }) || focusedInput === exports.START_DATE && !exactMinBookingDays && (0, can_select_range_1.canSelectRange)({
166
209
  minBookingDays,
167
210
  isDateBlocked: disabledDatesByUser,
168
- startDate: normalizedStartDate,
169
- endDate: dateStr,
211
+ endDate: normalizedEndDate,
212
+ startDate: dateStr_1
170
213
  })) {
171
- onDatesChange({
172
- startDate: (0, date_string_1.fromDateString)(normalizedStartDate),
173
- endDate: (0, date_string_1.fromDateString)(dateStr),
174
- focusedInput: null,
175
- });
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
+ }
176
248
  }
177
- if (focusedInput !== exports.END_DATE &&
178
- (!focusedDate || dateStr.slice(0, 7) !== focusedDate.slice(0, 7)) &&
179
- changeActiveMonthOnSelect) {
180
- 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)));
181
251
  }
182
- }
183
- function onDatesSelect(start, end) {
252
+ };
253
+ const onDatesSelect = function onDatesSelect(start, end) {
184
254
  const startStr = (0, date_string_1.toDateString)(start);
185
255
  const endStr = end ? (0, date_string_1.toDateString)(end) : null;
186
256
  if ((0, can_select_range_1.canSelectRange)({
@@ -190,91 +260,133 @@ function useDateRangePicker({ changeActiveMonthOnSelect = false, datesConfig = [
190
260
  maxBookingDate: normalizedMaxBookingDate,
191
261
  isDateBlocked: disabledDatesByUser,
192
262
  startDate: startStr,
193
- endDate: endStr,
263
+ endDate: endStr
194
264
  })) {
195
265
  onDatesChange({
196
266
  endDate: endStr ? (0, date_string_1.fromDateString)(endStr) : null,
197
267
  startDate: (0, date_string_1.fromDateString)(startStr),
198
- focusedInput: exports.START_DATE,
268
+ focusedInput: exports.START_DATE
199
269
  });
200
270
  }
201
- if (focusedInput !== exports.END_DATE &&
202
- (!focusedDate || startStr.slice(0, 7) !== focusedDate.slice(0, 7)) &&
203
- changeActiveMonthOnSelect) {
271
+ if (focusedInput !== exports.END_DATE && (!focusedDate || startStr.slice(0, 7) !== focusedDate.slice(0, 7)) && changeActiveMonthOnSelect) {
204
272
  setActiveMonths((0, get_initial_months_1.getInitialMonths)(numberOfMonths, (0, date_string_1.fromDateString)(startStr)));
205
273
  }
206
- }
207
- // eslint-disable-next-line complexity
208
- function onDateHover(date) {
209
- if (!date) {
274
+ };
275
+ const onDateHover = function onDateHover(date_9) {
276
+ if (!date_9) {
210
277
  setHoveredDate(null);
211
278
  }
212
279
  else {
213
- const dateStr = (0, date_string_1.toDateString)(date);
214
- const isNotBlocked = !_isDateBlocked(date) || (normalizedStartDate && dateStr === normalizedStartDate);
215
- const isHoveredDateAfterOrEqualMinDate = normalizedMinBookingDate
216
- ? dateStr >= (0, date_string_1.addDays)(normalizedMinBookingDate, -1)
217
- : true;
218
- const isHoveredDateBeforeOrEqualMaxDate = normalizedMaxBookingDate
219
- ? dateStr <= normalizedMaxBookingDate
220
- : true;
221
- const potentialEndDateStr = (0, date_string_1.addDays)(dateStr, minBookingDays - 1);
222
- const isPotentialEndDateAfterOrEqualMinDate = normalizedMinBookingDate
223
- ? potentialEndDateStr >= normalizedMinBookingDate
224
- : true;
225
- const isPotentialEndDateBeforeOrEqualMaxDate = normalizedMaxBookingDate
226
- ? potentialEndDateStr <= normalizedMaxBookingDate
227
- : true;
228
- const isExactAndInRange = exactMinBookingDays &&
229
- minBookingDays > 1 &&
230
- isHoveredDateAfterOrEqualMinDate &&
231
- isHoveredDateBeforeOrEqualMaxDate &&
232
- isPotentialEndDateAfterOrEqualMinDate &&
233
- isPotentialEndDateBeforeOrEqualMaxDate;
234
- const isInRange = normalizedStartDate &&
235
- !normalizedEndDate &&
236
- !exactMinBookingDays &&
237
- isHoveredDateAfterOrEqualMinDate &&
238
- isHoveredDateBeforeOrEqualMaxDate;
239
- const isMinBookingDaysInRange = minBookingDays > 1 && normalizedStartDate
240
- ? dateStr > normalizedStartDate && dateStr < (0, date_string_1.addDays)(normalizedStartDate, minBookingDays - 2)
241
- : true;
242
- 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;
243
291
  if (isNotBlocked && (isExactAndInRange || isInRange || isStartDateHoveredAndInRange)) {
244
- setHoveredDate(dateStr);
292
+ setHoveredDate(dateStr_2);
245
293
  }
246
- else if (hoveredDate !== null) {
247
- setHoveredDate(null);
294
+ else {
295
+ if (hoveredDate !== null) {
296
+ setHoveredDate(null);
297
+ }
248
298
  }
249
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;
250
305
  }
251
- return {
252
- ...(0, use_date_picker_navigation_1.useDatePickerNavigation)({
253
- activeMonths,
254
- maxBookingDate: normalizedMaxBookingDate,
255
- minBookingDate: normalizedMinBookingDate,
256
- numberOfMonths,
257
- setActiveMonths,
258
- setFocusedDate: (d) => setFocusedDate(d ? (0, date_string_1.toDateString)(d) : null),
259
- }),
306
+ else {
307
+ t17 = $[24];
308
+ }
309
+ const t18 = (0, use_date_picker_navigation_1.useDatePickerNavigation)({
260
310
  activeMonths,
261
- datesConfig,
262
- firstDayOfWeek,
263
- focusedDate: focusedDate ? (0, date_string_1.fromDateString)(focusedDate) : null,
264
- hoveredDate: hoveredDate ? (0, date_string_1.fromDateString)(hoveredDate) : null,
265
- isDateBlocked: _isDateBlocked,
266
- isDateFocused,
267
- isDateHovered: _isDateHovered,
268
- isDateInsideRange: _isDateInsideRange,
269
- isDateSelected: _isDateSelected,
270
- isEndDate: _isEndDate,
271
- isStartDate: _isStartDate,
311
+ maxBookingDate: normalizedMaxBookingDate,
312
+ minBookingDate: normalizedMinBookingDate,
272
313
  numberOfMonths,
273
- onDateFocus,
274
- onDateHover,
275
- onDateSelect,
276
- onDatesSelect,
277
- onResetDates,
278
- unavailableDates: allDisabledDates.map(date_string_1.fromDateString),
279
- };
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;
280
392
  }