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