@cerebruminc/cerebellum 16.5.10-beta.dangerous.9f03af8 → 16.5.10-beta.dangerous.c41a159

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.
@@ -9696,7 +9696,7 @@ function useFloating(options) {
9696
9696
  }
9697
9697
 
9698
9698
  /*!
9699
- react-datepicker v9.1.0
9699
+ react-datepicker v8.8.0
9700
9700
  https://github.com/Hacker0x01/react-datepicker
9701
9701
  Released under the MIT License.
9702
9702
  */
@@ -9760,19 +9760,17 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
9760
9760
  };
9761
9761
 
9762
9762
  var CalendarContainer = function (_a) {
9763
- var _b = _a.showTimeSelectOnly, showTimeSelectOnly = _b === void 0 ? false : _b, _c = _a.showTime, showTime = _c === void 0 ? false : _c, className = _a.className, children = _a.children, inline = _a.inline;
9763
+ var _b = _a.showTimeSelectOnly, showTimeSelectOnly = _b === void 0 ? false : _b, _c = _a.showTime, showTime = _c === void 0 ? false : _c, className = _a.className, children = _a.children;
9764
9764
  var ariaLabel = showTimeSelectOnly
9765
9765
  ? "Choose Time"
9766
9766
  : "Choose Date".concat(showTime ? " and Time" : "");
9767
- return (React__namespace.default.createElement("div", { className: className, "aria-label": ariaLabel, role: inline ? undefined : "dialog", "aria-modal": inline ? undefined : "true", translate: "no" }, children));
9767
+ return (React__namespace.default.createElement("div", { className: className, role: "dialog", "aria-label": ariaLabel, "aria-modal": "true" }, children));
9768
9768
  };
9769
9769
 
9770
9770
  var useDetectClickOutside = function (onClickOutside, ignoreClass) {
9771
9771
  var ref = React.useRef(null);
9772
9772
  var onClickOutsideRef = React.useRef(onClickOutside);
9773
- React.useEffect(function () {
9774
- onClickOutsideRef.current = onClickOutside;
9775
- }, [onClickOutside]);
9773
+ onClickOutsideRef.current = onClickOutside;
9776
9774
  var handleClickOutside = React.useCallback(function (event) {
9777
9775
  var _a;
9778
9776
  var target = (event.composed &&
@@ -9808,77 +9806,6 @@ var ClickOutsideWrapper = function (_a) {
9808
9806
  } }, children));
9809
9807
  };
9810
9808
 
9811
- // Cache for the date-fns-tz module
9812
- var dateFnsTz = null;
9813
- var dateFnsTzLoadAttempted = false;
9814
- /**
9815
- * Attempts to load date-fns-tz module.
9816
- * Returns null if the module is not installed.
9817
- */
9818
- function getDateFnsTz() {
9819
- if (dateFnsTzLoadAttempted) {
9820
- return dateFnsTz;
9821
- }
9822
- dateFnsTzLoadAttempted = true;
9823
- try {
9824
- // Dynamic require for date-fns-tz
9825
- // Use a variable to prevent webpack from statically analyzing the require
9826
- // and showing warnings when the optional dependency is not installed
9827
- // See: https://github.com/Hacker0x01/react-datepicker/issues/6154
9828
- var dateFnsTzModuleName = "date-fns-tz";
9829
- // eslint-disable-next-line @typescript-eslint/no-require-imports
9830
- dateFnsTz = require(dateFnsTzModuleName);
9831
- }
9832
- catch (_a) {
9833
- /* istanbul ignore next - only executes when date-fns-tz is not installed */
9834
- dateFnsTz = null;
9835
- }
9836
- return dateFnsTz;
9837
- }
9838
- /**
9839
- * Converts a date to the specified timezone.
9840
- * If no timezone is specified or date-fns-tz is not installed, returns the original date.
9841
- *
9842
- * @param date - The date to convert
9843
- * @param timeZone - The IANA timezone identifier (e.g., "America/New_York", "UTC")
9844
- * @returns The date in the specified timezone
9845
- */
9846
- function toZonedTime(date, timeZone) {
9847
- if (!timeZone) {
9848
- return date;
9849
- }
9850
- var tz = getDateFnsTz();
9851
- if (!tz) {
9852
- if (process.env.NODE_ENV !== "production") {
9853
- console.warn('react-datepicker: timeZone prop requires "date-fns-tz" package. ' +
9854
- "Please install it: npm install date-fns-tz");
9855
- }
9856
- return date;
9857
- }
9858
- return tz.toZonedTime(date, timeZone);
9859
- }
9860
- /**
9861
- * Converts a date from the specified timezone to UTC.
9862
- * If no timezone is specified or date-fns-tz is not installed, returns the original date.
9863
- *
9864
- * @param date - The date in the specified timezone
9865
- * @param timeZone - The IANA timezone identifier (e.g., "America/New_York", "UTC")
9866
- * @returns The date in UTC
9867
- */
9868
- function fromZonedTime(date, timeZone) {
9869
- if (!timeZone) {
9870
- return date;
9871
- }
9872
- var tz = getDateFnsTz();
9873
- if (!tz) {
9874
- if (process.env.NODE_ENV !== "production") {
9875
- console.warn('react-datepicker: timeZone prop requires "date-fns-tz" package. ' +
9876
- "Please install it: npm install date-fns-tz");
9877
- }
9878
- return date;
9879
- }
9880
- return tz.fromZonedTime(date, timeZone);
9881
- }
9882
9809
  var KeyType;
9883
9810
  (function (KeyType) {
9884
9811
  KeyType["ArrowUp"] = "ArrowUp";
@@ -9935,72 +9862,20 @@ function parseDate(value, dateFormat, locale, strictParsing, refDate) {
9935
9862
  return parsedDate;
9936
9863
  }
9937
9864
  }
9938
- // When strictParsing is false, try native Date parsing as a fallback
9939
- // This allows flexible input formats like "12/05/2025" or "2025-12-16"
9940
- // even when the dateFormat prop specifies a different format.
9941
- // Only attempt this for inputs that look like complete dates (minimum
9942
- // length of 8 characters, e.g., "1/1/2000") to avoid parsing partial
9943
- // inputs like "03/" or "2000" which should be handled by parseDateForNavigation.
9944
- if (!strictParsing && value && value.length >= 8) {
9945
- var nativeDate = new Date(value);
9946
- if (isValid$1(nativeDate)) {
9947
- return nativeDate;
9948
- }
9949
- }
9950
9865
  return null;
9951
9866
  }
9952
9867
  /**
9953
- * Parses a partial date string for calendar navigation purposes.
9954
- * Unlike parseDate, this function attempts to extract whatever date
9955
- * information is available (year, month) from a partial input,
9956
- * returning a date suitable for navigating the calendar view.
9957
- *
9958
- * @param value - The date string to parse.
9959
- * @param refDate - The reference date to use for missing components.
9960
- * @returns - A date for navigation or null if no date info could be extracted.
9961
- */
9962
- function parseDateForNavigation(value, refDate) {
9963
- if (refDate === void 0) { refDate = newDate(); }
9964
- if (!value)
9965
- return null;
9966
- // Try to extract a 4-digit year from the input
9967
- var yearMatch = value.match(/\b(1\d{3}|2\d{3})\b/);
9968
- if (!yearMatch || !yearMatch[1])
9969
- return null;
9970
- var year = parseInt(yearMatch[1], 10);
9971
- // Try to extract a month (1-12) from the input
9972
- // Look for patterns like "03/", "/03", "03-", "-03" or standalone "03" at start
9973
- var monthMatch = value.match(/(?:^|[/\-\s])?(0?[1-9]|1[0-2])(?:[/\-\s]|$)/);
9974
- var month = monthMatch && monthMatch[1]
9975
- ? parseInt(monthMatch[1], 10) - 1
9976
- : refDate.getMonth();
9977
- // Return a date with the extracted year and month, using day 1
9978
- return new Date(year, month, 1);
9979
- }
9980
- /**
9981
- * Checks if a given date is a valid Date object.
9868
+ * Checks if a given date is valid and not before the minimum date.
9982
9869
  * @param date - The date to be checked.
9983
- * @returns A boolean value indicating whether the date is valid.
9984
- */
9985
- function isValid(date) {
9986
- return isValid$1(date);
9987
- }
9988
- /**
9989
- * Safely returns a valid Date or null.
9990
- * This handles cases where a value might be passed as a string or other
9991
- * invalid type at runtime, even though TypeScript expects a Date.
9992
- * @param date - The value to check (typed as Date but could be anything at runtime)
9993
- * @returns The date if it's a valid Date object, otherwise null
9870
+ * @param minDate - The minimum date allowed. If not provided, defaults to "1/1/1800".
9871
+ * @returns A boolean value indicating whether the date is valid and not before the minimum date.
9994
9872
  */
9995
- function safeToDate(date) {
9996
- if (date == null) {
9997
- return null;
9998
- }
9999
- // Check if it's actually a Date object AND is valid
10000
- if (isDate(date) && isValid$1(date)) {
10001
- return date;
10002
- }
10003
- return null;
9873
+ function isValid(date, minDate) {
9874
+ /* the fallback date is essential to not break test case
9875
+ * `should auto update calendar when the updated date text is after props.minDate`
9876
+ * and backward compatibility respectfully
9877
+ */
9878
+ return isValid$1(date) && !isBefore(date, new Date("1/1/1800"));
10004
9879
  }
10005
9880
  // ** Date Formatting **
10006
9881
  /**
@@ -10601,7 +10476,6 @@ function isTimeInDisabledRange(time, _a) {
10601
10476
  valid = !isWithinInterval(baseTime, { start: min, end: max });
10602
10477
  }
10603
10478
  catch (err) {
10604
- /* istanbul ignore next - date-fns historically threw on invalid intervals */
10605
10479
  valid = false;
10606
10480
  }
10607
10481
  return valid;
