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