willba-component-library 0.3.15 → 0.3.17
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/index.esm.js +18 -30
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +17 -29
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +17 -29
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/components/FilterPanels/Dates/Dates.css +1 -1
- package/src/components/FilterBar/components/FilterPanels/Guests/GuestCount/GuestCount.css +0 -1
- package/src/components/FilterBar/components/FilterPanels/Guests/Guests.css +7 -1
- package/src/components/FilterBar/components/FilterPanels/Locations/Locations.css +1 -2
- package/src/components/FilterBar/hooks/usePanelPosition.tsx +16 -29
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.
|
|
110
|
+
<script src="https://cdn.jsdelivr.net/npm/willba-component-library@0.3.17/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
|
-
|
|
6831
|
+
useLayoutEffect(function () {
|
|
6832
6832
|
if (!selectedFilter || typeof selectedFilter !== 'string' || isMobile) {
|
|
6833
6833
|
setLocalStyles({});
|
|
6834
6834
|
return;
|
|
6835
6835
|
}
|
|
6836
|
-
var
|
|
6837
|
-
var
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
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) {
|
|
@@ -12020,7 +12008,7 @@ var Dates = forwardRef(function (_a, ref) {
|
|
|
12020
12008
|
});
|
|
12021
12009
|
Dates.displayName = 'Dates';
|
|
12022
12010
|
|
|
12023
|
-
var css_248z$a = ".will-guests-filter-label,\n.will-guests-filter-count {\n font-size: 18px;\n color: var(--will-text);\n}\n\n.will-guests-filter-inner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n.will-guests-filter-label {\n display: block;\n font-weight: 600;\n margin-bottom: 10px;\n}\n\n.will-guests-filter-inner .will-guests-filter-counter {\n display: flex;\n align-items: center;\n}\n\n.will-guests-filter-count {\n margin: 0 10px;\n min-width: 30px;\n text-align: center;\n}\n\n.will-guests-filter-counter-button {\n border-radius: 50%;\n background-color: transparent;\n border: 1px solid var(--will-grey);\n width: 30px;\n height: 30px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 20px;\n cursor: pointer;\n color: var(--will-black);\n\n padding: 0;\n margin: 0;\n -webkit-appearance: none;\n appearance: none;\n}\n\n.will-guests-filter-counter-button:hover {\n background-color: var(--will-onahau);\n}\n\n@media (max-width: 960px) {\n .will-guests-filter-inner {\n width: 100%;\n
|
|
12011
|
+
var css_248z$a = ".will-guests-filter-label,\n.will-guests-filter-count {\n font-size: 18px;\n color: var(--will-text);\n}\n\n.will-guests-filter-inner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n.will-guests-filter-label {\n display: block;\n font-weight: 600;\n margin-bottom: 10px;\n}\n\n.will-guests-filter-inner .will-guests-filter-counter {\n display: flex;\n align-items: center;\n}\n\n.will-guests-filter-count {\n margin: 0 10px;\n min-width: 30px;\n text-align: center;\n}\n\n.will-guests-filter-counter-button {\n border-radius: 50%;\n background-color: transparent;\n border: 1px solid var(--will-grey);\n width: 30px;\n height: 30px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 20px;\n cursor: pointer;\n color: var(--will-black);\n\n padding: 0;\n margin: 0;\n -webkit-appearance: none;\n appearance: none;\n}\n\n.will-guests-filter-counter-button:hover {\n background-color: var(--will-onahau);\n}\n\n@media (max-width: 960px) {\n .will-guests-filter-inner {\n width: 100%;\n justify-content: space-between;\n }\n}\n";
|
|
12024
12012
|
styleInject(css_248z$a);
|
|
12025
12013
|
|
|
12026
12014
|
var GuestCount = function (_a) {
|
|
@@ -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
|
|
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) {
|