willba-component-library 0.3.10 → 0.3.12
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/assets/IconsSvg.d.ts +1 -2
- package/lib/components/Button/Button.d.ts +6 -6
- package/lib/components/FilterBar/FilterBar.d.ts +1 -2
- package/lib/components/FilterBar/FilterBarTypes.d.ts +3 -13
- package/lib/components/FilterBar/components/buttons/select-button/SelectButton.d.ts +1 -2
- package/lib/components/FilterBar/components/buttons/tab-button/TabButton.d.ts +1 -2
- package/lib/components/FilterBar/components/cards/image-card/ImageCard.d.ts +1 -2
- package/lib/components/FilterBar/components/categories/Categories.d.ts +1 -2
- package/lib/components/FilterBar/components/common/FilterSectionHeader.d.ts +2 -2
- package/lib/components/FilterBar/components/dates/Dates.d.ts +5 -4
- package/lib/components/FilterBar/components/divider/Divider.d.ts +1 -2
- package/lib/components/FilterBar/components/guests/Guests.d.ts +1 -2
- package/lib/components/FilterBar/components/locations/Locations.d.ts +1 -2
- package/lib/components/FilterBar/utils/index.d.ts +1 -1
- package/lib/components/FilterBar/utils/parseLocations.d.ts +1 -2
- package/lib/components/FilterCalendar/FilterCalendar.d.ts +1 -2
- package/lib/components/FilterCalendar/components/Footer.d.ts +1 -2
- package/lib/core/components/buttons/close-button/CloseButton.d.ts +1 -2
- package/lib/core/components/buttons/submit-button/SubmitButton.d.ts +2 -2
- package/lib/core/components/calendar/Calendar.d.ts +1 -2
- package/lib/index.d.ts +11 -19
- package/lib/index.esm.js +346 -359
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +431 -444
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +433 -447
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/rollup.config.mjs +1 -1
- package/src/assets/IconsSvg.tsx +0 -2
- package/src/components/Button/Button.stories.tsx +15 -16
- package/src/components/Button/Button.tsx +15 -15
- package/src/components/FilterBar/FilterBar.css +1 -1
- package/src/components/FilterBar/FilterBar.stories.tsx +14 -50
- package/src/components/FilterBar/FilterBar.tsx +44 -13
- package/src/components/FilterBar/FilterBarTypes.ts +3 -14
- package/src/components/FilterBar/components/buttons/select-button/SelectButton.tsx +13 -2
- package/src/components/FilterBar/components/buttons/tab-button/TabButton.tsx +0 -2
- package/src/components/FilterBar/components/cards/image-card/ImageCard.css +0 -1
- package/src/components/FilterBar/components/cards/image-card/ImageCard.tsx +1 -1
- package/src/components/FilterBar/components/categories/Categories.tsx +2 -1
- package/src/components/FilterBar/components/common/FilterSectionHeader.css +1 -0
- package/src/components/FilterBar/components/common/FilterSectionHeader.tsx +2 -1
- package/src/components/FilterBar/components/dates/Dates.css +3 -0
- package/src/components/FilterBar/components/dates/Dates.tsx +5 -4
- package/src/components/FilterBar/components/divider/Divider.tsx +0 -2
- package/src/components/FilterBar/components/guests/GuestCount/GuestCount.tsx +1 -1
- package/src/components/FilterBar/components/guests/Guests.css +1 -1
- package/src/components/FilterBar/components/guests/Guests.tsx +11 -2
- package/src/components/FilterBar/components/locations/Locations.css +1 -1
- package/src/components/FilterBar/components/locations/Locations.tsx +16 -36
- package/src/components/FilterBar/utils/calculateDropdownPosition.tsx +106 -0
- package/src/components/FilterBar/utils/index.tsx +1 -1
- package/src/components/FilterBar/utils/parseLocations.tsx +3 -7
- package/src/components/FilterCalendar/FilterCalendar.stories.tsx +1 -1
- package/src/components/FilterCalendar/FilterCalendar.tsx +0 -1
- package/src/components/FilterCalendar/components/Footer.tsx +0 -1
- package/src/core/components/buttons/close-button/CloseButton.tsx +0 -1
- package/src/core/components/buttons/submit-button/SubmitButton.tsx +1 -1
- package/src/core/components/calendar/Calendar.tsx +7 -4
- package/stories/Button.tsx +14 -11
- package/stories/Header.tsx +27 -14
- package/stories/Page.tsx +39 -21
- package/src/components/FilterBar/utils/getLocalizedContent.tsx +0 -21
package/lib/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.WillbaComponentLibrary = {}, global.React));
|
|
5
|
-
})(this, (function (exports,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.WillbaComponentLibrary = {}, global.jsxRuntime, global.React));
|
|
5
|
+
})(this, (function (exports, jsxRuntime, React__default) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
8
|
var n = Object.create(null);
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
return Object.freeze(n);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var React__default__namespace = /*#__PURE__*/_interopNamespaceDefault(React__default);
|
|
25
25
|
|
|
26
26
|
/******************************************************************************
|
|
27
27
|
Copyright (c) Microsoft Corporation.
|
|
@@ -213,16 +213,16 @@
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
var css_248z$
|
|
217
|
-
styleInject(css_248z$
|
|
216
|
+
var css_248z$h = ".storybook-button {\n font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;\n font-weight: 700;\n border: 0;\n border-radius: 3em;\n cursor: pointer;\n display: inline-block;\n line-height: 1;\n}\n.storybook-button--primary {\n color: white;\n background-color: #1ea7fd;\n}\n.storybook-button--secondary {\n color: #333;\n background-color: transparent;\n box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;\n}\n.storybook-button--small {\n font-size: 12px;\n padding: 10px 16px;\n}\n.storybook-button--medium {\n font-size: 14px;\n padding: 11px 20px;\n}\n.storybook-button--large {\n font-size: 16px;\n padding: 12px 24px;\n}";
|
|
217
|
+
styleInject(css_248z$h);
|
|
218
218
|
|
|
219
219
|
/**
|
|
220
220
|
* Primary UI component for user interaction
|
|
221
221
|
*/
|
|
222
222
|
var Button$1 = function (_a) {
|
|
223
|
-
var _b = _a.type, type = _b === void 0 ?
|
|
224
|
-
var _d = __read(
|
|
225
|
-
return (
|
|
223
|
+
var _b = _a.type, type = _b === void 0 ? 'primary' : _b, textColor = _a.textColor, _c = _a.size, size = _c === void 0 ? 'medium' : _c, onClick = _a.onClick, label = _a.label;
|
|
224
|
+
var _d = __read(React__default.useState(4), 2), theState = _d[0]; _d[1];
|
|
225
|
+
return (jsxRuntime.jsx("button", { type: "button", className: classNames('storybook-button', "storybook-button--".concat(size), "storybook-button--".concat(type)), style: textColor ? { color: textColor } : {}, onClick: onClick, children: "".concat(label, " ").concat(theState) }));
|
|
226
226
|
};
|
|
227
227
|
|
|
228
228
|
function warn() {
|
|
@@ -363,7 +363,7 @@
|
|
|
363
363
|
}
|
|
364
364
|
};
|
|
365
365
|
|
|
366
|
-
const I18nContext =
|
|
366
|
+
const I18nContext = React__default.createContext();
|
|
367
367
|
class ReportNamespaces {
|
|
368
368
|
constructor() {
|
|
369
369
|
this.usedNamespaces = {};
|
|
@@ -379,8 +379,8 @@
|
|
|
379
379
|
}
|
|
380
380
|
|
|
381
381
|
const usePrevious = (value, ignore) => {
|
|
382
|
-
const ref =
|
|
383
|
-
|
|
382
|
+
const ref = React__default.useRef();
|
|
383
|
+
React__default.useEffect(() => {
|
|
384
384
|
ref.current = ignore ? ref.current : value;
|
|
385
385
|
}, [value, ignore]);
|
|
386
386
|
return ref.current;
|
|
@@ -393,7 +393,7 @@
|
|
|
393
393
|
const {
|
|
394
394
|
i18n: i18nFromContext,
|
|
395
395
|
defaultNS: defaultNSFromContext
|
|
396
|
-
} =
|
|
396
|
+
} = React__default.useContext(I18nContext) || {};
|
|
397
397
|
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
398
398
|
if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
|
|
399
399
|
if (!i18n) {
|
|
@@ -426,12 +426,12 @@
|
|
|
426
426
|
function getT() {
|
|
427
427
|
return i18n.getFixedT(props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
|
|
428
428
|
}
|
|
429
|
-
const [t, setT] =
|
|
429
|
+
const [t, setT] = React__default.useState(getT);
|
|
430
430
|
let joinedNS = namespaces.join();
|
|
431
431
|
if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
|
|
432
432
|
const previousJoinedNS = usePrevious(joinedNS);
|
|
433
|
-
const isMounted =
|
|
434
|
-
|
|
433
|
+
const isMounted = React__default.useRef(true);
|
|
434
|
+
React__default.useEffect(() => {
|
|
435
435
|
const {
|
|
436
436
|
bindI18n,
|
|
437
437
|
bindI18nStore
|
|
@@ -462,8 +462,8 @@
|
|
|
462
462
|
if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(e => i18n.store.off(e, boundReset));
|
|
463
463
|
};
|
|
464
464
|
}, [i18n, joinedNS]);
|
|
465
|
-
const isInitial =
|
|
466
|
-
|
|
465
|
+
const isInitial = React__default.useRef(true);
|
|
466
|
+
React__default.useEffect(() => {
|
|
467
467
|
if (isMounted.current && !isInitial.current) {
|
|
468
468
|
setT(getT);
|
|
469
469
|
}
|
|
@@ -491,7 +491,7 @@
|
|
|
491
491
|
style: undefined,
|
|
492
492
|
attr: undefined
|
|
493
493
|
};
|
|
494
|
-
var IconContext =
|
|
494
|
+
var IconContext = React__default.createContext && React__default.createContext(DefaultContext);
|
|
495
495
|
|
|
496
496
|
var __assign$1 = undefined && undefined.__assign || function () {
|
|
497
497
|
__assign$1 = Object.assign || function (t) {
|
|
@@ -513,7 +513,7 @@
|
|
|
513
513
|
};
|
|
514
514
|
function Tree2Element(tree) {
|
|
515
515
|
return tree && tree.map(function (node, i) {
|
|
516
|
-
return
|
|
516
|
+
return React__default.createElement(node.tag, __assign$1({
|
|
517
517
|
key: i
|
|
518
518
|
}, node.attr), Tree2Element(node.child));
|
|
519
519
|
});
|
|
@@ -521,7 +521,7 @@
|
|
|
521
521
|
function GenIcon(data) {
|
|
522
522
|
// eslint-disable-next-line react/display-name
|
|
523
523
|
return function (props) {
|
|
524
|
-
return
|
|
524
|
+
return React__default.createElement(IconBase, __assign$1({
|
|
525
525
|
attr: __assign$1({}, data.attr)
|
|
526
526
|
}, props), Tree2Element(data.child));
|
|
527
527
|
};
|
|
@@ -536,7 +536,7 @@
|
|
|
536
536
|
var className;
|
|
537
537
|
if (conf.className) className = conf.className;
|
|
538
538
|
if (props.className) className = (className ? className + " " : "") + props.className;
|
|
539
|
-
return
|
|
539
|
+
return React__default.createElement("svg", __assign$1({
|
|
540
540
|
stroke: "currentColor",
|
|
541
541
|
fill: "currentColor",
|
|
542
542
|
strokeWidth: "0"
|
|
@@ -548,9 +548,9 @@
|
|
|
548
548
|
height: computedSize,
|
|
549
549
|
width: computedSize,
|
|
550
550
|
xmlns: "http://www.w3.org/2000/svg"
|
|
551
|
-
}), title &&
|
|
551
|
+
}), title && React__default.createElement("title", null, title), props.children);
|
|
552
552
|
};
|
|
553
|
-
return IconContext !== undefined ?
|
|
553
|
+
return IconContext !== undefined ? React__default.createElement(IconContext.Consumer, null, function (conf) {
|
|
554
554
|
return elem(conf);
|
|
555
555
|
}) : elem(DefaultContext);
|
|
556
556
|
}
|
|
@@ -572,12 +572,12 @@
|
|
|
572
572
|
return themePalette;
|
|
573
573
|
}
|
|
574
574
|
|
|
575
|
-
var css_248z$
|
|
576
|
-
styleInject(css_248z$
|
|
575
|
+
var css_248z$g = "@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-light-grey: #C8C8C8;\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";
|
|
576
|
+
styleInject(css_248z$g);
|
|
577
577
|
|
|
578
578
|
var useAwaitRender = function () {
|
|
579
|
-
var _a = __read(
|
|
580
|
-
|
|
579
|
+
var _a = __read(React__default.useState(false), 2), initialRenderComplete = _a[0], setInitialRenderComplete = _a[1];
|
|
580
|
+
React__default.useEffect(function () {
|
|
581
581
|
setInitialRenderComplete(true);
|
|
582
582
|
}, []);
|
|
583
583
|
if (!initialRenderComplete)
|
|
@@ -2972,8 +2972,8 @@
|
|
|
2972
2972
|
|
|
2973
2973
|
var useUpdateTranslations = function (_a) {
|
|
2974
2974
|
var language = _a.language;
|
|
2975
|
-
var _b = __read(
|
|
2976
|
-
|
|
2975
|
+
var _b = __read(React__default.useState(0), 2); _b[0]; var setRerenderKey = _b[1];
|
|
2976
|
+
React__default.useEffect(function () {
|
|
2977
2977
|
instance.changeLanguage(language);
|
|
2978
2978
|
setRerenderKey(function (prevKey) { return prevKey + 1; });
|
|
2979
2979
|
}, [language]);
|
|
@@ -2982,8 +2982,8 @@
|
|
|
2982
2982
|
// TODO - Refactor and rename this hook
|
|
2983
2983
|
var useCloseFilterSection = function (_a) {
|
|
2984
2984
|
var handleSelectedFilter = _a.handleSelectedFilter;
|
|
2985
|
-
var filtersRef =
|
|
2986
|
-
|
|
2985
|
+
var filtersRef = React__default.useRef(null);
|
|
2986
|
+
React__default.useEffect(function () {
|
|
2987
2987
|
var handleClickOutside = function (event) {
|
|
2988
2988
|
if (filtersRef.current &&
|
|
2989
2989
|
!filtersRef.current.contains(event.target)) {
|
|
@@ -2999,8 +2999,8 @@
|
|
|
2999
2999
|
};
|
|
3000
3000
|
|
|
3001
3001
|
var useAutoFocus = function (autoFocus) {
|
|
3002
|
-
var ref =
|
|
3003
|
-
|
|
3002
|
+
var ref = React__default.useRef(null);
|
|
3003
|
+
React__default.useEffect(function () {
|
|
3004
3004
|
if (!autoFocus || !ref.current)
|
|
3005
3005
|
return;
|
|
3006
3006
|
var attemptFocus = function (attempts) {
|
|
@@ -3020,14 +3020,12 @@
|
|
|
3020
3020
|
return ref;
|
|
3021
3021
|
};
|
|
3022
3022
|
|
|
3023
|
-
var css_248z$
|
|
3024
|
-
styleInject(css_248z$
|
|
3023
|
+
var css_248z$f = ".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";
|
|
3024
|
+
styleInject(css_248z$f);
|
|
3025
3025
|
|
|
3026
3026
|
var SubmitButton = function (_a) {
|
|
3027
3027
|
var onClick = _a.onClick, startIcon = _a.startIcon, label = _a.label, disabled = _a.disabled, isLoading = _a.isLoading, variant = _a.variant;
|
|
3028
|
-
return (
|
|
3029
|
-
isLoading ? (React.createElement("span", null, React.createElement(FaSpinner, { style: { animation: 'spin 1s linear infinite' } }))) : (startIcon && React.createElement("span", null, startIcon)),
|
|
3030
|
-
label || 'Label'));
|
|
3028
|
+
return (jsxRuntime.jsxs("button", { className: "will-filter-bar-submit-button ".concat(variant || 'default'), onClick: onClick, disabled: disabled || isLoading, children: [isLoading ? (jsxRuntime.jsx("span", { children: jsxRuntime.jsx(FaSpinner, { style: { animation: 'spin 1s linear infinite' } }) })) : (startIcon && jsxRuntime.jsx("span", { children: startIcon })), label || 'Label'] }));
|
|
3031
3029
|
};
|
|
3032
3030
|
|
|
3033
3031
|
// THIS FILE IS AUTO GENERATED
|
|
@@ -3035,13 +3033,12 @@
|
|
|
3035
3033
|
return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 512 512"},"child":[{"tag":"path","attr":{"d":"M331.3 308.7L278.6 256l52.7-52.7c6.2-6.2 6.2-16.4 0-22.6-6.2-6.2-16.4-6.2-22.6 0L256 233.4l-52.7-52.7c-6.2-6.2-15.6-7.1-22.6 0-7.1 7.1-6 16.6 0 22.6l52.7 52.7-52.7 52.7c-6.7 6.7-6.4 16.3 0 22.6 6.4 6.4 16.4 6.2 22.6 0l52.7-52.7 52.7 52.7c6.2 6.2 16.4 6.2 22.6 0 6.3-6.2 6.3-16.4 0-22.6z"}},{"tag":"path","attr":{"d":"M256 76c48.1 0 93.3 18.7 127.3 52.7S436 207.9 436 256s-18.7 93.3-52.7 127.3S304.1 436 256 436c-48.1 0-93.3-18.7-127.3-52.7S76 304.1 76 256s18.7-93.3 52.7-127.3S207.9 76 256 76m0-28C141.1 48 48 141.1 48 256s93.1 208 208 208 208-93.1 208-208S370.9 48 256 48z"}}]})(props);
|
|
3036
3034
|
}
|
|
3037
3035
|
|
|
3038
|
-
var css_248z$
|
|
3039
|
-
styleInject(css_248z$
|
|
3036
|
+
var css_248z$e = ".will-filter-bar-close-button {\n width: auto;\n height: auto;\n /* background-color: var(--will-grey); */\n color: var(--will-grey);\n padding: 2px 7px;\n border-radius: 50%;\n cursor: pointer;\n border: none;\n display: flex;\n align-items: center;\n font-size: 23px;\n /* display: none; */\n\n position: absolute;\n top: 10px;\n right: 10px;\n\n min-height: 35px;\n}\n\n@media (max-width: 960px) {\n .will-filter-bar-close-button {\n top: 10px;\n right: 10px;\n\n border-radius: 25px;\n margin-left:0;\n \n display: flex;\n justify-content: center;\n }\n}\n";
|
|
3037
|
+
styleInject(css_248z$e);
|
|
3040
3038
|
|
|
3041
3039
|
var CloseButton = function (_a) {
|
|
3042
3040
|
var handleClose = _a.handleClose;
|
|
3043
|
-
return (
|
|
3044
|
-
React.createElement(IoIosCloseCircleOutline, null)));
|
|
3041
|
+
return (jsxRuntime.jsx("button", { className: "will-filter-bar-close-button", onClick: handleClose, children: jsxRuntime.jsx(IoIosCloseCircleOutline, {}) }));
|
|
3045
3042
|
};
|
|
3046
3043
|
|
|
3047
3044
|
function _typeof(o) {
|
|
@@ -7322,7 +7319,7 @@
|
|
|
7322
7319
|
*
|
|
7323
7320
|
* Access to this context from the {@link useDayPicker} hook.
|
|
7324
7321
|
*/
|
|
7325
|
-
var DayPickerContext =
|
|
7322
|
+
var DayPickerContext = React__default.createContext(undefined);
|
|
7326
7323
|
/**
|
|
7327
7324
|
* The provider for the {@link DayPickerContext}, assigning the defaults from the
|
|
7328
7325
|
* initial DayPicker props.
|
|
@@ -7344,7 +7341,7 @@
|
|
|
7344
7341
|
onSelect = initialProps.onSelect;
|
|
7345
7342
|
}
|
|
7346
7343
|
var value = __assign(__assign(__assign({}, defaultContextValues), initialProps), { captionLayout: captionLayout, classNames: __assign(__assign({}, defaultContextValues.classNames), initialProps.classNames), components: __assign({}, initialProps.components), formatters: __assign(__assign({}, defaultContextValues.formatters), initialProps.formatters), fromDate: fromDate, labels: __assign(__assign({}, defaultContextValues.labels), initialProps.labels), mode: initialProps.mode || defaultContextValues.mode, modifiers: __assign(__assign({}, defaultContextValues.modifiers), initialProps.modifiers), modifiersClassNames: __assign(__assign({}, defaultContextValues.modifiersClassNames), initialProps.modifiersClassNames), onSelect: onSelect, styles: __assign(__assign({}, defaultContextValues.styles), initialProps.styles), toDate: toDate });
|
|
7347
|
-
return (
|
|
7344
|
+
return (React__default.createElement(DayPickerContext.Provider, { value: value }, props.children));
|
|
7348
7345
|
}
|
|
7349
7346
|
/**
|
|
7350
7347
|
* Hook to access the {@link DayPickerContextValue}.
|
|
@@ -7353,7 +7350,7 @@
|
|
|
7353
7350
|
* internal or custom components.
|
|
7354
7351
|
*/
|
|
7355
7352
|
function useDayPicker() {
|
|
7356
|
-
var context =
|
|
7353
|
+
var context = React__default.useContext(DayPickerContext);
|
|
7357
7354
|
if (!context) {
|
|
7358
7355
|
throw new Error("useDayPicker must be used within a DayPickerProvider.");
|
|
7359
7356
|
}
|
|
@@ -7363,15 +7360,15 @@
|
|
|
7363
7360
|
/** Render the caption for the displayed month. This component is used when `captionLayout="buttons"`. */
|
|
7364
7361
|
function CaptionLabel(props) {
|
|
7365
7362
|
var _a = useDayPicker(), locale = _a.locale, classNames = _a.classNames, styles = _a.styles, formatCaption = _a.formatters.formatCaption;
|
|
7366
|
-
return (
|
|
7363
|
+
return (React__default.createElement("div", { className: classNames.caption_label, style: styles.caption_label, "aria-live": "polite", role: "presentation", id: props.id }, formatCaption(props.displayMonth, { locale: locale })));
|
|
7367
7364
|
}
|
|
7368
7365
|
|
|
7369
7366
|
/**
|
|
7370
7367
|
* Render the icon in the styled drop-down.
|
|
7371
7368
|
*/
|
|
7372
7369
|
function IconDropdown(props) {
|
|
7373
|
-
return (
|
|
7374
|
-
|
|
7370
|
+
return (React__default.createElement("svg", __assign({ width: "8px", height: "8px", viewBox: "0 0 120 120", "data-testid": "iconDropdown" }, props),
|
|
7371
|
+
React__default.createElement("path", { d: "M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z", fill: "currentColor", fillRule: "nonzero" })));
|
|
7375
7372
|
}
|
|
7376
7373
|
|
|
7377
7374
|
/**
|
|
@@ -7383,12 +7380,12 @@
|
|
|
7383
7380
|
var onChange = props.onChange, value = props.value, children = props.children, caption = props.caption, className = props.className, style = props.style;
|
|
7384
7381
|
var dayPicker = useDayPicker();
|
|
7385
7382
|
var IconDropdownComponent = (_b = (_a = dayPicker.components) === null || _a === void 0 ? void 0 : _a.IconDropdown) !== null && _b !== void 0 ? _b : IconDropdown;
|
|
7386
|
-
return (
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7383
|
+
return (React__default.createElement("div", { className: className, style: style },
|
|
7384
|
+
React__default.createElement("span", { className: dayPicker.classNames.vhidden }, props['aria-label']),
|
|
7385
|
+
React__default.createElement("select", { name: props.name, "aria-label": props['aria-label'], className: dayPicker.classNames.dropdown, style: dayPicker.styles.dropdown, value: value, onChange: onChange }, children),
|
|
7386
|
+
React__default.createElement("div", { className: dayPicker.classNames.caption_label, style: dayPicker.styles.caption_label, "aria-hidden": "true" },
|
|
7390
7387
|
caption,
|
|
7391
|
-
|
|
7388
|
+
React__default.createElement(IconDropdownComponent, { className: dayPicker.classNames.dropdown_icon, style: dayPicker.styles.dropdown_icon }))));
|
|
7392
7389
|
}
|
|
7393
7390
|
|
|
7394
7391
|
/** Render the dropdown to navigate between months. */
|
|
@@ -7397,9 +7394,9 @@
|
|
|
7397
7394
|
var _b = useDayPicker(), fromDate = _b.fromDate, toDate = _b.toDate, styles = _b.styles, locale = _b.locale, formatMonthCaption = _b.formatters.formatMonthCaption, classNames = _b.classNames, components = _b.components, labelMonthDropdown = _b.labels.labelMonthDropdown;
|
|
7398
7395
|
// Dropdown should appear only when both from/toDate is set
|
|
7399
7396
|
if (!fromDate)
|
|
7400
|
-
return
|
|
7397
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
7401
7398
|
if (!toDate)
|
|
7402
|
-
return
|
|
7399
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
7403
7400
|
var dropdownMonths = [];
|
|
7404
7401
|
if (isSameYear(fromDate, toDate)) {
|
|
7405
7402
|
// only display the months included in the range
|
|
@@ -7421,7 +7418,7 @@
|
|
|
7421
7418
|
props.onChange(newMonth);
|
|
7422
7419
|
};
|
|
7423
7420
|
var DropdownComponent = (_a = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a !== void 0 ? _a : Dropdown;
|
|
7424
|
-
return (
|
|
7421
|
+
return (React__default.createElement(DropdownComponent, { name: "months", "aria-label": labelMonthDropdown(), className: classNames.dropdown_month, style: styles.dropdown_month, onChange: handleChange, value: props.displayMonth.getMonth(), caption: formatMonthCaption(props.displayMonth, { locale: locale }) }, dropdownMonths.map(function (m) { return (React__default.createElement("option", { key: m.getMonth(), value: m.getMonth() }, formatMonthCaption(m, { locale: locale }))); })));
|
|
7425
7422
|
}
|
|
7426
7423
|
|
|
7427
7424
|
/**
|
|
@@ -7435,9 +7432,9 @@
|
|
|
7435
7432
|
var years = [];
|
|
7436
7433
|
// Dropdown should appear only when both from/toDate is set
|
|
7437
7434
|
if (!fromDate)
|
|
7438
|
-
return
|
|
7435
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
7439
7436
|
if (!toDate)
|
|
7440
|
-
return
|
|
7437
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
7441
7438
|
var fromYear = fromDate.getFullYear();
|
|
7442
7439
|
var toYear = toDate.getFullYear();
|
|
7443
7440
|
for (var year = fromYear; year <= toYear; year++) {
|
|
@@ -7448,7 +7445,7 @@
|
|
|
7448
7445
|
props.onChange(newMonth);
|
|
7449
7446
|
};
|
|
7450
7447
|
var DropdownComponent = (_a = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a !== void 0 ? _a : Dropdown;
|
|
7451
|
-
return (
|
|
7448
|
+
return (React__default.createElement(DropdownComponent, { name: "years", "aria-label": labelYearDropdown(), className: classNames.dropdown_year, style: styles.dropdown_year, onChange: handleChange, value: displayMonth.getFullYear(), caption: formatYearCaption(displayMonth, { locale: locale }) }, years.map(function (year) { return (React__default.createElement("option", { key: year.getFullYear(), value: year.getFullYear() }, formatYearCaption(year, { locale: locale }))); })));
|
|
7452
7449
|
}
|
|
7453
7450
|
|
|
7454
7451
|
/**
|
|
@@ -7461,7 +7458,7 @@
|
|
|
7461
7458
|
* argument, which will be always returned as `value`.
|
|
7462
7459
|
*/
|
|
7463
7460
|
function useControlledValue(defaultValue, controlledValue) {
|
|
7464
|
-
var _a =
|
|
7461
|
+
var _a = React__default.useState(defaultValue), uncontrolledValue = _a[0], setValue = _a[1];
|
|
7465
7462
|
var value = controlledValue === undefined ? uncontrolledValue : controlledValue;
|
|
7466
7463
|
return [value, setValue];
|
|
7467
7464
|
}
|
|
@@ -7579,7 +7576,7 @@
|
|
|
7579
7576
|
* The Navigation context shares details and methods to navigate the months in DayPicker.
|
|
7580
7577
|
* Access this context from the {@link useNavigation} hook.
|
|
7581
7578
|
*/
|
|
7582
|
-
var NavigationContext =
|
|
7579
|
+
var NavigationContext = React__default.createContext(undefined);
|
|
7583
7580
|
/** Provides the values for the {@link NavigationContext}. */
|
|
7584
7581
|
function NavigationProvider(props) {
|
|
7585
7582
|
var dayPicker = useDayPicker();
|
|
@@ -7612,7 +7609,7 @@
|
|
|
7612
7609
|
nextMonth: nextMonth,
|
|
7613
7610
|
isDateDisplayed: isDateDisplayed
|
|
7614
7611
|
};
|
|
7615
|
-
return (
|
|
7612
|
+
return (React__default.createElement(NavigationContext.Provider, { value: value }, props.children));
|
|
7616
7613
|
}
|
|
7617
7614
|
/**
|
|
7618
7615
|
* Hook to access the {@link NavigationContextValue}. Use this hook to navigate
|
|
@@ -7621,7 +7618,7 @@
|
|
|
7621
7618
|
* This hook is meant to be used inside internal or custom components.
|
|
7622
7619
|
*/
|
|
7623
7620
|
function useNavigation() {
|
|
7624
|
-
var context =
|
|
7621
|
+
var context = React__default.useContext(NavigationContext);
|
|
7625
7622
|
if (!context) {
|
|
7626
7623
|
throw new Error('useNavigation must be used within a NavigationProvider');
|
|
7627
7624
|
}
|
|
@@ -7639,31 +7636,31 @@
|
|
|
7639
7636
|
goToMonth(newMonth);
|
|
7640
7637
|
};
|
|
7641
7638
|
var CaptionLabelComponent = (_a = components === null || components === void 0 ? void 0 : components.CaptionLabel) !== null && _a !== void 0 ? _a : CaptionLabel;
|
|
7642
|
-
var captionLabel = (
|
|
7643
|
-
return (
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7639
|
+
var captionLabel = (React__default.createElement(CaptionLabelComponent, { id: props.id, displayMonth: props.displayMonth }));
|
|
7640
|
+
return (React__default.createElement("div", { className: classNames.caption_dropdowns, style: styles.caption_dropdowns },
|
|
7641
|
+
React__default.createElement("div", { className: classNames.vhidden }, captionLabel),
|
|
7642
|
+
React__default.createElement(MonthsDropdown, { onChange: handleMonthChange, displayMonth: props.displayMonth }),
|
|
7643
|
+
React__default.createElement(YearsDropdown, { onChange: handleMonthChange, displayMonth: props.displayMonth })));
|
|
7647
7644
|
}
|
|
7648
7645
|
|
|
7649
7646
|
/**
|
|
7650
7647
|
* Render the "previous month" button in the navigation.
|
|
7651
7648
|
*/
|
|
7652
7649
|
function IconLeft(props) {
|
|
7653
|
-
return (
|
|
7654
|
-
|
|
7650
|
+
return (React__default.createElement("svg", __assign({ width: "16px", height: "16px", viewBox: "0 0 120 120" }, props),
|
|
7651
|
+
React__default.createElement("path", { d: "M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z", fill: "currentColor", fillRule: "nonzero" })));
|
|
7655
7652
|
}
|
|
7656
7653
|
|
|
7657
7654
|
/**
|
|
7658
7655
|
* Render the "next month" button in the navigation.
|
|
7659
7656
|
*/
|
|
7660
7657
|
function IconRight(props) {
|
|
7661
|
-
return (
|
|
7662
|
-
|
|
7658
|
+
return (React__default.createElement("svg", __assign({ width: "16px", height: "16px", viewBox: "0 0 120 120" }, props),
|
|
7659
|
+
React__default.createElement("path", { d: "M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z", fill: "currentColor" })));
|
|
7663
7660
|
}
|
|
7664
7661
|
|
|
7665
7662
|
/** Render a button HTML element applying the reset class name. */
|
|
7666
|
-
var Button =
|
|
7663
|
+
var Button = React__default.forwardRef(function (props, ref) {
|
|
7667
7664
|
var _a = useDayPicker(), classNames = _a.classNames, styles = _a.styles;
|
|
7668
7665
|
var classNamesArr = [classNames.button_reset, classNames.button];
|
|
7669
7666
|
if (props.className) {
|
|
@@ -7674,7 +7671,7 @@
|
|
|
7674
7671
|
if (props.style) {
|
|
7675
7672
|
Object.assign(style, props.style);
|
|
7676
7673
|
}
|
|
7677
|
-
return (
|
|
7674
|
+
return (React__default.createElement("button", __assign({}, props, { ref: ref, type: "button", className: className, style: style })));
|
|
7678
7675
|
});
|
|
7679
7676
|
|
|
7680
7677
|
/** A component rendering the navigation buttons or the drop-downs. */
|
|
@@ -7682,7 +7679,7 @@
|
|
|
7682
7679
|
var _a, _b;
|
|
7683
7680
|
var _c = useDayPicker(), dir = _c.dir, locale = _c.locale, classNames = _c.classNames, styles = _c.styles, _d = _c.labels, labelPrevious = _d.labelPrevious, labelNext = _d.labelNext, components = _c.components;
|
|
7684
7681
|
if (!props.nextMonth && !props.previousMonth) {
|
|
7685
|
-
return
|
|
7682
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
7686
7683
|
}
|
|
7687
7684
|
var previousLabel = labelPrevious(props.previousMonth, { locale: locale });
|
|
7688
7685
|
var previousClassName = [
|
|
@@ -7696,9 +7693,9 @@
|
|
|
7696
7693
|
].join(' ');
|
|
7697
7694
|
var IconRightComponent = (_a = components === null || components === void 0 ? void 0 : components.IconRight) !== null && _a !== void 0 ? _a : IconRight;
|
|
7698
7695
|
var IconLeftComponent = (_b = components === null || components === void 0 ? void 0 : components.IconLeft) !== null && _b !== void 0 ? _b : IconLeft;
|
|
7699
|
-
return (
|
|
7700
|
-
!props.hidePrevious && (
|
|
7701
|
-
!props.hideNext && (
|
|
7696
|
+
return (React__default.createElement("div", { className: classNames.nav, style: styles.nav },
|
|
7697
|
+
!props.hidePrevious && (React__default.createElement(Button, { name: "previous-month", "aria-label": previousLabel, className: previousClassName, style: styles.nav_button_previous, disabled: !props.previousMonth, onClick: props.onPreviousClick }, dir === 'rtl' ? (React__default.createElement(IconRightComponent, { className: classNames.nav_icon, style: styles.nav_icon })) : (React__default.createElement(IconLeftComponent, { className: classNames.nav_icon, style: styles.nav_icon })))),
|
|
7698
|
+
!props.hideNext && (React__default.createElement(Button, { name: "next-month", "aria-label": nextLabel, className: nextClassName, style: styles.nav_button_next, disabled: !props.nextMonth, onClick: props.onNextClick }, dir === 'rtl' ? (React__default.createElement(IconLeftComponent, { className: classNames.nav_icon, style: styles.nav_icon })) : (React__default.createElement(IconRightComponent, { className: classNames.nav_icon, style: styles.nav_icon }))))));
|
|
7702
7699
|
}
|
|
7703
7700
|
|
|
7704
7701
|
/**
|
|
@@ -7724,7 +7721,7 @@
|
|
|
7724
7721
|
return;
|
|
7725
7722
|
goToMonth(nextMonth);
|
|
7726
7723
|
};
|
|
7727
|
-
return (
|
|
7724
|
+
return (React__default.createElement(Navigation, { displayMonth: props.displayMonth, hideNext: hideNext, hidePrevious: hidePrevious, nextMonth: nextMonth, previousMonth: previousMonth, onPreviousClick: handlePreviousClick, onNextClick: handleNextClick }));
|
|
7728
7725
|
}
|
|
7729
7726
|
|
|
7730
7727
|
/**
|
|
@@ -7737,22 +7734,22 @@
|
|
|
7737
7734
|
var CaptionLabelComponent = (_a = components === null || components === void 0 ? void 0 : components.CaptionLabel) !== null && _a !== void 0 ? _a : CaptionLabel;
|
|
7738
7735
|
var caption;
|
|
7739
7736
|
if (disableNavigation) {
|
|
7740
|
-
caption = (
|
|
7737
|
+
caption = (React__default.createElement(CaptionLabelComponent, { id: props.id, displayMonth: props.displayMonth }));
|
|
7741
7738
|
}
|
|
7742
7739
|
else if (captionLayout === 'dropdown') {
|
|
7743
|
-
caption = (
|
|
7740
|
+
caption = (React__default.createElement(CaptionDropdowns, { displayMonth: props.displayMonth, id: props.id }));
|
|
7744
7741
|
}
|
|
7745
7742
|
else if (captionLayout === 'dropdown-buttons') {
|
|
7746
|
-
caption = (
|
|
7747
|
-
|
|
7748
|
-
|
|
7743
|
+
caption = (React__default.createElement(React__default.Fragment, null,
|
|
7744
|
+
React__default.createElement(CaptionDropdowns, { displayMonth: props.displayMonth, id: props.id }),
|
|
7745
|
+
React__default.createElement(CaptionNavigation, { displayMonth: props.displayMonth, id: props.id })));
|
|
7749
7746
|
}
|
|
7750
7747
|
else {
|
|
7751
|
-
caption = (
|
|
7752
|
-
|
|
7753
|
-
|
|
7748
|
+
caption = (React__default.createElement(React__default.Fragment, null,
|
|
7749
|
+
React__default.createElement(CaptionLabelComponent, { id: props.id, displayMonth: props.displayMonth }),
|
|
7750
|
+
React__default.createElement(CaptionNavigation, { displayMonth: props.displayMonth, id: props.id })));
|
|
7754
7751
|
}
|
|
7755
|
-
return (
|
|
7752
|
+
return (React__default.createElement("div", { className: classNames.caption, style: styles.caption }, caption));
|
|
7756
7753
|
}
|
|
7757
7754
|
|
|
7758
7755
|
/** Render the Footer component (empty as default).*/
|
|
@@ -7760,10 +7757,10 @@
|
|
|
7760
7757
|
function Footer$1(props) {
|
|
7761
7758
|
var _a = useDayPicker(), footer = _a.footer, styles = _a.styles, tfoot = _a.classNames.tfoot;
|
|
7762
7759
|
if (!footer)
|
|
7763
|
-
return
|
|
7764
|
-
return (
|
|
7765
|
-
|
|
7766
|
-
|
|
7760
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
7761
|
+
return (React__default.createElement("tfoot", { className: tfoot, style: styles.tfoot },
|
|
7762
|
+
React__default.createElement("tr", null,
|
|
7763
|
+
React__default.createElement("td", { colSpan: 8 }, footer))));
|
|
7767
7764
|
}
|
|
7768
7765
|
|
|
7769
7766
|
/**
|
|
@@ -7792,9 +7789,9 @@
|
|
|
7792
7789
|
function HeadRow() {
|
|
7793
7790
|
var _a = useDayPicker(), classNames = _a.classNames, styles = _a.styles, showWeekNumber = _a.showWeekNumber, locale = _a.locale, weekStartsOn = _a.weekStartsOn, ISOWeek = _a.ISOWeek, formatWeekdayName = _a.formatters.formatWeekdayName, labelWeekday = _a.labels.labelWeekday;
|
|
7794
7791
|
var weekdays = getWeekdays(locale, weekStartsOn, ISOWeek);
|
|
7795
|
-
return (
|
|
7796
|
-
showWeekNumber && (
|
|
7797
|
-
weekdays.map(function (weekday, i) { return (
|
|
7792
|
+
return (React__default.createElement("tr", { style: styles.head_row, className: classNames.head_row },
|
|
7793
|
+
showWeekNumber && (React__default.createElement("td", { style: styles.head_cell, className: classNames.head_cell })),
|
|
7794
|
+
weekdays.map(function (weekday, i) { return (React__default.createElement("th", { key: i, scope: "col", className: classNames.head_cell, style: styles.head_cell, "aria-label": labelWeekday(weekday, { locale: locale }) }, formatWeekdayName(weekday, { locale: locale }))); })));
|
|
7798
7795
|
}
|
|
7799
7796
|
|
|
7800
7797
|
/** Render the table head. */
|
|
@@ -7802,14 +7799,14 @@
|
|
|
7802
7799
|
var _a;
|
|
7803
7800
|
var _b = useDayPicker(), classNames = _b.classNames, styles = _b.styles, components = _b.components;
|
|
7804
7801
|
var HeadRowComponent = (_a = components === null || components === void 0 ? void 0 : components.HeadRow) !== null && _a !== void 0 ? _a : HeadRow;
|
|
7805
|
-
return (
|
|
7806
|
-
|
|
7802
|
+
return (React__default.createElement("thead", { style: styles.head, className: classNames.head },
|
|
7803
|
+
React__default.createElement(HeadRowComponent, null)));
|
|
7807
7804
|
}
|
|
7808
7805
|
|
|
7809
7806
|
/** Render the content of the day cell. */
|
|
7810
7807
|
function DayContent(props) {
|
|
7811
7808
|
var _a = useDayPicker(), locale = _a.locale, formatDay = _a.formatters.formatDay;
|
|
7812
|
-
return
|
|
7809
|
+
return React__default.createElement(React__default.Fragment, null, formatDay(props.date, { locale: locale }));
|
|
7813
7810
|
}
|
|
7814
7811
|
|
|
7815
7812
|
/**
|
|
@@ -7818,7 +7815,7 @@
|
|
|
7818
7815
|
*
|
|
7819
7816
|
* Access this context from the {@link useSelectMultiple} hook.
|
|
7820
7817
|
*/
|
|
7821
|
-
var SelectMultipleContext =
|
|
7818
|
+
var SelectMultipleContext = React__default.createContext(undefined);
|
|
7822
7819
|
/** Provides the values for the {@link SelectMultipleContext}. */
|
|
7823
7820
|
function SelectMultipleProvider(props) {
|
|
7824
7821
|
if (!isDayPickerMultiple(props.initialProps)) {
|
|
@@ -7828,9 +7825,9 @@
|
|
|
7828
7825
|
disabled: []
|
|
7829
7826
|
}
|
|
7830
7827
|
};
|
|
7831
|
-
return (
|
|
7828
|
+
return (React__default.createElement(SelectMultipleContext.Provider, { value: emptyContextValue }, props.children));
|
|
7832
7829
|
}
|
|
7833
|
-
return (
|
|
7830
|
+
return (React__default.createElement(SelectMultipleProviderInternal, { initialProps: props.initialProps, children: props.children }));
|
|
7834
7831
|
}
|
|
7835
7832
|
function SelectMultipleProviderInternal(_a) {
|
|
7836
7833
|
var initialProps = _a.initialProps, children = _a.children;
|
|
@@ -7875,7 +7872,7 @@
|
|
|
7875
7872
|
onDayClick: onDayClick,
|
|
7876
7873
|
modifiers: modifiers
|
|
7877
7874
|
};
|
|
7878
|
-
return (
|
|
7875
|
+
return (React__default.createElement(SelectMultipleContext.Provider, { value: contextValue }, children));
|
|
7879
7876
|
}
|
|
7880
7877
|
/**
|
|
7881
7878
|
* Hook to access the {@link SelectMultipleContextValue}.
|
|
@@ -7883,7 +7880,7 @@
|
|
|
7883
7880
|
* This hook is meant to be used inside internal or custom components.
|
|
7884
7881
|
*/
|
|
7885
7882
|
function useSelectMultiple() {
|
|
7886
|
-
var context =
|
|
7883
|
+
var context = React__default.useContext(SelectMultipleContext);
|
|
7887
7884
|
if (!context) {
|
|
7888
7885
|
throw new Error('useSelectMultiple must be used within a SelectMultipleProvider');
|
|
7889
7886
|
}
|
|
@@ -7931,7 +7928,7 @@
|
|
|
7931
7928
|
*
|
|
7932
7929
|
* Access this context from the {@link useSelectRange} hook.
|
|
7933
7930
|
*/
|
|
7934
|
-
var SelectRangeContext =
|
|
7931
|
+
var SelectRangeContext = React__default.createContext(undefined);
|
|
7935
7932
|
/** Provides the values for the {@link SelectRangeProvider}. */
|
|
7936
7933
|
function SelectRangeProvider(props) {
|
|
7937
7934
|
if (!isDayPickerRange(props.initialProps)) {
|
|
@@ -7944,9 +7941,9 @@
|
|
|
7944
7941
|
disabled: []
|
|
7945
7942
|
}
|
|
7946
7943
|
};
|
|
7947
|
-
return (
|
|
7944
|
+
return (React__default.createElement(SelectRangeContext.Provider, { value: emptyContextValue }, props.children));
|
|
7948
7945
|
}
|
|
7949
|
-
return (
|
|
7946
|
+
return (React__default.createElement(SelectRangeProviderInternal, { initialProps: props.initialProps, children: props.children }));
|
|
7950
7947
|
}
|
|
7951
7948
|
function SelectRangeProviderInternal(_a) {
|
|
7952
7949
|
var initialProps = _a.initialProps, children = _a.children;
|
|
@@ -8017,7 +8014,7 @@
|
|
|
8017
8014
|
});
|
|
8018
8015
|
}
|
|
8019
8016
|
}
|
|
8020
|
-
return (
|
|
8017
|
+
return (React__default.createElement(SelectRangeContext.Provider, { value: { selected: selected, onDayClick: onDayClick, modifiers: modifiers } }, children));
|
|
8021
8018
|
}
|
|
8022
8019
|
/**
|
|
8023
8020
|
* Hook to access the {@link SelectRangeContextValue}.
|
|
@@ -8025,7 +8022,7 @@
|
|
|
8025
8022
|
* This hook is meant to be used inside internal or custom components.
|
|
8026
8023
|
*/
|
|
8027
8024
|
function useSelectRange() {
|
|
8028
|
-
var context =
|
|
8025
|
+
var context = React__default.useContext(SelectRangeContext);
|
|
8029
8026
|
if (!context) {
|
|
8030
8027
|
throw new Error('useSelectRange must be used within a SelectRangeProvider');
|
|
8031
8028
|
}
|
|
@@ -8108,7 +8105,7 @@
|
|
|
8108
8105
|
}
|
|
8109
8106
|
|
|
8110
8107
|
/** The Modifiers context store the modifiers used in DayPicker. To access the value of this context, use {@link useModifiers}. */
|
|
8111
|
-
var ModifiersContext =
|
|
8108
|
+
var ModifiersContext = React__default.createContext(undefined);
|
|
8112
8109
|
/** Provide the value for the {@link ModifiersContext}. */
|
|
8113
8110
|
function ModifiersProvider(props) {
|
|
8114
8111
|
var dayPicker = useDayPicker();
|
|
@@ -8117,7 +8114,7 @@
|
|
|
8117
8114
|
var internalModifiers = getInternalModifiers(dayPicker, selectMultiple, selectRange);
|
|
8118
8115
|
var customModifiers = getCustomModifiers(dayPicker.modifiers);
|
|
8119
8116
|
var modifiers = __assign(__assign({}, internalModifiers), customModifiers);
|
|
8120
|
-
return (
|
|
8117
|
+
return (React__default.createElement(ModifiersContext.Provider, { value: modifiers }, props.children));
|
|
8121
8118
|
}
|
|
8122
8119
|
/**
|
|
8123
8120
|
* Return the modifiers used by DayPicker.
|
|
@@ -8127,7 +8124,7 @@
|
|
|
8127
8124
|
*
|
|
8128
8125
|
*/
|
|
8129
8126
|
function useModifiers() {
|
|
8130
|
-
var context =
|
|
8127
|
+
var context = React__default.useContext(ModifiersContext);
|
|
8131
8128
|
if (!context) {
|
|
8132
8129
|
throw new Error('useModifiers must be used within a ModifiersProvider');
|
|
8133
8130
|
}
|
|
@@ -8365,13 +8362,13 @@
|
|
|
8365
8362
|
*
|
|
8366
8363
|
* Access this context from the {@link useFocusContext} hook.
|
|
8367
8364
|
*/
|
|
8368
|
-
var FocusContext =
|
|
8365
|
+
var FocusContext = React__default.createContext(undefined);
|
|
8369
8366
|
/** The provider for the {@link FocusContext}. */
|
|
8370
8367
|
function FocusProvider(props) {
|
|
8371
8368
|
var navigation = useNavigation();
|
|
8372
8369
|
var modifiers = useModifiers();
|
|
8373
|
-
var _a =
|
|
8374
|
-
var _b =
|
|
8370
|
+
var _a = React__default.useState(), focusedDay = _a[0], setFocusedDay = _a[1];
|
|
8371
|
+
var _b = React__default.useState(), lastFocused = _b[0], setLastFocused = _b[1];
|
|
8375
8372
|
var initialFocusTarget = getInitialFocusTarget(navigation.displayMonths, modifiers);
|
|
8376
8373
|
// TODO: cleanup and test obscure code below
|
|
8377
8374
|
var focusTarget = (focusedDay !== null && focusedDay !== void 0 ? focusedDay : (lastFocused && navigation.isDateDisplayed(lastFocused)))
|
|
@@ -8415,7 +8412,7 @@
|
|
|
8415
8412
|
focusStartOfWeek: function () { return moveFocus('startOfWeek', 'before'); },
|
|
8416
8413
|
focusEndOfWeek: function () { return moveFocus('endOfWeek', 'after'); }
|
|
8417
8414
|
};
|
|
8418
|
-
return (
|
|
8415
|
+
return (React__default.createElement(FocusContext.Provider, { value: value }, props.children));
|
|
8419
8416
|
}
|
|
8420
8417
|
/**
|
|
8421
8418
|
* Hook to access the {@link FocusContextValue}. Use this hook to handle the
|
|
@@ -8424,7 +8421,7 @@
|
|
|
8424
8421
|
* This hook is meant to be used inside internal or custom components.
|
|
8425
8422
|
*/
|
|
8426
8423
|
function useFocusContext() {
|
|
8427
|
-
var context =
|
|
8424
|
+
var context = React__default.useContext(FocusContext);
|
|
8428
8425
|
if (!context) {
|
|
8429
8426
|
throw new Error('useFocusContext must be used within a FocusProvider');
|
|
8430
8427
|
}
|
|
@@ -8456,16 +8453,16 @@
|
|
|
8456
8453
|
*
|
|
8457
8454
|
* Access this context from the {@link useSelectSingle} hook.
|
|
8458
8455
|
*/
|
|
8459
|
-
var SelectSingleContext =
|
|
8456
|
+
var SelectSingleContext = React__default.createContext(undefined);
|
|
8460
8457
|
/** Provides the values for the {@link SelectSingleProvider}. */
|
|
8461
8458
|
function SelectSingleProvider(props) {
|
|
8462
8459
|
if (!isDayPickerSingle(props.initialProps)) {
|
|
8463
8460
|
var emptyContextValue = {
|
|
8464
8461
|
selected: undefined
|
|
8465
8462
|
};
|
|
8466
|
-
return (
|
|
8463
|
+
return (React__default.createElement(SelectSingleContext.Provider, { value: emptyContextValue }, props.children));
|
|
8467
8464
|
}
|
|
8468
|
-
return (
|
|
8465
|
+
return (React__default.createElement(SelectSingleProviderInternal, { initialProps: props.initialProps, children: props.children }));
|
|
8469
8466
|
}
|
|
8470
8467
|
function SelectSingleProviderInternal(_a) {
|
|
8471
8468
|
var initialProps = _a.initialProps, children = _a.children;
|
|
@@ -8482,7 +8479,7 @@
|
|
|
8482
8479
|
selected: initialProps.selected,
|
|
8483
8480
|
onDayClick: onDayClick
|
|
8484
8481
|
};
|
|
8485
|
-
return (
|
|
8482
|
+
return (React__default.createElement(SelectSingleContext.Provider, { value: contextValue }, children));
|
|
8486
8483
|
}
|
|
8487
8484
|
/**
|
|
8488
8485
|
* Hook to access the {@link SelectSingleContextValue}.
|
|
@@ -8490,7 +8487,7 @@
|
|
|
8490
8487
|
* This hook is meant to be used inside internal or custom components.
|
|
8491
8488
|
*/
|
|
8492
8489
|
function useSelectSingle() {
|
|
8493
|
-
var context =
|
|
8490
|
+
var context = React__default.useContext(SelectSingleContext);
|
|
8494
8491
|
if (!context) {
|
|
8495
8492
|
throw new Error('useSelectSingle must be used within a SelectSingleProvider');
|
|
8496
8493
|
}
|
|
@@ -8729,7 +8726,7 @@
|
|
|
8729
8726
|
var selectedDays = useSelectedDays();
|
|
8730
8727
|
var isButton = Boolean(dayPicker.onDayClick || dayPicker.mode !== 'default');
|
|
8731
8728
|
// Focus the button if the day is focused according to the focus context
|
|
8732
|
-
|
|
8729
|
+
React__default.useEffect(function () {
|
|
8733
8730
|
var _a;
|
|
8734
8731
|
if (activeModifiers.outside)
|
|
8735
8732
|
return;
|
|
@@ -8752,7 +8749,7 @@
|
|
|
8752
8749
|
var isHidden = Boolean((activeModifiers.outside && !dayPicker.showOutsideDays) ||
|
|
8753
8750
|
activeModifiers.hidden);
|
|
8754
8751
|
var DayContentComponent = (_c = (_b = dayPicker.components) === null || _b === void 0 ? void 0 : _b.DayContent) !== null && _c !== void 0 ? _c : DayContent;
|
|
8755
|
-
var children = (
|
|
8752
|
+
var children = (React__default.createElement(DayContentComponent, { date: day, displayMonth: displayMonth, activeModifiers: activeModifiers }));
|
|
8756
8753
|
var divProps = {
|
|
8757
8754
|
style: style,
|
|
8758
8755
|
className: className,
|
|
@@ -8780,15 +8777,15 @@
|
|
|
8780
8777
|
* modifiers.
|
|
8781
8778
|
*/
|
|
8782
8779
|
function Day(props) {
|
|
8783
|
-
var buttonRef =
|
|
8780
|
+
var buttonRef = React__default.useRef(null);
|
|
8784
8781
|
var dayRender = useDayRender(props.date, props.displayMonth, buttonRef);
|
|
8785
8782
|
if (dayRender.isHidden) {
|
|
8786
|
-
return
|
|
8783
|
+
return React__default.createElement("div", { role: "gridcell" });
|
|
8787
8784
|
}
|
|
8788
8785
|
if (!dayRender.isButton) {
|
|
8789
|
-
return
|
|
8786
|
+
return React__default.createElement("div", __assign({}, dayRender.divProps));
|
|
8790
8787
|
}
|
|
8791
|
-
return
|
|
8788
|
+
return React__default.createElement(Button, __assign({ name: "day", ref: buttonRef }, dayRender.buttonProps));
|
|
8792
8789
|
}
|
|
8793
8790
|
|
|
8794
8791
|
/**
|
|
@@ -8800,13 +8797,13 @@
|
|
|
8800
8797
|
var _a = useDayPicker(), onWeekNumberClick = _a.onWeekNumberClick, styles = _a.styles, classNames = _a.classNames, locale = _a.locale, labelWeekNumber = _a.labels.labelWeekNumber, formatWeekNumber = _a.formatters.formatWeekNumber;
|
|
8801
8798
|
var content = formatWeekNumber(Number(weekNumber), { locale: locale });
|
|
8802
8799
|
if (!onWeekNumberClick) {
|
|
8803
|
-
return (
|
|
8800
|
+
return (React__default.createElement("span", { className: classNames.weeknumber, style: styles.weeknumber }, content));
|
|
8804
8801
|
}
|
|
8805
8802
|
var label = labelWeekNumber(Number(weekNumber), { locale: locale });
|
|
8806
8803
|
var handleClick = function (e) {
|
|
8807
8804
|
onWeekNumberClick(weekNumber, dates, e);
|
|
8808
8805
|
};
|
|
8809
|
-
return (
|
|
8806
|
+
return (React__default.createElement(Button, { name: "week-number", "aria-label": label, className: classNames.weeknumber, style: styles.weeknumber, onClick: handleClick }, content));
|
|
8810
8807
|
}
|
|
8811
8808
|
|
|
8812
8809
|
/** Render a row in the calendar, with the days and the week number. */
|
|
@@ -8817,13 +8814,13 @@
|
|
|
8817
8814
|
var WeeknumberComponent = (_b = components === null || components === void 0 ? void 0 : components.WeekNumber) !== null && _b !== void 0 ? _b : WeekNumber;
|
|
8818
8815
|
var weekNumberCell;
|
|
8819
8816
|
if (showWeekNumber) {
|
|
8820
|
-
weekNumberCell = (
|
|
8821
|
-
|
|
8817
|
+
weekNumberCell = (React__default.createElement("td", { className: classNames.cell, style: styles.cell },
|
|
8818
|
+
React__default.createElement(WeeknumberComponent, { number: props.weekNumber, dates: props.dates })));
|
|
8822
8819
|
}
|
|
8823
|
-
return (
|
|
8820
|
+
return (React__default.createElement("tr", { className: classNames.row, style: styles.row },
|
|
8824
8821
|
weekNumberCell,
|
|
8825
|
-
props.dates.map(function (date) { return (
|
|
8826
|
-
|
|
8822
|
+
props.dates.map(function (date) { return (React__default.createElement("td", { className: classNames.cell, style: styles.cell, key: getUnixTime(date), role: "presentation" },
|
|
8823
|
+
React__default.createElement(DayComponent, { displayMonth: props.displayMonth, date: date }))); })));
|
|
8827
8824
|
}
|
|
8828
8825
|
|
|
8829
8826
|
/** Return the weeks between two dates. */
|
|
@@ -8891,10 +8888,10 @@
|
|
|
8891
8888
|
var HeadComponent = (_a = components === null || components === void 0 ? void 0 : components.Head) !== null && _a !== void 0 ? _a : Head;
|
|
8892
8889
|
var RowComponent = (_b = components === null || components === void 0 ? void 0 : components.Row) !== null && _b !== void 0 ? _b : Row;
|
|
8893
8890
|
var FooterComponent = (_c = components === null || components === void 0 ? void 0 : components.Footer) !== null && _c !== void 0 ? _c : Footer$1;
|
|
8894
|
-
return (
|
|
8895
|
-
!hideHead &&
|
|
8896
|
-
|
|
8897
|
-
|
|
8891
|
+
return (React__default.createElement("table", { id: props.id, className: classNames.table, style: styles.table, role: "grid", "aria-labelledby": props['aria-labelledby'] },
|
|
8892
|
+
!hideHead && React__default.createElement(HeadComponent, null),
|
|
8893
|
+
React__default.createElement("tbody", { className: classNames.tbody, style: styles.tbody, role: "rowgroup" }, weeks.map(function (week) { return (React__default.createElement(RowComponent, { displayMonth: props.displayMonth, key: week.weekNumber, dates: week.dates, weekNumber: week.weekNumber })); })),
|
|
8894
|
+
React__default.createElement(FooterComponent, { displayMonth: props.displayMonth })));
|
|
8898
8895
|
}
|
|
8899
8896
|
|
|
8900
8897
|
/*
|
|
@@ -8938,8 +8935,8 @@
|
|
|
8938
8935
|
* @param deps
|
|
8939
8936
|
*/
|
|
8940
8937
|
var useIsomorphicLayoutEffect = canUseDOM()
|
|
8941
|
-
?
|
|
8942
|
-
:
|
|
8938
|
+
? React__default__namespace.useLayoutEffect
|
|
8939
|
+
: React__default__namespace.useEffect;
|
|
8943
8940
|
var serverHandoffComplete = false;
|
|
8944
8941
|
var id = 0;
|
|
8945
8942
|
function genId() {
|
|
@@ -8952,7 +8949,7 @@
|
|
|
8952
8949
|
// If this instance isn't part of the initial render, we don't have to do the
|
|
8953
8950
|
// double render/patch-up dance. We can just generate the ID and return it.
|
|
8954
8951
|
var initialId = providedId !== null && providedId !== void 0 ? providedId : (serverHandoffComplete ? genId() : null);
|
|
8955
|
-
var _b =
|
|
8952
|
+
var _b = React__default__namespace.useState(initialId), id = _b[0], setId = _b[1];
|
|
8956
8953
|
useIsomorphicLayoutEffect(function () {
|
|
8957
8954
|
if (id === null) {
|
|
8958
8955
|
// Patch the ID after render. We do this in `useLayoutEffect` to avoid any
|
|
@@ -8963,7 +8960,7 @@
|
|
|
8963
8960
|
}
|
|
8964
8961
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8965
8962
|
}, []);
|
|
8966
|
-
|
|
8963
|
+
React__default__namespace.useEffect(function () {
|
|
8967
8964
|
if (serverHandoffComplete === false) {
|
|
8968
8965
|
// Flag all future uses of `useId` to skip the update dance. This is in
|
|
8969
8966
|
// `useEffect` because it goes after `useLayoutEffect`, ensuring we don't
|
|
@@ -9006,9 +9003,9 @@
|
|
|
9006
9003
|
style = __assign(__assign({}, style), styles.caption_between);
|
|
9007
9004
|
}
|
|
9008
9005
|
var CaptionComponent = (_b = components === null || components === void 0 ? void 0 : components.Caption) !== null && _b !== void 0 ? _b : Caption;
|
|
9009
|
-
return (
|
|
9010
|
-
|
|
9011
|
-
|
|
9006
|
+
return (React__default.createElement("div", { key: props.displayIndex, className: className.join(' '), style: style },
|
|
9007
|
+
React__default.createElement(CaptionComponent, { id: captionId, displayMonth: props.displayMonth }),
|
|
9008
|
+
React__default.createElement(Table, { id: tableId, "aria-labelledby": captionId, displayMonth: props.displayMonth })));
|
|
9012
9009
|
}
|
|
9013
9010
|
|
|
9014
9011
|
/** Render the container with the months according to the number of months to display. */
|
|
@@ -9017,9 +9014,9 @@
|
|
|
9017
9014
|
var dayPicker = useDayPicker();
|
|
9018
9015
|
var focusContext = useFocusContext();
|
|
9019
9016
|
var navigation = useNavigation();
|
|
9020
|
-
var _b =
|
|
9017
|
+
var _b = React__default.useState(false), hasInitialFocus = _b[0], setHasInitialFocus = _b[1];
|
|
9021
9018
|
// Focus the focus target when initialFocus is passed in
|
|
9022
|
-
|
|
9019
|
+
React__default.useEffect(function () {
|
|
9023
9020
|
if (!dayPicker.initialFocus)
|
|
9024
9021
|
return;
|
|
9025
9022
|
if (!focusContext.focusTarget)
|
|
@@ -9050,20 +9047,20 @@
|
|
|
9050
9047
|
var _a;
|
|
9051
9048
|
return __assign(__assign({}, attrs), (_a = {}, _a[key] = initialProps[key], _a));
|
|
9052
9049
|
}, {});
|
|
9053
|
-
return (
|
|
9054
|
-
|
|
9050
|
+
return (React__default.createElement("div", __assign({ className: classNames.join(' '), style: style, dir: dayPicker.dir, id: dayPicker.id }, dataAttributes),
|
|
9051
|
+
React__default.createElement("div", { className: dayPicker.classNames.months, style: dayPicker.styles.months }, navigation.displayMonths.map(function (month, i) { return (React__default.createElement(Month, { key: i, displayIndex: i, displayMonth: month })); }))));
|
|
9055
9052
|
}
|
|
9056
9053
|
|
|
9057
9054
|
/** Provide the value for all the context providers. */
|
|
9058
9055
|
function RootProvider(props) {
|
|
9059
9056
|
var children = props.children, initialProps = __rest(props, ["children"]);
|
|
9060
|
-
return (
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
|
|
9066
|
-
|
|
9057
|
+
return (React__default.createElement(DayPickerProvider, { initialProps: initialProps },
|
|
9058
|
+
React__default.createElement(NavigationProvider, null,
|
|
9059
|
+
React__default.createElement(SelectSingleProvider, { initialProps: initialProps },
|
|
9060
|
+
React__default.createElement(SelectMultipleProvider, { initialProps: initialProps },
|
|
9061
|
+
React__default.createElement(SelectRangeProvider, { initialProps: initialProps },
|
|
9062
|
+
React__default.createElement(ModifiersProvider, null,
|
|
9063
|
+
React__default.createElement(FocusProvider, null, children))))))));
|
|
9067
9064
|
}
|
|
9068
9065
|
|
|
9069
9066
|
/**
|
|
@@ -9154,8 +9151,8 @@
|
|
|
9154
9151
|
* ```
|
|
9155
9152
|
*/
|
|
9156
9153
|
function DayPicker(props) {
|
|
9157
|
-
return (
|
|
9158
|
-
|
|
9154
|
+
return (React__default.createElement(RootProvider, __assign({}, props),
|
|
9155
|
+
React__default.createElement(Root, { initialProps: props })));
|
|
9159
9156
|
}
|
|
9160
9157
|
|
|
9161
9158
|
var reactResponsive$1 = {exports: {}};
|
|
@@ -9169,7 +9166,7 @@
|
|
|
9169
9166
|
hasRequiredReactResponsive = 1;
|
|
9170
9167
|
(function (module, exports) {
|
|
9171
9168
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
9172
|
-
module.exports = factory(
|
|
9169
|
+
module.exports = factory(React__default);
|
|
9173
9170
|
})(reactResponsive, (__WEBPACK_EXTERNAL_MODULE_react__) => {
|
|
9174
9171
|
return /******/ (() => { // webpackBootstrap
|
|
9175
9172
|
/******/ var __webpack_modules__ = ({
|
|
@@ -10998,19 +10995,15 @@
|
|
|
10998
10995
|
var fill = _a.fill, size = _a.size, icon = _a.icon;
|
|
10999
10996
|
switch (icon) {
|
|
11000
10997
|
case 'spinner':
|
|
11001
|
-
return (
|
|
11002
|
-
React.createElement("style", null, "\n .spinner_z9k8 {\n transform-origin: center;\n animation: spinner_StKS .75s infinite linear;\n }\n @keyframes spinner_StKS {\n 100% {\n transform: rotate(360deg);\n }\n }\n "),
|
|
11003
|
-
React.createElement("path", { d: "M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z", opacity: ".25", fill: fill }),
|
|
11004
|
-
React.createElement("path", { d: "M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z", className: "spinner_z9k8", fill: fill })));
|
|
10998
|
+
return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "".concat(size || 25), height: "".concat(size || 25), viewBox: "0 0 24 24", children: [jsxRuntime.jsx("style", { children: "\n .spinner_z9k8 {\n transform-origin: center;\n animation: spinner_StKS .75s infinite linear;\n }\n @keyframes spinner_StKS {\n 100% {\n transform: rotate(360deg);\n }\n }\n " }), jsxRuntime.jsx("path", { d: "M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z", opacity: ".25", fill: fill }), jsxRuntime.jsx("path", { d: "M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z", className: "spinner_z9k8", fill: fill })] }));
|
|
11005
10999
|
case 'warning':
|
|
11006
|
-
return (
|
|
11000
|
+
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "".concat(size || 25), height: "".concat(size || 25), className: "svg-icon", style: {
|
|
11007
11001
|
verticalAlign: 'middle',
|
|
11008
11002
|
fill: fill,
|
|
11009
11003
|
overflow: 'hidden',
|
|
11010
11004
|
minWidth: '25px',
|
|
11011
11005
|
minHeight: '25px',
|
|
11012
|
-
}, viewBox: "0 0 1024 1024", version: "1.1" }
|
|
11013
|
-
React.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" })));
|
|
11006
|
+
}, viewBox: "0 0 1024 1024", version: "1.1", children: jsxRuntime.jsx("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" }) }));
|
|
11014
11007
|
default:
|
|
11015
11008
|
return null;
|
|
11016
11009
|
}
|
|
@@ -11336,7 +11329,7 @@
|
|
|
11336
11329
|
calendarRangeTo &&
|
|
11337
11330
|
areIntervalsOverlapping({ start: calendarRangeFrom, end: calendarRangeTo }, { start: rangeFrom, end: rangeTo }));
|
|
11338
11331
|
});
|
|
11339
|
-
|
|
11332
|
+
React__default.useEffect(function () {
|
|
11340
11333
|
if ((rangeContext &&
|
|
11341
11334
|
calendarRangeFrom &&
|
|
11342
11335
|
!startIsEqualOrBeforeRangeContextEnd) ||
|
|
@@ -11351,7 +11344,7 @@
|
|
|
11351
11344
|
|
|
11352
11345
|
var useCalendarTooltips = function (_a) {
|
|
11353
11346
|
var showFeedback = _a.showFeedback;
|
|
11354
|
-
return
|
|
11347
|
+
return React__default.useEffect(function () {
|
|
11355
11348
|
if (typeof document === 'undefined' || !showFeedback)
|
|
11356
11349
|
return;
|
|
11357
11350
|
// Children
|
|
@@ -11428,7 +11421,7 @@
|
|
|
11428
11421
|
|
|
11429
11422
|
var useCalendarLoadingSpinner = function (_a) {
|
|
11430
11423
|
var loadingData = _a.loadingData;
|
|
11431
|
-
return
|
|
11424
|
+
return React__default.useEffect(function () {
|
|
11432
11425
|
if (typeof document === 'undefined')
|
|
11433
11426
|
return;
|
|
11434
11427
|
var loadingSpinner = document.querySelector('.will-filter-bar-calendar .rdp-months .will-calendar-spinner');
|
|
@@ -11445,9 +11438,9 @@
|
|
|
11445
11438
|
|
|
11446
11439
|
var useUpdateDisabledDates = function (_a) {
|
|
11447
11440
|
var disableCalendarDates = _a.disableCalendarDates, calendarRange = _a.calendarRange, updateCalendarMonthNavigation = _a.updateCalendarMonthNavigation, updateCalendarDefaultMonth = _a.updateCalendarDefaultMonth;
|
|
11448
|
-
var _b = __read(
|
|
11449
|
-
var _c = __read(
|
|
11450
|
-
var newDisableCalendarDates =
|
|
11441
|
+
var _b = __read(React__default.useState(undefined), 2), overlappingDate = _b[0], setOverlappingDate = _b[1];
|
|
11442
|
+
var _c = __read(React__default.useState([]), 2), lastPossibleCheckout = _c[0], setLatsPossibleCheckout = _c[1];
|
|
11443
|
+
var newDisableCalendarDates = React__default.useMemo(function () {
|
|
11451
11444
|
var _a;
|
|
11452
11445
|
if (disableCalendarDates === null || disableCalendarDates === void 0 ? void 0 : disableCalendarDates.availableDates) {
|
|
11453
11446
|
var dateFormat_1 = 'dd-MM-yyyy';
|
|
@@ -11498,13 +11491,13 @@
|
|
|
11498
11491
|
return { newDisableCalendarDates: newDisableCalendarDates, overlappingDate: overlappingDate, lastPossibleCheckout: lastPossibleCheckout };
|
|
11499
11492
|
};
|
|
11500
11493
|
|
|
11501
|
-
var css_248z$
|
|
11502
|
-
styleInject(css_248z$
|
|
11494
|
+
var css_248z$d = ".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}";
|
|
11495
|
+
styleInject(css_248z$d);
|
|
11503
11496
|
|
|
11504
|
-
var css_248z$
|
|
11505
|
-
styleInject(css_248z$
|
|
11497
|
+
var css_248z$c = ".will-calendar-filter-container {\n display: flex;\n justify-content: center;\n user-select: none;\n}\n\n/* Calendar overrides */\n.will-calendar-filter-container .rdp {\n margin: 0;\n}\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.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: 0.6;\n}\n\n.will-calendar-filter-container .rdp-table {\n border-collapse: separate;\n border-spacing: 0px 2px;\n}\n\n.will-calendar-filter-container\n .rdp-button_reset.rdp-button.rdp-day.rdp-day_selected {\n background-color: var(--will-primary);\n opacity: 1;\n color: var(--will-white);\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\n .will-calendar-filter-container\n .will-calendar-tooltip-overlapping-date,\n.will-root\n .will-calendar-filter-container\n .will-calendar-tooltip-check-out-only,\n.will-root\n .will-calendar-filter-container\n .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\n .will-calendar-filter-container\n .will-calendar-tooltip-check-out\n > div,\n.will-root\n .will-calendar-filter-container\n .will-calendar-tooltip-overlapping-date\n > div,\n.will-root\n .will-calendar-filter-container\n .will-calendar-tooltip-check-out-only\n > div,\n.will-root\n .will-calendar-filter-container\n .will-calendar-tooltip-check-in-only\n > 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\n .will-calendar-filter-container\n .will-calendar-tooltip-check-out::before,\n.will-root\n .will-calendar-filter-container\n .will-calendar-tooltip-overlapping-date::before,\n.will-root\n .will-calendar-filter-container\n .will-calendar-tooltip-check-out-only::before,\n.will-root\n .will-calendar-filter-container\n .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\n .will-calendar-filter-container\n .rdp-cell:hover\n .will-calendar-tooltip,\n.will-root\n .will-calendar-filter-container\n .rdp-cell:hover\n .will-calendar-tooltip-check-out,\n.will-root\n .will-calendar-filter-container\n .rdp-cell:hover\n .will-calendar-tooltip-overlapping-date,\n.will-root\n .will-calendar-filter-container\n .rdp-cell:hover\n .will-calendar-tooltip-check-out-only,\n.will-root\n .will-calendar-filter-container\n .rdp-cell:hover\n .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.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: 2px solid var(--will-light-grey);\n box-sizing: border-box;\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\n .will-calendar-filter-container\n .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\n .will-calendar-filter-container\n .will-calendar-tooltip-overlapping-date,\n .will-root\n .will-calendar-filter-container\n .will-calendar-tooltip-check-out-only,\n .will-root\n .will-calendar-filter-container\n .will-calendar-tooltip-check-in-only {\n top: -70px;\n white-space: wrap;\n max-width: 120px;\n }\n}\n";
|
|
11498
|
+
styleInject(css_248z$c);
|
|
11506
11499
|
|
|
11507
|
-
var Calendar =
|
|
11500
|
+
var Calendar = React__default.forwardRef(function (_a, ref) {
|
|
11508
11501
|
var _b;
|
|
11509
11502
|
var selectedPath = _a.selectedPath, calendarRange = _a.calendarRange, setCalendarRange = _a.setCalendarRange, language = _a.language, disableCalendarDates = _a.disableCalendarDates, requestDates = _a.requestDates, disabledDates = _a.disabledDates, updateCalendarMonthNavigation = _a.updateCalendarMonthNavigation, setUpdateCalendarMonthNavigation = _a.setUpdateCalendarMonthNavigation, updateCalendarDefaultMonth = _a.updateCalendarDefaultMonth, loadingData = _a.loadingData, showFeedback = _a.showFeedback, palette = _a.palette, setCalendarHasError = _a.setCalendarHasError, setUpdatedForSubmit = _a.setUpdatedForSubmit, rangeContext = _a.rangeContext, calendarHasError = _a.calendarHasError, autoFocus = _a.autoFocus;
|
|
11510
11503
|
// Translations
|
|
@@ -11592,53 +11585,39 @@
|
|
|
11592
11585
|
: __spreadArray$1(__spreadArray$1(__spreadArray$1(__spreadArray$1([
|
|
11593
11586
|
lastPossibleCheckout
|
|
11594
11587
|
], __read(base), false), __read(firstPossibleRangeContextCheckIn), false), __read(lastPossibleRangeContextCheckOut), false), __read(disabledInsideSelectableRange()), false);
|
|
11595
|
-
return (
|
|
11596
|
-
|
|
11597
|
-
|
|
11598
|
-
|
|
11599
|
-
|
|
11600
|
-
|
|
11601
|
-
?
|
|
11602
|
-
|
|
11603
|
-
|
|
11604
|
-
|
|
11605
|
-
|
|
11606
|
-
|
|
11607
|
-
|
|
11608
|
-
|
|
11609
|
-
|
|
11610
|
-
|
|
11611
|
-
|
|
11612
|
-
|
|
11613
|
-
|
|
11614
|
-
|
|
11615
|
-
|
|
11616
|
-
|
|
11617
|
-
|
|
11618
|
-
|
|
11619
|
-
|
|
11620
|
-
|
|
11621
|
-
|
|
11622
|
-
|
|
11623
|
-
|
|
11624
|
-
|
|
11625
|
-
|
|
11626
|
-
|
|
11627
|
-
|
|
11628
|
-
currentSelectionLastCheckoutDate: currentSelectionAvailability,
|
|
11629
|
-
}) }),
|
|
11630
|
-
React.createElement("div", { className: 'will-calendar-tooltip' },
|
|
11631
|
-
React.createElement("div", null, t('noCheckIn'))),
|
|
11632
|
-
React.createElement("div", { className: 'will-calendar-tooltip-check-out' },
|
|
11633
|
-
React.createElement("div", null, t('noCheckOut'))),
|
|
11634
|
-
React.createElement("div", { className: 'will-calendar-tooltip-overlapping-date' },
|
|
11635
|
-
React.createElement("div", null, t('checkOutOnly'))),
|
|
11636
|
-
React.createElement("div", { className: 'will-calendar-tooltip-check-in-only' },
|
|
11637
|
-
React.createElement("div", null, t('checkInOnly'))),
|
|
11638
|
-
React.createElement("div", { className: 'will-calendar-tooltip-check-out-only' },
|
|
11639
|
-
React.createElement("div", null, t('checkOutOnly'))),
|
|
11640
|
-
React.createElement("div", { className: 'will-calendar-spinner' },
|
|
11641
|
-
React.createElement(IconsSvg, { fill: (palette === null || palette === void 0 ? void 0 : palette.primary) || 'inherit', size: 50, icon: "spinner" })))));
|
|
11588
|
+
return (jsxRuntime.jsx("div", { className: "will-filter-bar-calendar", ref: ref, children: jsxRuntime.jsxs("div", { className: "will-calendar-filter-container", ref: calendarContainerRef, children: [jsxRuntime.jsx(DayPicker, { id: "will-calendar", mode: "range", locale: language === 'en' ? enUS : fi, numberOfMonths: !isTablet ? 2 : 1, weekStartsOn: 1, selected: calendarRange, onSelect: function (range) { return handleOnSelect(range); }, captionLayout: "dropdown-buttons", defaultMonth: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from) ||
|
|
11589
|
+
selectedStartDate ||
|
|
11590
|
+
rangeContextStartDate ||
|
|
11591
|
+
(((_b = newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates) === null || _b === void 0 ? void 0 : _b.length)
|
|
11592
|
+
? newDisableCalendarDates.disabledDates[0].from
|
|
11593
|
+
: today), disabled: disabled, fromMonth: today, onMonthChange: function (val) {
|
|
11594
|
+
requestDates === null || requestDates === void 0 ? void 0 : requestDates(val);
|
|
11595
|
+
setUpdateCalendarMonthNavigation === null || setUpdateCalendarMonthNavigation === void 0 ? void 0 : setUpdateCalendarMonthNavigation(function (prev) { return !prev; });
|
|
11596
|
+
}, classNames: {
|
|
11597
|
+
day_range_start: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from) ? 'rdp-day_range_start' : '',
|
|
11598
|
+
day_range_end: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) ? 'rdp-day_range_end' : '',
|
|
11599
|
+
}, modifiersClassNames: {
|
|
11600
|
+
today: 'my-today',
|
|
11601
|
+
booked: 'booked',
|
|
11602
|
+
disabledAfterCheckIn: 'disabled-after-check-in',
|
|
11603
|
+
overlappingDate: 'overlapping-date',
|
|
11604
|
+
noActiveSelectionStart: 'no-active-selection-start',
|
|
11605
|
+
noActiveSelectionMid: 'no-active-selection-mid',
|
|
11606
|
+
noActiveSelectionEnd: 'no-active-selection-end',
|
|
11607
|
+
checkoutOptionsMid: 'rdp-day_selected rdp-day_range_middle checkout-option',
|
|
11608
|
+
checkInOnly: 'check-in-only',
|
|
11609
|
+
checkOutOnly: 'check-out-only',
|
|
11610
|
+
}, modifiers:
|
|
11611
|
+
// This function handles conditions for applying the modifiersClassNames
|
|
11612
|
+
handleCalendarModifiers({
|
|
11613
|
+
calendarRange: calendarRange,
|
|
11614
|
+
disabledDates: disabled,
|
|
11615
|
+
overlappingDate: overlappingDate,
|
|
11616
|
+
rangeContext: rangeContext,
|
|
11617
|
+
findFirstPossibleRangeContextCheckIn: findFirstPossibleRangeContextCheckIn,
|
|
11618
|
+
findLastPossibleRangeContextCheckOut: findLastPossibleRangeContextCheckOut,
|
|
11619
|
+
currentSelectionLastCheckoutDate: currentSelectionAvailability,
|
|
11620
|
+
}) }, updateCalendarDefaultMonth), jsxRuntime.jsx("div", { className: 'will-calendar-tooltip', children: jsxRuntime.jsx("div", { children: t('noCheckIn') }) }), jsxRuntime.jsx("div", { className: 'will-calendar-tooltip-check-out', children: jsxRuntime.jsx("div", { children: t('noCheckOut') }) }), jsxRuntime.jsx("div", { className: 'will-calendar-tooltip-overlapping-date', children: jsxRuntime.jsx("div", { children: t('checkOutOnly') }) }), jsxRuntime.jsx("div", { className: 'will-calendar-tooltip-check-in-only', children: jsxRuntime.jsx("div", { children: t('checkInOnly') }) }), jsxRuntime.jsx("div", { className: 'will-calendar-tooltip-check-out-only', children: jsxRuntime.jsx("div", { children: t('checkOutOnly') }) }), jsxRuntime.jsx("div", { className: 'will-calendar-spinner', children: jsxRuntime.jsx(IconsSvg, { fill: (palette === null || palette === void 0 ? void 0 : palette.primary) || 'inherit', size: 50, icon: "spinner" }) })] }) }));
|
|
11642
11621
|
});
|
|
11643
11622
|
|
|
11644
11623
|
var parseGuests = function (_a) {
|
|
@@ -11667,28 +11646,13 @@
|
|
|
11667
11646
|
};
|
|
11668
11647
|
};
|
|
11669
11648
|
|
|
11670
|
-
var getLocalizedContent = function (_a) {
|
|
11671
|
-
var _b;
|
|
11672
|
-
var contents = _a.contents, locale = _a.locale, _c = _a.fallbackLocale, fallbackLocale = _c === void 0 ? 'en' : _c;
|
|
11673
|
-
var preferred = contents.find(function (content) { return content.locale === locale; });
|
|
11674
|
-
if (preferred)
|
|
11675
|
-
return preferred.content;
|
|
11676
|
-
var fallback = contents.find(function (content) { return content.locale === fallbackLocale; });
|
|
11677
|
-
if (fallback)
|
|
11678
|
-
return fallback.content;
|
|
11679
|
-
return (_b = contents[0]) === null || _b === void 0 ? void 0 : _b.content;
|
|
11680
|
-
};
|
|
11681
|
-
|
|
11682
11649
|
var parseLocations = function (_a) {
|
|
11683
|
-
var selectedLocations = _a.selectedLocations,
|
|
11650
|
+
var selectedLocations = _a.selectedLocations, locationsPlaceholder = _a.locationsPlaceholder, _b = _a.locationsSelectedLabel, locationsSelectedLabel = _b === void 0 ? 'locations' : _b;
|
|
11684
11651
|
if (!selectedLocations.length) {
|
|
11685
11652
|
return locationsPlaceholder;
|
|
11686
11653
|
}
|
|
11687
11654
|
if (selectedLocations.length === 1) {
|
|
11688
|
-
var translation =
|
|
11689
|
-
contents: selectedLocations[0].label,
|
|
11690
|
-
locale: language,
|
|
11691
|
-
});
|
|
11655
|
+
var translation = selectedLocations[0].label;
|
|
11692
11656
|
if (!translation) {
|
|
11693
11657
|
return locationsPlaceholder;
|
|
11694
11658
|
}
|
|
@@ -11711,16 +11675,99 @@
|
|
|
11711
11675
|
Pages["SALES"] = "/sales";
|
|
11712
11676
|
})(Pages || (Pages = {}));
|
|
11713
11677
|
|
|
11678
|
+
var calculateDropdownPosition = function (_a) {
|
|
11679
|
+
var filterSection = _a.filterSection, headerRef = _a.headerRef, locationsButtonRef = _a.locationsButtonRef, datesButtonRef = _a.datesButtonRef, guestsButtonRef = _a.guestsButtonRef, isMobile = _a.isMobile;
|
|
11680
|
+
// On mobile, don't apply any positioning - let CSS handle it naturally
|
|
11681
|
+
// Dropdowns will start from leftmost point with position: relative
|
|
11682
|
+
if (isMobile) {
|
|
11683
|
+
return {};
|
|
11684
|
+
}
|
|
11685
|
+
if (!headerRef.current)
|
|
11686
|
+
return {};
|
|
11687
|
+
var containerRect = headerRef.current.getBoundingClientRect();
|
|
11688
|
+
var containerLeft = 0;
|
|
11689
|
+
switch (filterSection) {
|
|
11690
|
+
case FilterSections.LOCATIONS:
|
|
11691
|
+
// Locations: Start from beginning, hug content
|
|
11692
|
+
if (locationsButtonRef.current) {
|
|
11693
|
+
var buttonRect = locationsButtonRef.current.getBoundingClientRect();
|
|
11694
|
+
var relativeLeft = buttonRect.left - containerRect.left;
|
|
11695
|
+
return {
|
|
11696
|
+
left: relativeLeft,
|
|
11697
|
+
right: 'auto',
|
|
11698
|
+
width: 'auto',
|
|
11699
|
+
};
|
|
11700
|
+
}
|
|
11701
|
+
break;
|
|
11702
|
+
case FilterSections.CALENDAR:
|
|
11703
|
+
// Calendar: Two months side-by-side, needs ~650-700px
|
|
11704
|
+
// Start from dates button, but push left if not enough space
|
|
11705
|
+
if (datesButtonRef.current) {
|
|
11706
|
+
var buttonRect = datesButtonRef.current.getBoundingClientRect();
|
|
11707
|
+
var relativeLeft = buttonRect.left - containerRect.left;
|
|
11708
|
+
var availableWidth = containerRect.width - relativeLeft;
|
|
11709
|
+
var calendarMinWidth = 650;
|
|
11710
|
+
if (availableWidth < calendarMinWidth) {
|
|
11711
|
+
// Not enough space, align to the right edge
|
|
11712
|
+
return {
|
|
11713
|
+
left: 'auto',
|
|
11714
|
+
right: containerLeft,
|
|
11715
|
+
width: 'auto',
|
|
11716
|
+
maxWidth: "".concat(containerRect.width, "px"),
|
|
11717
|
+
};
|
|
11718
|
+
}
|
|
11719
|
+
else {
|
|
11720
|
+
// Enough space, start from dates button
|
|
11721
|
+
return {
|
|
11722
|
+
left: relativeLeft,
|
|
11723
|
+
right: 'auto',
|
|
11724
|
+
width: 'auto',
|
|
11725
|
+
};
|
|
11726
|
+
}
|
|
11727
|
+
}
|
|
11728
|
+
break;
|
|
11729
|
+
case FilterSections.GUESTS:
|
|
11730
|
+
// Guests: Start from guests button, push left if not enough space
|
|
11731
|
+
if (guestsButtonRef.current) {
|
|
11732
|
+
var buttonRect = guestsButtonRef.current.getBoundingClientRect();
|
|
11733
|
+
var relativeLeft = buttonRect.left - containerRect.left;
|
|
11734
|
+
var availableWidth = containerRect.width - relativeLeft;
|
|
11735
|
+
var dropdownMinWidth = 350;
|
|
11736
|
+
if (availableWidth < dropdownMinWidth) {
|
|
11737
|
+
// Not enough space, align to the right
|
|
11738
|
+
return {
|
|
11739
|
+
left: 'auto',
|
|
11740
|
+
right: containerLeft,
|
|
11741
|
+
width: 'auto',
|
|
11742
|
+
maxWidth: "".concat(containerRect.width, "px"),
|
|
11743
|
+
};
|
|
11744
|
+
}
|
|
11745
|
+
else {
|
|
11746
|
+
// Enough space, start from button
|
|
11747
|
+
return {
|
|
11748
|
+
left: relativeLeft,
|
|
11749
|
+
right: 'auto',
|
|
11750
|
+
width: 'auto',
|
|
11751
|
+
};
|
|
11752
|
+
}
|
|
11753
|
+
}
|
|
11754
|
+
break;
|
|
11755
|
+
default:
|
|
11756
|
+
return {};
|
|
11757
|
+
}
|
|
11758
|
+
return {};
|
|
11759
|
+
};
|
|
11760
|
+
|
|
11714
11761
|
var useFilterBar = function (_a) {
|
|
11715
11762
|
var redirectUrl = _a.redirectUrl, ageCategories = _a.ageCategories, onSubmit = _a.onSubmit, tabs = _a.tabs, locations = _a.locations;
|
|
11716
|
-
var _b = __read(
|
|
11717
|
-
var _c = __read(
|
|
11718
|
-
var _d = __read(
|
|
11719
|
-
var _e = __read(
|
|
11720
|
-
var _f = __read(
|
|
11721
|
-
var _g = __read(
|
|
11722
|
-
var _h = __read(
|
|
11723
|
-
|
|
11763
|
+
var _b = __read(React__default.useState(Pages.EVENTS), 2), selectedPath = _b[0], setSelectedPath = _b[1];
|
|
11764
|
+
var _c = __read(React__default.useState(false), 2), selectedFilter = _c[0], setSelectedFilter = _c[1];
|
|
11765
|
+
var _d = __read(React__default.useState(), 2), calendarRange = _d[0], setCalendarRange = _d[1];
|
|
11766
|
+
var _e = __read(React__default.useState(false), 2), innerLoading = _e[0], setInnerLoading = _e[1];
|
|
11767
|
+
var _f = __read(React__default.useState(0), 2), categories = _f[0], setCategories = _f[1];
|
|
11768
|
+
var _g = __read(React__default.useState({}), 2), ageCategoryCounts = _g[0], setAgeCategoryCounts = _g[1];
|
|
11769
|
+
var _h = __read(React__default.useState([]), 2), selectedLocations = _h[0], setSelectedLocations = _h[1];
|
|
11770
|
+
React__default.useEffect(function () {
|
|
11724
11771
|
var _a;
|
|
11725
11772
|
var urlSearchParams = new URLSearchParams(window.location.search);
|
|
11726
11773
|
var startDateParam = urlSearchParams.get('startDate');
|
|
@@ -11745,7 +11792,7 @@
|
|
|
11745
11792
|
setSelectedLocations(matchedLocations);
|
|
11746
11793
|
}
|
|
11747
11794
|
}, []);
|
|
11748
|
-
|
|
11795
|
+
React__default.useEffect(function () {
|
|
11749
11796
|
if (typeof window === 'undefined')
|
|
11750
11797
|
return;
|
|
11751
11798
|
var defaultTab = (tabs === null || tabs === void 0 ? void 0 : tabs.length) === 1 ? tabs[0] : tabs === null || tabs === void 0 ? void 0 : tabs.find(function (tab) { return tab.default; });
|
|
@@ -11878,9 +11925,9 @@
|
|
|
11878
11925
|
|
|
11879
11926
|
var useScrollInToView = function (_a) {
|
|
11880
11927
|
var selectedFilter = _a.selectedFilter;
|
|
11881
|
-
var _b = __read(
|
|
11882
|
-
var targetFilterBarRef =
|
|
11883
|
-
|
|
11928
|
+
var _b = __read(React__default.useState(true), 2), isMobile = _b[0], setIsMobile = _b[1];
|
|
11929
|
+
var targetFilterBarRef = React__default.useRef(null);
|
|
11930
|
+
React__default.useEffect(function () {
|
|
11884
11931
|
if (typeof window !== 'undefined' && window.innerWidth > 960) {
|
|
11885
11932
|
setIsMobile(false);
|
|
11886
11933
|
return;
|
|
@@ -11897,33 +11944,29 @@
|
|
|
11897
11944
|
return { isMobile: isMobile, targetFilterBarRef: targetFilterBarRef };
|
|
11898
11945
|
};
|
|
11899
11946
|
|
|
11900
|
-
var css_248z$
|
|
11901
|
-
styleInject(css_248z$
|
|
11947
|
+
var css_248z$b = ".will-filter-bar-select-button {\n width: 100%;\n height: auto;\n background-color: transparent;\n border: none;\n padding: 0 20px;\n border-radius: 20px;\n cursor: pointer;\n font-size: 14px;\n text-align: initial;\n}\n\n.will-filter-bar-select-button.disabled {\n cursor: not-allowed;\n}\n\n.will-filter-bar-select-button .select-button-wrapper {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 10px;\n}\n\n.will-filter-bar-select-button .select-button-wrapper > div {\n display: grid;\n}\n\n.will-filter-bar-select-button .select-button-label {\n color: var(--will-black);\n font-weight: 600;\n}\n\n.will-filter-bar-select-button .select-button-description {\n color: var(--will-black);\n font-weight: 400;\n opacity: 0.5;\n white-space: nowrap;\n min-height: 19px;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.will-filter-bar-select-button .select-button-description span {\n font: inherit;\n}\n\n.will-filter-bar-select-button .select-button-label.active,\n.will-filter-bar-select-button .select-button-description.active {\n font-weight: 700;\n font-size: 15px;\n opacity: 1;\n}\n\n@media (max-width: 960px) {\n .will-filter-bar-select-button {\n padding: 15px 0;\n }\n\n .will-filter-bar-select-button:first-child {\n padding: 0 0 15px 0;\n }\n\n .will-filter-bar-select-button .select-button-wrapper {\n justify-content: center;\n text-align: center;\n }\n\n .will-filter-bar-select-button .select-button-description {\n white-space: wrap;\n }\n\n .will-filter-bar-select-button .select-button-divider {\n display: none;\n }\n}\n";
|
|
11948
|
+
styleInject(css_248z$b);
|
|
11902
11949
|
|
|
11903
|
-
var SelectButton =
|
|
11950
|
+
var SelectButton = React__default.forwardRef(function (_a, ref) {
|
|
11904
11951
|
var active = _a.active, label = _a.label, onClick = _a.onClick, description = _a.description, disabled = _a.disabled, ariaExpanded = _a.ariaExpanded, ariaControls = _a.ariaControls;
|
|
11905
|
-
return (
|
|
11906
|
-
React.createElement("span", { className: "select-button-wrapper" },
|
|
11907
|
-
React.createElement("div", null,
|
|
11908
|
-
React.createElement("p", { className: "select-button-label" }, label),
|
|
11909
|
-
React.createElement("p", { className: "select-button-description ".concat(active ? 'active' : ''), dangerouslySetInnerHTML: { __html: description } })))));
|
|
11952
|
+
return (jsxRuntime.jsx("button", { ref: ref, className: "will-filter-bar-select-button ".concat(disabled ? 'disabled' : ''), onClick: disabled ? undefined : onClick, disabled: disabled, "aria-expanded": ariaExpanded, "aria-controls": ariaControls, "aria-haspopup": "true", "aria-disabled": disabled, children: jsxRuntime.jsx("span", { className: "select-button-wrapper", children: jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("p", { className: "select-button-label", children: label }), jsxRuntime.jsx("p", { className: "select-button-description ".concat(active ? 'active' : ''), dangerouslySetInnerHTML: { __html: description } })] }) }) }));
|
|
11910
11953
|
});
|
|
11911
11954
|
SelectButton.displayName = 'SelectButton';
|
|
11912
11955
|
|
|
11913
|
-
var css_248z$
|
|
11914
|
-
styleInject(css_248z$
|
|
11956
|
+
var css_248z$a = ".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";
|
|
11957
|
+
styleInject(css_248z$a);
|
|
11915
11958
|
|
|
11916
11959
|
var TabButton = function (_a) {
|
|
11917
11960
|
var onClick = _a.onClick, label = _a.label, active = _a.active, mode = _a.mode;
|
|
11918
|
-
return (
|
|
11961
|
+
return (jsxRuntime.jsx("button", { className: "will-filter-bar-tab-button ".concat(mode || 'light', " ").concat(active && 'active', " "), onClick: onClick, children: label }));
|
|
11919
11962
|
};
|
|
11920
11963
|
|
|
11921
|
-
var css_248z$
|
|
11922
|
-
styleInject(css_248z$
|
|
11964
|
+
var css_248z$9 = ".will-guests-filter-label,\n.will-guests-filter-count {\n font-size: 18px;\n color: var(--will-text);\n}\n\n.will-guests-filter-inner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n.will-guests-filter-label {\n display: block;\n font-weight: 600;\n margin-bottom: 10px;\n}\n\n.will-guests-filter-inner .will-guests-filter-counter {\n display: flex;\n align-items: center;\n}\n\n.will-guests-filter-count {\n margin: 0 10px;\n min-width: 30px;\n text-align: center;\n}\n\n.will-guests-filter-counter-button {\n border-radius: 50%;\n background-color: transparent;\n border: 1px solid var(--will-grey);\n width: 30px;\n height: 30px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 20px;\n cursor: pointer;\n color: var(--will-black);\n\n padding: 0;\n margin: 0;\n -webkit-appearance: none;\n appearance: none;\n}\n\n.will-guests-filter-counter-button:hover {\n background-color: var(--will-onahau);\n}\n\n@media (max-width: 960px) {\n .will-guests-filter-inner {\n width: 100%;\n margin: 15px 0;\n justify-content: space-between;\n }\n}\n";
|
|
11965
|
+
styleInject(css_248z$9);
|
|
11923
11966
|
|
|
11924
11967
|
var GuestCount = function (_a) {
|
|
11925
11968
|
var label = _a.label, sortOrder = _a.sortOrder, id = _a.id, updateGuestsCount = _a.updateGuestsCount, count = _a.count, minVal = _a.minVal;
|
|
11926
|
-
|
|
11969
|
+
React__default.useEffect(function () {
|
|
11927
11970
|
if (minVal && minVal > count) {
|
|
11928
11971
|
updateGuestsCount("guests-".concat(id), minVal);
|
|
11929
11972
|
}
|
|
@@ -11936,54 +11979,41 @@
|
|
|
11936
11979
|
var handleIncrement = function () {
|
|
11937
11980
|
updateGuestsCount("guests-".concat(id), count + 1);
|
|
11938
11981
|
};
|
|
11939
|
-
return (
|
|
11940
|
-
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
|
|
11944
|
-
|
|
11945
|
-
|
|
11946
|
-
|
|
11947
|
-
|
|
11948
|
-
React.createElement("path", { d: "M4 10H16", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }))),
|
|
11949
|
-
React.createElement("span", { className: "will-guests-filter-count" }, count),
|
|
11950
|
-
React.createElement("button", { className: "will-guests-filter-counter-button", onClick: handleIncrement },
|
|
11951
|
-
React.createElement("svg", { width: "15", height: "15", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
11952
|
-
React.createElement("path", { d: "M10 4V16M4 10H16", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }))))));
|
|
11953
|
-
};
|
|
11954
|
-
|
|
11955
|
-
var css_248z$7 = ".will-filter-section-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n.will-filter-section-title {\n font-size: 22px;\n margin: 0;\n}\n\n.will-filter-section-action {\n display: flex;\n gap: 8px;\n align-items: center;\n}\n\n.will-filter-section-action .will-filter-bar-close-button {\n position: relative;\n top: auto;\n right: auto;\n margin: 0;\n}\n\n@media (max-width: 960px) {\n .will-filter-section-title {\n font-size: 18px;\n }\n}\n";
|
|
11956
|
-
styleInject(css_248z$7);
|
|
11982
|
+
return (jsxRuntime.jsxs("div", { className: "will-guests-filter-inner", style: { order: "".concat(sortOrder) }, children: [jsxRuntime.jsx("p", { className: "will-guests-filter-label", children: label }), jsxRuntime.jsxs("div", { className: "will-guests-filter-counter", children: [jsxRuntime.jsx("button", { className: "will-guests-filter-counter-button", onClick: handleDecrement, disabled: (minVal && count <= minVal) || !count, style: {
|
|
11983
|
+
cursor: (minVal && count <= minVal) || !count ? 'initial' : 'pointer',
|
|
11984
|
+
paddingBottom: '4px',
|
|
11985
|
+
opacity: (minVal && count <= minVal) || !count ? 0.4 : 1,
|
|
11986
|
+
}, children: jsxRuntime.jsx("svg", { width: "10", height: "10", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M4 10H16", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) }), jsxRuntime.jsx("span", { className: "will-guests-filter-count", children: count }), jsxRuntime.jsx("button", { className: "will-guests-filter-counter-button", onClick: handleIncrement, children: jsxRuntime.jsx("svg", { width: "15", height: "15", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M10 4V16M4 10H16", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })] })] }));
|
|
11987
|
+
};
|
|
11988
|
+
|
|
11989
|
+
var css_248z$8 = ".will-filter-section-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 16px;\n}\n\n.will-filter-section-title {\n font-size: 22px;\n margin: 0;\n}\n\n.will-filter-section-action {\n display: flex;\n gap: 8px;\n align-items: center;\n}\n\n.will-filter-section-action .will-filter-bar-close-button {\n position: relative;\n top: auto;\n right: auto;\n margin: 0;\n}\n\n@media (max-width: 960px) {\n .will-filter-section-title {\n font-size: 18px;\n }\n}\n";
|
|
11990
|
+
styleInject(css_248z$8);
|
|
11957
11991
|
|
|
11958
11992
|
var FilterSectionHeader = function (_a) {
|
|
11959
11993
|
var title = _a.title, action = _a.action;
|
|
11960
|
-
return (
|
|
11961
|
-
React.createElement("h3", { className: "will-filter-section-title" }, title),
|
|
11962
|
-
action && React.createElement("div", { className: "will-filter-section-action" }, action)));
|
|
11994
|
+
return (jsxRuntime.jsxs("div", { className: "will-filter-section-header", children: [jsxRuntime.jsx("h3", { className: "will-filter-section-title", children: title }), action && jsxRuntime.jsx("div", { className: "will-filter-section-action", children: action })] }));
|
|
11963
11995
|
};
|
|
11964
11996
|
|
|
11965
|
-
var css_248z$
|
|
11966
|
-
styleInject(css_248z$
|
|
11997
|
+
var css_248z$7 = ".will-filter-bar-guests {\n text-align: initial;\n}\n\n.will-guests-filter-container {\n display: flex;\n flex-direction: column;\n min-width: 400px;\n gap: 20px;\n padding: 16px;\n}\n\n@media (max-width: 960px) {\n .will-guests-filter-container {\n margin-top: 15px;\n min-width: 100%;\n }\n}\n";
|
|
11998
|
+
styleInject(css_248z$7);
|
|
11967
11999
|
|
|
11968
|
-
var Guests =
|
|
12000
|
+
var Guests = React__default.forwardRef(function (_a, ref) {
|
|
11969
12001
|
var ageCategories = _a.ageCategories, updateGuestsCount = _a.updateGuestsCount, ageCategoryCounts = _a.ageCategoryCounts, autoFocus = _a.autoFocus, onClose = _a.onClose;
|
|
11970
12002
|
var t = useTranslation('filterBar').t;
|
|
11971
12003
|
var containerRef = useAutoFocus(autoFocus);
|
|
11972
|
-
return (
|
|
11973
|
-
React.createElement(FilterSectionHeader, { title: t('guests.title'), action: onClose && React.createElement(CloseButton, { handleClose: onClose }) }),
|
|
11974
|
-
React.createElement("div", { className: "will-guests-filter-container", ref: containerRef }, ageCategories === null || ageCategories === void 0 ? void 0 : ageCategories.map(function (category) { return (React.createElement(GuestCount, { key: category.id, id: category.id, label: category.name, minVal: category.minVal, sortOrder: category.sortOrder, updateGuestsCount: updateGuestsCount, count: ageCategoryCounts["guests-".concat(category.id)] || 0 })); }))));
|
|
12004
|
+
return (jsxRuntime.jsxs("div", { className: "will-filter-bar-guests", ref: ref, children: [jsxRuntime.jsx(FilterSectionHeader, { title: t('guests.title'), action: onClose && jsxRuntime.jsx(CloseButton, { handleClose: onClose }) }), jsxRuntime.jsx("div", { className: "will-guests-filter-container", ref: containerRef, children: ageCategories === null || ageCategories === void 0 ? void 0 : ageCategories.map(function (category) { return (jsxRuntime.jsx(GuestCount, { id: category.id, label: category.name, minVal: category.minVal, sortOrder: category.sortOrder, updateGuestsCount: updateGuestsCount, count: ageCategoryCounts["guests-".concat(category.id)] || 0 }, category.id)); }) })] }));
|
|
11975
12005
|
});
|
|
11976
12006
|
Guests.displayName = 'Guests';
|
|
11977
12007
|
|
|
11978
|
-
var css_248z$
|
|
11979
|
-
styleInject(css_248z$
|
|
12008
|
+
var css_248z$6 = ".will-filter-bar-divider {\n width: 1px;\n margin: 0 10px;\n background-color: var(--will-charcoal-blue);\n}\n\n@media (max-width: 960px) {\n .will-filter-bar-divider {\n width: auto;\n margin: 0 10px;\n height: 1px;\n background-color: var(--will-charcoal-blue);\n }\n}";
|
|
12009
|
+
styleInject(css_248z$6);
|
|
11980
12010
|
|
|
11981
12011
|
var Divider = function () {
|
|
11982
|
-
return
|
|
12012
|
+
return jsxRuntime.jsx("div", { className: "will-filter-bar-divider" });
|
|
11983
12013
|
};
|
|
11984
12014
|
|
|
11985
|
-
var css_248z$
|
|
11986
|
-
styleInject(css_248z$
|
|
12015
|
+
var css_248z$5 = ".will-filter-bar-categories {\n text-align: center;\n}\n\n.will-categories-filter-title {\n font-size: 16px;\n text-transform: uppercase;\n margin: 10px 0 30px 0;\n}\n\n.will-categories-filter-inner {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 20px;\n}\n\n.will-categories-filter-inner input {\n cursor: pointer;\n margin-right: 10px;\n}\n";
|
|
12016
|
+
styleInject(css_248z$5);
|
|
11987
12017
|
|
|
11988
12018
|
var Categories = function (_a) {
|
|
11989
12019
|
_a.categories; var setCategories = _a.setCategories;
|
|
@@ -11994,45 +12024,37 @@
|
|
|
11994
12024
|
'Summer camp',
|
|
11995
12025
|
'Winter camp',
|
|
11996
12026
|
];
|
|
11997
|
-
var _b = __read(
|
|
12027
|
+
var _b = __read(React__default.useState(''), 2), selectedCategory = _b[0], setSelectedCategory = _b[1];
|
|
11998
12028
|
var handleCategoryChange = function (selectedCategory) {
|
|
11999
12029
|
setSelectedCategory(selectedCategory);
|
|
12000
12030
|
setCategories(selectedCategory);
|
|
12001
12031
|
};
|
|
12002
|
-
return (
|
|
12003
|
-
React.createElement("h3", { className: "will-categories-filter-title" }, t('categories.label')),
|
|
12004
|
-
React.createElement("div", { className: "will-categories-filter-inner" }, categoriesPlaceholder.map(function (itm, idx) { return (React.createElement("div", { key: idx },
|
|
12005
|
-
React.createElement("input", { type: "radio", value: itm, checked: selectedCategory === itm, onChange: function () { return handleCategoryChange(itm); } }),
|
|
12006
|
-
React.createElement("span", null, itm))); }))));
|
|
12032
|
+
return (jsxRuntime.jsxs("div", { className: "will-filter-bar-categories", children: [jsxRuntime.jsx("h3", { className: "will-categories-filter-title", children: t('categories.label') }), jsxRuntime.jsx("div", { className: "will-categories-filter-inner", children: categoriesPlaceholder.map(function (itm, idx) { return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("input", { type: "radio", value: itm, checked: selectedCategory === itm, onChange: function () { return handleCategoryChange(itm); } }), jsxRuntime.jsx("span", { children: itm })] }, idx)); }) })] }));
|
|
12007
12033
|
};
|
|
12008
12034
|
|
|
12009
|
-
var css_248z$
|
|
12010
|
-
styleInject(css_248z$
|
|
12035
|
+
var css_248z$4 = ".will-filter-bar-locations {\n text-align: initial;\n}\n\n.will-locations-filter-container {\n display: flex;\n gap: 10px;\n flex-direction: column;\n min-width: 400px;\n padding: 16px 0;\n}\n\n@media (max-width: 960px) {\n .will-locations-filter-container {\n margin-top: 15px;\n min-width: 100%;\n }\n}\n";
|
|
12036
|
+
styleInject(css_248z$4);
|
|
12011
12037
|
|
|
12012
|
-
var css_248z$
|
|
12013
|
-
styleInject(css_248z$
|
|
12038
|
+
var css_248z$3 = ".will-image-card {\n display: flex;\n gap: 20px;\n justify-content: space-between;\n align-items: center;\n padding: 8px 16px;\n cursor: pointer;\n user-select: none;\n min-height: 40px;\n}\n\n.will-image-card.is-selected {\n background-color: var(--will-transparent-lavender);\n}\n\n.will-image-card:hover {\n background-color: var(--will-transparent-lavender);\n}\n\n.will-image-card-image img {\n width: 120px;\n height: 68px;\n object-fit: cover;\n}\n";
|
|
12039
|
+
styleInject(css_248z$3);
|
|
12014
12040
|
|
|
12015
|
-
var ImageCard =
|
|
12041
|
+
var ImageCard = React__default.forwardRef(function (_a, ref) {
|
|
12016
12042
|
var title = _a.title, description = _a.description, imageUrl = _a.imageUrl, isSelected = _a.isSelected, onClick = _a.onClick;
|
|
12017
12043
|
var ariaLabel = "".concat(title).concat(description ? ", ".concat(description) : '');
|
|
12018
|
-
return (
|
|
12044
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: "will-image-card ".concat(isSelected ? 'is-selected' : ''), onClick: onClick, onKeyDown: function (e) {
|
|
12019
12045
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
12020
12046
|
e.preventDefault();
|
|
12021
12047
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
12022
12048
|
}
|
|
12023
|
-
}, role: "button", tabIndex: 0, "aria-pressed": isSelected, "aria-label": ariaLabel },
|
|
12024
|
-
React.createElement("div", { className: "will-image-card-content" },
|
|
12025
|
-
React.createElement("h3", null, title),
|
|
12026
|
-
description && React.createElement("p", null, description)),
|
|
12027
|
-
React.createElement("div", { className: "will-image-card-image" }, imageUrl && React.createElement("img", { src: imageUrl, alt: title || 'Location image' }))));
|
|
12049
|
+
}, role: "button", tabIndex: 0, "aria-pressed": isSelected, "aria-label": ariaLabel, children: [jsxRuntime.jsxs("div", { className: "will-image-card-content", children: [jsxRuntime.jsx("h3", { children: title }), description && jsxRuntime.jsx("p", { children: description })] }), jsxRuntime.jsx("div", { className: "will-image-card-image", children: imageUrl && jsxRuntime.jsx("img", { src: imageUrl, alt: title || 'Location image' }) })] }));
|
|
12028
12050
|
});
|
|
12029
12051
|
ImageCard.displayName = 'ImageCard';
|
|
12030
12052
|
|
|
12031
|
-
var Locations =
|
|
12053
|
+
var Locations = React__default.forwardRef(function (_a, ref) {
|
|
12032
12054
|
var locations = _a.locations, language = _a.language, selectedLocations = _a.selectedLocations, setSelectedLocations = _a.setSelectedLocations, autoFocus = _a.autoFocus, _b = _a.multiSelect, multiSelect = _b === void 0 ? false : _b, onClose = _a.onClose;
|
|
12033
12055
|
var t = useTranslation('filterBar').t;
|
|
12034
|
-
var firstCardRef =
|
|
12035
|
-
|
|
12056
|
+
var firstCardRef = React__default.useRef(null);
|
|
12057
|
+
React__default.useEffect(function () {
|
|
12036
12058
|
if (autoFocus && firstCardRef.current) {
|
|
12037
12059
|
firstCardRef.current.focus();
|
|
12038
12060
|
}
|
|
@@ -12056,42 +12078,22 @@
|
|
|
12056
12078
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
12057
12079
|
}
|
|
12058
12080
|
};
|
|
12059
|
-
return (
|
|
12060
|
-
|
|
12061
|
-
|
|
12062
|
-
|
|
12063
|
-
.filter(function (location) {
|
|
12064
|
-
var label = getLocalizedContent({
|
|
12065
|
-
contents: location.label,
|
|
12066
|
-
locale: language,
|
|
12067
|
-
});
|
|
12068
|
-
return !!label;
|
|
12069
|
-
})
|
|
12070
|
-
.map(function (location, index) {
|
|
12071
|
-
var label = getLocalizedContent({
|
|
12072
|
-
contents: location.label,
|
|
12073
|
-
locale: language,
|
|
12074
|
-
});
|
|
12075
|
-
var description = location.description
|
|
12076
|
-
? getLocalizedContent({
|
|
12077
|
-
contents: location.description,
|
|
12078
|
-
locale: language,
|
|
12079
|
-
})
|
|
12080
|
-
: null;
|
|
12081
|
-
return (React.createElement(ImageCard, { key: location.id, ref: index === 0 ? firstCardRef : null, title: label, description: description, imageUrl: location.imageUrl, isSelected: selectedLocations.some(function (loc) { return loc.id === location.id; }), onClick: function () { return handleLocationClick(location); } }));
|
|
12082
|
-
}))));
|
|
12081
|
+
return (jsxRuntime.jsxs("div", { className: "will-filter-bar-locations", ref: ref, children: [jsxRuntime.jsx(FilterSectionHeader, { title: t('locations.title'), action: onClose && jsxRuntime.jsx(CloseButton, { handleClose: onClose }) }), jsxRuntime.jsx("div", { className: "will-locations-filter-container", children: !!((locations === null || locations === void 0 ? void 0 : locations.length) && language) &&
|
|
12082
|
+
locations.map(function (location, index) {
|
|
12083
|
+
return (jsxRuntime.jsx(ImageCard, { ref: index === 0 ? firstCardRef : null, title: location.label, description: location.description, imageUrl: location.imageUrl, isSelected: selectedLocations.some(function (loc) { return loc.id === location.id; }), onClick: function () { return handleLocationClick(location); } }, location.id));
|
|
12084
|
+
}) })] }));
|
|
12083
12085
|
});
|
|
12084
12086
|
Locations.displayName = 'Locations';
|
|
12085
12087
|
|
|
12086
|
-
var css_248z$
|
|
12088
|
+
var css_248z$2 = ".will-root {\n z-index: 999;\n width: fit-content;\n min-width: 796px;\n max-height: 100vh;\n position: relative;\n}\n\n.will-root.is-full-width {\n width: 100%;\n min-width: auto;\n}\n\n.will-filter-bar {\n box-sizing: border-box;\n position: relative;\n}\n\n/* Tabs */\n\n.will-filter-bar-tabs {\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n z-index: 222;\n background: transparent;\n padding: 10px;\n gap: 10px;\n}\n\n/* Header */\n.will-filter-bar-header {\n display: flex;\n justify-content: space-between;\n padding: 10px;\n position: relative;\n z-index: 222;\n border-radius: 40px;\n background-color: var(--will-white);\n}\n\n@media (max-width: 960px) {\n .will-filter-bar-header {\n flex-direction: column;\n padding: 20px;\n border-radius: 25px;\n overflow: hidden;\n }\n}\n\n/* Container */\n\n.will-filter-bar-container {\n background-color: var(--will-white);\n min-height: 100px;\n position: absolute;\n top: 125px;\n z-index: 111;\n border-radius: 25px;\n box-shadow: var(--will-box-shadow);\n}\n\n@media (max-width: 960px) {\n .will-root {\n width: 100%;\n min-width: auto;\n max-height: 100vh;\n z-index: 3;\n }\n\n .will-filter-bar-container {\n margin-top: 10px;\n top: 0;\n padding: 45px 20px;\n position: relative;\n }\n}\n\n/* Common */\n\n.will-filter-bar-header.dark,\n.will-filter-bar-container.dark {\n box-shadow: var(--will-box-shadow-dark);\n}\n\n.will-filter-bar-header.light,\n.will-filter-bar-container.light {\n box-shadow: var(--will-box-shadow-light);\n}\n\n.will-guest-count {\n display: inline-block;\n min-width: 10px;\n}\n";
|
|
12089
|
+
styleInject(css_248z$2);
|
|
12090
|
+
|
|
12091
|
+
var css_248z$1 = ".will-dates-filter-container {\n padding: 0 16px;\n}\n";
|
|
12087
12092
|
styleInject(css_248z$1);
|
|
12088
12093
|
|
|
12089
|
-
var Dates =
|
|
12094
|
+
var Dates = React__default.forwardRef(function (_a, ref) {
|
|
12090
12095
|
var onClose = _a.onClose, autoFocus = _a.autoFocus, calendarRange = _a.calendarRange, setCalendarRange = _a.setCalendarRange, disableCalendarDates = _a.disableCalendarDates, selectedPath = _a.selectedPath, language = _a.language, filtersRef = _a.filtersRef;
|
|
12091
|
-
return (
|
|
12092
|
-
React.createElement(FilterSectionHeader, { title: '', action: onClose && React.createElement(CloseButton, { handleClose: onClose }) }),
|
|
12093
|
-
React.createElement("div", { className: "will-dates-filter-container" },
|
|
12094
|
-
React.createElement(Calendar, { autoFocus: autoFocus, calendarRange: calendarRange, setCalendarRange: setCalendarRange, disableCalendarDates: disableCalendarDates, selectedPath: selectedPath, language: language, ref: filtersRef }))));
|
|
12096
|
+
return (jsxRuntime.jsxs("div", { className: "will-filter-bar-dates", ref: ref, children: [jsxRuntime.jsx(FilterSectionHeader, { title: '', action: onClose && jsxRuntime.jsx(CloseButton, { handleClose: onClose }) }), jsxRuntime.jsx("div", { className: "will-dates-filter-container", children: jsxRuntime.jsx(Calendar, { autoFocus: autoFocus, calendarRange: calendarRange, setCalendarRange: setCalendarRange, disableCalendarDates: disableCalendarDates, selectedPath: selectedPath, language: language, ref: filtersRef }) })] }));
|
|
12095
12097
|
});
|
|
12096
12098
|
Dates.displayName = 'Dates';
|
|
12097
12099
|
|
|
@@ -12103,24 +12105,42 @@
|
|
|
12103
12105
|
useUpdateTranslations({ language: language });
|
|
12104
12106
|
var t = useTranslation('filterBar').t;
|
|
12105
12107
|
// Refs for SelectButtons
|
|
12106
|
-
var locationsButtonRef =
|
|
12107
|
-
var datesButtonRef =
|
|
12108
|
-
var guestsButtonRef =
|
|
12109
|
-
var previouslyFocusedButtonRef =
|
|
12108
|
+
var locationsButtonRef = React__default.useRef(null);
|
|
12109
|
+
var datesButtonRef = React__default.useRef(null);
|
|
12110
|
+
var guestsButtonRef = React__default.useRef(null);
|
|
12111
|
+
var previouslyFocusedButtonRef = React__default.useRef(null);
|
|
12112
|
+
var headerRef = React__default.useRef(null);
|
|
12113
|
+
// Dropdown positioning
|
|
12114
|
+
var _f = __read(React__default.useState({}), 2), dropdownStyle = _f[0], setDropdownStyle = _f[1];
|
|
12110
12115
|
// Filters
|
|
12111
|
-
var
|
|
12116
|
+
var _g = useFilterBar({
|
|
12112
12117
|
redirectUrl: redirectUrl,
|
|
12113
12118
|
ageCategories: ageCategories,
|
|
12114
12119
|
onSubmit: onSubmit,
|
|
12115
12120
|
tabs: tabs,
|
|
12116
12121
|
locations: locations,
|
|
12117
|
-
}), selectedFilter =
|
|
12122
|
+
}), selectedFilter = _g.selectedFilter, ageCategoryCounts = _g.ageCategoryCounts, categories = _g.categories, calendarRange = _g.calendarRange, selectedPath = _g.selectedPath, innerLoading = _g.innerLoading, selectedLocations = _g.selectedLocations, setSelectedLocations = _g.setSelectedLocations, setCalendarRange = _g.setCalendarRange, setCategories = _g.setCategories, handleSelectedFilter = _g.handleSelectedFilter, handleSubmit = _g.handleSubmit, updateGuestsCount = _g.updateGuestsCount, setSelectedPath = _g.setSelectedPath, handleResetFilters = _g.handleResetFilters;
|
|
12118
12123
|
// Scroll in to view
|
|
12119
|
-
var
|
|
12124
|
+
var _h = useScrollInToView({ selectedFilter: selectedFilter }), isMobile = _h.isMobile, targetFilterBarRef = _h.targetFilterBarRef;
|
|
12120
12125
|
// Handle close filter section
|
|
12121
12126
|
var filtersRef = useCloseFilterSection({ handleSelectedFilter: handleSelectedFilter }).filtersRef;
|
|
12127
|
+
// Enhanced handleSelectedFilter with positioning
|
|
12128
|
+
var handleSelectedFilterWithPosition = function (filter) {
|
|
12129
|
+
if (filter) {
|
|
12130
|
+
var position = calculateDropdownPosition({
|
|
12131
|
+
filterSection: filter,
|
|
12132
|
+
headerRef: headerRef,
|
|
12133
|
+
locationsButtonRef: locationsButtonRef,
|
|
12134
|
+
datesButtonRef: datesButtonRef,
|
|
12135
|
+
guestsButtonRef: guestsButtonRef,
|
|
12136
|
+
isMobile: isMobile,
|
|
12137
|
+
});
|
|
12138
|
+
setDropdownStyle(position);
|
|
12139
|
+
}
|
|
12140
|
+
handleSelectedFilter(filter);
|
|
12141
|
+
};
|
|
12122
12142
|
// Store previously focused button and restore focus when closing
|
|
12123
|
-
|
|
12143
|
+
React__default.useEffect(function () {
|
|
12124
12144
|
if (!selectedFilter && previouslyFocusedButtonRef.current) {
|
|
12125
12145
|
previouslyFocusedButtonRef.current.focus();
|
|
12126
12146
|
previouslyFocusedButtonRef.current = null;
|
|
@@ -12139,51 +12159,34 @@
|
|
|
12139
12159
|
});
|
|
12140
12160
|
var parsedLocations = parseLocations({
|
|
12141
12161
|
selectedLocations: selectedLocations,
|
|
12142
|
-
language: language,
|
|
12143
12162
|
locationsPlaceholder: t('locations.placeholder'),
|
|
12144
12163
|
locationsSelectedLabel: t('locations.selected'),
|
|
12145
12164
|
});
|
|
12146
|
-
return (
|
|
12147
|
-
|
|
12148
|
-
|
|
12149
|
-
|
|
12150
|
-
|
|
12151
|
-
|
|
12152
|
-
|
|
12153
|
-
|
|
12154
|
-
|
|
12155
|
-
|
|
12156
|
-
|
|
12157
|
-
|
|
12158
|
-
|
|
12159
|
-
|
|
12160
|
-
|
|
12161
|
-
|
|
12162
|
-
|
|
12163
|
-
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
: t('
|
|
12168
|
-
|
|
12169
|
-
|
|
12170
|
-
|
|
12171
|
-
selectedPath !== Pages.EVENTS && (React.createElement(React.Fragment, null,
|
|
12172
|
-
React.createElement(Divider, null),
|
|
12173
|
-
React.createElement(SelectButton, { ref: guestsButtonRef, label: t('guests.label'), description: parsedGuests.content, onClick: function () {
|
|
12174
|
-
previouslyFocusedButtonRef.current = guestsButtonRef.current;
|
|
12175
|
-
handleSelectedFilter(FilterSections.GUESTS);
|
|
12176
|
-
}, active: !!parsedGuests.data.total, ariaExpanded: selectedFilter === FilterSections.GUESTS, ariaControls: "will-guests-filter" }))),
|
|
12177
|
-
React.createElement(SubmitButton, { onClick: handleSubmit, startIcon: React.createElement(FaSearch, null), label: t('common:search'), isLoading: innerLoading || outerLoading })),
|
|
12178
|
-
selectedFilter && (React.createElement("div", { className: "will-filter-bar-container ".concat(mode || 'light'), style: (!tabs || tabs.length < 2) && !isMobile ? { top: 66 } : {} },
|
|
12179
|
-
selectedFilter === FilterSections.CALENDAR && (React.createElement("div", { id: "will-dates-filter" },
|
|
12180
|
-
React.createElement(Dates, { autoFocus: true, ref: filtersRef, onClose: function () { return handleSelectedFilter(false); }, calendarRange: calendarRange, setCalendarRange: setCalendarRange, disableCalendarDates: disableCalendarDates, selectedPath: selectedPath, language: language, filtersRef: filtersRef }))),
|
|
12181
|
-
selectedFilter === FilterSections.GUESTS && (React.createElement("div", { id: "will-guests-filter" },
|
|
12182
|
-
React.createElement(Guests, { updateGuestsCount: updateGuestsCount, ageCategories: ageCategories, ageCategoryCounts: ageCategoryCounts, ref: filtersRef, autoFocus: true, onClose: function () { return handleSelectedFilter(false); } }))),
|
|
12183
|
-
selectedFilter === FilterSections.CATEGORIES && (React.createElement("div", { id: "will-categories-filter" },
|
|
12184
|
-
React.createElement(Categories, { categories: categories, setCategories: setCategories }))),
|
|
12185
|
-
selectedFilter === FilterSections.LOCATIONS && (React.createElement("div", { id: "will-locations-filter" },
|
|
12186
|
-
React.createElement(Locations, { autoFocus: true, ref: filtersRef, locations: locations === null || locations === void 0 ? void 0 : locations.data, language: language, selectedLocations: selectedLocations, setSelectedLocations: setSelectedLocations, multiSelect: locations === null || locations === void 0 ? void 0 : locations.multiSelect, onClose: function () { return handleSelectedFilter(false); } })))))));
|
|
12165
|
+
return (jsxRuntime.jsxs("div", { className: "will-root ".concat(fullWidth ? 'is-full-width' : ''), style: themePalette, children: [tabs && tabs.length > 1 && (jsxRuntime.jsx("div", { className: "will-filter-bar-tabs", ref: targetFilterBarRef, children: tabs
|
|
12166
|
+
.sort(function (a, b) { return a.order - b.order; })
|
|
12167
|
+
.map(function (tab, idx) { return (jsxRuntime.jsx(TabButton, { label: tab.label || t("tabs.".concat(tab.path.substring(1))), onClick: function () {
|
|
12168
|
+
setSelectedPath(tab.path);
|
|
12169
|
+
handleResetFilters();
|
|
12170
|
+
handleSelectedFilter(false);
|
|
12171
|
+
}, active: selectedPath === tab.path, mode: mode }, "tab-".concat(idx))); }) })), jsxRuntime.jsxs("div", { className: "will-filter-bar-header ".concat(mode || 'light'), ref: function (el) {
|
|
12172
|
+
headerRef.current = el;
|
|
12173
|
+
if ((tabs === null || tabs === void 0 ? void 0 : tabs.length) === 1 && targetFilterBarRef) {
|
|
12174
|
+
targetFilterBarRef.current = el;
|
|
12175
|
+
}
|
|
12176
|
+
}, children: [!!((_b = locations === null || locations === void 0 ? void 0 : locations.data) === null || _b === void 0 ? void 0 : _b.length) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(SelectButton, { ref: locationsButtonRef, label: t('locations.label'), description: parsedLocations, onClick: function () {
|
|
12177
|
+
previouslyFocusedButtonRef.current = locationsButtonRef.current;
|
|
12178
|
+
handleSelectedFilterWithPosition(FilterSections.LOCATIONS);
|
|
12179
|
+
}, active: !!selectedLocations.length, disabled: locations === null || locations === void 0 ? void 0 : locations.disabled, ariaExpanded: selectedFilter === FilterSections.LOCATIONS, ariaControls: "will-locations-filter" }), jsxRuntime.jsx(Divider, {})] })), jsxRuntime.jsx(SelectButton, { ref: datesButtonRef, label: t('calendar.label'), description: parsedDates
|
|
12180
|
+
? parsedDates
|
|
12181
|
+
: selectedPath === Pages.ROOMS
|
|
12182
|
+
? t('calendar.roomsLabelPlaceholder')
|
|
12183
|
+
: t('calendar.eventsLabelPlaceholder'), onClick: function () {
|
|
12184
|
+
previouslyFocusedButtonRef.current = datesButtonRef.current;
|
|
12185
|
+
handleSelectedFilterWithPosition(FilterSections.CALENDAR);
|
|
12186
|
+
}, active: !!parsedDates, ariaExpanded: selectedFilter === FilterSections.CALENDAR, ariaControls: "will-calendar-filter" }), selectedPath !== Pages.EVENTS && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Divider, {}), jsxRuntime.jsx(SelectButton, { ref: guestsButtonRef, label: t('guests.label'), description: parsedGuests.content, onClick: function () {
|
|
12187
|
+
previouslyFocusedButtonRef.current = guestsButtonRef.current;
|
|
12188
|
+
handleSelectedFilterWithPosition(FilterSections.GUESTS);
|
|
12189
|
+
}, active: !!parsedGuests.data.total, ariaExpanded: selectedFilter === FilterSections.GUESTS, ariaControls: "will-guests-filter" })] })), jsxRuntime.jsx(SubmitButton, { onClick: handleSubmit, startIcon: jsxRuntime.jsx(FaSearch, {}), label: t('common:search'), isLoading: innerLoading || outerLoading })] }), selectedFilter && (jsxRuntime.jsxs("div", { className: "will-filter-bar-container ".concat(mode || 'light'), style: __assign$2(__assign$2({}, ((!tabs || tabs.length < 2) && !isMobile ? { top: 66 } : {})), dropdownStyle), children: [selectedFilter === FilterSections.CALENDAR && (jsxRuntime.jsx("div", { id: "will-dates-filter", children: jsxRuntime.jsx(Dates, { autoFocus: true, ref: filtersRef, onClose: function () { return handleSelectedFilter(false); }, calendarRange: calendarRange, setCalendarRange: setCalendarRange, disableCalendarDates: disableCalendarDates, selectedPath: selectedPath, language: language, filtersRef: filtersRef }) })), selectedFilter === FilterSections.GUESTS && (jsxRuntime.jsx("div", { id: "will-guests-filter", children: jsxRuntime.jsx(Guests, { updateGuestsCount: updateGuestsCount, ageCategories: ageCategories, ageCategoryCounts: ageCategoryCounts, ref: filtersRef, autoFocus: true, onClose: function () { return handleSelectedFilter(false); } }) })), selectedFilter === FilterSections.CATEGORIES && (jsxRuntime.jsx("div", { id: "will-categories-filter", children: jsxRuntime.jsx(Categories, { categories: categories, setCategories: setCategories }) })), selectedFilter === FilterSections.LOCATIONS && (jsxRuntime.jsx("div", { id: "will-locations-filter", children: jsxRuntime.jsx(Locations, { autoFocus: true, ref: filtersRef, locations: locations === null || locations === void 0 ? void 0 : locations.data, language: language, selectedLocations: selectedLocations, setSelectedLocations: setSelectedLocations, multiSelect: locations === null || locations === void 0 ? void 0 : locations.multiSelect, onClose: function () { return handleSelectedFilter(false); } }) }))] }))] }));
|
|
12187
12190
|
}
|
|
12188
12191
|
////////////
|
|
12189
12192
|
var AGE_CATEGORIES_FALLBACK = [
|
|
@@ -12206,18 +12209,18 @@
|
|
|
12206
12209
|
var useFilterCalendar = function (_a) {
|
|
12207
12210
|
var onSubmit = _a.onSubmit, setToggleCalendar = _a.setToggleCalendar, noActiveSelection = _a.noActiveSelection, toggleCalendar = _a.toggleCalendar, outerRangeContext = _a.outerRangeContext, outerDisableCalendarDates = _a.outerDisableCalendarDates;
|
|
12208
12211
|
// State
|
|
12209
|
-
var _b = __read(
|
|
12210
|
-
var _c = __read(
|
|
12211
|
-
var _d = __read(
|
|
12212
|
-
var _e = __read(
|
|
12213
|
-
var _f = __read(
|
|
12214
|
-
var _g = __read(
|
|
12215
|
-
var _h = __read(
|
|
12216
|
-
var _j = __read(
|
|
12217
|
-
var _k = __read(
|
|
12212
|
+
var _b = __read(React__default.useState(), 2), calendarRange = _b[0], setCalendarRange = _b[1];
|
|
12213
|
+
var _c = __read(React__default.useState(outerRangeContext), 2), rangeContext = _c[0], setRangeContext = _c[1];
|
|
12214
|
+
var _d = __read(React__default.useState(), 2), initialCalendarRange = _d[0], setInitialCalendarRange = _d[1];
|
|
12215
|
+
var _e = __read(React__default.useState([]), 2), disabledDates = _e[0], setDisabledDates = _e[1];
|
|
12216
|
+
var _f = __read(React__default.useState(false), 2), updateCalendarMonthNavigation = _f[0], setUpdateCalendarMonthNavigation = _f[1];
|
|
12217
|
+
var _g = __read(React__default.useState(0), 2), updateCalendarDefaultMonth = _g[0], setUpdateCalendarDefaultMonth = _g[1];
|
|
12218
|
+
var _h = __read(React__default.useState(false), 2), calendarHasError = _h[0], setCalendarHasError = _h[1];
|
|
12219
|
+
var _j = __read(React__default.useState(false), 2), updatedForSubmit = _j[0], setUpdatedForSubmit = _j[1];
|
|
12220
|
+
var _k = __read(React__default.useState(), 2), disableCalendarDates = _k[0], setDisableCalendarDates = _k[1];
|
|
12218
12221
|
// Lifecycle
|
|
12219
12222
|
// Handle update component with new data
|
|
12220
|
-
|
|
12223
|
+
React__default.useEffect(function () {
|
|
12221
12224
|
var _a;
|
|
12222
12225
|
if (outerDisableCalendarDates === null || outerDisableCalendarDates === void 0 ? void 0 : outerDisableCalendarDates.availableDates) {
|
|
12223
12226
|
setDisableCalendarDates({
|
|
@@ -12235,7 +12238,7 @@
|
|
|
12235
12238
|
}
|
|
12236
12239
|
}, [outerDisableCalendarDates]);
|
|
12237
12240
|
// Handle Range Context initial selections
|
|
12238
|
-
|
|
12241
|
+
React__default.useEffect(function () {
|
|
12239
12242
|
if (typeof window === 'undefined')
|
|
12240
12243
|
return;
|
|
12241
12244
|
var urlSearchParams = new URLSearchParams(window.location.search);
|
|
@@ -12265,7 +12268,7 @@
|
|
|
12265
12268
|
}
|
|
12266
12269
|
}, [toggleCalendar]);
|
|
12267
12270
|
// Handle submit dates
|
|
12268
|
-
|
|
12271
|
+
React__default.useEffect(function () {
|
|
12269
12272
|
var formatString = 'dd.MM.yyyy';
|
|
12270
12273
|
var initialRangeTo = (initialCalendarRange === null || initialCalendarRange === void 0 ? void 0 : initialCalendarRange.to)
|
|
12271
12274
|
? format(initialCalendarRange.to, formatString)
|
|
@@ -12324,36 +12327,26 @@
|
|
|
12324
12327
|
var nights = nightsCount({
|
|
12325
12328
|
calendarRange: calendarRange,
|
|
12326
12329
|
});
|
|
12327
|
-
return (
|
|
12328
|
-
|
|
12329
|
-
|
|
12330
|
-
|
|
12331
|
-
|
|
12332
|
-
|
|
12333
|
-
|
|
12334
|
-
|
|
12335
|
-
|
|
12336
|
-
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
dateFormat: 'EEEEEE d.M.yyyy',
|
|
12343
|
-
language: language,
|
|
12344
|
-
}) || t('common:checkOut')))),
|
|
12345
|
-
React.createElement("span", { className: "will-calendar-footer-booked" }, !calendarHasError && nights
|
|
12346
|
-
? "".concat(nights, " ").concat(t("common:".concat(nights === 1 ? 'night' : 'nights')))
|
|
12347
|
-
: '')),
|
|
12348
|
-
React.createElement("div", { className: "will-calendar-footer-actions" },
|
|
12349
|
-
React.createElement(SubmitButton, { onClick: handleClearDates, disabled: !(calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from), label: t("common:clearDates"), variant: "text" }))));
|
|
12330
|
+
return (jsxRuntime.jsxs("div", { className: "will-calendar-footer-actions-wrapper", children: [jsxRuntime.jsxs("div", { className: "will-calendar-footer-dates", children: [calendarHasError ? (jsxRuntime.jsx("div", { className: "will-calendar-footer-error", children: calendarHasError &&
|
|
12331
|
+
renderCalendarErrorMessage({
|
|
12332
|
+
palette: palette,
|
|
12333
|
+
message: t("common:errors.calendarErrors.checkInAvailabilityError"),
|
|
12334
|
+
}) })) : (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("span", { children: parseDate({
|
|
12335
|
+
date: calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from,
|
|
12336
|
+
dateFormat: 'EEEEEE d.M.yyyy',
|
|
12337
|
+
language: language,
|
|
12338
|
+
}) || t('common:checkIn') }), jsxRuntime.jsx("span", { className: "will-calendar-footer-dates-separator", children: "-" }), jsxRuntime.jsx("span", { children: parseDate({
|
|
12339
|
+
date: calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to,
|
|
12340
|
+
dateFormat: 'EEEEEE d.M.yyyy',
|
|
12341
|
+
language: language,
|
|
12342
|
+
}) || t('common:checkOut') })] })), jsxRuntime.jsx("span", { className: "will-calendar-footer-booked", children: !calendarHasError && nights
|
|
12343
|
+
? "".concat(nights, " ").concat(t("common:".concat(nights === 1 ? 'night' : 'nights')))
|
|
12344
|
+
: '' })] }), jsxRuntime.jsx("div", { className: "will-calendar-footer-actions", children: jsxRuntime.jsx(SubmitButton, { onClick: handleClearDates, disabled: !(calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from), label: t("common:clearDates"), variant: "text" }) })] }));
|
|
12350
12345
|
};
|
|
12351
12346
|
/////////
|
|
12352
12347
|
var renderCalendarErrorMessage = function (_a) {
|
|
12353
12348
|
var message = _a.message, palette = _a.palette;
|
|
12354
|
-
return (
|
|
12355
|
-
React.createElement(IconsSvg, { fill: (palette === null || palette === void 0 ? void 0 : palette.error) || 'inherit', size: 25, icon: "warning" }),
|
|
12356
|
-
React.createElement("span", null, message || '')));
|
|
12349
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(IconsSvg, { fill: (palette === null || palette === void 0 ? void 0 : palette.error) || 'inherit', size: 25, icon: "warning" }), jsxRuntime.jsx("span", { children: message || '' })] }));
|
|
12357
12350
|
};
|
|
12358
12351
|
|
|
12359
12352
|
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 max-width: 80%;\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 max-width: 100%;\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}";
|
|
@@ -12379,14 +12372,7 @@
|
|
|
12379
12372
|
var filtersRef = useCloseFilterSection({
|
|
12380
12373
|
handleSelectedFilter: setToggleCalendar,
|
|
12381
12374
|
}).filtersRef;
|
|
12382
|
-
return (
|
|
12383
|
-
React.createElement("div", { className: "will-calendar-header" },
|
|
12384
|
-
React.createElement("h2", null, t('filterBar:calendar.title')),
|
|
12385
|
-
React.createElement(CloseButton, { handleClose: function () { return setToggleCalendar(false); } })),
|
|
12386
|
-
React.createElement("div", { className: "will-calendar-main" },
|
|
12387
|
-
React.createElement(Calendar, { calendarRange: calendarRange, setCalendarRange: setCalendarRange, calendarOffset: calendarOffset, selectedPath: '/rooms', language: language, disableCalendarDates: disableCalendarDates, requestDates: requestDates, disabledDates: disabledDates, updateCalendarMonthNavigation: updateCalendarMonthNavigation, setUpdateCalendarMonthNavigation: setUpdateCalendarMonthNavigation, updateCalendarDefaultMonth: updateCalendarDefaultMonth, loadingData: loadingData, showFeedback: showFeedback, noActiveSelection: noActiveSelection, palette: palette, setCalendarHasError: setCalendarHasError, setUpdatedForSubmit: setUpdatedForSubmit, rangeContext: rangeContext, calendarHasError: calendarHasError })),
|
|
12388
|
-
React.createElement("div", { className: "will-calendar-footer" },
|
|
12389
|
-
React.createElement(Footer, { calendarHasError: calendarHasError, calendarRange: calendarRange, handleClearDates: handleClearDates, language: language, palette: palette }))))));
|
|
12375
|
+
return (jsxRuntime.jsx("div", { className: "will-root", style: themePalette, children: toggleCalendar && (jsxRuntime.jsxs("div", { className: "will-calendar-wrapper", ref: filtersRef, children: [jsxRuntime.jsxs("div", { className: "will-calendar-header", children: [jsxRuntime.jsx("h2", { children: t('filterBar:calendar.title') }), jsxRuntime.jsx(CloseButton, { handleClose: function () { return setToggleCalendar(false); } })] }), jsxRuntime.jsx("div", { className: "will-calendar-main", children: jsxRuntime.jsx(Calendar, { calendarRange: calendarRange, setCalendarRange: setCalendarRange, calendarOffset: calendarOffset, selectedPath: '/rooms', language: language, disableCalendarDates: disableCalendarDates, requestDates: requestDates, disabledDates: disabledDates, updateCalendarMonthNavigation: updateCalendarMonthNavigation, setUpdateCalendarMonthNavigation: setUpdateCalendarMonthNavigation, updateCalendarDefaultMonth: updateCalendarDefaultMonth, loadingData: loadingData, showFeedback: showFeedback, noActiveSelection: noActiveSelection, palette: palette, setCalendarHasError: setCalendarHasError, setUpdatedForSubmit: setUpdatedForSubmit, rangeContext: rangeContext, calendarHasError: calendarHasError }) }), jsxRuntime.jsx("div", { className: "will-calendar-footer", children: jsxRuntime.jsx(Footer, { calendarHasError: calendarHasError, calendarRange: calendarRange, handleClearDates: handleClearDates, language: language, palette: palette }) })] })) }));
|
|
12390
12376
|
}
|
|
12391
12377
|
|
|
12392
12378
|
exports.Button = Button$1;
|