willba-component-library 0.3.14 → 0.3.16

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.
Files changed (94) hide show
  1. package/README.md +12 -12
  2. package/lib/components/FilterBar/FilterBar.d.ts +2 -2
  3. package/lib/components/FilterBar/components/FilterControls/FilterControls.d.ts +3 -0
  4. package/lib/components/FilterBar/components/FilterPanels/Categories/Categories.d.ts +11 -0
  5. package/lib/components/FilterBar/components/FilterPanels/Dates/Dates.d.ts +16 -0
  6. package/lib/components/FilterBar/components/FilterPanels/FilterPanels.d.ts +3 -0
  7. package/lib/components/FilterBar/components/FilterPanels/Guests/GuestCount/GuestCount.d.ts +4 -0
  8. package/lib/components/FilterBar/components/FilterPanels/Guests/Guests.d.ts +12 -0
  9. package/lib/components/FilterBar/components/FilterPanels/Locations/Locations.d.ts +14 -0
  10. package/lib/components/FilterBar/components/FilterPanels/SectionHeader/SectionHeader.d.ts +8 -0
  11. package/lib/components/FilterBar/components/FilterTabs/FilterTabs.d.ts +3 -0
  12. package/lib/components/FilterBar/components/ImageCard/ImageCard.d.ts +11 -0
  13. package/lib/components/FilterBar/components/SelectButton/SelectButton.d.ts +13 -0
  14. package/lib/components/FilterBar/components/TabButton/TabButton.d.ts +10 -0
  15. package/lib/components/FilterBar/components/index.d.ts +6 -5
  16. package/lib/components/FilterBar/hooks/index.d.ts +4 -1
  17. package/lib/components/FilterBar/hooks/useFilterActions.d.ts +25 -0
  18. package/lib/components/FilterBar/hooks/useFilterState.d.ts +22 -0
  19. package/lib/components/FilterBar/hooks/useFilterUi.d.ts +7 -0
  20. package/lib/components/FilterBar/hooks/usePanelPosition.d.ts +12 -0
  21. package/lib/components/FilterBar/index.d.ts +1 -1
  22. package/lib/components/FilterBar/providers/FilterBarProvider.d.ts +31 -0
  23. package/lib/components/FilterBar/providers/index.d.ts +1 -0
  24. package/lib/components/FilterBar/utils/ageCategoriesRules.d.ts +7 -0
  25. package/lib/components/FilterBar/utils/index.d.ts +1 -1
  26. package/lib/components/FilterBar/utils/parseGuests.d.ts +5 -1
  27. package/lib/components/FilterCalendar/FilterCalendar.d.ts +1 -1
  28. package/lib/core/components/buttons/CloseButton/CloseButton.d.ts +7 -0
  29. package/lib/core/components/buttons/SubmitButton/SubmitButton.d.ts +14 -0
  30. package/lib/core/components/index.d.ts +4 -2
  31. package/lib/index.d.ts +1 -1
  32. package/lib/index.esm.js +1142 -1117
  33. package/lib/index.esm.js.map +1 -1
  34. package/lib/index.js +1141 -1116
  35. package/lib/index.js.map +1 -1
  36. package/lib/index.umd.js +1141 -1116
  37. package/lib/index.umd.js.map +1 -1
  38. package/lib/themes/useTheme.d.ts +1 -1
  39. package/package.json +1 -1
  40. package/src/components/FilterBar/FilterBar.css +4 -70
  41. package/src/components/FilterBar/FilterBar.stories.tsx +1 -1
  42. package/src/components/FilterBar/FilterBar.tsx +28 -283
  43. package/src/components/FilterBar/components/FilterControls/FilterControls.css +18 -0
  44. package/src/components/FilterBar/components/FilterControls/FilterControls.tsx +135 -0
  45. package/src/components/FilterBar/components/{categories → FilterPanels/Categories}/Categories.css +1 -1
  46. package/src/components/FilterBar/components/{categories → FilterPanels/Categories}/Categories.tsx +3 -1
  47. package/src/components/FilterBar/components/{dates → FilterPanels/Dates}/Dates.css +1 -1
  48. package/src/components/FilterBar/components/{dates → FilterPanels/Dates}/Dates.tsx +11 -11
  49. package/src/components/FilterBar/components/FilterPanels/FilterPanels.css +24 -0
  50. package/src/components/FilterBar/components/FilterPanels/FilterPanels.tsx +115 -0
  51. package/src/components/FilterBar/components/{guests → FilterPanels/Guests}/GuestCount/GuestCount.tsx +1 -1
  52. package/src/components/FilterBar/components/{guests → FilterPanels/Guests}/Guests.css +9 -4
  53. package/src/components/FilterBar/components/{guests → FilterPanels/Guests}/Guests.tsx +7 -7
  54. package/src/components/FilterBar/components/{locations → FilterPanels/Locations}/Locations.css +2 -3
  55. package/src/components/FilterBar/components/{locations → FilterPanels/Locations}/Locations.tsx +7 -6
  56. package/src/components/FilterBar/components/{common/FilterSectionHeader.tsx → FilterPanels/SectionHeader/SectionHeader.tsx} +2 -2
  57. package/src/components/FilterBar/components/FilterTabs/FilterTabs.css +10 -0
  58. package/src/components/FilterBar/components/FilterTabs/FilterTabs.tsx +47 -0
  59. package/src/components/FilterBar/components/{buttons/select-button → SelectButton}/SelectButton.css +1 -0
  60. package/src/components/FilterBar/components/{buttons/select-button → SelectButton}/SelectButton.tsx +7 -6
  61. package/src/components/FilterBar/components/index.ts +6 -6
  62. package/src/components/FilterBar/hooks/index.ts +4 -1
  63. package/src/components/FilterBar/hooks/useFilterActions.tsx +126 -0
  64. package/src/components/FilterBar/hooks/useFilterState.tsx +86 -0
  65. package/src/components/FilterBar/hooks/useFilterUi.tsx +19 -0
  66. package/src/components/FilterBar/hooks/usePanelPosition.tsx +53 -0
  67. package/src/components/FilterBar/index.ts +1 -1
  68. package/src/components/FilterBar/providers/FilterBarProvider.tsx +169 -0
  69. package/src/components/FilterBar/providers/index.ts +1 -0
  70. package/src/components/FilterBar/utils/ageCategoriesRules.ts +27 -0
  71. package/src/components/FilterBar/utils/index.tsx +1 -1
  72. package/src/components/FilterBar/utils/parseGuests.tsx +20 -9
  73. package/src/components/FilterBar/utils/{parseLocations.tsx → parseLocations.ts} +3 -4
  74. package/src/components/FilterCalendar/FilterCalendar.tsx +2 -2
  75. package/src/core/components/index.ts +5 -2
  76. package/src/index.ts +1 -1
  77. package/src/themes/useTheme.tsx +1 -1
  78. package/src/components/FilterBar/components/buttons/index.ts +0 -5
  79. package/src/components/FilterBar/components/cards/index.ts +0 -1
  80. package/src/components/FilterBar/components/dates/index.ts +0 -1
  81. package/src/components/FilterBar/hooks/useFilterBar.tsx +0 -208
  82. package/src/components/FilterBar/utils/calculateDropdownPosition.tsx +0 -96
  83. /package/src/components/FilterBar/components/{divider → Divider}/Divider.css +0 -0
  84. /package/src/components/FilterBar/components/{divider → Divider}/Divider.tsx +0 -0
  85. /package/src/components/FilterBar/components/{guests → FilterPanels/Guests}/GuestCount/GuestCount.css +0 -0
  86. /package/src/components/FilterBar/components/{common/FilterSectionHeader.css → FilterPanels/SectionHeader/SectionHeader.css} +0 -0
  87. /package/src/components/FilterBar/components/{cards/image-card → ImageCard}/ImageCard.css +0 -0
  88. /package/src/components/FilterBar/components/{cards/image-card → ImageCard}/ImageCard.tsx +0 -0
  89. /package/src/components/FilterBar/components/{buttons/tab-button → TabButton}/TabButton.css +0 -0
  90. /package/src/components/FilterBar/components/{buttons/tab-button → TabButton}/TabButton.tsx +0 -0
  91. /package/src/core/components/buttons/{close-button → CloseButton}/CloseButton.css +0 -0
  92. /package/src/core/components/buttons/{close-button → CloseButton}/CloseButton.tsx +0 -0
  93. /package/src/core/components/buttons/{submit-button → SubmitButton}/SubmitButton.css +0 -0
  94. /package/src/core/components/buttons/{submit-button → SubmitButton}/SubmitButton.tsx +0 -0
package/lib/index.umd.js CHANGED
@@ -213,8 +213,8 @@
213
213
  }
214
214
  }
215
215
 
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);
216
+ var css_248z$k = ".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$k);
218
218
 
