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.js CHANGED
@@ -449,6 +449,18 @@ function useTranslation(ns) {
449
449
  });
450
450
  }
451
451
 
452
+ function useTheme(_a) {
453
+ var palette = _a.palette;
454
+ var themePalette = {
455
+ '--will-primary': palette === null || palette === void 0 ? void 0 : palette.primary,
456
+ '--will-secondary': palette === null || palette === void 0 ? void 0 : palette.secondary,
457
+ };
458
+ return themePalette;
459
+ }
460
+
461
+ 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}";
462
+ styleInject(css_248z$b);
463
+
452
464
  function _typeof(o) {
453
465
  "@babel/helpers - typeof";
454
466
 
@@ -3889,18 +3901,6 @@ function setYear(dirtyDate, dirtyYear) {
3889
3901
  return date;
3890
3902
  }
3891
3903
 
3892
- function useTheme(_a) {
3893
- var palette = _a.palette;
3894
- var themePalette = {
3895
- '--will-primary': palette === null || palette === void 0 ? void 0 : palette.primary,
3896
- '--will-secondary': palette === null || palette === void 0 ? void 0 : palette.secondary,
3897
- };
3898
- return themePalette;
3899
- }
3900
-
3901
- 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}";
3902
- styleInject(css_248z$b);
3903
-
3904
3904
  var parseDates = function (_a) {
3905
3905
  var calendarRange = _a.calendarRange;
3906
3906
  return (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) && (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from)
@@ -3920,6 +3920,13 @@ var parseGuests = function (_a) {
3920
3920
  }, '');
3921
3921
  };
3922
3922
 
