willba-component-library 0.3.19 → 0.3.21
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/README.md +1 -1
- package/lib/components/FilterBar/components/FilterPanels/Locations/Locations.d.ts +0 -1
- package/lib/components/FilterBar/components/FilterTabs/FilterTabs.d.ts +1 -1
- package/lib/components/FilterBar/hooks/index.d.ts +1 -1
- package/lib/components/FilterBar/hooks/useFilterRefs.d.ts +8 -0
- package/lib/components/FilterBar/hooks/useFilterUi.d.ts +2 -1
- package/lib/components/FilterBar/hooks/usePanelPosition.d.ts +2 -2
- package/lib/components/FilterBar/hooks/useScrollInToView.d.ts +1 -1
- package/lib/components/FilterBar/providers/FilterBarProvider.d.ts +3 -2
- package/lib/core/hooks/useCloseFilterSection.d.ts +1 -1
- package/lib/index.esm.js +57 -57
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +57 -57
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +57 -57
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.tsx +1 -2
- package/src/components/FilterBar/components/FilterControls/FilterControls.tsx +10 -6
- package/src/components/FilterBar/components/FilterPanels/Dates/Dates.css +7 -1
- package/src/components/FilterBar/components/FilterPanels/FilterPanels.tsx +10 -12
- package/src/components/FilterBar/components/FilterPanels/Guests/Guests.css +2 -1
- package/src/components/FilterBar/components/FilterPanels/Locations/Locations.tsx +1 -3
- package/src/components/FilterBar/components/FilterPanels/SectionHeader/SectionHeader.css +5 -1
- package/src/components/FilterBar/components/FilterTabs/FilterTabs.tsx +26 -23
- package/src/components/FilterBar/components/ImageCard/ImageCard.css +7 -1
- package/src/components/FilterBar/hooks/index.ts +1 -1
- package/src/components/FilterBar/hooks/{useFilterUi.tsx → useFilterRefs.tsx} +5 -3
- package/src/components/FilterBar/hooks/usePanelPosition.tsx +4 -4
- package/src/components/FilterBar/hooks/useScrollInToView.tsx +4 -4
- package/src/components/FilterBar/providers/FilterBarProvider.tsx +8 -6
- package/src/components/FilterCalendar/FilterCalendar.tsx +2 -2
- package/src/core/hooks/useCloseFilterSection.tsx +5 -5
package/README.md
CHANGED
|
@@ -107,7 +107,7 @@ ReactDOM.render(<App />, document.querySelector('#app'))
|
|
|
107
107
|
|
|
108
108
|
<script src="https://unpkg.com/react@18.3.1/umd/react.production.min.js"></script>
|
|
109
109
|
<script src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.production.min.js"></script>
|
|
110
|
-
<script src="https://cdn.jsdelivr.net/npm/willba-component-library@0.3.
|
|
110
|
+
<script src="https://cdn.jsdelivr.net/npm/willba-component-library@0.3.21/lib/index.umd.js"></script>
|
|
111
111
|
|
|
112
112
|
<script>
|
|
113
113
|
const renderFilterBar = async () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { useScrollInToView } from './useScrollInToView';
|
|
2
2
|
export { useFilterState } from './useFilterState';
|
|
3
3
|
export { useFilterActions } from './useFilterActions';
|
|
4
|
-
export {
|
|
4
|
+
export { useFilterRefs } from './useFilterRefs';
|
|
5
5
|
export { usePanelPosition } from './usePanelPosition';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const useFilterRefs: (selectedFilter: string | boolean) => {
|
|
2
|
+
previouslyFocusedButtonRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
3
|
+
isMobile: boolean;
|
|
4
|
+
tabsRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
5
|
+
panelRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
6
|
+
buttonRefs: import("react").MutableRefObject<Record<string, HTMLButtonElement | null>>;
|
|
7
|
+
filtersRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
8
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare const useFilterUi: (selectedFilter: string | boolean) => {
|
|
2
2
|
previouslyFocusedButtonRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
3
3
|
isMobile: boolean;
|
|
4
|
-
|
|
4
|
+
tabsRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
5
5
|
panelRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
6
6
|
buttonRefs: import("react").MutableRefObject<Record<string, HTMLButtonElement | null>>;
|
|
7
|
+
filtersRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
7
8
|
};
|
|
@@ -2,11 +2,11 @@ import { CSSProperties, MutableRefObject, RefObject } from 'react';
|
|
|
2
2
|
type Props = {
|
|
3
3
|
selectedFilter: string | boolean;
|
|
4
4
|
panelRef: RefObject<HTMLDivElement | null>;
|
|
5
|
-
|
|
5
|
+
filtersRef: RefObject<HTMLDivElement | null>;
|
|
6
6
|
buttonRefs: MutableRefObject<Record<string, HTMLButtonElement | null>>;
|
|
7
7
|
isMobile: boolean;
|
|
8
8
|
};
|
|
9
|
-
export declare const usePanelPosition: ({ selectedFilter, panelRef,
|
|
9
|
+
export declare const usePanelPosition: ({ selectedFilter, panelRef, filtersRef, buttonRefs, isMobile, }: Props) => {
|
|
10
10
|
localStyles: CSSProperties;
|
|
11
11
|
};
|
|
12
12
|
export {};
|
|
@@ -3,6 +3,6 @@ type Props = {
|
|
|
3
3
|
};
|
|
4
4
|
export declare const useScrollInToView: ({ selectedFilter }: Props) => {
|
|
5
5
|
isMobile: boolean;
|
|
6
|
-
|
|
6
|
+
tabsRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
7
7
|
};
|
|
8
8
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { PropsWithChildren,
|
|
1
|
+
import React, { PropsWithChildren, MutableRefObject } from 'react';
|
|
2
2
|
import { DateRange } from 'react-day-picker';
|
|
3
3
|
import { AgeCategoryCount, Location, FilterBarTypes } from '../FilterBarTypes';
|
|
4
4
|
type FilterBarProviderProps = PropsWithChildren<FilterBarTypes>;
|
|
@@ -23,8 +23,9 @@ type FilterBarContextType = FilterBarTypes & {
|
|
|
23
23
|
previouslyFocusedButtonRef: MutableRefObject<HTMLButtonElement | null>;
|
|
24
24
|
panelRef: MutableRefObject<HTMLDivElement | null>;
|
|
25
25
|
buttonRefs: MutableRefObject<Record<string, HTMLButtonElement | null>>;
|
|
26
|
+
filtersRef: MutableRefObject<HTMLDivElement | null>;
|
|
26
27
|
isMobile: boolean;
|
|
27
|
-
|
|
28
|
+
tabsRef: MutableRefObject<HTMLDivElement | null>;
|
|
28
29
|
};
|
|
29
30
|
export declare const FilterBarProvider: ({ children, language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, outerLoading, locations, }: FilterBarProviderProps) => React.JSX.Element;
|
|
30
31
|
export declare const useFilterBar: () => FilterBarContextType;
|
|
@@ -2,6 +2,6 @@ type Props = {
|
|
|
2
2
|
handleSelectedFilter: (arg: boolean) => void;
|
|
3
3
|
};
|
|
4
4
|
export declare const useCloseFilterSection: ({ handleSelectedFilter }: Props) => {
|
|
5
|
-
|
|
5
|
+
filterSectionRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
6
6
|
};
|
|
7
7
|
export {};
|
package/lib/index.esm.js
CHANGED
|
@@ -2879,11 +2879,11 @@ var useUpdateTranslations = function (_a) {
|
|
|
2879
2879
|
// TODO - Refactor and rename this hook
|
|
2880
2880
|
var useCloseFilterSection = function (_a) {
|
|
2881
2881
|
var handleSelectedFilter = _a.handleSelectedFilter;
|
|
2882
|
-
var
|
|
2882
|
+
var filterSectionRef = useRef(null);
|
|
2883
2883
|
useEffect(function () {
|
|
2884
2884
|
var handleClickOutside = function (event) {
|
|
2885
|
-
if (
|
|
2886
|
-
!
|
|
2885
|
+
if (filterSectionRef.current &&
|
|
2886
|
+
!filterSectionRef.current.contains(event.target)) {
|
|
2887
2887
|
handleSelectedFilter(false);
|
|
2888
2888
|
}
|
|
2889
2889
|
};
|
|
@@ -2891,8 +2891,8 @@ var useCloseFilterSection = function (_a) {
|
|
|
2891
2891
|
return function () {
|
|
2892
2892
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
2893
2893
|
};
|
|
2894
|
-
}, [
|
|
2895
|
-
return {
|
|
2894
|
+
}, [filterSectionRef]);
|
|
2895
|
+
return { filterSectionRef: filterSectionRef };
|
|
2896
2896
|
};
|
|
2897
2897
|
|
|
2898
2898
|
var useAutoFocus = function (autoFocus) {
|
|
@@ -2962,22 +2962,22 @@ var Pages;
|
|
|
2962
2962
|
var useScrollInToView = function (_a) {
|
|
2963
2963
|
var selectedFilter = _a.selectedFilter;
|
|
2964
2964
|
var _b = __read(useState(true), 2), isMobile = _b[0], setIsMobile = _b[1];
|
|
2965
|
-
var
|
|
2965
|
+
var tabsRef = useRef(null);
|
|
2966
2966
|
useEffect(function () {
|
|
2967
2967
|
if (typeof window !== 'undefined' && window.innerWidth > 960) {
|
|
2968
2968
|
setIsMobile(false);
|
|
2969
2969
|
return;
|
|
2970
2970
|
}
|
|
2971
|
-
if (
|
|
2971
|
+
if (tabsRef.current && selectedFilter) {
|
|
2972
2972
|
window.scrollTo({
|
|
2973
2973
|
behavior: 'smooth',
|
|
2974
|
-
top:
|
|
2974
|
+
top: tabsRef.current.getBoundingClientRect().top -
|
|
2975
2975
|
document.body.getBoundingClientRect().top -
|
|
2976
2976
|
30,
|
|
2977
2977
|
});
|
|
2978
2978
|
}
|
|
2979
2979
|
}, [selectedFilter]);
|
|
2980
|
-
return { isMobile: isMobile,
|
|
2980
|
+
return { isMobile: isMobile, tabsRef: tabsRef };
|
|
2981
2981
|
};
|
|
2982
2982
|
|
|
2983
2983
|
var useFilterState = function (_a) {
|
|
@@ -6811,22 +6811,24 @@ var useFilterActions = function (_a) {
|
|
|
6811
6811
|
};
|
|
6812
6812
|
};
|
|
6813
6813
|
|
|
6814
|
-
var
|
|
6814
|
+
var useFilterRefs = function (selectedFilter) {
|
|
6815
6815
|
var buttonRefs = useRef({});
|
|
6816
6816
|
var panelRef = useRef(null);
|
|
6817
6817
|
var previouslyFocusedButtonRef = useRef(null);
|
|
6818
|
-
var
|
|
6818
|
+
var filtersRef = useRef(null);
|
|
6819
|
+
var _a = useScrollInToView({ selectedFilter: selectedFilter }), isMobile = _a.isMobile, tabsRef = _a.tabsRef;
|
|
6819
6820
|
return {
|
|
6820
6821
|
previouslyFocusedButtonRef: previouslyFocusedButtonRef,
|
|
6821
6822
|
isMobile: isMobile,
|
|
6822
|
-
|
|
6823
|
+
tabsRef: tabsRef,
|
|
6823
6824
|
panelRef: panelRef,
|
|
6824
6825
|
buttonRefs: buttonRefs,
|
|
6826
|
+
filtersRef: filtersRef,
|
|
6825
6827
|
};
|
|
6826
6828
|
};
|
|
6827
6829
|
|
|
6828
6830
|
var usePanelPosition = function (_a) {
|
|
6829
|
-
var selectedFilter = _a.selectedFilter, panelRef = _a.panelRef,
|
|
6831
|
+
var selectedFilter = _a.selectedFilter, panelRef = _a.panelRef, filtersRef = _a.filtersRef, buttonRefs = _a.buttonRefs, isMobile = _a.isMobile;
|
|
6830
6832
|
var _b = __read(useState({}), 2), localStyles = _b[0], setLocalStyles = _b[1];
|
|
6831
6833
|
useLayoutEffect(function () {
|
|
6832
6834
|
if (!selectedFilter || typeof selectedFilter !== 'string' || isMobile) {
|
|
@@ -6834,14 +6836,14 @@ var usePanelPosition = function (_a) {
|
|
|
6834
6836
|
return;
|
|
6835
6837
|
}
|
|
6836
6838
|
var panel = panelRef.current;
|
|
6837
|
-
var container =
|
|
6839
|
+
var container = filtersRef.current;
|
|
6838
6840
|
var button = buttonRefs.current[selectedFilter];
|
|
6839
6841
|
if (!panel || !container || !button)
|
|
6840
6842
|
return;
|
|
6841
6843
|
var panelRect = panel.getBoundingClientRect();
|
|
6842
6844
|
var containerRect = container.getBoundingClientRect();
|
|
6843
6845
|
var buttonRect = button.getBoundingClientRect();
|
|
6844
|
-
var buttonLeft = buttonRect.left - containerRect.left;
|
|
6846
|
+
var buttonLeft = buttonRect.left - containerRect.left - 30; // Offset by 30px to account for controls section spacing
|
|
6845
6847
|
var left = Math.max(0, Math.min(buttonLeft, containerRect.width - panelRect.width));
|
|
6846
6848
|
setLocalStyles({ left: left });
|
|
6847
6849
|
}, [selectedFilter, isMobile]);
|
|
@@ -6867,8 +6869,8 @@ var FilterBarProvider = function (_a) {
|
|
|
6867
6869
|
onSubmit: onSubmit,
|
|
6868
6870
|
setInnerLoading: setInnerLoading,
|
|
6869
6871
|
});
|
|
6870
|
-
var
|
|
6871
|
-
var contextValue = 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 }),
|
|
6872
|
+
var filterRefs = useFilterRefs(selectedFilter);
|
|
6873
|
+
var contextValue = 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 }), filterRefs)); }, [
|
|
6872
6874
|
selectedFilter,
|
|
6873
6875
|
ageCategoryCounts,
|
|
6874
6876
|
categories,
|
|
@@ -6887,8 +6889,9 @@ var FilterBarProvider = function (_a) {
|
|
|
6887
6889
|
tabs,
|
|
6888
6890
|
outerLoading,
|
|
6889
6891
|
locations,
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
+
filterRefs.isMobile,
|
|
6893
|
+
filterRefs.tabsRef,
|
|
6894
|
+
filterRefs.filtersRef,
|
|
6892
6895
|
]);
|
|
6893
6896
|
return (React__default.createElement(FilterBarContext.Provider, { value: contextValue }, children));
|
|
6894
6897
|
};
|
|
@@ -11987,7 +11990,7 @@ var Calendar = forwardRef(function (_a, ref) {
|
|
|
11987
11990
|
React__default.createElement(IconsSvg, { fill: (palette === null || palette === void 0 ? void 0 : palette.primary) || 'inherit', size: 50, icon: "spinner" })))));
|
|
11988
11991
|
});
|
|
11989
11992
|
|
|
11990
|
-
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";
|
|
11993
|
+
var css_248z$c = ".will-filter-section-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 16px 30px;\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-header {\n padding: 16px 20px;\n }\n\n .will-filter-section-title {\n font-size: 18px;\n }\n}\n";
|
|
11991
11994
|
styleInject(css_248z$c);
|
|
11992
11995
|
|
|
11993
11996
|
var SectionHeader = function (_a) {
|
|
@@ -11997,7 +12000,7 @@ var SectionHeader = function (_a) {
|
|
|
11997
12000
|
action && React__default.createElement("div", { className: "will-filter-section-action" }, action)));
|
|
11998
12001
|
};
|
|
11999
12002
|
|
|
12000
|
-
var css_248z$b = ".will-dates-filter-container {\n padding: 0 16px 16px
|
|
12003
|
+
var css_248z$b = ".will-dates-filter-container {\n padding: 0 30px 16px 30px;\n}\n\n@media (max-width: 960px) {\n .will-dates-filter-container {\n padding: 0 20px 16px 20px;\n }\n}\n";
|
|
12001
12004
|
styleInject(css_248z$b);
|
|
12002
12005
|
|
|
12003
12006
|
var Dates = forwardRef(function (_a, ref) {
|
|
@@ -12043,7 +12046,7 @@ var GuestCount = function (_a) {
|
|
|
12043
12046
|
React__default.createElement("path", { d: "M10 4V16M4 10H16", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }))))));
|
|
12044
12047
|
};
|
|
12045
12048
|
|
|
12046
|
-
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
|
|
12049
|
+
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 30px 16px 30px;\n}\n\n@media (max-width: 960px) {\n .will-guests-filter-container {\n min-width: auto;\n padding: 0 20px 16px 20px;\n }\n}\n\n/**/\n.will-guest-count {\n display: inline-block;\n min-width: 10px;\n}\n";
|
|
12047
12050
|
styleInject(css_248z$9);
|
|
12048
12051
|
|
|
12049
12052
|
var Guests = forwardRef(function (_a, ref) {
|
|
@@ -12056,7 +12059,7 @@ var Guests = forwardRef(function (_a, ref) {
|
|
|
12056
12059
|
});
|
|
12057
12060
|
Guests.displayName = 'Guests';
|
|
12058
12061
|
|
|
12059
|
-
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
|
|
12062
|
+
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 30px;\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\n@media (max-width: 960px) {\n .will-image-card {\n padding: 8px 20px;\n }\n}\n";
|
|
12060
12063
|
styleInject(css_248z$8);
|
|
12061
12064
|
|
|
12062
12065
|
var ImageCard = forwardRef(function (_a, ref) {
|
|
@@ -12079,7 +12082,7 @@ var css_248z$7 = "#will-filter-bar-locations {\n text-align: initial;\n}\n\n.wi
|
|
|
12079
12082
|
styleInject(css_248z$7);
|
|
12080
12083
|
|
|
12081
12084
|
var Locations = forwardRef(function (_a, ref) {
|
|
12082
|
-
var locations = _a.locations,
|
|
12085
|
+
var locations = _a.locations, selectedLocations = _a.selectedLocations, setSelectedLocations = _a.setSelectedLocations, autoFocus = _a.autoFocus, _b = _a.multiSelect, multiSelect = _b === void 0 ? false : _b, onClose = _a.onClose;
|
|
12083
12086
|
var t = useTranslation('filterBar').t;
|
|
12084
12087
|
var firstCardRef = useRef(null);
|
|
12085
12088
|
useEffect(function () {
|
|
@@ -12108,7 +12111,7 @@ var Locations = forwardRef(function (_a, ref) {
|
|
|
12108
12111
|
};
|
|
12109
12112
|
return (React__default.createElement("div", { id: "will-filter-bar-locations", ref: ref },
|
|
12110
12113
|
React__default.createElement(SectionHeader, { title: t('locations.title'), action: onClose && React__default.createElement(CloseButton, { handleClose: onClose }) }),
|
|
12111
|
-
React__default.createElement("div", { className: "will-locations-filter-container" }, !!(
|
|
12114
|
+
React__default.createElement("div", { className: "will-locations-filter-container" }, !!(locations === null || locations === void 0 ? void 0 : locations.length) &&
|
|
12112
12115
|
locations.map(function (location, index) {
|
|
12113
12116
|
return (React__default.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); } }));
|
|
12114
12117
|
}))));
|
|
@@ -12144,33 +12147,31 @@ var css_248z$5 = ".will-filter-bar-panels {\n background-color: var(--will-whit
|
|
|
12144
12147
|
styleInject(css_248z$5);
|
|
12145
12148
|
|
|
12146
12149
|
var FilterPanels = function () {
|
|
12147
|
-
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,
|
|
12150
|
+
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, filtersRef = _a.filtersRef, setSelectedLocations = _a.setSelectedLocations, setCalendarRange = _a.setCalendarRange, handleSelectedFilter = _a.handleSelectedFilter, updateGuestsCount = _a.updateGuestsCount, setCategories = _a.setCategories;
|
|
12148
12151
|
// Handle close filter section
|
|
12149
|
-
var
|
|
12152
|
+
var filterSectionRef = useCloseFilterSection({ handleSelectedFilter: handleSelectedFilter }).filterSectionRef;
|
|
12150
12153
|
var localStyles = usePanelPosition({
|
|
12151
12154
|
selectedFilter: selectedFilter,
|
|
12152
12155
|
panelRef: panelRef,
|
|
12153
|
-
|
|
12156
|
+
filtersRef: filtersRef,
|
|
12154
12157
|
buttonRefs: buttonRefs,
|
|
12155
12158
|
isMobile: isMobile,
|
|
12156
12159
|
}).localStyles;
|
|
12157
12160
|
var renderContent = function () {
|
|
12158
12161
|
switch (selectedFilter) {
|
|
12159
12162
|
case FilterSections.CALENDAR:
|
|
12160
|
-
return (React__default.createElement(Dates, { autoFocus: true, ref:
|
|
12163
|
+
return (React__default.createElement(Dates, { autoFocus: true, ref: filterSectionRef, onClose: function () { return handleSelectedFilter(false); }, calendarRange: calendarRange, setCalendarRange: setCalendarRange, disableCalendarDates: disableCalendarDates, selectedPath: selectedPath, language: language }));
|
|
12161
12164
|
case FilterSections.GUESTS:
|
|
12162
|
-
return (React__default.createElement(Guests, { autoFocus: true, ref:
|
|
12165
|
+
return (React__default.createElement(Guests, { autoFocus: true, ref: filterSectionRef, ageCategories: ageCategories, ageCategoryCounts: ageCategoryCounts, updateGuestsCount: updateGuestsCount, onClose: function () { return handleSelectedFilter(false); } }));
|
|
12163
12166
|
case FilterSections.CATEGORIES:
|
|
12164
12167
|
return (React__default.createElement(Categories, { categories: categories, setCategories: setCategories }));
|
|
12165
12168
|
case FilterSections.LOCATIONS:
|
|
12166
|
-
return (React__default.createElement(Locations, { autoFocus: true, ref:
|
|
12169
|
+
return (React__default.createElement(Locations, { autoFocus: true, ref: filterSectionRef, locations: locations === null || locations === void 0 ? void 0 : locations.data, selectedLocations: selectedLocations, setSelectedLocations: setSelectedLocations, multiSelect: locations === null || locations === void 0 ? void 0 : locations.multiSelect, onClose: function () { return handleSelectedFilter(false); } }));
|
|
12167
12170
|
default:
|
|
12168
12171
|
return null;
|
|
12169
12172
|
}
|
|
12170
12173
|
};
|
|
12171
|
-
return (selectedFilter && (React__default.createElement("div", { ref: panelRef, className: "will-filter-bar-panels ".concat(mode || 'light'), style: (!tabs || tabs.length < 2) && !isMobile
|
|
12172
|
-
? { top: 66 }
|
|
12173
|
-
: __assign$2({}, localStyles) }, renderContent())));
|
|
12174
|
+
return (selectedFilter && (React__default.createElement("div", { ref: panelRef, className: "will-filter-bar-panels ".concat(mode || 'light'), style: __assign$2(__assign$2({}, localStyles), ((!tabs || tabs.length < 2) && !isMobile ? { top: 66 } : {})) }, renderContent())));
|
|
12174
12175
|
};
|
|
12175
12176
|
|
|
12176
12177
|
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";
|
|
@@ -12179,11 +12180,7 @@ styleInject(css_248z$4);
|
|
|
12179
12180
|
var FilterControls = function () {
|
|
12180
12181
|
var _a;
|
|
12181
12182
|
var t = useTranslation('filterBar').t;
|
|
12182
|
-
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,
|
|
12183
|
-
// Refs
|
|
12184
|
-
previouslyFocusedButtonRef = _b.previouslyFocusedButtonRef, buttonRefs = _b.buttonRefs,
|
|
12185
|
-
//
|
|
12186
|
-
targetFilterBarRef = _b.targetFilterBarRef;
|
|
12183
|
+
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, previouslyFocusedButtonRef = _b.previouslyFocusedButtonRef, buttonRefs = _b.buttonRefs, tabsRef = _b.tabsRef, filtersRef = _b.filtersRef;
|
|
12187
12184
|
// Store previously focused button and restore focus when closing
|
|
12188
12185
|
useEffect(function () {
|
|
12189
12186
|
if (!selectedFilter && previouslyFocusedButtonRef.current) {
|
|
@@ -12205,8 +12202,13 @@ var FilterControls = function () {
|
|
|
12205
12202
|
locationsPlaceholder: t('locations.placeholder'),
|
|
12206
12203
|
locationsSelectedLabel: t('locations.selected'),
|
|
12207
12204
|
});
|
|
12208
|
-
return (React__default.createElement("div", { className: "will-filter-bar-controls ".concat(mode || 'light'), ref: (
|
|
12209
|
-
|
|
12205
|
+
return (React__default.createElement("div", { className: "will-filter-bar-controls ".concat(mode || 'light'), ref: function (el) {
|
|
12206
|
+
filtersRef.current = el;
|
|
12207
|
+
if ((tabs === null || tabs === void 0 ? void 0 : tabs.length) === 1) {
|
|
12208
|
+
tabsRef.current = el;
|
|
12209
|
+
}
|
|
12210
|
+
} },
|
|
12211
|
+
((_a = locations === null || locations === void 0 ? void 0 : locations.data) === null || _a === void 0 ? void 0 : _a.length) && locations.data.length > 1 && (React__default.createElement(React__default.Fragment, null,
|
|
12210
12212
|
React__default.createElement(SelectButton, { ref: function (el) { return (buttonRefs.current[FilterSections.LOCATIONS] = el); }, label: t('locations.label'), description: parsedLocations, onClick: function (e) {
|
|
12211
12213
|
previouslyFocusedButtonRef.current = e.currentTarget;
|
|
12212
12214
|
handleSelectedFilter(FilterSections.LOCATIONS);
|
|
@@ -12234,17 +12236,16 @@ styleInject(css_248z$3);
|
|
|
12234
12236
|
|
|
12235
12237
|
var FilterTabs = function () {
|
|
12236
12238
|
var t = useTranslation('filterBar').t;
|
|
12237
|
-
var _a = useFilterBar(), selectedPath = _a.selectedPath, mode = _a.mode, tabs = _a.tabs, handleSelectedFilter = _a.handleSelectedFilter, setSelectedPath = _a.setSelectedPath, handleResetFilters = _a.handleResetFilters
|
|
12238
|
-
|
|
12239
|
-
|
|
12240
|
-
|
|
12241
|
-
|
|
12242
|
-
|
|
12243
|
-
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
|
|
12247
|
-
}, active: selectedPath === tab.path, mode: mode })); }))));
|
|
12239
|
+
var _a = useFilterBar(), selectedPath = _a.selectedPath, mode = _a.mode, tabs = _a.tabs, tabsRef = _a.tabsRef, handleSelectedFilter = _a.handleSelectedFilter, setSelectedPath = _a.setSelectedPath, handleResetFilters = _a.handleResetFilters;
|
|
12240
|
+
var sortedTabs = useMemo(function () { return __spreadArray$1([], __read((tabs !== null && tabs !== void 0 ? tabs : [])), false).sort(function (a, b) { return a.order - b.order; }); }, [tabs]);
|
|
12241
|
+
var handleTabClick = function (path) {
|
|
12242
|
+
setSelectedPath(path);
|
|
12243
|
+
handleResetFilters();
|
|
12244
|
+
handleSelectedFilter(false);
|
|
12245
|
+
};
|
|
12246
|
+
if (sortedTabs.length <= 1)
|
|
12247
|
+
return null;
|
|
12248
|
+
return (React__default.createElement("div", { className: "will-filter-bar-tabs", ref: tabsRef }, sortedTabs.map(function (tab) { return (React__default.createElement(TabButton, { key: tab.path, label: tab.label || t("tabs.".concat(tab.path.slice(1))), onClick: function () { return handleTabClick(tab.path); }, active: selectedPath === tab.path, mode: mode })); })));
|
|
12248
12249
|
};
|
|
12249
12250
|
|
|
12250
12251
|
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";
|
|
@@ -12254,7 +12255,7 @@ var css_248z$1 = ".will-root {\n z-index: 999;\n width: fit-content;\n min-wi
|
|
|
12254
12255
|
styleInject(css_248z$1);
|
|
12255
12256
|
|
|
12256
12257
|
var FilterBar = function (_a) {
|
|
12257
|
-
var
|
|
12258
|
+
var language = _a.language, ageCategories = _a.ageCategories, _b = _a.redirectUrl, redirectUrl = _b === void 0 ? REDIRECT_URL_FALLBACK : _b, palette = _a.palette, onSubmit = _a.onSubmit, fullWidth = _a.fullWidth, disableCalendarDates = _a.disableCalendarDates, mode = _a.mode, tabs = _a.tabs, outerLoading = _a.outerLoading, locations = _a.locations;
|
|
12258
12259
|
var themePalette = useTheme({ palette: palette });
|
|
12259
12260
|
// Translations
|
|
12260
12261
|
useUpdateTranslations({ language: language });
|
|
@@ -12268,7 +12269,6 @@ var FilterBar = function (_a) {
|
|
|
12268
12269
|
};
|
|
12269
12270
|
////////////
|
|
12270
12271
|
var REDIRECT_URL_FALLBACK = 'http://localhost:3000/';
|
|
12271
|
-
var LANGUAGE_FALLBACK = 'en';
|
|
12272
12272
|
|
|
12273
12273
|
var useFilterCalendar = function (_a) {
|
|
12274
12274
|
var onSubmit = _a.onSubmit, setToggleCalendar = _a.setToggleCalendar, noActiveSelection = _a.noActiveSelection, toggleCalendar = _a.toggleCalendar, outerRangeContext = _a.outerRangeContext, outerDisableCalendarDates = _a.outerDisableCalendarDates;
|
|
@@ -12443,10 +12443,10 @@ function FilterCalendar(_a) {
|
|
|
12443
12443
|
// Display component after fully loaded
|
|
12444
12444
|
useAwaitRender();
|
|
12445
12445
|
// Handle close filter section
|
|
12446
|
-
var
|
|
12446
|
+
var filterSectionRef = useCloseFilterSection({
|
|
12447
12447
|
handleSelectedFilter: setToggleCalendar,
|
|
12448
|
-
}).
|
|
12449
|
-
return (React__default.createElement("div", { className: "will-root", style: themePalette }, toggleCalendar && (React__default.createElement("div", { className: "will-calendar-wrapper", ref:
|
|
12448
|
+
}).filterSectionRef;
|
|
12449
|
+
return (React__default.createElement("div", { className: "will-root", style: themePalette }, toggleCalendar && (React__default.createElement("div", { className: "will-calendar-wrapper", ref: filterSectionRef },
|
|
12450
12450
|
React__default.createElement("div", { className: "will-calendar-header" },
|
|
12451
12451
|
React__default.createElement("h2", null, t('filterBar:calendar.title')),
|
|
12452
12452
|
React__default.createElement(CloseButton, { handleClose: function () { return setToggleCalendar(false); } })),
|