willba-component-library 0.2.39 → 0.2.41

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
@@ -10831,20 +10831,6 @@
10831
10831
  var isTablet = reactResponsiveExports.useMediaQuery({ maxWidth: 960 });
10832
10832
  var today = startOfDay(new Date());
10833
10833
  var selectedStartDate = calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from;
10834
- // Handle loading spinner
10835
- React__default.useEffect(function () {
10836
- if (typeof document === 'undefined')
10837
- return;
10838
- var loadingSpinner = document.querySelector('.will-filter-bar-calendar .will-calendar-spinner');
10839
- if (loadingData) {
10840
- if (loadingSpinner)
10841
- loadingSpinner.style.display = 'flex';
10842
- }
10843
- else {
10844
- if (loadingSpinner)
10845
- loadingSpinner.style.display = 'none';
10846
- }
10847
- }, [loadingData]);
10848
10834
  // Handle overlapping availableDates.lastCheckOut and disabledDates.start
10849
10835
  var _c = __read(React__default.useState(undefined), 2), overlappingDate = _c[0], setOverlappingDate = _c[1];
10850
10836
  React__default.useMemo(function () {
@@ -10906,6 +10892,7 @@
10906
10892
  var calendarOverlappingDate = document.querySelectorAll('.will-filter-bar-calendar .rdp-cell:has(.overlapping-date)');
10907
10893
  var tooltipClonesCheckIn = [];
10908
10894
  var tooltipClonesCheckOut = [];
10895
+ var tooltipClonesSpinner = [];
10909
10896
  var tooltipClonesOverlappingDates = [];
10910
10897
  if (calendarTooltip && calendarButtons.length > 0) {
10911
10898
  calendarButtons.forEach(function (element) {
@@ -10922,7 +10909,9 @@
10922
10909
  });
10923
10910
  }
10924
10911
  if (loadingSpinner && calendarMonthContainer) {
10925
- calendarMonthContainer.appendChild(loadingSpinner);
10912
+ var tooltipClone = loadingSpinner.cloneNode(true);
10913
+ calendarMonthContainer.appendChild(tooltipClone);
10914
+ tooltipClonesSpinner.push(tooltipClone);
10926
10915
  }
10927
10916
  if (calendarTooltipOverlappingDate &&
10928
10917
  calendarOverlappingDate.length > 0) {
@@ -10935,6 +10924,7 @@
10935
10924
  return function () {
10936
10925
  tooltipClonesCheckIn.forEach(function (clone) { return clone.remove(); });
10937
10926
  tooltipClonesCheckOut.forEach(function (clone) { return clone.remove(); });
10927
+ tooltipClonesSpinner.forEach(function (clone) { return clone.remove(); });
10938
10928
  tooltipClonesOverlappingDates.forEach(function (clone) { return clone.remove(); });
10939
10929
  };
10940
10930
  }, [
@@ -10944,6 +10934,20 @@
10944
10934
  initialCalendarRange,
10945
10935
  updateCalendarDefaultMoth,
10946
10936
  ]);
10937
+ // Handle loading spinner
10938
+ React__default.useEffect(function () {
10939
+ if (typeof document === 'undefined')
10940
+ return;
10941
+ var loadingSpinner = document.querySelector('.will-filter-bar-calendar .rdp-months .will-calendar-spinner');
10942
+ if (loadingData) {
10943
+ if (loadingSpinner)
10944
+ loadingSpinner.style.display = 'flex';
10945
+ }
10946
+ else {
10947
+ if (loadingSpinner)
10948
+ loadingSpinner.style.display = 'none';
10949
+ }
10950
+ }, [loadingData, updateCalendarMonthNavigation, updateCalendarDefaultMoth]);
10947
10951
  return (React__default.createElement("div", { className: "will-filter-bar-calendar", ref: ref },
10948
10952
  React__default.createElement("div", { className: "will-calendar-filter-container" },
10949
10953
  React__default.createElement(DayPicker, { key: updateCalendarDefaultMoth, id: "will-calendar", mode: "range", locale: language === 'en' ? enUS : fi, numberOfMonths: !isTablet ? 2 : 1, weekStartsOn: 1, selected: calendarRange, onSelect: function (range) {