willba-component-library 0.1.23 → 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 -2
- package/lib/components/FilterBar/hooks/useFilterBar.d.ts +1 -1
- package/lib/index.esm.js +5 -5
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +5 -5
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +5 -5
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBarTypes.ts +2 -2
- 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
|
@@ -9,13 +9,13 @@ export interface AgeCategoryType {
|
|
|
9
9
|
}
|
|
10
10
|
export interface GuestsPropsType {
|
|
11
11
|
ageCategories: AgeCategoryType[];
|
|
12
|
-
updateGuestsCount: (arg1:
|
|
12
|
+
updateGuestsCount: (arg1: string, arg2: number) => void;
|
|
13
13
|
ageCategoryCounts: AgeCategoryCount | {};
|
|
14
14
|
}
|
|
15
15
|
export interface GuestsCountPropsType {
|
|
16
16
|
label: string;
|
|
17
17
|
id: number;
|
|
18
|
-
updateGuestsCount: (arg1:
|
|
18
|
+
updateGuestsCount: (arg1: string, arg2: number) => void;
|
|
19
19
|
count: number;
|
|
20
20
|
minVal: number;
|
|
21
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.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,9 +8028,10 @@ 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
|
-
return (__assign(__assign({}, prevCounts), (_a = {}, _a[
|
|
8034
|
+
return (__assign(__assign({}, prevCounts), (_a = {}, _a[id] = newCount, _a)));
|
|
8035
8035
|
});
|
|
8036
8036
|
};
|
|
8037
8037
|
useEffect(function () {
|