@activecollab/components 2.0.198 → 2.0.199

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/dist/index.js CHANGED
@@ -11410,8 +11410,13 @@
11410
11410
  return monthTransitionDirection && !disableAnimations ? monthTransitionDirection === "next" ? "slide-down" : "slide-up" : "";
11411
11411
  }, [disableAnimations, monthTransitionDirection]);
11412
11412
  var handleDayClick = function handleDayClick(day, modifiers) {
11413
- handleDateSelect(day);
11413
+ if (modifiers.some(function (mod) {
11414
+ return mod === "day_disabled";
11415
+ })) {
11416
+ return;
11417
+ }
11414
11418
  if (onDayClick) onDayClick(day, modifiers);
11419
+ handleDateSelect(day);
11415
11420
  };
11416
11421
  var getHoverRange = function getHoverRange() {
11417
11422
  if (!hoveredDate) return null;
@@ -19292,7 +19297,8 @@
19292
19297
  position = _ref.position,
19293
19298
  disableDaysBefore = _ref.disableDaysBefore,
19294
19299
  enableYearPicker = _ref.enableYearPicker,
19295
- disableAnimations = _ref.disableAnimations;
19300
+ disableAnimations = _ref.disableAnimations,
19301
+ disabledDaysAfter = _ref.disabledDaysAfter;
19296
19302
  var labelText = React.useMemo(function () {
19297
19303
  if (!selectedDays) {
19298
19304
  return defaultLabelText;
@@ -19304,6 +19310,9 @@
19304
19310
  if (selectedDays.to && selectedDays.from && toMoment(selectedDays.from).isSame(toMoment(selectedDays.to))) {
19305
19311
  return formattedEndDate;
19306
19312
  }
19313
+ if (!selectedDays.to && selectedDays.from) {
19314
+ return formattedStartDate;
19315
+ }
19307
19316
  return "".concat(formattedStartDate, " - ").concat(formattedEndDate);
19308
19317
  }
19309
19318
  }, [selectedDays, dateFormat, defaultLabelText, longDateFormat]);
@@ -19358,9 +19367,35 @@
19358
19367
  matched: isNonWorkingDay,
19359
19368
  title: isNonWorkingDay ? nonWorkingDaysOfWeekLabel : null
19360
19369
  };
19370
+ },
19371
+ day_disabled: function day_disabled(day) {
19372
+ if (disableDaysBefore) {
19373
+ if (day.toJSON().slice(0, 10) < disableDaysBefore.toJSON().slice(0, 10)) {
19374
+ return {
19375
+ matched: true,
19376
+ title: ""
19377
+ };
19378
+ }
19379
+ }
19380
+ if (!weekendIsSelectable && weekends.some(function (value) {
19381
+ return value === day.getDay();
19382
+ })) {
19383
+ return {
19384
+ matched: true,
19385
+ title: weekendLabel
19386
+ };
19387
+ }
19388
+ var currentDay = new Date(day.getFullYear(), day.getMonth(), day.getDate());
19389
+ var globalDayOff = globalDaysOff.find(function (data) {
19390
+ return isDayInRange(currentDay, data);
19391
+ });
19392
+ return {
19393
+ matched: !!globalDayOff,
19394
+ title: null
19395
+ };
19361
19396
  }
19362
19397
  };
19363
- }, [daysToModify, _nonWorkingDaysOfWeek, nonWorkingDaysOfWeekLabel, weekendLabel, weekends]);
19398
+ }, [daysToModify, disableDaysBefore, _nonWorkingDaysOfWeek, nonWorkingDaysOfWeekLabel, weekendIsSelectable, weekendLabel, weekends]);
19364
19399
  var renderTargetEl = React.useMemo(function () {
19365
19400
  if (labelType === "icon" && icon) {
19366
19401
  return /*#__PURE__*/React__default["default"].createElement(SelectDateTarget, {
@@ -19405,6 +19440,7 @@
19405
19440
  modalDiscardBtnText: modalDiscardBtnText,
19406
19441
  modalCancelBtnText: modalCancelBtnText,
19407
19442
  disabledDaysBefore: disableDaysBefore,
19443
+ disabledDaysAfter: disabledDaysAfter,
19408
19444
  backgroundElementClass: backgroundElementClass,
19409
19445
  disabled: weekendIsSelectable ? [] : [0, 6],
19410
19446
  popperTooltipClassName: popperTooltipClassName,
@@ -19427,6 +19463,7 @@
19427
19463
  cancelLabel: cancelButtonText,
19428
19464
  clearLabel: clearButtonText,
19429
19465
  disabledDaysBefore: disableDaysBefore,
19466
+ disabledDaysAfter: disabledDaysAfter,
19430
19467
  popperTooltipClassName: popperTooltipClassName,
19431
19468
  popperTooltipStyle: popperTooltipStyle,
19432
19469
  disabled: weekendIsSelectable ? [] : [0, 6],