willba-component-library 0.2.96 → 0.2.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/FilterBar/FilterBar.d.ts +1 -1
- package/lib/components/FilterBar/FilterBarTypes.d.ts +1 -0
- package/lib/components/FilterBar/hooks/useFilterBar.d.ts +2 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.esm.js +11 -4
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +11 -4
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +11 -4
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.stories.tsx +1 -0
- package/src/components/FilterBar/FilterBar.tsx +2 -0
- package/src/components/FilterBar/FilterBarTypes.ts +1 -0
- package/src/components/FilterBar/hooks/useFilterBar.tsx +12 -4
- package/lib/assets/SpinnerSvg.d.ts +0 -5
- package/lib/components/FilterBar/components/buttons/close-button/CloseButton.d.ts +0 -7
- package/lib/components/FilterBar/components/buttons/submit-button/SubmitButton.d.ts +0 -3
- package/lib/components/FilterBar/components/calendar/Calendar.d.ts +0 -14
- package/lib/components/FilterBar/hooks/useCloseFilterSection.d.ts +0 -8
- package/lib/components/FilterBar/hooks/useUpdateTranslations.d.ts +0 -5
- package/lib/components/FilterBar/utils/parseDates.d.ts +0 -6
- package/lib/core/utils/handleOverlappingDates.d.ts +0 -1
- package/lib/core/utils/index.d.ts +0 -3
- package/lib/core/utils/nightsCount.d.ts +0 -6
- package/lib/core/utils/parseDate.d.ts +0 -7
- package/lib/core/utils/parseDates.d.ts +0 -6
package/package.json
CHANGED
|
@@ -36,6 +36,7 @@ export default function FilterBar({
|
|
|
36
36
|
mode,
|
|
37
37
|
tabs,
|
|
38
38
|
outerLoading,
|
|
39
|
+
siteId,
|
|
39
40
|
}: FilterBarTypes) {
|
|
40
41
|
const themePalette = useTheme({ palette })
|
|
41
42
|
|
|
@@ -63,6 +64,7 @@ export default function FilterBar({
|
|
|
63
64
|
ageCategories,
|
|
64
65
|
onSubmit,
|
|
65
66
|
tabs,
|
|
67
|
+
siteId,
|
|
66
68
|
})
|
|
67
69
|
|
|
68
70
|
// Scroll in to view
|
|
@@ -15,6 +15,7 @@ type Props = {
|
|
|
15
15
|
ageCategories?: AgeCategoryType[]
|
|
16
16
|
onSubmit?: ((val: Filters) => void) | null
|
|
17
17
|
tabs?: Tab[]
|
|
18
|
+
siteId?: string
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export const useFilterBar = ({
|
|
@@ -22,6 +23,7 @@ export const useFilterBar = ({
|
|
|
22
23
|
ageCategories,
|
|
23
24
|
onSubmit,
|
|
24
25
|
tabs,
|
|
26
|
+
siteId,
|
|
25
27
|
}: Props) => {
|
|
26
28
|
const [selectedPath, setSelectedPath] = useState<string>(Pages.EVENTS)
|
|
27
29
|
const [selectedFilter, setSelectedFilter] = useState<string | boolean>(false)
|
|
@@ -115,10 +117,16 @@ export const useFilterBar = ({
|
|
|
115
117
|
if (onSubmit && window.location.href.includes(selectedPath)) {
|
|
116
118
|
onSubmit(newParams)
|
|
117
119
|
} else {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
const siteIdParam = siteId ? `siteId=${siteId}` : ''
|
|
121
|
+
const querySearchParam = querySearchParams
|
|
122
|
+
? querySearchParams.toString()
|
|
123
|
+
: ''
|
|
124
|
+
|
|
125
|
+
const params = [siteIdParam, querySearchParam].filter(Boolean).join('&')
|
|
126
|
+
const path = `${redirectUrl}${selectedPath}`
|
|
127
|
+
|
|
128
|
+
setInnerLoading(true)
|
|
129
|
+
window.location.href = params ? `${path}?${params}` : path
|
|
122
130
|
}
|
|
123
131
|
}
|
|
124
132
|
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DateRange } from 'react-day-picker';
|
|
3
|
-
import { CalendarOffset } from '../../FilterBarTypes';
|
|
4
|
-
import 'react-day-picker/dist/style.css';
|
|
5
|
-
import './Calendar.css';
|
|
6
|
-
type Props = {
|
|
7
|
-
calendarRange: DateRange | undefined;
|
|
8
|
-
setCalendarRange: (range: DateRange | undefined) => void;
|
|
9
|
-
calendarOffset?: CalendarOffset;
|
|
10
|
-
selectedPath: string;
|
|
11
|
-
locale?: string;
|
|
12
|
-
};
|
|
13
|
-
export declare const Calendar: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
type Props = {
|
|
3
|
-
handleSelectedFilter: (arg: boolean) => void;
|
|
4
|
-
};
|
|
5
|
-
export declare const useCloseFilterSection: ({ handleSelectedFilter }: Props) => {
|
|
6
|
-
filtersRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
7
|
-
};
|
|
8
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const handleOverlappingDates: () => void;
|