willba-component-library 0.2.60 → 0.2.62

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/lib/index.umd.js CHANGED
@@ -549,7 +549,7 @@
549
549
  return themePalette;
550
550
  }
551
551
 
552
- var css_248z$c = "@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');\n\n.will-root * {\n font-family: 'Montserrat', sans-serif;\n}\n\n.will-root {\n \n box-sizing: border-box;\n font-size: 14px;\n \n color: #1E1E1E;\n \n /* Palette */\n --will-primary: #374269;\n --will-secondary: #374269;\n --will-grey: #ABA7AF;\n --will-white: #fff;\n --will-white-transparent: #ffffffcf;\n --will-black: #000;\n --will-onahau: #CDEEFF;\n --will-text: #5A5959;\n --will-charcoal-blue: #384265;\n --will-transparent-white: rgba(255, 255, 255, 0.30);\n --will-transparent-black: rgba(171, 167, 175, 0.30);\n --will-error: #d32f2f;\n\n /*Color mix*/\n --will-primary-lighter: color-mix(in srgb, var(--will-primary), white 20%);\n --will-primary-lightest: color-mix(in srgb, var(--will-primary), white 80%);\n\n\n /* Confines */\n --will-box-shadow-dark: 0px 2px 12px 2px #a1a1a180;\n --will-box-shadow-light: 0px 2px 12px 2px #bcb9b980;\n\n /* Breakpoints */\n\n --will-lg: 1140px;\n --will-md: 960px;\n --will-sm: 600px;\n --will-xl: 1280px;\n --will-xs: 0px;\n}\n\n/* Typography */\n\n.will-root h1, h2, h3, h4, h5, h6 {\n font-weight: 700;\n} \n\n.will-root p, h1, h2, h3, h4, h5, h6, span {\n margin: 0;\n padding: 0;\n}\n\n\n/* Integration fixes */\n\n.will-root p {\n margin: 0 !important;\n}\n\n.will-root button {\n line-height: normal !important;\n}\n";
552
+ var css_248z$c = "@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');\n\n.will-root * {\n font-family: 'Montserrat', sans-serif;\n}\n\n.will-root {\n \n box-sizing: border-box;\n font-size: 14px;\n \n color: #1E1E1E;\n \n /* Palette */\n --will-primary: #374269;\n --will-secondary: #374269;\n --will-grey: #ABA7AF;\n --will-white: #fff;\n --will-white-transparent: #ffffffcf;\n --will-black: #000;\n --will-onahau: #CDEEFF;\n --will-text: #5A5959;\n --will-charcoal-blue: #384265;\n --will-transparent-white: rgba(255, 255, 255, 0.30);\n --will-transparent-black: rgba(171, 167, 175, 0.30);\n --will-error: #d32f2f;\n\n /*Color mix*/\n --will-primary-lighter: color-mix(in srgb, var(--will-primary), white 50%);\n --will-primary-lightest: color-mix(in srgb, var(--will-primary), white 80%);\n\n\n /* Confines */\n --will-box-shadow-dark: 0px 2px 12px 2px #a1a1a180;\n --will-box-shadow-light: 0px 2px 12px 2px #bcb9b980;\n\n /* Breakpoints */\n\n --will-lg: 1140px;\n --will-md: 960px;\n --will-sm: 600px;\n --will-xl: 1280px;\n --will-xs: 0px;\n}\n\n/* Typography */\n\n.will-root h1, h2, h3, h4, h5, h6 {\n font-weight: 700;\n} \n\n.will-root p, h1, h2, h3, h4, h5, h6, span {\n margin: 0;\n padding: 0;\n}\n\n\n/* Integration fixes */\n\n.will-root p {\n margin: 0 !important;\n}\n\n.will-root button {\n line-height: normal !important;\n}\n";
553
553
  styleInject(css_248z$c);
554
554
 
555
555
  var useAwaitRender = function () {
@@ -3780,86 +3780,6 @@
3780
3780
  return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_WEEK$4);
3781
3781
  }
3782
3782
 
