willba-component-library 0.1.22 → 0.1.24
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/components/FilterBar/FilterBarTypes.d.ts +2 -4
- package/lib/components/FilterBar/hooks/useFilterBar.d.ts +1 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.esm.js +5 -9
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +5 -9
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +5 -9
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.stories.tsx +0 -6
- package/src/components/FilterBar/FilterBar.tsx +1 -4
- package/src/components/FilterBar/FilterBarTypes.ts +2 -4
- package/src/components/FilterBar/components/guests/GuestCount/GuestCount.tsx +2 -2
- package/src/components/FilterBar/components/guests/Guests.tsx +3 -2
- package/src/components/FilterBar/hooks/useFilterBar.tsx +3 -2
|
@@ -4,20 +4,18 @@ export interface AgeCategoryCount {
|
|
|
4
4
|
export interface AgeCategoryType {
|
|
5
5
|
id: string;
|
|
6
6
|
name: string;
|
|
7
|
-
minAge: number | null;
|
|
8
|
-
maxAge: number | null;
|
|
9
7
|
minVal: number;
|
|
10
8
|
sortOrder: number;
|
|
11
9
|
}
|
|
12
10
|
export interface GuestsPropsType {
|
|
13
11
|
ageCategories: AgeCategoryType[];
|
|
14
|
-
updateGuestsCount: (arg1:
|
|
12
|
+
updateGuestsCount: (arg1: string, arg2: number) => void;
|
|
15
13
|
ageCategoryCounts: AgeCategoryCount | {};
|
|
16
14
|
}
|
|
17
15
|
export interface GuestsCountPropsType {
|
|
18
16
|
label: string;
|
|
19
17
|
id: number;
|
|
20
|
-
updateGuestsCount: (arg1:
|
|
18
|
+
updateGuestsCount: (arg1: string, arg2: number) => void;
|
|
21
19
|
count: number;
|
|
22
20
|
minVal: number;
|
|
23
21
|
sortOrder: number;
|
|
@@ -16,7 +16,7 @@ export default function useFilterBar({ redirectUrl }: UseFilterBarPropsType): {
|
|
|
16
16
|
setCategories: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
17
17
|
handleSelectedFilter: (id: number | boolean) => void;
|
|
18
18
|
handleSubmit: () => void;
|
|
19
|
-
updateGuestsCount: (id:
|
|
19
|
+
updateGuestsCount: (id: string, newCount: number) => void;
|
|
20
20
|
handleResetFilters: () => void;
|
|
21
21
|
setSelectedPath: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
22
22
|
};
|
package/lib/index.d.ts
CHANGED
package/lib/index.esm.js
CHANGED
|
@@ -7923,11 +7923,11 @@ function GuestCount(_a) {
|
|
|
7923
7923
|
var label = _a.label, sortOrder = _a.sortOrder, id = _a.id, updateGuestsCount = _a.updateGuestsCount, count = _a.count, minVal = _a.minVal;
|
|
7924
7924
|
var handleDecrement = function () {
|
|
7925
7925
|
if (count > minVal) {
|
|
7926
|
-
updateGuestsCount(id, count - 1);
|
|
7926
|
+
updateGuestsCount("guests-".concat(id), count - 1);
|
|
7927
7927
|
}
|
|
7928
7928
|
};
|
|
7929
7929
|
var handleIncrement = function () {
|
|
7930
|
-
updateGuestsCount(id, count + 1);
|
|
7930
|
+
updateGuestsCount("guests-".concat(id), count + 1);
|
|
7931
7931
|
};
|
|
7932
7932
|
return (React__default__default.createElement("div", { className: "will-guests-filter-inner", style: { order: "".concat(sortOrder) } },
|
|
7933
7933
|
React__default__default.createElement("p", { className: "will-guests-filter-label" }, label),
|
|
@@ -7951,8 +7951,7 @@ function Guests(_a) {
|
|
|
7951
7951
|
var ageCategories = _a.ageCategories, updateGuestsCount = _a.updateGuestsCount, ageCategoryCounts = _a.ageCategoryCounts;
|
|
7952
7952
|
return (React__default__default.createElement("div", { className: "will-filter-bar-guests" },
|
|
7953
7953
|
React__default__default.createElement("h3", { className: "will-guests-filter-title" }, "Who's coming?"),
|
|
7954
|
-
React__default__default.createElement("div", { className: "will-guests-filter-container" }, ageCategories === null || ageCategories === void 0 ? void 0 : ageCategories.map(function (category) { return (React__default__default.createElement(GuestCount, { key: category.id, id: parseInt(category.id), label: category.name, minVal: category.minVal, sortOrder: category.sortOrder, updateGuestsCount: updateGuestsCount, count: ageCategoryCounts[category.id] ||
|
|
7955
|
-
category.minVal })); }))));
|
|
7954
|
+
React__default__default.createElement("div", { className: "will-guests-filter-container" }, ageCategories === null || ageCategories === void 0 ? void 0 : ageCategories.map(function (category) { return (React__default__default.createElement(GuestCount, { key: category.id, id: parseInt(category.id), label: category.name, minVal: category.minVal, sortOrder: category.sortOrder, updateGuestsCount: updateGuestsCount, count: ageCategoryCounts["guests-".concat(category.id)] || category.minVal })); }))));
|
|
7956
7955
|
}
|
|
7957
7956
|
|
|
7958
7957
|
var css_248z$4 = ".will-filter-bar-categories {\n text-align: center;\n}\n\n.will-categories-filter-title {\n font-size: 16px;\n text-transform: uppercase;\n margin: 10px 0 30px 0;\n}\n\n.will-categories-filter-inner {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 20px;\n}\n\n.will-categories-filter-inner input {\n cursor: pointer;\n margin-right: 10px;\n}\n";
|
|
@@ -8029,6 +8028,7 @@ function useFilterBar(_a) {
|
|
|
8029
8028
|
var _e = useState(0), categories = _e[0], setCategories = _e[1];
|
|
8030
8029
|
var _f = useState({}), ageCategoryCounts = _f[0], setAgeCategoryCounts = _f[1];
|
|
8031
8030
|
var updateGuestsCount = function (id, newCount) {
|
|
8031
|
+
console.log(ageCategoryCounts);
|
|
8032
8032
|
setAgeCategoryCounts(function (prevCounts) {
|
|
8033
8033
|
var _a;
|
|
8034
8034
|
return (__assign(__assign({}, prevCounts), (_a = {}, _a[id] = newCount, _a)));
|
|
@@ -8060,7 +8060,7 @@ function useFilterBar(_a) {
|
|
|
8060
8060
|
: '',
|
|
8061
8061
|
endDate: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) ? format(calendarRange.to, 'yyyy-MM-dd') : '',
|
|
8062
8062
|
categories: categories,
|
|
8063
|
-
|
|
8063
|
+
ageCategoryCounts: JSON.stringify(ageCategoryCounts),
|
|
8064
8064
|
};
|
|
8065
8065
|
for (var _i = 0, _a = Object.entries(params); _i < _a.length; _i++) {
|
|
8066
8066
|
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
@@ -10541,16 +10541,12 @@ var AGE_CATEGORIES_FALLBACK = [
|
|
|
10541
10541
|
id: '1',
|
|
10542
10542
|
name: 'Adults',
|
|
10543
10543
|
sortOrder: 1,
|
|
10544
|
-
minAge: null,
|
|
10545
|
-
maxAge: 6,
|
|
10546
10544
|
minVal: 0,
|
|
10547
10545
|
},
|
|
10548
10546
|
{
|
|
10549
10547
|
id: '2',
|
|
10550
10548
|
name: 'Kids',
|
|
10551
10549
|
sortOrder: 2,
|
|
10552
|
-
minAge: 6,
|
|
10553
|
-
maxAge: 17,
|
|
10554
10550
|
minVal: 0,
|
|
10555
10551
|
},
|
|
10556
10552
|
];
|