@@ -11177,10 +11051,6 @@ var Day = /** @class */ (function (_super) {
11177
11051
  var _a;
11178
11052
  var _b = _this.props, day = _b.day, selectsStart = _b.selectsStart, selectsEnd = _b.selectsEnd, selectsRange = _b.selectsRange, selectsDisabledDaysInRange = _b.selectsDisabledDaysInRange, startDate = _b.startDate, swapRange = _b.swapRange, endDate = _b.endDate;
11179
11053
  var selectingDate = (_a = _this.props.selectingDate) !== null && _a !== void 0 ? _a : _this.props.preSelection;
11180
- // Don't highlight days outside the current month
11181
- if (_this.isAfterMonth() || _this.isBeforeMonth()) {
11182
- return false;
11183
- }
11184
11054
  if (!(selectsStart || selectsEnd || selectsRange) ||
11185
11055
  !selectingDate ||
11186
11056
  (!selectsDisabledDaysInRange && _this.isDisabled())) {
@@ -11909,12 +11779,7 @@ var Month$1 = /** @class */ (function (_super) {
11909
11779
  });
11910
11780
  };
11911
11781
  _this.isSelectedQuarter = function (day, q, selected) {
11912
- return getQuarter(selected) === q && getYear(day) === getYear(selected);
11913
- };
11914
- _this.isSelectQuarterInList = function (day, q, selectedDates) {
11915
- return selectedDates.some(function (selectedDate) {
11916
- return _this.isSelectedQuarter(day, q, selectedDate);
11917
- });
11782
+ return getQuarter(day) === q && getYear(day) === getYear(selected);
11918
11783
  };
11919
11784
  _this.isMonthSelected = function () {
11920
11785
  var _a = _this.props, day = _a.day, selected = _a.selected, selectedDates = _a.selectedDates, selectsMultiple = _a.selectsMultiple;
@@ -11926,21 +11791,7 @@ var Month$1 = /** @class */ (function (_super) {
11926
11791
  }
11927
11792
  return !!selected && _this.isSelectedMonth(day, monthIdx, selected);
11928
11793
  };
11929
- _this.isQuarterSelected = function () {
11930
- var _a = _this.props, day = _a.day, selected = _a.selected, selectedDates = _a.selectedDates, selectsMultiple = _a.selectsMultiple;
11931
- var quarterIdx = getQuarter(day);
11932
- if (selectsMultiple) {
11933
- return selectedDates === null || selectedDates === void 0 ? void 0 : selectedDates.some(function (selectedDate) {
11934
- return _this.isSelectedQuarter(day, quarterIdx, selectedDate);
11935
- });
11936
- }
11937
- return !!selected && _this.isSelectedQuarter(day, quarterIdx, selected);
11938
- };
11939
11794
  _this.renderWeeks = function () {
11940
- // Return empty array if day is invalid
11941
- if (!isValid(_this.props.day)) {
11942
- return [];
11943
- }
11944
11795
  var weeks = [];
11945
11796
  var isFixedHeight = _this.props.fixedHeight;
11946
11797
  var i = 0;
@@ -12237,7 +12088,7 @@ var Month$1 = /** @class */ (function (_super) {
12237
12088
  return "".concat(prefix, " ").concat(formatDate(labelDate, "MMMM yyyy", locale));
12238
12089
  };
12239
12090
  _this.getQuarterClassNames = function (q) {
12240
- var _a = _this.props, day = _a.day, startDate = _a.startDate, endDate = _a.endDate, minDate = _a.minDate, maxDate = _a.maxDate, excludeDates = _a.excludeDates, includeDates = _a.includeDates, filterDate = _a.filterDate, preSelection = _a.preSelection, disabledKeyboardNavigation = _a.disabledKeyboardNavigation, disabled = _a.disabled;
12091
+ var _a = _this.props, day = _a.day, startDate = _a.startDate, endDate = _a.endDate, selected = _a.selected, minDate = _a.minDate, maxDate = _a.maxDate, excludeDates = _a.excludeDates, includeDates = _a.includeDates, filterDate = _a.filterDate, preSelection = _a.preSelection, disabledKeyboardNavigation = _a.disabledKeyboardNavigation, disabled = _a.disabled;
12241
12092
  var isDisabled = (minDate ||
12242
12093
  maxDate ||
12243
12094
  excludeDates ||
@@ -12245,16 +12096,14 @@ var Month$1 = /** @class */ (function (_super) {
12245
12096
  filterDate ||
12246
12097
  disabled) &&
12247
12098
  isQuarterDisabled(setQuarter(day, q), _this.props);
12248
- var selection = _this.getSelection();
12249
12099
  return clsx("react-datepicker__quarter-text", "react-datepicker__quarter-".concat(q), {
12250
12100
  "react-datepicker__quarter-text--disabled": isDisabled,
12251
- "react-datepicker__quarter-text--selected": selection
12252
- ? _this.isSelectQuarterInList(day, q, selection)
12101
+ "react-datepicker__quarter-text--selected": selected
12102
+ ? _this.isSelectedQuarter(day, q, selected)
12253
12103
  : undefined,
12254
12104
  "react-datepicker__quarter-text--keyboard-selected": !disabledKeyboardNavigation &&
12255
12105
  preSelection &&
12256
12106
  _this.isSelectedQuarter(day, q, preSelection) &&
12257
- !_this.isQuarterSelected() &&
12258
12107
  !isDisabled,
12259
12108
  "react-datepicker__quarter-text--in-selecting-range": _this.isInSelectingRangeQuarter(q),
12260
12109
  "react-datepicker__quarter-text--in-range": startDate && endDate
@@ -12334,20 +12183,14 @@ var Month$1 = /** @class */ (function (_super) {
12334
12183
  var formattedAriaLabelPrefix = ariaLabelPrefix
12335
12184
  ? ariaLabelPrefix.trim() + " "
12336
12185
  : "";
12337
- // Format aria-label, return empty string if date is invalid
12338
- var formattedAriaLabel = isValid(day)
12339
- ? "".concat(formattedAriaLabelPrefix).concat(formatDate(day, "MMMM, yyyy", this.props.locale))
12340
- : "";
12341
12186
  var shouldUseListboxRole = showMonthYearPicker || showQuarterYearPicker;
12342
12187
  if (shouldUseListboxRole) {
12343
- return (React__namespace.default.createElement("div", { className: this.getClassNames(), onMouseLeave: !this.props.usePointerEvent ? this.handleMouseLeave : undefined, onPointerLeave: this.props.usePointerEvent ? this.handleMouseLeave : undefined, "aria-label": formattedAriaLabel, role: "listbox" }, showMonthYearPicker ? this.renderMonths() : this.renderQuarters()));
12188
+ return (React__namespace.default.createElement("div", { className: this.getClassNames(), onMouseLeave: !this.props.usePointerEvent ? this.handleMouseLeave : undefined, onPointerLeave: this.props.usePointerEvent ? this.handleMouseLeave : undefined, "aria-label": "".concat(formattedAriaLabelPrefix).concat(formatDate(day, "MMMM, yyyy", this.props.locale)), role: "listbox" }, showMonthYearPicker ? this.renderMonths() : this.renderQuarters()));
12344
12189
  }
12345
12190
  // For regular calendar view, use table structure
12346
12191
  return (React__namespace.default.createElement("div", { role: "table" },
12347
12192
  this.props.dayNamesHeader && (React__namespace.default.createElement("div", { role: "rowgroup" }, this.props.dayNamesHeader)),
12348
- this.props.monthHeader && (React__namespace.default.createElement("div", { role: "rowgroup" }, this.props.monthHeader)),
12349
- React__namespace.default.createElement("div", { className: this.getClassNames(), onMouseLeave: !this.props.usePointerEvent ? this.handleMouseLeave : undefined, onPointerLeave: this.props.usePointerEvent ? this.handleMouseLeave : undefined, "aria-label": formattedAriaLabel, role: "rowgroup" }, this.renderWeeks()),
12350
- this.props.monthFooter && (React__namespace.default.createElement("div", { role: "rowgroup" }, this.props.monthFooter))));
12193
+ React__namespace.default.createElement("div", { className: this.getClassNames(), onMouseLeave: !this.props.usePointerEvent ? this.handleMouseLeave : undefined, onPointerLeave: this.props.usePointerEvent ? this.handleMouseLeave : undefined, "aria-label": "".concat(formattedAriaLabelPrefix).concat(formatDate(day, "MMMM, yyyy", this.props.locale)), role: "rowgroup" }, this.renderWeeks())));
12351
12194
  };
12352
12195
  return Month;
12353
12196
  }(React.Component));
@@ -12458,15 +12301,10 @@ var MonthDropdown = /** @class */ (function (_super) {
12458
12301
  return MonthDropdown;
12459
12302
  }(React.Component));
12460
12303
 
12461
- // Default range: 5 years before and after current date
12462
- var DEFAULT_YEAR_RANGE$1 = 5;
12463
- function generateMonthYears(minDate, maxDate, currentDate) {
12304
+ function generateMonthYears(minDate, maxDate) {
12464
12305
  var list = [];
12465
- // Use defaults if minDate/maxDate not provided
12466
- var effectiveMinDate = minDate !== null && minDate !== void 0 ? minDate : subYears(currentDate, DEFAULT_YEAR_RANGE$1);
12467
- var effectiveMaxDate = maxDate !== null && maxDate !== void 0 ? maxDate : addYears(currentDate, DEFAULT_YEAR_RANGE$1);
12468
- var currDate = getStartOfMonth(effectiveMinDate);
12469
- var lastDate = getStartOfMonth(effectiveMaxDate);
12306
+ var currDate = getStartOfMonth(minDate);
12307
+ var lastDate = getStartOfMonth(maxDate);
12470
12308
  while (!isAfter(currDate, lastDate)) {
12471
12309
  list.push(newDate(currDate));
12472
12310
  currDate = addMonths(currDate, 1);
@@ -12494,7 +12332,7 @@ var MonthYearDropdownOptions = /** @class */ (function (_super) {
12494
12332
  _this.props.onCancel();
12495
12333
  };
12496
12334
  _this.state = {
12497
- monthYearsList: generateMonthYears(_this.props.minDate, _this.props.maxDate, _this.props.date),
12335
+ monthYearsList: generateMonthYears(_this.props.minDate, _this.props.maxDate),
12498
12336
  };
12499
12337
  return _this;
12500
12338
  }
@@ -12508,8 +12346,6 @@ var MonthYearDropdownOptions = /** @class */ (function (_super) {
12508
12346
  return MonthYearDropdownOptions;
12509
12347
  }(React.Component));
12510
12348
 
12511
- // Default range: 5 years before and after current date
12512
- var DEFAULT_YEAR_RANGE = 5;
12513
12349
  var MonthYearDropdown = /** @class */ (function (_super) {
12514
12350
  __extends(MonthYearDropdown, _super);
12515
12351
  function MonthYearDropdown() {
@@ -12518,12 +12354,8 @@ var MonthYearDropdown = /** @class */ (function (_super) {
12518
12354
  dropdownVisible: false,
12519
12355
  };
12520
12356
  _this.renderSelectOptions = function () {
12521
- var _a, _b;
12522
- // Use defaults if minDate/maxDate not provided
12523
- var minDate = (_a = _this.props.minDate) !== null && _a !== void 0 ? _a : subYears(_this.props.date, DEFAULT_YEAR_RANGE);
12524
- var maxDate = (_b = _this.props.maxDate) !== null && _b !== void 0 ? _b : addYears(_this.props.date, DEFAULT_YEAR_RANGE);
12525
- var currDate = getStartOfMonth(minDate);
12526
- var lastDate = getStartOfMonth(maxDate);
12357
+ var currDate = getStartOfMonth(_this.props.minDate);
12358
+ var lastDate = getStartOfMonth(_this.props.maxDate);
12527
12359
  var options = [];
12528
12360
  while (!isAfter(currDate, lastDate)) {
12529
12361
  var timePoint = getTime(currDate);
@@ -12615,8 +12447,7 @@ var Time = /** @class */ (function (_super) {
12615
12447
  (_b = (_a = _this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, time);
12616
12448
  };
12617
12449
  _this.isSelectedTime = function (time) {
12618
- var selected = safeToDate(_this.props.selected);
12619
- return selected && isSameMinute(selected, time);
12450
+ return _this.props.selected && isSameMinute(_this.props.selected, time);
12620
12451
  };
12621
12452
  _this.isDisabledTime = function (time) {
12622
12453
  return ((_this.props.minTime || _this.props.maxTime) &&
@@ -12677,9 +12508,7 @@ var Time = /** @class */ (function (_super) {
12677
12508
  var times = [];
12678
12509
  var format = typeof _this.props.format === "string" ? _this.props.format : "p";
12679
12510
  var intervals = (_a = _this.props.intervals) !== null && _a !== void 0 ? _a : Time.defaultProps.intervals;
12680
- var activeDate = safeToDate(_this.props.selected) ||
12681
- safeToDate(_this.props.openToDate) ||
12682
- newDate();
12511
+ var activeDate = _this.props.selected || _this.props.openToDate || newDate();
12683
12512
  var base = getStartOfDay(activeDate);
12684
12513
  var sortedInjectTimes = _this.props.injectTimes &&
12685
12514
  _this.props.injectTimes.sort(function (a, b) {
@@ -12759,13 +12588,9 @@ var Time = /** @class */ (function (_super) {
12759
12588
  };
12760
12589
  Time.prototype.updateContainerHeight = function () {
12761
12590
  if (this.props.monthRef && this.header) {
12762
- var newHeight = this.props.monthRef.clientHeight - this.header.clientHeight;
12763
- // Only update state if height actually changed to prevent infinite resize loops
12764
- if (this.state.height !== newHeight) {
12765
- this.setState({
12766
- height: newHeight,
12767
- });
12768
- }
12591
+ this.setState({
12592
+ height: this.props.monthRef.clientHeight - this.header.clientHeight,
12593
+ });
12769
12594
  }
12770
12595
  };
12771
12596
  Time.prototype.render = function () {
@@ -13453,13 +13278,7 @@ var Calendar = /** @class */ (function (_super) {
13453
13278
  return ({
13454
13279
  date: setMonth(date, Number(month)),
13455
13280
  });
13456
- }, function () {
13457
- var _a, _b;
13458
- _this.handleMonthChange(_this.state.date);
13459
- // Reset monthSelectedIn to 0 so the target month appears in the leftmost position
13460
- // This ensures consistent behavior when using changeMonth in custom headers
13461
- (_b = (_a = _this.props).onMonthSelectedInChange) === null || _b === void 0 ? void 0 : _b.call(_a, 0);
13462
- });
13281
+ }, function () { return _this.handleMonthChange(_this.state.date); });
13463
13282
  };
13464
13283
  _this.changeMonthYear = function (monthYear) {
13465
13284
  _this.setState(function (_a) {
@@ -13469,13 +13288,8 @@ var Calendar = /** @class */ (function (_super) {
13469
13288
  });
13470
13289
  }, function () { return _this.handleMonthYearChange(_this.state.date); });
13471
13290
  };
13472
- _this.header = function (date, customDayNameCount) {
13291
+ _this.header = function (date) {
13473
13292
  if (date === void 0) { date = _this.state.date; }
13474
- if (customDayNameCount === void 0) { customDayNameCount = 0; }
13475
- // Return empty array if date is invalid
13476
- if (!isValid(date)) {
13477
- return [];
13478
- }
13479
13293
  var disabled = _this.props.disabled;
13480
13294
  var startOfWeek = getStartOfWeek(date, _this.props.locale, _this.props.calendarStartDay);
13481
13295
  var dayNames = [];
@@ -13487,24 +13301,11 @@ var Calendar = /** @class */ (function (_super) {
13487
13301
  return dayNames.concat([0, 1, 2, 3, 4, 5, 6].map(function (offset) {
13488
13302
  var day = addDays(startOfWeek, offset);
13489
13303
  var weekDayName = _this.formatWeekday(day, _this.props.locale);
13490
- var fullDayName = formatDate(day, "EEEE", _this.props.locale);
13491
13304
  var weekDayClassName = _this.props.weekDayClassName
13492
13305
  ? _this.props.weekDayClassName(day)
13493
13306
  : undefined;
13494
- // Use custom render if provided
13495
- if (_this.props.renderCustomDayName) {
13496
- var customContent = _this.props.renderCustomDayName({
13497
- day: day,
13498
- shortName: weekDayName,
13499
- fullName: fullDayName,
13500
- locale: _this.props.locale,
13501
- customDayNameCount: customDayNameCount,
13502
- });
13503
- return (React__namespace.default.createElement("div", { key: offset, role: "columnheader", className: clsx("react-datepicker__day-name", weekDayClassName, disabled ? "react-datepicker__day-name--disabled" : "") }, customContent));
13504
- }
13505
- // Default render
13506
13307
  return (React__namespace.default.createElement("div", { key: offset, role: "columnheader", className: clsx("react-datepicker__day-name", weekDayClassName, disabled ? "react-datepicker__day-name--disabled" : "") },
13507
- React__namespace.default.createElement("span", { className: "react-datepicker__sr-only" }, fullDayName),
13308
+ React__namespace.default.createElement("span", { className: "react-datepicker__sr-only" }, formatDate(day, "EEEE", _this.props.locale)),
13508
13309
  React__namespace.default.createElement("span", { "aria-hidden": "true" }, weekDayName)));
13509
13310
  }));
13510
13311
  };
@@ -13683,9 +13484,7 @@ var Calendar = /** @class */ (function (_super) {
13683
13484
  if (_this.props.showMonthYearDropdown) {
13684
13485
  classes.push("react-datepicker__current-month--hasMonthYearDropdown");
13685
13486
  }
13686
- return (React__namespace.default.createElement("h2", { className: classes.join(" ") }, isValid(date)
13687
- ? formatDate(date, _this.props.dateFormat, _this.props.locale)
13688
- : ""));
13487
+ return (React__namespace.default.createElement("h2", { className: classes.join(" ") }, formatDate(date, _this.props.dateFormat, _this.props.locale)));
13689
13488
  };
13690
13489
  _this.renderYearDropdown = function (overrideHide) {
13691
13490
  if (overrideHide === void 0) { overrideHide = false; }
@@ -13718,31 +13517,17 @@ var Calendar = /** @class */ (function (_super) {
13718
13517
  }
13719
13518
  return (React__namespace.default.createElement("div", { className: "react-datepicker__today-button", onClick: _this.handleTodayButtonClick }, _this.props.todayButton));
13720
13519
  };
13721
- _this.renderDayNamesHeader = function (monthDate, customDayNameCount) {
13722
- if (customDayNameCount === void 0) { customDayNameCount = 0; }
13723
- return (React__namespace.default.createElement("div", { className: "react-datepicker__day-names", role: "row" }, _this.header(monthDate, customDayNameCount)));
13724
- };
13520
+ _this.renderDayNamesHeader = function (monthDate) { return (React__namespace.default.createElement("div", { className: "react-datepicker__day-names", role: "row" }, _this.header(monthDate))); };
13725
13521
  _this.renderDefaultHeader = function (_a) {
13726
13522
  var monthDate = _a.monthDate, i = _a.i;
13727
- var headerContent = (React__namespace.default.createElement("div", { className: clsx("react-datepicker__header", {
13728
- "react-datepicker__header--has-time-select": _this.props.showTimeSelect,
13729
- "react-datepicker__header--middle": _this.props.monthHeaderPosition === "middle",
13730
- "react-datepicker__header--bottom": _this.props.monthHeaderPosition === "bottom",
13731
- }) },
13523
+ return (React__namespace.default.createElement("div", { className: "react-datepicker__header ".concat(_this.props.showTimeSelect
13524
+ ? "react-datepicker__header--has-time-select"
13525
+ : "") },
13732
13526
  _this.renderCurrentMonth(monthDate),
13733
13527
  React__namespace.default.createElement("div", { className: "react-datepicker__header__dropdown react-datepicker__header__dropdown--".concat(_this.props.dropdownMode), onFocus: _this.handleDropdownFocus },
13734
13528
  _this.renderMonthDropdown(i !== 0),
13735
13529
  _this.renderMonthYearDropdown(i !== 0),
13736
13530
  _this.renderYearDropdown(i !== 0))));
13737
- // Top position: render header directly in default location
13738
- if (_this.props.monthHeaderPosition === "top") {
13739
- return headerContent;
13740
- }
13741
- // Middle/bottom positions: wrap with navigation buttons
13742
- return (React__namespace.default.createElement("div", { className: "react-datepicker__header-wrapper" },
13743
- _this.renderPreviousButton() || null,
13744
- _this.renderNextButton() || null,
13745
- headerContent));
13746
13531
  };
13747
13532
  _this.renderCustomHeader = function (headerArgs) {
13748
13533
  var _a, _b;
@@ -13811,13 +13596,8 @@ var Calendar = /** @class */ (function (_super) {
13811
13596
  monthList.push(React__namespace.default.createElement("div", { key: monthKey, ref: function (div) {
13812
13597
  _this.monthContainer = div !== null && div !== void 0 ? div : undefined;
13813
13598
  }, className: "react-datepicker__month-container" },
13814
- _this.props.monthHeaderPosition === "top" &&
13815
- _this.renderHeader({ monthDate: monthDate, i: i }),
13816
- React__namespace.default.createElement(Month$1, _assign({}, Calendar.defaultProps, _this.props, { containerRef: _this.containerRef, ariaLabelPrefix: _this.props.monthAriaLabelPrefix, day: monthDate, onDayClick: _this.handleDayClick, handleOnKeyDown: _this.props.handleOnDayKeyDown, handleOnMonthKeyDown: _this.props.handleOnKeyDown, onDayMouseEnter: _this.handleDayMouseEnter, onMouseLeave: _this.handleMonthMouseLeave, orderInDisplay: i, selectingDate: _this.state.selectingDate, monthShowsDuplicateDaysEnd: monthShowsDuplicateDaysEnd, monthShowsDuplicateDaysStart: monthShowsDuplicateDaysStart, dayNamesHeader: _this.renderDayNamesHeader(monthDate, i), monthHeader: _this.props.monthHeaderPosition === "middle"
13817
- ? _this.renderHeader({ monthDate: monthDate, i: i })
13818
- : undefined, monthFooter: _this.props.monthHeaderPosition === "bottom"
13819
- ? _this.renderHeader({ monthDate: monthDate, i: i })
13820
- : undefined }))));
13599
+ _this.renderHeader({ monthDate: monthDate, i: i }),
13600
+ React__namespace.default.createElement(Month$1, _assign({}, Calendar.defaultProps, _this.props, { containerRef: _this.containerRef, ariaLabelPrefix: _this.props.monthAriaLabelPrefix, day: monthDate, onDayClick: _this.handleDayClick, handleOnKeyDown: _this.props.handleOnDayKeyDown, handleOnMonthKeyDown: _this.props.handleOnKeyDown, onDayMouseEnter: _this.handleDayMouseEnter, onMouseLeave: _this.handleMonthMouseLeave, orderInDisplay: i, selectingDate: _this.state.selectingDate, monthShowsDuplicateDaysEnd: monthShowsDuplicateDaysEnd, monthShowsDuplicateDaysStart: monthShowsDuplicateDaysStart, dayNamesHeader: _this.renderDayNamesHeader(monthDate) }))));
13821
13601
  }
13822
13602
  return monthList;
13823
13603
  };
@@ -13840,34 +13620,6 @@ var Calendar = /** @class */ (function (_super) {
13840
13620
  return;
13841
13621
  };
13842
13622
  _this.renderInputTimeSection = function () {
13843
- var _a, _b;
13844
- if (!_this.props.showTimeInput) {
13845
- return;
13846
- }
13847
- // Handle selectsRange mode - render two time inputs
13848
- if (_this.props.selectsRange) {
13849
- var _c = _this.props, startDate = _c.startDate, endDate = _c.endDate;
13850
- var startTime = startDate ? new Date(startDate) : undefined;
13851
- var startTimeValid = startTime && isValid(startTime) && Boolean(startDate);
13852
- var startTimeString = startTimeValid
13853
- ? "".concat(addZero(startTime.getHours()), ":").concat(addZero(startTime.getMinutes()))
13854
- : "";
13855
- var endTime = endDate ? new Date(endDate) : undefined;
13856
- var endTimeValid = endTime && isValid(endTime) && Boolean(endDate);
13857
- var endTimeString = endTimeValid
13858
- ? "".concat(addZero(endTime.getHours()), ":").concat(addZero(endTime.getMinutes()))
13859
- : "";
13860
- return (React__namespace.default.createElement(React__namespace.default.Fragment, null,
13861
- React__namespace.default.createElement(InputTime, _assign({}, Calendar.defaultProps, _this.props, { date: startTime, timeString: startTimeString, onChange: function (time) {
13862
- var _a, _b;
13863
- (_b = (_a = _this.props).onTimeChange) === null || _b === void 0 ? void 0 : _b.call(_a, time, "start");
13864
- }, timeInputLabel: ((_a = _this.props.timeInputLabel) !== null && _a !== void 0 ? _a : "Time") + " (Start)" })),
13865
- React__namespace.default.createElement(InputTime, _assign({}, Calendar.defaultProps, _this.props, { date: endTime, timeString: endTimeString, onChange: function (time) {
13866
- var _a, _b;
13867
- (_b = (_a = _this.props).onTimeChange) === null || _b === void 0 ? void 0 : _b.call(_a, time, "end");
13868
- }, timeInputLabel: ((_b = _this.props.timeInputLabel) !== null && _b !== void 0 ? _b : "Time") + " (End)" }))));
13869
- }
13870
- // Single date mode (original behavior)
13871
13623
  var time = _this.props.selected
13872
13624
  ? new Date(_this.props.selected)
13873
13625
  : undefined;
@@ -13875,17 +13627,13 @@ var Calendar = /** @class */ (function (_super) {
13875
13627
  var timeString = timeValid
13876
13628
  ? "".concat(addZero(time.getHours()), ":").concat(addZero(time.getMinutes()))
13877
13629
  : "";
13878
- return (React__namespace.default.createElement(InputTime, _assign({}, Calendar.defaultProps, _this.props, { date: time, timeString: timeString, onChange: function (time) {
13879
- var _a, _b;
13880
- (_b = (_a = _this.props).onTimeChange) === null || _b === void 0 ? void 0 : _b.call(_a, time);
13881
- } })));
13630
+ if (_this.props.showTimeInput) {
13631
+ return (React__namespace.default.createElement(InputTime, _assign({}, Calendar.defaultProps, _this.props, { date: time, timeString: timeString, onChange: _this.props.onTimeChange })));
13632
+ }
13633
+ return;
13882
13634
  };
13883
13635
  _this.renderAriaLiveRegion = function () {
13884
13636
  var _a;
13885
- // Don't render aria-live message if date is invalid
13886
- if (!isValid(_this.state.date)) {
13887
- return (React__namespace.default.createElement("span", { role: "alert", "aria-live": "polite", className: "react-datepicker__aria-live" }));
13888
- }
13889
13637
  var _b = getYearsPeriod(_this.state.date, (_a = _this.props.yearItemNumber) !== null && _a !== void 0 ? _a : Calendar.defaultProps.yearItemNumber), startPeriod = _b.startPeriod, endPeriod = _b.endPeriod;
13890
13638
  var ariaLiveMessage;
13891
13639
  if (_this.props.showYearPicker) {
@@ -13927,7 +13675,6 @@ var Calendar = /** @class */ (function (_super) {
13927
13675
  previousMonthButtonLabel: "Previous Month",
13928
13676
  nextMonthButtonLabel: "Next Month",
13929
13677
  yearItemNumber: DEFAULT_YEAR_ITEM_NUMBER,
13930
- monthHeaderPosition: "top",
13931
13678
  };
13932
13679
  },
13933
13680
  enumerable: false,
@@ -13948,7 +13695,6 @@ var Calendar = /** @class */ (function (_super) {
13948
13695
  Calendar.prototype.componentDidUpdate = function (prevProps) {
13949
13696
  var _this = this;
13950
13697
  if (this.props.preSelection &&
13951
- isValid(this.props.preSelection) &&
13952
13698
  (!isSameDay(this.props.preSelection, prevProps.preSelection) ||
13953
13699
  this.props.monthSelectedIn !== prevProps.monthSelectedIn)) {
13954
13700
  var hasMonthChanged_1 = !isSameMonth(this.state.date, this.props.preSelection);
@@ -13969,12 +13715,10 @@ var Calendar = /** @class */ (function (_super) {
13969
13715
  React__namespace.default.createElement("div", { style: { display: "contents" }, ref: this.containerRef },
13970
13716
  React__namespace.default.createElement(Container, { className: clsx("react-datepicker", this.props.className, {
13971
13717
  "react-datepicker--time-only": this.props.showTimeSelectOnly,
13972
- }), showTime: this.props.showTimeSelect || this.props.showTimeInput, showTimeSelectOnly: this.props.showTimeSelectOnly, inline: this.props.inline },
13718
+ }), showTime: this.props.showTimeSelect || this.props.showTimeInput, showTimeSelectOnly: this.props.showTimeSelectOnly },
13973
13719
  this.renderAriaLiveRegion(),
13974
- this.props.monthHeaderPosition === "top" &&
13975
- this.renderPreviousButton(),
13976
- this.props.monthHeaderPosition === "top" &&
13977
- this.renderNextButton(),
13720
+ this.renderPreviousButton(),
13721
+ this.renderNextButton(),
13978
13722
  this.renderMonths(),
13979
13723
  this.renderYears(),
13980
13724
  this.renderTodayButton(),
@@ -14165,7 +13909,6 @@ function withFloating(Component) {
14165
13909
  var floatingProps = useFloating(_assign({ open: !hidePopper, whileElementsMounted: autoUpdate, placement: props.popperPlacement, middleware: __spreadArray([
14166
13910
  flip({ padding: 15 }),
14167
13911
  offset(10),
14168
- // eslint-disable-next-line react-hooks/refs -- Floating UI requires refs to be passed during render
14169
13912
  arrow({ element: arrowRef })
14170
13913
  ], ((_a = props.popperModifiers) !== null && _a !== void 0 ? _a : []), true) }, props.popperProps));
14171
13914
  var componentProps = _assign(_assign({}, props), { hidePopper: hidePopper, popperProps: _assign(_assign({}, floatingProps), { arrowRef: arrowRef }) });
@@ -14176,21 +13919,11 @@ function withFloating(Component) {
14176
13919
  }
14177
13920
 
14178
13921
  // Exported for testing purposes
14179
- var PopperComponent$1 = function (props) {
14180
- var className = props.className, wrapperClassName = props.wrapperClassName, _a = props.hidePopper, hidePopper = _a === void 0 ? true : _a, popperComponent = props.popperComponent, targetComponent = props.targetComponent, enableTabLoop = props.enableTabLoop, popperOnKeyDown = props.popperOnKeyDown, portalId = props.portalId, portalHost = props.portalHost, popperProps = props.popperProps, showArrow = props.showArrow, popperTargetRef = props.popperTargetRef, monthHeaderPosition = props.monthHeaderPosition;
14181
- // When a custom popperTargetRef is provided, use it as the position reference
14182
- // This allows the popper to be positioned relative to a specific element
14183
- // within the custom input, rather than the wrapper div
14184
- React.useEffect(function () {
14185
- if (popperTargetRef === null || popperTargetRef === void 0 ? void 0 : popperTargetRef.current) {
14186
- popperProps.refs.setPositionReference(popperTargetRef.current);
14187
- }
14188
- }, [popperTargetRef, popperProps.refs]);
13922
+ var PopperComponent = function (props) {
13923
+ var className = props.className, wrapperClassName = props.wrapperClassName, _a = props.hidePopper, hidePopper = _a === void 0 ? true : _a, popperComponent = props.popperComponent, targetComponent = props.targetComponent, enableTabLoop = props.enableTabLoop, popperOnKeyDown = props.popperOnKeyDown, portalId = props.portalId, portalHost = props.portalHost, popperProps = props.popperProps, showArrow = props.showArrow;
14189
13924
  var popper = undefined;
14190
13925
  if (!hidePopper) {
14191
- var classes = clsx("react-datepicker-popper", !showArrow && "react-datepicker-popper-offset", monthHeaderPosition === "middle" &&
14192
- "react-datepicker-popper--header-middle", monthHeaderPosition === "bottom" &&
14193
- "react-datepicker-popper--header-bottom", className);
13926
+ var classes = clsx("react-datepicker-popper", className);
14194
13927
  popper = (React__namespace.default.createElement(TabLoop, { enableTabLoop: enableTabLoop },
14195
13928
  React__namespace.default.createElement("div", { ref: popperProps.refs.setFloating, style: popperProps.floatingStyles, className: classes, "data-placement": popperProps.placement, onKeyDown: popperOnKeyDown },
14196
13929
  popperComponent,
@@ -14207,7 +13940,7 @@ var PopperComponent$1 = function (props) {
14207
13940
  React__namespace.default.createElement("div", { ref: popperProps.refs.setReference, className: wrapperClasses }, targetComponent),
14208
13941
  popper));
14209
13942
  };
14210
- var PopperComponent = withFloating(PopperComponent$1);
13943
+ var PopperComponent$1 = withFloating(PopperComponent);
14211
13944
 
14212
13945
  // Compares dates year+month combinations
14213
13946
  function hasPreSelectionChanged(date1, date2) {
@@ -14227,32 +13960,27 @@ var DatePicker = /** @class */ (function (_super) {
14227
13960
  _this.calendar = null;
14228
13961
  _this.input = null;
14229
13962
  _this.getPreSelection = function () {
14230
- var timeZone = _this.props.timeZone;
14231
- var baseDate = _this.props.openToDate
13963
+ return _this.props.openToDate
14232
13964
  ? _this.props.openToDate
14233
13965
  : _this.props.selectsEnd && _this.props.startDate
14234
13966
  ? _this.props.startDate
14235
13967
  : _this.props.selectsStart && _this.props.endDate
14236
13968
  ? _this.props.endDate
14237
13969
  : newDate();
14238
- // Convert to the specified timezone for display
14239
- return timeZone ? toZonedTime(baseDate, timeZone) : baseDate;
14240
13970
  };
14241
13971
  // Convert the date from string format to standard Date format
14242
- // Uses parseDate with ISO format to parse as local time, preventing
14243
- // dates from shifting in timezones west of UTC. See issue #6105.
14244
13972
  _this.modifyHolidays = function () {
14245
13973
  var _a;
14246
13974
  return (_a = _this.props.holidays) === null || _a === void 0 ? void 0 : _a.reduce(function (accumulator, holiday) {
14247
- var date = parseDate(holiday.date, "yyyy-MM-dd", undefined, false);
14248
- if (!date) {
13975
+ var date = new Date(holiday.date);
13976
+ if (!isValid(date)) {
14249
13977
  return accumulator;
14250
13978
  }
14251
13979
  return __spreadArray(__spreadArray([], accumulator, true), [_assign(_assign({}, holiday), { date: date })], false);
14252
13980
  }, []);
14253
13981
  };
14254
13982
  _this.calcInitialState = function () {
14255
- var timeZone = _this.props.timeZone;
13983
+ var _a;
14256
13984
  var defaultPreSelection = _this.getPreSelection();
14257
13985
  var minDate = getEffectiveMinDate(_this.props);
14258
13986
  var maxDate = getEffectiveMaxDate(_this.props);
@@ -14261,18 +13989,13 @@ var DatePicker = /** @class */ (function (_super) {
14261
13989
  : maxDate && isAfter(defaultPreSelection, getEndOfDay(maxDate))
14262
13990
  ? maxDate
14263
13991
  : defaultPreSelection;
14264
- // Convert selected/startDate to zoned time for display if timezone is specified
14265
- var initialPreSelection = _this.props.selectsRange
14266
- ? _this.props.startDate
14267
- : _this.props.selected;
14268
- if (initialPreSelection && timeZone) {
14269
- initialPreSelection = toZonedTime(initialPreSelection, timeZone);
14270
- }
14271
13992
  return {
14272
13993
  open: _this.props.startOpen || false,
14273
13994
  preventFocus: false,
14274
13995
  inputValue: null,
14275
- preSelection: initialPreSelection !== null && initialPreSelection !== void 0 ? initialPreSelection : boundedPreSelection,
13996
+ preSelection: (_a = (_this.props.selectsRange
13997
+ ? _this.props.startDate
13998
+ : _this.props.selected)) !== null && _a !== void 0 ? _a : boundedPreSelection,
14276
13999
  // transforming highlighted days (perhaps nested array)
14277
14000
  // to flat Map for faster access in day.jsx
14278
14001
  highlightDates: getHighLightDaysMap(_this.props.highlightDates),
@@ -14286,7 +14009,7 @@ var DatePicker = /** @class */ (function (_super) {
14286
14009
  };
14287
14010
  _this.getInputValue = function () {
14288
14011
  var _a;
14289
- var _b = _this.props, locale = _b.locale, startDate = _b.startDate, endDate = _b.endDate, rangeSeparator = _b.rangeSeparator, selected = _b.selected, selectedDates = _b.selectedDates, selectsMultiple = _b.selectsMultiple, selectsRange = _b.selectsRange, formatMultipleDates = _b.formatMultipleDates, value = _b.value;
14012
+ var _b = _this.props, locale = _b.locale, startDate = _b.startDate, endDate = _b.endDate, rangeSeparator = _b.rangeSeparator, selected = _b.selected, selectedDates = _b.selectedDates, selectsMultiple = _b.selectsMultiple, selectsRange = _b.selectsRange, value = _b.value;
14290
14013
  var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
14291
14014
  var inputValue = _this.state.inputValue;
14292
14015
  if (typeof value === "string") {
@@ -14303,12 +14026,6 @@ var DatePicker = /** @class */ (function (_super) {
14303
14026
  });
14304
14027
  }
14305
14028
  else if (selectsMultiple) {
14306
- if (formatMultipleDates) {
14307
- var formatDateFn = function (date) {
14308
- return safeDateFormat(date, { dateFormat: dateFormat, locale: locale });
14309
- };
14310
- return formatMultipleDates(selectedDates !== null && selectedDates !== void 0 ? selectedDates : [], formatDateFn);
14311
- }
14312
14029
  return safeMultipleDatesFormat(selectedDates !== null && selectedDates !== void 0 ? selectedDates : [], {
14313
14030
  dateFormat: dateFormat,
14314
14031
  locale: locale,
@@ -14426,19 +14143,6 @@ var DatePicker = /** @class */ (function (_super) {
14426
14143
  if (!_this.state.open || _this.props.withPortal || _this.props.showTimeInput) {
14427
14144
  (_b = (_a = _this.props).onBlur) === null || _b === void 0 ? void 0 : _b.call(_a, event);
14428
14145
  }
14429
- // If user cleared the input via a mask library (inputValue has no date-like
14430
- // characters), clear the selection on blur (fixes issue #5814 with mask inputs)
14431
- var inputValue = _this.state.inputValue;
14432
- if (typeof inputValue === "string" && inputValue.length > 0) {
14433
- // Check if input looks like a cleared mask (no alphanumeric characters)
14434
- // This distinguishes between:
14435
- // - "__/__/____" (cleared mask) → should clear selection
14436
- // - "2025-02-45" (invalid date) → should keep previous selection
14437
- var hasDateCharacters = /[a-zA-Z0-9]/.test(inputValue);
14438
- if (!hasDateCharacters && _this.props.selected) {
14439
- _this.setSelected(null, undefined, true);
14440
- }
14441
- }
14442
14146
  _this.resetInputValue();
14443
14147
  if (_this.state.open && _this.props.open === false) {
14444
14148
  _this.setOpen(false);
@@ -14447,19 +14151,17 @@ var DatePicker = /** @class */ (function (_super) {
14447
14151
  };
14448
14152
  _this.handleCalendarClickOutside = function (event) {
14449
14153
  var _a, _b;
14450
- // Call user's onClickOutside first, allowing them to call preventDefault()
14451
- (_b = (_a = _this.props).onClickOutside) === null || _b === void 0 ? void 0 : _b.call(_a, event);
14452
- // Only close if not prevented and not inline
14453
- if (!_this.props.inline && !event.defaultPrevented) {
14154
+ if (!_this.props.inline) {
14454
14155
  _this.setOpen(false);
14455
14156
  }
14157
+ (_b = (_a = _this.props).onClickOutside) === null || _b === void 0 ? void 0 : _b.call(_a, event);
14456
14158
  if (_this.props.withPortal) {
14457
14159
  event.preventDefault();
14458
14160
  }
14459
14161
  };
14460
14162
  // handleChange is called when user types in the textbox
14461
14163
  _this.handleChange = function () {
14462
- var _a, _b, _c, _d, _e, _f, _g, _h;
14164
+ var _a, _b, _c, _d, _e;
14463
14165
  var allArgs = [];
14464
14166
  for (var _i = 0; _i < arguments.length; _i++) {
14465
14167
  allArgs[_i] = arguments[_i];
@@ -14477,24 +14179,24 @@ var DatePicker = /** @class */ (function (_super) {
14477
14179
  inputValue: (event === null || event === void 0 ? void 0 : event.target) instanceof HTMLInputElement ? event.target.value : null,
14478
14180
  lastPreSelectChange: PRESELECT_CHANGE_VIA_INPUT,
14479
14181
  });
14480
- var _j = _this.props, selectsRange = _j.selectsRange, startDate = _j.startDate, endDate = _j.endDate;
14182
+ var _f = _this.props, selectsRange = _f.selectsRange, startDate = _f.startDate, endDate = _f.endDate;
14481
14183
  var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
14482
14184
  var strictParsing = (_b = _this.props.strictParsing) !== null && _b !== void 0 ? _b : DatePicker.defaultProps.strictParsing;
14483
14185
  var value = (event === null || event === void 0 ? void 0 : event.target) instanceof HTMLInputElement ? event.target.value : "";
14484
14186
  if (selectsRange) {
14485
14187
  var rangeSeparator = _this.props.rangeSeparator;
14486
14188
  var trimmedRangeSeparator = rangeSeparator.trim();
14487
- var _k = value
14189
+ var _g = value
14488
14190
  .split(dateFormat.includes(trimmedRangeSeparator)
14489
14191
  ? rangeSeparator
14490
14192
  : trimmedRangeSeparator, 2)
14491
- .map(function (val) { return val.trim(); }), valueStart = _k[0], valueEnd = _k[1];
14193
+ .map(function (val) { return val.trim(); }), valueStart = _g[0], valueEnd = _g[1];
14492
14194
  var startDateNew = parseDate(valueStart !== null && valueStart !== void 0 ? valueStart : "", dateFormat, _this.props.locale, strictParsing);
14493
14195
  var endDateNew = startDateNew
14494
14196
  ? parseDate(valueEnd !== null && valueEnd !== void 0 ? valueEnd : "", dateFormat, _this.props.locale, strictParsing)
14495
14197
  : null;
14496
- var startChanged = ((_c = safeToDate(startDate)) === null || _c === void 0 ? void 0 : _c.getTime()) !== (startDateNew === null || startDateNew === void 0 ? void 0 : startDateNew.getTime());
14497
- var endChanged = ((_d = safeToDate(endDate)) === null || _d === void 0 ? void 0 : _d.getTime()) !== (endDateNew === null || endDateNew === void 0 ? void 0 : endDateNew.getTime());
14198
+ var startChanged = (startDate === null || startDate === void 0 ? void 0 : startDate.getTime()) !== (startDateNew === null || startDateNew === void 0 ? void 0 : startDateNew.getTime());
14199
+ var endChanged = (endDate === null || endDate === void 0 ? void 0 : endDate.getTime()) !== (endDateNew === null || endDateNew === void 0 ? void 0 : endDateNew.getTime());
14498
14200
  if (!startChanged && !endChanged) {
14499
14201
  return;
14500
14202
  }
@@ -14504,31 +14206,15 @@ var DatePicker = /** @class */ (function (_super) {
14504
14206
  if (endDateNew && isDayDisabled(endDateNew, _this.props)) {
14505
14207
  return;
14506
14208
  }
14507
- // Update preSelection to keep calendar viewport consistent when reopening
14508
- // Use startDate for preSelection to match calcInitialState behavior
14509
- if (startDateNew) {
14510
- _this.setState({ preSelection: startDateNew });
14511
- }
14512
- (_f = (_e = _this.props).onChange) === null || _f === void 0 ? void 0 : _f.call(_e, [startDateNew, endDateNew], event);
14209
+ (_d = (_c = _this.props).onChange) === null || _d === void 0 ? void 0 : _d.call(_c, [startDateNew, endDateNew], event);
14513
14210
  }
14514
14211
  else {
14515
14212
  // not selectsRange
14516
- var date = parseDate(value, dateFormat, _this.props.locale, strictParsing, (_g = _this.props.selected) !== null && _g !== void 0 ? _g : undefined);
14213
+ var date = parseDate(value, dateFormat, _this.props.locale, strictParsing, (_e = _this.props.selected) !== null && _e !== void 0 ? _e : undefined);
14517
14214
  // Update selection if either (1) date was successfully parsed, or (2) input field is empty
14518
14215
  if (date || !value) {
14519
14216
  _this.setSelected(date, event, true);
14520
14217
  }
14521
- else if (!_this.props.inline) {
14522
- // If full date parsing failed but we have partial input,
14523
- // try to extract date info for calendar navigation
14524
- var navDate = parseDateForNavigation(value, (_h = _this.state.preSelection) !== null && _h !== void 0 ? _h : undefined);
14525
- // Only update preSelection if navDate is valid and within min/max bounds
14526
- if (navDate &&
14527
- (!_this.props.minDate || !isBefore(navDate, _this.props.minDate)) &&
14528
- (!_this.props.maxDate || !isAfter(navDate, _this.props.maxDate))) {
14529
- _this.setState({ preSelection: navDate });
14530
- }
14531
- }
14532
14218
  }
14533
14219
  };
14534
14220
  _this.handleSelect = function (date, event, monthSelectedIn) {
@@ -14567,13 +14253,7 @@ var DatePicker = /** @class */ (function (_super) {
14567
14253
  // setSelected is called either from handleChange (user typed date into textbox and it was parsed) or handleSelect (user selected date from calendar using mouse or keyboard)
14568
14254
  _this.setSelected = function (date, event, keepInput, monthSelectedIn) {
14569
14255
  var _a, _b;
14570
- var timeZone = _this.props.timeZone;
14571
- // If timezone is specified, convert the selected date from zoned time to UTC
14572
- // This ensures the onChange callback receives a proper UTC Date object
14573
14256
  var changedDate = date;
14574
- if (changedDate && timeZone) {
14575
- changedDate = fromZonedTime(changedDate, timeZone);
14576
- }
14577
14257
  // Early return if selected year/month/day is disabled
14578
14258
  if (_this.props.showYearPicker) {
14579
14259
  if (changedDate !== null &&
@@ -14630,56 +14310,54 @@ var DatePicker = /** @class */ (function (_super) {
14630
14310
  }
14631
14311
  }
14632
14312
  if (selectsRange) {
14633
- var onChangeRange = onChange;
14634
14313
  var noRanges = !startDate && !endDate;
14635
14314
  var hasStartRange = startDate && !endDate;
14636
14315
  var hasOnlyEndRange = !startDate && !!endDate;
14637
14316
  var isRangeFilled = startDate && endDate;
14638
14317
  if (noRanges) {
14639
- onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, null], event);
14318
+ onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, null], event);
14640
14319
  }
14641
14320
  else if (hasStartRange) {
14642
14321
  if (changedDate === null) {
14643
- onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([null, null], event);
14322
+ onChange === null || onChange === void 0 ? void 0 : onChange([null, null], event);
14644
14323
  }
14645
14324
  else if (isDateBefore(changedDate, startDate)) {
14646
14325
  if (swapRange) {
14647
- onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, startDate], event);
14326
+ onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, startDate], event);
14648
14327
  }
14649
14328
  else {
14650
- onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, null], event);
14329
+ onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, null], event);
14651
14330
  }
14652
14331
  }
14653
14332
  else {
14654
- onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([startDate, changedDate], event);
14333
+ onChange === null || onChange === void 0 ? void 0 : onChange([startDate, changedDate], event);
14655
14334
  }
14656
14335
  }
14657
14336
  else if (hasOnlyEndRange) {
14658
14337
  if (changedDate && isDateBefore(changedDate, endDate)) {
14659
- onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, endDate], event);
14338
+ onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, endDate], event);
14660
14339
  }
14661
14340
  else {
14662
- onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, null], event);
14341
+ onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, null], event);
14663
14342
  }
14664
14343
  }
14665
14344
  if (isRangeFilled) {
14666
- onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, null], event);
14345
+ onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, null], event);
14667
14346
  }
14668
14347
  }
14669
14348
  else if (selectsMultiple) {
14670
- var onChangeMultiple = onChange;
14671
14349
  if (changedDate !== null) {
14672
14350
  if (!(selectedDates === null || selectedDates === void 0 ? void 0 : selectedDates.length)) {
14673
- onChangeMultiple === null || onChangeMultiple === void 0 ? void 0 : onChangeMultiple([changedDate], event);
14351
+ onChange === null || onChange === void 0 ? void 0 : onChange([changedDate], event);
14674
14352
  }
14675
14353
  else {
14676
14354
  var isChangedDateAlreadySelected = selectedDates.some(function (selectedDate) { return isSameDay(selectedDate, changedDate); });
14677
14355
  if (isChangedDateAlreadySelected) {
14678
14356
  var nextDates = selectedDates.filter(function (selectedDate) { return !isSameDay(selectedDate, changedDate); });
14679
- onChangeMultiple === null || onChangeMultiple === void 0 ? void 0 : onChangeMultiple(nextDates, event);
14357
+ onChange === null || onChange === void 0 ? void 0 : onChange(nextDates, event);
14680
14358
  }
14681
14359
  else {
14682
- onChangeMultiple === null || onChangeMultiple === void 0 ? void 0 : onChangeMultiple(__spreadArray(__spreadArray([], selectedDates, true), [changedDate], false), event);
14360
+ onChange === null || onChange === void 0 ? void 0 : onChange(__spreadArray(__spreadArray([], selectedDates, true), [changedDate], false), event);
14683
14361
  }
14684
14362
  }
14685
14363
  }
@@ -14728,135 +14406,24 @@ var DatePicker = /** @class */ (function (_super) {
14728
14406
  _this.toggleCalendar = function () {
14729
14407
  _this.setOpen(!_this.state.open);
14730
14408
  };
14731
- _this.handleTimeChange = function (time, modifyDateType) {
14409
+ _this.handleTimeChange = function (time) {
14732
14410
  var _a, _b;
14733
- if (_this.props.selectsMultiple) {
14411
+ if (_this.props.selectsRange || _this.props.selectsMultiple) {
14734
14412
  return;
14735
14413
  }
14736
- var _c = _this.props, selectsRange = _c.selectsRange, startDate = _c.startDate, endDate = _c.endDate, onChange = _c.onChange, timeZone = _c.timeZone;
14737
- if (selectsRange) {
14738
- var onChangeRange = onChange;
14739
- // In range mode, apply time to the appropriate date
14740
- // If modifyDateType is specified, use that to determine which date to modify
14741
- // Otherwise, use the legacy behavior:
14742
- // - If we have a startDate but no endDate, apply time to startDate
14743
- // - If we have both, apply time to endDate
14744
- if (modifyDateType === "start") {
14745
- // Explicitly modify start date
14746
- if (startDate) {
14747
- var changedStartDate = setTime(startDate, {
14748
- hour: getHours(time),
14749
- minute: getMinutes(time),
14750
- });
14751
- _this.setState({
14752
- preSelection: changedStartDate,
14753
- });
14754
- // Convert from zoned time to UTC if timezone is specified
14755
- if (timeZone) {
14756
- changedStartDate = fromZonedTime(changedStartDate, timeZone);
14757
- }
14758
- onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([
14759
- changedStartDate,
14760
- endDate
14761
- ? timeZone
14762
- ? fromZonedTime(endDate, timeZone)
14763
- : endDate
14764
- : null,
14765
- ], undefined);
14766
- }
14767
- }
14768
- else if (modifyDateType === "end") {
14769
- // Explicitly modify end date
14770
- if (endDate) {
14771
- var changedEndDate = setTime(endDate, {
14772
- hour: getHours(time),
14773
- minute: getMinutes(time),
14774
- });
14775
- _this.setState({
14776
- preSelection: changedEndDate,
14777
- });
14778
- // Convert from zoned time to UTC if timezone is specified
14779
- if (timeZone) {
14780
- changedEndDate = fromZonedTime(changedEndDate, timeZone);
14781
- }
14782
- onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([
14783
- startDate
14784
- ? timeZone
14785
- ? fromZonedTime(startDate, timeZone)
14786
- : startDate
14787
- : null,
14788
- changedEndDate,
14789
- ], undefined);
14790
- }
14791
- }
14792
- else {
14793
- // Legacy behavior for showTimeSelect (single time picker)
14794
- var hasStartRange = startDate && !endDate;
14795
- if (hasStartRange) {
14796
- // Apply time to startDate
14797
- var changedStartDate = setTime(startDate, {
14798
- hour: getHours(time),
14799
- minute: getMinutes(time),
14800
- });
14801
- _this.setState({
14802
- preSelection: changedStartDate,
14803
- });
14804
- // Convert from zoned time to UTC if timezone is specified
14805
- if (timeZone) {
14806
- changedStartDate = fromZonedTime(changedStartDate, timeZone);
14807
- }
14808
- onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedStartDate, null], undefined);
14809
- }
14810
- else if (startDate && endDate) {
14811
- // Apply time to endDate
14812
- var changedEndDate = setTime(endDate, {
14813
- hour: getHours(time),
14814
- minute: getMinutes(time),
14815
- });
14816
- _this.setState({
14817
- preSelection: changedEndDate,
14818
- });
14819
- // Convert from zoned time to UTC if timezone is specified
14820
- if (timeZone) {
14821
- changedEndDate = fromZonedTime(changedEndDate, timeZone);
14822
- }
14823
- onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([
14824
- timeZone ? fromZonedTime(startDate, timeZone) : startDate,
14825
- changedEndDate,
14826
- ], undefined);
14827
- }
14828
- else {
14829
- // No dates selected yet, just update preSelection
14830
- var changedDate = setTime(_this.getPreSelection(), {
14831
- hour: getHours(time),
14832
- minute: getMinutes(time),
14833
- });
14834
- _this.setState({
14835
- preSelection: changedDate,
14836
- });
14837
- }
14838
- }
14839
- }
14840
- else {
14841
- // Single date mode (original behavior)
14842
- var selected = _this.props.selected
14843
- ? _this.props.selected
14844
- : _this.getPreSelection();
14845
- var changedDate = _this.props.selected
14846
- ? time
14847
- : setTime(selected, {
14848
- hour: getHours(time),
14849
- minute: getMinutes(time),
14850
- });
14851
- _this.setState({
14852
- preSelection: changedDate,
14414
+ var selected = _this.props.selected
14415
+ ? _this.props.selected
14416
+ : _this.getPreSelection();
14417
+ var changedDate = _this.props.selected
14418
+ ? time
14419
+ : setTime(selected, {
14420
+ hour: getHours(time),
14421
+ minute: getMinutes(time),
14853
14422
  });
14854
- // Convert from zoned time to UTC if timezone is specified
14855
- if (changedDate && timeZone) {
14856
- changedDate = fromZonedTime(changedDate, timeZone);
14857
- }
14858
- (_b = (_a = _this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, changedDate);
14859
- }
14423
+ _this.setState({
14424
+ preSelection: changedDate,
14425
+ });
14426
+ (_b = (_a = _this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, changedDate);
14860
14427
  if (_this.props.shouldCloseOnSelect && !_this.props.showTimeInput) {
14861
14428
  _this.sendFocusBackToInput();
14862
14429
  _this.setOpen(false);
@@ -14876,117 +14443,6 @@ var DatePicker = /** @class */ (function (_super) {
14876
14443
  }
14877
14444
  (_b = (_a = _this.props).onInputClick) === null || _b === void 0 ? void 0 : _b.call(_a);
14878
14445
  };
14879
- _this.handleTimeOnlyArrowKey = function (eventKey) {
14880
- var _a, _b, _c, _d;
14881
- var currentTime = safeToDate(_this.props.selected) || _this.state.preSelection || newDate();
14882
- var timeIntervals = (_a = _this.props.timeIntervals) !== null && _a !== void 0 ? _a : 30;
14883
- var dateFormat = (_b = _this.props.dateFormat) !== null && _b !== void 0 ? _b : DatePicker.defaultProps.dateFormat;
14884
- var formatStr = Array.isArray(dateFormat) ? dateFormat[0] : dateFormat;
14885
- var baseDate = getStartOfDay(currentTime);
14886
- var currentMinutes = getHours(currentTime) * 60 + getMinutes(currentTime);
14887
- var maxMinutes = 23 * 60 + 60 - timeIntervals; // Cap at last valid interval of the day
14888
- var newTime;
14889
- if (eventKey === KeyType.ArrowUp) {
14890
- var newMinutes = Math.max(0, currentMinutes - timeIntervals);
14891
- newTime = addMinutes(baseDate, newMinutes);
14892
- }
14893
- else {
14894
- var newMinutes = Math.min(maxMinutes, currentMinutes + timeIntervals);
14895
- newTime = addMinutes(baseDate, newMinutes);
14896
- }
14897
- var formattedTime = formatDate(newTime, formatStr || DatePicker.defaultProps.dateFormat, _this.props.locale);
14898
- _this.setState({
14899
- preSelection: newTime,
14900
- inputValue: formattedTime,
14901
- });
14902
- if (_this.props.selectsRange || _this.props.selectsMultiple) {
14903
- return;
14904
- }
14905
- var selected = _this.props.selected
14906
- ? _this.props.selected
14907
- : _this.getPreSelection();
14908
- var changedDate = _this.props.selected
14909
- ? newTime
14910
- : setTime(selected, {
14911
- hour: getHours(newTime),
14912
- minute: getMinutes(newTime),
14913
- });
14914
- (_d = (_c = _this.props).onChange) === null || _d === void 0 ? void 0 : _d.call(_c, changedDate);
14915
- if (_this.props.showTimeSelectOnly || _this.props.showTimeSelect) {
14916
- _this.setState({ isRenderAriaLiveMessage: true });
14917
- }
14918
- requestAnimationFrame(function () {
14919
- _this.scrollToTimeOption(newTime);
14920
- });
14921
- };
14922
- _this.handleTimeOnlyEnterKey = function (event) {
14923
- var _a, _b, _c, _d;
14924
- var inputElement = event.target;
14925
- var inputValue = inputElement.value;
14926
- var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
14927
- var timeFormat = _this.props.timeFormat || "p";
14928
- var defaultTime = _this.state.preSelection || safeToDate(_this.props.selected) || newDate();
14929
- var parsedDate = parseDate(inputValue, dateFormat, _this.props.locale, (_b = _this.props.strictParsing) !== null && _b !== void 0 ? _b : false, defaultTime);
14930
- var timeToCommit = defaultTime;
14931
- if (parsedDate && isValid(parsedDate)) {
14932
- timeToCommit = parsedDate;
14933
- }
14934
- else {
14935
- var highlightedItem = ((_c = _this.calendar) === null || _c === void 0 ? void 0 : _c.containerRef.current) instanceof Element &&
14936
- _this.calendar.containerRef.current.querySelector(".react-datepicker__time-list-item[tabindex='0']");
14937
- if (highlightedItem instanceof HTMLElement) {
14938
- var itemText = (_d = highlightedItem.textContent) === null || _d === void 0 ? void 0 : _d.trim();
14939
- if (itemText) {
14940
- var itemTime = parseDate(itemText, timeFormat, _this.props.locale, false, defaultTime);
14941
- if (itemTime && isValid(itemTime)) {
14942
- timeToCommit = itemTime;
14943
- }
14944
- }
14945
- }
14946
- }
14947
- _this.handleTimeChange(timeToCommit);
14948
- _this.setOpen(false);
14949
- _this.sendFocusBackToInput();
14950
- };
14951
- _this.scrollToTimeOption = function (time) {
14952
- var _a, _b;
14953
- if (!((_a = _this.calendar) === null || _a === void 0 ? void 0 : _a.containerRef.current)) {
14954
- return;
14955
- }
14956
- var container = _this.calendar.containerRef.current;
14957
- var timeListItems = Array.from(container.querySelectorAll(".react-datepicker__time-list-item"));
14958
- var targetItem = null;
14959
- var closestTimeDiff = Infinity;
14960
- var timeFormat = _this.props.timeFormat || "p";
14961
- for (var _i = 0, timeListItems_1 = timeListItems; _i < timeListItems_1.length; _i++) {
14962
- var item = timeListItems_1[_i];
14963
- var itemText = (_b = item.textContent) === null || _b === void 0 ? void 0 : _b.trim();
14964
- if (itemText) {
14965
- var itemTime = parseDate(itemText, timeFormat, _this.props.locale, false, time);
14966
- if (itemTime && isValid(itemTime)) {
14967
- if (isSameMinute(itemTime, time)) {
14968
- targetItem = item;
14969
- break;
14970
- }
14971
- var timeDiff = Math.abs(itemTime.getTime() - time.getTime());
14972
- if (timeDiff < closestTimeDiff) {
14973
- closestTimeDiff = timeDiff;
14974
- targetItem = item;
14975
- }
14976
- }
14977
- }
14978
- }
14979
- if (targetItem) {
14980
- timeListItems.forEach(function (item) {
14981
- item.setAttribute("tabindex", "-1");
14982
- });
14983
- targetItem.setAttribute("tabindex", "0");
14984
- targetItem.scrollIntoView({
14985
- behavior: "smooth",
14986
- block: "center",
14987
- });
14988
- }
14989
- };
14990
14446
  _this.onInputKeyDown = function (event) {
14991
14447
  var _a, _b, _c, _d, _e, _f;
14992
14448
  (_b = (_a = _this.props).onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a, event);
@@ -15001,18 +14457,6 @@ var DatePicker = /** @class */ (function (_super) {
15001
14457
  }
15002
14458
  return;
15003
14459
  }
15004
- if (_this.state.open && _this.props.showTimeSelectOnly) {
15005
- if (eventKey === KeyType.ArrowDown || eventKey === KeyType.ArrowUp) {
15006
- event.preventDefault();
15007
- _this.handleTimeOnlyArrowKey(eventKey);
15008
- return;
15009
- }
15010
- if (eventKey === KeyType.Enter) {
15011
- event.preventDefault();
15012
- _this.handleTimeOnlyEnterKey(event);
15013
- return;
15014
- }
15015
- }
15016
14460
  // if calendar is open, these keys will focus the selected item
15017
14461
  if (_this.state.open) {
15018
14462
  if (eventKey === KeyType.ArrowDown || eventKey === KeyType.ArrowUp) {
@@ -15203,12 +14647,20 @@ var DatePicker = /** @class */ (function (_super) {
15203
14647
  _this.setSelected(newSelection);
15204
14648
  }
15205
14649
  _this.setPreSelection(newSelection);
15206
- // In inline mode, always set shouldFocusDayInline to true when navigating via keyboard.
15207
- // This ensures focus is properly transferred to the new day element regardless of
15208
- // whether the month changed. The user initiated this navigation from a focused day,
15209
- // so we should always focus the destination day.
14650
+ // need to figure out whether month has changed to focus day in inline version
15210
14651
  if (inline) {
15211
- _this.setState({ shouldFocusDayInline: true });
14652
+ var prevMonth = getMonth(copy);
14653
+ var newMonth = getMonth(newSelection);
14654
+ var prevYear = getYear(copy);
14655
+ var newYear = getYear(newSelection);
14656
+ if (prevMonth !== newMonth || prevYear !== newYear) {
14657
+ // month has changed
14658
+ _this.setState({ shouldFocusDayInline: true });
14659
+ }
14660
+ else {
14661
+ // month hasn't changed
14662
+ _this.setState({ shouldFocusDayInline: false });
14663
+ }
15212
14664
  }
15213
14665
  };
15214
14666
  // handle generic key down events in the popper that do not adjust or select dates
@@ -15255,9 +14707,6 @@ var DatePicker = /** @class */ (function (_super) {
15255
14707
  }
15256
14708
  }
15257
14709
  };
15258
- _this.handleMonthSelectedInChange = function (monthSelectedIn) {
15259
- _this.setState({ monthSelectedIn: monthSelectedIn });
15260
- };
15261
14710
  _this.renderCalendar = function () {
15262
14711
  var _a, _b;
15263
14712
  if (!_this.props.inline && !_this.isCalendarOpen()) {
@@ -15265,7 +14714,7 @@ var DatePicker = /** @class */ (function (_super) {
15265
14714
  }
15266
14715
  return (React__namespace.default.createElement(Calendar, _assign({ showMonthYearDropdown: undefined, ref: function (elem) {
15267
14716
  _this.calendar = elem;
15268
- } }, _this.props, _this.state, { setOpen: _this.setOpen, dateFormat: (_a = _this.props.dateFormatCalendar) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormatCalendar, onSelect: _this.handleSelect, onClickOutside: _this.handleCalendarClickOutside, holidays: getHolidaysMap(_this.modifyHolidays()), outsideClickIgnoreClass: _this.props.outsideClickIgnoreClass, onDropdownFocus: _this.handleDropdownFocus, onTimeChange: _this.handleTimeChange, className: _this.props.calendarClassName, container: _this.props.calendarContainer, handleOnKeyDown: _this.props.onKeyDown, handleOnDayKeyDown: _this.onDayKeyDown, setPreSelection: _this.setPreSelection, dropdownMode: (_b = _this.props.dropdownMode) !== null && _b !== void 0 ? _b : DatePicker.defaultProps.dropdownMode, onMonthSelectedInChange: _this.handleMonthSelectedInChange }), _this.props.children));
14717
+ } }, _this.props, _this.state, { setOpen: _this.setOpen, dateFormat: (_a = _this.props.dateFormatCalendar) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormatCalendar, onSelect: _this.handleSelect, onClickOutside: _this.handleCalendarClickOutside, holidays: getHolidaysMap(_this.modifyHolidays()), outsideClickIgnoreClass: _this.props.outsideClickIgnoreClass, onDropdownFocus: _this.handleDropdownFocus, onTimeChange: _this.handleTimeChange, className: _this.props.calendarClassName, container: _this.props.calendarContainer, handleOnKeyDown: _this.props.onKeyDown, handleOnDayKeyDown: _this.onDayKeyDown, setPreSelection: _this.setPreSelection, dropdownMode: (_b = _this.props.dropdownMode) !== null && _b !== void 0 ? _b : DatePicker.defaultProps.dropdownMode }), _this.props.children));
15269
14718
  };
15270
14719
  _this.renderAriaLiveRegion = function () {
15271
14720
  var _a;
@@ -15313,34 +14762,39 @@ var DatePicker = /** @class */ (function (_super) {
15313
14762
  };
15314
14763
  _this.renderDateInput = function () {
15315
14764
  var _a, _b;
15316
- var _c, _d, _e, _f, _g;
15317
14765
  var className = clsx(_this.props.className, (_a = {},
15318
14766
  _a[_this.props.outsideClickIgnoreClass ||
15319
14767
  DatePicker.defaultProps.outsideClickIgnoreClass] = _this.state.open,
15320
14768
  _a));
15321
14769
  var customInput = _this.props.customInput || React__namespace.default.createElement("input", { type: "text" });
15322
14770
  var customInputRef = _this.props.customInputRef || "ref";
15323
- // Build aria props object, only including defined values to avoid
15324
- // overwriting aria attributes that may be set on the custom input
15325
- var ariaProps = {};
15326
- var ariaDescribedBy = (_c = _this.props["aria-describedby"]) !== null && _c !== void 0 ? _c : _this.props.ariaDescribedBy;
15327
- var ariaInvalid = (_d = _this.props["aria-invalid"]) !== null && _d !== void 0 ? _d : _this.props.ariaInvalid;
15328
- var ariaLabel = (_e = _this.props["aria-label"]) !== null && _e !== void 0 ? _e : _this.props.ariaLabel;
15329
- var ariaLabelledBy = (_f = _this.props["aria-labelledby"]) !== null && _f !== void 0 ? _f : _this.props.ariaLabelledBy;
15330
- var ariaRequired = (_g = _this.props["aria-required"]) !== null && _g !== void 0 ? _g : _this.props.ariaRequired;
15331
- if (ariaDescribedBy != null)
15332
- ariaProps["aria-describedby"] = ariaDescribedBy;
15333
- if (ariaInvalid != null)
15334
- ariaProps["aria-invalid"] = ariaInvalid;
15335
- if (ariaLabel != null)
15336
- ariaProps["aria-label"] = ariaLabel;
15337
- if (ariaLabelledBy != null)
15338
- ariaProps["aria-labelledby"] = ariaLabelledBy;
15339
- if (ariaRequired != null)
15340
- ariaProps["aria-required"] = ariaRequired;
15341
- return React.cloneElement(customInput, _assign((_b = {}, _b[customInputRef] = function (input) {
15342
- _this.input = input;
15343
- }, _b.value = _this.getInputValue(), _b.onBlur = _this.handleBlur, _b.onChange = _this.handleChange, _b.onClick = _this.onInputClick, _b.onFocus = _this.handleFocus, _b.onKeyDown = _this.onInputKeyDown, _b.id = _this.props.id, _b.name = _this.props.name, _b.form = _this.props.form, _b.autoFocus = _this.props.autoFocus, _b.placeholder = _this.props.placeholderText, _b.disabled = _this.props.disabled, _b.autoComplete = _this.props.autoComplete, _b.className = clsx(customInput.props.className, className), _b.title = _this.props.title, _b.readOnly = _this.props.readOnly, _b.required = _this.props.required, _b.tabIndex = _this.props.tabIndex, _b), ariaProps));
14771
+ return React.cloneElement(customInput, (_b = {},
14772
+ _b[customInputRef] = function (input) {
14773
+ _this.input = input;
14774
+ },
14775
+ _b.value = _this.getInputValue(),
14776
+ _b.onBlur = _this.handleBlur,
14777
+ _b.onChange = _this.handleChange,
14778
+ _b.onClick = _this.onInputClick,
14779
+ _b.onFocus = _this.handleFocus,
14780
+ _b.onKeyDown = _this.onInputKeyDown,
14781
+ _b.id = _this.props.id,
14782
+ _b.name = _this.props.name,
14783
+ _b.form = _this.props.form,
14784
+ _b.autoFocus = _this.props.autoFocus,
14785
+ _b.placeholder = _this.props.placeholderText,
14786
+ _b.disabled = _this.props.disabled,
14787
+ _b.autoComplete = _this.props.autoComplete,
14788
+ _b.className = clsx(customInput.props.className, className),
14789
+ _b.title = _this.props.title,
14790
+ _b.readOnly = _this.props.readOnly,
14791
+ _b.required = _this.props.required,
14792
+ _b.tabIndex = _this.props.tabIndex,
14793
+ _b["aria-describedby"] = _this.props.ariaDescribedBy,
14794
+ _b["aria-invalid"] = _this.props.ariaInvalid,
14795
+ _b["aria-labelledby"] = _this.props.ariaLabelledBy,
14796
+ _b["aria-required"] = _this.props.ariaRequired,
14797
+ _b));
15344
14798
  };
15345
14799
  _this.renderClearButton = function () {
15346
14800
  var _a = _this.props, isClearable = _a.isClearable, disabled = _a.disabled, selected = _a.selected, startDate = _a.startDate, endDate = _a.endDate, clearButtonTitle = _a.clearButtonTitle, _b = _a.clearButtonClassName, clearButtonClassName = _b === void 0 ? "" : _b, _c = _a.ariaLabelClose, ariaLabelClose = _c === void 0 ? "Close" : _c, selectedDates = _a.selectedDates, readOnly = _a.readOnly;
@@ -15420,30 +14874,14 @@ var DatePicker = /** @class */ (function (_super) {
15420
14874
  };
15421
14875
  DatePicker.prototype.componentDidUpdate = function (prevProps, prevState) {
15422
14876
  var _a, _b, _c, _d;
15423
- // Update preSelection when selected/startDate prop changes to a different month/year.
15424
- // This ensures the calendar view updates when dates are programmatically set
15425
- // (e.g., via "Today" or "This Week" buttons). (Fix for #3367)
15426
- if (this.props.selectsRange &&
15427
- hasPreSelectionChanged(prevProps.startDate, this.props.startDate)) {
15428
- this.setPreSelection(this.props.startDate);
15429
- }
15430
- else if (hasPreSelectionChanged(prevProps.selected, this.props.selected)) {
14877
+ if (prevProps.inline &&
14878
+ hasPreSelectionChanged(prevProps.selected, this.props.selected)) {
15431
14879
  this.setPreSelection(this.props.selected);
15432
14880
  }
15433
14881
  if (this.state.monthSelectedIn !== undefined &&
15434
14882
  prevProps.monthsShown !== this.props.monthsShown) {
15435
14883
  this.setState({ monthSelectedIn: 0 });
15436
14884
  }
15437
- // Reset monthSelectedIn when calendar opens for range selection
15438
- // This ensures startDate is displayed as the first month when reopening
15439
- // (Fix for #5939), but we don't reset during active selection to avoid
15440
- // the view jumping when clicking dates in the second calendar (Fix for #5275)
15441
- if (this.props.selectsRange &&
15442
- prevState.open === false &&
15443
- this.state.open === true &&
15444
- this.state.monthSelectedIn !== 0) {
15445
- this.setState({ monthSelectedIn: 0 });
15446
- }
15447
14885
  if (prevProps.highlightDates !== this.props.highlightDates) {
15448
14886
  this.setState({
15449
14887
  highlightDates: getHighLightDaysMap(this.props.highlightDates),
@@ -15493,11 +14931,11 @@ var DatePicker = /** @class */ (function (_super) {
15493
14931
  if (this.state.open && this.props.portalId) {
15494
14932
  portalContainer = (React__namespace.default.createElement(Portal, _assign({ portalId: this.props.portalId }, this.props), portalContainer));
15495
14933
  }
15496
- return (React__namespace.default.createElement(React__namespace.default.Fragment, null,
14934
+ return (React__namespace.default.createElement("div", null,
15497
14935
  this.renderInputContainer(),
15498
14936
  portalContainer));
15499
14937
  }
15500
- return (React__namespace.default.createElement(PopperComponent, _assign({}, this.props, { className: this.props.popperClassName, hidePopper: !this.isCalendarOpen(), targetComponent: this.renderInputContainer(), popperComponent: calendar, popperOnKeyDown: this.onPopperKeyDown, showArrow: this.props.showPopperArrow, monthHeaderPosition: this.props.monthHeaderPosition })));
14938
+ return (React__namespace.default.createElement(PopperComponent$1, _assign({}, this.props, { className: this.props.popperClassName, hidePopper: !this.isCalendarOpen(), targetComponent: this.renderInputContainer(), popperComponent: calendar, popperOnKeyDown: this.onPopperKeyDown, showArrow: this.props.showPopperArrow })));
15501
14939
  };
15502
14940
  return DatePicker;
15503
14941
  }(React.Component));
@@ -15905,4 +15343,4 @@ exports.DatePickerGroup = DatePickerGroup;
15905
15343
  exports.HelperText = HelperText;
15906
15344
  exports.InlineDatePicker = InlineDatePicker;
15907
15345
  exports.ValidationText = ValidationText;
15908
- //# sourceMappingURL=InlineDatePicker-pT085Em_.js.map
15346
+ //# sourceMappingURL=InlineDatePicker-4u82zKn2.js.map