219
219
  /**
220
220
  * Primary UI component for user interaction
@@ -225,440 +225,100 @@
225
225
  return (React.createElement("button", { type: "button", className: classNames('storybook-button', "storybook-button--".concat(size), "storybook-button--".concat(type)), style: textColor ? { color: textColor } : {}, onClick: onClick }, "".concat(label, " ").concat(theState)));
226
226
  };
227
227
 
228
- function warn() {
229
- if (console && console.warn) {
230
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
231
- args[_key] = arguments[_key];
232
- }
233
- if (typeof args[0] === 'string') args[0] = `react-i18next:: ${args[0]}`;
234
- console.warn(...args);
235
- }
236
- }
237
- const alreadyWarned = {};
238
- function warnOnce() {
239
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
240
- args[_key2] = arguments[_key2];
241
- }
242
- if (typeof args[0] === 'string' && alreadyWarned[args[0]]) return;
243
- if (typeof args[0] === 'string') alreadyWarned[args[0]] = new Date();
244
- warn(...args);
245
- }
246
- const loadedClb = (i18n, cb) => () => {
247
- if (i18n.isInitialized) {
248
- cb();
249
- } else {
250
- const initialized = () => {
251
- setTimeout(() => {
252
- i18n.off('initialized', initialized);
253
- }, 0);
254
- cb();
228
+ var useTheme = function (_a) {
229
+ var palette = _a.palette;
230
+ var themePalette = {
231
+ '--will-primary': palette === null || palette === void 0 ? void 0 : palette.primary,
232
+ '--will-secondary': palette === null || palette === void 0 ? void 0 : palette.secondary,
233
+ '--will-error': palette === null || palette === void 0 ? void 0 : palette.error,
255
234
  };
256
- i18n.on('initialized', initialized);
257
- }
235
+ return themePalette;
258
236
  };
259
- function loadNamespaces(i18n, ns, cb) {
260
- i18n.loadNamespaces(ns, loadedClb(i18n, cb));
261
- }
262
- function loadLanguages(i18n, lng, ns, cb) {
263
- if (typeof ns === 'string') ns = [ns];
264
- ns.forEach(n => {
265
- if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
266
- });
267
- i18n.loadLanguages(lng, loadedClb(i18n, cb));
268
- }
269
- function oldI18nextHasLoadedNamespace(ns, i18n) {
270
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
271
- const lng = i18n.languages[0];
272
- const fallbackLng = i18n.options ? i18n.options.fallbackLng : false;
273
- const lastLng = i18n.languages[i18n.languages.length - 1];
274
- if (lng.toLowerCase() === 'cimode') return true;
275
- const loadNotPending = (l, n) => {
276
- const loadState = i18n.services.backendConnector.state[`${l}|${n}`];
277
- return loadState === -1 || loadState === 2;
278
- };
279
- if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18n.services.backendConnector.backend && i18n.isLanguageChangingTo && !loadNotPending(i18n.isLanguageChangingTo, ns)) return false;
280
- if (i18n.hasResourceBundle(lng, ns)) return true;
281
- if (!i18n.services.backendConnector.backend || i18n.options.resources && !i18n.options.partialBundledLanguages) return true;
282
- if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
283
- return false;
284
- }
285
- function hasLoadedNamespace(ns, i18n) {
286
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
287
- if (!i18n.languages || !i18n.languages.length) {
288
- warnOnce('i18n.languages were undefined or empty', i18n.languages);
289
- return true;
290
- }
291
- const isNewerI18next = i18n.options.ignoreJSONStructure !== undefined;
292
- if (!isNewerI18next) {
293
- return oldI18nextHasLoadedNamespace(ns, i18n, options);
294
- }
295
- return i18n.hasLoadedNamespace(ns, {
296
- lng: options.lng,
297
- precheck: (i18nInstance, loadNotPending) => {
298
- if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
299
- }
300
- });
301
- }
302
237
 
303
- const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
304
- const htmlEntities = {
305
- '&amp;': '&',
306
- '&#38;': '&',
307
- '&lt;': '<',
308
- '&#60;': '<',
309
- '&gt;': '>',
310
- '&#62;': '>',
311
- '&apos;': "'",
312
- '&#39;': "'",
313
- '&quot;': '"',
314
- '&#34;': '"',
315
- '&nbsp;': ' ',
316
- '&#160;': ' ',
317
- '&copy;': '©',
318
- '&#169;': '©',
319
- '&reg;': '®',
320
- '&#174;': '®',
321
- '&hellip;': '…',
322
- '&#8230;': '…',
323
- '&#x2F;': '/',
324
- '&#47;': '/'
238
+ var useAwaitRender = function () {
239
+ var _a = __read(React.useState(false), 2), initialRenderComplete = _a[0], setInitialRenderComplete = _a[1];
240
+ React.useEffect(function () {
241
+ setInitialRenderComplete(true);
242
+ }, []);
243
+ if (!initialRenderComplete)
244
+ return null;
325
245
  };
326
- const unescapeHtmlEntity = m => htmlEntities[m];
327
- const unescape = text => text.replace(matchHtmlEntity, unescapeHtmlEntity);
328
246
 
329
- let defaultOptions$1 = {
330
- bindI18n: 'languageChanged',
331
- bindI18nStore: '',
332
- transEmptyNodeValue: '',
333
- transSupportBasicHtmlNodes: true,
334
- transWrapTextNodes: '',
335
- transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'],
336
- useSuspense: true,
337
- unescape
247
+ const isString = obj => typeof obj === 'string';
248
+ const defer = () => {
249
+ let res;
250
+ let rej;
251
+ const promise = new Promise((resolve, reject) => {
252
+ res = resolve;
253
+ rej = reject;
254
+ });
255
+ promise.resolve = res;
256
+ promise.reject = rej;
257
+ return promise;
338
258
  };
339
- function setDefaults() {
340
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
341
- defaultOptions$1 = {
342
- ...defaultOptions$1,
343
- ...options
344
- };
345
- }
346
- function getDefaults() {
347
- return defaultOptions$1;
348
- }
349
-
350
- let i18nInstance;
351
- function setI18n(instance) {
352
- i18nInstance = instance;
353
- }
354
- function getI18n() {
355
- return i18nInstance;
356
- }
357
-
358
- const initReactI18next = {
359
- type: '3rdParty',
360
- init(instance) {
361
- setDefaults(instance.options.react);
362
- setI18n(instance);
363
- }
259
+ const makeString = object => {
260
+ if (object == null) return '';
261
+ return '' + object;
364
262
  };
365
-
366
- const I18nContext = React.createContext();
367
- class ReportNamespaces {
368
- constructor() {
369
- this.usedNamespaces = {};
263
+ const copy = (a, s, t) => {
264
+ a.forEach(m => {
265
+ if (s[m]) t[m] = s[m];
266
+ });
267
+ };
268
+ const lastOfPathSeparatorRegExp = /###/g;
269
+ const cleanKey = key => key && key.indexOf('###') > -1 ? key.replace(lastOfPathSeparatorRegExp, '.') : key;
270
+ const canNotTraverseDeeper = object => !object || isString(object);
271
+ const getLastOfPath = (object, path, Empty) => {
272
+ const stack = !isString(path) ? path : path.split('.');
273
+ let stackIndex = 0;
274
+ while (stackIndex < stack.length - 1) {
275
+ if (canNotTraverseDeeper(object)) return {};
276
+ const key = cleanKey(stack[stackIndex]);
277
+ if (!object[key] && Empty) object[key] = new Empty();
278
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
279
+ object = object[key];
280
+ } else {
281
+ object = {};
282
+ }
283
+ ++stackIndex;
370
284
  }
371
- addUsedNamespaces(namespaces) {
372
- namespaces.forEach(ns => {
373
- if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
374
- });
285
+ if (canNotTraverseDeeper(object)) return {};
286
+ return {
287
+ obj: object,
288
+ k: cleanKey(stack[stackIndex])
289
+ };
290
+ };
291
+ const setPath = (object, path, newValue) => {
292
+ const {
293
+ obj,
294
+ k
295
+ } = getLastOfPath(object, path, Object);
296
+ if (obj !== undefined || path.length === 1) {
297
+ obj[k] = newValue;
298
+ return;
375
299
  }
376
- getUsedNamespaces() {
377
- return Object.keys(this.usedNamespaces);
300
+ let e = path[path.length - 1];
301
+ let p = path.slice(0, path.length - 1);
302
+ let last = getLastOfPath(object, p, Object);
303
+ while (last.obj === undefined && p.length) {
304
+ e = `${p[p.length - 1]}.${e}`;
305
+ p = p.slice(0, p.length - 1);
306
+ last = getLastOfPath(object, p, Object);
307
+ if (last?.obj && typeof last.obj[`${last.k}.${e}`] !== 'undefined') {
308
+ last.obj = undefined;
309
+ }
378
310
  }
379
- }
380
-
381
- const usePrevious = (value, ignore) => {
382
- const ref = React.useRef();
383
- React.useEffect(() => {
384
- ref.current = ignore ? ref.current : value;
385
- }, [value, ignore]);
386
- return ref.current;
311
+ last.obj[`${last.k}.${e}`] = newValue;
387
312
  };
388
- function useTranslation(ns) {
389
- let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
313
+ const pushPath = (object, path, newValue, concat) => {
390
314
  const {
391
- i18n: i18nFromProps
392
- } = props;
393
- const {
394
- i18n: i18nFromContext,
395
- defaultNS: defaultNSFromContext
396
- } = React.useContext(I18nContext) || {};
397
- const i18n = i18nFromProps || i18nFromContext || getI18n();
398
- if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
399
- if (!i18n) {
400
- warnOnce('You will need to pass in an i18next instance by using initReactI18next');
401
- const notReadyT = (k, optsOrDefaultValue) => {
402
- if (typeof optsOrDefaultValue === 'string') return optsOrDefaultValue;
403
- if (optsOrDefaultValue && typeof optsOrDefaultValue === 'object' && typeof optsOrDefaultValue.defaultValue === 'string') return optsOrDefaultValue.defaultValue;
404
- return Array.isArray(k) ? k[k.length - 1] : k;
405
- };
406
- const retNotReady = [notReadyT, {}, false];
407
- retNotReady.t = notReadyT;
408
- retNotReady.i18n = {};
409
- retNotReady.ready = false;
410
- return retNotReady;
411
- }
412
- if (i18n.options.react && i18n.options.react.wait !== undefined) warnOnce('It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.');
413
- const i18nOptions = {
414
- ...getDefaults(),
415
- ...i18n.options.react,
416
- ...props
417
- };
418
- const {
419
- useSuspense,
420
- keyPrefix
421
- } = i18nOptions;
422
- let namespaces = ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
423
- namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation'];
424
- if (i18n.reportNamespaces.addUsedNamespaces) i18n.reportNamespaces.addUsedNamespaces(namespaces);
425
- const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(n => hasLoadedNamespace(n, i18n, i18nOptions));
426
- function getT() {
427
- return i18n.getFixedT(props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
428
- }
429
- const [t, setT] = React.useState(getT);
430
- let joinedNS = namespaces.join();
431
- if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
432
- const previousJoinedNS = usePrevious(joinedNS);
433
- const isMounted = React.useRef(true);
434
- React.useEffect(() => {
435
- const {
436
- bindI18n,
437
- bindI18nStore
438
- } = i18nOptions;
439
- isMounted.current = true;
440
- if (!ready && !useSuspense) {
441
- if (props.lng) {
442
- loadLanguages(i18n, props.lng, namespaces, () => {
443
- if (isMounted.current) setT(getT);
444
- });
445
- } else {
446
- loadNamespaces(i18n, namespaces, () => {
447
- if (isMounted.current) setT(getT);
448
- });
449
- }
450
- }
451
- if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
452
- setT(getT);
453
- }
454
- function boundReset() {
455
- if (isMounted.current) setT(getT);
456
- }
457
- if (bindI18n && i18n) i18n.on(bindI18n, boundReset);
458
- if (bindI18nStore && i18n) i18n.store.on(bindI18nStore, boundReset);
459
- return () => {
460
- isMounted.current = false;
461
- if (bindI18n && i18n) bindI18n.split(' ').forEach(e => i18n.off(e, boundReset));
462
- if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(e => i18n.store.off(e, boundReset));
463
- };
464
- }, [i18n, joinedNS]);
465
- const isInitial = React.useRef(true);
466
- React.useEffect(() => {
467
- if (isMounted.current && !isInitial.current) {
468
- setT(getT);
469
- }
470
- isInitial.current = false;
471
- }, [i18n, keyPrefix]);
472
- const ret = [t, i18n, ready];
473
- ret.t = t;
474
- ret.i18n = i18n;
475
- ret.ready = ready;
476
- if (ready) return ret;
477
- if (!ready && !useSuspense) return ret;
478
- throw new Promise(resolve => {
479
- if (props.lng) {
480
- loadLanguages(i18n, props.lng, namespaces, () => resolve());
481
- } else {
482
- loadNamespaces(i18n, namespaces, () => resolve());
483
- }
484
- });
485
- }
486
-
487
- var DefaultContext = {
488
- color: undefined,
489
- size: undefined,
490
- className: undefined,
491
- style: undefined,
492
- attr: undefined
493
- };
494
- var IconContext = React.createContext && React.createContext(DefaultContext);
495
-
496
- var __assign$1 = undefined && undefined.__assign || function () {
497
- __assign$1 = Object.assign || function (t) {
498
- for (var s, i = 1, n = arguments.length; i < n; i++) {
499
- s = arguments[i];
500
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
501
- }
502
- return t;
503
- };
504
- return __assign$1.apply(this, arguments);
505
- };
506
- var __rest$1 = undefined && undefined.__rest || function (s, e) {
507
- var t = {};
508
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
509
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
510
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
511
- }
512
- return t;
513
- };
514
- function Tree2Element(tree) {
515
- return tree && tree.map(function (node, i) {
516
- return React.createElement(node.tag, __assign$1({
517
- key: i
518
- }, node.attr), Tree2Element(node.child));
519
- });
520
- }
521
- function GenIcon(data) {
522
- // eslint-disable-next-line react/display-name
523
- return function (props) {
524
- return React.createElement(IconBase, __assign$1({
525
- attr: __assign$1({}, data.attr)
526
- }, props), Tree2Element(data.child));
527
- };
528
- }
529
- function IconBase(props) {
530
- var elem = function (conf) {
531
- var attr = props.attr,
532
- size = props.size,
533
- title = props.title,
534
- svgProps = __rest$1(props, ["attr", "size", "title"]);
535
- var computedSize = size || conf.size || "1em";
536
- var className;
537
- if (conf.className) className = conf.className;
538
- if (props.className) className = (className ? className + " " : "") + props.className;
539
- return React.createElement("svg", __assign$1({
540
- stroke: "currentColor",
541
- fill: "currentColor",
542
- strokeWidth: "0"
543
- }, conf.attr, attr, svgProps, {
544
- className: className,
545
- style: __assign$1(__assign$1({
546
- color: props.color || conf.color
547
- }, conf.style), props.style),
548
- height: computedSize,
549
- width: computedSize,
550
- xmlns: "http://www.w3.org/2000/svg"
551
- }), title && React.createElement("title", null, title), props.children);
552
- };
553
- return IconContext !== undefined ? React.createElement(IconContext.Consumer, null, function (conf) {
554
- return elem(conf);
555
- }) : elem(DefaultContext);
556
- }
557
-
558
- // THIS FILE IS AUTO GENERATED
559
- function FaSearch (props) {
560
- return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 512 512"},"child":[{"tag":"path","attr":{"d":"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"}}]})(props);
561
- }function FaSpinner (props) {
562
- return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 512 512"},"child":[{"tag":"path","attr":{"d":"M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"}}]})(props);
563
- }
564
-
565
- function useTheme(_a) {
566
- var palette = _a.palette;
567
- var themePalette = {
568
- '--will-primary': palette === null || palette === void 0 ? void 0 : palette.primary,
569
- '--will-secondary': palette === null || palette === void 0 ? void 0 : palette.secondary,
570
- '--will-error': palette === null || palette === void 0 ? void 0 : palette.error,
571
- };
572
- return themePalette;
573
- }
574
-
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
-
578
- var useAwaitRender = function () {
579
- var _a = __read(React.useState(false), 2), initialRenderComplete = _a[0], setInitialRenderComplete = _a[1];
580
- React.useEffect(function () {
581
- setInitialRenderComplete(true);
582
- }, []);
583
- if (!initialRenderComplete)
584
- return null;
585
- };
586
-
587
- const isString = obj => typeof obj === 'string';
588
- const defer = () => {
589
- let res;
590
- let rej;
591
- const promise = new Promise((resolve, reject) => {
592
- res = resolve;
593
- rej = reject;
594
- });
595
- promise.resolve = res;
596
- promise.reject = rej;
597
- return promise;
598
- };
599
- const makeString = object => {
600
- if (object == null) return '';
601
- return '' + object;
602
- };
603
- const copy = (a, s, t) => {
604
- a.forEach(m => {
605
- if (s[m]) t[m] = s[m];
606
- });
607
- };
608
- const lastOfPathSeparatorRegExp = /###/g;
609
- const cleanKey = key => key && key.indexOf('###') > -1 ? key.replace(lastOfPathSeparatorRegExp, '.') : key;
610
- const canNotTraverseDeeper = object => !object || isString(object);
611
- const getLastOfPath = (object, path, Empty) => {
612
- const stack = !isString(path) ? path : path.split('.');
613
- let stackIndex = 0;
614
- while (stackIndex < stack.length - 1) {
615
- if (canNotTraverseDeeper(object)) return {};
616
- const key = cleanKey(stack[stackIndex]);
617
- if (!object[key] && Empty) object[key] = new Empty();
618
- if (Object.prototype.hasOwnProperty.call(object, key)) {
619
- object = object[key];
620
- } else {
621
- object = {};
622
- }
623
- ++stackIndex;
624
- }
625
- if (canNotTraverseDeeper(object)) return {};
626
- return {
627
- obj: object,
628
- k: cleanKey(stack[stackIndex])
629
- };
630
- };
631
- const setPath = (object, path, newValue) => {
632
- const {
633
- obj,
634
- k
635
- } = getLastOfPath(object, path, Object);
636
- if (obj !== undefined || path.length === 1) {
637
- obj[k] = newValue;
638
- return;
639
- }
640
- let e = path[path.length - 1];
641
- let p = path.slice(0, path.length - 1);
642
- let last = getLastOfPath(object, p, Object);
643
- while (last.obj === undefined && p.length) {
644
- e = `${p[p.length - 1]}.${e}`;
645
- p = p.slice(0, p.length - 1);
646
- last = getLastOfPath(object, p, Object);
647
- if (last?.obj && typeof last.obj[`${last.k}.${e}`] !== 'undefined') {
648
- last.obj = undefined;
649
- }
650
- }
651
- last.obj[`${last.k}.${e}`] = newValue;
652
- };
653
- const pushPath = (object, path, newValue, concat) => {
654
- const {
655
- obj,
656
- k
657
- } = getLastOfPath(object, path, Object);
658
- obj[k] = obj[k] || [];
659
- obj[k].push(newValue);
660
- };
661
- const getPath = (object, path) => {
315
+ obj,
316
+ k
317
+ } = getLastOfPath(object, path, Object);
318
+ obj[k] = obj[k] || [];
319
+ obj[k].push(newValue);
320
+ };
321
+ const getPath = (object, path) => {
662
322
  const {
663
323
  obj,
664
324
  k
@@ -2723,96 +2383,355 @@
2723
2383
  instance.createInstance = I18n.createInstance;
2724
2384
  return instance;
2725
2385
  }
2726
- cloneInstance(options = {}, callback = noop) {
2727
- const forkResourceStore = options.forkResourceStore;
2728
- if (forkResourceStore) delete options.forkResourceStore;
2729
- const mergedOptions = {
2730
- ...this.options,
2731
- ...options,
2732
- ...{
2733
- isClone: true
2386
+ cloneInstance(options = {}, callback = noop) {
2387
+ const forkResourceStore = options.forkResourceStore;
2388
+ if (forkResourceStore) delete options.forkResourceStore;
2389
+ const mergedOptions = {
2390
+ ...this.options,
2391
+ ...options,
2392
+ ...{
2393
+ isClone: true
2394
+ }
2395
+ };
2396
+ const clone = new I18n(mergedOptions);
2397
+ if (options.debug !== undefined || options.prefix !== undefined) {
2398
+ clone.logger = clone.logger.clone(options);
2399
+ }
2400
+ const membersToCopy = ['store', 'services', 'language'];
2401
+ membersToCopy.forEach(m => {
2402
+ clone[m] = this[m];
2403
+ });
2404
+ clone.services = {
2405
+ ...this.services
2406
+ };
2407
+ clone.services.utils = {
2408
+ hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2409
+ };
2410
+ if (forkResourceStore) {
2411
+ const clonedData = Object.keys(this.store.data).reduce((prev, l) => {
2412
+ prev[l] = {
2413
+ ...this.store.data[l]
2414
+ };
2415
+ prev[l] = Object.keys(prev[l]).reduce((acc, n) => {
2416
+ acc[n] = {
2417
+ ...prev[l][n]
2418
+ };
2419
+ return acc;
2420
+ }, prev[l]);
2421
+ return prev;
2422
+ }, {});
2423
+ clone.store = new ResourceStore(clonedData, mergedOptions);
2424
+ clone.services.resourceStore = clone.store;
2425
+ }
2426
+ if (options.interpolation) {
2427
+ const defOpts = get();
2428
+ const mergedInterpolation = {
2429
+ ...defOpts.interpolation,
2430
+ ...this.options.interpolation,
2431
+ ...options.interpolation
2432
+ };
2433
+ const mergedForInterpolator = {
2434
+ ...mergedOptions,
2435
+ interpolation: mergedInterpolation
2436
+ };
2437
+ clone.services.interpolator = new Interpolator(mergedForInterpolator);
2438
+ }
2439
+ clone.translator = new Translator(clone.services, mergedOptions);
2440
+ clone.translator.on('*', (event, ...args) => {
2441
+ clone.emit(event, ...args);
2442
+ });
2443
+ clone.init(mergedOptions, callback);
2444
+ clone.translator.options = mergedOptions;
2445
+ clone.translator.backendConnector.services.utils = {
2446
+ hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2447
+ };
2448
+ return clone;
2449
+ }
2450
+ toJSON() {
2451
+ return {
2452
+ options: this.options,
2453
+ store: this.store,
2454
+ language: this.language,
2455
+ languages: this.languages,
2456
+ resolvedLanguage: this.resolvedLanguage
2457
+ };
2458
+ }
2459
+ }
2460
+ const instance = I18n.createInstance();
2461
+
2462
+ instance.createInstance;
2463
+ instance.dir;
2464
+ instance.init;
2465
+ instance.loadResources;
2466
+ instance.reloadResources;
2467
+ instance.use;
2468
+ instance.changeLanguage;
2469
+ instance.getFixedT;
2470
+ instance.t;
2471
+ instance.exists;
2472
+ instance.setDefaultNamespace;
2473
+ instance.hasLoadedNamespace;
2474
+ instance.loadNamespaces;
2475
+ instance.loadLanguages;
2476
+
2477
+ function warn() {
2478
+ if (console && console.warn) {
2479
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2480
+ args[_key] = arguments[_key];
2481
+ }
2482
+ if (typeof args[0] === 'string') args[0] = `react-i18next:: ${args[0]}`;
2483
+ console.warn(...args);
2484
+ }
2485
+ }
2486
+ const alreadyWarned = {};
2487
+ function warnOnce() {
2488
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2489
+ args[_key2] = arguments[_key2];
2490
+ }
2491
+ if (typeof args[0] === 'string' && alreadyWarned[args[0]]) return;
2492
+ if (typeof args[0] === 'string') alreadyWarned[args[0]] = new Date();
2493
+ warn(...args);
2494
+ }
2495
+ const loadedClb = (i18n, cb) => () => {
2496
+ if (i18n.isInitialized) {
2497
+ cb();
2498
+ } else {
2499
+ const initialized = () => {
2500
+ setTimeout(() => {
2501
+ i18n.off('initialized', initialized);
2502
+ }, 0);
2503
+ cb();
2504
+ };
2505
+ i18n.on('initialized', initialized);
2506
+ }
2507
+ };
2508
+ function loadNamespaces(i18n, ns, cb) {
2509
+ i18n.loadNamespaces(ns, loadedClb(i18n, cb));
2510
+ }
2511
+ function loadLanguages(i18n, lng, ns, cb) {
2512
+ if (typeof ns === 'string') ns = [ns];
2513
+ ns.forEach(n => {
2514
+ if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
2515
+ });
2516
+ i18n.loadLanguages(lng, loadedClb(i18n, cb));
2517
+ }
2518
+ function oldI18nextHasLoadedNamespace(ns, i18n) {
2519
+ let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2520
+ const lng = i18n.languages[0];
2521
+ const fallbackLng = i18n.options ? i18n.options.fallbackLng : false;
2522
+ const lastLng = i18n.languages[i18n.languages.length - 1];
2523
+ if (lng.toLowerCase() === 'cimode') return true;
2524
+ const loadNotPending = (l, n) => {
2525
+ const loadState = i18n.services.backendConnector.state[`${l}|${n}`];
2526
+ return loadState === -1 || loadState === 2;
2527
+ };
2528
+ if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18n.services.backendConnector.backend && i18n.isLanguageChangingTo && !loadNotPending(i18n.isLanguageChangingTo, ns)) return false;
2529
+ if (i18n.hasResourceBundle(lng, ns)) return true;
2530
+ if (!i18n.services.backendConnector.backend || i18n.options.resources && !i18n.options.partialBundledLanguages) return true;
2531
+ if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
2532
+ return false;
2533
+ }
2534
+ function hasLoadedNamespace(ns, i18n) {
2535
+ let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2536
+ if (!i18n.languages || !i18n.languages.length) {
2537
+ warnOnce('i18n.languages were undefined or empty', i18n.languages);
2538
+ return true;
2539
+ }
2540
+ const isNewerI18next = i18n.options.ignoreJSONStructure !== undefined;
2541
+ if (!isNewerI18next) {
2542
+ return oldI18nextHasLoadedNamespace(ns, i18n, options);
2543
+ }
2544
+ return i18n.hasLoadedNamespace(ns, {
2545
+ lng: options.lng,
2546
+ precheck: (i18nInstance, loadNotPending) => {
2547
+ if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
2548
+ }
2549
+ });
2550
+ }
2551
+
2552
+ const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
2553
+ const htmlEntities = {
2554
+ '&amp;': '&',
2555
+ '&#38;': '&',
2556
+ '&lt;': '<',
2557
+ '&#60;': '<',
2558
+ '&gt;': '>',
2559
+ '&#62;': '>',
2560
+ '&apos;': "'",
2561
+ '&#39;': "'",
2562
+ '&quot;': '"',
2563
+ '&#34;': '"',
2564
+ '&nbsp;': ' ',
2565
+ '&#160;': ' ',
2566
+ '&copy;': '©',
2567
+ '&#169;': '©',
2568
+ '&reg;': '®',
2569
+ '&#174;': '®',
2570
+ '&hellip;': '…',
2571
+ '&#8230;': '…',
2572
+ '&#x2F;': '/',
2573
+ '&#47;': '/'
2574
+ };
2575
+ const unescapeHtmlEntity = m => htmlEntities[m];
2576
+ const unescape = text => text.replace(matchHtmlEntity, unescapeHtmlEntity);
2577
+
2578
+ let defaultOptions$1 = {
2579
+ bindI18n: 'languageChanged',
2580
+ bindI18nStore: '',
2581
+ transEmptyNodeValue: '',
2582
+ transSupportBasicHtmlNodes: true,
2583
+ transWrapTextNodes: '',
2584
+ transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'],
2585
+ useSuspense: true,
2586
+ unescape
2587
+ };
2588
+ function setDefaults() {
2589
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2590
+ defaultOptions$1 = {
2591
+ ...defaultOptions$1,
2592
+ ...options
2593
+ };
2594
+ }
2595
+ function getDefaults() {
2596
+ return defaultOptions$1;
2597
+ }
2598
+
2599
+ let i18nInstance;
2600
+ function setI18n(instance) {
2601
+ i18nInstance = instance;
2602
+ }
2603
+ function getI18n() {
2604
+ return i18nInstance;
2605
+ }
2606
+
2607
+ const initReactI18next = {
2608
+ type: '3rdParty',
2609
+ init(instance) {
2610
+ setDefaults(instance.options.react);
2611
+ setI18n(instance);
2612
+ }
2613
+ };
2614
+
2615
+ const I18nContext = React.createContext();
2616
+ class ReportNamespaces {
2617
+ constructor() {
2618
+ this.usedNamespaces = {};
2619
+ }
2620
+ addUsedNamespaces(namespaces) {
2621
+ namespaces.forEach(ns => {
2622
+ if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
2623
+ });
2624
+ }
2625
+ getUsedNamespaces() {
2626
+ return Object.keys(this.usedNamespaces);
2627
+ }
2628
+ }
2629
+
2630
+ const usePrevious = (value, ignore) => {
2631
+ const ref = React.useRef();
2632
+ React.useEffect(() => {
2633
+ ref.current = ignore ? ref.current : value;
2634
+ }, [value, ignore]);
2635
+ return ref.current;
2636
+ };
2637
+ function useTranslation(ns) {
2638
+ let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2639
+ const {
2640
+ i18n: i18nFromProps
2641
+ } = props;
2642
+ const {
2643
+ i18n: i18nFromContext,
2644
+ defaultNS: defaultNSFromContext
2645
+ } = React.useContext(I18nContext) || {};
2646
+ const i18n = i18nFromProps || i18nFromContext || getI18n();
2647
+ if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
2648
+ if (!i18n) {
2649
+ warnOnce('You will need to pass in an i18next instance by using initReactI18next');
2650
+ const notReadyT = (k, optsOrDefaultValue) => {
2651
+ if (typeof optsOrDefaultValue === 'string') return optsOrDefaultValue;
2652
+ if (optsOrDefaultValue && typeof optsOrDefaultValue === 'object' && typeof optsOrDefaultValue.defaultValue === 'string') return optsOrDefaultValue.defaultValue;
2653
+ return Array.isArray(k) ? k[k.length - 1] : k;
2654
+ };
2655
+ const retNotReady = [notReadyT, {}, false];
2656
+ retNotReady.t = notReadyT;
2657
+ retNotReady.i18n = {};
2658
+ retNotReady.ready = false;
2659
+ return retNotReady;
2660
+ }
2661
+ if (i18n.options.react && i18n.options.react.wait !== undefined) warnOnce('It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.');
2662
+ const i18nOptions = {
2663
+ ...getDefaults(),
2664
+ ...i18n.options.react,
2665
+ ...props
2666
+ };
2667
+ const {
2668
+ useSuspense,
2669
+ keyPrefix
2670
+ } = i18nOptions;
2671
+ let namespaces = ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
2672
+ namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation'];
2673
+ if (i18n.reportNamespaces.addUsedNamespaces) i18n.reportNamespaces.addUsedNamespaces(namespaces);
2674
+ const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(n => hasLoadedNamespace(n, i18n, i18nOptions));
2675
+ function getT() {
2676
+ return i18n.getFixedT(props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
2677
+ }
2678
+ const [t, setT] = React.useState(getT);
2679
+ let joinedNS = namespaces.join();
2680
+ if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
2681
+ const previousJoinedNS = usePrevious(joinedNS);
2682
+ const isMounted = React.useRef(true);
2683
+ React.useEffect(() => {
2684
+ const {
2685
+ bindI18n,
2686
+ bindI18nStore
2687
+ } = i18nOptions;
2688
+ isMounted.current = true;
2689
+ if (!ready && !useSuspense) {
2690
+ if (props.lng) {
2691
+ loadLanguages(i18n, props.lng, namespaces, () => {
2692
+ if (isMounted.current) setT(getT);
2693
+ });
2694
+ } else {
2695
+ loadNamespaces(i18n, namespaces, () => {
2696
+ if (isMounted.current) setT(getT);
2697
+ });
2734
2698
  }
2735
- };
2736
- const clone = new I18n(mergedOptions);
2737
- if (options.debug !== undefined || options.prefix !== undefined) {
2738
- clone.logger = clone.logger.clone(options);
2739
2699
  }
2740
- const membersToCopy = ['store', 'services', 'language'];
2741
- membersToCopy.forEach(m => {
2742
- clone[m] = this[m];
2743
- });
2744
- clone.services = {
2745
- ...this.services
2746
- };
2747
- clone.services.utils = {
2748
- hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2749
- };
2750
- if (forkResourceStore) {
2751
- const clonedData = Object.keys(this.store.data).reduce((prev, l) => {
2752
- prev[l] = {
2753
- ...this.store.data[l]
2754
- };
2755
- prev[l] = Object.keys(prev[l]).reduce((acc, n) => {
2756
- acc[n] = {
2757
- ...prev[l][n]
2758
- };
2759
- return acc;
2760
- }, prev[l]);
2761
- return prev;
2762
- }, {});
2763
- clone.store = new ResourceStore(clonedData, mergedOptions);
2764
- clone.services.resourceStore = clone.store;
2700
+ if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
2701
+ setT(getT);
2765
2702
  }
2766
- if (options.interpolation) {
2767
- const defOpts = get();
2768
- const mergedInterpolation = {
2769
- ...defOpts.interpolation,
2770
- ...this.options.interpolation,
2771
- ...options.interpolation
2772
- };
2773
- const mergedForInterpolator = {
2774
- ...mergedOptions,
2775
- interpolation: mergedInterpolation
2776
- };
2777
- clone.services.interpolator = new Interpolator(mergedForInterpolator);
2703
+ function boundReset() {
2704
+ if (isMounted.current) setT(getT);
2778
2705
  }
2779
- clone.translator = new Translator(clone.services, mergedOptions);
2780
- clone.translator.on('*', (event, ...args) => {
2781
- clone.emit(event, ...args);
2782
- });
2783
- clone.init(mergedOptions, callback);
2784
- clone.translator.options = mergedOptions;
2785
- clone.translator.backendConnector.services.utils = {
2786
- hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2787
- };
2788
- return clone;
2789
- }
2790
- toJSON() {
2791
- return {
2792
- options: this.options,
2793
- store: this.store,
2794
- language: this.language,
2795
- languages: this.languages,
2796
- resolvedLanguage: this.resolvedLanguage
2706
+ if (bindI18n && i18n) i18n.on(bindI18n, boundReset);
2707
+ if (bindI18nStore && i18n) i18n.store.on(bindI18nStore, boundReset);
2708
+ return () => {
2709
+ isMounted.current = false;
2710
+ if (bindI18n && i18n) bindI18n.split(' ').forEach(e => i18n.off(e, boundReset));
2711
+ if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(e => i18n.store.off(e, boundReset));
2797
2712
  };
2798
- }
2713
+ }, [i18n, joinedNS]);
2714
+ const isInitial = React.useRef(true);
2715
+ React.useEffect(() => {
2716
+ if (isMounted.current && !isInitial.current) {
2717
+ setT(getT);
2718
+ }
2719
+ isInitial.current = false;
2720
+ }, [i18n, keyPrefix]);
2721
+ const ret = [t, i18n, ready];
2722
+ ret.t = t;
2723
+ ret.i18n = i18n;
2724
+ ret.ready = ready;
2725
+ if (ready) return ret;
2726
+ if (!ready && !useSuspense) return ret;
2727
+ throw new Promise(resolve => {
2728
+ if (props.lng) {
2729
+ loadLanguages(i18n, props.lng, namespaces, () => resolve());
2730
+ } else {
2731
+ loadNamespaces(i18n, namespaces, () => resolve());
2732
+ }
2733
+ });
2799
2734
  }
2800
- const instance = I18n.createInstance();
2801
-
2802
- instance.createInstance;
2803
- instance.dir;
2804
- instance.init;
2805
- instance.loadResources;
2806
- instance.reloadResources;
2807
- instance.use;
2808
- instance.changeLanguage;
2809
- instance.getFixedT;
2810
- instance.t;
2811
- instance.exists;
2812
- instance.setDefaultNamespace;
2813
- instance.hasLoadedNamespace;
2814
- instance.loadNamespaces;
2815
- instance.loadLanguages;
2816
2735
 
2817
2736
  var locations$1 = {
2818
2737
  label: "Location",
@@ -3020,28 +2939,134 @@
3020
2939
  return ref;
3021
2940
  };
3022
2941
 
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);
2942
+ var css_248z$j = ".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 user-select: none;\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";
2943
+ styleInject(css_248z$j);
3025
2944
 
3026
- var SubmitButton = function (_a) {
3027
- var onClick = _a.onClick, startIcon = _a.startIcon, label = _a.label, disabled = _a.disabled, isLoading = _a.isLoading, variant = _a.variant;
3028
- return (React.createElement("button", { className: "will-filter-bar-submit-button ".concat(variant || 'default'), onClick: onClick, disabled: disabled || isLoading },
3029
- isLoading ? (React.createElement("span", null, React.createElement(FaSpinner, { style: { animation: 'spin 1s linear infinite' } }))) : (startIcon && React.createElement("span", null, startIcon)),
3030
- label || 'Label'));
2945
+ var SelectButton = React.forwardRef(function (_a, ref) {
2946
+ var active = _a.active, label = _a.label, onClick = _a.onClick, description = _a.description, disabled = _a.disabled, ariaExpanded = _a.ariaExpanded, ariaControls = _a.ariaControls;
2947
+ return (React.createElement("button", { ref: ref, className: "will-filter-bar-select-button ".concat(disabled ? 'disabled' : ''), onClick: function (e) { return (disabled ? undefined : onClick(e)); }, disabled: disabled, "aria-expanded": ariaExpanded, "aria-controls": ariaControls, "aria-haspopup": "true", "aria-disabled": disabled },
2948
+ React.createElement("span", { className: "select-button-wrapper" },
2949
+ React.createElement("div", null,
2950
+ React.createElement("p", { className: "select-button-label" }, label),
2951
+ React.createElement("p", { className: "select-button-description ".concat(active ? 'active' : '') }, description)))));
2952
+ });
2953
+ SelectButton.displayName = 'SelectButton';
2954
+
2955
+ var css_248z$i = ".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";
2956
+ styleInject(css_248z$i);
2957
+
2958
+ var TabButton = function (_a) {
2959
+ var onClick = _a.onClick, label = _a.label, active = _a.active, mode = _a.mode;
2960
+ return (React.createElement("button", { className: "will-filter-bar-tab-button ".concat(mode || 'light', " ").concat(active && 'active', " "), onClick: onClick }, label));
3031
2961
  };
3032
2962
 
3033
- // THIS FILE IS AUTO GENERATED
3034
- function IoIosCloseCircleOutline (props) {
3035
- 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
- }
2963
+ var css_248z$h = ".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}";
2964
+ styleInject(css_248z$h);
3037
2965
 
3038
- 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";
3039
- styleInject(css_248z$e);
2966
+ var Divider = function () {
2967
+ return React.createElement("div", { className: "will-filter-bar-divider" });
2968
+ };
3040
2969
 
3041
- var CloseButton = function (_a) {
3042
- var handleClose = _a.handleClose;
3043
- return (React.createElement("button", { className: "will-filter-bar-close-button", onClick: handleClose },
3044
- React.createElement(IoIosCloseCircleOutline, null)));
2970
+ var FilterSections;
2971
+ (function (FilterSections) {
2972
+ FilterSections["CALENDAR"] = "calendar";
2973
+ FilterSections["GUESTS"] = "guests";
2974
+ FilterSections["CATEGORIES"] = "categories";
2975
+ FilterSections["LOCATIONS"] = "locations";
2976
+ })(FilterSections || (FilterSections = {}));
2977
+ var Pages;
2978
+ (function (Pages) {
2979
+ Pages["ROOMS"] = "/rooms";
2980
+ Pages["EVENTS"] = "/events";
2981
+ Pages["SALES"] = "/sales";
2982
+ })(Pages || (Pages = {}));
2983
+
2984
+ var useScrollInToView = function (_a) {
2985
+ var selectedFilter = _a.selectedFilter;
2986
+ var _b = __read(React.useState(true), 2), isMobile = _b[0], setIsMobile = _b[1];
2987
+ var targetFilterBarRef = React.useRef(null);
2988
+ React.useEffect(function () {
2989
+ if (typeof window !== 'undefined' && window.innerWidth > 960) {
2990
+ setIsMobile(false);
2991
+ return;
2992
+ }
2993
+ if (targetFilterBarRef.current && selectedFilter) {
2994
+ window.scrollTo({
2995
+ behavior: 'smooth',
2996
+ top: targetFilterBarRef.current.getBoundingClientRect().top -
2997
+ document.body.getBoundingClientRect().top -
2998
+ 30,
2999
+ });
3000
+ }
3001
+ }, [selectedFilter]);
3002
+ return { isMobile: isMobile, targetFilterBarRef: targetFilterBarRef };
3003
+ };
3004
+
3005
+ var useFilterState = function (_a) {
3006
+ var locations = _a.locations;
3007
+ var _b = __read(React.useState(Pages.EVENTS), 2), selectedPath = _b[0], setSelectedPath = _b[1];
3008
+ var _c = __read(React.useState(false), 2), selectedFilter = _c[0], setSelectedFilter = _c[1];
3009
+ var _d = __read(React.useState(), 2), calendarRange = _d[0], setCalendarRange = _d[1];
3010
+ var _e = __read(React.useState(false), 2), innerLoading = _e[0], setInnerLoading = _e[1];
3011
+ var _f = __read(React.useState(0), 2), categories = _f[0], setCategories = _f[1];
3012
+ var _g = __read(React.useState({}), 2), ageCategoryCounts = _g[0], setAgeCategoryCounts = _g[1];
3013
+ var _h = __read(React.useState([]), 2), selectedLocations = _h[0], setSelectedLocations = _h[1];
3014
+ React.useEffect(function () {
3015
+ var _a;
3016
+ if (typeof window === 'undefined')
3017
+ return;
3018
+ var urlSearchParams = new URLSearchParams(window.location.search);
3019
+ var startDateParam = urlSearchParams.get('startDate');
3020
+ var endDateParam = urlSearchParams.get('endDate');
3021
+ var locationIdParams = urlSearchParams.getAll('locationId');
3022
+ var ageCategoryCountsParam = {};
3023
+ var ageCategoryCountsQuery = urlSearchParams.get('ageCategoryCounts');
3024
+ if (ageCategoryCountsQuery) {
3025
+ try {
3026
+ ageCategoryCountsParam = JSON.parse(ageCategoryCountsQuery);
3027
+ }
3028
+ catch (error) {
3029
+ console.warn('Invalid ageCategoryCounts query param, ignoring', error);
3030
+ ageCategoryCountsParam = {};
3031
+ }
3032
+ }
3033
+ var categoriesParam = urlSearchParams.get('categories');
3034
+ var parsedCategories = 0;
3035
+ if (categoriesParam) {
3036
+ var parsed = parseInt(categoriesParam, 10);
3037
+ parsedCategories = Number.isNaN(parsed) ? 0 : parsed;
3038
+ }
3039
+ if (startDateParam && endDateParam) {
3040
+ setCalendarRange({
3041
+ from: new Date(startDateParam),
3042
+ to: new Date(endDateParam),
3043
+ });
3044
+ }
3045
+ setAgeCategoryCounts(ageCategoryCountsParam);
3046
+ setCategories(parsedCategories);
3047
+ if (((_a = locations === null || locations === void 0 ? void 0 : locations.data) === null || _a === void 0 ? void 0 : _a.length) && locationIdParams.length) {
3048
+ var matchedLocations = locations.data.filter(function (location) {
3049
+ return locationIdParams.includes(location.id.toString());
3050
+ });
3051
+ setSelectedLocations(matchedLocations);
3052
+ }
3053
+ }, [locations]);
3054
+ return {
3055
+ selectedPath: selectedPath,
3056
+ selectedFilter: selectedFilter,
3057
+ calendarRange: calendarRange,
3058
+ innerLoading: innerLoading,
3059
+ categories: categories,
3060
+ ageCategoryCounts: ageCategoryCounts,
3061
+ selectedLocations: selectedLocations,
3062
+ setSelectedLocations: setSelectedLocations,
3063
+ setCalendarRange: setCalendarRange,
3064
+ setAgeCategoryCounts: setAgeCategoryCounts,
3065
+ setCategories: setCategories,
3066
+ setSelectedPath: setSelectedPath,
3067
+ setSelectedFilter: setSelectedFilter,
3068
+ setInnerLoading: setInnerLoading,
3069
+ };
3045
3070
  };
3046
3071
 
3047
3072
  function _typeof(o) {
@@ -6625,37 +6650,379 @@
6625
6650
  return date;
6626
6651
  }
6627
6652
 
6628
- /**
6629
- * @name setYear
6630
- * @category Year Helpers
6631
- * @summary Set the year to the given date.
6632
- *
6633
- * @description
6634
- * Set the year to the given date.
6635
- *
6636
- * @param {Date|Number} date - the date to be changed
6637
- * @param {Number} year - the year of the new date
6638
- * @returns {Date} the new date with the year set
6639
- * @throws {TypeError} 2 arguments required
6640
- *
6641
- * @example
6642
- * // Set year 2013 to 1 September 2014:
6643
- * const result = setYear(new Date(2014, 8, 1), 2013)
6644
- * //=> Sun Sep 01 2013 00:00:00
6645
- */
6646
- function setYear(dirtyDate, dirtyYear) {
6647
- requiredArgs(2, arguments);
6648
- var date = toDate(dirtyDate);
6649
- var year = toInteger(dirtyYear);
6653
+ /**
6654
+ * @name setYear
6655
+ * @category Year Helpers
6656
+ * @summary Set the year to the given date.
6657
+ *
6658
+ * @description
6659
+ * Set the year to the given date.
6660
+ *
6661
+ * @param {Date|Number} date - the date to be changed
6662
+ * @param {Number} year - the year of the new date
6663
+ * @returns {Date} the new date with the year set
6664
+ * @throws {TypeError} 2 arguments required
6665
+ *
6666
+ * @example
6667
+ * // Set year 2013 to 1 September 2014:
6668
+ * const result = setYear(new Date(2014, 8, 1), 2013)
6669
+ * //=> Sun Sep 01 2013 00:00:00
6670
+ */
6671
+ function setYear(dirtyDate, dirtyYear) {
6672
+ requiredArgs(2, arguments);
6673
+ var date = toDate(dirtyDate);
6674
+ var year = toInteger(dirtyYear);
6675
+
6676
+ // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
6677
+ if (isNaN(date.getTime())) {
6678
+ return new Date(NaN);
6679
+ }
6680
+ date.setFullYear(year);
6681
+ return date;
6682
+ }
6683
+
6684
+ var parseGuests = function (_a) {
6685
+ var guestLabel = _a.guestLabel, guestsLabel = _a.guestsLabel, guestsPlaceholder = _a.guestsPlaceholder, ageCategoryCounts = _a.ageCategoryCounts, ageCategories = _a.ageCategories;
6686
+ var parsedData = Object.entries(ageCategoryCounts).reduce(function (acc, _a) {
6687
+ var _b = __read(_a, 2), key = _b[0], value = _b[1];
6688
+ var parts = key.split('-');
6689
+ if (parts.length < 2)
6690
+ return acc;
6691
+ var ageCategoryId = parts[1];
6692
+ var ageCategory = ageCategories === null || ageCategories === void 0 ? void 0 : ageCategories.find(function (c) { return c.id === ageCategoryId; });
6693
+ if (ageCategory && value) {
6694
+ return {
6695
+ total: acc.total + value,
6696
+ html: __spreadArray$1(__spreadArray$1([], __read(acc.html), false), ["".concat(value)], false),
6697
+ };
6698
+ }
6699
+ return acc;
6700
+ }, { total: 0, html: [] });
6701
+ if (!parsedData.total) {
6702
+ return {
6703
+ content: guestsPlaceholder,
6704
+ data: parsedData,
6705
+ };
6706
+ }
6707
+ var breakdown = parsedData.html.length > 1 ? parsedData.html.join(' + ') : null;
6708
+ return {
6709
+ content: (React.createElement(React.Fragment, null,
6710
+ React.createElement("span", { className: "will-guest-count" }, parsedData.total),
6711
+ ' ',
6712
+ parsedData.total > 1 ? guestsLabel : guestLabel,
6713
+ breakdown && React.createElement(React.Fragment, null,
6714
+ " \u00A0 ( ",
6715
+ breakdown,
6716
+ " )"))),
6717
+ data: parsedData,
6718
+ };
6719
+ };
6720
+
6721
+ var parseLocations = function (_a) {
6722
+ var selectedLocations = _a.selectedLocations, locationsPlaceholder = _a.locationsPlaceholder, _b = _a.locationsSelectedLabel, locationsSelectedLabel = _b === void 0 ? 'locations' : _b;
6723
+ if (!selectedLocations.length) {
6724
+ return locationsPlaceholder;
6725
+ }
6726
+ if (selectedLocations.length === 1) {
6727
+ var singleSelection = selectedLocations[0].label;
6728
+ if (!singleSelection) {
6729
+ return locationsPlaceholder;
6730
+ }
6731
+ return singleSelection;
6732
+ }
6733
+ return "".concat(selectedLocations.length, " ").concat(locationsSelectedLabel);
6734
+ };
6735
+
6736
+ var ageCategoryRules = function (_a) {
6737
+ var ageCategoryCounts = _a.ageCategoryCounts, ageCategories = _a.ageCategories;
6738
+ if (ageCategories === null || ageCategories === void 0 ? void 0 : ageCategories.length) {
6739
+ ageCategories === null || ageCategories === void 0 ? void 0 : ageCategories.map(function (a) {
6740
+ if (a.minVal) {
6741
+ var ageCategory = ageCategoryCounts["guests-".concat(a.id)];
6742
+ if (!ageCategory) {
6743
+ ageCategoryCounts["guests-".concat(a.id)] = a.minVal;
6744
+ }
6745
+ }
6746
+ });
6747
+ }
6748
+ return Object.entries(ageCategoryCounts).length
6749
+ ? JSON.stringify(ageCategoryCounts)
6750
+ : '';
6751
+ };
6752
+
6753
+ var useFilterActions = function (_a) {
6754
+ var tabs = _a.tabs, calendarRange = _a.calendarRange, ageCategoryCounts = _a.ageCategoryCounts, ageCategories = _a.ageCategories, selectedLocations = _a.selectedLocations, selectedPath = _a.selectedPath, redirectUrl = _a.redirectUrl, setSelectedPath = _a.setSelectedPath, setAgeCategoryCounts = _a.setAgeCategoryCounts, setSelectedFilter = _a.setSelectedFilter, setCalendarRange = _a.setCalendarRange, onSubmit = _a.onSubmit, setInnerLoading = _a.setInnerLoading;
6755
+ React.useEffect(function () {
6756
+ if (typeof window === 'undefined')
6757
+ return;
6758
+ 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; });
6759
+ var paths = [Pages.EVENTS, Pages.ROOMS, Pages.SALES];
6760
+ var currentPath = paths.find(function (path) { return window.location.pathname.includes(path); }) ||
6761
+ (defaultTab === null || defaultTab === void 0 ? void 0 : defaultTab.path) ||
6762
+ Pages.EVENTS;
6763
+ setSelectedPath(currentPath);
6764
+ }, [tabs]);
6765
+ var updateGuestsCount = function (id, newCount) {
6766
+ setAgeCategoryCounts(function (prev) {
6767
+ var _a;
6768
+ return (__assign$2(__assign$2({}, prev), (_a = {}, _a[id] = newCount, _a)));
6769
+ });
6770
+ };
6771
+ var handleSelectedFilter = function (id) {
6772
+ setSelectedFilter(id);
6773
+ };
6774
+ var handleSubmit = function () {
6775
+ var e_1, _a;
6776
+ if (typeof window === 'undefined')
6777
+ return;
6778
+ var newParams = {
6779
+ startDate: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from)
6780
+ ? format(calendarRange.from, 'yyyy-MM-dd')
6781
+ : '',
6782
+ endDate: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) ? format(calendarRange.to, 'yyyy-MM-dd') : '',
6783
+ ageCategoryCounts: ageCategoryRules({
6784
+ ageCategoryCounts: ageCategoryCounts,
6785
+ ageCategories: ageCategories,
6786
+ }),
6787
+ selectedLocations: selectedLocations
6788
+ .map(function (l) { return l.id.toString(); })
6789
+ .join(','),
6790
+ };
6791
+ var querySearchParams = new URLSearchParams();
6792
+ try {
6793
+ for (var _b = __values(Object.entries(newParams)), _c = _b.next(); !_c.done; _c = _b.next()) {
6794
+ var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
6795
+ if (!value)
6796
+ continue;
6797
+ if (key === 'selectedLocations' && selectedLocations.length) {
6798
+ selectedLocations.forEach(function (location) {
6799
+ return querySearchParams.append('locationId', location.id.toString());
6800
+ });
6801
+ }
6802
+ else {
6803
+ querySearchParams.append(key, value.toString());
6804
+ }
6805
+ }
6806
+ }
6807
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
6808
+ finally {
6809
+ try {
6810
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
6811
+ }
6812
+ finally { if (e_1) throw e_1.error; }
6813
+ }
6814
+ setSelectedFilter(false);
6815
+ if (onSubmit && window.location.href.includes(selectedPath)) {
6816
+ onSubmit(newParams);
6817
+ return;
6818
+ }
6819
+ var paramString = querySearchParams.toString();
6820
+ var path = "".concat(redirectUrl).concat(selectedPath);
6821
+ setInnerLoading(true);
6822
+ window.location.href = paramString ? "".concat(path, "?").concat(paramString) : path;
6823
+ };
6824
+ var handleResetFilters = function () {
6825
+ setAgeCategoryCounts({});
6826
+ setCalendarRange(undefined);
6827
+ };
6828
+ return {
6829
+ updateGuestsCount: updateGuestsCount,
6830
+ handleSelectedFilter: handleSelectedFilter,
6831
+ handleSubmit: handleSubmit,
6832
+ handleResetFilters: handleResetFilters,
6833
+ };
6834
+ };
6835
+
6836
+ var useFilterUi = function (selectedFilter) {
6837
+ var buttonRefs = React.useRef({});
6838
+ var panelRef = React.useRef(null);
6839
+ var previouslyFocusedButtonRef = React.useRef(null);
6840
+ var _a = useScrollInToView({ selectedFilter: selectedFilter }), isMobile = _a.isMobile, targetFilterBarRef = _a.targetFilterBarRef;
6841
+ return {
6842
+ previouslyFocusedButtonRef: previouslyFocusedButtonRef,
6843
+ isMobile: isMobile,
6844
+ targetFilterBarRef: targetFilterBarRef,
6845
+ panelRef: panelRef,
6846
+ buttonRefs: buttonRefs,
6847
+ };
6848
+ };
6849
+
6850
+ var usePanelPosition = function (_a) {
6851
+ var selectedFilter = _a.selectedFilter, panelRef = _a.panelRef, targetFilterBarRef = _a.targetFilterBarRef, buttonRefs = _a.buttonRefs, isMobile = _a.isMobile;
6852
+ var _b = __read(React.useState({}), 2), localStyles = _b[0], setLocalStyles = _b[1];
6853
+ React.useLayoutEffect(function () {
6854
+ if (!selectedFilter || typeof selectedFilter !== 'string' || isMobile) {
6855
+ setLocalStyles({});
6856
+ return;
6857
+ }
6858
+ var panel = panelRef.current;
6859
+ var container = targetFilterBarRef.current;
6860
+ var button = buttonRefs.current[selectedFilter];
6861
+ if (!panel || !container || !button)
6862
+ return;
6863
+ var panelRect = panel.getBoundingClientRect();
6864
+ var containerRect = container.getBoundingClientRect();
6865
+ var buttonRect = button.getBoundingClientRect();
6866
+ var buttonLeft = buttonRect.left - containerRect.left;
6867
+ var left = Math.max(0, Math.min(buttonLeft, containerRect.width - panelRect.width));
6868
+ setLocalStyles({ left: left });
6869
+ }, [selectedFilter, isMobile]);
6870
+ return { localStyles: localStyles };
6871
+ };
6872
+
6873
+ var FilterBarContext = React.createContext(undefined);
6874
+ var FilterBarProvider = function (_a) {
6875
+ var children = _a.children, language = _a.language, ageCategories = _a.ageCategories, redirectUrl = _a.redirectUrl, palette = _a.palette, onSubmit = _a.onSubmit, fullWidth = _a.fullWidth, disableCalendarDates = _a.disableCalendarDates, mode = _a.mode, tabs = _a.tabs, outerLoading = _a.outerLoading, locations = _a.locations;
6876
+ var _b = useFilterState({ locations: locations }), selectedPath = _b.selectedPath, selectedFilter = _b.selectedFilter, calendarRange = _b.calendarRange, innerLoading = _b.innerLoading, categories = _b.categories, ageCategoryCounts = _b.ageCategoryCounts, selectedLocations = _b.selectedLocations, setSelectedLocations = _b.setSelectedLocations, setCalendarRange = _b.setCalendarRange, setAgeCategoryCounts = _b.setAgeCategoryCounts, setCategories = _b.setCategories, setSelectedPath = _b.setSelectedPath, setSelectedFilter = _b.setSelectedFilter, setInnerLoading = _b.setInnerLoading;
6877
+ var filterActions = useFilterActions({
6878
+ tabs: tabs,
6879
+ ageCategoryCounts: ageCategoryCounts,
6880
+ ageCategories: ageCategories,
6881
+ selectedLocations: selectedLocations,
6882
+ selectedPath: selectedPath,
6883
+ redirectUrl: redirectUrl,
6884
+ setSelectedPath: setSelectedPath,
6885
+ setAgeCategoryCounts: setAgeCategoryCounts,
6886
+ setSelectedFilter: setSelectedFilter,
6887
+ setCalendarRange: setCalendarRange,
6888
+ onSubmit: onSubmit,
6889
+ setInnerLoading: setInnerLoading,
6890
+ });
6891
+ var filterUi = useFilterUi(selectedFilter);
6892
+ var contextValue = React.useMemo(function () { return (__assign$2(__assign$2(__assign$2({ selectedFilter: selectedFilter, ageCategoryCounts: ageCategoryCounts, categories: categories, calendarRange: calendarRange, selectedPath: selectedPath, innerLoading: innerLoading, selectedLocations: selectedLocations, setSelectedLocations: setSelectedLocations, setCalendarRange: setCalendarRange, setSelectedFilter: setSelectedFilter, setAgeCategoryCounts: setAgeCategoryCounts, setCategories: setCategories, setSelectedPath: setSelectedPath }, filterActions), { language: language, ageCategories: ageCategories, redirectUrl: redirectUrl, palette: palette, onSubmit: onSubmit, fullWidth: fullWidth, disableCalendarDates: disableCalendarDates, mode: mode, tabs: tabs, outerLoading: outerLoading, locations: locations }), filterUi)); }, [
6893
+ selectedFilter,
6894
+ ageCategoryCounts,
6895
+ categories,
6896
+ calendarRange,
6897
+ selectedPath,
6898
+ innerLoading,
6899
+ selectedLocations,
6900
+ language,
6901
+ ageCategories,
6902
+ redirectUrl,
6903
+ palette,
6904
+ onSubmit,
6905
+ fullWidth,
6906
+ disableCalendarDates,
6907
+ mode,
6908
+ tabs,
6909
+ outerLoading,
6910
+ locations,
6911
+ filterUi.isMobile,
6912
+ filterUi.targetFilterBarRef,
6913
+ ]);
6914
+ return (React.createElement(FilterBarContext.Provider, { value: contextValue }, children));
6915
+ };
6916
+ var useFilterBar = function () {
6917
+ var context = React.useContext(FilterBarContext);
6918
+ if (!context) {
6919
+ throw new Error('useFilterBar must be used within FilterBarProvider');
6920
+ }
6921
+ return context;
6922
+ };
6923
+
6924
+ var DefaultContext = {
6925
+ color: undefined,
6926
+ size: undefined,
6927
+ className: undefined,
6928
+ style: undefined,
6929
+ attr: undefined
6930
+ };
6931
+ var IconContext = React.createContext && React.createContext(DefaultContext);
6932
+
6933
+ var __assign$1 = undefined && undefined.__assign || function () {
6934
+ __assign$1 = Object.assign || function (t) {
6935
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6936
+ s = arguments[i];
6937
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6938
+ }
6939
+ return t;
6940
+ };
6941
+ return __assign$1.apply(this, arguments);
6942
+ };
6943
+ var __rest$1 = undefined && undefined.__rest || function (s, e) {
6944
+ var t = {};
6945
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
6946
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
6947
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
6948
+ }
6949
+ return t;
6950
+ };
6951
+ function Tree2Element(tree) {
6952
+ return tree && tree.map(function (node, i) {
6953
+ return React.createElement(node.tag, __assign$1({
6954
+ key: i
6955
+ }, node.attr), Tree2Element(node.child));
6956
+ });
6957
+ }
6958
+ function GenIcon(data) {
6959
+ // eslint-disable-next-line react/display-name
6960
+ return function (props) {
6961
+ return React.createElement(IconBase, __assign$1({
6962
+ attr: __assign$1({}, data.attr)
6963
+ }, props), Tree2Element(data.child));
6964
+ };
6965
+ }
6966
+ function IconBase(props) {
6967
+ var elem = function (conf) {
6968
+ var attr = props.attr,
6969
+ size = props.size,
6970
+ title = props.title,
6971
+ svgProps = __rest$1(props, ["attr", "size", "title"]);
6972
+ var computedSize = size || conf.size || "1em";
6973
+ var className;
6974
+ if (conf.className) className = conf.className;
6975
+ if (props.className) className = (className ? className + " " : "") + props.className;
6976
+ return React.createElement("svg", __assign$1({
6977
+ stroke: "currentColor",
6978
+ fill: "currentColor",
6979
+ strokeWidth: "0"
6980
+ }, conf.attr, attr, svgProps, {
6981
+ className: className,
6982
+ style: __assign$1(__assign$1({
6983
+ color: props.color || conf.color
6984
+ }, conf.style), props.style),
6985
+ height: computedSize,
6986
+ width: computedSize,
6987
+ xmlns: "http://www.w3.org/2000/svg"
6988
+ }), title && React.createElement("title", null, title), props.children);
6989
+ };
6990
+ return IconContext !== undefined ? React.createElement(IconContext.Consumer, null, function (conf) {
6991
+ return elem(conf);
6992
+ }) : elem(DefaultContext);
6993
+ }
6994
+
6995
+ // THIS FILE IS AUTO GENERATED
6996
+ function FaSearch (props) {
6997
+ return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 512 512"},"child":[{"tag":"path","attr":{"d":"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"}}]})(props);
6998
+ }function FaSpinner (props) {
6999
+ return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 512 512"},"child":[{"tag":"path","attr":{"d":"M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"}}]})(props);
7000
+ }
7001
+
7002
+ var css_248z$g = ".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";
7003
+ styleInject(css_248z$g);
7004
+
7005
+ var SubmitButton = function (_a) {
7006
+ var onClick = _a.onClick, startIcon = _a.startIcon, label = _a.label, disabled = _a.disabled, isLoading = _a.isLoading, variant = _a.variant;
7007
+ return (React.createElement("button", { className: "will-filter-bar-submit-button ".concat(variant || 'default'), onClick: onClick, disabled: disabled || isLoading },
7008
+ isLoading ? (React.createElement("span", null, React.createElement(FaSpinner, { style: { animation: 'spin 1s linear infinite' } }))) : (startIcon && React.createElement("span", null, startIcon)),
7009
+ label || 'Label'));
7010
+ };
6650
7011
 
