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.js
CHANGED
|
@@ -6831,7 +6831,7 @@ 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);
|
|
@@ -6863,7 +6863,7 @@ var usePanelPosition = function (_a) {
|
|
|
6863
6863
|
var panelRect = panel.getBoundingClientRect();
|
|
6864
6864
|
var containerRect = container.getBoundingClientRect();
|
|
6865
6865
|
var buttonRect = button.getBoundingClientRect();
|
|
6866
|
-
var buttonLeft = buttonRect.left - containerRect.left;
|
|
6866
|
+
var buttonLeft = buttonRect.left - containerRect.left - 30; // Offset by 30px to account for controls section spacing
|
|
6867
6867
|
var left = Math.max(0, Math.min(buttonLeft, containerRect.width - panelRect.width));
|
|
6868
6868
|
setLocalStyles({ left: left });
|
|
6869
6869
|
}, [selectedFilter, isMobile]);
|
|
@@ -6889,8 +6889,8 @@ var FilterBarProvider = function (_a) {
|
|
|
6889
6889
|
onSubmit: onSubmit,
|
|
6890
6890
|
setInnerLoading: setInnerLoading,
|
|
6891
6891
|
});
|
|
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 }),
|
|
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)); }, [
|
|
6894
6894
|
selectedFilter,
|
|
6895
6895
|
ageCategoryCounts,
|
|
6896
6896
|
categories,
|
|
@@ -6909,9 +6909,9 @@ var FilterBarProvider = function (_a) {
|
|
|
6909
6909
|
tabs,
|
|
6910
6910
|
outerLoading,
|
|
6911
6911
|
locations,
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6912
|
+
filterRefs.isMobile,
|
|
6913
|
+
filterRefs.tabsRef,
|
|
6914
|
+
filterRefs.filtersRef,
|
|
6915
6915
|
]);
|
|
6916
6916
|
return (React.createElement(FilterBarContext.Provider, { value: contextValue }, children));
|
|
6917
6917
|
};
|
|
@@ -12010,7 +12010,7 @@ var Calendar = React.forwardRef(function (_a, ref) {
|
|
|
12010
12010
|
React.createElement(IconsSvg, { fill: (palette === null || palette === void 0 ? void 0 : palette.primary) || 'inherit', size: 50, icon: "spinner" })))));
|
|
12011
12011
|
});
|
|
12012
12012
|
|
|
12013
|
-
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";
|
|
12014
12014
|
styleInject(css_248z$c);
|
|
12015
12015
|
|
|
12016
12016
|
var SectionHeader = function (_a) {
|
|
@@ -12020,7 +12020,7 @@ var SectionHeader = function (_a) {
|
|
|
12020
12020
|
action && React.createElement("div", { className: "will-filter-section-action" }, action)));
|
|
12021
12021
|
};
|
|
12022
12022
|
|
|
12023
|
-
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";
|
|
12024
12024
|
styleInject(css_248z$b);
|
|
12025
12025
|
|
|
12026
12026
|
var Dates = React.forwardRef(function (_a, ref) {
|
|
@@ -12066,7 +12066,7 @@ var GuestCount = function (_a) {
|
|
|
12066
12066
|
React.createElement("path", { d: "M10 4V16M4 10H16", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }))))));
|
|
12067
12067
|
};
|
|
12068
12068
|
|
|
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
|
|
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";
|
|
12070
12070
|
styleInject(css_248z$9);
|
|
12071
12071
|
|
|
12072
12072
|
var Guests = React.forwardRef(function (_a, ref) {
|
|
@@ -12079,7 +12079,7 @@ var Guests = React.forwardRef(function (_a, ref) {
|
|
|
12079
12079
|
});
|
|
12080
12080
|
Guests.displayName = 'Guests';
|
|
12081
12081
|
|
|
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
|
|
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";
|
|
12083
12083
|
styleInject(css_248z$8);
|
|
12084
12084
|
|
|
12085
12085
|
var ImageCard = React.forwardRef(function (_a, ref) {
|
|
@@ -12102,7 +12102,7 @@ var css_248z$7 = "#will-filter-bar-locations {\n text-align: initial;\n}\n\n.wi
|
|
|
12102
12102
|
styleInject(css_248z$7);
|
|
12103
12103
|
|
|
12104
12104
|
var Locations = React.forwardRef(function (_a, ref) {
|
|
12105
|
-
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;
|
|
12106
12106
|
var t = useTranslation('filterBar').t;
|
|
12107
12107
|
var firstCardRef = React.useRef(null);
|
|
12108
12108
|
React.useEffect(function () {
|
|
@@ -12131,7 +12131,7 @@ var Locations = React.forwardRef(function (_a, ref) {
|
|
|
12131
12131
|
};
|
|
12132
12132
|
return (React.createElement("div", { id: "will-filter-bar-locations", ref: ref },
|
|
12133
12133
|
React.createElement(SectionHeader, { title: t('locations.title'), action: onClose && React.createElement(CloseButton, { handleClose: onClose }) }),
|
|
12134
|
-
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) &&
|
|
12135
12135
|
locations.map(function (location, index) {
|
|
12136
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); } }));
|
|
12137
12137
|
}))));
|
|
@@ -12186,7 +12186,7 @@ var FilterPanels = function () {
|
|
|
12186
12186
|
case FilterSections.CATEGORIES:
|
|
12187
12187
|
return (React.createElement(Categories, { categories: categories, setCategories: setCategories }));
|
|
12188
12188
|
case FilterSections.LOCATIONS:
|
|
12189
|
-
return (React.createElement(Locations, { autoFocus: true, ref: filterSectionRef, locations: locations === null || locations === void 0 ? void 0 : locations.data,
|
|
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); } }));
|
|
12190
12190
|
default:
|
|
12191
12191
|
return null;
|
|
12192
12192
|
}
|
|
@@ -12228,7 +12228,7 @@ var FilterControls = function () {
|
|
|
12228
12228
|
tabsRef.current = el;
|
|
12229
12229
|
}
|
|
12230
12230
|
} },
|
|
12231
|
-
|
|
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,
|
|
12232
12232
|
React.createElement(SelectButton, { ref: function (el) { return (buttonRefs.current[FilterSections.LOCATIONS] = el); }, label: t('locations.label'), description: parsedLocations, onClick: function (e) {
|
|
12233
12233
|
previouslyFocusedButtonRef.current = e.currentTarget;
|
|
12234
12234
|
handleSelectedFilter(FilterSections.LOCATIONS);
|
|
@@ -12256,17 +12256,16 @@ styleInject(css_248z$3);
|
|
|
12256
12256
|
|
|
12257
12257
|
var FilterTabs = function () {
|
|
12258
12258
|
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 })); }))));
|
|
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 })); })));
|
|
12270
12269
|
};
|
|
12271
12270
|
|
|
12272
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";
|
|
@@ -12276,7 +12275,7 @@ var css_248z$1 = ".will-root {\n z-index: 999;\n width: fit-content;\n min-wi
|
|
|
12276
12275
|
styleInject(css_248z$1);
|
|
12277
12276
|
|
|
12278
12277
|
var FilterBar = function (_a) {
|
|
12279
|
-
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;
|
|
12280
12279
|
var themePalette = useTheme({ palette: palette });
|
|
12281
12280
|
// Translations
|
|
12282
12281
|
useUpdateTranslations({ language: language });
|
|
@@ -12290,7 +12289,6 @@ var FilterBar = function (_a) {
|
|
|
12290
12289
|
};
|
|
12291
12290
|
////////////
|
|
12292
12291
|
var REDIRECT_URL_FALLBACK = 'http://localhost:3000/';
|
|
12293
|
-
var LANGUAGE_FALLBACK = 'en';
|
|
12294
12292
|
|
|
12295
12293
|
var useFilterCalendar = function (_a) {
|
|
12296
12294
|
var onSubmit = _a.onSubmit, setToggleCalendar = _a.setToggleCalendar, noActiveSelection = _a.noActiveSelection, toggleCalendar = _a.toggleCalendar, outerRangeContext = _a.outerRangeContext, outerDisableCalendarDates = _a.outerDisableCalendarDates;
|