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.esm.js
CHANGED
|
@@ -7983,6 +7983,10 @@ styleInject(css_248z$6);
|
|
|
7983
7983
|
|
|
7984
7984
|
function GuestCount(_a) {
|
|
7985
7985
|
var label = _a.label, sortOrder = _a.sortOrder, id = _a.id, updateGuestsCount = _a.updateGuestsCount, count = _a.count, minVal = _a.minVal;
|
|
7986
|
+
useEffect(function () {
|
|
7987
|
+
if (minVal)
|
|
7988
|
+
updateGuestsCount("guests-".concat(id), minVal);
|
|
7989
|
+
}, []);
|
|
7986
7990
|
var handleDecrement = function () {
|
|
7987
7991
|
if (count > minVal) {
|
|
7988
7992
|
updateGuestsCount("guests-".concat(id), count - 1);
|
|
@@ -8011,8 +8015,9 @@ styleInject(css_248z$5);
|
|
|
8011
8015
|
|
|
8012
8016
|
function Guests(_a) {
|
|
8013
8017
|
var ageCategories = _a.ageCategories, updateGuestsCount = _a.updateGuestsCount, ageCategoryCounts = _a.ageCategoryCounts;
|
|
8018
|
+
var t = useTranslation('filterBar').t;
|
|
8014
8019
|
return (React__default__default.createElement("div", { className: "will-filter-bar-guests" },
|
|
8015
|
-
React__default__default.createElement("h3", { className: "will-guests-filter-title" },
|
|
8020
|
+
React__default__default.createElement("h3", { className: "will-guests-filter-title" }, t('guests.title')),
|
|
8016
8021
|
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 })); }))));
|
|
8017
8022
|
}
|
|
8018
8023
|
|
|
@@ -8124,7 +8129,6 @@ function useFilterBar(_a) {
|
|
|
8124
8129
|
var currentSearchParams = new URLSearchParams(window.location.search);
|
|
8125
8130
|
var updatedParams = new URLSearchParams();
|
|
8126
8131
|
try {
|
|
8127
|
-
// Copy existing parameters to updatedParams
|
|
8128
8132
|
for (var _d = __values(currentSearchParams.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
8129
8133
|
var _f = __read(_e.value, 2), key = _f[0], value = _f[1];
|
|
8130
8134
|
updatedParams.append(key, value);
|
|
@@ -8138,15 +8142,12 @@ function useFilterBar(_a) {
|
|
|
8138
8142
|
finally { if (e_1) throw e_1.error; }
|
|
8139
8143
|
}
|
|
8140
8144
|
try {
|
|
8141
|
-
// Update parameters based on newParams
|
|
8142
8145
|
for (var _g = __values(Object.entries(newParams)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
8143
8146
|
var _j = __read(_h.value, 2), key = _j[0], value = _j[1];
|
|
8144
8147
|
if (value) {
|
|
8145
|
-
console.log(value);
|
|
8146
8148
|
updatedParams.set(key, value.toString());
|
|
8147
8149
|
}
|
|
8148
8150
|
else {
|
|
8149
|
-
// Remove parameter if value is falsy
|
|
8150
8151
|
updatedParams.delete(key);
|
|
8151
8152
|
}
|
|
8152
8153
|
}
|
|
@@ -8158,10 +8159,9 @@ function useFilterBar(_a) {
|
|
|
8158
8159
|
}
|
|
8159
8160
|
finally { if (e_2) throw e_2.error; }
|
|
8160
8161
|
}
|
|
8161
|
-
console.log(updatedParams.toString());
|
|
8162
8162
|
var baseUrl = window.location.origin + window.location.pathname;
|
|
8163
|
-
// Construct the updated URL with the modified query parameters
|
|
8164
8163
|
var updatedUrl = "".concat(baseUrl, "?").concat(updatedParams.toString());
|
|
8164
|
+
handleSelectedFilter(false);
|
|
8165
8165
|
return (window.location.href = updatedUrl);
|
|
8166
8166
|
}
|
|
8167
8167
|
else {
|
|
@@ -8181,6 +8181,7 @@ function useFilterBar(_a) {
|
|
|
8181
8181
|
}
|
|
8182
8182
|
finally { if (e_3) throw e_3.error; }
|
|
8183
8183
|
}
|
|
8184
|
+
handleSelectedFilter(false);
|
|
8184
8185
|
return (window.location.href = "".concat(redirectUrl, "/").concat(selectedPath).concat(querySearchParams ? "?".concat(querySearchParams.toString()) : ''));
|
|
8185
8186
|
}
|
|
8186
8187
|
};
|
|
@@ -10486,14 +10487,16 @@ instance.loadNamespaces;
|
|
|
10486
10487
|
instance.loadLanguages;
|
|
10487
10488
|
|
|
10488
10489
|
var calendar$1 = {
|
|
10490
|
+
label: "When",
|
|
10491
|
+
labelPlaceholder: "Add check-in and check-out",
|
|
10489
10492
|
startDate: "Start date",
|
|
10490
10493
|
endDate: "End date",
|
|
10491
10494
|
title: "Calendar"
|
|
10492
10495
|
};
|
|
10493
10496
|
var guests$1 = {
|
|
10494
|
-
label: "
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
+
label: "Who",
|
|
10498
|
+
labelPlaceholder: "Add guests",
|
|
10499
|
+
title: "Who's coming?",
|
|
10497
10500
|
adultsLabel: "Adults",
|
|
10498
10501
|
kidsLabel: "kids"
|
|
10499
10502
|
};
|
|
@@ -10517,14 +10520,16 @@ var enFilterBar = {
|
|
|
10517
10520
|
};
|
|
10518
10521
|
|
|
10519
10522
|
var calendar = {
|
|
10523
|
+
label: "Milloin",
|
|
10524
|
+
labelPlaceholder: "Lisää check-in ja check-out",
|
|
10520
10525
|
startDate: "Alku",
|
|
10521
10526
|
endDate: "Loppu",
|
|
10522
10527
|
title: "Kalenteri"
|
|
10523
10528
|
};
|
|
10524
10529
|
var guests = {
|
|
10525
|
-
label: "
|
|
10526
|
-
|
|
10527
|
-
|
|
10530
|
+
label: "Kuka",
|
|
10531
|
+
labelPlaceholder: "Lisää vieraat",
|
|
10532
|
+
title: "Ketkä ovat tulossa?",
|
|
10528
10533
|
adultsLabel: "Aikuiset",
|
|
10529
10534
|
kidsLabel: "lapset"
|
|
10530
10535
|
};
|
|
@@ -10626,10 +10631,10 @@ function FilterBar(_a) {
|
|
|
10626
10631
|
React__default__default.createElement(SubmitButton, { label: t('tabs.events'), onClick: function () { return setSelectedPath('/events'); }, active: selectedPath === '/events' }),
|
|
10627
10632
|
React__default__default.createElement(SubmitButton, { label: t('tabs.rooms'), onClick: function () { return setSelectedPath('/rooms'); }, active: selectedPath === '/rooms' }))),
|
|
10628
10633
|
React__default__default.createElement("div", { className: "will-filter-bar-header" },
|
|
10629
|
-
React__default__default.createElement(SelectButton, { label: '
|
|
10634
|
+
React__default__default.createElement(SelectButton, { label: t('calendar.label'), description: t('calendar.labelPlaceholder'), onClick: function () { return handleSelectedFilter(1); }, style: fontWeightBold(selectedFilter === 1) }),
|
|
10630
10635
|
selectedPath === '/rooms' && (React__default__default.createElement(React__default__default.Fragment, null,
|
|
10631
10636
|
React__default__default.createElement(Divider, null),
|
|
10632
|
-
React__default__default.createElement(SelectButton, { label: '
|
|
10637
|
+
React__default__default.createElement(SelectButton, { label: t('guests.label'), description: t('guests.labelPlaceholder'), onClick: function () { return handleSelectedFilter(2); }, style: fontWeightBold(selectedFilter === 2) }))),
|
|
10633
10638
|
React__default__default.createElement(SubmitButton$1, { onClick: handleSubmit })),
|
|
10634
10639
|
selectedFilter && (React__default__default.createElement("div", { className: "will-filter-bar-container", style: currentViewApply && !isMobile ? { top: 66 } : {} },
|
|
10635
10640
|
React__default__default.createElement(CloseButton, { handleClose: function () { return handleSelectedFilter(false); } }),
|