willba-component-library 0.1.30 → 0.1.32
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/index.esm.js +20 -15
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +20 -15
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +20 -15
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.tsx +5 -4
- package/src/components/FilterBar/components/guests/GuestCount/GuestCount.tsx +5 -1
- package/src/components/FilterBar/components/guests/Guests.tsx +3 -1
- package/src/components/FilterBar/hooks/useFilterBar.tsx +2 -9
- package/src/locales/en/filterBar.json +5 -3
- package/src/locales/fi/filterBar.json +5 -3
package/lib/index.js
CHANGED
|
@@ -8003,6 +8003,10 @@ styleInject(css_248z$6);
|
|
|
8003
8003
|
|
|
8004
8004
|
function GuestCount(_a) {
|
|
8005
8005
|
var label = _a.label, sortOrder = _a.sortOrder, id = _a.id, updateGuestsCount = _a.updateGuestsCount, count = _a.count, minVal = _a.minVal;
|
|
8006
|
+
React__default.useEffect(function () {
|
|
8007
|
+
if (minVal)
|
|
8008
|
+
updateGuestsCount("guests-".concat(id), minVal);
|
|
8009
|
+
}, []);
|
|
8006
8010
|
var handleDecrement = function () {
|
|
8007
8011
|
if (count > minVal) {
|
|
8008
8012
|
updateGuestsCount("guests-".concat(id), count - 1);
|
|
@@ -8031,8 +8035,9 @@ styleInject(css_248z$5);
|
|
|
8031
8035
|
|
|
8032
8036
|
function Guests(_a) {
|
|
8033
8037
|
var ageCategories = _a.ageCategories, updateGuestsCount = _a.updateGuestsCount, ageCategoryCounts = _a.ageCategoryCounts;
|
|
8038
|
+
var t = useTranslation('filterBar').t;
|
|
8034
8039
|
return (React__default.createElement("div", { className: "will-filter-bar-guests" },
|
|
8035
|
-
React__default.createElement("h3", { className: "will-guests-filter-title" },
|
|
8040
|
+
React__default.createElement("h3", { className: "will-guests-filter-title" }, t('guests.title')),
|
|
8036
8041
|
React__default.createElement("div", { className: "will-guests-filter-container" }, ageCategories === null || ageCategories === void 0 ? void 0 : ageCategories.map(function (category) { return (React__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 })); }))));
|
|
8037
8042
|
}
|
|
8038
8043
|
|
|
@@ -8144,7 +8149,6 @@ function useFilterBar(_a) {
|
|
|
8144
8149
|
var currentSearchParams = new URLSearchParams(window.location.search);
|
|
8145
8150
|
var updatedParams = new URLSearchParams();
|
|
8146
8151
|
try {
|
|
8147
|
-
// Copy existing parameters to updatedParams
|
|
8148
8152
|
for (var _d = __values(currentSearchParams.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
8149
8153
|
var _f = __read(_e.value, 2), key = _f[0], value = _f[1];
|
|
8150
8154
|
updatedParams.append(key, value);
|
|
@@ -8158,15 +8162,12 @@ function useFilterBar(_a) {
|
|
|
8158
8162
|
finally { if (e_1) throw e_1.error; }
|
|
8159
8163
|
}
|
|
8160
8164
|
try {
|
|
8161
|
-
// Update parameters based on newParams
|
|
8162
8165
|
for (var _g = __values(Object.entries(newParams)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
8163
8166
|
var _j = __read(_h.value, 2), key = _j[0], value = _j[1];
|
|
8164
8167
|
if (value) {
|
|
8165
|
-
console.log(value);
|
|
8166
8168
|
updatedParams.set(key, value.toString());
|
|
8167
8169
|
}
|
|
8168
8170
|
else {
|
|
8169
|
-
// Remove parameter if value is falsy
|
|
8170
8171
|
updatedParams.delete(key);
|
|
8171
8172
|
}
|
|
8172
8173
|
}
|
|
@@ -8178,10 +8179,9 @@ function useFilterBar(_a) {
|
|
|
8178
8179
|
}
|
|
8179
8180
|
finally { if (e_2) throw e_2.error; }
|
|
8180
8181
|
}
|
|
8181
|
-
console.log(updatedParams.toString());
|
|
8182
8182
|
var baseUrl = window.location.origin + window.location.pathname;
|
|
8183
|
-
// Construct the updated URL with the modified query parameters
|
|
8184
8183
|
var updatedUrl = "".concat(baseUrl, "?").concat(updatedParams.toString());
|
|
8184
|
+
handleSelectedFilter(false);
|
|
8185
8185
|
return (window.location.href = updatedUrl);
|
|
8186
8186
|
}
|
|
8187
8187
|
else {
|
|
@@ -8201,6 +8201,7 @@ function useFilterBar(_a) {
|
|
|
8201
8201
|
}
|
|
8202
8202
|
finally { if (e_3) throw e_3.error; }
|
|
8203
8203
|
}
|
|
8204
|
+
handleSelectedFilter(false);
|
|
8204
8205
|
return (window.location.href = "".concat(redirectUrl, "/").concat(selectedPath).concat(querySearchParams ? "?".concat(querySearchParams.toString()) : ''));
|
|
8205
8206
|
}
|
|
8206
8207
|
};
|
|
@@ -10506,14 +10507,16 @@ instance.loadNamespaces;
|
|
|
10506
10507
|
instance.loadLanguages;
|
|
10507
10508
|
|
|
10508
10509
|
var calendar$1 = {
|
|
10510
|
+
label: "When",
|
|
10511
|
+
labelPlaceholder: "Add check-in and check-out",
|
|
10509
10512
|
startDate: "Start date",
|
|
10510
10513
|
endDate: "End date",
|
|
10511
10514
|
title: "Calendar"
|
|
10512
10515
|
};
|
|
10513
10516
|
var guests$1 = {
|
|
10514
|
-
label: "
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
+
label: "Who",
|
|
10518
|
+
labelPlaceholder: "Add guests",
|
|
10519
|
+
title: "Who's coming?",
|
|
10517
10520
|
adultsLabel: "Adults",
|
|
10518
10521
|
kidsLabel: "kids"
|
|
10519
10522
|
};
|
|
@@ -10537,14 +10540,16 @@ var enFilterBar = {
|
|
|
10537
10540
|
};
|
|
10538
10541
|
|
|
10539
10542
|
var calendar = {
|
|
10543
|
+
label: "Milloin",
|
|
10544
|
+
labelPlaceholder: "Lisää check-in ja check-out",
|
|
10540
10545
|
startDate: "Alku",
|
|
10541
10546
|
endDate: "Loppu",
|
|
10542
10547
|
title: "Kalenteri"
|
|
10543
10548
|
};
|
|
10544
10549
|
var guests = {
|
|
10545
|
-
label: "
|
|
10546
|
-
|
|
10547
|
-
|
|
10550
|
+
label: "Kuka",
|
|
10551
|
+
labelPlaceholder: "Lisää vieraat",
|
|
10552
|
+
title: "Ketkä ovat tulossa?",
|
|
10548
10553
|
adultsLabel: "Aikuiset",
|
|
10549
10554
|
kidsLabel: "lapset"
|
|
10550
10555
|
};
|
|
@@ -10646,10 +10651,10 @@ function FilterBar(_a) {
|
|
|
10646
10651
|
React__default.createElement(SubmitButton, { label: t('tabs.events'), onClick: function () { return setSelectedPath('/events'); }, active: selectedPath === '/events' }),
|
|
10647
10652
|
React__default.createElement(SubmitButton, { label: t('tabs.rooms'), onClick: function () { return setSelectedPath('/rooms'); }, active: selectedPath === '/rooms' }))),
|
|
10648
10653
|
React__default.createElement("div", { className: "will-filter-bar-header" },
|
|
10649
|
-
React__default.createElement(SelectButton, { label: '
|
|
10654
|
+
React__default.createElement(SelectButton, { label: t('calendar.label'), description: t('calendar.labelPlaceholder'), onClick: function () { return handleSelectedFilter(1); }, style: fontWeightBold(selectedFilter === 1) }),
|
|
10650
10655
|
selectedPath === '/rooms' && (React__default.createElement(React__default.Fragment, null,
|
|
10651
10656
|
React__default.createElement(Divider, null),
|
|
10652
|
-
React__default.createElement(SelectButton, { label: '
|
|
10657
|
+
React__default.createElement(SelectButton, { label: t('guests.label'), description: t('guests.labelPlaceholder'), onClick: function () { return handleSelectedFilter(2); }, style: fontWeightBold(selectedFilter === 2) }))),
|
|
10653
10658
|
React__default.createElement(SubmitButton$1, { onClick: handleSubmit })),
|
|
10654
10659
|
selectedFilter && (React__default.createElement("div", { className: "will-filter-bar-container", style: currentViewApply && !isMobile ? { top: 66 } : {} },
|
|
10655
10660
|
React__default.createElement(CloseButton, { handleClose: function () { return handleSelectedFilter(false); } }),
|