willba-component-library 0.3.25 → 0.3.27
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/hooks/usePanelPosition.d.ts +5 -3
- package/lib/index.esm.js +17 -14
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +17 -14
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +17 -14
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/components/FilterControls/FilterControls.css +4 -0
- package/src/components/FilterBar/components/FilterControls/FilterControls.tsx +2 -2
- package/src/components/FilterBar/components/FilterPanels/FilterPanels.css +0 -2
- package/src/components/FilterBar/components/FilterPanels/FilterPanels.tsx +3 -5
- package/src/components/FilterBar/hooks/usePanelPosition.tsx +12 -13
package/lib/index.umd.js
CHANGED
|
@@ -6850,11 +6850,13 @@
|
|
|
6850
6850
|
};
|
|
6851
6851
|
|
|
6852
6852
|
var usePanelPosition = function (_a) {
|
|
6853
|
-
var selectedFilter = _a.selectedFilter, panelRef = _a.panelRef, filtersRef = _a.filtersRef, buttonRefs = _a.buttonRefs, isMobile = _a.isMobile;
|
|
6854
|
-
var _b = __read(React.useState(
|
|
6853
|
+
var selectedFilter = _a.selectedFilter, panelRef = _a.panelRef, filtersRef = _a.filtersRef, buttonRefs = _a.buttonRefs, isMobile = _a.isMobile, tabs = _a.tabs;
|
|
6854
|
+
var _b = __read(React.useState(), 2), left = _b[0], setLeft = _b[1];
|
|
6855
|
+
var hasMultipleTabs = tabs && tabs.length > 1;
|
|
6856
|
+
var top = isMobile ? (hasMultipleTabs ? 60 : 0) : hasMultipleTabs ? 125 : 66;
|
|
6855
6857
|
React.useLayoutEffect(function () {
|
|
6856
6858
|
if (!selectedFilter || typeof selectedFilter !== 'string' || isMobile) {
|
|
6857
|
-
|
|
6859
|
+
setLeft(undefined);
|
|
6858
6860
|
return;
|
|
6859
6861
|
}
|
|
6860
6862
|
var panel = panelRef.current;
|
|
@@ -6865,11 +6867,11 @@
|
|
|
6865
6867
|
var panelRect = panel.getBoundingClientRect();
|
|
6866
6868
|
var containerRect = container.getBoundingClientRect();
|
|
6867
6869
|
var buttonRect = button.getBoundingClientRect();
|
|
6868
|
-
var buttonLeft = buttonRect.left - containerRect.left - 10;
|
|
6869
|
-
var
|
|
6870
|
-
|
|
6870
|
+
var buttonLeft = buttonRect.left - containerRect.left - 10;
|
|
6871
|
+
var newLeft = Math.max(0, Math.min(buttonLeft, containerRect.width - panelRect.width));
|
|
6872
|
+
setLeft(newLeft);
|
|
6871
6873
|
}, [selectedFilter, isMobile]);
|
|
6872
|
-
return {
|
|
6874
|
+
return { top: top, left: left };
|
|
6873
6875
|
};
|
|
6874
6876
|
|
|
6875
6877
|
var FilterBarContext = React.createContext(undefined);
|
|
@@ -12165,20 +12167,21 @@
|
|
|
12165
12167
|
};
|
|
12166
12168
|
Categories.displayName = 'Categories';
|
|
12167
12169
|
|
|
12168
|
-
var css_248z$5 = ".will-filter-bar-panels {\n background-color: var(--will-white);\n min-height: 100px;\n position: absolute;\n
|
|
12170
|
+
var css_248z$5 = ".will-filter-bar-panels {\n background-color: var(--will-white);\n min-height: 100px;\n position: absolute;\n z-index: 111;\n border-radius: 25px;\n box-shadow: var(--will-box-shadow);\n}\n\n@media (max-width: 960px) {\n .will-root {\n width: 100%;\n min-width: auto;\n max-height: 100vh;\n z-index: 3;\n }\n\n .will-filter-bar-panels {\n width: 100%;\n z-index: 999;\n }\n}\n";
|
|
12169
12171
|
styleInject(css_248z$5);
|
|
12170
12172
|
|
|
12171
12173
|
var FilterPanels = function () {
|
|
12172
12174
|
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;
|
|
12173
12175
|
// Handle close filter section
|
|
12174
12176
|
var filterSectionRef = useCloseFilterSection({ handleSelectedFilter: handleSelectedFilter }).filterSectionRef;
|
|
12175
|
-
var
|
|
12177
|
+
var _b = usePanelPosition({
|
|
12176
12178
|
selectedFilter: selectedFilter,
|
|
12177
12179
|
panelRef: panelRef,
|
|
12178
12180
|
filtersRef: filtersRef,
|
|
12179
12181
|
buttonRefs: buttonRefs,
|
|
12180
12182
|
isMobile: isMobile,
|
|
12181
|
-
|
|
12183
|
+
tabs: tabs,
|
|
12184
|
+
}), left = _b.left, top = _b.top;
|
|
12182
12185
|
var renderContent = function () {
|
|
12183
12186
|
switch (selectedFilter) {
|
|
12184
12187
|
case FilterSections.CALENDAR:
|
|
@@ -12193,10 +12196,10 @@
|
|
|
12193
12196
|
return null;
|
|
12194
12197
|
}
|
|
12195
12198
|
};
|
|
12196
|
-
return (selectedFilter && (React.createElement("div", { ref: panelRef, className: "will-filter-bar-panels ".concat(mode || 'light'), style:
|
|
12199
|
+
return (selectedFilter && (React.createElement("div", { ref: panelRef, className: "will-filter-bar-panels ".concat(mode || 'light'), style: { left: left, top: top } }, renderContent())));
|
|
12197
12200
|
};
|
|
12198
12201
|
|
|
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";
|
|
12202
|
+
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 .will-filter-bar-controls.disabled {\n opacity: 0.1;\n }\n}\n";
|
|
12200
12203
|
styleInject(css_248z$4);
|
|
12201
12204
|
|
|
12202
12205
|
var FilterControls = function () {
|
|
@@ -12224,13 +12227,13 @@
|
|
|
12224
12227
|
locationsPlaceholder: t('locations.placeholder'),
|
|
12225
12228
|
locationsSelectedLabel: t('locations.selected'),
|
|
12226
12229
|
});
|
|
12227
|
-
return (React.createElement("div", { className: "will-filter-bar-controls ".concat(mode || 'light'), ref: function (el) {
|
|
12230
|
+
return (React.createElement("div", { className: "will-filter-bar-controls ".concat(mode || 'light', " ").concat(selectedFilter ? 'disabled' : ''), ref: function (el) {
|
|
12228
12231
|
filtersRef.current = el;
|
|
12229
12232
|
if ((tabs === null || tabs === void 0 ? void 0 : tabs.length) === 1) {
|
|
12230
12233
|
tabsRef.current = el;
|
|
12231
12234
|
}
|
|
12232
12235
|
} },
|
|
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,
|
|
12236
|
+
!!((_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
12237
|
React.createElement(SelectButton, { ref: function (el) { return (buttonRefs.current[FilterSections.LOCATIONS] = el); }, label: t('locations.label'), description: parsedLocations, onClick: function (e) {
|
|
12235
12238
|
previouslyFocusedButtonRef.current = e.currentTarget;
|
|
12236
12239
|
handleSelectedFilter(FilterSections.LOCATIONS);
|