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
package/lib/index.js
CHANGED
|
@@ -2876,8 +2876,7 @@ var clearDates$1 = "Clear dates";
|
|
|
2876
2876
|
var noCheckIn$1 = "Room not available";
|
|
2877
2877
|
var noCheckOut$1 = "Check-out not available";
|
|
2878
2878
|
var checkOutOnly$1 = "Check-out only";
|
|
2879
|
-
var
|
|
2880
|
-
var onlyCheckIn$1 = "Check-out only";
|
|
2879
|
+
var checkInOnly$1 = "Check-in only";
|
|
2881
2880
|
var errors$1 = {
|
|
2882
2881
|
calendarErrors: {
|
|
2883
2882
|
checkInAvailabilityError: "Check-in available for second room only with connection dates",
|
|
@@ -2895,8 +2894,7 @@ var enCommon = {
|
|
|
2895
2894
|
noCheckIn: noCheckIn$1,
|
|
2896
2895
|
noCheckOut: noCheckOut$1,
|
|
2897
2896
|
checkOutOnly: checkOutOnly$1,
|
|
2898
|
-
|
|
2899
|
-
onlyCheckIn: onlyCheckIn$1,
|
|
2897
|
+
checkInOnly: checkInOnly$1,
|
|
2900
2898
|
errors: errors$1
|
|
2901
2899
|
};
|
|
2902
2900
|
|
|
@@ -2947,8 +2945,7 @@ var clearDates = "Tyhjennä";
|
|
|
2947
2945
|
var noCheckIn = "Huone ei saatavilla";
|
|
2948
2946
|
var noCheckOut = "Uloskirjaus ei saatavilla";
|
|
2949
2947
|
var checkOutOnly = "Vain uloskirjaus";
|
|
2950
|
-
var
|
|
2951
|
-
var onlyCheckIn = "Check-out only";
|
|
2948
|
+
var checkInOnly = "Check-in only";
|
|
2952
2949
|
var errors = {
|
|
2953
2950
|
calendarErrors: {
|
|
2954
2951
|
checkInAvailabilityError: "Check-in available for second room only with connection dates",
|
|
@@ -2966,8 +2963,7 @@ var fiCommon = {
|
|
|
2966
2963
|
noCheckIn: noCheckIn,
|
|
2967
2964
|
noCheckOut: noCheckOut,
|
|
2968
2965
|
checkOutOnly: checkOutOnly,
|
|
2969
|
-
|
|
2970
|
-
onlyCheckIn: onlyCheckIn,
|
|
2966
|
+
checkInOnly: checkInOnly,
|
|
2971
2967
|
errors: errors
|
|
2972
2968
|
};
|
|
2973
2969
|
|
|
@@ -3901,62 +3897,6 @@ function endOfMonth(dirtyDate) {
|
|
|
3901
3897
|
return date;
|
|
3902
3898
|
}
|
|
3903
3899
|
|
|
3904
|
-
/**
|
|
3905
|
-
* @name eachDayOfInterval
|
|
3906
|
-
* @category Interval Helpers
|
|
3907
|
-
* @summary Return the array of dates within the specified time interval.
|
|
3908
|
-
*
|
|
3909
|
-
* @description
|
|
3910
|
-
* Return the array of dates within the specified time interval.
|
|
3911
|
-
*
|
|
3912
|
-
* @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
|
|
3913
|
-
* @param {Object} [options] - an object with options.
|
|
3914
|
-
* @param {Number} [options.step=1] - the step to increment by. The value should be more than 1.
|
|
3915
|
-
* @returns {Date[]} the array with starts of days from the day of the interval start to the day of the interval end
|
|
3916
|
-
* @throws {TypeError} 1 argument required
|
|
3917
|
-
* @throws {RangeError} `options.step` must be a number greater than 1
|
|
3918
|
-
* @throws {RangeError} The start of an interval cannot be after its end
|
|
3919
|
-
* @throws {RangeError} Date in interval cannot be `Invalid Date`
|
|
3920
|
-
*
|
|
3921
|
-
* @example
|
|
3922
|
-
* // Each day between 6 October 2014 and 10 October 2014:
|
|
3923
|
-
* const result = eachDayOfInterval({
|
|
3924
|
-
* start: new Date(2014, 9, 6),
|
|
3925
|
-
* end: new Date(2014, 9, 10)
|
|
3926
|
-
* })
|
|
3927
|
-
* //=> [
|
|
3928
|
-
* // Mon Oct 06 2014 00:00:00,
|
|
3929
|
-
* // Tue Oct 07 2014 00:00:00,
|
|
3930
|
-
* // Wed Oct 08 2014 00:00:00,
|
|
3931
|
-
* // Thu Oct 09 2014 00:00:00,
|
|
3932
|
-
* // Fri Oct 10 2014 00:00:00
|
|
3933
|
-
* // ]
|
|
3934
|
-
*/
|
|
3935
|
-
function eachDayOfInterval(dirtyInterval, options) {
|
|
3936
|
-
var _options$step;
|
|
3937
|
-
requiredArgs(1, arguments);
|
|
3938
|
-
var interval = dirtyInterval || {};
|
|
3939
|
-
var startDate = toDate(interval.start);
|
|
3940
|
-
var endDate = toDate(interval.end);
|
|
3941
|
-
var endTime = endDate.getTime();
|
|
3942
|
-
|
|
3943
|
-
// Throw an exception if start date is after end date or if any date is `Invalid Date`
|
|
3944
|
-
if (!(startDate.getTime() <= endTime)) {
|
|
3945
|
-
throw new RangeError('Invalid interval');
|
|
3946
|
-
}
|
|
3947
|
-
var dates = [];
|
|
3948
|
-
var currentDate = startDate;
|
|
3949
|
-
currentDate.setHours(0, 0, 0, 0);
|
|
3950
|
-
var step = Number((_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1);
|
|
3951
|
-
if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number greater than 1');
|
|
3952
|
-
while (currentDate.getTime() <= endTime) {
|
|
3953
|
-
dates.push(toDate(currentDate));
|
|
3954
|
-
currentDate.setDate(currentDate.getDate() + step);
|
|
3955
|
-
currentDate.setHours(0, 0, 0, 0);
|
|
3956
|
-
}
|
|
3957
|
-
return dates;
|
|
3958
|
-
}
|
|
3959
|
-
|
|
3960
3900
|
/**
|
|
3961
3901
|
* @name startOfMonth
|
|
3962
3902
|
* @category Month Helpers
|
|
@@ -6546,58 +6486,6 @@ function isSameYear(dirtyDateLeft, dirtyDateRight) {
|
|
|
6546
6486
|
return dateLeft.getFullYear() === dateRight.getFullYear();
|
|
6547
6487
|
}
|
|
6548
6488
|
|
|
6549
|
-
/**
|
|
6550
|
-
* @name isWithinInterval
|
|
6551
|
-
* @category Interval Helpers
|
|
6552
|
-
* @summary Is the given date within the interval?
|
|
6553
|
-
*
|
|
6554
|
-
* @description
|
|
6555
|
-
* Is the given date within the interval? (Including start and end.)
|
|
6556
|
-
*
|
|
6557
|
-
* @param {Date|Number} date - the date to check
|
|
6558
|
-
* @param {Interval} interval - the interval to check
|
|
6559
|
-
* @returns {Boolean} the date is within the interval
|
|
6560
|
-
* @throws {TypeError} 2 arguments required
|
|
6561
|
-
* @throws {RangeError} The start of an interval cannot be after its end
|
|
6562
|
-
* @throws {RangeError} Date in interval cannot be `Invalid Date`
|
|
6563
|
-
*
|
|
6564
|
-
* @example
|
|
6565
|
-
* // For the date within the interval:
|
|
6566
|
-
* isWithinInterval(new Date(2014, 0, 3), {
|
|
6567
|
-
* start: new Date(2014, 0, 1),
|
|
6568
|
-
* end: new Date(2014, 0, 7)
|
|
6569
|
-
* })
|
|
6570
|
-
* //=> true
|
|
6571
|
-
*
|
|
6572
|
-
* @example
|
|
6573
|
-
* // For the date outside of the interval:
|
|
6574
|
-
* isWithinInterval(new Date(2014, 0, 10), {
|
|
6575
|
-
* start: new Date(2014, 0, 1),
|
|
6576
|
-
* end: new Date(2014, 0, 7)
|
|
6577
|
-
* })
|
|
6578
|
-
* //=> false
|
|
6579
|
-
*
|
|
6580
|
-
* @example
|
|
6581
|
-
* // For date equal to interval start:
|
|
6582
|
-
* isWithinInterval(date, { start, end: date }) // => true
|
|
6583
|
-
*
|
|
6584
|
-
* @example
|
|
6585
|
-
* // For date equal to interval end:
|
|
6586
|
-
* isWithinInterval(date, { start: date, end }) // => true
|
|
6587
|
-
*/
|
|
6588
|
-
function isWithinInterval(dirtyDate, interval) {
|
|
6589
|
-
requiredArgs(2, arguments);
|
|
6590
|
-
var time = toDate(dirtyDate).getTime();
|
|
6591
|
-
var startTime = toDate(interval.start).getTime();
|
|
6592
|
-
var endTime = toDate(interval.end).getTime();
|
|
6593
|
-
|
|
6594
|
-
// Throw an exception if start date is after end date or if any date is `Invalid Date`
|
|
6595
|
-
if (!(startTime <= endTime)) {
|
|
6596
|
-
throw new RangeError('Invalid interval');
|
|
6597
|
-
}
|
|
6598
|
-
return time >= startTime && time <= endTime;
|
|
6599
|
-
}
|
|
6600
|
-
|
|
6601
6489
|
/**
|
|
6602
6490
|
* @name subDays
|
|
6603
6491
|
* @category Day Helpers
|
|
@@ -11204,22 +11092,18 @@ var calendarSelectionRules = function (_a) {
|
|
|
11204
11092
|
};
|
|
11205
11093
|
/////////
|
|
11206
11094
|
var disableFutureDates = function (_a) {
|
|
11207
|
-
var rangeFrom = _a.rangeFrom, checkOutRange = _a.checkOutRange, setDisabledDates = _a.setDisabledDates
|
|
11095
|
+
var rangeFrom = _a.rangeFrom, checkOutRange = _a.checkOutRange, setDisabledDates = _a.setDisabledDates, newDisableCalendarDates = _a.newDisableCalendarDates;
|
|
11208
11096
|
if (rangeFrom && checkOutRange && setDisabledDates) {
|
|
11209
11097
|
// Get parse data
|
|
11210
11098
|
var checkIn = addDays(checkOutRange.checkIn, 1);
|
|
11211
11099
|
var firstCheckOut = addDays(checkOutRange.firstCheckOut, -1);
|
|
11212
11100
|
var noDatesRange = isEqual(checkIn, checkOutRange.firstCheckOut);
|
|
11213
|
-
setDisabledDates([
|
|
11214
|
-
// Will disable all dates before the check-in date
|
|
11215
|
-
// { before: findCheckOutRange?.checkIn },
|
|
11101
|
+
setDisabledDates(__spreadArray$1(__spreadArray$1([], __read(((newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates) || [])), false), [
|
|
11216
11102
|
{
|
|
11217
11103
|
from: noDatesRange ? undefined : checkIn,
|
|
11218
11104
|
to: noDatesRange ? undefined : firstCheckOut,
|
|
11219
11105
|
},
|
|
11220
|
-
|
|
11221
|
-
//{ after: checkOutRange?.lastCheckOut },
|
|
11222
|
-
]);
|
|
11106
|
+
], false));
|
|
11223
11107
|
}
|
|
11224
11108
|
};
|
|
11225
11109
|
|
|
@@ -11251,35 +11135,6 @@ var handleCalendarModifiers = function (_a) {
|
|
|
11251
11135
|
var calendarRangeTo = (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) && endOfDay(calendarRange.to);
|
|
11252
11136
|
var rangeContextFrom = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.from) && endOfDay(rangeContext.from);
|
|
11253
11137
|
var rangeContextTo = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.to) && endOfDay(rangeContext.to);
|
|
11254
|
-
// Create range for range context middle selection and current overlapping selection
|
|
11255
|
-
var rangeContextMiddleSelection = rangeContextFrom && rangeContextTo
|
|
11256
|
-
? eachDayOfInterval({
|
|
11257
|
-
start: addDays(rangeContextFrom, 1),
|
|
11258
|
-
end: addDays(rangeContextTo, -1),
|
|
11259
|
-
}).filter(function (date) {
|
|
11260
|
-
return !((calendarRangeFrom &&
|
|
11261
|
-
isEqual(endOfDay(calendarRangeFrom), endOfDay(date))) ||
|
|
11262
|
-
(calendarRangeTo &&
|
|
11263
|
-
isEqual(endOfDay(calendarRangeTo), endOfDay(date))) ||
|
|
11264
|
-
(calendarRangeFrom &&
|
|
11265
|
-
!calendarRangeTo &&
|
|
11266
|
-
(currentSelectionLastCheckoutDate === null || currentSelectionLastCheckoutDate === void 0 ? void 0 : currentSelectionLastCheckoutDate.lastCheckOut) &&
|
|
11267
|
-
isAfter(calendarRangeFrom, rangeContextFrom) &&
|
|
11268
|
-
isBefore(currentSelectionLastCheckoutDate === null || currentSelectionLastCheckoutDate === void 0 ? void 0 : currentSelectionLastCheckoutDate.lastCheckOut, rangeContextTo) &&
|
|
11269
|
-
isWithinInterval(date, {
|
|
11270
|
-
start: currentSelectionLastCheckoutDate.checkIn,
|
|
11271
|
-
end: currentSelectionLastCheckoutDate.lastCheckOut,
|
|
11272
|
-
})) ||
|
|
11273
|
-
(calendarRangeFrom &&
|
|
11274
|
-
calendarRangeTo &&
|
|
11275
|
-
isAfter(calendarRangeFrom, rangeContextFrom) &&
|
|
11276
|
-
isBefore(calendarRangeTo, rangeContextTo) &&
|
|
11277
|
-
isWithinInterval(date, {
|
|
11278
|
-
start: calendarRangeFrom,
|
|
11279
|
-
end: calendarRangeTo,
|
|
11280
|
-
})));
|
|
11281
|
-
})
|
|
11282
|
-
: [];
|
|
11283
11138
|
return {
|
|
11284
11139
|
booked: disabledDatesByPage.length
|
|
11285
11140
|
? disabledDatesByPage
|
|
@@ -11296,21 +11151,13 @@ var handleCalendarModifiers = function (_a) {
|
|
|
11296
11151
|
overlappingDate: __spreadArray$1([], __read((!calendarRangeFrom && !!(overlappingDate === null || overlappingDate === void 0 ? void 0 : overlappingDate.length)
|
|
11297
11152
|
? overlappingDate.map(function (date) { return ({ from: date.from }); })
|
|
11298
11153
|
: [])), false),
|
|
11299
|
-
noActiveSelectionStart: rangeContextFrom
|
|
11300
|
-
|
|
11301
|
-
|
|
11302
|
-
|
|
11303
|
-
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
|
-
? rangeContextMiddleSelection
|
|
11307
|
-
: [])), false),
|
|
11308
|
-
noActiveSelectionEnd: rangeContextTo &&
|
|
11309
|
-
!(calendarRangeFrom &&
|
|
11310
|
-
rangeContextTo &&
|
|
11311
|
-
isEqual(endOfDay(rangeContextTo), endOfDay(calendarRangeFrom)))
|
|
11312
|
-
? rangeContextTo
|
|
11313
|
-
: [],
|
|
11154
|
+
noActiveSelectionStart: rangeContextFrom || [],
|
|
11155
|
+
noActiveSelectionMid: [
|
|
11156
|
+
rangeContextFrom && rangeContextTo
|
|
11157
|
+
? { after: rangeContextFrom, before: rangeContextTo }
|
|
11158
|
+
: [],
|
|
11159
|
+
],
|
|
11160
|
+
noActiveSelectionEnd: rangeContextTo || [],
|
|
11314
11161
|
checkoutOptionsMid: __spreadArray$1([], __read((calendarRangeFrom &&
|
|
11315
11162
|
!calendarRangeTo &&
|
|
11316
11163
|
(currentSelectionLastCheckoutDate === null || currentSelectionLastCheckoutDate === void 0 ? void 0 : currentSelectionLastCheckoutDate.lastCheckOut)
|
|
@@ -11567,7 +11414,7 @@ var useUpdateDisabledDates = function (_a) {
|
|
|
11567
11414
|
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}";
|
|
11568
11415
|
styleInject(css_248z$9);
|
|
11569
11416
|
|
|
11570
|
-
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 .
|
|
11417
|
+
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";
|
|
11571
11418
|
styleInject(css_248z$8);
|
|
11572
11419
|
|
|
11573
11420
|
var Calendar = React__default.forwardRef(function (_a, ref) {
|
|
@@ -11638,9 +11485,9 @@ var Calendar = React__default.forwardRef(function (_a, ref) {
|
|
|
11638
11485
|
: today), disabled: disabledDatesByPage$1.length
|
|
11639
11486
|
? disabledDatesByPage$1
|
|
11640
11487
|
: (disabledDates === null || disabledDates === void 0 ? void 0 : disabledDates.length)
|
|
11641
|
-
? __spreadArray$1(__spreadArray$1(__spreadArray$1(
|
|
11488
|
+
? __spreadArray$1(__spreadArray$1(__spreadArray$1([
|
|
11642
11489
|
lastPossibleCheckout && lastPossibleCheckout
|
|
11643
|
-
],
|
|
11490
|
+
], __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)
|
|
11644
11491
|
? __spreadArray$1(__spreadArray$1(__spreadArray$1([
|
|
11645
11492
|
lastPossibleCheckout && lastPossibleCheckout
|
|
11646
11493
|
], __read(newDisableCalendarDates.disabledDates), false), __read(firstPossibleRangeContextCheckIn), false), __read(lastPossibleRangeContextCheckOut), false) : [], fromMonth: today, onMonthChange: function (val) {
|
|
@@ -11656,9 +11503,9 @@ var Calendar = React__default.forwardRef(function (_a, ref) {
|
|
|
11656
11503
|
booked: 'booked',
|
|
11657
11504
|
disabledAfterCheckIn: 'disabled-after-check-in',
|
|
11658
11505
|
overlappingDate: 'overlapping-date',
|
|
11659
|
-
noActiveSelectionStart: '
|
|
11660
|
-
noActiveSelectionMid: '
|
|
11661
|
-
noActiveSelectionEnd: '
|
|
11506
|
+
noActiveSelectionStart: 'no-active-selection-start',
|
|
11507
|
+
noActiveSelectionMid: 'no-active-selection-mid',
|
|
11508
|
+
noActiveSelectionEnd: 'no-active-selection-end',
|
|
11662
11509
|
checkoutOptionsMid: 'rdp-day_selected rdp-day_range_middle checkout-option',
|
|
11663
11510
|
checkInOnly: 'check-in-only',
|
|
11664
11511
|
checkOutOnly: 'check-out-only',
|
|
@@ -11685,9 +11532,9 @@ var Calendar = React__default.forwardRef(function (_a, ref) {
|
|
|
11685
11532
|
React__default.createElement("div", { className: 'will-calendar-tooltip-overlapping-date' },
|
|
11686
11533
|
React__default.createElement("div", null, t('checkOutOnly'))),
|
|
11687
11534
|
React__default.createElement("div", { className: 'will-calendar-tooltip-check-in-only' },
|
|
11688
|
-
React__default.createElement("div", null,
|
|
11535
|
+
React__default.createElement("div", null, t('checkInOnly'))),
|
|
11689
11536
|
React__default.createElement("div", { className: 'will-calendar-tooltip-check-out-only' },
|
|
11690
|
-
React__default.createElement("div", null,
|
|
11537
|
+
React__default.createElement("div", null, t('checkOutOnly'))),
|
|
11691
11538
|
React__default.createElement("div", { className: 'will-calendar-spinner' },
|
|
11692
11539
|
React__default.createElement(IconsSvg, { fill: (palette === null || palette === void 0 ? void 0 : palette.primary) || 'inherit', size: 50, icon: "spinner" })))));
|
|
11693
11540
|
});
|
|
@@ -12075,6 +11922,7 @@ var useFilterCalendar = function (_a) {
|
|
|
12075
11922
|
// Lifecycle
|
|
12076
11923
|
// Handle update component with new data
|
|
12077
11924
|
React__default.useEffect(function () {
|
|
11925
|
+
var _a;
|
|
12078
11926
|
if (outerDisableCalendarDates === null || outerDisableCalendarDates === void 0 ? void 0 : outerDisableCalendarDates.availableDates) {
|
|
12079
11927
|
setDisableCalendarDates({
|
|
12080
11928
|
availableDates: __spreadArray$1([], __read(outerDisableCalendarDates.availableDates.sort(function (a, b) {
|
|
@@ -12086,6 +11934,9 @@ var useFilterCalendar = function (_a) {
|
|
|
12086
11934
|
})), false) : [],
|
|
12087
11935
|
});
|
|
12088
11936
|
}
|
|
11937
|
+
if (disabledDates && !!((_a = outerDisableCalendarDates === null || outerDisableCalendarDates === void 0 ? void 0 : outerDisableCalendarDates.disabledDates) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
11938
|
+
setDisabledDates(__assign$2(__assign$2({}, disabledDates), outerDisableCalendarDates.disabledDates));
|
|
11939
|
+
}
|
|
12089
11940
|
}, [outerDisableCalendarDates]);
|
|
12090
11941
|
// Handle Range Context initial selections
|
|
12091
11942
|
React__default.useEffect(function () {
|