willba-component-library 0.1.42 → 0.1.44
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 +19 -44
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +19 -44
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +19 -44
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/components/calendar/Calendar.tsx +6 -9
- package/src/components/FilterBar/components/guests/GuestCount/GuestCount.tsx +9 -6
- package/src/components/FilterBar/hooks/useFilterBar.tsx +3 -42
package/lib/index.umd.js
CHANGED
|
@@ -3923,7 +3923,7 @@
|
|
|
3923
3923
|
};
|
|
3924
3924
|
|
|
3925
3925
|
var useFilterBar = function (_a) {
|
|
3926
|
-
var redirectUrl = _a.redirectUrl, currentViewApply = _a.currentViewApply
|
|
3926
|
+
var redirectUrl = _a.redirectUrl, currentViewApply = _a.currentViewApply; _a.ageCategories;
|
|
3927
3927
|
var _b = __read(React__default.useState('/events'), 2), selectedPath = _b[0], setSelectedPath = _b[1];
|
|
3928
3928
|
var _c = __read(React__default.useState(false), 2), selectedFilter = _c[0], setSelectedFilter = _c[1];
|
|
3929
3929
|
var _d = __read(React__default.useState(), 2), calendarRange = _d[0], setCalendarRange = _d[1];
|
|
@@ -3982,10 +3982,9 @@
|
|
|
3982
3982
|
: '',
|
|
3983
3983
|
endDate: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) ? format(calendarRange.to, 'yyyy-MM-dd') : '',
|
|
3984
3984
|
categories: categories,
|
|
3985
|
-
ageCategoryCounts:
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
}),
|
|
3985
|
+
ageCategoryCounts: Object.entries(ageCategoryCounts).length
|
|
3986
|
+
? JSON.stringify(ageCategoryCounts)
|
|
3987
|
+
: '',
|
|
3989
3988
|
};
|
|
3990
3989
|
if (currentViewApply) {
|
|
3991
3990
|
var currentSearchParams = new URLSearchParams(window.location.search);
|
|
@@ -4069,31 +4068,6 @@
|
|
|
4069
4068
|
setSelectedPath: setSelectedPath,
|
|
4070
4069
|
};
|
|
4071
4070
|
};
|
|
4072
|
-
////////////
|
|
4073
|
-
var handleAgeCategoryRules = function (_a) {
|
|
4074
|
-
var ageCategoryCounts = _a.ageCategoryCounts, ageCategories = _a.ageCategories;
|
|
4075
|
-
if (ageCategories === null || ageCategories === void 0 ? void 0 : ageCategories.length) {
|
|
4076
|
-
ageCategories === null || ageCategories === void 0 ? void 0 : ageCategories.map(function (a) {
|
|
4077
|
-
if (a.minVal) {
|
|
4078
|
-
// Age categories rules
|
|
4079
|
-
var totalAgeCategories = Object.entries(ageCategoryCounts).reduce(function (acc, c) {
|
|
4080
|
-
return acc + c[1];
|
|
4081
|
-
}, 0);
|
|
4082
|
-
var ageCategory = ageCategoryCounts["guests-".concat(a.id)];
|
|
4083
|
-
if (!totalAgeCategories ||
|
|
4084
|
-
(totalAgeCategories === 1 && ageCategory === 1)) {
|
|
4085
|
-
ageCategoryCounts["guests-".concat(a.id)] = 2;
|
|
4086
|
-
}
|
|
4087
|
-
else if (totalAgeCategories > 1 && !ageCategory) {
|
|
4088
|
-
ageCategoryCounts["guests-".concat(a.id)] = a.minVal;
|
|
4089
|
-
}
|
|
4090
|
-
}
|
|
4091
|
-
});
|
|
4092
|
-
}
|
|
4093
|
-
return Object.entries(ageCategoryCounts).length
|
|
4094
|
-
? JSON.stringify(ageCategoryCounts)
|
|
4095
|
-
: '';
|
|
4096
|
-
};
|
|
4097
4071
|
|
|
4098
4072
|
var useScrollInToView = function (_a) {
|
|
4099
4073
|
var selectedFilter = _a.selectedFilter;
|
|
@@ -6626,6 +6600,11 @@
|
|
|
6626
6600
|
|
|
6627
6601
|
function GuestCount(_a) {
|
|
6628
6602
|
var label = _a.label, sortOrder = _a.sortOrder, id = _a.id, updateGuestsCount = _a.updateGuestsCount, count = _a.count, minVal = _a.minVal;
|
|
6603
|
+
React__default.useEffect(function () {
|
|
6604
|
+
if (minVal && minVal > count) {
|
|
6605
|
+
updateGuestsCount("guests-".concat(id), minVal);
|
|
6606
|
+
}
|
|
6607
|
+
}, []);
|
|
6629
6608
|
var handleDecrement = function () {
|
|
6630
6609
|
if (count > minVal) {
|
|
6631
6610
|
updateGuestsCount("guests-".concat(id), count - 1);
|
|
@@ -6637,13 +6616,10 @@
|
|
|
6637
6616
|
return (React__default.createElement("div", { className: "will-guests-filter-inner", style: { order: "".concat(sortOrder) } },
|
|
6638
6617
|
React__default.createElement("p", { className: "will-guests-filter-label" }, label),
|
|
6639
6618
|
React__default.createElement("div", { className: "will-guests-filter-counter" },
|
|
6640
|
-
React__default.createElement("button", { className: "will-guests-filter-counter-button", onClick: handleDecrement, disabled: minVal && count <= minVal ? true : false, style: {
|
|
6641
|
-
cursor: minVal && count <= minVal
|
|
6642
|
-
? 'initial'
|
|
6643
|
-
: !minVal && count < 1
|
|
6644
|
-
? 'initial'
|
|
6645
|
-
: 'pointer',
|
|
6619
|
+
React__default.createElement("button", { className: "will-guests-filter-counter-button", onClick: handleDecrement, disabled: (minVal && count <= minVal) || !count ? true : false, style: {
|
|
6620
|
+
cursor: (minVal && count <= minVal) || !count ? 'initial' : 'pointer',
|
|
6646
6621
|
paddingBottom: '4px',
|
|
6622
|
+
opacity: (minVal && count <= minVal) || !count ? 0.4 : 1,
|
|
6647
6623
|
} }, "-"),
|
|
6648
6624
|
React__default.createElement("span", { className: "will-guests-filter-count" }, count),
|
|
6649
6625
|
React__default.createElement("button", { className: "will-guests-filter-counter-button", onClick: handleIncrement }, "+"))));
|
|
@@ -10637,6 +10613,10 @@
|
|
|
10637
10613
|
var Calendar = React__default.forwardRef(function (_a, ref) {
|
|
10638
10614
|
var calendarRange = _a.calendarRange, setCalendarRange = _a.setCalendarRange;
|
|
10639
10615
|
var isTablet = reactResponsiveExports.useMediaQuery({ maxWidth: 960 });
|
|
10616
|
+
React__default.useEffect(function () {
|
|
10617
|
+
if (!calendarRange)
|
|
10618
|
+
setCalendarRange(undefined);
|
|
10619
|
+
}, []);
|
|
10640
10620
|
var today = startOfDay(new Date());
|
|
10641
10621
|
var disabledDays = [
|
|
10642
10622
|
{
|
|
@@ -10644,19 +10624,14 @@
|
|
|
10644
10624
|
to: addDays(today, -50),
|
|
10645
10625
|
},
|
|
10646
10626
|
];
|
|
10647
|
-
|
|
10648
|
-
if (!calendarRange)
|
|
10649
|
-
setCalendarRange(undefined);
|
|
10650
|
-
}, []);
|
|
10627
|
+
var selectedStartDate = calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from;
|
|
10651
10628
|
return (React__default.createElement("div", { className: "will-filter-bar-calendar", ref: ref },
|
|
10652
10629
|
React__default.createElement("div", { className: "will-calendar-filter-container" },
|
|
10653
|
-
React__default.createElement(DayPicker, { id: "will-calendar", mode: "range",
|
|
10654
|
-
//showOutsideDays
|
|
10655
|
-
numberOfMonths: !isTablet ? 2 : 1, weekStartsOn: 1, selected: calendarRange, onSelect: setCalendarRange, modifiersClassNames: {
|
|
10630
|
+
React__default.createElement(DayPicker, { id: "will-calendar", mode: "range", numberOfMonths: !isTablet ? 2 : 1, weekStartsOn: 1, selected: calendarRange, onSelect: setCalendarRange, modifiersClassNames: {
|
|
10656
10631
|
today: 'my-today',
|
|
10657
10632
|
}, modifiersStyles: {
|
|
10658
10633
|
disabled: { opacity: '0.2' },
|
|
10659
|
-
}, captionLayout: "dropdown-buttons", defaultMonth: today, disabled: disabledDays, fromMonth: today }))));
|
|
10634
|
+
}, captionLayout: "dropdown-buttons", defaultMonth: selectedStartDate || today, disabled: disabledDays, fromMonth: today }))));
|
|
10660
10635
|
});
|
|
10661
10636
|
|
|
10662
10637
|
var css_248z$2 = ".will-filter-bar-divider {\n width: 1px;\n margin: 0 10px;\n background-color: #384265;\n}\n\n@media (max-width: 960px) {\n .will-filter-bar-divider {\n width: auto;\n margin: 0 10px;\n height: 1px;\n background-color: #384265;\n }\n}";
|