willba-component-library 0.3.15 → 0.3.16

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.15/lib/index.umd.js"></script>
110
+ <script src="https://cdn.jsdelivr.net/npm/willba-component-library@0.3.16/lib/index.umd.js"></script>
111
111
 
112
112
  <script>
113
113
  const renderFilterBar = async () => {
package/lib/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import React__default, { useState, useEffect, createContext, useContext, useRef, forwardRef, useMemo } from 'react';
2
+ import React__default, { useState, useEffect, createContext, useContext, useRef, forwardRef, useLayoutEffect, useMemo } from 'react';
3
3
 
4
4
  /******************************************************************************
5
5
  Copyright (c) Microsoft Corporation.
@@ -6828,35 +6828,23 @@ var useFilterUi = function (selectedFilter) {
6828
6828
  var usePanelPosition = function (_a) {
6829
6829
  var selectedFilter = _a.selectedFilter, panelRef = _a.panelRef, targetFilterBarRef = _a.targetFilterBarRef, buttonRefs = _a.buttonRefs, isMobile = _a.isMobile;
6830
6830
  var _b = __read(useState({}), 2), localStyles = _b[0], setLocalStyles = _b[1];
6831
- useEffect(function () {
6831
+ useLayoutEffect(function () {
6832
6832
  if (!selectedFilter || typeof selectedFilter !== 'string' || isMobile) {
6833
6833
  setLocalStyles({});
6834
6834
  return;
6835
6835
  }
6836
- var timeoutId = null;
6837
- var calculate = function () {
6838
- var panel = panelRef.current;
6839
- var container = targetFilterBarRef.current;
6840
- var button = buttonRefs.current[selectedFilter];
6841
- if (!panel || !container || !button)
6842
- return;
6843
- var panelRect = panel.getBoundingClientRect();
6844
- if (panelRect.width === 0) {
6845
- timeoutId = window.setTimeout(calculate, 10);
6846
- return;
6847
- }
6848
- var containerRect = container.getBoundingClientRect();
6849
- var buttonRect = button.getBoundingClientRect();
6850
- var buttonLeft = buttonRect.left - containerRect.left;
6851
- var left = Math.min(buttonLeft, Math.max(containerRect.width - panelRect.width, 0));
6852
- setLocalStyles({ left: left });
6853
- };
6854
- calculate();
6855
- return function () {
6856
- if (timeoutId)
6857
- clearTimeout(timeoutId);
6858
- };
6859
- }, [selectedFilter, panelRef, targetFilterBarRef, buttonRefs, isMobile]);
6836
+ var panel = panelRef.current;
6837
+ var container = targetFilterBarRef.current;
6838
+ var button = buttonRefs.current[selectedFilter];
6839
+ if (!panel || !container || !button)
6840
+ return;
6841
+ var panelRect = panel.getBoundingClientRect();
6842
+ var containerRect = container.getBoundingClientRect();
6843
+ var buttonRect = button.getBoundingClientRect();
6844
+ var buttonLeft = buttonRect.left - containerRect.left;
6845
+ var left = Math.max(0, Math.min(buttonLeft, containerRect.width - panelRect.width));
6846
+ setLocalStyles({ left: left });
6847
+ }, [selectedFilter, isMobile]);
6860
6848
  return { localStyles: localStyles };
6861
6849
  };
6862
6850
 
@@ -12008,7 +11996,7 @@ var SectionHeader = function (_a) {
12008
11996
  action && React__default.createElement("div", { className: "will-filter-section-action" }, action)));
12009
11997
  };
12010
11998
 
12011
- var css_248z$b = ".will-dates-filter-container {\n padding: 0 16px;\n}\n";
11999
+ var css_248z$b = ".will-dates-filter-container {\n padding: 0 16px 16px 16px;\n}\n";
12012
12000
  styleInject(css_248z$b);
12013
12001
 
12014
12002
  var Dates = forwardRef(function (_a, ref) {
@@ -12054,7 +12042,7 @@ var GuestCount = function (_a) {
12054
12042
  React__default.createElement("path", { d: "M10 4V16M4 10H16", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }))))));
12055
12043
  };
12056
12044
 
12057
- 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: 16px;\n}\n\n/**/\n.will-guest-count {\n display: inline-block;\n min-width: 10px;\n}\n";
12045
+ 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 16px 16px 16px;\n}\n\n@media (max-width: 960px) {\n .will-guests-filter-container {\n min-width: auto;\n }\n}\n\n/**/\n.will-guest-count {\n display: inline-block;\n min-width: 10px;\n}\n";
12058
12046
  styleInject(css_248z$9);
12059
12047
 
12060
12048
  var Guests = forwardRef(function (_a, ref) {
@@ -12086,7 +12074,7 @@ var ImageCard = forwardRef(function (_a, ref) {
12086
12074
  });
12087
12075
  ImageCard.displayName = 'ImageCard';
12088
12076
 
12089
- var css_248z$7 = "#will-filter-bar-locations {\n text-align: initial;\n}\n\n.will-locations-filter-container {\n display: flex;\n gap: 10px;\n flex-direction: column;\n min-width: 400px;\n padding: 16px 0;\n}\n\n@media (max-width: 960px) {\n .will-locations-filter-container {\n margin-top: 15px;\n min-width: 100%;\n }\n}\n";
12077
+ var css_248z$7 = "#will-filter-bar-locations {\n text-align: initial;\n}\n\n.will-locations-filter-container {\n display: flex;\n flex-direction: column;\n min-width: 400px;\n padding-bottom: 16px;\n}\n\n@media (max-width: 960px) {\n .will-locations-filter-container {\n margin-top: 15px;\n min-width: 100%;\n }\n}\n";
12090
12078
  styleInject(css_248z$7);
12091
12079
 
12092
12080
  var Locations = forwardRef(function (_a, ref) {