willba-component-library 0.2.59 → 0.2.61
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 +173 -113
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +173 -113
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +173 -113
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterCalendar/FilterCalendar.stories.tsx +42 -69
- package/src/components/FilterCalendar/FilterCalendar.tsx +1 -1
- package/src/core/components/calendar/Calendar.tsx +0 -2
- package/src/core/components/calendar/hooks/useCalendarTooltips.tsx +0 -1
- package/src/core/components/calendar/utils/calendarSelectionRules.tsx +17 -2
- package/src/core/components/calendar/utils/handleCalendarModifiers.tsx +69 -31
- package/src/themes/Default.css +1 -1
|
@@ -25,10 +25,7 @@ export declare const handleCalendarModifiers: ({ newDisableCalendarDates, calend
|
|
|
25
25
|
from: Date | undefined;
|
|
26
26
|
}[];
|
|
27
27
|
noActiveSelectionStart: never[] | Date;
|
|
28
|
-
noActiveSelectionMid:
|
|
29
|
-
from: Date;
|
|
30
|
-
to: Date;
|
|
31
|
-
}[];
|
|
28
|
+
noActiveSelectionMid: Date[];
|
|
32
29
|
noActiveSelectionEnd: never[] | Date;
|
|
33
30
|
checkoutOptionsMid: {
|
|
34
31
|
after: 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
|
|
@@ -11010,14 +11038,14 @@ var calendarSelectionRules = function (_a) {
|
|
|
11010
11038
|
// Calendar selection rules: The cases are handled sequentially, starting from simple selections to more complex contextual selections.
|
|
11011
11039
|
// The rules are processed in a specific order, so one case is handled before another.
|
|
11012
11040
|
// Changing the order will cause the rules to break or not work properly.
|
|
11013
|
-
console.log(overlappingDateTo);
|
|
11014
11041
|
if (!!overlappingDateFrom ||
|
|
11015
11042
|
(calendarRangeFrom && calendarRangeTo && overlappingDateTo)) {
|
|
11016
11043
|
// 1. If dates overlap, clear the selection.
|
|
11017
11044
|
return setCalendarRange(undefined);
|
|
11018
11045
|
}
|
|
11019
11046
|
if (
|
|
11020
|
-
// 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.
|
|
11021
11049
|
(rangeFrom && rangeContextTo && isAfter(rangeFrom, rangeContextTo)) ||
|
|
11022
11050
|
(calendarRangeFrom &&
|
|
11023
11051
|
calendarRangeTo &&
|
|
@@ -11038,6 +11066,16 @@ var calendarSelectionRules = function (_a) {
|
|
|
11038
11066
|
}
|
|
11039
11067
|
// 5. Handle gap selection backwards and forwards
|
|
11040
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
|
+
setCalendarHasError && setCalendarHasError(true);
|
|
11076
|
+
return setCalendarRange(undefined);
|
|
11077
|
+
}
|
|
11078
|
+
if (
|
|
11041
11079
|
// Enforce on every date selection before current "start", mark as "start" selection
|
|
11042
11080
|
rangeFrom &&
|
|
11043
11081
|
calendarRangeFrom &&
|
|
@@ -11112,60 +11150,85 @@ var disabledDatesByPage = function (_a) {
|
|
|
11112
11150
|
var handleCalendarModifiers = function (_a) {
|
|
11113
11151
|
var _b;
|
|
11114
11152
|
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;
|
|
11153
|
+
// Parse data
|
|
11154
|
+
var calendarRangeFrom = (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from) && endOfDay(calendarRange.from);
|
|
11155
|
+
var calendarRangeTo = (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) && endOfDay(calendarRange.to);
|
|
11156
|
+
var rangeContextFrom = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.from) && endOfDay(rangeContext.from);
|
|
11157
|
+
var rangeContextTo = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.to) && endOfDay(rangeContext.to);
|
|
11115
11158
|
// Create range for range context middle selection and current overlapping selection
|
|
11116
|
-
var rangeContextMiddleSelection =
|
|
11117
|
-
?
|
|
11118
|
-
|
|
11119
|
-
|
|
11120
|
-
})
|
|
11121
|
-
return !((
|
|
11122
|
-
isEqual(endOfDay(
|
|
11123
|
-
(
|
|
11124
|
-
isEqual(endOfDay(
|
|
11159
|
+
var rangeContextMiddleSelection = rangeContextFrom && rangeContextTo
|
|
11160
|
+
? eachDayOfInterval({
|
|
11161
|
+
start: addDays(rangeContextFrom, 1),
|
|
11162
|
+
end: addDays(rangeContextTo, -1),
|
|
11163
|
+
}).filter(function (date) {
|
|
11164
|
+
return !((calendarRangeFrom &&
|
|
11165
|
+
isEqual(endOfDay(calendarRangeFrom), endOfDay(date))) ||
|
|
11166
|
+
(calendarRangeTo &&
|
|
11167
|
+
isEqual(endOfDay(calendarRangeTo), endOfDay(date))) ||
|
|
11168
|
+
(calendarRangeFrom &&
|
|
11169
|
+
!calendarRangeTo &&
|
|
11170
|
+
(currentSelectionLastCheckoutDate === null || currentSelectionLastCheckoutDate === void 0 ? void 0 : currentSelectionLastCheckoutDate.lastCheckOut) &&
|
|
11171
|
+
isAfter(calendarRangeFrom, rangeContextFrom) &&
|
|
11172
|
+
isBefore(currentSelectionLastCheckoutDate === null || currentSelectionLastCheckoutDate === void 0 ? void 0 : currentSelectionLastCheckoutDate.lastCheckOut, rangeContextTo) &&
|
|
11173
|
+
isWithinInterval(date, {
|
|
11174
|
+
start: currentSelectionLastCheckoutDate.checkIn,
|
|
11175
|
+
end: currentSelectionLastCheckoutDate.lastCheckOut,
|
|
11176
|
+
})) ||
|
|
11177
|
+
(calendarRangeFrom &&
|
|
11178
|
+
calendarRangeTo &&
|
|
11179
|
+
isAfter(calendarRangeFrom, rangeContextFrom) &&
|
|
11180
|
+
isBefore(calendarRangeTo, rangeContextTo) &&
|
|
11181
|
+
isWithinInterval(date, {
|
|
11182
|
+
start: calendarRangeFrom,
|
|
11183
|
+
end: calendarRangeTo,
|
|
11184
|
+
})));
|
|
11125
11185
|
})
|
|
11126
11186
|
: [];
|
|
11187
|
+
console.log();
|
|
11127
11188
|
return {
|
|
11128
11189
|
booked: disabledDatesByPage.length
|
|
11129
11190
|
? disabledDatesByPage
|
|
11130
11191
|
: (disabledDates === null || disabledDates === void 0 ? void 0 : disabledDates.length)
|
|
11131
11192
|
? __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)
|
|
11132
11193
|
? __spreadArray$1(__spreadArray$1(__spreadArray$1([], __read(newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates), false), __read(firstPossibleRangeContextCheckIn), false), __read(lastPossibleRangeContextCheckOut), false) : [],
|
|
11133
|
-
disabledAfterCheckIn:
|
|
11134
|
-
? [{ after:
|
|
11194
|
+
disabledAfterCheckIn: calendarRangeFrom
|
|
11195
|
+
? [{ after: calendarRangeFrom }]
|
|
11135
11196
|
: [],
|
|
11136
|
-
overlappingDate: __spreadArray$1([], __read((!
|
|
11197
|
+
overlappingDate: __spreadArray$1([], __read((!calendarRangeFrom && !!(overlappingDate === null || overlappingDate === void 0 ? void 0 : overlappingDate.length)
|
|
11137
11198
|
? overlappingDate.map(function (date) { return ({ from: date.from }); })
|
|
11138
11199
|
: [])), false),
|
|
11139
|
-
noActiveSelectionStart:
|
|
11140
|
-
!(
|
|
11141
|
-
|
|
11142
|
-
isEqual(endOfDay(
|
|
11143
|
-
?
|
|
11200
|
+
noActiveSelectionStart: rangeContextFrom &&
|
|
11201
|
+
!(calendarRangeFrom &&
|
|
11202
|
+
rangeContextFrom &&
|
|
11203
|
+
isEqual(endOfDay(rangeContextFrom), endOfDay(calendarRangeFrom)))
|
|
11204
|
+
? rangeContextFrom
|
|
11144
11205
|
: [],
|
|
11145
11206
|
noActiveSelectionMid: __spreadArray$1([], __read((rangeContextMiddleSelection.length
|
|
11146
11207
|
? rangeContextMiddleSelection
|
|
11147
11208
|
: [])), false),
|
|
11148
|
-
noActiveSelectionEnd:
|
|
11149
|
-
!(
|
|
11150
|
-
|
|
11151
|
-
isEqual(endOfDay(
|
|
11152
|
-
?
|
|
11209
|
+
noActiveSelectionEnd: rangeContextTo &&
|
|
11210
|
+
!(calendarRangeFrom &&
|
|
11211
|
+
rangeContextTo &&
|
|
11212
|
+
isEqual(endOfDay(rangeContextTo), endOfDay(calendarRangeFrom)))
|
|
11213
|
+
? rangeContextTo
|
|
11153
11214
|
: [],
|
|
11154
|
-
checkoutOptionsMid: __spreadArray$1([], __read((
|
|
11155
|
-
!
|
|
11215
|
+
checkoutOptionsMid: __spreadArray$1([], __read((calendarRangeFrom &&
|
|
11216
|
+
!calendarRangeTo &&
|
|
11156
11217
|
(currentSelectionLastCheckoutDate === null || currentSelectionLastCheckoutDate === void 0 ? void 0 : currentSelectionLastCheckoutDate.lastCheckOut)
|
|
11157
11218
|
? [
|
|
11158
11219
|
{
|
|
11159
|
-
after:
|
|
11220
|
+
after: calendarRangeFrom,
|
|
11160
11221
|
before: addDays(currentSelectionLastCheckoutDate.lastCheckOut, 1),
|
|
11161
11222
|
},
|
|
11162
11223
|
]
|
|
11163
11224
|
: [])), false),
|
|
11164
|
-
checkInOnly: __spreadArray$1([], __read(((findFirstPossibleRangeContextCheckIn === null || findFirstPossibleRangeContextCheckIn === void 0 ? void 0 : findFirstPossibleRangeContextCheckIn.checkIn) &&
|
|
11225
|
+
checkInOnly: __spreadArray$1([], __read(((findFirstPossibleRangeContextCheckIn === null || findFirstPossibleRangeContextCheckIn === void 0 ? void 0 : findFirstPossibleRangeContextCheckIn.checkIn) &&
|
|
11226
|
+
rangeContext &&
|
|
11227
|
+
rangeContextFrom
|
|
11165
11228
|
? [
|
|
11166
11229
|
{
|
|
11167
11230
|
from: findFirstPossibleRangeContextCheckIn.checkIn,
|
|
11168
|
-
to: addDays(
|
|
11231
|
+
to: addDays(rangeContextFrom, -1),
|
|
11169
11232
|
},
|
|
11170
11233
|
]
|
|
11171
11234
|
: [])), false),
|
|
@@ -11255,7 +11318,6 @@ var checkForContinuousSelection = function (_a) {
|
|
|
11255
11318
|
var useCalendarTooltips = function (_a) {
|
|
11256
11319
|
var showFeedback = _a.showFeedback;
|
|
11257
11320
|
return useEffect(function () {
|
|
11258
|
-
console.log('3');
|
|
11259
11321
|
if (typeof document === 'undefined' || !showFeedback)
|
|
11260
11322
|
return;
|
|
11261
11323
|
// Children
|
|
@@ -11419,7 +11481,6 @@ var Calendar = forwardRef(function (_a, ref) {
|
|
|
11419
11481
|
selectedPath: selectedPath,
|
|
11420
11482
|
newDisableCalendarDates: newDisableCalendarDates,
|
|
11421
11483
|
});
|
|
11422
|
-
console.log('2', t('noCheckIn'));
|
|
11423
11484
|
// Handle tooltip
|
|
11424
11485
|
useCalendarTooltips({
|
|
11425
11486
|
showFeedback: showFeedback,
|
|
@@ -11985,7 +12046,6 @@ function FilterCalendar(_a) {
|
|
|
11985
12046
|
// Translations
|
|
11986
12047
|
useUpdateTranslations({ language: language });
|
|
11987
12048
|
var t = useTranslation().t;
|
|
11988
|
-
console.log('1', t('noCheckIn'));
|
|
11989
12049
|
var _b = useFilterCalendar({
|
|
11990
12050
|
onSubmit: onSubmit,
|
|
11991
12051
|
setToggleCalendar: setToggleCalendar,
|