willba-component-library 0.3.20 → 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/index.esm.js +26 -28
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +26 -28
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +26 -28
- 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 +1 -1
- package/src/components/FilterBar/components/FilterPanels/Dates/Dates.css +7 -1
- package/src/components/FilterBar/components/FilterPanels/FilterPanels.tsx +0 -1
- 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} +1 -1
- package/src/components/FilterBar/hooks/usePanelPosition.tsx +1 -1
- package/src/components/FilterBar/providers/FilterBarProvider.tsx +6 -6
package/lib/index.umd.js
CHANGED
|
@@ -6833,7 +6833,7 @@
|
|
|
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);
|
|
@@ -6865,7 +6865,7 @@
|
|
|
6865
6865
|
var panelRect = panel.getBoundingClientRect();
|
|
6866
6866
|
var containerRect = container.getBoundingClientRect();
|
|
6867
6867
|
var buttonRect = button.getBoundingClientRect();
|
|
6868
|
-
var buttonLeft = buttonRect.left - containerRect.left;
|
|
6868
|
+
var buttonLeft = buttonRect.left - containerRect.left - 30; // Offset by 30px to account for controls section spacing
|
|
6869
6869
|
var left = Math.max(0, Math.min(buttonLeft, containerRect.width - panelRect.width));
|
|
6870
6870
|
setLocalStyles({ left: left });
|
|
6871
6871
|
}, [selectedFilter, isMobile]);
|
|
@@ -6891,8 +6891,8 @@
|
|
|
6891
6891
|
onSubmit: onSubmit,
|
|
6892
6892
|
setInnerLoading: setInnerLoading,
|
|
6893
6893
|
});
|
|
6894
|
-
var
|
|
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 }),
|
|
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)); }, [
|
|
6896
6896
|
selectedFilter,
|
|
6897
6897
|
ageCategoryCounts,
|
|
6898
6898
|
categories,
|
|
@@ -6911,9 +6911,9 @@
|
|
|
6911
6911
|
tabs,
|
|
6912
6912
|
outerLoading,
|
|
6913
6913
|
locations,
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6914
|
+
filterRefs.isMobile,
|
|
6915
|
+
filterRefs.tabsRef,
|
|
6916
|
+
filterRefs.filtersRef,
|
|
6917
6917
|
]);
|
|
6918
6918
|
return (React.createElement(FilterBarContext.Provider, { value: contextValue }, children));
|
|
6919
6919
|
};
|
|
@@ -12012,7 +12012,7 @@
|
|
|
12012
12012
|
React.createElement(IconsSvg, { fill: (palette === null || palette === void 0 ? void 0 : palette.primary) || 'inherit', size: 50, icon: "spinner" })))));
|
|
12013
12013
|
});
|
|
12014
12014
|
|
|
12015
|
-
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";
|
|
12016
12016
|
styleInject(css_248z$c);
|
|
12017
12017
|
|
|
12018
12018
|
var SectionHeader = function (_a) {
|
|
@@ -12022,7 +12022,7 @@
|
|
|
12022
12022
|
action && React.createElement("div", { className: "will-filter-section-action" }, action)));
|
|
12023
12023
|
};
|
|
12024
12024
|
|
|
12025
|
-
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";
|
|
12026
12026
|
styleInject(css_248z$b);
|
|
12027
12027
|
|
|
12028
12028
|
var Dates = React.forwardRef(function (_a, ref) {
|
|
@@ -12068,7 +12068,7 @@
|
|
|
12068
12068
|
React.createElement("path", { d: "M10 4V16M4 10H16", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }))))));
|
|
12069
12069
|
};
|
|
12070
12070
|
|
|
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
|
|
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";
|
|
12072
12072
|
styleInject(css_248z$9);
|
|
12073
12073
|
|
|
12074
12074
|
var Guests = React.forwardRef(function (_a, ref) {
|
|
@@ -12081,7 +12081,7 @@
|
|
|
12081
12081
|
});
|
|
12082
12082
|
Guests.displayName = 'Guests';
|
|
12083
12083
|
|
|
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
|
|
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";
|
|
12085
12085
|
styleInject(css_248z$8);
|
|
12086
12086
|
|
|
12087
12087
|
var ImageCard = React.forwardRef(function (_a, ref) {
|
|
@@ -12104,7 +12104,7 @@
|
|
|
12104
12104
|
styleInject(css_248z$7);
|
|
12105
12105
|
|
|
12106
12106
|
var Locations = React.forwardRef(function (_a, ref) {
|
|
12107
|
-
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;
|
|
12108
12108
|
var t = useTranslation('filterBar').t;
|
|
12109
12109
|
var firstCardRef = React.useRef(null);
|
|
12110
12110
|
React.useEffect(function () {
|
|
@@ -12133,7 +12133,7 @@
|
|
|
12133
12133
|
};
|
|
12134
12134
|
return (React.createElement("div", { id: "will-filter-bar-locations", ref: ref },
|
|
12135
12135
|
React.createElement(SectionHeader, { title: t('locations.title'), action: onClose && React.createElement(CloseButton, { handleClose: onClose }) }),
|
|
12136
|
-
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) &&
|
|
12137
12137
|
locations.map(function (location, index) {
|
|
12138
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); } }));
|
|
12139
12139
|
}))));
|
|
@@ -12188,7 +12188,7 @@
|
|
|
12188
12188
|
case FilterSections.CATEGORIES:
|
|
12189
12189
|
return (React.createElement(Categories, { categories: categories, setCategories: setCategories }));
|
|
12190
12190
|
case FilterSections.LOCATIONS:
|
|
12191
|
-
return (React.createElement(Locations, { autoFocus: true, ref: filterSectionRef, locations: locations === null || locations === void 0 ? void 0 : locations.data,
|
|
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); } }));
|
|
12192
12192
|
default:
|
|
12193
12193
|
return null;
|
|
12194
12194
|
}
|
|
@@ -12230,7 +12230,7 @@
|
|
|
12230
12230
|
tabsRef.current = el;
|
|
12231
12231
|
}
|
|
12232
12232
|
} },
|
|
12233
|
-
|
|
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,
|
|
12234
12234
|
React.createElement(SelectButton, { ref: function (el) { return (buttonRefs.current[FilterSections.LOCATIONS] = el); }, label: t('locations.label'), description: parsedLocations, onClick: function (e) {
|
|
12235
12235
|
previouslyFocusedButtonRef.current = e.currentTarget;
|
|
12236
12236
|
handleSelectedFilter(FilterSections.LOCATIONS);
|
|
@@ -12258,17 +12258,16 @@
|
|
|
12258
12258
|
|
|
12259
12259
|
var FilterTabs = function () {
|
|
12260
12260
|
var t = useTranslation('filterBar').t;
|
|
12261
|
-
var _a = useFilterBar(), selectedPath = _a.selectedPath, mode = _a.mode, tabs = _a.tabs, handleSelectedFilter = _a.handleSelectedFilter, setSelectedPath = _a.setSelectedPath, handleResetFilters = _a.handleResetFilters
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
|
|
12270
|
-
|
|
12271
|
-
}, 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 })); })));
|
|
12272
12271
|
};
|
|
12273
12272
|
|
|
12274
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";
|
|
@@ -12278,7 +12277,7 @@
|
|
|
12278
12277
|
styleInject(css_248z$1);
|
|
12279
12278
|
|
|
12280
12279
|
var FilterBar = function (_a) {
|
|
12281
|
-
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;
|
|
12282
12281
|
var themePalette = useTheme({ palette: palette });
|
|
12283
12282
|
// Translations
|
|
12284
12283
|
useUpdateTranslations({ language: language });
|
|
@@ -12292,7 +12291,6 @@
|
|
|
12292
12291
|
};
|
|
12293
12292
|
////////////
|
|
12294
12293
|
var REDIRECT_URL_FALLBACK = 'http://localhost:3000/';
|
|
12295
|
-
var LANGUAGE_FALLBACK = 'en';
|
|
12296
12294
|
|
|
12297
12295
|
var useFilterCalendar = function (_a) {
|
|
12298
12296
|
var onSubmit = _a.onSubmit, setToggleCalendar = _a.setToggleCalendar, noActiveSelection = _a.noActiveSelection, toggleCalendar = _a.toggleCalendar, outerRangeContext = _a.outerRangeContext, outerDisableCalendarDates = _a.outerDisableCalendarDates;
|