willba-component-library 0.1.46 → 0.1.47

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.umd.js CHANGED
@@ -451,6 +451,18 @@
451
451
  });
452
452
  }
453
453
 
454
+ function useTheme(_a) {
455
+ var palette = _a.palette;
456
+ var themePalette = {
457
+ '--will-primary': palette === null || palette === void 0 ? void 0 : palette.primary,
458
+ '--will-secondary': palette === null || palette === void 0 ? void 0 : palette.secondary,
459
+ };
460
+ return themePalette;
461
+ }
462
+
463
+ var css_248z$b = "@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');\n\n.will-root * {\n font-family: 'Montserrat', sans-serif;\n}\n\n.will-root {\n \n box-sizing: border-box;\n font-size: 14px;\n \n color: #1E1E1E;\n\n /* Palette */\n --will-primary: #374269;\n --will-secondary: #374269;\n --will-grey: #ABA7AF;\n --will-white: #fff;\n --will-black: #000;\n --will-onahau: #CDEEFF;\n --will-text: #5A5959;\n --will-transparent-white: rgba(255, 255, 255, 0.30);\n\n /* Confines */\n --will-box-shadow: 0px 6px 11px 0px #a7a4a480;\n\n /* Breakpoints */\n\n --will-lg: 1140px;\n --will-md: 960px;\n --will-sm: 600px;\n --will-xl: 1280px;\n --will-xs: 0px;\n}\n\n/* Typography */\n\n.will-root h1, h2, h3, h4, h5, h6 {\n font-weight: 700;\n} \n\n.will-root p, h1, h2, h3, h4, h5, h6, span {\n margin: 0;\n padding: 0;\n}";
464
+ styleInject(css_248z$b);
465
+
454
466
  function _typeof(o) {
455
467
  "@babel/helpers - typeof";
456
468
 
@@ -3891,18 +3903,6 @@
3891
3903
  return date;
3892
3904
  }
3893
3905
 
3894
- function useTheme(_a) {
3895
- var palette = _a.palette;
3896
- var themePalette = {
3897
- '--will-primary': palette === null || palette === void 0 ? void 0 : palette.primary,
3898
- '--will-secondary': palette === null || palette === void 0 ? void 0 : palette.secondary,
3899
- };
3900
- return themePalette;
3901
- }
3902
-
3903
- var css_248z$b = "@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');\n\n.will-root * {\n font-family: 'Montserrat', sans-serif;\n}\n\n.will-root {\n \n box-sizing: border-box;\n font-size: 14px;\n \n color: #1E1E1E;\n\n /* Palette */\n --will-primary: #374269;\n --will-secondary: #374269;\n --will-grey: #ABA7AF;\n --will-white: #fff;\n --will-black: #000;\n --will-onahau: #CDEEFF;\n --will-text: #5A5959;\n --will-transparent-white: rgba(255, 255, 255, 0.30);\n\n /* Confines */\n --will-box-shadow: 0px 6px 11px 0px #a7a4a480;\n\n /* Breakpoints */\n\n --will-lg: 1140px;\n --will-md: 960px;\n --will-sm: 600px;\n --will-xl: 1280px;\n --will-xs: 0px;\n}\n\n/* Typography */\n\n.will-root h1, h2, h3, h4, h5, h6 {\n font-weight: 700;\n} \n\n.will-root p, h1, h2, h3, h4, h5, h6, span {\n margin: 0;\n padding: 0;\n}";
3904
- styleInject(css_248z$b);
3905
-
3906
3906
  var parseDates = function (_a) {
3907
3907
  var calendarRange = _a.calendarRange;
3908
3908
  return (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) && (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from)
@@ -3922,6 +3922,13 @@
3922
3922
  }, '');
3923
3923
  };
3924
3924
 