3783
- // for accurate equality comparisons of UTC timestamps that end up
3784
- // having the same representation in local time, e.g. one hour before
3785
- // DST ends vs. the instant that DST ends.
3786
- function compareLocalAsc(dateLeft, dateRight) {
3787
- var diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds();
3788
- if (diff < 0) {
3789
- return -1;
3790
- } else if (diff > 0) {
3791
- return 1;
3792
- // Return 0 if diff is 0; return NaN if diff is NaN
3793
- } else {
3794
- return diff;
3795
- }
3796
- }
3797
-
3798
- /**
3799
- * @name differenceInDays
3800
- * @category Day Helpers
3801
- * @summary Get the number of full days between the given dates.
3802
- *
3803
- * @description
3804
- * Get the number of full day periods between two dates. Fractional days are
3805
- * truncated towards zero.
3806
- *
3807
- * One "full day" is the distance between a local time in one day to the same
3808
- * local time on the next or previous day. A full day can sometimes be less than
3809
- * or more than 24 hours if a daylight savings change happens between two dates.
3810
- *
3811
- * To ignore DST and only measure exact 24-hour periods, use this instead:
3812
- * `Math.floor(differenceInHours(dateLeft, dateRight)/24)|0`.
3813
- *
3814
- *
3815
- * @param {Date|Number} dateLeft - the later date
3816
- * @param {Date|Number} dateRight - the earlier date
3817
- * @returns {Number} the number of full days according to the local timezone
3818
- * @throws {TypeError} 2 arguments required
3819
- *
3820
- * @example
3821
- * // How many full days are between
3822
- * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
3823
- * const result = differenceInDays(
3824
- * new Date(2012, 6, 2, 0, 0),
3825
- * new Date(2011, 6, 2, 23, 0)
3826
- * )
3827
- * //=> 365
3828
- * // How many full days are between
3829
- * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
3830
- * const result = differenceInDays(
3831
- * new Date(2011, 6, 3, 0, 1),
3832
- * new Date(2011, 6, 2, 23, 59)
3833
- * )
3834
- * //=> 0
3835
- * // How many full days are between
3836
- * // 1 March 2020 0:00 and 1 June 2020 0:00 ?
3837
- * // Note: because local time is used, the
3838
- * // result will always be 92 days, even in
3839
- * // time zones where DST starts and the
3840
- * // period has only 92*24-1 hours.
3841
- * const result = differenceInDays(
3842
- * new Date(2020, 5, 1),
3843
- * new Date(2020, 2, 1)
3844
- * )
3845
- //=> 92
3846
- */
3847
- function differenceInDays(dirtyDateLeft, dirtyDateRight) {
3848
- requiredArgs(2, arguments);
3849
- var dateLeft = toDate(dirtyDateLeft);
3850
- var dateRight = toDate(dirtyDateRight);
3851
- var sign = compareLocalAsc(dateLeft, dateRight);
3852
- var difference = Math.abs(differenceInCalendarDays(dateLeft, dateRight));
3853
- dateLeft.setDate(dateLeft.getDate() - sign * difference);
3854
-
3855
- // Math.abs(diff in full days - diff in calendar days) === 1 if last calendar day is not full
3856
- // If so, result must be decreased by 1 in absolute value
3857
- var isLastDayNotFull = Number(compareLocalAsc(dateLeft, dateRight) === -sign);
3858
- var result = sign * (difference - isLastDayNotFull);
3859
- // Prevent negative zero
3860
- return result === 0 ? 0 : result;
3861
- }
3862
-
3863
3783
  /**
3864
3784
  * @name endOfDay
3865
3785
  * @category Day Helpers
@@ -3912,6 +3832,62 @@
3912
3832
  return date;
3913
3833
  }
3914
3834
 
3835
+ /**
3836
+ * @name eachDayOfInterval
3837
+ * @category Interval Helpers
3838
+ * @summary Return the array of dates within the specified time interval.
3839
+ *
3840
+ * @description
3841
+ * Return the array of dates within the specified time interval.
3842
+ *
3843
+ * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
3844
+ * @param {Object} [options] - an object with options.
3845
+ * @param {Number} [options.step=1] - the step to increment by. The value should be more than 1.
3846
+ * @returns {Date[]} the array with starts of days from the day of the interval start to the day of the interval end
3847
+ * @throws {TypeError} 1 argument required
3848
+ * @throws {RangeError} `options.step` must be a number greater than 1
3849
+ * @throws {RangeError} The start of an interval cannot be after its end
3850
+ * @throws {RangeError} Date in interval cannot be `Invalid Date`
3851
+ *
3852
+ * @example
3853
+ * // Each day between 6 October 2014 and 10 October 2014:
3854
+ * const result = eachDayOfInterval({
3855
+ * start: new Date(2014, 9, 6),
3856
+ * end: new Date(2014, 9, 10)
3857
+ * })
3858
+ * //=> [
3859
+ * // Mon Oct 06 2014 00:00:00,
3860
+ * // Tue Oct 07 2014 00:00:00,
3861
+ * // Wed Oct 08 2014 00:00:00,
3862
+ * // Thu Oct 09 2014 00:00:00,
3863
+ * // Fri Oct 10 2014 00:00:00
3864
+ * // ]
3865
+ */
3866
+ function eachDayOfInterval(dirtyInterval, options) {
3867
+ var _options$step;
3868
+ requiredArgs(1, arguments);
3869
+ var interval = dirtyInterval || {};
3870
+ var startDate = toDate(interval.start);
3871
+ var endDate = toDate(interval.end);
3872
+ var endTime = endDate.getTime();
3873
+
3874
+ // Throw an exception if start date is after end date or if any date is `Invalid Date`
3875
+ if (!(startDate.getTime() <= endTime)) {
3876
+ throw new RangeError('Invalid interval');
3877
+ }
3878
+ var dates = [];
3879
+ var currentDate = startDate;
3880
+ currentDate.setHours(0, 0, 0, 0);
3881
+ var step = Number((_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1);
3882
+ if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number greater than 1');
3883
+ while (currentDate.getTime() <= endTime) {
3884
+ dates.push(toDate(currentDate));
3885
+ currentDate.setDate(currentDate.getDate() + step);
3886
+ currentDate.setHours(0, 0, 0, 0);
3887
+ }
3888
+ return dates;
3889
+ }
3890
+
3915
3891
  /**
3916
3892
  * @name startOfMonth
3917
3893
  * @category Month Helpers
@@ -6501,6 +6477,58 @@
6501
6477
  return dateLeft.getFullYear() === dateRight.getFullYear();
6502
6478
  }
6503
6479
 
6480
+ /**
6481
+ * @name isWithinInterval
6482
+ * @category Interval Helpers
6483
+ * @summary Is the given date within the interval?
6484
+ *
6485
+ * @description
6486
+ * Is the given date within the interval? (Including start and end.)
6487
+ *
6488
+ * @param {Date|Number} date - the date to check
6489
+ * @param {Interval} interval - the interval to check
6490
+ * @returns {Boolean} the date is within the interval
6491
+ * @throws {TypeError} 2 arguments required
6492
+ * @throws {RangeError} The start of an interval cannot be after its end
6493
+ * @throws {RangeError} Date in interval cannot be `Invalid Date`
6494
+ *
6495
+ * @example
6496
+ * // For the date within the interval:
6497
+ * isWithinInterval(new Date(2014, 0, 3), {
6498
+ * start: new Date(2014, 0, 1),
6499
+ * end: new Date(2014, 0, 7)
6500
+ * })
6501
+ * //=> true
6502
+ *
6503
+ * @example
6504
+ * // For the date outside of the interval:
6505
+ * isWithinInterval(new Date(2014, 0, 10), {
6506
+ * start: new Date(2014, 0, 1),
6507
+ * end: new Date(2014, 0, 7)
6508
+ * })
6509
+ * //=> false
6510
+ *
6511
+ * @example
6512
+ * // For date equal to interval start:
6513
+ * isWithinInterval(date, { start, end: date }) // => true
6514
+ *
6515
+ * @example
6516
+ * // For date equal to interval end:
6517
+ * isWithinInterval(date, { start: date, end }) // => true
6518
+ */
6519
+ function isWithinInterval(dirtyDate, interval) {
6520
+ requiredArgs(2, arguments);
6521
+ var time = toDate(dirtyDate).getTime();
6522
+ var startTime = toDate(interval.start).getTime();
6523
+ var endTime = toDate(interval.end).getTime();
6524
+
6525
+ // Throw an exception if start date is after end date or if any date is `Invalid Date`
6526
+ if (!(startTime <= endTime)) {
6527
+ throw new RangeError('Invalid interval');
6528
+ }
6529
+ return time >= startTime && time <= endTime;
6530
+ }
6531
+
6504
6532
  /**
6505
6533
  * @name subDays
6506
6534
  * @category Day Helpers
@@ -11038,7 +11066,8 @@
11038
11066
  return setCalendarRange(undefined);
11039
11067
  }
11040
11068
  if (
11041
- // 2. If selected "start" is after "range context end", clear selection and display error
11069
+ // 2. If selected "start" is after "range context end", clear selection and display error.
11070
+ // Also, if there are unavailable dates between the rangeContext "start" and "end", do not allow a fully overlapping selection.
11042
11071
  (rangeFrom && rangeContextTo && isAfter(rangeFrom, rangeContextTo)) ||
11043
11072
  (calendarRangeFrom &&
11044
11073
  calendarRangeTo &&
@@ -11059,6 +11088,17 @@
11059
11088
  }
11060
11089
  // 5. Handle gap selection backwards and forwards
11061
11090
  if (
11091
+ // In the range context case, every date selection that is after selected "start" last checkout,
11092
+ // clear selection and prompt error
11093
+ rangeContext &&
11094
+ rangeTo &&
11095
+ (checkOutRange === null || checkOutRange === void 0 ? void 0 : checkOutRange.lastCheckOut) &&
11096
+ isAfter(rangeTo, endOfDay(checkOutRange.lastCheckOut)) &&
11097
+ isAfter(rangeTo, endOfDay(rangeContext.to))) {
11098
+ setCalendarHasError && setCalendarHasError(true);
11099
+ return setCalendarRange(undefined);
11100
+ }
11101
+ if (
11062
11102
  // Enforce on every date selection before current "start", mark as "start" selection
11063
11103
  rangeFrom &&
11064
11104
  calendarRangeFrom &&
@@ -11133,62 +11173,85 @@
11133
11173
  var handleCalendarModifiers = function (_a) {
11134
11174
  var _b;
11135
11175
  var newDisableCalendarDates = _a.newDisableCalendarDates, calendarRange = _a.calendarRange, disabledDatesByPage = _a.disabledDatesByPage, disabledDates = _a.disabledDates, overlappingDate = _a.overlappingDate, rangeContext = _a.rangeContext, firstPossibleRangeContextCheckIn = _a.firstPossibleRangeContextCheckIn, lastPossibleRangeContextCheckOut = _a.lastPossibleRangeContextCheckOut, findFirstPossibleRangeContextCheckIn = _a.findFirstPossibleRangeContextCheckIn, findLastPossibleRangeContextCheckOut = _a.findLastPossibleRangeContextCheckOut, currentSelectionLastCheckoutDate = _a.currentSelectionLastCheckoutDate;
11176
+ // Parse data
11177
+ var calendarRangeFrom = (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from) && endOfDay(calendarRange.from);
11178
+ var calendarRangeTo = (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) && endOfDay(calendarRange.to);
11179
+ var rangeContextFrom = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.from) && endOfDay(rangeContext.from);
11180
+ var rangeContextTo = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.to) && endOfDay(rangeContext.to);
11136
11181
  // Create range for range context middle selection and current overlapping selection
11137
- var rangeContextMiddleSelection = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.from) && (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.to)
11138
- ? Array.from({ length: differenceInDays(rangeContext.to, rangeContext.from) - 1 }, function (_, i) { return ({
11139
- from: addDays(rangeContext.from, i + 1),
11140
- to: addDays(rangeContext.from, i + 1),
11141
- }); }).filter(function (date) {
11142
- return !(((calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from) &&
11143
- isEqual(endOfDay(calendarRange.from), endOfDay(date.from))) ||
11144
- ((calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) &&
11145
- isEqual(endOfDay(calendarRange.to), endOfDay(date.from))));
11182
+ var rangeContextMiddleSelection = rangeContextFrom && rangeContextTo
11183
+ ? eachDayOfInterval({
11184
+ start: addDays(rangeContextFrom, 1),
11185
+ end: addDays(rangeContextTo, -1),
11186
+ }).filter(function (date) {
11187
+ return !((calendarRangeFrom &&
11188
+ isEqual(endOfDay(calendarRangeFrom), endOfDay(date))) ||
11189
+ (calendarRangeTo &&
11190
+ isEqual(endOfDay(calendarRangeTo), endOfDay(date))) ||
11191
+ (calendarRangeFrom &&
11192
+ !calendarRangeTo &&
11193
+ (currentSelectionLastCheckoutDate === null || currentSelectionLastCheckoutDate === void 0 ? void 0 : currentSelectionLastCheckoutDate.lastCheckOut) &&
11194
+ isAfter(calendarRangeFrom, rangeContextFrom) &&
11195
+ isBefore(currentSelectionLastCheckoutDate === null || currentSelectionLastCheckoutDate === void 0 ? void 0 : currentSelectionLastCheckoutDate.lastCheckOut, rangeContextTo) &&
11196
+ isWithinInterval(date, {
11197
+ start: currentSelectionLastCheckoutDate.checkIn,
11198
+ end: currentSelectionLastCheckoutDate.lastCheckOut,
11199
+ })) ||
11200
+ (calendarRangeFrom &&
11201
+ calendarRangeTo &&
11202
+ isAfter(calendarRangeFrom, rangeContextFrom) &&
11203
+ isBefore(calendarRangeTo, rangeContextTo) &&
11204
+ isWithinInterval(date, {
11205
+ start: calendarRangeFrom,
11206
+ end: calendarRangeTo,
11207
+ })));
11146
11208
  })
11147
11209
  : [];
11210
+ console.log();
11148
11211
  return {
11149
11212
  booked: disabledDatesByPage.length
11150
11213
  ? disabledDatesByPage
11151
11214
  : (disabledDates === null || disabledDates === void 0 ? void 0 : disabledDates.length)
11152
11215
  ? __spreadArray$1(__spreadArray$1(__spreadArray$1([], __read(disabledDates), false), __read(firstPossibleRangeContextCheckIn), false), __read(lastPossibleRangeContextCheckOut), false) : ((_b = newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates) === null || _b === void 0 ? void 0 : _b.length)
11153
11216
  ? __spreadArray$1(__spreadArray$1(__spreadArray$1([], __read(newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates), false), __read(firstPossibleRangeContextCheckIn), false), __read(lastPossibleRangeContextCheckOut), false) : [],
11154
- disabledAfterCheckIn: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from)
11155
- ? [{ after: calendarRange.from }]
11217
+ disabledAfterCheckIn: calendarRangeFrom
11218
+ ? [{ after: calendarRangeFrom }]
11156
11219
  : [],
11157
- overlappingDate: __spreadArray$1([], __read((!(calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from) && !!(overlappingDate === null || overlappingDate === void 0 ? void 0 : overlappingDate.length)
11220
+ overlappingDate: __spreadArray$1([], __read((!calendarRangeFrom && !!(overlappingDate === null || overlappingDate === void 0 ? void 0 : overlappingDate.length)
11158
11221
  ? overlappingDate.map(function (date) { return ({ from: date.from }); })
11159
11222
  : [])), false),
11160
- noActiveSelectionStart: (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.from) &&
11161
- !(((calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from) &&
11162
- isEqual(endOfDay(rangeContext.from), endOfDay(calendarRange.from))) ||
11163
- ((calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) &&
11164
- isEqual(endOfDay(rangeContext.from), endOfDay(calendarRange.to))))
11165
- ? rangeContext.from
11166
- : [],
11167
- noActiveSelectionEnd: (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.to) &&
11168
- !(((calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from) &&
11169
- isEqual(endOfDay(rangeContext.to), endOfDay(calendarRange.from))) ||
11170
- ((calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) &&
11171
- isEqual(endOfDay(rangeContext.to), endOfDay(calendarRange.to))))
11172
- ? rangeContext.to
11223
+ noActiveSelectionStart: rangeContextFrom &&
11224
+ !(calendarRangeFrom &&
11225
+ rangeContextFrom &&
11226
+ isEqual(endOfDay(rangeContextFrom), endOfDay(calendarRangeFrom)))
11227
+ ? rangeContextFrom
11173
11228
  : [],
11174
11229
  noActiveSelectionMid: __spreadArray$1([], __read((rangeContextMiddleSelection.length
11175
11230
  ? rangeContextMiddleSelection
11176
11231
  : [])), false),
11177
- checkoutOptionsMid: __spreadArray$1([], __read(((calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from) &&
11178
- !(calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) &&
11232
+ noActiveSelectionEnd: rangeContextTo &&
11233
+ !(calendarRangeFrom &&
11234
+ rangeContextTo &&
11235
+ isEqual(endOfDay(rangeContextTo), endOfDay(calendarRangeFrom)))
11236
+ ? rangeContextTo
11237
+ : [],
11238
+ checkoutOptionsMid: __spreadArray$1([], __read((calendarRangeFrom &&
11239
+ !calendarRangeTo &&
11179
11240
  (currentSelectionLastCheckoutDate === null || currentSelectionLastCheckoutDate === void 0 ? void 0 : currentSelectionLastCheckoutDate.lastCheckOut)
11180
11241
  ? [
11181
11242
  {
11182
- after: calendarRange.from,
11243
+ after: calendarRangeFrom,
11183
11244
  before: addDays(currentSelectionLastCheckoutDate.lastCheckOut, 1),
11184
11245
  },
11185
11246
  ]
11186
11247
  : [])), false),
11187
- checkInOnly: __spreadArray$1([], __read(((findFirstPossibleRangeContextCheckIn === null || findFirstPossibleRangeContextCheckIn === void 0 ? void 0 : findFirstPossibleRangeContextCheckIn.checkIn) && rangeContext
11248
+ checkInOnly: __spreadArray$1([], __read(((findFirstPossibleRangeContextCheckIn === null || findFirstPossibleRangeContextCheckIn === void 0 ? void 0 : findFirstPossibleRangeContextCheckIn.checkIn) &&
11249
+ rangeContext &&
11250
+ rangeContextFrom
11188
11251
  ? [
11189
11252
  {
11190
11253
  from: findFirstPossibleRangeContextCheckIn.checkIn,
11191
- to: addDays(rangeContext.from, -1),
11254
+ to: addDays(rangeContextFrom, -1),
11192
11255
  },
11193
11256
  ]
11194
11257
  : [])), false),
@@ -11267,12 +11330,14 @@
11267
11330
  ? isAfter(endOfDay(calendarRangeTo), endOfDay(rangeContextFrom)) ||
11268
11331
  isEqual(endOfDay(calendarRangeTo), endOfDay(rangeContextFrom))
11269
11332
  : null;
11270
- if ((rangeContext &&
11271
- calendarRangeFrom &&
11272
- !startIsEqualOrBeforeRangeContextEnd) ||
11273
- (rangeContext && calendarRangeTo && !endIsEqualOrAfterRangeContextStart)) {
11274
- setCalendarHasError && !calendarHasError && setCalendarHasError(true);
11275
- }
11333
+ React__default.useEffect(function () {
11334
+ if ((rangeContext &&
11335
+ calendarRangeFrom &&
11336
+ !startIsEqualOrBeforeRangeContextEnd) ||
11337
+ (rangeContext && calendarRangeTo && !endIsEqualOrAfterRangeContextStart)) {
11338
+ setCalendarHasError && !calendarHasError && setCalendarHasError(true);
11339
+ }
11340
+ });
11276
11341
  };
11277
11342
 
11278
11343
  var useCalendarTooltips = function (_a) {