6651
- // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
6652
- if (isNaN(date.getTime())) {
6653
- return new Date(NaN);
6654
- }
6655
- date.setFullYear(year);
6656
- return date;
7012
+ // THIS FILE IS AUTO GENERATED
7013
+ function IoIosCloseCircleOutline (props) {
7014
+ 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);
6657
7015
  }
6658
7016
 
7017
+ var css_248z$f = ".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";
7018
+ styleInject(css_248z$f);
7019
+
7020
+ var CloseButton = function (_a) {
7021
+ var handleClose = _a.handleClose;
7022
+ return (React.createElement("button", { className: "will-filter-bar-close-button", onClick: handleClose },
7023
+ React.createElement(IoIosCloseCircleOutline, null)));
7024
+ };
7025
+
6659
7026
  function futureSeconds(text) {
6660
7027
  return text.replace(/sekuntia?/, 'sekunnin');
6661
7028
  }
@@ -11498,11 +11865,11 @@
11498
11865
  return { newDisableCalendarDates: newDisableCalendarDates, overlappingDate: overlappingDate, lastPossibleCheckout: lastPossibleCheckout };
11499
11866
  };
11500
11867
 
11501
- 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}";
11502
- styleInject(css_248z$d);
11868
+ var css_248z$e = ".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}";
11869
+ styleInject(css_248z$e);
11503
11870
 
