willba-component-library 0.1.77 → 0.1.79
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 +16 -65
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +16 -65
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +16 -65
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.tsx +1 -1
- package/src/components/FilterBar/hooks/useFilterBar.tsx +11 -46
package/lib/index.js
CHANGED
|
@@ -4009,7 +4009,7 @@ var useFilterBar = function (_a) {
|
|
|
4009
4009
|
setSelectedFilter(id);
|
|
4010
4010
|
};
|
|
4011
4011
|
var handleSubmit = function () {
|
|
4012
|
-
var e_1, _a
|
|
4012
|
+
var e_1, _a;
|
|
4013
4013
|
var newParams = {
|
|
4014
4014
|
startDate: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from)
|
|
4015
4015
|
? format(calendarRange.from, 'yyyy-MM-dd')
|
|
@@ -4021,75 +4021,26 @@ var useFilterBar = function (_a) {
|
|
|
4021
4021
|
ageCategories: ageCategories,
|
|
4022
4022
|
}),
|
|
4023
4023
|
};
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
var
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
updatedParams.append(key, value);
|
|
4031
|
-
}
|
|
4032
|
-
}
|
|
4033
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
4034
|
-
finally {
|
|
4035
|
-
try {
|
|
4036
|
-
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
4037
|
-
}
|
|
4038
|
-
finally { if (e_1) throw e_1.error; }
|
|
4039
|
-
}
|
|
4040
|
-
try {
|
|
4041
|
-
for (var _g = __values(Object.entries(newParams)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
4042
|
-
var _j = __read(_h.value, 2), key = _j[0], value = _j[1];
|
|
4043
|
-
if (value) {
|
|
4044
|
-
updatedParams.set(key, value.toString());
|
|
4045
|
-
}
|
|
4046
|
-
else {
|
|
4047
|
-
updatedParams.delete(key);
|
|
4048
|
-
}
|
|
4049
|
-
}
|
|
4050
|
-
}
|
|
4051
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
4052
|
-
finally {
|
|
4053
|
-
try {
|
|
4054
|
-
if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
|
|
4024
|
+
var querySearchParams = new URLSearchParams();
|
|
4025
|
+
try {
|
|
4026
|
+
for (var _b = __values(Object.entries(newParams)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
4027
|
+
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
4028
|
+
if (value) {
|
|
4029
|
+
querySearchParams.append(key, value.toString());
|
|
4055
4030
|
}
|
|
4056
|
-
finally { if (e_2) throw e_2.error; }
|
|
4057
4031
|
}
|
|
4058
|
-
var baseUrl = window.location.origin + window.location.pathname;
|
|
4059
|
-
var updatedUrl = "".concat(baseUrl, "?").concat(updatedParams.toString());
|
|
4060
|
-
handleSelectedFilter(false);
|
|
4061
|
-
if (onSubmit && selectedPath === Pages.ROOMS) {
|
|
4062
|
-
var updatedParamsObject_1 = {};
|
|
4063
|
-
updatedParams.forEach(function (value, key) {
|
|
4064
|
-
if (value)
|
|
4065
|
-
updatedParamsObject_1[key] = value;
|
|
4066
|
-
});
|
|
4067
|
-
return onSubmit(updatedParamsObject_1);
|
|
4068
|
-
}
|
|
4069
|
-
return (window.location.href = updatedUrl);
|
|
4070
4032
|
}
|
|
4071
|
-
|
|
4072
|
-
|
|
4033
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
4034
|
+
finally {
|
|
4073
4035
|
try {
|
|
4074
|
-
|
|
4075
|
-
var _m = __read(_l.value, 2), key = _m[0], value = _m[1];
|
|
4076
|
-
if (value) {
|
|
4077
|
-
querySearchParams.append(key, value.toString());
|
|
4078
|
-
}
|
|
4079
|
-
}
|
|
4080
|
-
}
|
|
4081
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
4082
|
-
finally {
|
|
4083
|
-
try {
|
|
4084
|
-
if (_l && !_l.done && (_c = _k.return)) _c.call(_k);
|
|
4085
|
-
}
|
|
4086
|
-
finally { if (e_3) throw e_3.error; }
|
|
4036
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
4087
4037
|
}
|
|
4088
|
-
|
|
4089
|
-
return onSubmit && selectedPath === Pages.ROOMS
|
|
4090
|
-
? onSubmit(newParams)
|
|
4091
|
-
: (window.location.href = "".concat(redirectUrl, "/").concat(selectedPath).concat(querySearchParams ? "?".concat(querySearchParams.toString()) : ''));
|
|
4038
|
+
finally { if (e_1) throw e_1.error; }
|
|
4092
4039
|
}
|
|
4040
|
+
handleSelectedFilter(false);
|
|
4041
|
+
return onSubmit && selectedPath === Pages.ROOMS
|
|
4042
|
+
? onSubmit(newParams)
|
|
4043
|
+
: (window.location.href = "".concat(redirectUrl, "/").concat(selectedPath).concat(querySearchParams ? "?".concat(querySearchParams.toString()) : ''));
|
|
4093
4044
|
};
|
|
4094
4045
|
var handleResetFilters = function () {
|
|
4095
4046
|
setAgeCategoryCounts({});
|
|
@@ -11177,7 +11128,7 @@ function FilterBar(_a) {
|
|
|
11177
11128
|
React__default.createElement(Divider, null),
|
|
11178
11129
|
React__default.createElement(SelectButton, { label: t('guests.label'), description: parsedGuests.content, onClick: function () { return handleSelectedFilter(FilterSections.GUESTS); }, active: !!parsedGuests.data.total }))),
|
|
11179
11130
|
React__default.createElement(SubmitButton, { onClick: handleSubmit })),
|
|
11180
|
-
selectedFilter && (React__default.createElement("div", { className: "will-filter-bar-container ".concat(mode || 'dark'), style: tabs
|
|
11131
|
+
selectedFilter && (React__default.createElement("div", { className: "will-filter-bar-container ".concat(mode || 'dark'), style: (!tabs || tabs.length < 2) && !isMobile ? { top: 66 } : {} },
|
|
11181
11132
|
React__default.createElement(CloseButton, { handleClose: function () { return handleSelectedFilter(false); } }),
|
|
11182
11133
|
selectedFilter === FilterSections.CALENDAR && (React__default.createElement(Calendar, { calendarRange: calendarRange, setCalendarRange: setCalendarRange, ref: filtersRef, calendarOffset: calendarOffset, selectedPath: selectedPath, locale: language })),
|
|
11183
11134
|
selectedFilter === FilterSections.GUESTS && (React__default.createElement(Guests, { updateGuestsCount: updateGuestsCount, ageCategories: ageCategories, ageCategoryCounts: ageCategoryCounts, ref: filtersRef })),
|