3923
+ var FilterSections;
3924
+ (function (FilterSections) {
3925
+ FilterSections["CALENDAR"] = "calendar";
3926
+ FilterSections["GUESTS"] = "guests";
3927
+ FilterSections["CATEGORIES"] = "categories";
3928
+ })(FilterSections || (FilterSections = {}));
3929
+
3923
3930
  var useFilterBar = function (_a) {
3924
3931
  var redirectUrl = _a.redirectUrl, currentViewApply = _a.currentViewApply, ageCategories = _a.ageCategories;
3925
3932
  var _b = __read(React__default.useState('/events'), 2), selectedPath = _b[0], setSelectedPath = _b[1];
@@ -4091,7 +4098,7 @@ var useScrollInToView = function (_a) {
4091
4098
  var _b = __read(React__default.useState(true), 2), isMobile = _b[0], setIsMobile = _b[1];
4092
4099
  var targetFilterBarRef = React__default.useRef(null);
4093
4100
  React__default.useEffect(function () {
4094
- if (window !== undefined && window.innerWidth > 960) {
4101
+ if (typeof window !== 'undefined' && window.innerWidth > 960) {
4095
4102
  setIsMobile(false);
4096
4103
  return;
4097
4104
  }
@@ -6575,16 +6582,16 @@ var CloseButton = function (_a) {
6575
6582
  React__default.createElement(IoIosCloseCircleOutline, null)));
6576
6583
  };
6577
6584
 
6578
- 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";
6585
+ 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";
6579
6586
  styleInject(css_248z$9);
6580
6587
 
6581
6588
  var SelectButton = function (_a) {
6582
- var label = _a.label, onClick = _a.onClick, style = _a.style, description = _a.description;
6583
- return (React__default.createElement("button", { className: "will-filter-bar-select-button", onClick: onClick, style: style },
6589
+ var active = _a.active, label = _a.label, onClick = _a.onClick, description = _a.description;
6590
+ return (React__default.createElement("button", { className: "will-filter-bar-select-button", onClick: onClick },
6584
6591
  React__default.createElement("span", { className: "select-button-wrapper" },
6585
6592
  React__default.createElement("div", null,
6586
- React__default.createElement("p", { className: "select-button-label" }, label),
6587
- React__default.createElement("p", { className: "select-button-description" }, description)))));
6593
+ React__default.createElement("p", { className: "select-button-label ".concat(active ? 'active' : '') }, label),
6594
+ React__default.createElement("p", { className: "select-button-description ".concat(active ? 'active' : '') }, description)))));
6588
6595
  };
6589
6596
 
6590
6597
  // THIS FILE IS AUTO GENERATED
@@ -10693,7 +10700,7 @@ function FilterBar(_a) {
10693
10700
  var t = useTranslation('filterBar').t;
10694
10701
  // Filters
10695
10702
  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;
10696
- // Default selected tab
10703
+ // Default selected tab when tabs are hidden
10697
10704
  React__default.useEffect(function () {
10698
10705
  if (currentViewApply === 'roomFilters') {
10699
10706
  setSelectedPath('/rooms');
@@ -10703,6 +10710,7 @@ function FilterBar(_a) {
10703
10710
  var _e = useScrollInToView({ selectedFilter: selectedFilter }), isMobile = _e.isMobile, targetFilterBarRef = _e.targetFilterBarRef;
10704
10711
  // Handle close filter section
10705
10712
  var filtersRef = useCloseFilterSection({ handleSelectedFilter: handleSelectedFilter }).filtersRef;
10713
+ // Parsed data for filter section description
10706
10714
  var parsedDates = parseDates({ calendarRange: calendarRange });
10707
10715
  var parsedGuests = parseGuests({ ageCategoryCounts: ageCategoryCounts, ageCategories: ageCategories });
10708
10716
  return (React__default.createElement("div", { className: "will-root", style: themePalette },
@@ -10714,21 +10722,18 @@ function FilterBar(_a) {
10714
10722
  ? parsedDates
10715
10723
  : selectedPath === '/rooms'
10716
10724
  ? t('calendar.roomsLabelPlaceholder')
10717
- : 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 }),
10725
+ : t('calendar.eventsLabelPlaceholder'), onClick: function () { return handleSelectedFilter(FilterSections.CALENDAR); }, active: selectedFilter === FilterSections.CALENDAR }),
10718
10726
  selectedPath === '/rooms' && (React__default.createElement(React__default.Fragment, null,
10719
10727
  React__default.createElement(Divider, null),
10720
- React__default.createElement(SelectButton, { label: t('guests.label'), description: parsedGuests ? parsedGuests : t('guests.labelPlaceholder'), onClick: function () { return handleSelectedFilter(2); }, style: fontWeightBold(selectedFilter === 2) }))),
10728
+ React__default.createElement(SelectButton, { label: t('guests.label'), description: parsedGuests ? parsedGuests : t('guests.labelPlaceholder'), onClick: function () { return handleSelectedFilter(FilterSections.GUESTS); }, active: selectedFilter === FilterSections.GUESTS }))),
10721
10729
  React__default.createElement(SubmitButton, { onClick: handleSubmit })),
10722
10730
  selectedFilter && (React__default.createElement("div", { className: "will-filter-bar-container", style: currentViewApply && !isMobile ? { top: 66 } : {} },
10723
10731
  React__default.createElement(CloseButton, { handleClose: function () { return handleSelectedFilter(false); } }),
10724
- selectedFilter === 1 && (React__default.createElement(Calendar, { calendarRange: calendarRange, setCalendarRange: setCalendarRange, ref: filtersRef })),
10725
- selectedFilter === 2 && (React__default.createElement(Guests, { updateGuestsCount: updateGuestsCount, ageCategories: ageCategories, ageCategoryCounts: ageCategoryCounts, ref: filtersRef })),
10726
- selectedFilter === 3 && (React__default.createElement(Categories, { categories: categories, setCategories: setCategories }))))));
10732
+ selectedFilter === FilterSections.CALENDAR && (React__default.createElement(Calendar, { calendarRange: calendarRange, setCalendarRange: setCalendarRange, ref: filtersRef })),
10733
+ selectedFilter === FilterSections.GUESTS && (React__default.createElement(Guests, { updateGuestsCount: updateGuestsCount, ageCategories: ageCategories, ageCategoryCounts: ageCategoryCounts, ref: filtersRef })),
10734
+ selectedFilter === FilterSections.CATEGORIES && (React__default.createElement(Categories, { categories: categories, setCategories: setCategories }))))));
10727
10735
  }
10728
10736
  ////////////
10729
- var fontWeightBold = function (input) {
10730
- return { fontWeight: input ? 'bold' : 'initial' };
10731
- };
10732
10737
  var AGE_CATEGORIES_FALLBACK = [
10733
10738
  {
10734
10739
  id: '1',