11504
- 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";
11505
- styleInject(css_248z$c);
11871
+ var css_248z$d = ".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";
11872
+ styleInject(css_248z$d);
11506
11873
 
11507
11874
  var Calendar = React.forwardRef(function (_a, ref) {
11508
11875
  var _b;
@@ -11572,413 +11939,100 @@
11572
11939
  // No gap between check-in and first possible check-out, nothing to disable
11573
11940
  addDays(currentSelectionAvailability.checkIn, 1) >=
11574
11941
  currentSelectionAvailability.firstCheckOut) {
11575
- return [];
11576
- }
11577
- // Disable dates between current check-in and first possible check-out
11578
- return [
11579
- {
11580
- from: addDays(currentSelectionAvailability.checkIn, 1),
11581
- to: addDays(currentSelectionAvailability.firstCheckOut, -1),
11582
- },
11583
- ];
11584
- };
11585
- var base = disabledDatesByPage$1.length
11586
- ? disabledDatesByPage$1
11587
- : (disabledDates === null || disabledDates === void 0 ? void 0 : disabledDates.length)
11588
- ? disabledDates
11589
- : (newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates) || [];
11590
- var disabled = disabledDatesByPage$1.length
11591
- ? base
11592
- : __spreadArray$1(__spreadArray$1(__spreadArray$1(__spreadArray$1([
11593
- lastPossibleCheckout
11594
- ], __read(base), false), __read(firstPossibleRangeContextCheckIn), false), __read(lastPossibleRangeContextCheckOut), false), __read(disabledInsideSelectableRange()), false);
11595
- return (React.createElement("div", { className: "will-filter-bar-calendar", ref: ref },
11596
- React.createElement("div", { className: "will-calendar-filter-container", ref: calendarContainerRef },
11597
- React.createElement(DayPicker, { key: updateCalendarDefaultMonth, 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) ||
11598
- selectedStartDate ||
11599
- rangeContextStartDate ||
11600
- (((_b = newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates) === null || _b === void 0 ? void 0 : _b.length)
11601
- ? newDisableCalendarDates.disabledDates[0].from
11602
- : today), disabled: disabled, fromMonth: today, onMonthChange: function (val) {
11603
- requestDates === null || requestDates === void 0 ? void 0 : requestDates(val);
11604
- setUpdateCalendarMonthNavigation === null || setUpdateCalendarMonthNavigation === void 0 ? void 0 : setUpdateCalendarMonthNavigation(function (prev) { return !prev; });
11605
- }, classNames: {
11606
- day_range_start: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from) ? 'rdp-day_range_start' : '',
11607
- day_range_end: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) ? 'rdp-day_range_end' : '',
11608
- }, modifiersClassNames: {
11609
- today: 'my-today',
11610
- booked: 'booked',
11611
- disabledAfterCheckIn: 'disabled-after-check-in',
11612
- overlappingDate: 'overlapping-date',
11613
- noActiveSelectionStart: 'no-active-selection-start',
11614
- noActiveSelectionMid: 'no-active-selection-mid',
11615
- noActiveSelectionEnd: 'no-active-selection-end',
11616
- checkoutOptionsMid: 'rdp-day_selected rdp-day_range_middle checkout-option',
11617
- checkInOnly: 'check-in-only',
11618
- checkOutOnly: 'check-out-only',
11619
- }, modifiers:
11620
- // This function handles conditions for applying the modifiersClassNames
11621
- handleCalendarModifiers({
11622
- calendarRange: calendarRange,
11623
- disabledDates: disabled,
11624
- overlappingDate: overlappingDate,
11625
- rangeContext: rangeContext,
11626
- findFirstPossibleRangeContextCheckIn: findFirstPossibleRangeContextCheckIn,
11627
- findLastPossibleRangeContextCheckOut: findLastPossibleRangeContextCheckOut,
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" })))));
11642
- });
11643
-
11644
- var parseGuests = function (_a) {
11645
- var guestLabel = _a.guestLabel, guestsLabel = _a.guestsLabel, guestsPlaceholder = _a.guestsPlaceholder, ageCategoryCounts = _a.ageCategoryCounts, ageCategories = _a.ageCategories;
11646
- var parsedData = Object.entries(ageCategoryCounts).reduce(function (acc, _a) {
11647
- var _b = __read(_a, 2), key = _b[0], value = _b[1];
11648
- var parts = key.split('-');
11649
- if (parts.length < 2)
11650
- return acc;
11651
- var ageCategoryId = parts[1];
11652
- var ageCategory = ageCategories.find(function (c) { return c.id === ageCategoryId; });
11653
- if (ageCategory && value) {
11654
- return {
11655
- total: acc.total + value,
11656
- html: __spreadArray$1(__spreadArray$1([], __read(acc.html), false), ["".concat(value)], false),
11657
- };
11658
- }
11659
- return acc;
11660
- }, { total: 0, html: [] });
11661
- var htmlString = parsedData.html.length > 1 ? parsedData.html.join(' + ') : '';
11662
- return {
11663
- content: parsedData.total
11664
- ? "<span class=\"will-guest-count\">".concat(parsedData.total, "</span> ").concat(parsedData.total > 1 ? guestsLabel : guestLabel).concat(htmlString ? " &nbsp; ( ".concat(htmlString, " )") : '')
11665
- : guestsPlaceholder,
11666
- data: parsedData,
11667
- };
11668
- };
11669
-
11670
- var parseLocations = function (_a) {
11671
- var selectedLocations = _a.selectedLocations, locationsPlaceholder = _a.locationsPlaceholder, _b = _a.locationsSelectedLabel, locationsSelectedLabel = _b === void 0 ? 'locations' : _b;
11672
- if (!selectedLocations.length) {
11673
- return locationsPlaceholder;
11674
- }
11675
- if (selectedLocations.length === 1) {
11676
- var translation = selectedLocations[0].label;
11677
- if (!translation) {
11678
- return locationsPlaceholder;
11679
- }
11680
- return translation;
11681
- }
11682
- return "".concat(selectedLocations.length, " ").concat(locationsSelectedLabel);
11683
- };
11684
-
11685
- var FilterSections;
11686
- (function (FilterSections) {
11687
- FilterSections["CALENDAR"] = "calendar";
11688
- FilterSections["GUESTS"] = "guests";
11689
- FilterSections["CATEGORIES"] = "categories";
11690
- FilterSections["LOCATIONS"] = "locations";
11691
- })(FilterSections || (FilterSections = {}));
11692
- var Pages;
11693
- (function (Pages) {
11694
- Pages["ROOMS"] = "/rooms";
11695
- Pages["EVENTS"] = "/events";
11696
- Pages["SALES"] = "/sales";
11697
- })(Pages || (Pages = {}));
11698
-
11699
- var calculateDropdownPosition = function (_a) {
11700
- var filterSection = _a.filterSection, headerRef = _a.headerRef, locationsButtonRef = _a.locationsButtonRef, datesButtonRef = _a.datesButtonRef, guestsButtonRef = _a.guestsButtonRef, isMobile = _a.isMobile;
11701
- if (isMobile) {
11702
- return {};
11703
- }
11704
- if (!headerRef.current)
11705
- return {};
11706
- var containerRect = headerRef.current.getBoundingClientRect();
11707
- var containerLeft = 0;
11708
- switch (filterSection) {
11709
- case FilterSections.LOCATIONS:
11710
- if (locationsButtonRef.current) {
11711
- var buttonRect = locationsButtonRef.current.getBoundingClientRect();
11712
- var relativeLeft = buttonRect.left - containerRect.left;
11713
- return {
11714
- left: relativeLeft,
11715
- right: 'auto',
11716
- width: 'auto',
11717
- };
11718
- }
11719
- break;
11720
- case FilterSections.CALENDAR:
11721
- if (datesButtonRef.current) {
11722
- var buttonRect = datesButtonRef.current.getBoundingClientRect();
11723
- var relativeLeft = buttonRect.left - containerRect.left;
11724
- var availableWidth = containerRect.width - relativeLeft;
11725
- var calendarMinWidth = 650;
11726
- if (availableWidth < calendarMinWidth) {
11727
- return {
11728
- left: 'auto',
11729
- right: containerLeft,
11730
- width: 'auto',
11731
- maxWidth: "".concat(containerRect.width, "px"),
11732
- };
11733
- }
11734
- else {
11735
- return {
11736
- left: relativeLeft,
11737
- right: 'auto',
11738
- width: 'auto',
11739
- };
11740
- }
11741
- }
11742
- break;
11743
- case FilterSections.GUESTS:
11744
- if (guestsButtonRef.current) {
11745
- var buttonRect = guestsButtonRef.current.getBoundingClientRect();
11746
- var relativeLeft = buttonRect.left - containerRect.left;
11747
- var availableWidth = containerRect.width - relativeLeft;
11748
- var dropdownMinWidth = 350;
11749
- if (availableWidth < dropdownMinWidth) {
11750
- return {
11751
- left: 'auto',
11752
- right: containerLeft,
11753
- width: 'auto',
11754
- maxWidth: "".concat(containerRect.width, "px"),
11755
- };
11756
- }
11757
- else {
11758
- return {
11759
- left: relativeLeft,
11760
- right: 'auto',
11761
- width: 'auto',
11762
- };
11763
- }
11764
- }
11765
- break;
11766
- default:
11767
- return {};
11768
- }
11769
- return {};
11770
- };
11771
-
11772
- var useFilterBar = function (_a) {
11773
- var redirectUrl = _a.redirectUrl, ageCategories = _a.ageCategories, onSubmit = _a.onSubmit, tabs = _a.tabs, locations = _a.locations;
11774
- var _b = __read(React.useState(Pages.EVENTS), 2), selectedPath = _b[0], setSelectedPath = _b[1];
11775
- var _c = __read(React.useState(false), 2), selectedFilter = _c[0], setSelectedFilter = _c[1];
11776
- var _d = __read(React.useState(), 2), calendarRange = _d[0], setCalendarRange = _d[1];
11777
- var _e = __read(React.useState(false), 2), innerLoading = _e[0], setInnerLoading = _e[1];
11778
- var _f = __read(React.useState(0), 2), categories = _f[0], setCategories = _f[1];
11779
- var _g = __read(React.useState({}), 2), ageCategoryCounts = _g[0], setAgeCategoryCounts = _g[1];
11780
- var _h = __read(React.useState([]), 2), selectedLocations = _h[0], setSelectedLocations = _h[1];
11781
- React.useEffect(function () {
11782
- var _a;
11783
- var urlSearchParams = new URLSearchParams(window.location.search);
11784
- var startDateParam = urlSearchParams.get('startDate');
11785
- var endDateParam = urlSearchParams.get('endDate');
11786
- // Get all locationId params from URL
11787
- var locationIdParams = urlSearchParams.getAll('locationId');
11788
- var ageCategoryCountsParam = JSON.parse(urlSearchParams.get('ageCategoryCounts') || '{}');
11789
- var parsedCategories = parseInt(urlSearchParams.get('categories') || '0', 10);
11790
- if (startDateParam && endDateParam) {
11791
- setCalendarRange({
11792
- from: new Date(startDateParam),
11793
- to: new Date(endDateParam),
11794
- });
11795
- }
11796
- setAgeCategoryCounts(ageCategoryCountsParam);
11797
- setCategories(parsedCategories);
11798
- // Set selected locations from URL - handle all locationIds
11799
- if (((_a = locations === null || locations === void 0 ? void 0 : locations.data) === null || _a === void 0 ? void 0 : _a.length) && locationIdParams.length) {
11800
- var matchedLocations = locations.data.filter(function (location) {
11801
- return locationIdParams.includes(location.id.toString());
11802
- });
11803
- setSelectedLocations(matchedLocations);
11804
- }
11805
- }, []);
11806
- React.useEffect(function () {
11807
- if (typeof window === 'undefined')
11808
- return;
11809
- 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; });
11810
- var findMatchingPath = function () {
11811
- var e_1, _a;
11812
- var paths = [Pages.EVENTS, Pages.ROOMS, Pages.SALES];
11813
- try {
11814
- for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {
11815
- var path = paths_1_1.value;
11816
- if (window.location.pathname.includes(path)) {
11817
- return path;
11818
- }
11819
- }
11820
- }
11821
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
11822
- finally {
11823
- try {
11824
- if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1);
11825
- }
11826
- finally { if (e_1) throw e_1.error; }
11827
- }
11828
- return defaultTab ? defaultTab.path : Pages.EVENTS;
11829
- };
11830
- var currentPath = findMatchingPath();
11831
- setSelectedPath(currentPath);
11832
- }, []);
11833
- var updateGuestsCount = function (id, newCount) {
11834
- setAgeCategoryCounts(function (prevCounts) {
11835
- var _a;
11836
- return (__assign$2(__assign$2({}, prevCounts), (_a = {}, _a[id] = newCount, _a)));
11837
- });
11838
- };
11839
- var handleSelectedFilter = function (id) {
11840
- setSelectedFilter(id);
11841
- };
11842
- var handleSubmit = function () {
11843
- var e_2, _a;
11844
- var newParams = {
11845
- startDate: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from)
11846
- ? format(calendarRange.from, 'yyyy-MM-dd')
11847
- : '',
11848
- endDate: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) ? format(calendarRange.to, 'yyyy-MM-dd') : '',
11849
- //categories: categories.toString(),
11850
- ageCategoryCounts: handleAgeCategoryRules({
11851
- ageCategoryCounts: ageCategoryCounts,
11852
- ageCategories: ageCategories,
11853
- }),
11854
- selectedLocations: selectedLocations
11855
- .map(function (location) { return location.id.toString(); })
11856
- .join(','),
11857
- };
11858
- var querySearchParams = new URLSearchParams();
11859
- try {
11860
- for (var _b = __values(Object.entries(newParams)), _c = _b.next(); !_c.done; _c = _b.next()) {
11861
- var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
11862
- if (value) {
11863
- if (key === 'selectedLocations' && !!selectedLocations.length) {
11864
- // Append all selected locationIds
11865
- selectedLocations.forEach(function (location) {
11866
- querySearchParams.append('locationId', location.id.toString());
11867
- });
11868
- }
11869
- else {
11870
- querySearchParams.append(key, value.toString());
11871
- }
11872
- }
11873
- }
11874
- }
11875
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
11876
- finally {
11877
- try {
11878
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
11879
- }
11880
- finally { if (e_2) throw e_2.error; }
11881
- }
11882
- handleSelectedFilter(false);
11883
- if (onSubmit && window.location.href.includes(selectedPath)) {
11884
- onSubmit(newParams);
11885
- }
11886
- else {
11887
- var params = new URLSearchParams(querySearchParams !== null && querySearchParams !== void 0 ? querySearchParams : undefined);
11888
- var paramString = params.toString();
11889
- var path = "".concat(redirectUrl).concat(selectedPath);
11890
- setInnerLoading(true);
11891
- window.location.href = paramString ? "".concat(path, "?").concat(paramString) : path;
11942
+ return [];
11892
11943
  }
