willba-component-library 0.2.100 → 0.2.102
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 -0
- package/lib/assets/SpinnerSvg.d.ts +5 -0
- package/lib/components/FilterBar/components/buttons/close-button/CloseButton.d.ts +7 -0
- package/lib/components/FilterBar/components/buttons/submit-button/SubmitButton.d.ts +3 -0
- package/lib/components/FilterBar/components/calendar/Calendar.d.ts +14 -0
- package/lib/components/FilterBar/hooks/useCloseFilterSection.d.ts +8 -0
- package/lib/components/FilterBar/hooks/useUpdateTranslations.d.ts +5 -0
- package/lib/components/FilterBar/utils/parseDates.d.ts +6 -0
- package/lib/core/utils/handleOverlappingDates.d.ts +1 -0
- package/lib/core/utils/index.d.ts +3 -0
- package/lib/core/utils/nightsCount.d.ts +6 -0
- package/lib/core/utils/parseDate.d.ts +7 -0
- package/lib/core/utils/parseDates.d.ts +6 -0
- package/lib/index.esm.js +6 -3
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +6 -3
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +6 -3
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.css +11 -10
- package/src/components/FilterBar/FilterBar.stories.tsx +5 -5
- package/src/components/FilterBar/utils/parseGuests.tsx +7 -6
package/README.md
CHANGED
|
@@ -188,3 +188,4 @@ ReactDOM.render(<App />, document.querySelector('#app'))
|
|
|
188
188
|
| ageCategories | `[{}]` | The ageCategories prop will determine the types of guests that can be selected. Specify the age categories for guests using the following format: `[{ id: string, name: string, minVal: number, sortOrder: number }]`. For example: `[{ id: '1', name: 'Aikuiset', minVal: 1, sortOrder: 1 }]` |
|
|
189
189
|
| fullWidth | `true` | Specify whether the filter bar width should be dynamic or fixed. |
|
|
190
190
|
| tabs | `[{}]` | Manage the filter bar tabs using the following format: `[{path: string, default: boolean, order: number, label: { en: string, fi: string }}]`. For example: `[{ path: '/rooms', default: true, order: 2, label: { en: 'Rooms', fi: 'Hilat' }}]` |
|
|
191
|
+
| locationIds | `string[]` | Specifies an array of location identifiers to be included as query parameters in the redirect URL after filter submission. Each ID will be appended as a separate `locationId` parameter. Default is `undefined`. For example: `['1', '2']` results in `?locationId=1&locationId=2` |
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DateRange } from 'react-day-picker';
|
|
3
|
+
import { CalendarOffset } from '../../FilterBarTypes';
|
|
4
|
+
import 'react-day-picker/dist/style.css';
|
|
5
|
+
import './Calendar.css';
|
|
6
|
+
type Props = {
|
|
7
|
+
calendarRange: DateRange | undefined;
|
|
8
|
+
setCalendarRange: (range: DateRange | undefined) => void;
|
|
9
|
+
calendarOffset?: CalendarOffset;
|
|
10
|
+
selectedPath: string;
|
|
11
|
+
locale?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const Calendar: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type Props = {
|
|
3
|
+
handleSelectedFilter: (arg: boolean) => void;
|
|
4
|
+
};
|
|
5
|
+
export declare const useCloseFilterSection: ({ handleSelectedFilter }: Props) => {
|
|
6
|
+
filtersRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const handleOverlappingDates: () => void;
|
package/lib/index.esm.js
CHANGED
|
@@ -11622,7 +11622,10 @@ var parseGuests = function (_a) {
|
|
|
11622
11622
|
var guestLabel = _a.guestLabel, guestsLabel = _a.guestsLabel, guestsPlaceholder = _a.guestsPlaceholder, ageCategoryCounts = _a.ageCategoryCounts, ageCategories = _a.ageCategories;
|
|
11623
11623
|
var parsedData = Object.entries(ageCategoryCounts).reduce(function (acc, _a) {
|
|
11624
11624
|
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
11625
|
-
var
|
|
11625
|
+
var parts = key.split('-');
|
|
11626
|
+
if (parts.length < 2)
|
|
11627
|
+
return acc;
|
|
11628
|
+
var ageCategoryId = parts[1];
|
|
11626
11629
|
var ageCategory = ageCategories.find(function (c) { return c.id === ageCategoryId; });
|
|
11627
11630
|
if (ageCategory && value) {
|
|
11628
11631
|
return {
|
|
@@ -11635,7 +11638,7 @@ var parseGuests = function (_a) {
|
|
|
11635
11638
|
var htmlString = parsedData.html.length > 1 ? parsedData.html.join(' + ') : '';
|
|
11636
11639
|
return {
|
|
11637
11640
|
content: parsedData.total
|
|
11638
|
-
? "<span
|
|
11641
|
+
? "<span class=\"will-guest-count\">".concat(parsedData.total, "</span> ").concat(parsedData.total > 1 ? guestsLabel : guestLabel).concat(htmlString ? " ( ".concat(htmlString, " )") : '')
|
|
11639
11642
|
: guestsPlaceholder,
|
|
11640
11643
|
data: parsedData,
|
|
11641
11644
|
};
|
|
@@ -11917,7 +11920,7 @@ var Categories = function (_a) {
|
|
|
11917
11920
|
React__default__default.createElement("span", null, itm))); }))));
|
|
11918
11921
|
};
|
|
11919
11922
|
|
|
11920
|
-
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/* Tabs */\n\n.will-filter-bar-tabs {\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n z-index: 222;\n background: transparent;\n padding: 10px;\n gap: 10px
|
|
11923
|
+
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/* Tabs */\n\n.will-filter-bar-tabs {\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n z-index: 222;\n background: transparent;\n padding: 10px;\n gap: 10px;\n}\n\n/* Header */\n.will-filter-bar-header {\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-header {\n flex-direction: column;\n padding: 20px;\n border-radius: 25px;\n }\n}\n\n/* Container */\n\n.will-filter-bar-container {\n background-color: var(--will-white);\n min-height: 100px;\n padding: 40px 20px;\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-container {\n margin-top: 10px;\n top: 0;\n padding: 45px 20px;\n position: relative;\n }\n}\n\n/* Common */\n\n.will-filter-bar-header.dark,\n.will-filter-bar-container.dark {\n box-shadow: var(--will-box-shadow-dark);\n}\n\n.will-filter-bar-header.light,\n.will-filter-bar-container.light {\n box-shadow: var(--will-box-shadow-light);\n}\n\n.will-guest-count {\n display: inline-block;\n min-width: 10px;\n}\n";
|
|
11921
11924
|
styleInject(css_248z$1);
|
|
11922
11925
|
|
|
11923
11926
|
function FilterBar(_a) {
|