3925
+ var FilterSections;
3926
+ (function (FilterSections) {
3927
+ FilterSections["CALENDAR"] = "calendar";
3928
+ FilterSections["GUESTS"] = "guests";
3929
+ FilterSections["CATEGORIES"] = "categories";
3930
+ })(FilterSections || (FilterSections = {}));
3931
+
3925
3932
  var useFilterBar = function (_a) {
3926
3933
  var redirectUrl = _a.redirectUrl, currentViewApply = _a.currentViewApply, ageCategories = _a.ageCategories;
3927
3934
  var _b = __read(React__default.useState('/events'), 2), selectedPath = _b[0], setSelectedPath = _b[1];
@@ -4093,7 +4100,7 @@
4093
4100
  var _b = __read(React__default.useState(true), 2), isMobile = _b[0], setIsMobile = _b[1];
4094
4101
  var targetFilterBarRef = React__default.useRef(null);
4095
4102
  React__default.useEffect(function () {
4096
- if (window !== undefined && window.innerWidth > 960) {
4103
+ if (typeof window !== 'undefined' && window.innerWidth > 960) {
4097
4104
  setIsMobile(false);
4098
4105
  return;
4099
4106
  }
@@ -6577,16 +6584,16 @@
6577
6584
  React__default.createElement(IoIosCloseCircleOutline, null)));
6578
6585
  };
6579
6586
 
6580
- var css_248z$9 = ".will-filter-bar-select-button {\n width: 100%;\n height: auto;\n background-color: transparent;\n border: none;\n padding: 0 20px;\n border-radius: 20px;\n cursor: pointer;\n font-size: 14px;\n text-align: initial;\n}\n\n\n\n.will-filter-bar-select-button .select-button-wrapper {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 10px;\n \n}\n\n.will-filter-bar-select-button .select-button-wrapper > div {\n display: grid\n}\n\n.will-filter-bar-select-button .select-button-description {\n font-weight: 400;\n opacity: 0.4;\n \n \n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n@media (max-width: 960px) {\n .will-filter-bar-select-button {\n padding: 15px 0;\n }\n\n .will-filter-bar-select-button:first-child {\n padding: 0 0 15px 0;\n }\n\n .will-filter-bar-select-button .select-button-wrapper {\n justify-content: center;\n text-align: center;\n }\n\n .will-filter-bar-select-button .select-button-description {\n white-space: wrap;\n }\n\n .will-filter-bar-select-button .select-button-divider {\n display: none\n }\n}\n\n\n";
6587
+ var css_248z$9 = ".will-filter-bar-select-button {\n width: 100%;\n height: auto;\n background-color: transparent;\n border: none;\n padding: 0 20px;\n border-radius: 20px;\n cursor: pointer;\n font-size: 14px;\n text-align: initial;\n}\n\n.will-filter-bar-select-button .select-button-wrapper {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 10px;\n \n}\n\n.will-filter-bar-select-button .select-button-wrapper > div {\n display: grid\n}\n\n.will-filter-bar-select-button .select-button-label {\n font-weight: 500;\n}\n\n.will-filter-bar-select-button .select-button-description {\n font-weight: 400;\n opacity: 0.8;\n \n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .will-filter-bar-select-button .select-button-label.active,\n .will-filter-bar-select-button .select-button-description.active {\n font-weight: 600;\n }\n\n@media (max-width: 960px) {\n .will-filter-bar-select-button {\n padding: 15px 0;\n }\n\n .will-filter-bar-select-button:first-child {\n padding: 0 0 15px 0;\n }\n\n .will-filter-bar-select-button .select-button-wrapper {\n justify-content: center;\n text-align: center;\n }\n\n .will-filter-bar-select-button .select-button-description {\n white-space: wrap;\n }\n\n .will-filter-bar-select-button .select-button-divider {\n display: none\n }\n}\n\n\n";
6581
6588
  styleInject(css_248z$9);
6582
6589
 
6583
6590
  var SelectButton = function (_a) {
6584
- var label = _a.label, onClick = _a.onClick, style = _a.style, description = _a.description;
6585
- return (React__default.createElement("button", { className: "will-filter-bar-select-button", onClick: onClick, style: style },
6591
+ var active = _a.active, label = _a.label, onClick = _a.onClick, description = _a.description;
6592
+ return (React__default.createElement("button", { className: "will-filter-bar-select-button", onClick: onClick },
6586
6593
  React__default.createElement("span", { className: "select-button-wrapper" },
6587
6594
  React__default.createElement("div", null,
6588
- React__default.createElement("p", { className: "select-button-label" }, label),
6589
- React__default.createElement("p", { className: "select-button-description" }, description)))));
6595
+ React__default.createElement("p", { className: "select-button-label ".concat(active ? 'active' : '') }, label),
6596
+ React__default.createElement("p", { className: "select-button-description ".concat(active ? 'active' : '') }, description)))));
6590
6597
  };
6591
6598
 
6592
6599
  // THIS FILE IS AUTO GENERATED
@@ -10695,7 +10702,7 @@
10695
10702
  var t = useTranslation('filterBar').t;
10696
10703
  // Filters
