willba-component-library 0.2.68 → 0.2.70
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 +4 -1
- package/lib/index.esm.js +26 -175
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +26 -175
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +26 -175
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterCalendar/FilterCalendar.stories.tsx +4 -4
- package/src/components/FilterCalendar/hooks/useFilterCalendar.ts +7 -0
- package/src/core/components/calendar/Calendar.css +37 -13
- package/src/core/components/calendar/Calendar.tsx +7 -9
- package/src/core/components/calendar/utils/calendarSelectionRules.tsx +2 -0
- package/src/core/components/calendar/utils/handleCalendarModifiers.tsx +6 -70
- package/src/locales/en/common.json +1 -2
- package/src/locales/fi/common.json +1 -2
|
@@ -26,7 +26,10 @@ export declare const handleCalendarModifiers: ({ newDisableCalendarDates, calend
|
|
|
26
26
|
from: Date | undefined;
|
|
27
27
|
}[];
|
|
28
28
|
noActiveSelectionStart: never[] | Date;
|
|
29
|
-
noActiveSelectionMid:
|
|
29
|
+
noActiveSelectionMid: (never[] | {
|
|
30
|
+
after: Date;
|
|
31
|
+
before: Date;
|
|
32
|
+
})[];
|
|
30
33
|
noActiveSelectionEnd: never[] | Date;
|
|
31
34
|
checkoutOptionsMid: {
|
|
32
35
|
after: Date;
|
package/lib/index.esm.js
CHANGED
|
@@ -2856,8 +2856,7 @@ var clearDates$1 = "Clear dates";
|
|
|
2856
2856
|
var noCheckIn$1 = "Room not available";
|
|
2857
2857
|
var noCheckOut$1 = "Check-out not available";
|
|
2858
2858
|
var checkOutOnly$1 = "Check-out only";
|
|
2859
|
-
var
|
|
2860
|
-
var onlyCheckIn$1 = "Check-out only";
|
|
2859
|
+
var checkInOnly$1 = "Check-in only";
|
|
2861
2860
|
var errors$1 = {
|
|
2862
2861
|
calendarErrors: {
|
|
2863
2862
|
checkInAvailabilityError: "Check-in available for second room only with connection dates",
|
|
@@ -2875,8 +2874,7 @@ var enCommon = {
|
|
|
2875
2874
|
noCheckIn: noCheckIn$1,
|
|
2876
2875
|
noCheckOut: noCheckOut$1,
|
|
2877
2876
|
checkOutOnly: checkOutOnly$1,
|
|
2878
|
-
|
|
2879
|
-
onlyCheckIn: onlyCheckIn$1,
|
|
2877
|
+
checkInOnly: checkInOnly$1,
|
|
2880
2878
|
errors: errors$1
|
|
2881
2879
|
};
|
|
2882
2880
|
|
|
@@ -2927,8 +2925,7 @@ var clearDates = "Tyhjennä";
|
|
|
2927
2925
|
var noCheckIn = "Huone ei saatavilla";
|
|
2928
2926
|
var noCheckOut = "Uloskirjaus ei saatavilla";
|
|
2929
2927
|
var checkOutOnly = "Vain uloskirjaus";
|
|
2930
|
-
var
|
|
2931
|
-
var onlyCheckIn = "Check-out only";
|
|
2928
|
+
var checkInOnly = "Check-in only";
|
|
2932
2929
|
var errors = {
|
|
2933
2930
|
calendarErrors: {
|
|
2934
2931
|
checkInAvailabilityError: "Check-in available for second room only with connection dates",
|
|
@@ -2946,8 +2943,7 @@ var fiCommon = {
|
|
|
2946
2943
|
noCheckIn: noCheckIn,
|
|
2947
2944
|
noCheckOut: noCheckOut,
|
|
2948
2945
|
checkOutOnly: checkOutOnly,
|
|
2949
|
-
|
|
2950
|
-
onlyCheckIn: onlyCheckIn,
|
|
2946
|
+
checkInOnly: checkInOnly,
|
|
2951
2947
|
errors: errors
|
|
2952
2948
|
};
|
|
2953
2949
|
|
|
@@ -3881,62 +3877,6 @@ function endOfMonth(dirtyDate) {
|
|
|
3881
3877
|
return date;
|
|
3882
3878
|
}
|
|
3883
3879
|
|
|
3884
|
-
/**
|
|
3885
|
-
* @name eachDayOfInterval
|
|
3886
|
-
* @category Interval Helpers
|
|
3887
|
-
* @summary Return the array of dates within the specified time interval.
|
|
3888
|
-
*
|
|
3889
|
-
* @description
|
|
3890
|
-
* Return the array of dates within the specified time interval.
|
|
3891
|
-
*
|
|
3892
|
-
* @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
|
|
3893
|
-
* @param {Object} [options] - an object with options.
|
|
3894
|
-
* @param {Number} [options.step=1] - the step to increment by. The value should be more than 1.
|
|
3895
|
-
* @returns {Date[]} the array with starts of days from the day of the interval start to the day of the interval end
|
|
3896
|
-
* @throws {TypeError} 1 argument required
|
|
3897
|
-
* @throws {RangeError} `options.step` must be a number greater than 1
|
|
3898
|
-
* @throws {RangeError} The start of an interval cannot be after its end
|
|
3899
|
-
* @throws {RangeError} Date in interval cannot be `Invalid Date`
|
|
3900
|
-
*
|
|
3901
|
-
* @example
|
|
3902
|
-
* // Each day between 6 October 2014 and 10 October 2014:
|
|
3903
|
-
* const result = eachDayOfInterval({
|
|
3904
|
-
* start: new Date(2014, 9, 6),
|
|
3905
|
-
* end: new Date(2014, 9, 10)
|
|
3906
|
-
* })
|
|
3907
|
-
* //=> [
|
|
3908
|
-
* // Mon Oct 06 2014 00:00:00,
|
|
3909
|
-
* // Tue Oct 07 2014 00:00:00,
|
|
3910
|
-
* // Wed Oct 08 2014 00:00:00,
|
|
3911
|
-
* // Thu Oct 09 2014 00:00:00,
|
|
3912
|
-
* // Fri Oct 10 2014 00:00:00
|
|
3913
|
-
* // ]
|
|
3914
|
-
*/
|
|
3915
|
-
function eachDayOfInterval(dirtyInterval, options) {
|
|
3916
|
-
var _options$step;
|
|
3917
|
-
requiredArgs(1, arguments);
|
|
3918
|
-
var interval = dirtyInterval || {};
|
|
3919
|
-
var startDate = toDate(interval.start);
|
|
3920
|
-
var endDate = toDate(interval.end);
|
|
3921
|
-
var endTime = endDate.getTime();
|
|
3922
|
-
|
|
3923
|
-
// Throw an exception if start date is after end date or if any date is `Invalid Date`
|
|
3924
|
-
if (!(startDate.getTime() <= endTime)) {
|
|
3925
|
-
throw new RangeError('Invalid interval');
|
|
3926
|
-
}
|
|
3927
|
-
var dates = [];
|
|
3928
|
-
var currentDate = startDate;
|
|
3929
|
-
currentDate.setHours(0, 0, 0, 0);
|
|
3930
|
-
var step = Number((_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1);
|
|
3931
|
-
if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number greater than 1');
|
|
3932
|
-
while (currentDate.getTime() <= endTime) {
|
|
3933
|
-
dates.push(toDate(currentDate));
|
|
3934
|
-
currentDate.setDate(currentDate.getDate() + step);
|
|
3935
|
-
currentDate.setHours(0, 0, 0, 0);
|
|
3936
|
-
}
|
|
3937
|
-
return dates;
|
|
3938
|
-
}
|
|
3939
|
-
|
|
3940
3880
|
/**
|
|
3941
3881
|
* @name startOfMonth
|
|
3942
3882
|
* @category Month Helpers
|
|
@@ -6526,58 +6466,6 @@ function isSameYear(dirtyDateLeft, dirtyDateRight) {
|
|
|
6526
6466
|
return dateLeft.getFullYear() === dateRight.getFullYear();
|
|
6527
6467
|
}
|
|
6528
6468
|
|
|
6529
|
-
/**
|
|
6530
|
-
* @name isWithinInterval
|
|
6531
|
-
* @category Interval Helpers
|
|
6532
|
-
* @summary Is the given date within the interval?
|
|
6533
|
-
*
|
|
6534
|
-
* @description
|
|
6535
|
-
* Is the given date within the interval? (Including start and end.)
|
|
6536
|
-
*
|
|
6537
|
-
* @param {Date|Number} date - the date to check
|
|
6538
|
-
* @param {Interval} interval - the interval to check
|
|
6539
|
-
* @returns {Boolean} the date is within the interval
|
|
6540
|
-
* @throws {TypeError} 2 arguments required
|
|
6541
|
-
* @throws {RangeError} The start of an interval cannot be after its end
|
|
6542
|
-
* @throws {RangeError} Date in interval cannot be `Invalid Date`
|
|
6543
|
-
*
|
|
6544
|
-
* @example
|
|
6545
|
-
* // For the date within the interval:
|
|
6546
|
-
* isWithinInterval(new Date(2014, 0, 3), {
|
|
6547
|
-
* start: new Date(2014, 0, 1),
|
|
6548
|
-
* end: new Date(2014, 0, 7)
|
|
6549
|
-
* })
|
|
6550
|
-
* //=> true
|
|
6551
|
-
*
|
|
6552
|
-
* @example
|
|
6553
|
-
* // For the date outside of the interval:
|
|
6554
|
-
* isWithinInterval(new Date(2014, 0, 10), {
|
|
6555
|
-
* start: new Date(2014, 0, 1),
|
|
6556
|
-
* end: new Date(2014, 0, 7)
|
|
6557
|
-
* })
|
|
6558
|
-
* //=> false
|
|
6559
|
-
*
|
|
6560
|
-
* @example
|
|
6561
|
-
* // For date equal to interval start:
|
|
6562
|
-
* isWithinInterval(date, { start, end: date }) // => true
|
|
6563
|
-
*
|
|
6564
|
-
* @example
|
|
6565
|
-
* // For date equal to interval end:
|
|
6566
|
-
* isWithinInterval(date, { start: date, end }) // => true
|
|
6567
|
-
*/
|
|
6568
|
-
function isWithinInterval(dirtyDate, interval) {
|
|
6569
|
-
requiredArgs(2, arguments);
|
|
6570
|
-
var time = toDate(dirtyDate).getTime();
|
|
6571
|
-
var startTime = toDate(interval.start).getTime();
|
|
6572
|
-
var endTime = toDate(interval.end).getTime();
|
|
6573
|
-
|
|
6574
|
-
// Throw an exception if start date is after end date or if any date is `Invalid Date`
|
|
6575
|
-
if (!(startTime <= endTime)) {
|
|
6576
|
-
throw new RangeError('Invalid interval');
|
|
6577
|
-
}
|
|
6578
|
-
return time >= startTime && time <= endTime;
|
|
6579
|
-
}
|
|
6580
|
-
|
|
6581
6469
|
/**
|
|
6582
6470
|
* @name subDays
|
|
6583
6471
|
* @category Day Helpers
|
|
@@ -11184,22 +11072,18 @@ var calendarSelectionRules = function (_a) {
|
|
|
11184
11072
|
};
|
|
11185
11073
|
/////////
|
|
11186
11074
|
var disableFutureDates = function (_a) {
|
|
11187
|
-
var rangeFrom = _a.rangeFrom, checkOutRange = _a.checkOutRange, setDisabledDates = _a.setDisabledDates
|
|
11075
|
+
var rangeFrom = _a.rangeFrom, checkOutRange = _a.checkOutRange, setDisabledDates = _a.setDisabledDates, newDisableCalendarDates = _a.newDisableCalendarDates;
|
|
11188
11076
|
if (rangeFrom && checkOutRange && setDisabledDates) {
|
|
11189
11077
|
// Get parse data
|
|
11190
11078
|
var checkIn = addDays(checkOutRange.checkIn, 1);
|
|
11191
11079
|
var firstCheckOut = addDays(checkOutRange.firstCheckOut, -1);
|
|
11192
11080
|
var noDatesRange = isEqual(checkIn, checkOutRange.firstCheckOut);
|
|
11193
|
-
setDisabledDates([
|
|
11194
|
-
// Will disable all dates before the check-in date
|
|
11195
|
-
// { before: findCheckOutRange?.checkIn },
|
|
11081
|
+
setDisabledDates(__spreadArray$1(__spreadArray$1([], __read(((newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates) || [])), false), [
|
|
11196
11082
|
{
|
|
11197
11083
|
from: noDatesRange ? undefined : checkIn,
|
|
11198
11084
|
to: noDatesRange ? undefined : firstCheckOut,
|
|
11199
11085
|
},
|
|
11200
|
-
|
|
11201
|
-
//{ after: checkOutRange?.lastCheckOut },
|
|
11202
|
-
]);
|
|
11086
|
+
], false));
|
|
11203
11087
|
}
|
|
11204
11088
|
};
|
|
11205
11089
|
|
|
@@ -11231,35 +11115,6 @@ var handleCalendarModifiers = function (_a) {
|
|
|
11231
11115
|
var calendarRangeTo = (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) && endOfDay(calendarRange.to);
|
|
11232
11116
|
var rangeContextFrom = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.from) && endOfDay(rangeContext.from);
|
|
11233
11117
|
var rangeContextTo = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.to) && endOfDay(rangeContext.to);
|
|
11234
|
-
// Create range for range context middle selection and current overlapping selection
|
|
11235
|
-
var rangeContextMiddleSelection = rangeContextFrom && rangeContextTo
|
|
11236
|
-
? eachDayOfInterval({
|
|
11237
|
-
start: addDays(rangeContextFrom, 1),
|
|
11238
|
-
end: addDays(rangeContextTo, -1),
|
|
11239
|
-
}).filter(function (date) {
|
|
11240
|
-
return !((calendarRangeFrom &&
|
|
11241
|
-
isEqual(endOfDay(calendarRangeFrom), endOfDay(date))) ||
|
|
11242
|
-
(calendarRangeTo &&
|
|
11243
|
-
isEqual(endOfDay(calendarRangeTo), endOfDay(date))) ||
|
|
11244
|
-
(calendarRangeFrom &&
|
|
11245
|
-
!calendarRangeTo &&
|
|
11246
|
-
(currentSelectionLastCheckoutDate === null || currentSelectionLastCheckoutDate === void 0 ? void 0 : currentSelectionLastCheckoutDate.lastCheckOut) &&
|
|
11247
|
-
isAfter(calendarRangeFrom, rangeContextFrom) &&
|
|
11248
|
-
isBefore(currentSelectionLastCheckoutDate === null || currentSelectionLastCheckoutDate === void 0 ? void 0 : currentSelectionLastCheckoutDate.lastCheckOut, rangeContextTo) &&
|
|
11249
|
-
isWithinInterval(date, {
|
|
11250
|
-
start: currentSelectionLastCheckoutDate.checkIn,
|
|
11251
|
-
end: currentSelectionLastCheckoutDate.lastCheckOut,
|
|
11252
|
-
})) ||
|
|
11253
|
-
(calendarRangeFrom &&
|
|
11254
|
-
calendarRangeTo &&
|
|
11255
|
-
isAfter(calendarRangeFrom, rangeContextFrom) &&
|
|
11256
|
-
isBefore(calendarRangeTo, rangeContextTo) &&
|
|
11257
|
-
isWithinInterval(date, {
|
|
11258
|
-
start: calendarRangeFrom,
|
|
11259
|
-
end: calendarRangeTo,
|
|
11260
|
-
})));
|
|
11261
|
-
})
|
|
11262
|
-
: [];
|
|
11263
11118
|
return {
|
|
11264
11119
|
booked: disabledDatesByPage.length
|
|
11265
11120
|
? disabledDatesByPage
|
|
@@ -11276,21 +11131,13 @@ var handleCalendarModifiers = function (_a) {
|
|
|
11276
11131
|
overlappingDate: __spreadArray$1([], __read((!calendarRangeFrom && !!(overlappingDate === null || overlappingDate === void 0 ? void 0 : overlappingDate.length)
|
|
11277
11132
|
? overlappingDate.map(function (date) { return ({ from: date.from }); })
|
|
11278
11133
|
: [])), false),
|
|
11279
|
-
noActiveSelectionStart: rangeContextFrom
|
|
11280
|
-
|
|
11281
|
-
|
|
11282
|
-
|
|
11283
|
-
|
|
11284
|
-
|
|
11285
|
-
|
|
11286
|
-
? rangeContextMiddleSelection
|
|
11287
|
-
: [])), false),
|
|
11288
|
-
noActiveSelectionEnd: rangeContextTo &&
|
|
11289
|
-
!(calendarRangeFrom &&
|
|
11290
|
-
rangeContextTo &&
|
|
11291
|
-
isEqual(endOfDay(rangeContextTo), endOfDay(calendarRangeFrom)))
|
|
11292
|
-
? rangeContextTo
|
|
11293
|
-
: [],
|
|
11134
|
+
noActiveSelectionStart: rangeContextFrom || [],
|
|
11135
|
+
noActiveSelectionMid: [
|
|
11136
|
+
rangeContextFrom && rangeContextTo
|
|
11137
|
+
? { after: rangeContextFrom, before: rangeContextTo }
|
|
11138
|
+
: [],
|
|
11139
|
+
],
|
|
11140
|
+
noActiveSelectionEnd: rangeContextTo || [],
|
|
11294
11141
|
checkoutOptionsMid: __spreadArray$1([], __read((calendarRangeFrom &&
|
|
11295
11142
|
!calendarRangeTo &&
|
|
11296
11143
|
(currentSelectionLastCheckoutDate === null || currentSelectionLastCheckoutDate === void 0 ? void 0 : currentSelectionLastCheckoutDate.lastCheckOut)
|
|
@@ -11547,7 +11394,7 @@ var useUpdateDisabledDates = function (_a) {
|
|
|
11547
11394
|
var css_248z$9 = ".rdp {\n --rdp-cell-size: 40px;\n --rdp-caption-font-size: 18px;\n --rdp-accent-color: #0000ff;\n --rdp-background-color: #e7edff;\n --rdp-accent-color-dark: #3003e1;\n --rdp-background-color-dark: #180270;\n --rdp-outline: 2px solid var(--rdp-accent-color); /* Outline border for focused elements */\n --rdp-outline-selected: 3px solid var(--rdp-accent-color); /* Outline border for focused _and_ selected elements */\n\n margin: 1em;\n}\n\n/* Hide elements for devices that are not screen readers */\n.rdp-vhidden {\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n background: transparent;\n border: 0;\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n position: absolute !important;\n top: 0;\n width: 1px !important;\n height: 1px !important;\n padding: 0 !important;\n overflow: hidden !important;\n clip: rect(1px, 1px, 1px, 1px) !important;\n border: 0 !important;\n}\n\n/* Buttons */\n.rdp-button_reset {\n appearance: none;\n position: relative;\n margin: 0;\n padding: 0;\n cursor: default;\n color: inherit;\n background: none;\n font: inherit;\n\n -moz-appearance: none;\n -webkit-appearance: none;\n}\n\n.rdp-button_reset:focus-visible {\n /* Make sure to reset outline only when :focus-visible is supported */\n outline: none;\n}\n\n.rdp-button {\n border: 2px solid transparent;\n}\n\n.rdp-button[disabled]:not(.rdp-day_selected) {\n opacity: 0.25;\n}\n\n.rdp-button:not([disabled]) {\n cursor: pointer;\n}\n\n.rdp-button:focus-visible:not([disabled]) {\n color: inherit;\n background-color: var(--rdp-background-color);\n border: var(--rdp-outline);\n}\n\n.rdp-button:hover:not([disabled]):not(.rdp-day_selected) {\n background-color: var(--rdp-background-color);\n}\n\n.rdp-months {\n display: flex;\n}\n\n.rdp-month {\n margin: 0 1em;\n}\n\n.rdp-month:first-child {\n margin-left: 0;\n}\n\n.rdp-month:last-child {\n margin-right: 0;\n}\n\n.rdp-table {\n margin: 0;\n max-width: calc(var(--rdp-cell-size) * 7);\n border-collapse: collapse;\n}\n\n.rdp-with_weeknumber .rdp-table {\n max-width: calc(var(--rdp-cell-size) * 8);\n border-collapse: collapse;\n}\n\n.rdp-caption {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0;\n text-align: left;\n}\n\n.rdp-multiple_months .rdp-caption {\n position: relative;\n display: block;\n text-align: center;\n}\n\n.rdp-caption_dropdowns {\n position: relative;\n display: inline-flex;\n}\n\n.rdp-caption_label {\n position: relative;\n z-index: 1;\n display: inline-flex;\n align-items: center;\n margin: 0;\n padding: 0 0.25em;\n white-space: nowrap;\n color: currentColor;\n border: 0;\n border: 2px solid transparent;\n font-family: inherit;\n font-size: var(--rdp-caption-font-size);\n font-weight: bold;\n}\n\n.rdp-nav {\n white-space: nowrap;\n}\n\n.rdp-multiple_months .rdp-caption_start .rdp-nav {\n position: absolute;\n top: 50%;\n left: 0;\n transform: translateY(-50%);\n}\n\n.rdp-multiple_months .rdp-caption_end .rdp-nav {\n position: absolute;\n top: 50%;\n right: 0;\n transform: translateY(-50%);\n}\n\n.rdp-nav_button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--rdp-cell-size);\n height: var(--rdp-cell-size);\n padding: 0.25em;\n border-radius: 100%;\n}\n\n/* ---------- */\n/* Dropdowns */\n/* ---------- */\n\n.rdp-dropdown_year,\n.rdp-dropdown_month {\n position: relative;\n display: inline-flex;\n align-items: center;\n}\n\n.rdp-dropdown {\n appearance: none;\n position: absolute;\n z-index: 2;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n margin: 0;\n padding: 0;\n cursor: inherit;\n opacity: 0;\n border: none;\n background-color: transparent;\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n}\n\n.rdp-dropdown[disabled] {\n opacity: unset;\n color: unset;\n}\n\n.rdp-dropdown:focus-visible:not([disabled]) + .rdp-caption_label {\n background-color: var(--rdp-background-color);\n border: var(--rdp-outline);\n border-radius: 6px;\n}\n\n.rdp-dropdown_icon {\n margin: 0 0 0 5px;\n}\n\n.rdp-head {\n border: 0;\n}\n\n.rdp-head_row,\n.rdp-row {\n height: 100%;\n}\n\n.rdp-head_cell {\n vertical-align: middle;\n font-size: 0.75em;\n font-weight: 700;\n text-align: center;\n height: 100%;\n height: var(--rdp-cell-size);\n padding: 0;\n text-transform: uppercase;\n}\n\n.rdp-tbody {\n border: 0;\n}\n\n.rdp-tfoot {\n margin: 0.5em;\n}\n\n.rdp-cell {\n width: var(--rdp-cell-size);\n height: 100%;\n height: var(--rdp-cell-size);\n padding: 0;\n text-align: center;\n}\n\n.rdp-weeknumber {\n font-size: 0.75em;\n}\n\n.rdp-weeknumber,\n.rdp-day {\n display: flex;\n overflow: hidden;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: var(--rdp-cell-size);\n max-width: var(--rdp-cell-size);\n height: var(--rdp-cell-size);\n margin: 0;\n border: 2px solid transparent;\n border-radius: 100%;\n}\n\n.rdp-day_today:not(.rdp-day_outside) {\n font-weight: bold;\n}\n\n.rdp-day_selected,\n.rdp-day_selected:focus-visible,\n.rdp-day_selected:hover {\n color: white;\n opacity: 1;\n background-color: var(--rdp-accent-color);\n}\n\n.rdp-day_outside {\n opacity: 0.5;\n}\n\n.rdp-day_selected:focus-visible {\n /* Since the background is the same use again the outline */\n outline: var(--rdp-outline);\n outline-offset: 2px;\n z-index: 1;\n}\n\n.rdp:not([dir='rtl']) .rdp-day_range_start:not(.rdp-day_range_end) {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n.rdp:not([dir='rtl']) .rdp-day_range_end:not(.rdp-day_range_start) {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n\n.rdp[dir='rtl'] .rdp-day_range_start:not(.rdp-day_range_end) {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n\n.rdp[dir='rtl'] .rdp-day_range_end:not(.rdp-day_range_start) {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n.rdp-day_range_end.rdp-day_range_start {\n border-radius: 100%;\n}\n\n.rdp-day_range_middle {\n border-radius: 0;\n}";
|
|
11548
11395
|
styleInject(css_248z$9);
|
|
11549
11396
|
|
|
11550
|
-
var css_248z$8 = ".will-calendar-filter-container {\n display: flex;\n justify-content: center;\n user-select: none;\n}\n\n/* Calendar overrides */\n\n\n.will-calendar-filter-container .DayPicker {\n font-size: 25px; /* Adjust this value to make the DayPicker bigger */\n}\n\n.will-calendar-filter-container .rdp-month {\n position: relative;\n}\n\n.will-calendar-filter-container .rdp-month.rdp-caption_start {\n padding-left: 70px;\n}\n\n.will-calendar-filter-container .rdp-month.rdp-caption_end {\n padding-right: 70px;\n}\n\n.will-calendar-filter-container .rdp-month .rdp-nav {\n border: 1px solid var(--will-primary);\n border-radius: 50%;\n}\n\n.will-calendar-filter-container .rdp-month .rdp-nav svg {\n color: var(--will-primary);\n}\n\n\n.will-calendar-filter-container .rdp-month .rdp-caption {\n position: initial;\n}\n\n.will-calendar-filter-container .rdp-month .rdp-caption > .rdp-caption_label,\n.will-calendar-filter-container .rdp-table .rdp-head {\n opacity: .6;\n}\n\n.will-calendar-filter-container .rdp-button_reset.rdp-button.rdp-day.rdp-day_selected {\n background-color: var(--will-primary);\n opacity: 1;\n}\n\n.will-calendar-filter-container .my-today:not(.rdp-day_selected) { \n font-weight: 700;\n opacity: 1;\n color: var(--will-primary);\n}\n\n.will-calendar-filter-container .rdp-cell {\n position: relative;\n}\n\n.will-calendar-filter-container .rdp-cell button {\n font-weight: 500;\n}\n\n.will-calendar-filter-container .rdp-cell button.booked {\n font-weight: 400;\n cursor: not-allowed;\n}\n\n.will-calendar-filter-container .rdp-cell .rdp-button[disabled] {\n opacity: 0.5;\n}\n\n@media (max-width: 960px) {\n .will-calendar-filter-container .rdp-month .rdp-nav {\n border: none;\n border-radius: initial;\n }\n\n .will-calendar-filter-container .rdp-month.rdp-caption_start {\n padding-left: 10px;\n }\n \n .will-calendar-filter-container .rdp-month.rdp-caption_end {\n padding-right: 10px;\n }\n}\n\n/* Tooltip */\n.will-root .will-calendar-filter-container .will-calendar-tooltip,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-overlapping-date,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out-only,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-in-only {\n position: absolute;\n top: -42px;\n transform: translateX(calc(-50% + 20px));\n display: none;\n white-space: nowrap;\n z-index: 2;\n}\n\n.will-root .will-calendar-filter-container .will-calendar-tooltip > div,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out > div,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-overlapping-date > div,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out-only > div,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-in-only > div {\n background-color: white;\n position: relative;\n padding: 5px 10px;\n border: 1px solid var(--will-primary);\n border-radius: 5px;\n}\n\n.will-root .will-calendar-filter-container .will-calendar-tooltip::before,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out::before,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-overlapping-date::before,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out-only::before,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-in-only::before {\n content: \"\";\n width: 10px;\n height: 10px;\n border: 1px solid var(--will-primary);\n position: absolute;\n bottom: -4px;\n left:calc(50% - 5.555px);\n rotate: 45deg;\n z-index: 0;\n background-color: var(--will-white);\n}\n\n.will-root .will-calendar-filter-container .rdp-cell:hover .will-calendar-tooltip,\n.will-root .will-calendar-filter-container .rdp-cell:hover .will-calendar-tooltip-check-out,\n.will-root .will-calendar-filter-container .rdp-cell:hover .will-calendar-tooltip-overlapping-date,\n.will-root .will-calendar-filter-container .rdp-cell:hover .will-calendar-tooltip-check-out-only,\n.will-root .will-calendar-filter-container .rdp-cell:hover .will-calendar-tooltip-check-in-only {\n display: block;\n}\n\n/* Loading spinner */\n\n.will-root .will-calendar-filter-container .rdp-months {\n position: relative;\n}\n\n.will-root .will-calendar-filter-container .will-calendar-spinner {\n position: absolute;\n top:0;\n bottom:0;\n left: 0;\n right: 0;\n background-color: var(--will-white-transparent);\n z-index: 3;\n display: none;\n justify-content: center;\n align-items: center;\n font-weight: 600;\n}\n\n/* No active selection */\n\n.will-root .will-calendar-filter-container .
|
|
11397
|
+
var css_248z$8 = ".will-calendar-filter-container {\n display: flex;\n justify-content: center;\n user-select: none;\n}\n\n/* Calendar overrides */\n\n\n.will-calendar-filter-container .DayPicker {\n font-size: 25px; /* Adjust this value to make the DayPicker bigger */\n}\n\n.will-calendar-filter-container .rdp-month {\n position: relative;\n}\n\n.will-calendar-filter-container .rdp-month.rdp-caption_start {\n padding-left: 70px;\n}\n\n.will-calendar-filter-container .rdp-month.rdp-caption_end {\n padding-right: 70px;\n}\n\n.will-calendar-filter-container .rdp-month .rdp-nav {\n border: 1px solid var(--will-primary);\n border-radius: 50%;\n}\n\n.will-calendar-filter-container .rdp-month .rdp-nav svg {\n color: var(--will-primary);\n}\n\n\n.will-calendar-filter-container .rdp-month .rdp-caption {\n position: initial;\n}\n\n.will-calendar-filter-container .rdp-month .rdp-caption > .rdp-caption_label,\n.will-calendar-filter-container .rdp-table .rdp-head {\n opacity: .6;\n}\n\n.will-calendar-filter-container .rdp-button_reset.rdp-button.rdp-day.rdp-day_selected {\n background-color: var(--will-primary);\n opacity: 1;\n}\n\n.will-calendar-filter-container .my-today:not(.rdp-day_selected) { \n font-weight: 700;\n opacity: 1;\n color: var(--will-primary);\n}\n\n.will-calendar-filter-container .rdp-cell {\n position: relative;\n}\n\n.will-calendar-filter-container .rdp-cell button {\n font-weight: 500;\n}\n\n.will-calendar-filter-container .rdp-cell button.booked {\n font-weight: 400;\n cursor: not-allowed;\n}\n\n.will-calendar-filter-container .rdp-cell .rdp-button[disabled] {\n opacity: 0.5;\n}\n\n@media (max-width: 960px) {\n .will-calendar-filter-container .rdp-month .rdp-nav {\n border: none;\n border-radius: initial;\n }\n\n .will-calendar-filter-container .rdp-month.rdp-caption_start {\n padding-left: 10px;\n }\n \n .will-calendar-filter-container .rdp-month.rdp-caption_end {\n padding-right: 10px;\n }\n}\n\n/* Tooltip */\n.will-root .will-calendar-filter-container .will-calendar-tooltip,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-overlapping-date,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out-only,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-in-only {\n position: absolute;\n top: -42px;\n transform: translateX(calc(-50% + 20px));\n display: none;\n white-space: nowrap;\n z-index: 2;\n}\n\n.will-root .will-calendar-filter-container .will-calendar-tooltip > div,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out > div,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-overlapping-date > div,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out-only > div,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-in-only > div {\n background-color: white;\n position: relative;\n padding: 5px 10px;\n border: 1px solid var(--will-primary);\n border-radius: 5px;\n}\n\n.will-root .will-calendar-filter-container .will-calendar-tooltip::before,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out::before,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-overlapping-date::before,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out-only::before,\n.will-root .will-calendar-filter-container .will-calendar-tooltip-check-in-only::before {\n content: \"\";\n width: 10px;\n height: 10px;\n border: 1px solid var(--will-primary);\n position: absolute;\n bottom: -4px;\n left:calc(50% - 5.555px);\n rotate: 45deg;\n z-index: 0;\n background-color: var(--will-white);\n}\n\n.will-root .will-calendar-filter-container .rdp-cell:hover .will-calendar-tooltip,\n.will-root .will-calendar-filter-container .rdp-cell:hover .will-calendar-tooltip-check-out,\n.will-root .will-calendar-filter-container .rdp-cell:hover .will-calendar-tooltip-overlapping-date,\n.will-root .will-calendar-filter-container .rdp-cell:hover .will-calendar-tooltip-check-out-only,\n.will-root .will-calendar-filter-container .rdp-cell:hover .will-calendar-tooltip-check-in-only {\n display: block;\n}\n\n/* Loading spinner */\n\n.will-root .will-calendar-filter-container .rdp-months {\n position: relative;\n}\n\n.will-root .will-calendar-filter-container .will-calendar-spinner {\n position: absolute;\n top:0;\n bottom:0;\n left: 0;\n right: 0;\n background-color: var(--will-white-transparent);\n z-index: 3;\n display: none;\n justify-content: center;\n align-items: center;\n font-weight: 600;\n}\n\n/* No active selection */\n\n\n\n\n/* ---- */\n\n.will-root .will-calendar-filter-container .no-active-selection-start,\n.will-root .will-calendar-filter-container .no-active-selection-mid,\n.will-root .will-calendar-filter-container .no-active-selection-end { \n position: initial;\n}\n\n.will-root .will-calendar-filter-container .no-active-selection-start::before,\n.will-root .will-calendar-filter-container .no-active-selection-mid::before,\n.will-root .will-calendar-filter-container .no-active-selection-end::before { \n content: \"\";\n position: absolute;\n width: 100%;\n height: 91%;\n margin-top: -2px;\n\n border: 3px dashed var(--will-grey);\n}\n\n\n.will-root .will-calendar-filter-container .no-active-selection-start::before {\n border-right: none;\n border-top-left-radius: 50%;\n border-bottom-left-radius: 50%;\n}\n\n.will-root .will-calendar-filter-container .no-active-selection-mid::before {\n border-right: none;\n border-left: none;\n}\n\n.will-root .will-calendar-filter-container .no-active-selection-end::before {\n border-left: none;\n border-top-right-radius: 50%;\n border-bottom-right-radius: 50%;\n}\n\n.will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_middle.checkout-option {\n background-color: var(--will-primary-lightest);\n color: inherit;\n}\n\n\n/* Overlapping date */\n\n.will-root .will-calendar-filter-container .overlapping-date {\n user-select: none;\n pointer-events: none;\n}\n\n.will-root .will-calendar-filter-container .overlapping-date:hover {\n cursor: not-allowed;\n}\n\n\n";
|
|
11551
11398
|
styleInject(css_248z$8);
|
|
11552
11399
|
|
|
11553
11400
|
var Calendar = forwardRef(function (_a, ref) {
|
|
@@ -11618,9 +11465,9 @@ var Calendar = forwardRef(function (_a, ref) {
|
|
|
11618
11465
|
: today), disabled: disabledDatesByPage$1.length
|
|
11619
11466
|
? disabledDatesByPage$1
|
|
11620
11467
|
: (disabledDates === null || disabledDates === void 0 ? void 0 : disabledDates.length)
|
|
11621
|
-
? __spreadArray$1(__spreadArray$1(__spreadArray$1(
|
|
11468
|
+
? __spreadArray$1(__spreadArray$1(__spreadArray$1([
|
|
11622
11469
|
lastPossibleCheckout && lastPossibleCheckout
|
|
11623
|
-
],
|
|
11470
|
+
], __read(disabledDates), false), __read(firstPossibleRangeContextCheckIn), false), __read(lastPossibleRangeContextCheckOut), false) : ((_c = newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates) === null || _c === void 0 ? void 0 : _c.length)
|
|
11624
11471
|
? __spreadArray$1(__spreadArray$1(__spreadArray$1([
|
|
11625
11472
|
lastPossibleCheckout && lastPossibleCheckout
|
|
11626
11473
|
], __read(newDisableCalendarDates.disabledDates), false), __read(firstPossibleRangeContextCheckIn), false), __read(lastPossibleRangeContextCheckOut), false) : [], fromMonth: today, onMonthChange: function (val) {
|
|
@@ -11636,9 +11483,9 @@ var Calendar = forwardRef(function (_a, ref) {
|
|
|
11636
11483
|
booked: 'booked',
|
|
11637
11484
|
disabledAfterCheckIn: 'disabled-after-check-in',
|
|
11638
11485
|
overlappingDate: 'overlapping-date',
|
|
11639
|
-
noActiveSelectionStart: '
|
|
11640
|
-
noActiveSelectionMid: '
|
|
11641
|
-
noActiveSelectionEnd: '
|
|
11486
|
+
noActiveSelectionStart: 'no-active-selection-start',
|
|
11487
|
+
noActiveSelectionMid: 'no-active-selection-mid',
|
|
11488
|
+
noActiveSelectionEnd: 'no-active-selection-end',
|
|
11642
11489
|
checkoutOptionsMid: 'rdp-day_selected rdp-day_range_middle checkout-option',
|
|
11643
11490
|
checkInOnly: 'check-in-only',
|
|
11644
11491
|
checkOutOnly: 'check-out-only',
|
|
@@ -11665,9 +11512,9 @@ var Calendar = forwardRef(function (_a, ref) {
|
|
|
11665
11512
|
React__default__default.createElement("div", { className: 'will-calendar-tooltip-overlapping-date' },
|
|
11666
11513
|
React__default__default.createElement("div", null, t('checkOutOnly'))),
|
|
11667
11514
|
React__default__default.createElement("div", { className: 'will-calendar-tooltip-check-in-only' },
|
|
11668
|
-
React__default__default.createElement("div", null,
|
|
11515
|
+
React__default__default.createElement("div", null, t('checkInOnly'))),
|
|
11669
11516
|
React__default__default.createElement("div", { className: 'will-calendar-tooltip-check-out-only' },
|
|
11670
|
-
React__default__default.createElement("div", null,
|
|
11517
|
+
React__default__default.createElement("div", null, t('checkOutOnly'))),
|
|
11671
11518
|
React__default__default.createElement("div", { className: 'will-calendar-spinner' },
|
|
11672
11519
|
React__default__default.createElement(IconsSvg, { fill: (palette === null || palette === void 0 ? void 0 : palette.primary) || 'inherit', size: 50, icon: "spinner" })))));
|
|
11673
11520
|
});
|
|
@@ -12055,6 +11902,7 @@ var useFilterCalendar = function (_a) {
|
|
|
12055
11902
|
// Lifecycle
|
|
12056
11903
|
// Handle update component with new data
|
|
12057
11904
|
useEffect(function () {
|
|
11905
|
+
var _a;
|
|
12058
11906
|
if (outerDisableCalendarDates === null || outerDisableCalendarDates === void 0 ? void 0 : outerDisableCalendarDates.availableDates) {
|
|
12059
11907
|
setDisableCalendarDates({
|
|
12060
11908
|
availableDates: __spreadArray$1([], __read(outerDisableCalendarDates.availableDates.sort(function (a, b) {
|
|
@@ -12066,6 +11914,9 @@ var useFilterCalendar = function (_a) {
|
|
|
12066
11914
|
})), false) : [],
|
|
12067
11915
|
});
|
|
12068
11916
|
}
|
|
11917
|
+
if (disabledDates && !!((_a = outerDisableCalendarDates === null || outerDisableCalendarDates === void 0 ? void 0 : outerDisableCalendarDates.disabledDates) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
11918
|
+
setDisabledDates(__assign$2(__assign$2({}, disabledDates), outerDisableCalendarDates.disabledDates));
|
|
11919
|
+
}
|
|
12069
11920
|
}, [outerDisableCalendarDates]);
|
|
12070
11921
|
// Handle Range Context initial selections
|
|
12071
11922
|
useEffect(function () {
|