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/core/components/calendar/utils/handleCalendarModifiers.d.ts +1 -4
- package/lib/index.esm.js +183 -118
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +183 -118
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +183 -118
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterCalendar/FilterCalendar.stories.tsx +49 -65
- package/src/core/components/calendar/Calendar.tsx +1 -1
- package/src/core/components/calendar/utils/calendarSelectionRules.tsx +17 -2
- package/src/core/components/calendar/utils/checkForContinuousSelection.tsx +11 -8
- package/src/core/components/calendar/utils/handleCalendarModifiers.tsx +74 -38
- package/src/themes/Default.css +1 -1
|
@@ -25,11 +25,8 @@ export declare const handleCalendarModifiers: ({ newDisableCalendarDates, calend
|
|
|
25
25
|
from: Date | undefined;
|
|
26
26
|
}[];
|
|
27
27
|
noActiveSelectionStart: never[] | Date;
|
|
28
|
+
noActiveSelectionMid: Date[];
|
|
28
29
|
noActiveSelectionEnd: never[] | Date;
|
|
29
|
-
noActiveSelectionMid: {
|
|
30
|
-
from: Date;
|
|
31
|
-
to: Date;
|
|
32
|
-
}[];
|
|
33
30
|
checkoutOptionsMid: {
|
|
34
31
|
after: Date;
|
|
35
32
|
before: Date;
|
package/lib/index.esm.js
CHANGED
|
@@ -527,7 +527,7 @@ function useTheme(_a) {
|
|
|
527
527
|
return themePalette;
|
|
528
528
|
}
|
|
529
529
|
|
|
530
|
-
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
|
|
530
|
+
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";
|
|
531
531
|
styleInject(css_248z$c);
|
|
532
532
|
|
|
533
533
|
var useAwaitRender = function () {
|
|
@@ -3758,86 +3758,6 @@ function differenceInCalendarWeeks(dirtyDateLeft, dirtyDateRight, options) {
|
|
|
3758
3758
|
return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_WEEK$4);
|
|
3759
3759
|
}
|
|
3760
3760
|
|
|
3761
|
-
// for accurate equality comparisons of UTC timestamps that end up
|
|
3762
|
-
// having the same representation in local time, e.g. one hour before
|
|
3763
|
-
// DST ends vs. the instant that DST ends.
|
|
3764
|
-
function compareLocalAsc(dateLeft, dateRight) {
|
|
3765
|
-
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();
|
|
3766
|
-
if (diff < 0) {
|
|
3767
|
-
return -1;
|
|
3768
|
-
} else if (diff > 0) {
|
|
3769
|
-
return 1;
|
|
3770
|
-
// Return 0 if diff is 0; return NaN if diff is NaN
|
|
3771
|
-
} else {
|
|
3772
|
-
return diff;
|
|
3773
|
-
}
|
|
3774
|
-
}
|
|
3775
|
-
|
|
3776
|
-
/**
|
|
3777
|
-
* @name differenceInDays
|
|
3778
|
-
* @category Day Helpers
|
|
3779
|
-
* @summary Get the number of full days between the given dates.
|
|
3780
|
-
*
|
|
3781
|
-
* @description
|
|
3782
|
-
* Get the number of full day periods between two dates. Fractional days are
|
|
3783
|
-
* truncated towards zero.
|
|
3784
|
-
*
|
|
3785
|
-
* One "full day" is the distance between a local time in one day to the same
|
|
3786
|
-
* local time on the next or previous day. A full day can sometimes be less than
|
|
3787
|
-
* or more than 24 hours if a daylight savings change happens between two dates.
|
|
3788
|
-
*
|
|
3789
|
-
* To ignore DST and only measure exact 24-hour periods, use this instead:
|
|
3790
|
-
* `Math.floor(differenceInHours(dateLeft, dateRight)/24)|0`.
|
|
3791
|
-
*
|
|
3792
|
-
*
|
|
3793
|
-
* @param {Date|Number} dateLeft - the later date
|
|
3794
|
-
* @param {Date|Number} dateRight - the earlier date
|
|
3795
|
-
* @returns {Number} the number of full days according to the local timezone
|
|
3796
|
-
* @throws {TypeError} 2 arguments required
|
|
3797
|
-
*
|
|
3798
|
-
* @example
|
|
3799
|
-
* // How many full days are between
|
|
3800
|
-
* // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
|
|
3801
|
-
* const result = differenceInDays(
|
|
3802
|
-
* new Date(2012, 6, 2, 0, 0),
|
|
3803
|
-
* new Date(2011, 6, 2, 23, 0)
|
|
3804
|
-
* )
|
|
3805
|
-
* //=> 365
|
|
3806
|
-
* // How many full days are between
|
|
3807
|
-
* // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
|
|
3808
|
-
* const result = differenceInDays(
|
|
3809
|
-
* new Date(2011, 6, 3, 0, 1),
|
|
3810
|
-
* new Date(2011, 6, 2, 23, 59)
|
|
3811
|
-
* )
|
|
3812
|
-
* //=> 0
|
|
3813
|
-
* // How many full days are between
|
|
3814
|
-
* // 1 March 2020 0:00 and 1 June 2020 0:00 ?
|
|
3815
|
-
* // Note: because local time is used, the
|
|
3816
|
-
* // result will always be 92 days, even in
|
|
3817
|
-
* // time zones where DST starts and the
|
|
3818
|
-
* // period has only 92*24-1 hours.
|
|
3819
|
-
* const result = differenceInDays(
|
|
3820
|
-
* new Date(2020, 5, 1),
|
|
3821
|
-
* new Date(2020, 2, 1)
|
|
3822
|
-
* )
|
|
3823
|
-
//=> 92
|
|
3824
|
-
*/
|
|
3825
|
-
function differenceInDays(dirtyDateLeft, dirtyDateRight) {
|
|
3826
|
-
requiredArgs(2, arguments);
|
|
3827
|
-
var dateLeft = toDate(dirtyDateLeft);
|
|
3828
|
-
var dateRight = toDate(dirtyDateRight);
|
|
3829
|
-
var sign = compareLocalAsc(dateLeft, dateRight);
|
|
3830
|
-
var difference = Math.abs(differenceInCalendarDays(dateLeft, dateRight));
|
|
3831
|
-
dateLeft.setDate(dateLeft.getDate() - sign * difference);
|
|
3832
|
-
|
|
3833
|
-
// Math.abs(diff in full days - diff in calendar days) === 1 if last calendar day is not full
|
|
3834
|
-
// If so, result must be decreased by 1 in absolute value
|
|
3835
|
-
var isLastDayNotFull = Number(compareLocalAsc(dateLeft, dateRight) === -sign);
|
|
3836
|
-
var result = sign * (difference - isLastDayNotFull);
|
|
3837
|
-
// Prevent negative zero
|
|
3838
|
-
return result === 0 ? 0 : result;
|
|
3839
|
-
}
|
|
3840
|
-
|
|
3841
3761
|
/**
|
|
3842
3762
|
* @name endOfDay
|
|
3843
3763
|
* @category Day Helpers
|
|
@@ -3890,6 +3810,62 @@ function endOfMonth(dirtyDate) {
|
|
|
3890
3810
|
return date;
|
|
3891
3811
|
}
|
|
3892
3812
|
|
|
3813
|
+
/**
|
|
3814
|
+
* @name eachDayOfInterval
|
|
3815
|
+
* @category Interval Helpers
|
|
3816
|
+
* @summary Return the array of dates within the specified time interval.
|
|
3817
|
+
*
|
|
3818
|
+
* @description
|
|
3819
|
+
* Return the array of dates within the specified time interval.
|
|
3820
|
+
*
|
|
3821
|
+
* @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
|
|
3822
|
+
* @param {Object} [options] - an object with options.
|
|
3823
|
+
* @param {Number} [options.step=1] - the step to increment by. The value should be more than 1.
|
|
3824
|
+
* @returns {Date[]} the array with starts of days from the day of the interval start to the day of the interval end
|
|
3825
|
+
* @throws {TypeError} 1 argument required
|
|
3826
|
+
* @throws {RangeError} `options.step` must be a number greater than 1
|
|
3827
|
+
* @throws {RangeError} The start of an interval cannot be after its end
|
|
3828
|
+
* @throws {RangeError} Date in interval cannot be `Invalid Date`
|
|
3829
|
+
*
|
|
3830
|
+
* @example
|
|
3831
|
+
* // Each day between 6 October 2014 and 10 October 2014:
|
|
3832
|
+
* const result = eachDayOfInterval({
|
|
3833
|
+
* start: new Date(2014, 9, 6),
|
|
3834
|
+
* end: new Date(2014, 9, 10)
|
|
3835
|
+
* })
|
|
3836
|
+
* //=> [
|
|
3837
|
+
* // Mon Oct 06 2014 00:00:00,
|
|
3838
|
+
* // Tue Oct 07 2014 00:00:00,
|
|
3839
|
+
* // Wed Oct 08 2014 00:00:00,
|
|
3840
|
+
* // Thu Oct 09 2014 00:00:00,
|
|
3841
|
+
* // Fri Oct 10 2014 00:00:00
|
|
3842
|
+
* // ]
|
|
3843
|
+
*/
|
|
3844
|
+
function eachDayOfInterval(dirtyInterval, options) {
|
|
3845
|
+
var _options$step;
|
|
3846
|
+
requiredArgs(1, arguments);
|
|
3847
|
+
var interval = dirtyInterval || {};
|
|
3848
|
+
var startDate = toDate(interval.start);
|
|
3849
|
+
var endDate = toDate(interval.end);
|
|
3850
|
+
var endTime = endDate.getTime();
|
|
3851
|
+
|
|
3852
|
+
// Throw an exception if start date is after end date or if any date is `Invalid Date`
|
|
3853
|
+
if (!(startDate.getTime() <= endTime)) {
|
|
3854
|
+
throw new RangeError('Invalid interval');
|
|
3855
|
+
}
|
|
3856
|
+
var dates = [];
|
|
3857
|
+
var currentDate = startDate;
|
|
3858
|
+
currentDate.setHours(0, 0, 0, 0);
|
|
3859
|
+
var step = Number((_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1);
|
|
3860
|
+
if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number greater than 1');
|
|
3861
|
+
while (currentDate.getTime() <= endTime) {
|
|
3862
|
+
dates.push(toDate(currentDate));
|
|
3863
|
+
currentDate.setDate(currentDate.getDate() + step);
|
|
3864
|
+
currentDate.setHours(0, 0, 0, 0);
|
|
3865
|
+
}
|
|
3866
|
+
return dates;
|
|
3867
|
+
}
|
|
3868
|
+
|
|
3893
3869
|
/**
|
|
3894
3870
|
* @name startOfMonth
|
|
3895
3871
|
* @category Month Helpers
|
|
@@ -6479,6 +6455,58 @@ function isSameYear(dirtyDateLeft, dirtyDateRight) {
|
|
|
6479
6455
|
return dateLeft.getFullYear() === dateRight.getFullYear();
|
|
6480
6456
|
}
|
|
6481
6457
|
|
|
6458
|
+
/**
|
|
6459
|
+
* @name isWithinInterval
|
|
6460
|
+
* @category Interval Helpers
|
|
6461
|
+
* @summary Is the given date within the interval?
|
|
6462
|
+
*
|
|
6463
|
+
* @description
|
|
6464
|
+
* Is the given date within the interval? (Including start and end.)
|
|
6465
|
+
*
|
|
6466
|
+
* @param {Date|Number} date - the date to check
|
|
6467
|
+
* @param {Interval} interval - the interval to check
|
|
6468
|
+
* @returns {Boolean} the date is within the interval
|
|
6469
|
+
* @throws {TypeError} 2 arguments required
|
|
6470
|
+
* @throws {RangeError} The start of an interval cannot be after its end
|
|
6471
|
+
* @throws {RangeError} Date in interval cannot be `Invalid Date`
|
|
6472
|
+
*
|
|
6473
|
+
* @example
|
|
6474
|
+
* // For the date within the interval:
|
|
6475
|
+
* isWithinInterval(new Date(2014, 0, 3), {
|
|
6476
|
+
* start: new Date(2014, 0, 1),
|
|
6477
|
+
* end: new Date(2014, 0, 7)
|
|
6478
|
+
* })
|
|
6479
|
+
* //=> true
|
|
6480
|
+
*
|
|
6481
|
+
* @example
|
|
6482
|
+
* // For the date outside of the interval:
|
|
6483
|
+
* isWithinInterval(new Date(2014, 0, 10), {
|
|
6484
|
+
* start: new Date(2014, 0, 1),
|
|
6485
|
+
* end: new Date(2014, 0, 7)
|
|
6486
|
+
* })
|
|
6487
|
+
* //=> false
|
|
6488
|
+
*
|
|
6489
|
+
* @example
|
|
6490
|
+
* // For date equal to interval start:
|
|
6491
|
+
* isWithinInterval(date, { start, end: date }) // => true
|
|
6492
|
+
*
|
|
6493
|
+
* @example
|
|
6494
|
+
* // For date equal to interval end:
|
|
6495
|
+
* isWithinInterval(date, { start: date, end }) // => true
|
|
6496
|
+
*/
|
|
6497
|
+
function isWithinInterval(dirtyDate, interval) {
|
|
6498
|
+
requiredArgs(2, arguments);
|
|
6499
|
+
var time = toDate(dirtyDate).getTime();
|
|
6500
|
+
var startTime = toDate(interval.start).getTime();
|
|
6501
|
+
var endTime = toDate(interval.end).getTime();
|
|
6502
|
+
|
|
6503
|
+
// Throw an exception if start date is after end date or if any date is `Invalid Date`
|
|
6504
|
+
if (!(startTime <= endTime)) {
|
|
6505
|
+
throw new RangeError('Invalid interval');
|
|
6506
|
+
}
|
|
6507
|
+
return time >= startTime && time <= endTime;
|
|
6508
|
+
}
|
|
6509
|
+
|
|
6482
6510
|
/**
|
|
6483
6511
|
* @name subDays
|
|
6484
6512
|
* @category Day Helpers
|
|
@@ -11016,7 +11044,8 @@ var calendarSelectionRules = function (_a) {
|
|
|
11016
11044
|
return setCalendarRange(undefined);
|
|
11017
11045
|
}
|
|
11018
11046
|
if (
|
|
11019
|
-
// 2. If selected "start" is after "range context end", clear selection and display error
|
|
11047
|
+
// 2. If selected "start" is after "range context end", clear selection and display error.
|
|
11048
|
+
// Also, if there are unavailable dates between the rangeContext "start" and "end", do not allow a fully overlapping selection.
|
|
11020
11049
|
(rangeFrom && rangeContextTo && isAfter(rangeFrom, rangeContextTo)) ||
|
|
11021
11050
|
(calendarRangeFrom &&
|
|
11022
11051
|
calendarRangeTo &&
|
|
@@ -11037,6 +11066,17 @@ var calendarSelectionRules = function (_a) {
|
|
|
11037
11066
|
}
|
|
11038
11067
|
// 5. Handle gap selection backwards and forwards
|
|
11039
11068
|
if (
|
|
11069
|
+
// In the range context case, every date selection that is after selected "start" last checkout,
|
|
11070
|
+
// clear selection and prompt error
|
|
11071
|
+
rangeContext &&
|
|
11072
|
+
rangeTo &&
|
|
11073
|
+
(checkOutRange === null || checkOutRange === void 0 ? void 0 : checkOutRange.lastCheckOut) &&
|
|
11074
|
+
isAfter(rangeTo, endOfDay(checkOutRange.lastCheckOut)) &&
|
|
11075
|
+
isAfter(rangeTo, endOfDay(rangeContext.to))) {
|
|
11076
|
+
setCalendarHasError && setCalendarHasError(true);
|
|
11077
|
+
return setCalendarRange(undefined);
|
|
11078
|
+
}
|
|
11079
|
+
if (
|
|
11040
11080
|
// Enforce on every date selection before current "start", mark as "start" selection
|
|
11041
11081
|
rangeFrom &&
|
|
11042
11082
|
calendarRangeFrom &&
|
|
@@ -11111,62 +11151,85 @@ var disabledDatesByPage = function (_a) {
|
|
|
11111
11151
|
var handleCalendarModifiers = function (_a) {
|
|
11112
11152
|
var _b;
|
|
11113
11153
|
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;
|
|
11154
|
+
// Parse data
|
|
11155
|
+
var calendarRangeFrom = (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from) && endOfDay(calendarRange.from);
|
|
11156
|
+
var calendarRangeTo = (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) && endOfDay(calendarRange.to);
|
|
11157
|
+
var rangeContextFrom = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.from) && endOfDay(rangeContext.from);
|
|
11158
|
+
var rangeContextTo = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.to) && endOfDay(rangeContext.to);
|
|
11114
11159
|
// Create range for range context middle selection and current overlapping selection
|
|
11115
|
-
var rangeContextMiddleSelection =
|
|
11116
|
-
?
|
|
11117
|
-
|
|
11118
|
-
|
|
11119
|
-
})
|
|
11120
|
-
return !((
|
|
11121
|
-
isEqual(endOfDay(
|
|
11122
|
-
(
|
|
11123
|
-
isEqual(endOfDay(
|
|
11160
|
+
var rangeContextMiddleSelection = rangeContextFrom && rangeContextTo
|
|
11161
|
+
? eachDayOfInterval({
|
|
11162
|
+
start: addDays(rangeContextFrom, 1),
|
|
11163
|
+
end: addDays(rangeContextTo, -1),
|
|
11164
|
+
}).filter(function (date) {
|
|
11165
|
+
return !((calendarRangeFrom &&
|
|
11166
|
+
isEqual(endOfDay(calendarRangeFrom), endOfDay(date))) ||
|
|
11167
|
+
(calendarRangeTo &&
|
|
11168
|
+
isEqual(endOfDay(calendarRangeTo), endOfDay(date))) ||
|
|
11169
|
+
(calendarRangeFrom &&
|
|
11170
|
+
!calendarRangeTo &&
|
|
11171
|
+
(currentSelectionLastCheckoutDate === null || currentSelectionLastCheckoutDate === void 0 ? void 0 : currentSelectionLastCheckoutDate.lastCheckOut) &&
|
|
11172
|
+
isAfter(calendarRangeFrom, rangeContextFrom) &&
|
|
11173
|
+
isBefore(currentSelectionLastCheckoutDate === null || currentSelectionLastCheckoutDate === void 0 ? void 0 : currentSelectionLastCheckoutDate.lastCheckOut, rangeContextTo) &&
|
|
11174
|
+
isWithinInterval(date, {
|
|
11175
|
+
start: currentSelectionLastCheckoutDate.checkIn,
|
|
11176
|
+
end: currentSelectionLastCheckoutDate.lastCheckOut,
|
|
11177
|
+
})) ||
|
|
11178
|
+
(calendarRangeFrom &&
|
|
11179
|
+
calendarRangeTo &&
|
|
11180
|
+
isAfter(calendarRangeFrom, rangeContextFrom) &&
|
|
11181
|
+
isBefore(calendarRangeTo, rangeContextTo) &&
|
|
11182
|
+
isWithinInterval(date, {
|
|
11183
|
+
start: calendarRangeFrom,
|
|
11184
|
+
end: calendarRangeTo,
|
|
11185
|
+
})));
|
|
11124
11186
|
})
|
|
11125
11187
|
: [];
|
|
11188
|
+
console.log();
|
|
11126
11189
|
return {
|
|
11127
11190
|
booked: disabledDatesByPage.length
|
|
11128
11191
|
? disabledDatesByPage
|
|
11129
11192
|
: (disabledDates === null || disabledDates === void 0 ? void 0 : disabledDates.length)
|
|
11130
11193
|
? __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)
|
|
11131
11194
|
? __spreadArray$1(__spreadArray$1(__spreadArray$1([], __read(newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates), false), __read(firstPossibleRangeContextCheckIn), false), __read(lastPossibleRangeContextCheckOut), false) : [],
|
|
11132
|
-
disabledAfterCheckIn:
|
|
11133
|
-
? [{ after:
|
|
11195
|
+
disabledAfterCheckIn: calendarRangeFrom
|
|
11196
|
+
? [{ after: calendarRangeFrom }]
|
|
11134
11197
|
: [],
|
|
11135
|
-
overlappingDate: __spreadArray$1([], __read((!
|
|
11198
|
+
overlappingDate: __spreadArray$1([], __read((!calendarRangeFrom && !!(overlappingDate === null || overlappingDate === void 0 ? void 0 : overlappingDate.length)
|
|
11136
11199
|
? overlappingDate.map(function (date) { return ({ from: date.from }); })
|
|
11137
11200
|
: [])), false),
|
|
11138
|
-
noActiveSelectionStart:
|
|
11139
|
-
!(
|
|
11140
|
-
|
|
11141
|
-
((
|
|
11142
|
-
|
|
11143
|
-
? rangeContext.from
|
|
11144
|
-
: [],
|
|
11145
|
-
noActiveSelectionEnd: (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.to) &&
|
|
11146
|
-
!(((calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from) &&
|
|
11147
|
-
isEqual(endOfDay(rangeContext.to), endOfDay(calendarRange.from))) ||
|
|
11148
|
-
((calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) &&
|
|
11149
|
-
isEqual(endOfDay(rangeContext.to), endOfDay(calendarRange.to))))
|
|
11150
|
-
? rangeContext.to
|
|
11201
|
+
noActiveSelectionStart: rangeContextFrom &&
|
|
11202
|
+
!(calendarRangeFrom &&
|
|
11203
|
+
rangeContextFrom &&
|
|
11204
|
+
isEqual(endOfDay(rangeContextFrom), endOfDay(calendarRangeFrom)))
|
|
11205
|
+
? rangeContextFrom
|
|
11151
11206
|
: [],
|
|
11152
11207
|
noActiveSelectionMid: __spreadArray$1([], __read((rangeContextMiddleSelection.length
|
|
11153
11208
|
? rangeContextMiddleSelection
|
|
11154
11209
|
: [])), false),
|
|
11155
|
-
|
|
11156
|
-
!(
|
|
11210
|
+
noActiveSelectionEnd: rangeContextTo &&
|
|
11211
|
+
!(calendarRangeFrom &&
|
|
11212
|
+
rangeContextTo &&
|
|
11213
|
+
isEqual(endOfDay(rangeContextTo), endOfDay(calendarRangeFrom)))
|
|
11214
|
+
? rangeContextTo
|
|
11215
|
+
: [],
|
|
11216
|
+
checkoutOptionsMid: __spreadArray$1([], __read((calendarRangeFrom &&
|
|
11217
|
+
!calendarRangeTo &&
|
|
11157
11218
|
(currentSelectionLastCheckoutDate === null || currentSelectionLastCheckoutDate === void 0 ? void 0 : currentSelectionLastCheckoutDate.lastCheckOut)
|
|
11158
11219
|
? [
|
|
11159
11220
|
{
|
|
11160
|
-
after:
|
|
11221
|
+
after: calendarRangeFrom,
|
|
11161
11222
|
before: addDays(currentSelectionLastCheckoutDate.lastCheckOut, 1),
|
|
11162
11223
|
},
|
|
11163
11224
|
]
|
|
11164
11225
|
: [])), false),
|
|
11165
|
-
checkInOnly: __spreadArray$1([], __read(((findFirstPossibleRangeContextCheckIn === null || findFirstPossibleRangeContextCheckIn === void 0 ? void 0 : findFirstPossibleRangeContextCheckIn.checkIn) &&
|
|
11226
|
+
checkInOnly: __spreadArray$1([], __read(((findFirstPossibleRangeContextCheckIn === null || findFirstPossibleRangeContextCheckIn === void 0 ? void 0 : findFirstPossibleRangeContextCheckIn.checkIn) &&
|
|
11227
|
+
rangeContext &&
|
|
11228
|
+
rangeContextFrom
|
|
11166
11229
|
? [
|
|
11167
11230
|
{
|
|
11168
11231
|
from: findFirstPossibleRangeContextCheckIn.checkIn,
|
|
11169
|
-
to: addDays(
|
|
11232
|
+
to: addDays(rangeContextFrom, -1),
|
|
11170
11233
|
},
|
|
11171
11234
|
]
|
|
11172
11235
|
: [])), false),
|
|
@@ -11245,12 +11308,14 @@ var checkForContinuousSelection = function (_a) {
|
|
|
11245
11308
|
? isAfter(endOfDay(calendarRangeTo), endOfDay(rangeContextFrom)) ||
|
|
11246
11309
|
isEqual(endOfDay(calendarRangeTo), endOfDay(rangeContextFrom))
|
|
11247
11310
|
: null;
|
|
11248
|
-
|
|
11249
|
-
|
|
11250
|
-
|
|
11251
|
-
|
|
11252
|
-
|
|
11253
|
-
|
|
11311
|
+
useEffect(function () {
|
|
11312
|
+
if ((rangeContext &&
|
|
11313
|
+
calendarRangeFrom &&
|
|
11314
|
+
!startIsEqualOrBeforeRangeContextEnd) ||
|
|
11315
|
+
(rangeContext && calendarRangeTo && !endIsEqualOrAfterRangeContextStart)) {
|
|
11316
|
+
setCalendarHasError && !calendarHasError && setCalendarHasError(true);
|
|
11317
|
+
}
|
|
11318
|
+
});
|
|
11254
11319
|
};
|
|
11255
11320
|
|
|
11256
11321
|
var useCalendarTooltips = function (_a) {
|