willba-component-library 0.2.98 → 0.2.99

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.
@@ -2,4 +2,4 @@ import React from 'react';
2
2
  import '../../themes/Default.css';
3
3
  import { FilterBarTypes } from './FilterBarTypes';
4
4
  import './FilterBar.css';
5
- export default function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, outerLoading, siteId, }: FilterBarTypes): React.JSX.Element;
5
+ export default function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, outerLoading, siteIds, }: FilterBarTypes): React.JSX.Element;
@@ -11,7 +11,7 @@ export type FilterBarTypes = {
11
11
  mode?: string;
12
12
  tabs?: Tab[];
13
13
  outerLoading?: boolean;
14
- siteId?: string;
14
+ siteIds?: string[];
15
15
  };
16
16
  export type AgeCategoryCount = {
17
17
  [categoryId: string]: number;
@@ -6,9 +6,9 @@ type Props = {
6
6
  ageCategories?: AgeCategoryType[];
7
7
  onSubmit?: ((val: Filters) => void) | null;
8
8
  tabs?: Tab[];
9
- siteId?: string;
9
+ siteIds?: string[];
10
10
  };
11
- export declare const useFilterBar: ({ redirectUrl, ageCategories, onSubmit, tabs, siteId, }: Props) => {
11
+ export declare const useFilterBar: ({ redirectUrl, ageCategories, onSubmit, tabs, siteIds, }: Props) => {
12
12
  selectedFilter: string | boolean;
13
13
  ageCategoryCounts: AgeCategoryCount;
14
14
  categories: number;
package/lib/index.d.ts CHANGED
@@ -90,7 +90,7 @@ type FilterBarTypes = {
90
90
  mode?: string;
91
91
  tabs?: Tab[];
92
92
  outerLoading?: boolean;
93
- siteId?: string;
93
+ siteIds?: string[];
94
94
  };
95
95
  type AgeCategoryType = {
96
96
  id: string;
@@ -113,7 +113,7 @@ type Tab = {
113
113
  label?: Translations;
114
114
  };
115
115
 
116
- declare function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, outerLoading, siteId, }: FilterBarTypes): React.JSX.Element;
116
+ declare function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, outerLoading, siteIds, }: FilterBarTypes): React.JSX.Element;
117
117
 
118
118
  interface FilterCalendarTypes extends Partial<CalendarTypes> {
119
119
  palette: Palette;
package/lib/index.esm.js CHANGED
@@ -11655,7 +11655,7 @@ var Pages;
11655
11655
  })(Pages || (Pages = {}));
11656
11656
 
11657
11657
  var useFilterBar = function (_a) {
11658
- var redirectUrl = _a.redirectUrl, ageCategories = _a.ageCategories, onSubmit = _a.onSubmit, tabs = _a.tabs, siteId = _a.siteId;
11658
+ var redirectUrl = _a.redirectUrl, ageCategories = _a.ageCategories, onSubmit = _a.onSubmit, tabs = _a.tabs, siteIds = _a.siteIds;
11659
11659
  var _b = __read(useState(Pages.EVENTS), 2), selectedPath = _b[0], setSelectedPath = _b[1];
11660
11660
  var _c = __read(useState(false), 2), selectedFilter = _c[0], setSelectedFilter = _c[1];
11661
11661
  var _d = __read(useState(), 2), calendarRange = _d[0], setCalendarRange = _d[1];
@@ -11747,14 +11747,16 @@ var useFilterBar = function (_a) {
11747
11747
  onSubmit(newParams);
11748
11748
  }
11749
11749
  else {
11750
- var siteIdParam = siteId ? "siteId=".concat(siteId) : '';
11751
- var querySearchParam = querySearchParams
11752
- ? querySearchParams.toString()
11753
- : '';
11754
- var params = [siteIdParam, querySearchParam].filter(Boolean).join('&');
11750
+ var params_1 = new URLSearchParams(querySearchParams !== null && querySearchParams !== void 0 ? querySearchParams : undefined);
11751
+ if (siteIds) {
11752
+ siteIds.forEach(function (id) {
11753
+ params_1.append('siteId', id);
11754
+ });
11755
+ }
11756
+ var paramString = params_1.toString();
11755
11757
  var path = "".concat(redirectUrl).concat(selectedPath);
11756
11758
  setInnerLoading(true);
11757
- window.location.href = params ? "".concat(path, "?").concat(params) : path;
11759
+ window.location.href = paramString ? "".concat(path, "?").concat(paramString) : path;
11758
11760
  }
11759
11761
  };
11760
11762
  var handleResetFilters = function () {
@@ -11919,7 +11921,7 @@ var css_248z$1 = ".will-root {\n z-index: 999;\n width: fit-content;\n min-wi
11919
11921
  styleInject(css_248z$1);
11920
11922
 
11921
11923
  function FilterBar(_a) {
11922
- var language = _a.language, _b = _a.ageCategories, ageCategories = _b === void 0 ? AGE_CATEGORIES_FALLBACK : _b, _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, siteId = _a.siteId;
11924
+ var language = _a.language, _b = _a.ageCategories, ageCategories = _b === void 0 ? AGE_CATEGORIES_FALLBACK : _b, _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, siteIds = _a.siteIds;
11923
11925
  var themePalette = useTheme({ palette: palette });
11924
11926
  // Translations
11925
11927
  useUpdateTranslations({ language: language });
@@ -11930,7 +11932,7 @@ function FilterBar(_a) {
11930
11932
  ageCategories: ageCategories,
11931
11933
  onSubmit: onSubmit,
11932
11934
  tabs: tabs,
11933
- siteId: siteId,
11935
+ siteIds: siteIds,
11934
11936
  }), selectedFilter = _d.selectedFilter, ageCategoryCounts = _d.ageCategoryCounts, categories = _d.categories, calendarRange = _d.calendarRange, selectedPath = _d.selectedPath, innerLoading = _d.innerLoading, setCalendarRange = _d.setCalendarRange, setCategories = _d.setCategories, handleSelectedFilter = _d.handleSelectedFilter, handleSubmit = _d.handleSubmit, updateGuestsCount = _d.updateGuestsCount, setSelectedPath = _d.setSelectedPath, handleResetFilters = _d.handleResetFilters;
11935
11937
  // Scroll in to view
11936
11938
  var _e = useScrollInToView({ selectedFilter: selectedFilter }), isMobile = _e.isMobile, targetFilterBarRef = _e.targetFilterBarRef;