willba-component-library 0.2.71 → 0.2.73
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/components/FilterCalendar/components/Footer.d.ts +10 -0
- package/lib/core/components/calendar/utils/checkForContinuousSelection.d.ts +3 -2
- package/lib/index.esm.js +190 -76
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +190 -76
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +190 -76
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/IconsSvg.tsx +2 -0
- package/src/components/FilterBar/components/buttons/tab-button/TabButton.css +1 -1
- package/src/components/FilterCalendar/FilterCalendar.css +14 -10
- package/src/components/FilterCalendar/FilterCalendar.stories.tsx +177 -426
- package/src/components/FilterCalendar/FilterCalendar.tsx +10 -91
- package/src/components/FilterCalendar/components/Footer.tsx +114 -0
- package/src/core/components/buttons/submit-button/SubmitButton.css +2 -0
- package/src/core/components/calendar/Calendar.css +18 -11
- package/src/core/components/calendar/Calendar.tsx +2 -1
- package/src/core/components/calendar/hooks/useCalendarTooltips.tsx +2 -0
- package/src/core/components/calendar/hooks/useUpdateDisabledDates.tsx +3 -1
- package/src/core/components/calendar/utils/checkForContinuousSelection.tsx +45 -12
- package/src/core/components/calendar/utils/handleCalendarModifiers.tsx +26 -6
- package/src/locales/en/common.json +2 -2
- package/src/locales/fi/common.json +3 -3
- package/src/themes/Default.css +7 -5
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DateRange } from 'react-day-picker';
|
|
3
|
+
import { Palette } from '../../../themes/useTheme';
|
|
4
|
+
export declare const Footer: ({ calendarHasError, calendarRange, handleClearDates, language, palette, }: {
|
|
5
|
+
calendarHasError: boolean;
|
|
6
|
+
calendarRange?: DateRange | undefined;
|
|
7
|
+
handleClearDates: () => void;
|
|
8
|
+
language?: string | undefined;
|
|
9
|
+
palette: Palette;
|
|
10
|
+
}) => React.JSX.Element;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { DateRange } from 'react-day-picker';
|
|
2
|
-
import { RangeContext } from '../CalendarTypes';
|
|
2
|
+
import { DisableCalendarDates, RangeContext } from '../CalendarTypes';
|
|
3
3
|
type Props = {
|
|
4
4
|
setCalendarHasError?: (arg: boolean) => void;
|
|
5
5
|
rangeContext?: RangeContext;
|
|
6
6
|
calendarRange?: DateRange;
|
|
7
7
|
calendarHasError?: boolean;
|
|
8
|
+
disabledDates?: DisableCalendarDates['disabledDates'];
|
|
8
9
|
};
|
|
9
|
-
export declare const checkForContinuousSelection: ({ setCalendarHasError, rangeContext, calendarRange, calendarHasError, }: Props) => void;
|
|
10
|
+
export declare const checkForContinuousSelection: ({ setCalendarHasError, rangeContext, calendarRange, calendarHasError, disabledDates, }: Props) => void;
|
|
10
11
|
export {};
|
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-
|
|
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-error: #d32f2f;\n\n /* Transparent */\n --will-transparent-black: rgba(0, 0, 0, 0.5);\n --will-transparent-white: rgba(255, 255, 255, 0.30);\n --will-transparent-lavender: rgba(171, 167, 175, 0.30);\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 /* Shadows */\n --will-box-shadow-dark: 0px 2px 12px 2px #a1a1a180;\n --will-box-shadow-light: 0px 2px 12px 2px #bcb9b980;\n\n /* Breakpoints */\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 () {
|
|
@@ -2859,8 +2859,8 @@ var checkOutOnly$1 = "Check-out only";
|
|
|
2859
2859
|
var checkInOnly$1 = "Check-in only";
|
|
2860
2860
|
var errors$1 = {
|
|
2861
2861
|
calendarErrors: {
|
|
2862
|
-
checkInAvailabilityError: "
|
|
2863
|
-
checkInAvailabilityGuide: "
|
|
2862
|
+
checkInAvailabilityError: "All room reservations in a single purchase must be for the same dates.",
|
|
2863
|
+
checkInAvailabilityGuide: "If you need reservations for different dates, please make a separate purchase."
|
|
2864
2864
|
}
|
|
2865
2865
|
};
|
|
2866
2866
|
var enCommon = {
|
|
@@ -2925,11 +2925,11 @@ var clearDates = "Tyhjennä";
|
|
|
2925
2925
|
var noCheckIn = "Huone ei saatavilla";
|
|
2926
2926
|
var noCheckOut = "Uloskirjaus ei saatavilla";
|
|
2927
2927
|
var checkOutOnly = "Vain uloskirjaus";
|
|
2928
|
-
var checkInOnly = "
|
|
2928
|
+
var checkInOnly = "Vain sisäänkirjautuminen";
|
|
2929
2929
|
var errors = {
|
|
2930
2930
|
calendarErrors: {
|
|
2931
|
-
checkInAvailabilityError: "
|
|
2932
|
-
checkInAvailabilityGuide: "
|
|
2931
|
+
checkInAvailabilityError: "Yhdellä ostolla tehdyt huonevaraukset tulee olla samalle ajankohdalle.",
|
|
2932
|
+
checkInAvailabilityGuide: "Jos tarvitset huonevarauksia eri ajankohdille, ole hyvä ja tee uusi osto."
|
|
2933
2933
|
}
|
|
2934
2934
|
};
|
|
2935
2935
|
var fiCommon = {
|
|
@@ -2991,7 +2991,7 @@ var useCloseFilterSection = function (_a) {
|
|
|
2991
2991
|
return { filtersRef: filtersRef };
|
|
2992
2992
|
};
|
|
2993
2993
|
|
|
2994
|
-
var css_248z$b = ".will-filter-bar-submit-button {\n width: auto;\n height: auto;\n padding: 10px 20px;\n border-radius: 20px;\n cursor: pointer;\n border: none;\n white-space: nowrap;\n text-transform: uppercase;\n font-size: 12px;\n display: flex;\n align-items: center;\n user-select: none;\n}\n\n/* Submit button variants */\n.will-filter-bar-submit-button.default {\n background-color: var(--will-primary);\n color: var(--will-white);\n}\n\n.will-filter-bar-submit-button.text {\n background-color: transparent;\n color: var(--will-black);\n text-decoration: underline;\n font-weight: 500;\n}\n\n.will-filter-bar-submit-button span {\n margin-right: 10px;\n display: flex;\n}\n\nbutton.will-filter-bar-submit-button:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n\n@media (max-width: 960px) {\n .will-filter-bar-submit-button {\n justify-content: center;\n \n }\n}\n\n/* --- */\n\n@keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n}\n";
|
|
2994
|
+
var css_248z$b = ".will-filter-bar-submit-button {\n width: auto;\n height: auto;\n padding: 10px 20px;\n border-radius: 20px;\n cursor: pointer;\n border: none;\n white-space: nowrap;\n text-transform: uppercase;\n font-size: 12px;\n display: flex;\n align-items: center;\n user-select: none;\n}\n\n/* Submit button variants */\n.will-filter-bar-submit-button.default {\n background-color: var(--will-primary);\n color: var(--will-white);\n}\n\n.will-filter-bar-submit-button.text {\n background-color: transparent;\n color: var(--will-black);\n text-decoration: underline;\n font-weight: 500;\n font-size: 15px;\n padding: 0 10px;\n}\n\n.will-filter-bar-submit-button span {\n margin-right: 10px;\n display: flex;\n}\n\nbutton.will-filter-bar-submit-button:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n\n@media (max-width: 960px) {\n .will-filter-bar-submit-button {\n justify-content: center;\n \n }\n}\n\n/* --- */\n\n@keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n}\n";
|
|
2995
2995
|
styleInject(css_248z$b);
|
|
2996
2996
|
|
|
2997
2997
|
var SubmitButton = function (_a) {
|
|
@@ -3495,6 +3495,78 @@ function addYears(dirtyDate, dirtyAmount) {
|
|
|
3495
3495
|
return addMonths(dirtyDate, amount * 12);
|
|
3496
3496
|
}
|
|
3497
3497
|
|
|
3498
|
+
/**
|
|
3499
|
+
* @name areIntervalsOverlapping
|
|
3500
|
+
* @category Interval Helpers
|
|
3501
|
+
* @summary Is the given time interval overlapping with another time interval?
|
|
3502
|
+
*
|
|
3503
|
+
* @description
|
|
3504
|
+
* Is the given time interval overlapping with another time interval? Adjacent intervals do not count as overlapping.
|
|
3505
|
+
*
|
|
3506
|
+
* @param {Interval} intervalLeft - the first interval to compare. See [Interval]{@link https://date-fns.org/docs/Interval}
|
|
3507
|
+
* @param {Interval} intervalRight - the second interval to compare. See [Interval]{@link https://date-fns.org/docs/Interval}
|
|
3508
|
+
* @param {Object} [options] - the object with options
|
|
3509
|
+
* @param {Boolean} [options.inclusive=false] - whether the comparison is inclusive or not
|
|
3510
|
+
* @returns {Boolean} whether the time intervals are overlapping
|
|
3511
|
+
* @throws {TypeError} 2 arguments required
|
|
3512
|
+
* @throws {RangeError} The start of an interval cannot be after its end
|
|
3513
|
+
* @throws {RangeError} Date in interval cannot be `Invalid Date`
|
|
3514
|
+
*
|
|
3515
|
+
* @example
|
|
3516
|
+
* // For overlapping time intervals:
|
|
3517
|
+
* areIntervalsOverlapping(
|
|
3518
|
+
* { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
|
|
3519
|
+
* { start: new Date(2014, 0, 17), end: new Date(2014, 0, 21) }
|
|
3520
|
+
* )
|
|
3521
|
+
* //=> true
|
|
3522
|
+
*
|
|
3523
|
+
* @example
|
|
3524
|
+
* // For non-overlapping time intervals:
|
|
3525
|
+
* areIntervalsOverlapping(
|
|
3526
|
+
* { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
|
|
3527
|
+
* { start: new Date(2014, 0, 21), end: new Date(2014, 0, 22) }
|
|
3528
|
+
* )
|
|
3529
|
+
* //=> false
|
|
3530
|
+
*
|
|
3531
|
+
* @example
|
|
3532
|
+
* // For adjacent time intervals:
|
|
3533
|
+
* areIntervalsOverlapping(
|
|
3534
|
+
* { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
|
|
3535
|
+
* { start: new Date(2014, 0, 20), end: new Date(2014, 0, 30) }
|
|
3536
|
+
* )
|
|
3537
|
+
* //=> false
|
|
3538
|
+
*
|
|
3539
|
+
* @example
|
|
3540
|
+
* // Using the inclusive option:
|
|
3541
|
+
* areIntervalsOverlapping(
|
|
3542
|
+
* { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
|
|
3543
|
+
* { start: new Date(2014, 0, 20), end: new Date(2014, 0, 24) }
|
|
3544
|
+
* )
|
|
3545
|
+
* //=> false
|
|
3546
|
+
* areIntervalsOverlapping(
|
|
3547
|
+
* { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
|
|
3548
|
+
* { start: new Date(2014, 0, 20), end: new Date(2014, 0, 24) },
|
|
3549
|
+
* { inclusive: true }
|
|
3550
|
+
* )
|
|
3551
|
+
* //=> true
|
|
3552
|
+
*/
|
|
3553
|
+
function areIntervalsOverlapping(intervalLeft, intervalRight, options) {
|
|
3554
|
+
requiredArgs(2, arguments);
|
|
3555
|
+
var leftStartTime = toDate(intervalLeft === null || intervalLeft === void 0 ? void 0 : intervalLeft.start).getTime();
|
|
3556
|
+
var leftEndTime = toDate(intervalLeft === null || intervalLeft === void 0 ? void 0 : intervalLeft.end).getTime();
|
|
3557
|
+
var rightStartTime = toDate(intervalRight === null || intervalRight === void 0 ? void 0 : intervalRight.start).getTime();
|
|
3558
|
+
var rightEndTime = toDate(intervalRight === null || intervalRight === void 0 ? void 0 : intervalRight.end).getTime();
|
|
3559
|
+
|
|
3560
|
+
// Throw an exception if start date is after end date or if any date is `Invalid Date`
|
|
3561
|
+
if (!(leftStartTime <= leftEndTime && rightStartTime <= rightEndTime)) {
|
|
3562
|
+
throw new RangeError('Invalid interval');
|
|
3563
|
+
}
|
|
3564
|
+
if (options !== null && options !== void 0 && options.inclusive) {
|
|
3565
|
+
return leftStartTime <= rightEndTime && rightStartTime <= leftEndTime;
|
|
3566
|
+
}
|
|
3567
|
+
return leftStartTime < rightEndTime && rightStartTime < leftEndTime;
|
|
3568
|
+
}
|
|
3569
|
+
|
|
3498
3570
|
/**
|
|
3499
3571
|
* @name max
|
|
3500
3572
|
* @category Common Helpers
|
|
@@ -7661,7 +7733,7 @@ function Caption(props) {
|
|
|
7661
7733
|
|
|
7662
7734
|
/** Render the Footer component (empty as default).*/
|
|
7663
7735
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
7664
|
-
function Footer(props) {
|
|
7736
|
+
function Footer$1(props) {
|
|
7665
7737
|
var _a = useDayPicker(), footer = _a.footer, styles = _a.styles, tfoot = _a.classNames.tfoot;
|
|
7666
7738
|
if (!footer)
|
|
7667
7739
|
return React__default__default.createElement(React__default__default.Fragment, null);
|
|
@@ -8815,7 +8887,7 @@ function Table(props) {
|
|
|
8815
8887
|
});
|
|
8816
8888
|
var HeadComponent = (_a = components === null || components === void 0 ? void 0 : components.Head) !== null && _a !== void 0 ? _a : Head;
|
|
8817
8889
|
var RowComponent = (_b = components === null || components === void 0 ? void 0 : components.Row) !== null && _b !== void 0 ? _b : Row;
|
|
8818
|
-
var FooterComponent = (_c = components === null || components === void 0 ? void 0 : components.Footer) !== null && _c !== void 0 ? _c : Footer;
|
|
8890
|
+
var FooterComponent = (_c = components === null || components === void 0 ? void 0 : components.Footer) !== null && _c !== void 0 ? _c : Footer$1;
|
|
8819
8891
|
return (React__default__default.createElement("table", { id: props.id, className: classNames.table, style: styles.table, role: "grid", "aria-labelledby": props['aria-labelledby'] },
|
|
8820
8892
|
!hideHead && React__default__default.createElement(HeadComponent, null),
|
|
8821
8893
|
React__default__default.createElement("tbody", { className: classNames.tbody, style: styles.tbody }, weeks.map(function (week) { return (React__default__default.createElement(RowComponent, { displayMonth: props.displayMonth, key: week.weekNumber, dates: week.dates, weekNumber: week.weekNumber })); })),
|
|
@@ -10923,6 +10995,8 @@ var IconsSvg = function (_a) {
|
|
|
10923
10995
|
verticalAlign: 'middle',
|
|
10924
10996
|
fill: fill,
|
|
10925
10997
|
overflow: 'hidden',
|
|
10998
|
+
minWidth: '25px',
|
|
10999
|
+
minHeight: '25px',
|
|
10926
11000
|
}, viewBox: "0 0 1024 1024", version: "1.1" },
|
|
10927
11001
|
React__default__default.createElement("path", { d: "M42.666667 896h938.666666L512 85.333333 42.666667 896z m512-128h-85.333334v-85.333333h85.333334v85.333333z m0-170.666667h-85.333334v-170.666666h85.333334v170.666666z" })));
|
|
10928
11002
|
}
|
|
@@ -11115,6 +11189,20 @@ var handleCalendarModifiers = function (_a) {
|
|
|
11115
11189
|
var calendarRangeTo = (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) && endOfDay(calendarRange.to);
|
|
11116
11190
|
var rangeContextFrom = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.from) && endOfDay(rangeContext.from);
|
|
11117
11191
|
var rangeContextTo = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.to) && endOfDay(rangeContext.to);
|
|
11192
|
+
var filteredOverlappingDates = overlappingDate
|
|
11193
|
+
? overlappingDate
|
|
11194
|
+
.filter(function (date) {
|
|
11195
|
+
var dateFrom = date.from ? endOfDay(date.from) : null;
|
|
11196
|
+
var isBeforeRange = dateFrom &&
|
|
11197
|
+
(findFirstPossibleRangeContextCheckIn === null || findFirstPossibleRangeContextCheckIn === void 0 ? void 0 : findFirstPossibleRangeContextCheckIn.checkIn) &&
|
|
11198
|
+
isBefore(dateFrom, findFirstPossibleRangeContextCheckIn === null || findFirstPossibleRangeContextCheckIn === void 0 ? void 0 : findFirstPossibleRangeContextCheckIn.checkIn);
|
|
11199
|
+
var isAfterRange = dateFrom &&
|
|
11200
|
+
(findLastPossibleRangeContextCheckOut === null || findLastPossibleRangeContextCheckOut === void 0 ? void 0 : findLastPossibleRangeContextCheckOut.lastCheckOut) &&
|
|
11201
|
+
isAfter(dateFrom, endOfDay(findLastPossibleRangeContextCheckOut === null || findLastPossibleRangeContextCheckOut === void 0 ? void 0 : findLastPossibleRangeContextCheckOut.lastCheckOut));
|
|
11202
|
+
return !(isBeforeRange || isAfterRange);
|
|
11203
|
+
})
|
|
11204
|
+
.map(function (date) { return ({ from: date.from }); })
|
|
11205
|
+
: [];
|
|
11118
11206
|
return {
|
|
11119
11207
|
booked: disabledDatesByPage.length
|
|
11120
11208
|
? disabledDatesByPage
|
|
@@ -11128,9 +11216,9 @@ var handleCalendarModifiers = function (_a) {
|
|
|
11128
11216
|
disabledAfterCheckIn: calendarRangeFrom
|
|
11129
11217
|
? [{ after: calendarRangeFrom }]
|
|
11130
11218
|
: [],
|
|
11131
|
-
overlappingDate:
|
|
11132
|
-
?
|
|
11133
|
-
: []
|
|
11219
|
+
overlappingDate: !calendarRangeFrom && !!filteredOverlappingDates.length
|
|
11220
|
+
? filteredOverlappingDates.map(function (date) { return ({ from: date.from }); })
|
|
11221
|
+
: [],
|
|
11134
11222
|
noActiveSelectionStart: rangeContextFrom || [],
|
|
11135
11223
|
noActiveSelectionMid: [
|
|
11136
11224
|
rangeContextFrom && rangeContextTo
|
|
@@ -11221,27 +11309,41 @@ var handleRangeContextDisabledDates = function (_a) {
|
|
|
11221
11309
|
// set setCalendarHasError to true. This will display an error message and
|
|
11222
11310
|
// prevent the submission of the selected dates.
|
|
11223
11311
|
var checkForContinuousSelection = function (_a) {
|
|
11224
|
-
var setCalendarHasError = _a.setCalendarHasError, rangeContext = _a.rangeContext, calendarRange = _a.calendarRange, calendarHasError = _a.calendarHasError;
|
|
11225
|
-
var calendarRangeFrom = (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from)
|
|
11226
|
-
var calendarRangeTo = (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to)
|
|
11227
|
-
var rangeContextFrom = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.from)
|
|
11228
|
-
var rangeContextTo = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.to)
|
|
11312
|
+
var setCalendarHasError = _a.setCalendarHasError, rangeContext = _a.rangeContext, calendarRange = _a.calendarRange, calendarHasError = _a.calendarHasError, disabledDates = _a.disabledDates;
|
|
11313
|
+
var calendarRangeFrom = (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from) && endOfDay(calendarRange.from);
|
|
11314
|
+
var calendarRangeTo = (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) && endOfDay(calendarRange.to);
|
|
11315
|
+
var rangeContextFrom = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.from) && endOfDay(rangeContext.from);
|
|
11316
|
+
var rangeContextTo = (rangeContext === null || rangeContext === void 0 ? void 0 : rangeContext.to) && endOfDay(rangeContext.to);
|
|
11229
11317
|
// Checking if rangeFrom is equal to or before rangeContextTo
|
|
11230
11318
|
var startIsEqualOrBeforeRangeContextEnd = calendarRangeFrom && rangeContextTo
|
|
11231
|
-
? isBefore(
|
|
11232
|
-
isEqual(
|
|
11319
|
+
? isBefore(calendarRangeFrom, rangeContextTo) ||
|
|
11320
|
+
isEqual(calendarRangeFrom, rangeContextTo)
|
|
11233
11321
|
: null;
|
|
11234
11322
|
// Checking if rangeTo is equal to or after rangeContextFrom
|
|
11235
11323
|
var endIsEqualOrAfterRangeContextStart = calendarRangeTo && rangeContextFrom && rangeContextTo
|
|
11236
|
-
? isAfter(
|
|
11237
|
-
isEqual(
|
|
11324
|
+
? isAfter(calendarRangeTo, rangeContextFrom) ||
|
|
11325
|
+
isEqual(calendarRangeTo, rangeContextFrom)
|
|
11238
11326
|
: null;
|
|
11327
|
+
// Check if selection overlapping unavailable dates
|
|
11328
|
+
var selectionOverlappingUnavailableDate = disabledDates === null || disabledDates === void 0 ? void 0 : disabledDates.find(function (range) {
|
|
11329
|
+
var rangeFrom = endOfDay(range.from);
|
|
11330
|
+
var rangeTo = endOfDay(range.to);
|
|
11331
|
+
return (rangeContextFrom &&
|
|
11332
|
+
rangeContextTo &&
|
|
11333
|
+
areIntervalsOverlapping({ start: rangeContextFrom, end: rangeContextTo }, { start: rangeFrom, end: rangeTo }) &&
|
|
11334
|
+
calendarRangeFrom &&
|
|
11335
|
+
calendarRangeTo &&
|
|
11336
|
+
areIntervalsOverlapping({ start: calendarRangeFrom, end: calendarRangeTo }, { start: rangeFrom, end: rangeTo }));
|
|
11337
|
+
});
|
|
11239
11338
|
useEffect(function () {
|
|
11240
11339
|
if ((rangeContext &&
|
|
11241
11340
|
calendarRangeFrom &&
|
|
11242
11341
|
!startIsEqualOrBeforeRangeContextEnd) ||
|
|
11243
|
-
(rangeContext &&
|
|
11244
|
-
|
|
11342
|
+
(rangeContext &&
|
|
11343
|
+
calendarRangeTo &&
|
|
11344
|
+
!endIsEqualOrAfterRangeContextStart) ||
|
|
11345
|
+
selectionOverlappingUnavailableDate) {
|
|
11346
|
+
!!(setCalendarHasError && !calendarHasError) && setCalendarHasError(true);
|
|
11245
11347
|
}
|
|
11246
11348
|
});
|
|
11247
11349
|
};
|
|
@@ -11268,6 +11370,8 @@ var useCalendarTooltips = function (_a) {
|
|
|
11268
11370
|
// Append children to parents
|
|
11269
11371
|
var tooltipClonesCheckIn = [];
|
|
11270
11372
|
var tooltipClonesCheckOut = [];
|
|
11373
|
+
var tooltipClonesCheckInOnly = [];
|
|
11374
|
+
var tooltipClonesCheckOutOnly = [];
|
|
11271
11375
|
var tooltipClonesSpinner = [];
|
|
11272
11376
|
var tooltipClonesOverlappingDates = [];
|
|
11273
11377
|
if (calendarTooltip && calendarButtons.length > 0) {
|
|
@@ -11288,12 +11392,14 @@ var useCalendarTooltips = function (_a) {
|
|
|
11288
11392
|
calendarCheckOutOnly.forEach(function (element) {
|
|
11289
11393
|
var tooltipClone = calendarTooltipCheckOutOnly.cloneNode(true);
|
|
11290
11394
|
element.appendChild(tooltipClone);
|
|
11395
|
+
tooltipClonesCheckOutOnly.push(tooltipClone);
|
|
11291
11396
|
});
|
|
11292
11397
|
}
|
|
11293
11398
|
if (calendarTooltipCheckInOnly && calendarCheckInOnly.length > 0) {
|
|
11294
11399
|
calendarCheckInOnly.forEach(function (element) {
|
|
11295
11400
|
var tooltipClone = calendarTooltipCheckInOnly.cloneNode(true);
|
|
11296
11401
|
element.appendChild(tooltipClone);
|
|
11402
|
+
tooltipClonesCheckInOnly.push(tooltipClone);
|
|
11297
11403
|
});
|
|
11298
11404
|
}
|
|
11299
11405
|
if (loadingSpinner && calendarMonthContainer) {
|
|
@@ -11313,6 +11419,8 @@ var useCalendarTooltips = function (_a) {
|
|
|
11313
11419
|
tooltipClonesCheckOut.forEach(function (clone) { return clone.remove(); });
|
|
11314
11420
|
tooltipClonesSpinner.forEach(function (clone) { return clone.remove(); });
|
|
11315
11421
|
tooltipClonesOverlappingDates.forEach(function (clone) { return clone.remove(); });
|
|
11422
|
+
tooltipClonesCheckInOnly.forEach(function (clone) { return clone.remove(); });
|
|
11423
|
+
tooltipClonesCheckOutOnly.forEach(function (clone) { return clone.remove(); });
|
|
11316
11424
|
};
|
|
11317
11425
|
});
|
|
11318
11426
|
};
|
|
@@ -11365,18 +11473,15 @@ var useUpdateDisabledDates = function (_a) {
|
|
|
11365
11473
|
acc.updatedDisabledDates.push(dateRange);
|
|
11366
11474
|
}
|
|
11367
11475
|
return acc;
|
|
11368
|
-
}, { updatedDisabledDates: [], newOverlappingDates: [] }), updatedDisabledDates = _a.updatedDisabledDates,
|
|
11476
|
+
}, { updatedDisabledDates: [], newOverlappingDates: [] }), updatedDisabledDates = _a.updatedDisabledDates, newOverlappingDates = _a.newOverlappingDates;
|
|
11369
11477
|
// Find last possible checkout ( disable all dates after the last possible checkout )
|
|
11370
11478
|
var lastPossibleCheckout_1 = disableCalendarDates.availableDates[disableCalendarDates.availableDates.length - 1].lastCheckOut;
|
|
11371
11479
|
if (lastPossibleCheckout_1) {
|
|
11372
11480
|
setLatsPossibleCheckout({ after: lastPossibleCheckout_1 });
|
|
11373
11481
|
}
|
|
11374
11482
|
// Extract overlapping dates ( dates that are only available for checkout )
|
|
11375
|
-
if (
|
|
11376
|
-
setOverlappingDate(
|
|
11377
|
-
if (prev === void 0) { prev = []; }
|
|
11378
|
-
return __spreadArray$1(__spreadArray$1([], __read(prev), false), __read(newOverlappingDates_1), false);
|
|
11379
|
-
});
|
|
11483
|
+
if (newOverlappingDates.length) {
|
|
11484
|
+
setOverlappingDate(__spreadArray$1([], __read(newOverlappingDates), false));
|
|
11380
11485
|
}
|
|
11381
11486
|
var newDisableCalendarDates_1 = __assign$2(__assign$2({}, disableCalendarDates), { disabledDates: updatedDisabledDates });
|
|
11382
11487
|
return newDisableCalendarDates_1;
|
|
@@ -11388,13 +11493,14 @@ var useUpdateDisabledDates = function (_a) {
|
|
|
11388
11493
|
updateCalendarMonthNavigation,
|
|
11389
11494
|
updateCalendarDefaultMonth,
|
|
11390
11495
|
]);
|
|
11496
|
+
console.log('1111', overlappingDate);
|
|
11391
11497
|
return { newDisableCalendarDates: newDisableCalendarDates, overlappingDate: overlappingDate, lastPossibleCheckout: lastPossibleCheckout };
|
|
11392
11498
|
};
|
|
11393
11499
|
|
|
11394
11500
|
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}";
|
|
11395
11501
|
styleInject(css_248z$9);
|
|
11396
11502
|
|
|
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
|
|
11503
|
+
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.will-calendar-filter-container .DayPicker {\n font-size: 25px;\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 color: var(--will-transparent-black);\n opacity: 1\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/* Tooltips */\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 .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\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: 100%;\n border: 3px dashed var(--will-grey);\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/* 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@media (max-width: 600px) {\n /* Tooltips */\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 top: -70px;\n white-space: wrap;\n max-width: 120px;\n}\n}\n\n\n";
|
|
11398
11504
|
styleInject(css_248z$8);
|
|
11399
11505
|
|
|
11400
11506
|
var Calendar = forwardRef(function (_a, ref) {
|
|
@@ -11454,6 +11560,7 @@ var Calendar = forwardRef(function (_a, ref) {
|
|
|
11454
11560
|
rangeContext: rangeContext,
|
|
11455
11561
|
calendarRange: calendarRange,
|
|
11456
11562
|
calendarHasError: calendarHasError,
|
|
11563
|
+
disabledDates: newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates,
|
|
11457
11564
|
});
|
|
11458
11565
|
return (React__default__default.createElement("div", { className: "will-filter-bar-calendar", ref: ref },
|
|
11459
11566
|
React__default__default.createElement("div", { className: "will-calendar-filter-container" },
|
|
@@ -11735,7 +11842,7 @@ var SelectButton = function (_a) {
|
|
|
11735
11842
|
React__default__default.createElement("p", { className: "select-button-description ".concat(active ? 'active' : ''), dangerouslySetInnerHTML: { __html: description } })))));
|
|
11736
11843
|
};
|
|
11737
11844
|
|
|
11738
|
-
var css_248z$6 = ".will-filter-bar-tab-button {\n width: auto;\n height: auto;\n padding: 10px 20px;\n cursor: pointer;\n border: none;\n white-space: nowrap;\n font-size: 16px;\n display: flex;\n align-items: center;\n background-color: transparent;\n user-select: none;\n font-weight: 600;\n border-radius: 50px;\n }\n\n .will-filter-bar-tab-button.light {\n color: var(--will-white)\n }\n\n .will-filter-bar-tab-button.dark {\n color: var(--will-black)\n }\n\n .will-filter-bar-tab-button.light.active,\n .will-filter-bar-tab-button:hover {\n background-color: var(--will-transparent-white);\n }\n\n .will-filter-bar-tab-button.dark.active,\n .will-filter-bar-tab-button:hover {\n background-color: var(--will-transparent-
|
|
11845
|
+
var css_248z$6 = ".will-filter-bar-tab-button {\n width: auto;\n height: auto;\n padding: 10px 20px;\n cursor: pointer;\n border: none;\n white-space: nowrap;\n font-size: 16px;\n display: flex;\n align-items: center;\n background-color: transparent;\n user-select: none;\n font-weight: 600;\n border-radius: 50px;\n }\n\n .will-filter-bar-tab-button.light {\n color: var(--will-white)\n }\n\n .will-filter-bar-tab-button.dark {\n color: var(--will-black)\n }\n\n .will-filter-bar-tab-button.light.active,\n .will-filter-bar-tab-button:hover {\n background-color: var(--will-transparent-white);\n }\n\n .will-filter-bar-tab-button.dark.active,\n .will-filter-bar-tab-button:hover {\n background-color: var(--will-transparent-lavender);\n }\n\n \n\n";
|
|
11739
11846
|
styleInject(css_248z$6);
|
|
11740
11847
|
|
|
11741
11848
|
var TabButton = function (_a) {
|
|
@@ -12002,7 +12109,57 @@ var useFilterCalendar = function (_a) {
|
|
|
12002
12109
|
};
|
|
12003
12110
|
};
|
|
12004
12111
|
|
|
12005
|
-
var
|
|
12112
|
+
var Footer = function (_a) {
|
|
12113
|
+
var calendarHasError = _a.calendarHasError, calendarRange = _a.calendarRange, handleClearDates = _a.handleClearDates, language = _a.language, palette = _a.palette;
|
|
12114
|
+
var t = useTranslation().t;
|
|
12115
|
+
var isMobile = reactResponsiveExports.useMediaQuery({ maxWidth: 600 });
|
|
12116
|
+
var nights = nightsCount({
|
|
12117
|
+
calendarRange: calendarRange,
|
|
12118
|
+
});
|
|
12119
|
+
return (React__default__default.createElement(React__default__default.Fragment, null,
|
|
12120
|
+
React__default__default.createElement("div", { className: "will-calendar-footer-actions-wrapper" },
|
|
12121
|
+
React__default__default.createElement("div", { className: "will-calendar-footer-dates" },
|
|
12122
|
+
calendarHasError ? (React__default__default.createElement("span", null, t("common:errors.calendarErrors.checkInAvailabilityGuide"))) : (React__default__default.createElement("div", null,
|
|
12123
|
+
React__default__default.createElement("span", null, parseDate({
|
|
12124
|
+
date: calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from,
|
|
12125
|
+
dateFormat: 'EEEEEE d.M.yyyy',
|
|
12126
|
+
language: language,
|
|
12127
|
+
}) || t('common:checkIn')),
|
|
12128
|
+
React__default__default.createElement("span", { className: "will-calendar-footer-dates-separator" }, "-"),
|
|
12129
|
+
React__default__default.createElement("span", null, parseDate({
|
|
12130
|
+
date: calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to,
|
|
12131
|
+
dateFormat: 'EEEEEE d.M.yyyy',
|
|
12132
|
+
language: language,
|
|
12133
|
+
}) || t('common:checkOut')))),
|
|
12134
|
+
React__default__default.createElement("span", { className: "will-calendar-footer-booked" }, calendarHasError
|
|
12135
|
+
? "".concat(1, " ").concat(t("common:night"), " min")
|
|
12136
|
+
: nights
|
|
12137
|
+
? "".concat(nights, " ").concat(t("common:".concat(nights === 1 ? 'night' : 'nights')))
|
|
12138
|
+
: '')),
|
|
12139
|
+
React__default__default.createElement("div", { className: "will-calendar-footer-error" }, calendarHasError &&
|
|
12140
|
+
isMobile &&
|
|
12141
|
+
renderCalendarErrorMessage({
|
|
12142
|
+
palette: palette,
|
|
12143
|
+
message: t("common:errors.calendarErrors.checkInAvailabilityError"),
|
|
12144
|
+
})),
|
|
12145
|
+
React__default__default.createElement("div", { className: "will-calendar-footer-actions" },
|
|
12146
|
+
React__default__default.createElement(SubmitButton, { onClick: handleClearDates, disabled: !(calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from), label: t("common:clearDates"), variant: "text" }))),
|
|
12147
|
+
React__default__default.createElement("div", { className: "will-calendar-footer-error" }, calendarHasError &&
|
|
12148
|
+
!isMobile &&
|
|
12149
|
+
renderCalendarErrorMessage({
|
|
12150
|
+
palette: palette,
|
|
12151
|
+
message: t("common:errors.calendarErrors.checkInAvailabilityError"),
|
|
12152
|
+
}))));
|
|
12153
|
+
};
|
|
12154
|
+
/////////
|
|
12155
|
+
var renderCalendarErrorMessage = function (_a) {
|
|
12156
|
+
var message = _a.message, palette = _a.palette;
|
|
12157
|
+
return (React__default__default.createElement(React__default__default.Fragment, null,
|
|
12158
|
+
React__default__default.createElement(IconsSvg, { fill: (palette === null || palette === void 0 ? void 0 : palette.error) || 'inherit', size: 25, icon: "warning" }),
|
|
12159
|
+
React__default__default.createElement("span", null, message || '')));
|
|
12160
|
+
};
|
|
12161
|
+
|
|
12162
|
+
var css_248z = ".will-root .will-calendar-wrapper {\n box-shadow: var(--will-box-shadow-dark);\n border-radius: 20px;\n background-color: var(--will-white);\n position: absolute;\n top: 0;\n left: 0;\n \n}\n\n.will-root .will-calendar-wrapper .will-calendar-header,\n.will-root .will-calendar-wrapper .will-calendar-main,\n.will-root .will-calendar-wrapper .will-calendar-footer {\n padding: 20px;\n}\n\n/* Header */\n\n.will-root .will-calendar-wrapper .will-calendar-header {\n display: flex;\n justify-content: space-between;\n border-bottom: 1px solid var(--will-grey);\n align-items: center;\n}\n\n/* Footer */\n\n.will-root .will-calendar-wrapper .will-calendar-footer {\n border-top: 1px solid var(--will-grey);\n}\n\n/* Footer actions */\n\n.will-root .will-calendar-wrapper .will-calendar-footer-actions-wrapper {\n display: flex;\n justify-content: space-between;\n}\n\n.will-root .will-calendar-wrapper .will-calendar-footer-dates > div {\n margin-bottom: 5px;\n}\n\n.will-root .will-calendar-wrapper .will-calendar-footer-dates-separator {\n margin: 0 15px;\n}\n\n.will-root .will-calendar-wrapper .will-calendar-footer-dates .will-calendar-footer-booked {\n display: flex;\n min-height: 20.5px;\n margin-top: 10px;\n}\n\n.will-root .will-calendar-wrapper .will-calendar-footer-error {\n display: flex;\n align-items: center;\n margin-top: 10px;\n}\n\n.will-root .will-calendar-wrapper .will-calendar-footer-error span {\n display: inline-block;\n margin-left: 10px;\n}\n\n@media (max-width: 960px) {\n .will-root .will-calendar-wrapper {\n width: -webkit-fill-available;\n margin: 0 -6%;\n }\n\n .will-root .will-calendar-wrapper .will-calendar-header,\n .will-root .will-calendar-wrapper .will-calendar-main,\n .will-root .will-calendar-wrapper .will-calendar-footer {\n padding: 20px 10px;\n }\n\n .will-root .will-calendar-wrapper .will-calendar-footer-actions-wrapper {\n flex-direction: column;\n }\n\n .will-root .will-calendar-wrapper .will-calendar-footer-dates {\n text-align: center;\n }\n\n .will-root .will-calendar-wrapper .will-calendar-footer-dates .will-calendar-footer-booked {\n justify-content: center;\n }\n\n .will-root .will-calendar-wrapper .will-calendar-footer-actions {\n flex-direction: column;\n width: 100%;\n }\n\n .will-root .will-calendar-wrapper .will-calendar-footer-actions button{\n width: 100%;\n margin-top: 10px;\n }\n\n .will-root .will-calendar-wrapper .will-calendar-footer-error {\n margin-top: 10px;\n }\n\n .will-root .will-calendar-wrapper .will-calendar-footer-error span {\n text-align: center;\n margin-left: 5px;\n }\n }\n\n.will-root .will-calendar-wrapper .will-calendar-header .will-filter-bar-close-button {\n position: initial;\n}";
|
|
12006
12163
|
styleInject(css_248z);
|
|
12007
12164
|
|
|
12008
12165
|
function FilterCalendar(_a) {
|
|
@@ -12011,7 +12168,6 @@ function FilterCalendar(_a) {
|
|
|
12011
12168
|
// Translations
|
|
12012
12169
|
useUpdateTranslations({ language: language });
|
|
12013
12170
|
var t = useTranslation().t;
|
|
12014
|
-
var isMobile = reactResponsiveExports.useMediaQuery({ maxWidth: 690 });
|
|
12015
12171
|
var _b = useFilterCalendar({
|
|
12016
12172
|
onSubmit: onSubmit,
|
|
12017
12173
|
setToggleCalendar: setToggleCalendar,
|
|
@@ -12026,9 +12182,6 @@ function FilterCalendar(_a) {
|
|
|
12026
12182
|
var filtersRef = useCloseFilterSection({
|
|
12027
12183
|
handleSelectedFilter: setToggleCalendar,
|
|
12028
12184
|
}).filtersRef;
|
|
12029
|
-
var nights = nightsCount({
|
|
12030
|
-
calendarRange: calendarRange,
|
|
12031
|
-
});
|
|
12032
12185
|
return (React__default__default.createElement("div", { className: "will-root", style: themePalette }, toggleCalendar && (React__default__default.createElement("div", { className: "will-calendar-wrapper", ref: filtersRef },
|
|
12033
12186
|
React__default__default.createElement("div", { className: "will-calendar-header" },
|
|
12034
12187
|
React__default__default.createElement("h2", null, t('filterBar:calendar.title')),
|
|
@@ -12036,47 +12189,8 @@ function FilterCalendar(_a) {
|
|
|
12036
12189
|
React__default__default.createElement("div", { className: "will-calendar-main" },
|
|
12037
12190
|
React__default__default.createElement(Calendar, { calendarRange: calendarRange, setCalendarRange: setCalendarRange, calendarOffset: calendarOffset, selectedPath: '/rooms', language: language, disableCalendarDates: disableCalendarDates, requestDates: requestDates, disabledDates: disabledDates, setDisabledDates: setDisabledDates, updateCalendarMonthNavigation: updateCalendarMonthNavigation, setUpdateCalendarMonthNavigation: setUpdateCalendarMonthNavigation, updateCalendarDefaultMonth: updateCalendarDefaultMonth, loadingData: loadingData, showFeedback: showFeedback, noActiveSelection: noActiveSelection, palette: palette, setCalendarHasError: setCalendarHasError, setUpdatedForSubmit: setUpdatedForSubmit, rangeContext: rangeContext, calendarHasError: calendarHasError })),
|
|
12038
12191
|
React__default__default.createElement("div", { className: "will-calendar-footer" },
|
|
12039
|
-
React__default__default.createElement(
|
|
12040
|
-
React__default__default.createElement("div", { className: "will-calendar-footer-dates" },
|
|
12041
|
-
calendarHasError ? (React__default__default.createElement("span", null, t("common:errors.calendarErrors.checkInAvailabilityGuide"))) : (React__default__default.createElement("div", null,
|
|
12042
|
-
React__default__default.createElement("span", null, parseDate({
|
|
12043
|
-
date: calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from,
|
|
12044
|
-
dateFormat: 'EEEEEE d.M.yyyy',
|
|
12045
|
-
language: language,
|
|
12046
|
-
}) || t('common:checkIn')),
|
|
12047
|
-
React__default__default.createElement("span", { className: "will-calendar-footer-dates-separator" }, "-"),
|
|
12048
|
-
React__default__default.createElement("span", null, parseDate({
|
|
12049
|
-
date: calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to,
|
|
12050
|
-
dateFormat: 'EEEEEE d.M.yyyy',
|
|
12051
|
-
language: language,
|
|
12052
|
-
}) || t('common:checkOut')))),
|
|
12053
|
-
React__default__default.createElement("span", { className: "will-calendar-footer-booked" }, calendarHasError
|
|
12054
|
-
? t("filterBar:calendar.minNights")
|
|
12055
|
-
: nights
|
|
12056
|
-
? "".concat(nights, " ").concat(t("common:".concat(nights === 1 ? 'night' : 'nights')))
|
|
12057
|
-
: '')),
|
|
12058
|
-
calendarHasError &&
|
|
12059
|
-
isMobile &&
|
|
12060
|
-
renderCalendarErrorMessage({
|
|
12061
|
-
palette: palette,
|
|
12062
|
-
message: t("common:errors.calendarErrors.checkInAvailabilityError"),
|
|
12063
|
-
}),
|
|
12064
|
-
React__default__default.createElement("div", { className: "will-calendar-footer-actions" },
|
|
12065
|
-
React__default__default.createElement(SubmitButton, { onClick: handleClearDates, disabled: !(calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from), label: t("common:clearDates"), variant: "text" }))),
|
|
12066
|
-
calendarHasError &&
|
|
12067
|
-
!isMobile &&
|
|
12068
|
-
renderCalendarErrorMessage({
|
|
12069
|
-
palette: palette,
|
|
12070
|
-
message: t("common:errors.calendarErrors.checkInAvailabilityError"),
|
|
12071
|
-
}))))));
|
|
12192
|
+
React__default__default.createElement(Footer, { calendarHasError: calendarHasError, calendarRange: calendarRange, handleClearDates: handleClearDates, language: language, palette: palette }))))));
|
|
12072
12193
|
}
|
|
12073
|
-
/////////
|
|
12074
|
-
var renderCalendarErrorMessage = function (_a) {
|
|
12075
|
-
var message = _a.message, palette = _a.palette;
|
|
12076
|
-
return (React__default__default.createElement("div", { className: "will-calendar-footer-error" },
|
|
12077
|
-
React__default__default.createElement(IconsSvg, { fill: (palette === null || palette === void 0 ? void 0 : palette.error) || 'inherit', size: 25, icon: "warning" }),
|
|
12078
|
-
React__default__default.createElement("span", { style: { marginLeft: '10px' } }, message || '')));
|
|
12079
|
-
};
|
|
12080
12194
|
|
|
12081
12195
|
export { Button$1 as Button, FilterBar, FilterCalendar };
|
|
12082
12196
|
//# sourceMappingURL=index.esm.js.map
|