11944
+ // Disable dates between current check-in and first possible check-out
11945
+ return [
11946
+ {
11947
+ from: addDays(currentSelectionAvailability.checkIn, 1),
11948
+ to: addDays(currentSelectionAvailability.firstCheckOut, -1),
11949
+ },
11950
+ ];
11893
11951
  };
11894
- var handleResetFilters = function () {
11895
- setAgeCategoryCounts({});
11896
- setCalendarRange(undefined);
11897
- };
11898
- return {
11899
- selectedFilter: selectedFilter,
11900
- ageCategoryCounts: ageCategoryCounts,
11901
- categories: categories,
11902
- calendarRange: calendarRange,
11903
- selectedPath: selectedPath,
11904
- innerLoading: innerLoading,
11905
- selectedLocations: selectedLocations,
11906
- setSelectedLocations: setSelectedLocations,
11907
- setCalendarRange: setCalendarRange,
11908
- setSelectedFilter: setSelectedFilter,
11909
- setAgeCategoryCounts: setAgeCategoryCounts,
11910
- setCategories: setCategories,
11911
- handleSelectedFilter: handleSelectedFilter,
11912
- handleSubmit: handleSubmit,
11913
- updateGuestsCount: updateGuestsCount,
11914
- handleResetFilters: handleResetFilters,
11915
- setSelectedPath: setSelectedPath,
11916
- };
11917
- };
11918
- ////////////
11919
- var handleAgeCategoryRules = function (_a) {
11920
- var ageCategoryCounts = _a.ageCategoryCounts, ageCategories = _a.ageCategories;
11921
- if (ageCategories === null || ageCategories === void 0 ? void 0 : ageCategories.length) {
11922
- ageCategories === null || ageCategories === void 0 ? void 0 : ageCategories.map(function (a) {
11923
- if (a.minVal) {
11924
- // Age categories rules
11925
- var ageCategory = ageCategoryCounts["guests-".concat(a.id)];
11926
- if (!ageCategory) {
11927
- ageCategoryCounts["guests-".concat(a.id)] = a.minVal;
11928
- }
11929
- }
11930
- });
11931
- }
11932
- return Object.entries(ageCategoryCounts).length
11933
- ? JSON.stringify(ageCategoryCounts)
11934
- : '';
11935
- };
11952
+ var base = disabledDatesByPage$1.length
11953
+ ? disabledDatesByPage$1
11954
+ : (disabledDates === null || disabledDates === void 0 ? void 0 : disabledDates.length)
11955
+ ? disabledDates
11956
+ : (newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates) || [];
11957
+ var disabled = disabledDatesByPage$1.length
11958
+ ? base
11959
+ : __spreadArray$1(__spreadArray$1(__spreadArray$1(__spreadArray$1([
11960
+ lastPossibleCheckout
11961
+ ], __read(base), false), __read(firstPossibleRangeContextCheckIn), false), __read(lastPossibleRangeContextCheckOut), false), __read(disabledInsideSelectableRange()), false);
11962
+ return (React.createElement("div", { className: "will-filter-bar-calendar", ref: ref },
11963
+ React.createElement("div", { className: "will-calendar-filter-container", ref: calendarContainerRef },
11964
+ React.createElement(DayPicker, { key: updateCalendarDefaultMonth, 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) ||
11965
+ selectedStartDate ||
11966
+ rangeContextStartDate ||
11967
+ (((_b = newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates) === null || _b === void 0 ? void 0 : _b.length)
11968
+ ? newDisableCalendarDates.disabledDates[0].from
11969
+ : today), disabled: disabled, fromMonth: today, onMonthChange: function (val) {
11970
+ requestDates === null || requestDates === void 0 ? void 0 : requestDates(val);
11971
+ setUpdateCalendarMonthNavigation === null || setUpdateCalendarMonthNavigation === void 0 ? void 0 : setUpdateCalendarMonthNavigation(function (prev) { return !prev; });
11972
+ }, classNames: {
11973
+ day_range_start: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from) ? 'rdp-day_range_start' : '',
11974
+ day_range_end: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) ? 'rdp-day_range_end' : '',
11975
+ }, modifiersClassNames: {
11976
+ today: 'my-today',
11977
+ booked: 'booked',
11978
+ disabledAfterCheckIn: 'disabled-after-check-in',
11979
+ overlappingDate: 'overlapping-date',
11980
+ noActiveSelectionStart: 'no-active-selection-start',
11981
+ noActiveSelectionMid: 'no-active-selection-mid',
11982
+ noActiveSelectionEnd: 'no-active-selection-end',
11983
+ checkoutOptionsMid: 'rdp-day_selected rdp-day_range_middle checkout-option',
11984
+ checkInOnly: 'check-in-only',
11985
+ checkOutOnly: 'check-out-only',
11986
+ }, modifiers:
11987
+ // This function handles conditions for applying the modifiersClassNames
11988
+ handleCalendarModifiers({
11989
+ calendarRange: calendarRange,
11990
+ disabledDates: disabled,
11991
+ overlappingDate: overlappingDate,
11992
+ rangeContext: rangeContext,
11993
+ findFirstPossibleRangeContextCheckIn: findFirstPossibleRangeContextCheckIn,
11994
+ findLastPossibleRangeContextCheckOut: findLastPossibleRangeContextCheckOut,
11995
+ currentSelectionLastCheckoutDate: currentSelectionAvailability,
11996
+ }) }),
11997
+ React.createElement("div", { className: 'will-calendar-tooltip' },
11998
+ React.createElement("div", null, t('noCheckIn'))),
11999
+ React.createElement("div", { className: 'will-calendar-tooltip-check-out' },
12000
+ React.createElement("div", null, t('noCheckOut'))),
12001
+ React.createElement("div", { className: 'will-calendar-tooltip-overlapping-date' },
12002
+ React.createElement("div", null, t('checkOutOnly'))),
12003
+ React.createElement("div", { className: 'will-calendar-tooltip-check-in-only' },
12004
+ React.createElement("div", null, t('checkInOnly'))),
12005
+ React.createElement("div", { className: 'will-calendar-tooltip-check-out-only' },
12006
+ React.createElement("div", null, t('checkOutOnly'))),
12007
+ React.createElement("div", { className: 'will-calendar-spinner' },
12008
+ React.createElement(IconsSvg, { fill: (palette === null || palette === void 0 ? void 0 : palette.primary) || 'inherit', size: 50, icon: "spinner" })))));
12009
+ });
11936
12010
 
