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/lib/index.umd.js
CHANGED
|
@@ -2901,11 +2901,11 @@
|
|
|
2901
2901
|
// TODO - Refactor and rename this hook
|
|
2902
2902
|
var useCloseFilterSection = function (_a) {
|
|
2903
2903
|
var handleSelectedFilter = _a.handleSelectedFilter;
|
|
2904
|
-
var
|
|
2904
|
+
var filterSectionRef = React.useRef(null);
|
|
2905
2905
|
React.useEffect(function () {
|
|
2906
2906
|
var handleClickOutside = function (event) {
|
|
2907
|
-
if (
|
|
2908
|
-
!
|
|
2907
|
+
if (filterSectionRef.current &&
|
|
2908
|
+
!filterSectionRef.current.contains(event.target)) {
|
|
2909
2909
|
handleSelectedFilter(false);
|
|
2910
2910
|
}
|
|
2911
2911
|
};
|
|
@@ -2913,8 +2913,8 @@
|
|
|
2913
2913
|
return function () {
|
|
2914
2914
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
2915
2915
|
};
|
|
2916
|
-
}, [
|
|
2917
|
-
return {
|
|
2916
|
+
}, [filterSectionRef]);
|
|
2917
|
+
return { filterSectionRef: filterSectionRef };
|
|
2918
2918
|
};
|
|
2919
2919
|
|
|
2920
2920
|
var useAutoFocus = function (autoFocus) {
|
|
@@ -2984,22 +2984,22 @@
|
|
|
2984
2984
|
var useScrollInToView = function (_a) {
|
|
2985
2985
|
var selectedFilter = _a.selectedFilter;
|
|
2986
2986
|
var _b = __read(React.useState(true), 2), isMobile = _b[0], setIsMobile = _b[1];
|
|
2987
|
-
var
|
|
2987
|
+
var tabsRef = React.useRef(null);
|
|
2988
2988
|
React.useEffect(function () {
|
|
2989
2989
|
if (typeof window !== 'undefined' && window.innerWidth > 960) {
|
|
2990
2990
|
setIsMobile(false);
|
|
2991
2991
|
return;
|
|
2992
2992
|
}
|
|
2993
|
-
if (
|
|
2993
|
+
if (tabsRef.current && selectedFilter) {
|
|
2994
2994
|
window.scrollTo({
|
|
2995
2995
|
behavior: 'smooth',
|
|
2996
|
-
top:
|
|
2996
|
+
top: tabsRef.current.getBoundingClientRect().top -
|
|
2997
2997
|
document.body.getBoundingClientRect().top -
|
|
2998
2998
|
30,
|
|
2999
2999
|
});
|
|
3000
3000
|
}
|
|
3001
3001
|
}, [selectedFilter]);
|
|
3002
|
-
return { isMobile: isMobile,
|
|
3002
|
+
return { isMobile: isMobile, tabsRef: tabsRef };
|
|
3003
3003
|
};
|
|
3004
3004
|
|
|
3005
3005
|
var useFilterState = function (_a) {
|
|
@@ -6833,22 +6833,24 @@
|
|
|
6833
6833
|
};
|
|
6834
6834
|
};
|
|
6835
6835
|
|
|
6836
|
-
var
|
|
6836
|
+
var useFilterRefs = function (selectedFilter) {
|
|
6837
6837
|
var buttonRefs = React.useRef({});
|
|
6838
6838
|
var panelRef = React.useRef(null);
|
|
6839
6839
|
var previouslyFocusedButtonRef = React.useRef(null);
|
|
6840
|
-
var
|
|
6840
|
+
var filtersRef = React.useRef(null);
|
|
6841
|
+
var _a = useScrollInToView({ selectedFilter: selectedFilter }), isMobile = _a.isMobile, tabsRef = _a.tabsRef;
|
|
6841
6842
|
return {
|
|
6842
6843
|
previouslyFocusedButtonRef: previouslyFocusedButtonRef,
|
|
6843
6844
|
isMobile: isMobile,
|
|
6844
|
-
|
|
6845
|
+
tabsRef: tabsRef,
|
|
6845
6846
|
panelRef: panelRef,
|
|
6846
6847
|
buttonRefs: buttonRefs,
|
|
6848
|
+
filtersRef: filtersRef,
|
|
6847
6849
|
};
|
|
6848
6850
|
};
|
|
6849
6851
|
|
|
6850
6852
|
var usePanelPosition = function (_a) {
|
|
6851
|
-
var selectedFilter = _a.selectedFilter, panelRef = _a.panelRef,
|
|
6853
|
+
var selectedFilter = _a.selectedFilter, panelRef = _a.panelRef, filtersRef = _a.filtersRef, buttonRefs = _a.buttonRefs, isMobile = _a.isMobile;
|
|
6852
6854
|
var _b = __read(React.useState({}), 2), localStyles = _b[0], setLocalStyles = _b[1];
|
|
6853
6855
|
React.useLayoutEffect(function () {
|
|
6854
6856
|
if (!selectedFilter || typeof selectedFilter !== 'string' || isMobile) {
|
|
@@ -6856,14 +6858,14 @@
|
|
|
6856
6858
|
return;
|
|
6857
6859
|
}
|
|
6858
6860
|
var panel = panelRef.current;
|
|
6859
|
-
var container =
|
|
6861
|
+
var container = filtersRef.current;
|
|
6860
6862
|
var button = buttonRefs.current[selectedFilter];
|
|
6861
6863
|
if (!panel || !container || !button)
|
|
6862
6864
|
return;
|
|
6863
6865
|
var panelRect = panel.getBoundingClientRect();
|
|
6864
6866
|
var containerRect = container.getBoundingClientRect();
|
|
6865
6867
|
var buttonRect = button.getBoundingClientRect();
|
|
6866
|
-
var buttonLeft = buttonRect.left - containerRect.left;
|
|
6868
|
+
var buttonLeft = buttonRect.left - containerRect.left - 30; // Offset by 30px to account for controls section spacing
|
|
6867
6869
|
var left = Math.max(0, Math.min(buttonLeft, containerRect.width - panelRect.width));
|
|
6868
6870
|
setLocalStyles({ left: left });
|
|
6869
6871
|
}, [selectedFilter, isMobile]);
|
|
@@ -6889,8 +6891,8 @@
|
|
|
6889
6891
|
onSubmit: onSubmit,
|
|
6890
6892
|
setInnerLoading: setInnerLoading,
|
|
6891
6893
|
});
|
|
6892
|
-
var
|
|
6893
|
-
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 }),
|
|
6894
|
+
var filterRefs = useFilterRefs(selectedFilter);
|
|
6895
|
+
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 }), filterRefs)); }, [
|
|
6894
6896
|
selectedFilter,
|
|
6895
6897
|
ageCategoryCounts,
|
|
6896
6898
|
categories,
|
|
@@ -6909,8 +6911,9 @@
|
|
|
6909
6911
|
tabs,
|
|
6910
6912
|
outerLoading,
|
|
6911
6913
|
locations,
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
+
filterRefs.isMobile,
|
|
6915
|
+
filterRefs.tabsRef,
|
|
6916
|
+
filterRefs.filtersRef,
|
|
6914
6917
|
]);
|
|
6915
6918
|
return (React.createElement(FilterBarContext.Provider, { value: contextValue }, children));
|
|
6916
6919
|
};
|
|
@@ -12009,7 +12012,7 @@
|
|
|
12009
12012
|
React.createElement(IconsSvg, { fill: (palette === null || palette === void 0 ? void 0 : palette.primary) || 'inherit', size: 50, icon: "spinner" })))));
|
|
12010
12013
|
});
|
|
12011
12014
|
|
|
12012
|
-
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";
|
|
12015
|
+
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";
|
|
12013
12016
|
styleInject(css_248z$c);
|
|
12014
12017
|
|
|
12015
12018
|
var SectionHeader = function (_a) {
|
|
@@ -12019,7 +12022,7 @@
|
|
|
12019
12022
|
action && React.createElement("div", { className: "will-filter-section-action" }, action)));
|
|
12020
12023
|
};
|
|
12021
12024
|
|
|
12022
|
-
var css_248z$b = ".will-dates-filter-container {\n padding: 0 16px 16px
|
|
12025
|
+
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";
|
|
12023
12026
|
styleInject(css_248z$b);
|
|
12024
12027
|
|
|
12025
12028
|
var Dates = React.forwardRef(function (_a, ref) {
|
|
@@ -12065,7 +12068,7 @@
|
|
|
12065
12068
|
React.createElement("path", { d: "M10 4V16M4 10H16", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }))))));
|
|
12066
12069
|
};
|
|
12067
12070
|
|
|
12068
|
-
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
|
|
12071
|
+
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";
|
|
12069
12072
|
styleInject(css_248z$9);
|
|
12070
12073
|
|
|
12071
12074
|
var Guests = React.forwardRef(function (_a, ref) {
|
|
@@ -12078,7 +12081,7 @@
|
|
|
12078
12081
|
});
|
|
12079
12082
|
Guests.displayName = 'Guests';
|
|
12080
12083
|
|
|
12081
|
-
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
|
|
12084
|
+
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";
|
|
12082
12085
|
styleInject(css_248z$8);
|
|
12083
12086
|
|
|
12084
12087
|
var ImageCard = React.forwardRef(function (_a, ref) {
|
|
@@ -12101,7 +12104,7 @@
|
|
|
12101
12104
|
styleInject(css_248z$7);
|
|
12102
12105
|
|
|
12103
12106
|
var Locations = React.forwardRef(function (_a, ref) {
|
|
12104
|
-
var locations = _a.locations,
|
|
12107
|
+
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;
|
|
12105
12108
|
var t = useTranslation('filterBar').t;
|
|
12106
12109
|
var firstCardRef = React.useRef(null);
|
|
12107
12110
|
React.useEffect(function () {
|
|
@@ -12130,7 +12133,7 @@
|
|
|
12130
12133
|
};
|
|
12131
12134
|
return (React.createElement("div", { id: "will-filter-bar-locations", ref: ref },
|
|
12132
12135
|
React.createElement(SectionHeader, { title: t('locations.title'), action: onClose && React.createElement(CloseButton, { handleClose: onClose }) }),
|
|
12133
|
-
React.createElement("div", { className: "will-locations-filter-container" }, !!(
|
|
12136
|
+
React.createElement("div", { className: "will-locations-filter-container" }, !!(locations === null || locations === void 0 ? void 0 : locations.length) &&
|
|
12134
12137
|
locations.map(function (location, index) {
|
|
12135
12138
|
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); } }));
|
|
12136
12139
|
}))));
|
|
@@ -12166,33 +12169,31 @@
|
|
|
12166
12169
|
styleInject(css_248z$5);
|
|
12167
12170
|
|
|
12168
12171
|
var FilterPanels = function () {
|
|
12169
|
-
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,
|
|
12172
|
+
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;
|
|
12170
12173
|
// Handle close filter section
|
|
12171
|
-
var
|
|
12174
|
+
var filterSectionRef = useCloseFilterSection({ handleSelectedFilter: handleSelectedFilter }).filterSectionRef;
|
|
12172
12175
|
var localStyles = usePanelPosition({
|
|
12173
12176
|
selectedFilter: selectedFilter,
|
|
12174
12177
|
panelRef: panelRef,
|
|
12175
|
-
|
|
12178
|
+
filtersRef: filtersRef,
|
|
12176
12179
|
buttonRefs: buttonRefs,
|
|
12177
12180
|
isMobile: isMobile,
|
|
12178
12181
|
}).localStyles;
|
|
12179
12182
|
var renderContent = function () {
|
|
12180
12183
|
switch (selectedFilter) {
|
|
12181
12184
|
case FilterSections.CALENDAR:
|
|
12182
|
-
return (React.createElement(Dates, { autoFocus: true, ref:
|
|
12185
|
+
return (React.createElement(Dates, { autoFocus: true, ref: filterSectionRef, onClose: function () { return handleSelectedFilter(false); }, calendarRange: calendarRange, setCalendarRange: setCalendarRange, disableCalendarDates: disableCalendarDates, selectedPath: selectedPath, language: language }));
|
|
12183
12186
|
case FilterSections.GUESTS:
|
|
12184
|
-
return (React.createElement(Guests, { autoFocus: true, ref:
|
|
12187
|
+
return (React.createElement(Guests, { autoFocus: true, ref: filterSectionRef, ageCategories: ageCategories, ageCategoryCounts: ageCategoryCounts, updateGuestsCount: updateGuestsCount, onClose: function () { return handleSelectedFilter(false); } }));
|
|
12185
12188
|
case FilterSections.CATEGORIES:
|
|
12186
12189
|
return (React.createElement(Categories, { categories: categories, setCategories: setCategories }));
|
|
12187
12190
|
case FilterSections.LOCATIONS:
|
|
12188
|
-
return (React.createElement(Locations, { autoFocus: true, ref:
|
|
12191
|
+
return (React.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); } }));
|
|
12189
12192
|
default:
|
|
12190
12193
|
return null;
|
|
12191
12194
|
}
|
|
12192
12195
|
};
|
|
12193
|
-
return (selectedFilter && (React.createElement("div", { ref: panelRef, className: "will-filter-bar-panels ".concat(mode || 'light'), style: (!tabs || tabs.length < 2) && !isMobile
|
|
12194
|
-
? { top: 66 }
|
|
12195
|
-
: __assign$2({}, localStyles) }, renderContent())));
|
|
12196
|
+
return (selectedFilter && (React.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())));
|
|
12196
12197
|
};
|
|
12197
12198
|
|
|
12198
12199
|
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";
|
|
@@ -12201,11 +12202,7 @@
|
|
|
12201
12202
|
var FilterControls = function () {
|
|
12202
12203
|
var _a;
|
|
12203
12204
|
var t = useTranslation('filterBar').t;
|
|
12204
|
-
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,
|
|
12205
|
-
// Refs
|
|
12206
|
-
previouslyFocusedButtonRef = _b.previouslyFocusedButtonRef, buttonRefs = _b.buttonRefs,
|
|
12207
|
-
//
|
|
12208
|
-
targetFilterBarRef = _b.targetFilterBarRef;
|
|
12205
|
+
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;
|
|
12209
12206
|
// Store previously focused button and restore focus when closing
|
|
12210
12207
|
React.useEffect(function () {
|
|
12211
12208
|
if (!selectedFilter && previouslyFocusedButtonRef.current) {
|
|
@@ -12227,8 +12224,13 @@
|
|
|
12227
12224
|
locationsPlaceholder: t('locations.placeholder'),
|
|
12228
12225
|
locationsSelectedLabel: t('locations.selected'),
|
|
12229
12226
|
});
|
|
12230
|
-
return (React.createElement("div", { className: "will-filter-bar-controls ".concat(mode || 'light'), ref: (
|
|
12231
|
-
|
|
12227
|
+
return (React.createElement("div", { className: "will-filter-bar-controls ".concat(mode || 'light'), ref: function (el) {
|
|
12228
|
+
filtersRef.current = el;
|
|
12229
|
+
if ((tabs === null || tabs === void 0 ? void 0 : tabs.length) === 1) {
|
|
12230
|
+
tabsRef.current = el;
|
|
12231
|
+
}
|
|
12232
|
+
} },
|
|
12233
|
+
((_a = locations === null || locations === void 0 ? void 0 : locations.data) === null || _a === void 0 ? void 0 : _a.length) && locations.data.length > 1 && (React.createElement(React.Fragment, null,
|
|
12232
12234
|
React.createElement(SelectButton, { ref: function (el) { return (buttonRefs.current[FilterSections.LOCATIONS] = el); }, label: t('locations.label'), description: parsedLocations, onClick: function (e) {
|
|
12233
12235
|
previouslyFocusedButtonRef.current = e.currentTarget;
|
|
12234
12236
|
handleSelectedFilter(FilterSections.LOCATIONS);
|
|
@@ -12256,17 +12258,16 @@
|
|
|
12256
12258
|
|
|
12257
12259
|
var FilterTabs = function () {
|
|
12258
12260
|
var t = useTranslation('filterBar').t;
|
|
12259
|
-
var _a = useFilterBar(), selectedPath = _a.selectedPath, mode = _a.mode, tabs = _a.tabs, handleSelectedFilter = _a.handleSelectedFilter, setSelectedPath = _a.setSelectedPath, handleResetFilters = _a.handleResetFilters
|
|
12260
|
-
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
}, active: selectedPath === tab.path, mode: mode })); }))));
|
|
12261
|
+
var _a = useFilterBar(), selectedPath = _a.selectedPath, mode = _a.mode, tabs = _a.tabs, tabsRef = _a.tabsRef, handleSelectedFilter = _a.handleSelectedFilter, setSelectedPath = _a.setSelectedPath, handleResetFilters = _a.handleResetFilters;
|
|
12262
|
+
var sortedTabs = React.useMemo(function () { return __spreadArray$1([], __read((tabs !== null && tabs !== void 0 ? tabs : [])), false).sort(function (a, b) { return a.order - b.order; }); }, [tabs]);
|
|
12263
|
+
var handleTabClick = function (path) {
|
|
12264
|
+
setSelectedPath(path);
|
|
12265
|
+
handleResetFilters();
|
|
12266
|
+
handleSelectedFilter(false);
|
|
12267
|
+
};
|
|
12268
|
+
if (sortedTabs.length <= 1)
|
|
12269
|
+
return null;
|
|
12270
|
+
return (React.createElement("div", { className: "will-filter-bar-tabs", ref: tabsRef }, sortedTabs.map(function (tab) { return (React.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 })); })));
|
|
12270
12271
|
};
|
|
12271
12272
|
|
|
12272
12273
|
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";
|
|
@@ -12276,7 +12277,7 @@
|
|
|
12276
12277
|
styleInject(css_248z$1);
|
|
12277
12278
|
|
|
12278
12279
|
var FilterBar = function (_a) {
|
|
12279
|
-
var
|
|
12280
|
+
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;
|
|
12280
12281
|
var themePalette = useTheme({ palette: palette });
|
|
12281
12282
|
// Translations
|
|
12282
12283
|
useUpdateTranslations({ language: language });
|
|
@@ -12290,7 +12291,6 @@
|
|
|
12290
12291
|
};
|
|
12291
12292
|
////////////
|
|
12292
12293
|
var REDIRECT_URL_FALLBACK = 'http://localhost:3000/';
|
|
12293
|
-
var LANGUAGE_FALLBACK = 'en';
|
|
12294
12294
|
|
|
12295
12295
|
var useFilterCalendar = function (_a) {
|
|
12296
12296
|
var onSubmit = _a.onSubmit, setToggleCalendar = _a.setToggleCalendar, noActiveSelection = _a.noActiveSelection, toggleCalendar = _a.toggleCalendar, outerRangeContext = _a.outerRangeContext, outerDisableCalendarDates = _a.outerDisableCalendarDates;
|
|
@@ -12465,10 +12465,10 @@
|
|
|
12465
12465
|
// Display component after fully loaded
|
|
12466
12466
|
useAwaitRender();
|
|
12467
12467
|
// Handle close filter section
|
|
12468
|
-
var
|
|
12468
|
+
var filterSectionRef = useCloseFilterSection({
|
|
12469
12469
|
handleSelectedFilter: setToggleCalendar,
|
|
12470
|
-
}).
|
|
12471
|
-
return (React.createElement("div", { className: "will-root", style: themePalette }, toggleCalendar && (React.createElement("div", { className: "will-calendar-wrapper", ref:
|
|
12470
|
+
}).filterSectionRef;
|
|
12471
|
+
return (React.createElement("div", { className: "will-root", style: themePalette }, toggleCalendar && (React.createElement("div", { className: "will-calendar-wrapper", ref: filterSectionRef },
|
|
12472
12472
|
React.createElement("div", { className: "will-calendar-header" },
|
|
12473
12473
|
React.createElement("h2", null, t('filterBar:calendar.title')),
|
|
12474
12474
|
React.createElement(CloseButton, { handleClose: function () { return setToggleCalendar(false); } })),
|