10697
10704
  var _d = useFilterBar({ redirectUrl: redirectUrl, currentViewApply: currentViewApply, ageCategories: ageCategories }), selectedFilter = _d.selectedFilter, ageCategoryCounts = _d.ageCategoryCounts, categories = _d.categories, calendarRange = _d.calendarRange, selectedPath = _d.selectedPath, setCalendarRange = _d.setCalendarRange, setCategories = _d.setCategories, handleSelectedFilter = _d.handleSelectedFilter, handleSubmit = _d.handleSubmit, updateGuestsCount = _d.updateGuestsCount, setSelectedPath = _d.setSelectedPath;
10698
- // Default selected tab
10705
+ // Default selected tab when tabs are hidden
10699
10706
  React__default.useEffect(function () {
10700
10707
  if (currentViewApply === 'roomFilters') {
10701
10708
  setSelectedPath('/rooms');
@@ -10705,6 +10712,7 @@
10705
10712
  var _e = useScrollInToView({ selectedFilter: selectedFilter }), isMobile = _e.isMobile, targetFilterBarRef = _e.targetFilterBarRef;
10706
10713
  // Handle close filter section
10707
10714
  var filtersRef = useCloseFilterSection({ handleSelectedFilter: handleSelectedFilter }).filtersRef;
10715
+ // Parsed data for filter section description
10708
10716
  var parsedDates = parseDates({ calendarRange: calendarRange });
10709
10717
  var parsedGuests = parseGuests({ ageCategoryCounts: ageCategoryCounts, ageCategories: ageCategories });
10710
10718
  return (React__default.createElement("div", { className: "will-root", style: themePalette },
@@ -10716,21 +10724,18 @@
10716
10724
  ? parsedDates
10717
10725
  : selectedPath === '/rooms'
10718
10726
  ? t('calendar.roomsLabelPlaceholder')
10719
- : t('calendar.eventsLabelPlaceholder'), onClick: function () { return handleSelectedFilter(1); }, style: fontWeightBold(selectedFilter === 1), date: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) ? format(calendarRange.to, 'dd.MM.yyyy') : null }),
10727
+ : t('calendar.eventsLabelPlaceholder'), onClick: function () { return handleSelectedFilter(FilterSections.CALENDAR); }, active: selectedFilter === FilterSections.CALENDAR }),
10720
10728
  selectedPath === '/rooms' && (React__default.createElement(React__default.Fragment, null,
10721
10729
  React__default.createElement(Divider, null),
10722
- React__default.createElement(SelectButton, { label: t('guests.label'), description: parsedGuests ? parsedGuests : t('guests.labelPlaceholder'), onClick: function () { return handleSelectedFilter(2); }, style: fontWeightBold(selectedFilter === 2) }))),
10730
+ React__default.createElement(SelectButton, { label: t('guests.label'), description: parsedGuests ? parsedGuests : t('guests.labelPlaceholder'), onClick: function () { return handleSelectedFilter(FilterSections.GUESTS); }, active: selectedFilter === FilterSections.GUESTS }))),
10723
10731
  React__default.createElement(SubmitButton, { onClick: handleSubmit })),
10724
10732
  selectedFilter && (React__default.createElement("div", { className: "will-filter-bar-container", style: currentViewApply && !isMobile ? { top: 66 } : {} },
10725
10733
  React__default.createElement(CloseButton, { handleClose: function () { return handleSelectedFilter(false); } }),
10726
- selectedFilter === 1 && (React__default.createElement(Calendar, { calendarRange: calendarRange, setCalendarRange: setCalendarRange, ref: filtersRef })),
10727
- selectedFilter === 2 && (React__default.createElement(Guests, { updateGuestsCount: updateGuestsCount, ageCategories: ageCategories, ageCategoryCounts: ageCategoryCounts, ref: filtersRef })),
10728
- selectedFilter === 3 && (React__default.createElement(Categories, { categories: categories, setCategories: setCategories }))))));
10734
+ selectedFilter === FilterSections.CALENDAR && (React__default.createElement(Calendar, { calendarRange: calendarRange, setCalendarRange: setCalendarRange, ref: filtersRef })),
10735
+ selectedFilter === FilterSections.GUESTS && (React__default.createElement(Guests, { updateGuestsCount: updateGuestsCount, ageCategories: ageCategories, ageCategoryCounts: ageCategoryCounts, ref: filtersRef })),
10736
+ selectedFilter === FilterSections.CATEGORIES && (React__default.createElement(Categories, { categories: categories, setCategories: setCategories }))))));
10729
10737
  }
10730
10738
  ////////////
10731
- var fontWeightBold = function (input) {
10732
- return { fontWeight: input ? 'bold' : 'initial' };
10733
- };
10734
10739
  var AGE_CATEGORIES_FALLBACK = [
10735
10740
  {
10736
10741
  id: '1',