11937
- var useScrollInToView = function (_a) {
11938
- var selectedFilter = _a.selectedFilter;
11939
- var _b = __read(React.useState(true), 2), isMobile = _b[0], setIsMobile = _b[1];
11940
- var targetFilterBarRef = React.useRef(null);
11941
- React.useEffect(function () {
11942
- if (typeof window !== 'undefined' && window.innerWidth > 960) {
11943
- setIsMobile(false);
11944
- return;
11945
- }
11946
- if (targetFilterBarRef.current && selectedFilter) {
11947
- window.scrollTo({
11948
- behavior: 'smooth',
11949
- top: targetFilterBarRef.current.getBoundingClientRect().top -
11950
- document.body.getBoundingClientRect().top -
11951
- 30,
11952
- });
11953
- }
11954
- }, [selectedFilter]);
11955
- return { isMobile: isMobile, targetFilterBarRef: targetFilterBarRef };
12011
+ var css_248z$c = ".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";
12012
+ styleInject(css_248z$c);
12013
+
12014
+ var SectionHeader = function (_a) {
12015
+ var title = _a.title, action = _a.action;
12016
+ return (React.createElement("div", { className: "will-filter-section-header" },
12017
+ React.createElement("h3", { className: "will-filter-section-title" }, title),
12018
+ action && React.createElement("div", { className: "will-filter-section-action" }, action)));
11956
12019
  };
11957
12020
 
11958
- 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";
12021
+ var css_248z$b = ".will-dates-filter-container {\n padding: 0 16px 16px 16px;\n}\n";
11959
12022
  styleInject(css_248z$b);
11960
12023
 
11961
- var SelectButton = React.forwardRef(function (_a, ref) {
11962
- var active = _a.active, label = _a.label, onClick = _a.onClick, description = _a.description, disabled = _a.disabled, ariaExpanded = _a.ariaExpanded, ariaControls = _a.ariaControls;
11963
- return (React.createElement("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 },
11964
- React.createElement("span", { className: "select-button-wrapper" },
11965
- React.createElement("div", null,
11966
- React.createElement("p", { className: "select-button-label" }, label),
11967
- React.createElement("p", { className: "select-button-description ".concat(active ? 'active' : ''), dangerouslySetInnerHTML: { __html: description } })))));
12024
+ var Dates = React.forwardRef(function (_a, ref) {
12025
+ var onClose = _a.onClose, autoFocus = _a.autoFocus, calendarRange = _a.calendarRange, setCalendarRange = _a.setCalendarRange, disableCalendarDates = _a.disableCalendarDates, selectedPath = _a.selectedPath, language = _a.language;
12026
+ return (React.createElement("div", { id: "will-filter-bar-dates", ref: ref },
12027
+ React.createElement(SectionHeader, { title: '', action: onClose && React.createElement(CloseButton, { handleClose: onClose }) }),
12028
+ React.createElement("div", { className: "will-dates-filter-container" },
12029
+ React.createElement(Calendar, { autoFocus: autoFocus, calendarRange: calendarRange, setCalendarRange: setCalendarRange, disableCalendarDates: disableCalendarDates, selectedPath: selectedPath, language: language }))));
11968
12030
  });
11969
- SelectButton.displayName = 'SelectButton';
12031
+ Dates.displayName = 'Dates';
11970
12032
 
11971
- 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";
12033
+ var css_248z$a = ".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";
11972
12034
  styleInject(css_248z$a);
11973
12035
 
11974
- var TabButton = function (_a) {
11975
- var onClick = _a.onClick, label = _a.label, active = _a.active, mode = _a.mode;
11976
- return (React.createElement("button", { className: "will-filter-bar-tab-button ".concat(mode || 'light', " ").concat(active && 'active', " "), onClick: onClick }, label));
11977
- };
11978
-
11979
- 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";
11980
- styleInject(css_248z$9);
11981
-
11982
12036
  var GuestCount = function (_a) {
11983
12037
  var label = _a.label, sortOrder = _a.sortOrder, id = _a.id, updateGuestsCount = _a.updateGuestsCount, count = _a.count, minVal = _a.minVal;
11984
12038
  React.useEffect(function () {
@@ -12010,65 +12064,21 @@
12010
12064
  React.createElement("path", { d: "M10 4V16M4 10H16", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }))))));
12011
12065
  };
