willba-component-library 0.2.68 → 0.2.69

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
@@ -11184,22 +11184,18 @@ var calendarSelectionRules = function (_a) {
11184
11184
  };
11185
11185
  /////////
11186
11186
  var disableFutureDates = function (_a) {
11187
- var rangeFrom = _a.rangeFrom, checkOutRange = _a.checkOutRange, setDisabledDates = _a.setDisabledDates; _a.newDisableCalendarDates;
11187
+ var rangeFrom = _a.rangeFrom, checkOutRange = _a.checkOutRange, setDisabledDates = _a.setDisabledDates, newDisableCalendarDates = _a.newDisableCalendarDates;
11188
11188
  if (rangeFrom && checkOutRange && setDisabledDates) {
11189
11189
  // Get parse data
11190
11190
  var checkIn = addDays(checkOutRange.checkIn, 1);
11191
11191
  var firstCheckOut = addDays(checkOutRange.firstCheckOut, -1);
11192
11192
  var noDatesRange = isEqual(checkIn, checkOutRange.firstCheckOut);
11193
- setDisabledDates([
11194
- // Will disable all dates before the check-in date
11195
- // { before: findCheckOutRange?.checkIn },
11193
+ setDisabledDates(__spreadArray$1(__spreadArray$1([], __read(((newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates) || [])), false), [
11196
11194
  {
11197
11195
  from: noDatesRange ? undefined : checkIn,
11198
11196
  to: noDatesRange ? undefined : firstCheckOut,
11199
11197
  },
11200
- // Will disable all dates after the last possible check-out after a check-in has been selected
11201
- //{ after: checkOutRange?.lastCheckOut },
11202
- ]);
11198
+ ], false));
11203
11199
  }
11204
11200
  };
11205
11201
 
@@ -11618,9 +11614,9 @@ var Calendar = forwardRef(function (_a, ref) {
11618
11614
  : today), disabled: disabledDatesByPage$1.length
11619
11615
  ? disabledDatesByPage$1
11620
11616
  : (disabledDates === null || disabledDates === void 0 ? void 0 : disabledDates.length)
11621
- ? __spreadArray$1(__spreadArray$1(__spreadArray$1(__spreadArray$1(__spreadArray$1([], __read(((newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates) || [])), false), [
11617
+ ? __spreadArray$1(__spreadArray$1(__spreadArray$1([
11622
11618
  lastPossibleCheckout && lastPossibleCheckout
11623
- ], false), __read(disabledDates), false), __read(firstPossibleRangeContextCheckIn), false), __read(lastPossibleRangeContextCheckOut), false) : ((_c = newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates) === null || _c === void 0 ? void 0 : _c.length)
11619
+ ], __read(disabledDates), false), __read(firstPossibleRangeContextCheckIn), false), __read(lastPossibleRangeContextCheckOut), false) : ((_c = newDisableCalendarDates === null || newDisableCalendarDates === void 0 ? void 0 : newDisableCalendarDates.disabledDates) === null || _c === void 0 ? void 0 : _c.length)
11624
11620
  ? __spreadArray$1(__spreadArray$1(__spreadArray$1([
11625
11621
  lastPossibleCheckout && lastPossibleCheckout
11626
11622
  ], __read(newDisableCalendarDates.disabledDates), false), __read(firstPossibleRangeContextCheckIn), false), __read(lastPossibleRangeContextCheckOut), false) : [], fromMonth: today, onMonthChange: function (val) {
@@ -12055,6 +12051,7 @@ var useFilterCalendar = function (_a) {
12055
12051
  // Lifecycle
12056
12052
  // Handle update component with new data
12057
12053
  useEffect(function () {
12054
+ var _a;
12058
12055
  if (outerDisableCalendarDates === null || outerDisableCalendarDates === void 0 ? void 0 : outerDisableCalendarDates.availableDates) {
12059
12056
  setDisableCalendarDates({
12060
12057
  availableDates: __spreadArray$1([], __read(outerDisableCalendarDates.availableDates.sort(function (a, b) {
@@ -12066,6 +12063,9 @@ var useFilterCalendar = function (_a) {
12066
12063
  })), false) : [],
12067
12064
  });
12068
12065
  }
12066
+ if (disabledDates && !!((_a = outerDisableCalendarDates === null || outerDisableCalendarDates === void 0 ? void 0 : outerDisableCalendarDates.disabledDates) === null || _a === void 0 ? void 0 : _a.length)) {
12067
+ setDisabledDates(__assign$2(__assign$2({}, disabledDates), outerDisableCalendarDates.disabledDates));
12068
+ }
12069
12069
  }, [outerDisableCalendarDates]);
12070
12070
  // Handle Range Context initial selections
12071
12071
  useEffect(function () {