willba-component-library 0.3.24 → 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/README.md CHANGED
@@ -107,7 +107,7 @@ ReactDOM.render(<App />, document.querySelector('#app'))
107
107
 
108
108
  <script src="https://unpkg.com/react@18.3.1/umd/react.production.min.js"></script>
109
109
  <script src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.production.min.js"></script>
110
- <script src="https://cdn.jsdelivr.net/npm/willba-component-library@0.3.24/lib/index.umd.js"></script>
110
+ <script src="https://cdn.jsdelivr.net/npm/willba-component-library@0.3.26/lib/index.umd.js"></script>
111
111
 
112
112
  <script>
113
113
  const renderFilterBar = async () => {
@@ -1,12 +1,14 @@
1
- import { CSSProperties, MutableRefObject, RefObject } from 'react';
1
+ import { MutableRefObject, RefObject } from 'react';
2
2
  type Props = {
3
3
  selectedFilter: string | boolean;
4
4
  panelRef: RefObject<HTMLDivElement | null>;
5
5
  filtersRef: RefObject<HTMLDivElement | null>;
6
6
  buttonRefs: MutableRefObject<Record<string, HTMLButtonElement | null>>;
7
7
  isMobile: boolean;
8
+ tabs?: unknown[];
8
9
  };
9
- export declare const usePanelPosition: ({ selectedFilter, panelRef, filtersRef, buttonRefs, isMobile, }: Props) => {
10
- localStyles: CSSProperties;
10
+ export declare const usePanelPosition: ({ selectedFilter, panelRef, filtersRef, buttonRefs, isMobile, tabs, }: Props) => {
11
+ top: number;
12
+ left: number | undefined;
11
13
  };
12
14
  export {};
package/lib/index.esm.js CHANGED
@@ -6828,11 +6828,13 @@ var useFilterRefs = function (selectedFilter) {
6828
6828
  };
6829
6829
 
6830
6830
  var usePanelPosition = function (_a) {
6831
- var selectedFilter = _a.selectedFilter, panelRef = _a.panelRef, filtersRef = _a.filtersRef, buttonRefs = _a.buttonRefs, isMobile = _a.isMobile;
6832
- var _b = __read(useState({}), 2), localStyles = _b[0], setLocalStyles = _b[1];
6831
+ var selectedFilter = _a.selectedFilter, panelRef = _a.panelRef, filtersRef = _a.filtersRef, buttonRefs = _a.buttonRefs, isMobile = _a.isMobile, tabs = _a.tabs;
6832
+ var _b = __read(useState(), 2), left = _b[0], setLeft = _b[1];
6833
+ var hasMultipleTabs = tabs && tabs.length > 1;
6834
+ var top = isMobile ? (hasMultipleTabs ? 60 : 0) : hasMultipleTabs ? 125 : 66;
6833
6835
  useLayoutEffect(function () {
6834
6836
  if (!selectedFilter || typeof selectedFilter !== 'string' || isMobile) {
6835
- setLocalStyles({});
6837
+ setLeft(undefined);
6836
6838
  return;
6837
6839
  }
6838
6840
  var panel = panelRef.current;
@@ -6843,11 +6845,11 @@ var usePanelPosition = function (_a) {
6843
6845
  var panelRect = panel.getBoundingClientRect();
6844
6846
  var containerRect = container.getBoundingClientRect();
6845
6847
  var buttonRect = button.getBoundingClientRect();
6846
- var buttonLeft = buttonRect.left - containerRect.left - 10; // Offset by 10px to account for controls section spacing
6847
- var left = Math.max(0, Math.min(buttonLeft, containerRect.width - panelRect.width));
6848
- setLocalStyles({ left: left });
6848
+ var buttonLeft = buttonRect.left - containerRect.left - 10;
6849
+ var newLeft = Math.max(0, Math.min(buttonLeft, containerRect.width - panelRect.width));
6850
+ setLeft(newLeft);
6849
6851
  }, [selectedFilter, isMobile]);
6850
- return { localStyles: localStyles };
6852
+ return { top: top, left: left };
6851
6853
  };
6852
6854
 
6853
6855
  var FilterBarContext = createContext(undefined);
@@ -12143,20 +12145,21 @@ var Categories = function (_a) {
12143
12145
  };
12144
12146
  Categories.displayName = 'Categories';
12145
12147
 
12146
- 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";
12148
+ 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";
12147
12149
  styleInject(css_248z$5);
12148
12150
 
12149
12151
  var FilterPanels = function () {
12150
12152
  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;
12151
12153
  // Handle close filter section
12152
12154
  var filterSectionRef = useCloseFilterSection({ handleSelectedFilter: handleSelectedFilter }).filterSectionRef;
12153
- var localStyles = usePanelPosition({
12155
+ var _b = usePanelPosition({
12154
12156
  selectedFilter: selectedFilter,
12155
12157
  panelRef: panelRef,
12156
12158
  filtersRef: filtersRef,
12157
12159
  buttonRefs: buttonRefs,
12158
12160
  isMobile: isMobile,
12159
- }).localStyles;
12161
+ tabs: tabs,
12162
+ }), left = _b.left, top = _b.top;
12160
12163
  var renderContent = function () {
12161
12164
  switch (selectedFilter) {
12162
12165
  case FilterSections.CALENDAR:
@@ -12171,10 +12174,10 @@ var FilterPanels = function () {
12171
12174
  return null;
12172
12175
  }
12173
12176
  };
12174
- return (selectedFilter && (React__default.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())));
12177
+ return (selectedFilter && (React__default.createElement("div", { ref: panelRef, className: "will-filter-bar-panels ".concat(mode || 'light'), style: { left: left, top: top } }, renderContent())));
12175
12178
  };
12176
12179
 
12177
- 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";
12180
+ 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";
12178
12181
  styleInject(css_248z$4);
12179
12182
 
12180
12183
  var FilterControls = function () {
@@ -12202,7 +12205,7 @@ var FilterControls = function () {
12202
12205
  locationsPlaceholder: t('locations.placeholder'),
12203
12206
  locationsSelectedLabel: t('locations.selected'),
12204
12207
  });
12205
- return (React__default.createElement("div", { className: "will-filter-bar-controls ".concat(mode || 'light'), ref: function (el) {
12208
+ return (React__default.createElement("div", { className: "will-filter-bar-controls ".concat(mode || 'light', " ").concat(selectedFilter ? 'disabled' : ''), ref: function (el) {
12206
12209
  filtersRef.current = el;
12207
12210
  if ((tabs === null || tabs === void 0 ? void 0 : tabs.length) === 1) {
12208
12211
  tabsRef.current = el;
@@ -12251,7 +12254,7 @@ var FilterTabs = function () {
12251
12254
  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";
12252
12255
  styleInject(css_248z$2);
12253
12256
 
12254
- var css_248z$1 = ".will-root {\n z-index: 999;\n width: fit-content;\n min-width: 796px;\n max-height: 100vh;\n position: relative;\n}\n\n.will-root.is-full-width {\n width: 100%;\n min-width: auto;\n}\n\n.will-filter-bar {\n box-sizing: border-box;\n position: relative;\n}\n\n/* Common */\n\n.will-filter-bar-controls.dark,\n.will-filter-bar-panels.dark {\n box-shadow: var(--will-box-shadow-dark);\n}\n\n.will-filter-bar-controls.light,\n.will-filter-bar-panels.light {\n box-shadow: var(--will-box-shadow-light);\n}\n";
12257
+ var css_248z$1 = ".will-root {\n z-index: 999;\n width: fit-content;\n min-width: 796px;\n max-height: 100vh;\n position: relative;\n}\n\n.will-root.is-full-width {\n width: 100%;\n}\n\n.will-filter-bar {\n box-sizing: border-box;\n position: relative;\n}\n\n@media (max-width: 960px) {\n .will-root {\n width: 100%;\n min-width: auto;\n }\n}\n\n/* Common */\n\n.will-filter-bar-controls.dark,\n.will-filter-bar-panels.dark {\n box-shadow: var(--will-box-shadow-dark);\n}\n\n.will-filter-bar-controls.light,\n.will-filter-bar-panels.light {\n box-shadow: var(--will-box-shadow-light);\n}\n";
12255
12258
  styleInject(css_248z$1);
12256
12259
 
12257
12260
  var FilterBar = function (_a) {