willba-component-library 0.1.80 → 0.1.82

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 CHANGED
@@ -3966,17 +3966,30 @@ var useFilterBar = function (_a) {
3966
3966
  };
3967
3967
  }, [selectedFilter]);
3968
3968
  useEffect(function () {
3969
- // Handle default selected tab
3970
3969
  if (typeof window === 'undefined')
3971
3970
  return;
3972
3971
  var defaultTab = (tabs === null || tabs === void 0 ? void 0 : tabs.length) === 1 ? tabs[0] : tabs === null || tabs === void 0 ? void 0 : tabs.find(function (tab) { return tab.default; });
3973
- var currentPath = window.location.pathname.includes(Pages.EVENTS) ||
3974
- (defaultTab === null || defaultTab === void 0 ? void 0 : defaultTab.path) === Pages.EVENTS
3975
- ? Pages.EVENTS
3976
- : window.location.pathname.includes(Pages.ROOMS) ||
3977
- (defaultTab === null || defaultTab === void 0 ? void 0 : defaultTab.path) === Pages.ROOMS
3978
- ? Pages.ROOMS
3979
- : Pages.EVENTS;
3972
+ var findMatchingPath = function () {
3973
+ var e_1, _a;
3974
+ var paths = [Pages.EVENTS, Pages.ROOMS];
3975
+ try {
3976
+ for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {
3977
+ var path = paths_1_1.value;
3978
+ if (window.location.pathname.includes(path)) {
3979
+ return path;
3980
+ }
3981
+ }
3982
+ }
3983
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3984
+ finally {
3985
+ try {
3986
+ if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1);
3987
+ }
3988
+ finally { if (e_1) throw e_1.error; }
3989
+ }
3990
+ return defaultTab ? defaultTab.path : Pages.EVENTS;
3991
+ };
3992
+ var currentPath = findMatchingPath();
3980
3993
  setSelectedPath(currentPath);
3981
3994
  }, []);
3982
3995
  var updateGuestsCount = function (id, newCount) {
@@ -3989,7 +4002,7 @@ var useFilterBar = function (_a) {
3989
4002
  setSelectedFilter(id);
3990
4003
  };
3991
4004
  var handleSubmit = function () {
3992
- var e_1, _a;
4005
+ var e_2, _a;
3993
4006
  var newParams = {
3994
4007
  startDate: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from)
3995
4008
  ? format(calendarRange.from, 'yyyy-MM-dd')
@@ -4010,12 +4023,12 @@ var useFilterBar = function (_a) {
4010
4023
  }
4011
4024
  }
4012
4025
  }
4013
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
4026
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
4014
4027
  finally {
4015
4028
  try {
4016
4029
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
4017
4030
  }
4018
- finally { if (e_1) throw e_1.error; }
4031
+ finally { if (e_2) throw e_2.error; }
4019
4032
  }
4020
4033
  handleSelectedFilter(false);
4021
4034
  return onSubmit && selectedPath === Pages.ROOMS