12012
12066
 
12013
- 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";
12014
- styleInject(css_248z$8);
12015
-
12016
- var FilterSectionHeader = function (_a) {
12017
- var title = _a.title, action = _a.action;
12018
- return (React.createElement("div", { className: "will-filter-section-header" },
12019
- React.createElement("h3", { className: "will-filter-section-title" }, title),
12020
- action && React.createElement("div", { className: "will-filter-section-action" }, action)));
12021
- };
12022
-
12023
- 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";
12024
- styleInject(css_248z$7);
12067
+ var css_248z$9 = "#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: 0 16px 16px 16px;\n}\n\n@media (max-width: 960px) {\n .will-guests-filter-container {\n min-width: auto;\n }\n}\n\n/**/\n.will-guest-count {\n display: inline-block;\n min-width: 10px;\n}\n";
12068
+ styleInject(css_248z$9);
12025
12069
 
12026
12070
  var Guests = React.forwardRef(function (_a, ref) {
12027
12071
  var ageCategories = _a.ageCategories, updateGuestsCount = _a.updateGuestsCount, ageCategoryCounts = _a.ageCategoryCounts, autoFocus = _a.autoFocus, onClose = _a.onClose;
12028
12072
  var t = useTranslation('filterBar').t;
12029
12073
  var containerRef = useAutoFocus(autoFocus);
12030
- return (React.createElement("div", { className: "will-filter-bar-guests", ref: ref },
12031
- React.createElement(FilterSectionHeader, { title: t('guests.title'), action: onClose && React.createElement(CloseButton, { handleClose: onClose }) }),
12074
+ return (React.createElement("div", { id: "will-filter-bar-guests", ref: ref },
12075
+ React.createElement(SectionHeader, { title: t('guests.title'), action: onClose && React.createElement(CloseButton, { handleClose: onClose }) }),
12032
12076
  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 })); }))));
12033
12077
  });
12034
12078
  Guests.displayName = 'Guests';
12035
12079
 
12036
- 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}";
12037
- styleInject(css_248z$6);
12038
-
12039
- var Divider = function () {
12040
- return React.createElement("div", { className: "will-filter-bar-divider" });
12041
- };
12042
-
12043
- 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";
12044
- styleInject(css_248z$5);
12045
-
12046
- var Categories = function (_a) {
12047
- _a.categories; var setCategories = _a.setCategories;
12048
- var t = useTranslation('filterBar').t;
12049
- var categoriesPlaceholder = [
12050
- 'Weekend',
12051
- 'Week',
12052
- 'Summer camp',
12053
- 'Winter camp',
12054
- ];
12055
- var _b = __read(React.useState(''), 2), selectedCategory = _b[0], setSelectedCategory = _b[1];
12056
- var handleCategoryChange = function (selectedCategory) {
12057
- setSelectedCategory(selectedCategory);
12058
- setCategories(selectedCategory);
12059
- };
12060
- return (React.createElement("div", { className: "will-filter-bar-categories" },
12061
- React.createElement("h3", { className: "will-categories-filter-title" }, t('categories.label')),
12062
- React.createElement("div", { className: "will-categories-filter-inner" }, categoriesPlaceholder.map(function (itm, idx) { return (React.createElement("div", { key: idx },
12063
- React.createElement("input", { type: "radio", value: itm, checked: selectedCategory === itm, onChange: function () { return handleCategoryChange(itm); } }),
12064
- React.createElement("span", null, itm))); }))));
12065
- };
12066
-
12067
- 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";
12068
- styleInject(css_248z$4);
12069
-
12070
- 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";
12071
- styleInject(css_248z$3);
12080
+ var css_248z$8 = ".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";
12081
+ styleInject(css_248z$8);
12072
12082
 
12073
12083
  var ImageCard = React.forwardRef(function (_a, ref) {
12074
12084
  var title = _a.title, description = _a.description, imageUrl = _a.imageUrl, isSelected = _a.isSelected, onClick = _a.onClick;
@@ -12086,6 +12096,9 @@
12086
12096
  });
12087
12097
  ImageCard.displayName = 'ImageCard';
12088
12098
 
12099
+ var css_248z$7 = "#will-filter-bar-locations {\n text-align: initial;\n}\n\n.will-locations-filter-container {\n display: flex;\n flex-direction: column;\n min-width: 400px;\n padding-bottom: 16px;\n}\n\n@media (max-width: 960px) {\n .will-locations-filter-container {\n margin-top: 15px;\n min-width: 100%;\n }\n}\n";
12100
+ styleInject(css_248z$7);
12101
+
12089
12102
  var Locations = React.forwardRef(function (_a, ref) {
12090
12103
  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;
12091
12104
  var t = useTranslation('filterBar').t;
@@ -12114,8 +12127,8 @@
12114
12127
  onClose === null || onClose === void 0 ? void 0 : onClose();
12115
12128
  }
12116
12129
  };
