willba-component-library 0.3.25 → 0.3.26

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/lib/index.js CHANGED
@@ -6848,11 +6848,13 @@ var useFilterRefs = function (selectedFilter) {
6848
6848
  };
6849
6849
 
6850
6850
  var usePanelPosition = function (_a) {
6851
- var selectedFilter = _a.selectedFilter, panelRef = _a.panelRef, filtersRef = _a.filtersRef, buttonRefs = _a.buttonRefs, isMobile = _a.isMobile;
6852
- var _b = __read(React.useState({}), 2), localStyles = _b[0], setLocalStyles = _b[1];
6851
+ var selectedFilter = _a.selectedFilter, panelRef = _a.panelRef, filtersRef = _a.filtersRef, buttonRefs = _a.buttonRefs, isMobile = _a.isMobile, tabs = _a.tabs;
6852
+ var _b = __read(React.useState(), 2), left = _b[0], setLeft = _b[1];
6853
+ var hasMultipleTabs = tabs && tabs.length > 1;
6854
+ var top = isMobile ? (hasMultipleTabs ? 60 : 0) : hasMultipleTabs ? 125 : 66;
6853
6855
  React.useLayoutEffect(function () {
6854
6856
  if (!selectedFilter || typeof selectedFilter !== 'string' || isMobile) {
6855
- setLocalStyles({});
6857
+ setLeft(undefined);
6856
6858
  return;
6857
6859
  }
6858
6860
  var panel = panelRef.current;
@@ -6863,11 +6865,11 @@ var usePanelPosition = function (_a) {
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 - 10; // Offset by 10px to account for controls section spacing
6867
- var left = Math.max(0, Math.min(buttonLeft, containerRect.width - panelRect.width));
6868
- setLocalStyles({ left: left });
6868
+ var buttonLeft = buttonRect.left - containerRect.left - 10;
6869
+ var newLeft = Math.max(0, Math.min(buttonLeft, containerRect.width - panelRect.width));
6870
+ setLeft(newLeft);
6869
6871
  }, [selectedFilter, isMobile]);
6870
- return { localStyles: localStyles };
6872
+ return { top: top, left: left };
6871
6873
  };
6872
6874
 
6873
6875
  var FilterBarContext = React.createContext(undefined);
@@ -12163,20 +12165,21 @@ var Categories = function (_a) {
12163
12165
  };
12164
12166
  Categories.displayName = 'Categories';
12165
12167
 
12166
- var css_248z$5 = ".will-filter-bar-panels {\n background-color: var(--will-white);\n min-height: 100px;\n position: absolute;\n top: 125px;\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 top: 60px;\n width: 100%;\n z-index: 999;\n }\n}\n";
12168
+ 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";
12167
12169
  styleInject(css_248z$5);
12168
12170
 
12169
12171
  var FilterPanels = function () {
12170
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;
12171
12173
  // Handle close filter section
12172
12174
  var filterSectionRef = useCloseFilterSection({ handleSelectedFilter: handleSelectedFilter }).filterSectionRef;
12173
- var localStyles = usePanelPosition({
12175
+ var _b = usePanelPosition({
12174
12176
  selectedFilter: selectedFilter,
12175
12177
  panelRef: panelRef,
12176
12178
  filtersRef: filtersRef,
12177
12179
  buttonRefs: buttonRefs,
12178
12180
  isMobile: isMobile,
12179
- }).localStyles;
12181
+ tabs: tabs,
12182
+ }), left = _b.left, top = _b.top;
12180
12183
  var renderContent = function () {
12181
12184
  switch (selectedFilter) {
12182
12185
  case FilterSections.CALENDAR:
@@ -12191,10 +12194,10 @@ var FilterPanels = function () {
12191
12194
  return null;
12192
12195
  }
12193
12196
  };
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())));
12197
+ return (selectedFilter && (React.createElement("div", { ref: panelRef, className: "will-filter-bar-panels ".concat(mode || 'light'), style: { left: left, top: top } }, renderContent())));
12195
12198
  };
12196
12199
 
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";
12200
+ 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";
12198
12201
  styleInject(css_248z$4);
12199
12202
 
12200
12203
  var FilterControls = function () {
@@ -12222,7 +12225,7 @@ var FilterControls = function () {
12222
12225
  locationsPlaceholder: t('locations.placeholder'),
12223
12226
  locationsSelectedLabel: t('locations.selected'),
12224
12227
  });
12225
- return (React.createElement("div", { className: "will-filter-bar-controls ".concat(mode || 'light'), ref: function (el) {
12228
+ return (React.createElement("div", { className: "will-filter-bar-controls ".concat(mode || 'light', " ").concat(selectedFilter ? 'disabled' : ''), ref: function (el) {
12226
12229
  filtersRef.current = el;
12227
12230
  if ((tabs === null || tabs === void 0 ? void 0 : tabs.length) === 1) {
12228
12231
  tabsRef.current = el;