12117
- return (React.createElement("div", { className: "will-filter-bar-locations", ref: ref },
12118
- React.createElement(FilterSectionHeader, { title: t('locations.title'), action: onClose && React.createElement(CloseButton, { handleClose: onClose }) }),
12130
+ return (React.createElement("div", { id: "will-filter-bar-locations", ref: ref },
12131
+ React.createElement(SectionHeader, { title: t('locations.title'), action: onClose && React.createElement(CloseButton, { handleClose: onClose }) }),
12119
12132
  React.createElement("div", { className: "will-locations-filter-container" }, !!((locations === null || locations === void 0 ? void 0 : locations.length) && language) &&
12120
12133
  locations.map(function (location, index) {
12121
12134
  return (React.createElement(ImageCard, { key: location.id, 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); } }));
@@ -12123,63 +12136,75 @@
12123
12136
  });
12124
12137
  Locations.displayName = 'Locations';
12125
12138
 
12126
- 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";
12127
- styleInject(css_248z$2);
12139
+ var css_248z$6 = "#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";
12140
+ styleInject(css_248z$6);
12128
12141
 
12129
- var css_248z$1 = ".will-dates-filter-container {\n padding: 0 16px;\n}\n";
12130
- styleInject(css_248z$1);
12142
+ var Categories = function (_a) {
12143
+ _a.categories; var setCategories = _a.setCategories;
12144
+ var t = useTranslation('filterBar').t;
12145
+ var categoriesPlaceholder = [
12146
+ 'Weekend',
12147
+ 'Week',
12148
+ 'Summer camp',
12149
+ 'Winter camp',
12150
+ ];
12151
+ var _b = __read(React.useState(''), 2), selectedCategory = _b[0], setSelectedCategory = _b[1];
12152
+ var handleCategoryChange = function (selectedCategory) {
12153
+ setSelectedCategory(selectedCategory);
12154
+ setCategories(selectedCategory);
12155
+ };
12156
+ return (React.createElement("div", { id: "will-filter-bar-categories" },
12157
+ React.createElement("h3", { className: "will-categories-filter-title" }, t('categories.label')),
12158
+ React.createElement("div", { className: "will-categories-filter-inner" }, categoriesPlaceholder.map(function (itm, idx) { return (React.createElement("div", { key: idx },
12159
+ React.createElement("input", { type: "radio", value: itm, checked: selectedCategory === itm, onChange: function () { return handleCategoryChange(itm); } }),
12160
+ React.createElement("span", null, itm))); }))));
12161
+ };
12162
+ Categories.displayName = 'Categories';
12131
12163
 
12132
- var Dates = React.forwardRef(function (_a, ref) {
12133
- 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;
12134
- return (React.createElement("div", { className: "will-filter-bar-dates", ref: ref },
12135
- React.createElement(FilterSectionHeader, { title: '', action: onClose && React.createElement(CloseButton, { handleClose: onClose }) }),
12136
- React.createElement("div", { className: "will-dates-filter-container" },
12137
- React.createElement(Calendar, { autoFocus: autoFocus, calendarRange: calendarRange, setCalendarRange: setCalendarRange, disableCalendarDates: disableCalendarDates, selectedPath: selectedPath, language: language, ref: filtersRef }))));
12138
- });
12139
- Dates.displayName = 'Dates';
12164
+ var css_248z$5 = ".will-filter-bar-panels {\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-panels {\n margin-top: 10px;\n top: 0;\n position: relative;\n }\n}\n";
12165
+ styleInject(css_248z$5);
12140
12166
 
12141
- function FilterBar(_a) {
12142
- var _b;
12143
- var _c = _a.language, language = _c === void 0 ? LANGUAGE_FALLBACK : _c, _d = _a.ageCategories, ageCategories = _d === void 0 ? AGE_CATEGORIES_FALLBACK : _d, _e = _a.redirectUrl, redirectUrl = _e === void 0 ? REDIRECT_URL_FALLBACK : _e, palette = _a.palette, onSubmit = _a.onSubmit, fullWidth = _a.fullWidth, disableCalendarDates = _a.disableCalendarDates, mode = _a.mode, tabs = _a.tabs, outerLoading = _a.outerLoading, locations = _a.locations;
12144
- var themePalette = useTheme({ palette: palette });
12145
- // Translations
12146
- useUpdateTranslations({ language: language });
12147
- var t = useTranslation('filterBar').t;
12148
- // Refs for SelectButtons
12149
- var locationsButtonRef = React.useRef(null);
12150
- var datesButtonRef = React.useRef(null);
12151
- var guestsButtonRef = React.useRef(null);
12152
- var previouslyFocusedButtonRef = React.useRef(null);
12153
- var headerRef = React.useRef(null);
12154
- // Dropdown positioning
12155
- var _f = __read(React.useState({}), 2), dropdownStyle = _f[0], setDropdownStyle = _f[1];
12156
- // Filters
12157
- var _g = useFilterBar({
12158
- redirectUrl: redirectUrl,
12159
- ageCategories: ageCategories,
12160
- onSubmit: onSubmit,
12161
- tabs: tabs,
12162
- locations: locations,
12163
- }), 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;
12164
- // Scroll in to view
12165
- var _h = useScrollInToView({ selectedFilter: selectedFilter }), isMobile = _h.isMobile, targetFilterBarRef = _h.targetFilterBarRef;
12167
+ var FilterPanels = function () {
12168
+ var _a = useFilterBar(), categories = _a.categories, calendarRange = _a.calendarRange, selectedFilter = _a.selectedFilter, selectedPath = _a.selectedPath, ageCategoryCounts = _a.ageCategoryCounts, selectedLocations = _a.selectedLocations, mode = _a.mode, tabs = _a.tabs, disableCalendarDates = _a.disableCalendarDates, ageCategories = _a.ageCategories, locations = _a.locations, language = _a.language, isMobile = _a.isMobile, panelRef = _a.panelRef, buttonRefs = _a.buttonRefs, targetFilterBarRef = _a.targetFilterBarRef, setSelectedLocations = _a.setSelectedLocations, setCalendarRange = _a.setCalendarRange, handleSelectedFilter = _a.handleSelectedFilter, updateGuestsCount = _a.updateGuestsCount, setCategories = _a.setCategories;
12166
12169
  // Handle close filter section
12167
12170
  var filtersRef = useCloseFilterSection({ handleSelectedFilter: handleSelectedFilter }).filtersRef;
12168
- // Enhanced handleSelectedFilter with positioning
12169
- var handleSelectedFilterWithPosition = function (filter) {
12170
- if (filter) {
12171
- var position = calculateDropdownPosition({
12172
- filterSection: filter,
12173
- headerRef: headerRef,
12174
- locationsButtonRef: locationsButtonRef,
12175
- datesButtonRef: datesButtonRef,
12176
- guestsButtonRef: guestsButtonRef,
12177
- isMobile: isMobile,
12178
- });
12179
- setDropdownStyle(position);
12171
+ var localStyles = usePanelPosition({
12172
+ selectedFilter: selectedFilter,
12173
+ panelRef: panelRef,
12174
+ targetFilterBarRef: targetFilterBarRef,
12175
+ buttonRefs: buttonRefs,
12176
+ isMobile: isMobile,
12177
+ }).localStyles;
12178
+ var renderContent = function () {
12179
+ switch (selectedFilter) {
12180
+ case FilterSections.CALENDAR:
12181
+ return (React.createElement(Dates, { autoFocus: true, ref: filtersRef, onClose: function () { return handleSelectedFilter(false); }, calendarRange: calendarRange, setCalendarRange: setCalendarRange, disableCalendarDates: disableCalendarDates, selectedPath: selectedPath, language: language }));
12182
+ case FilterSections.GUESTS:
12183
+ return (React.createElement(Guests, { autoFocus: true, ref: filtersRef, ageCategories: ageCategories, ageCategoryCounts: ageCategoryCounts, updateGuestsCount: updateGuestsCount, onClose: function () { return handleSelectedFilter(false); } }));
12184
+ case FilterSections.CATEGORIES:
12185
+ return (React.createElement(Categories, { categories: categories, setCategories: setCategories }));
12186
+ case FilterSections.LOCATIONS:
12187
+ return (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); } }));
12188
+ default:
12189
+ return null;
12180
12190
  }
12181
- handleSelectedFilter(filter);
12182
12191
  };
12192
+ return (selectedFilter && (React.createElement("div", { ref: panelRef, className: "will-filter-bar-panels ".concat(mode || 'light'), style: (!tabs || tabs.length < 2) && !isMobile
12193
+ ? { top: 66 }
12194
+ : __assign$2({}, localStyles) }, renderContent())));
12195
+ };
12196
+
12197
+ var css_248z$4 = ".will-filter-bar-controls {\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-controls {\n flex-direction: column;\n padding: 20px;\n border-radius: 25px;\n overflow: hidden;\n }\n}\n";
12198
+ styleInject(css_248z$4);
12199
+
12200
+ var FilterControls = function () {
12201
+ var _a;
12202
+ var t = useTranslation('filterBar').t;
12203
+ var _b = useFilterBar(), calendarRange = _b.calendarRange, selectedFilter = _b.selectedFilter, selectedPath = _b.selectedPath, ageCategoryCounts = _b.ageCategoryCounts, selectedLocations = _b.selectedLocations, mode = _b.mode, tabs = _b.tabs, ageCategories = _b.ageCategories, locations = _b.locations, innerLoading = _b.innerLoading, outerLoading = _b.outerLoading, handleSubmit = _b.handleSubmit, handleSelectedFilter = _b.handleSelectedFilter,
12204
+ // Refs
12205
+ previouslyFocusedButtonRef = _b.previouslyFocusedButtonRef, buttonRefs = _b.buttonRefs,
12206
+ //
12207
+ targetFilterBarRef = _b.targetFilterBarRef;
12183
12208
  // Store previously focused button and restore focus when closing
12184
12209
  React.useEffect(function () {
12185
12210
  if (!selectedFilter && previouslyFocusedButtonRef.current) {
@@ -12187,8 +12212,6 @@
12187
12212
  previouslyFocusedButtonRef.current = null;
12188
12213
  }
12189
12214
  }, [selectedFilter]);
12190
- // Display component after fully loaded
12191
- useAwaitRender();
12192
12215
  // Parsed data for filter section description
12193
12216
  var parsedDates = parseDates({ calendarRange: calendarRange });
12194
12217
  var parsedGuests = parseGuests({
@@ -12203,66 +12226,68 @@
12203
12226
  locationsPlaceholder: t('locations.placeholder'),
12204
12227
  locationsSelectedLabel: t('locations.selected'),
12205
12228
  });
12206
- return (React.createElement("div", { className: "will-root ".concat(fullWidth ? 'is-full-width' : ''), style: themePalette },
12207
- tabs && tabs.length > 1 && (React.createElement("div", { className: "will-filter-bar-tabs", ref: targetFilterBarRef }, tabs
12208
- .sort(function (a, b) { return a.order - b.order; })
12209
- .map(function (tab, idx) { return (React.createElement(TabButton, { key: "tab-".concat(idx), label: tab.label || t("tabs.".concat(tab.path.substring(1))), onClick: function () {
12210
- setSelectedPath(tab.path);
12211
- handleResetFilters();
12212
- handleSelectedFilter(false);
12213
- }, active: selectedPath === tab.path, mode: mode })); }))),
12214
- React.createElement("div", { className: "will-filter-bar-header ".concat(mode || 'light'), ref: function (el) {
12215
- headerRef.current = el;
12216
- if ((tabs === null || tabs === void 0 ? void 0 : tabs.length) === 1 && targetFilterBarRef) {
12217
- targetFilterBarRef.current = el;
12218
- }
12219
- } },
12220
- !!((_b = locations === null || locations === void 0 ? void 0 : locations.data) === null || _b === void 0 ? void 0 : _b.length) && (React.createElement(React.Fragment, null,
12221
- React.createElement(SelectButton, { ref: locationsButtonRef, label: t('locations.label'), description: parsedLocations, onClick: function () {
12222
- previouslyFocusedButtonRef.current = locationsButtonRef.current;
12223
- handleSelectedFilterWithPosition(FilterSections.LOCATIONS);
12224
- }, active: !!selectedLocations.length, disabled: locations === null || locations === void 0 ? void 0 : locations.disabled, ariaExpanded: selectedFilter === FilterSections.LOCATIONS, ariaControls: "will-locations-filter" }),
12225
- React.createElement(Divider, null))),
12226
- React.createElement(SelectButton, { ref: datesButtonRef, label: t('calendar.label'), description: parsedDates
12227
- ? parsedDates
12228
- : selectedPath === Pages.ROOMS
12229
- ? t('calendar.roomsLabelPlaceholder')
12230
- : t('calendar.eventsLabelPlaceholder'), onClick: function () {
12231
- previouslyFocusedButtonRef.current = datesButtonRef.current;
12232
- handleSelectedFilterWithPosition(FilterSections.CALENDAR);
12233
- }, active: !!parsedDates, ariaExpanded: selectedFilter === FilterSections.CALENDAR, ariaControls: "will-calendar-filter" }),
12234
- selectedPath !== Pages.EVENTS && (React.createElement(React.Fragment, null,
12235
- React.createElement(Divider, null),
12236
- React.createElement(SelectButton, { ref: guestsButtonRef, label: t('guests.label'), description: parsedGuests.content, onClick: function () {
12237
- previouslyFocusedButtonRef.current = guestsButtonRef.current;
12238
- handleSelectedFilterWithPosition(FilterSections.GUESTS);
12239
- }, active: !!parsedGuests.data.total, ariaExpanded: selectedFilter === FilterSections.GUESTS, ariaControls: "will-guests-filter" }))),
12240
- React.createElement(SubmitButton, { onClick: handleSubmit, startIcon: React.createElement(FaSearch, null), label: t('common:search'), isLoading: innerLoading || outerLoading })),
12241
- selectedFilter && (React.createElement("div", { className: "will-filter-bar-container ".concat(mode || 'light'), style: __assign$2(__assign$2({}, ((!tabs || tabs.length < 2) && !isMobile ? { top: 66 } : {})), dropdownStyle) },
12242
- selectedFilter === FilterSections.CALENDAR && (React.createElement("div", { id: "will-dates-filter" },
12243
- React.createElement(Dates, { autoFocus: true, ref: filtersRef, onClose: function () { return handleSelectedFilter(false); }, calendarRange: calendarRange, setCalendarRange: setCalendarRange, disableCalendarDates: disableCalendarDates, selectedPath: selectedPath, language: language, filtersRef: filtersRef }))),
12244
- selectedFilter === FilterSections.GUESTS && (React.createElement("div", { id: "will-guests-filter" },
12245
- React.createElement(Guests, { updateGuestsCount: updateGuestsCount, ageCategories: ageCategories, ageCategoryCounts: ageCategoryCounts, ref: filtersRef, autoFocus: true, onClose: function () { return handleSelectedFilter(false); } }))),
12246
- selectedFilter === FilterSections.CATEGORIES && (React.createElement("div", { id: "will-categories-filter" },
12247
- React.createElement(Categories, { categories: categories, setCategories: setCategories }))),
12248
- selectedFilter === FilterSections.LOCATIONS && (React.createElement("div", { id: "will-locations-filter" },
12249
- 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); } })))))));
12250
- }
12229
+ return (React.createElement("div", { className: "will-filter-bar-controls ".concat(mode || 'light'), ref: (tabs === null || tabs === void 0 ? void 0 : tabs.length) === 1 ? targetFilterBarRef : null },
12230
+ !!((_a = locations === null || locations === void 0 ? void 0 : locations.data) === null || _a === void 0 ? void 0 : _a.length) && (React.createElement(React.Fragment, null,
12231
+ React.createElement(SelectButton, { ref: function (el) { return (buttonRefs.current[FilterSections.LOCATIONS] = el); }, label: t('locations.label'), description: parsedLocations, onClick: function (e) {
12232
+ previouslyFocusedButtonRef.current = e.currentTarget;
12233
+ handleSelectedFilter(FilterSections.LOCATIONS);
12234
+ }, active: !!selectedLocations.length, disabled: locations === null || locations === void 0 ? void 0 : locations.disabled, ariaExpanded: selectedFilter === FilterSections.LOCATIONS, ariaControls: "will-filter-bar-locations" }),
12235
+ React.createElement(Divider, null))),
12236
+ React.createElement(SelectButton, { ref: function (el) { return (buttonRefs.current[FilterSections.CALENDAR] = el); }, label: t('calendar.label'), description: parsedDates
12237
+ ? parsedDates
12238
+ : selectedPath === Pages.ROOMS
12239
+ ? t('calendar.roomsLabelPlaceholder')
12240
+ : t('calendar.eventsLabelPlaceholder'), onClick: function (e) {
12241
+ previouslyFocusedButtonRef.current = e.currentTarget;
12242
+ handleSelectedFilter(FilterSections.CALENDAR);
12243
+ }, active: !!parsedDates, ariaExpanded: selectedFilter === FilterSections.CALENDAR, ariaControls: "will-filter-bar-dates" }),
12244
+ selectedPath !== Pages.EVENTS && (React.createElement(React.Fragment, null,
12245
+ React.createElement(Divider, null),
12246
+ React.createElement(SelectButton, { ref: function (el) { return (buttonRefs.current[FilterSections.GUESTS] = el); }, label: t('guests.label'), description: parsedGuests.content, onClick: function (e) {
12247
+ previouslyFocusedButtonRef.current = e.currentTarget;
12248
+ handleSelectedFilter(FilterSections.GUESTS);
12249
+ }, active: !!parsedGuests.data.total, ariaExpanded: selectedFilter === FilterSections.GUESTS, ariaControls: "will-guests-filter" }))),
12250
+ React.createElement(SubmitButton, { onClick: handleSubmit, startIcon: React.createElement(FaSearch, null), label: t('common:search'), isLoading: innerLoading || outerLoading })));
12251
+ };
12252
+
12253
+ var css_248z$3 = ".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";
12254
+ styleInject(css_248z$3);
12255
+
12256
+ var FilterTabs = function () {
12257
+ var t = useTranslation('filterBar').t;
12258
+ var _a = useFilterBar(), selectedPath = _a.selectedPath, mode = _a.mode, tabs = _a.tabs, handleSelectedFilter = _a.handleSelectedFilter, setSelectedPath = _a.setSelectedPath, handleResetFilters = _a.handleResetFilters,
12259
+ //
12260
+ targetFilterBarRef = _a.targetFilterBarRef;
12261
+ return (tabs &&
12262
+ tabs.length > 1 && (React.createElement("div", { className: "will-filter-bar-tabs", ref: targetFilterBarRef }, tabs
12263
+ .sort(function (a, b) { return a.order - b.order; })
12264
+ .map(function (tab, idx) { return (React.createElement(TabButton, { key: "tab-".concat(idx), label: tab.label || t("tabs.".concat(tab.path.substring(1))), onClick: function () {
12265
+ setSelectedPath(tab.path);
12266
+ handleResetFilters();
12267
+ handleSelectedFilter(false);
12268
+ }, active: selectedPath === tab.path, mode: mode })); }))));
12269
+ };
12270
+
12271
+ var css_248z$2 = "@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";
12272
+ styleInject(css_248z$2);
12273
+
12274
+ var css_248z$1 = ".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/* Common */\n\n.will-filter-bar-controls.dark,\n.will-filter-bar-panels.dark {\n box-shadow: var(--will-box-shadow-dark);\n}\n\n.will-filter-bar-controls.light,\n.will-filter-bar-panels.light {\n box-shadow: var(--will-box-shadow-light);\n}\n";
12275
+ styleInject(css_248z$1);
12276
+
12277
+ var FilterBar = function (_a) {
12278
+ var _b = _a.language, language = _b === void 0 ? LANGUAGE_FALLBACK : _b, ageCategories = _a.ageCategories, _c = _a.redirectUrl, redirectUrl = _c === void 0 ? REDIRECT_URL_FALLBACK : _c, palette = _a.palette, onSubmit = _a.onSubmit, fullWidth = _a.fullWidth, disableCalendarDates = _a.disableCalendarDates, mode = _a.mode, tabs = _a.tabs, outerLoading = _a.outerLoading, locations = _a.locations;
12279
+ var themePalette = useTheme({ palette: palette });
12280
+ // Translations
12281
+ useUpdateTranslations({ language: language });
12282
+ // Display component after fully loaded
12283
+ useAwaitRender();
12284
+ return (React.createElement(FilterBarProvider, { language: language, ageCategories: ageCategories, redirectUrl: redirectUrl, palette: palette, onSubmit: onSubmit, fullWidth: fullWidth, disableCalendarDates: disableCalendarDates, mode: mode, tabs: tabs, outerLoading: outerLoading, locations: locations },
12285
+ React.createElement("div", { className: "will-root ".concat(fullWidth ? 'is-full-width' : ''), style: themePalette },
12286
+ React.createElement(FilterTabs, null),
12287
+ React.createElement(FilterControls, null),
12288
+ React.createElement(FilterPanels, null))));
12289
+ };
12251
12290
  ////////////
12252
- var AGE_CATEGORIES_FALLBACK = [
12253
- {
12254
- id: '1',
12255
- name: 'Adults',
12256
- sortOrder: 1,
12257
- minVal: 0,
12258
- },
12259
- {
12260
- id: '2',
12261
- name: 'Kids',
12262
- sortOrder: 2,
12263
- minVal: 0,
12264
- },
12265
- ];
12266
12291
  var REDIRECT_URL_FALLBACK = 'http://localhost:3000/';
12267
12292
  var LANGUAGE_FALLBACK = 'en';
12268
12293