@cerebruminc/cerebellum 16.5.10-beta.dangerous.8acc3c1 → 16.5.10-beta.dangerous.9f03af8
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/cjs/DatePicker.cjs +1 -1
- package/lib/cjs/Form.cjs +2 -2
- package/lib/cjs/{FormikContainer-BVUsbx6j.js → FormikContainer-DY64qixC.js} +2 -2
- package/lib/cjs/{FormikContainer-BVUsbx6j.js.map → FormikContainer-DY64qixC.js.map} +1 -1
- package/lib/cjs/{InlineDatePicker-4u82zKn2.js → InlineDatePicker-pT085Em_.js} +702 -140
- package/lib/cjs/InlineDatePicker-pT085Em_.js.map +1 -0
- package/lib/cjs/InlineDatePicker.cjs +1 -1
- package/lib/cjs/index.cjs +2 -2
- package/lib/esm/DatePicker.js +1 -1
- package/lib/esm/Form.js +2 -2
- package/lib/esm/{FormikContainer-C_iJWcIG.js → FormikContainer-BjsSb293.js} +2 -2
- package/lib/esm/{FormikContainer-C_iJWcIG.js.map → FormikContainer-BjsSb293.js.map} +1 -1
- package/lib/esm/{InlineDatePicker-RlV9iC8j.js → InlineDatePicker-XiMGS9jI.js} +703 -141
- package/lib/{cjs/InlineDatePicker-4u82zKn2.js.map → esm/InlineDatePicker-XiMGS9jI.js.map} +1 -1
- package/lib/esm/InlineDatePicker.js +1 -1
- package/lib/esm/index.js +2 -2
- package/package.json +4 -4
- package/lib/esm/InlineDatePicker-RlV9iC8j.js.map +0 -1
|
@@ -9696,7 +9696,7 @@ function useFloating(options) {
|
|
|
9696
9696
|
}
|
|
9697
9697
|
|
|
9698
9698
|
/*!
|
|
9699
|
-
react-datepicker
|
|
9699
|
+
react-datepicker v9.1.0
|
|
9700
9700
|
https://github.com/Hacker0x01/react-datepicker
|
|
9701
9701
|
Released under the MIT License.
|
|
9702
9702
|
*/
|
|
@@ -9760,17 +9760,19 @@ 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;
|
|
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;
|
|
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, role: "dialog", "aria-
|
|
9767
|
+
return (React__namespace.default.createElement("div", { className: className, "aria-label": ariaLabel, role: inline ? undefined : "dialog", "aria-modal": inline ? undefined : "true", translate: "no" }, 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
|
-
|
|
9773
|
+
React.useEffect(function () {
|
|
9774
|
+
onClickOutsideRef.current = onClickOutside;
|
|
9775
|
+
}, [onClickOutside]);
|
|
9774
9776
|
var handleClickOutside = React.useCallback(function (event) {
|
|
9775
9777
|
var _a;
|
|
9776
9778
|
var target = (event.composed &&
|
|
@@ -9806,6 +9808,77 @@ var ClickOutsideWrapper = function (_a) {
|
|
|
9806
9808
|
} }, children));
|
|
9807
9809
|
};
|
|
9808
9810
|
|
|
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
|
+
}
|
|
9809
9882
|
var KeyType;
|
|
9810
9883
|
(function (KeyType) {
|
|
9811
9884
|
KeyType["ArrowUp"] = "ArrowUp";
|
|
@@ -9862,20 +9935,72 @@ function parseDate(value, dateFormat, locale, strictParsing, refDate) {
|
|
|
9862
9935
|
return parsedDate;
|
|
9863
9936
|
}
|
|
9864
9937
|
}
|
|
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
|
+
}
|
|
9865
9950
|
return null;
|
|
9866
9951
|
}
|
|
9867
9952
|
/**
|
|
9868
|
-
*
|
|
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.
|
|
9869
9982
|
* @param date - The date to be checked.
|
|
9870
|
-
* @
|
|
9871
|
-
|
|
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
|
|
9872
9994
|
*/
|
|
9873
|
-
function
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
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;
|
|
9879
10004
|
}
|
|
9880
10005
|
// ** Date Formatting **
|
|
9881
10006
|
/**
|
|
@@ -10476,6 +10601,7 @@ function isTimeInDisabledRange(time, _a) {
|
|
|
10476
10601
|
valid = !isWithinInterval(baseTime, { start: min, end: max });
|
|
10477
10602
|
}
|
|
10478
10603
|
catch (err) {
|
|
10604
|
+
/* istanbul ignore next - date-fns historically threw on invalid intervals */
|
|
10479
10605
|
valid = false;
|
|
10480
10606
|
}
|
|
10481
10607
|
return valid;
|
|
@@ -11051,6 +11177,10 @@ var Day = /** @class */ (function (_super) {
|
|
|
11051
11177
|
var _a;
|
|
11052
11178
|
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;
|
|
11053
11179
|
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
|
+
}
|
|
11054
11184
|
if (!(selectsStart || selectsEnd || selectsRange) ||
|
|
11055
11185
|
!selectingDate ||
|
|
11056
11186
|
(!selectsDisabledDaysInRange && _this.isDisabled())) {
|
|
@@ -11779,7 +11909,12 @@ var Month$1 = /** @class */ (function (_super) {
|
|
|
11779
11909
|
});
|
|
11780
11910
|
};
|
|
11781
11911
|
_this.isSelectedQuarter = function (day, q, selected) {
|
|
11782
|
-
return getQuarter(
|
|
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
|
+
});
|
|
11783
11918
|
};
|
|
11784
11919
|
_this.isMonthSelected = function () {
|
|
11785
11920
|
var _a = _this.props, day = _a.day, selected = _a.selected, selectedDates = _a.selectedDates, selectsMultiple = _a.selectsMultiple;
|
|
@@ -11791,7 +11926,21 @@ var Month$1 = /** @class */ (function (_super) {
|
|
|
11791
11926
|
}
|
|
11792
11927
|
return !!selected && _this.isSelectedMonth(day, monthIdx, selected);
|
|
11793
11928
|
};
|
|
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
|
+
};
|
|
11794
11939
|
_this.renderWeeks = function () {
|
|
11940
|
+
// Return empty array if day is invalid
|
|
11941
|
+
if (!isValid(_this.props.day)) {
|
|
11942
|
+
return [];
|
|
11943
|
+
}
|
|
11795
11944
|
var weeks = [];
|
|
11796
11945
|
var isFixedHeight = _this.props.fixedHeight;
|
|
11797
11946
|
var i = 0;
|
|
@@ -12088,7 +12237,7 @@ var Month$1 = /** @class */ (function (_super) {
|
|
|
12088
12237
|
return "".concat(prefix, " ").concat(formatDate(labelDate, "MMMM yyyy", locale));
|
|
12089
12238
|
};
|
|
12090
12239
|
_this.getQuarterClassNames = function (q) {
|
|
12091
|
-
var _a = _this.props, day = _a.day, startDate = _a.startDate, endDate = _a.endDate,
|
|
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;
|
|
12092
12241
|
var isDisabled = (minDate ||
|
|
12093
12242
|
maxDate ||
|
|
12094
12243
|
excludeDates ||
|
|
@@ -12096,14 +12245,16 @@ var Month$1 = /** @class */ (function (_super) {
|
|
|
12096
12245
|
filterDate ||
|
|
12097
12246
|
disabled) &&
|
|
12098
12247
|
isQuarterDisabled(setQuarter(day, q), _this.props);
|
|
12248
|
+
var selection = _this.getSelection();
|
|
12099
12249
|
return clsx("react-datepicker__quarter-text", "react-datepicker__quarter-".concat(q), {
|
|
12100
12250
|
"react-datepicker__quarter-text--disabled": isDisabled,
|
|
12101
|
-
"react-datepicker__quarter-text--selected":
|
|
12102
|
-
? _this.
|
|
12251
|
+
"react-datepicker__quarter-text--selected": selection
|
|
12252
|
+
? _this.isSelectQuarterInList(day, q, selection)
|
|
12103
12253
|
: undefined,
|
|
12104
12254
|
"react-datepicker__quarter-text--keyboard-selected": !disabledKeyboardNavigation &&
|
|
12105
12255
|
preSelection &&
|
|
12106
12256
|
_this.isSelectedQuarter(day, q, preSelection) &&
|
|
12257
|
+
!_this.isQuarterSelected() &&
|
|
12107
12258
|
!isDisabled,
|
|
12108
12259
|
"react-datepicker__quarter-text--in-selecting-range": _this.isInSelectingRangeQuarter(q),
|
|
12109
12260
|
"react-datepicker__quarter-text--in-range": startDate && endDate
|
|
@@ -12183,14 +12334,20 @@ var Month$1 = /** @class */ (function (_super) {
|
|
|
12183
12334
|
var formattedAriaLabelPrefix = ariaLabelPrefix
|
|
12184
12335
|
? ariaLabelPrefix.trim() + " "
|
|
12185
12336
|
: "";
|
|
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
|
+
: "";
|
|
12186
12341
|
var shouldUseListboxRole = showMonthYearPicker || showQuarterYearPicker;
|
|
12187
12342
|
if (shouldUseListboxRole) {
|
|
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":
|
|
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()));
|
|
12189
12344
|
}
|
|
12190
12345
|
// For regular calendar view, use table structure
|
|
12191
12346
|
return (React__namespace.default.createElement("div", { role: "table" },
|
|
12192
12347
|
this.props.dayNamesHeader && (React__namespace.default.createElement("div", { role: "rowgroup" }, this.props.dayNamesHeader)),
|
|
12193
|
-
|
|
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))));
|
|
12194
12351
|
};
|
|
12195
12352
|
return Month;
|
|
12196
12353
|
}(React.Component));
|
|
@@ -12301,10 +12458,15 @@ var MonthDropdown = /** @class */ (function (_super) {
|
|
|
12301
12458
|
return MonthDropdown;
|
|
12302
12459
|
}(React.Component));
|
|
12303
12460
|
|
|
12304
|
-
|
|
12461
|
+
// Default range: 5 years before and after current date
|
|
12462
|
+
var DEFAULT_YEAR_RANGE$1 = 5;
|
|
12463
|
+
function generateMonthYears(minDate, maxDate, currentDate) {
|
|
12305
12464
|
var list = [];
|
|
12306
|
-
|
|
12307
|
-
var
|
|
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);
|
|
12308
12470
|
while (!isAfter(currDate, lastDate)) {
|
|
12309
12471
|
list.push(newDate(currDate));
|
|
12310
12472
|
currDate = addMonths(currDate, 1);
|
|
@@ -12332,7 +12494,7 @@ var MonthYearDropdownOptions = /** @class */ (function (_super) {
|
|
|
12332
12494
|
_this.props.onCancel();
|
|
12333
12495
|
};
|
|
12334
12496
|
_this.state = {
|
|
12335
|
-
monthYearsList: generateMonthYears(_this.props.minDate, _this.props.maxDate),
|
|
12497
|
+
monthYearsList: generateMonthYears(_this.props.minDate, _this.props.maxDate, _this.props.date),
|
|
12336
12498
|
};
|
|
12337
12499
|
return _this;
|
|
12338
12500
|
}
|
|
@@ -12346,6 +12508,8 @@ var MonthYearDropdownOptions = /** @class */ (function (_super) {
|
|
|
12346
12508
|
return MonthYearDropdownOptions;
|
|
12347
12509
|
}(React.Component));
|
|
12348
12510
|
|
|
12511
|
+
// Default range: 5 years before and after current date
|
|
12512
|
+
var DEFAULT_YEAR_RANGE = 5;
|
|
12349
12513
|
var MonthYearDropdown = /** @class */ (function (_super) {
|
|
12350
12514
|
__extends(MonthYearDropdown, _super);
|
|
12351
12515
|
function MonthYearDropdown() {
|
|
@@ -12354,8 +12518,12 @@ var MonthYearDropdown = /** @class */ (function (_super) {
|
|
|
12354
12518
|
dropdownVisible: false,
|
|
12355
12519
|
};
|
|
12356
12520
|
_this.renderSelectOptions = function () {
|
|
12357
|
-
var
|
|
12358
|
-
|
|
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);
|
|
12359
12527
|
var options = [];
|
|
12360
12528
|
while (!isAfter(currDate, lastDate)) {
|
|
12361
12529
|
var timePoint = getTime(currDate);
|
|
@@ -12447,7 +12615,8 @@ var Time = /** @class */ (function (_super) {
|
|
|
12447
12615
|
(_b = (_a = _this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, time);
|
|
12448
12616
|
};
|
|
12449
12617
|
_this.isSelectedTime = function (time) {
|
|
12450
|
-
|
|
12618
|
+
var selected = safeToDate(_this.props.selected);
|
|
12619
|
+
return selected && isSameMinute(selected, time);
|
|
12451
12620
|
};
|
|
12452
12621
|
_this.isDisabledTime = function (time) {
|
|
12453
12622
|
return ((_this.props.minTime || _this.props.maxTime) &&
|
|
@@ -12508,7 +12677,9 @@ var Time = /** @class */ (function (_super) {
|
|
|
12508
12677
|
var times = [];
|
|
12509
12678
|
var format = typeof _this.props.format === "string" ? _this.props.format : "p";
|
|
12510
12679
|
var intervals = (_a = _this.props.intervals) !== null && _a !== void 0 ? _a : Time.defaultProps.intervals;
|
|
12511
|
-
var activeDate = _this.props.selected ||
|
|
12680
|
+
var activeDate = safeToDate(_this.props.selected) ||
|
|
12681
|
+
safeToDate(_this.props.openToDate) ||
|
|
12682
|
+
newDate();
|
|
12512
12683
|
var base = getStartOfDay(activeDate);
|
|
12513
12684
|
var sortedInjectTimes = _this.props.injectTimes &&
|
|
12514
12685
|
_this.props.injectTimes.sort(function (a, b) {
|
|
@@ -12588,9 +12759,13 @@ var Time = /** @class */ (function (_super) {
|
|
|
12588
12759
|
};
|
|
12589
12760
|
Time.prototype.updateContainerHeight = function () {
|
|
12590
12761
|
if (this.props.monthRef && this.header) {
|
|
12591
|
-
this.
|
|
12592
|
-
|
|
12593
|
-
|
|
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
|
+
}
|
|
12594
12769
|
}
|
|
12595
12770
|
};
|
|
12596
12771
|
Time.prototype.render = function () {
|
|
@@ -13278,7 +13453,13 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13278
13453
|
return ({
|
|
13279
13454
|
date: setMonth(date, Number(month)),
|
|
13280
13455
|
});
|
|
13281
|
-
}, function () {
|
|
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
|
+
});
|
|
13282
13463
|
};
|
|
13283
13464
|
_this.changeMonthYear = function (monthYear) {
|
|
13284
13465
|
_this.setState(function (_a) {
|
|
@@ -13288,8 +13469,13 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13288
13469
|
});
|
|
13289
13470
|
}, function () { return _this.handleMonthYearChange(_this.state.date); });
|
|
13290
13471
|
};
|
|
13291
|
-
_this.header = function (date) {
|
|
13472
|
+
_this.header = function (date, customDayNameCount) {
|
|
13292
13473
|
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
|
+
}
|
|
13293
13479
|
var disabled = _this.props.disabled;
|
|
13294
13480
|
var startOfWeek = getStartOfWeek(date, _this.props.locale, _this.props.calendarStartDay);
|
|
13295
13481
|
var dayNames = [];
|
|
@@ -13301,11 +13487,24 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13301
13487
|
return dayNames.concat([0, 1, 2, 3, 4, 5, 6].map(function (offset) {
|
|
13302
13488
|
var day = addDays(startOfWeek, offset);
|
|
13303
13489
|
var weekDayName = _this.formatWeekday(day, _this.props.locale);
|
|
13490
|
+
var fullDayName = formatDate(day, "EEEE", _this.props.locale);
|
|
13304
13491
|
var weekDayClassName = _this.props.weekDayClassName
|
|
13305
13492
|
? _this.props.weekDayClassName(day)
|
|
13306
13493
|
: 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
|
|
13307
13506
|
return (React__namespace.default.createElement("div", { key: offset, role: "columnheader", className: clsx("react-datepicker__day-name", weekDayClassName, disabled ? "react-datepicker__day-name--disabled" : "") },
|
|
13308
|
-
React__namespace.default.createElement("span", { className: "react-datepicker__sr-only" },
|
|
13507
|
+
React__namespace.default.createElement("span", { className: "react-datepicker__sr-only" }, fullDayName),
|
|
13309
13508
|
React__namespace.default.createElement("span", { "aria-hidden": "true" }, weekDayName)));
|
|
13310
13509
|
}));
|
|
13311
13510
|
};
|
|
@@ -13484,7 +13683,9 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13484
13683
|
if (_this.props.showMonthYearDropdown) {
|
|
13485
13684
|
classes.push("react-datepicker__current-month--hasMonthYearDropdown");
|
|
13486
13685
|
}
|
|
13487
|
-
return (React__namespace.default.createElement("h2", { className: classes.join(" ") },
|
|
13686
|
+
return (React__namespace.default.createElement("h2", { className: classes.join(" ") }, isValid(date)
|
|
13687
|
+
? formatDate(date, _this.props.dateFormat, _this.props.locale)
|
|
13688
|
+
: ""));
|
|
13488
13689
|
};
|
|
13489
13690
|
_this.renderYearDropdown = function (overrideHide) {
|
|
13490
13691
|
if (overrideHide === void 0) { overrideHide = false; }
|
|
@@ -13517,17 +13718,31 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13517
13718
|
}
|
|
13518
13719
|
return (React__namespace.default.createElement("div", { className: "react-datepicker__today-button", onClick: _this.handleTodayButtonClick }, _this.props.todayButton));
|
|
13519
13720
|
};
|
|
13520
|
-
_this.renderDayNamesHeader = function (monthDate
|
|
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
|
+
};
|
|
13521
13725
|
_this.renderDefaultHeader = function (_a) {
|
|
13522
13726
|
var monthDate = _a.monthDate, i = _a.i;
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
: ""
|
|
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
|
+
}) },
|
|
13526
13732
|
_this.renderCurrentMonth(monthDate),
|
|
13527
13733
|
React__namespace.default.createElement("div", { className: "react-datepicker__header__dropdown react-datepicker__header__dropdown--".concat(_this.props.dropdownMode), onFocus: _this.handleDropdownFocus },
|
|
13528
13734
|
_this.renderMonthDropdown(i !== 0),
|
|
13529
13735
|
_this.renderMonthYearDropdown(i !== 0),
|
|
13530
13736
|
_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));
|
|
13531
13746
|
};
|
|
13532
13747
|
_this.renderCustomHeader = function (headerArgs) {
|
|
13533
13748
|
var _a, _b;
|
|
@@ -13596,8 +13811,13 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13596
13811
|
monthList.push(React__namespace.default.createElement("div", { key: monthKey, ref: function (div) {
|
|
13597
13812
|
_this.monthContainer = div !== null && div !== void 0 ? div : undefined;
|
|
13598
13813
|
}, className: "react-datepicker__month-container" },
|
|
13599
|
-
_this.
|
|
13600
|
-
|
|
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 }))));
|
|
13601
13821
|
}
|
|
13602
13822
|
return monthList;
|
|
13603
13823
|
};
|
|
@@ -13620,6 +13840,34 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13620
13840
|
return;
|
|
13621
13841
|
};
|
|
13622
13842
|
_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)
|
|
13623
13871
|
var time = _this.props.selected
|
|
13624
13872
|
? new Date(_this.props.selected)
|
|
13625
13873
|
: undefined;
|
|
@@ -13627,13 +13875,17 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13627
13875
|
var timeString = timeValid
|
|
13628
13876
|
? "".concat(addZero(time.getHours()), ":").concat(addZero(time.getMinutes()))
|
|
13629
13877
|
: "";
|
|
13630
|
-
|
|
13631
|
-
|
|
13632
|
-
|
|
13633
|
-
|
|
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
|
+
} })));
|
|
13634
13882
|
};
|
|
13635
13883
|
_this.renderAriaLiveRegion = function () {
|
|
13636
13884
|
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
|
+
}
|
|
13637
13889
|
var _b = getYearsPeriod(_this.state.date, (_a = _this.props.yearItemNumber) !== null && _a !== void 0 ? _a : Calendar.defaultProps.yearItemNumber), startPeriod = _b.startPeriod, endPeriod = _b.endPeriod;
|
|
13638
13890
|
var ariaLiveMessage;
|
|
13639
13891
|
if (_this.props.showYearPicker) {
|
|
@@ -13675,6 +13927,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13675
13927
|
previousMonthButtonLabel: "Previous Month",
|
|
13676
13928
|
nextMonthButtonLabel: "Next Month",
|
|
13677
13929
|
yearItemNumber: DEFAULT_YEAR_ITEM_NUMBER,
|
|
13930
|
+
monthHeaderPosition: "top",
|
|
13678
13931
|
};
|
|
13679
13932
|
},
|
|
13680
13933
|
enumerable: false,
|
|
@@ -13695,6 +13948,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13695
13948
|
Calendar.prototype.componentDidUpdate = function (prevProps) {
|
|
13696
13949
|
var _this = this;
|
|
13697
13950
|
if (this.props.preSelection &&
|
|
13951
|
+
isValid(this.props.preSelection) &&
|
|
13698
13952
|
(!isSameDay(this.props.preSelection, prevProps.preSelection) ||
|
|
13699
13953
|
this.props.monthSelectedIn !== prevProps.monthSelectedIn)) {
|
|
13700
13954
|
var hasMonthChanged_1 = !isSameMonth(this.state.date, this.props.preSelection);
|
|
@@ -13715,10 +13969,12 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13715
13969
|
React__namespace.default.createElement("div", { style: { display: "contents" }, ref: this.containerRef },
|
|
13716
13970
|
React__namespace.default.createElement(Container, { className: clsx("react-datepicker", this.props.className, {
|
|
13717
13971
|
"react-datepicker--time-only": this.props.showTimeSelectOnly,
|
|
13718
|
-
}), showTime: this.props.showTimeSelect || this.props.showTimeInput, showTimeSelectOnly: this.props.showTimeSelectOnly },
|
|
13972
|
+
}), showTime: this.props.showTimeSelect || this.props.showTimeInput, showTimeSelectOnly: this.props.showTimeSelectOnly, inline: this.props.inline },
|
|
13719
13973
|
this.renderAriaLiveRegion(),
|
|
13720
|
-
this.
|
|
13721
|
-
|
|
13974
|
+
this.props.monthHeaderPosition === "top" &&
|
|
13975
|
+
this.renderPreviousButton(),
|
|
13976
|
+
this.props.monthHeaderPosition === "top" &&
|
|
13977
|
+
this.renderNextButton(),
|
|
13722
13978
|
this.renderMonths(),
|
|
13723
13979
|
this.renderYears(),
|
|
13724
13980
|
this.renderTodayButton(),
|
|
@@ -13909,6 +14165,7 @@ function withFloating(Component) {
|
|
|
13909
14165
|
var floatingProps = useFloating(_assign({ open: !hidePopper, whileElementsMounted: autoUpdate, placement: props.popperPlacement, middleware: __spreadArray([
|
|
13910
14166
|
flip({ padding: 15 }),
|
|
13911
14167
|
offset(10),
|
|
14168
|
+
// eslint-disable-next-line react-hooks/refs -- Floating UI requires refs to be passed during render
|
|
13912
14169
|
arrow({ element: arrowRef })
|
|
13913
14170
|
], ((_a = props.popperModifiers) !== null && _a !== void 0 ? _a : []), true) }, props.popperProps));
|
|
13914
14171
|
var componentProps = _assign(_assign({}, props), { hidePopper: hidePopper, popperProps: _assign(_assign({}, floatingProps), { arrowRef: arrowRef }) });
|
|
@@ -13919,11 +14176,21 @@ function withFloating(Component) {
|
|
|
13919
14176
|
}
|
|
13920
14177
|
|
|
13921
14178
|
// Exported for testing purposes
|
|
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;
|
|
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]);
|
|
13924
14189
|
var popper = undefined;
|
|
13925
14190
|
if (!hidePopper) {
|
|
13926
|
-
var classes = clsx("react-datepicker-popper",
|
|
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);
|
|
13927
14194
|
popper = (React__namespace.default.createElement(TabLoop, { enableTabLoop: enableTabLoop },
|
|
13928
14195
|
React__namespace.default.createElement("div", { ref: popperProps.refs.setFloating, style: popperProps.floatingStyles, className: classes, "data-placement": popperProps.placement, onKeyDown: popperOnKeyDown },
|
|
13929
14196
|
popperComponent,
|
|
@@ -13940,7 +14207,7 @@ var PopperComponent = function (props) {
|
|
|
13940
14207
|
React__namespace.default.createElement("div", { ref: popperProps.refs.setReference, className: wrapperClasses }, targetComponent),
|
|
13941
14208
|
popper));
|
|
13942
14209
|
};
|
|
13943
|
-
var PopperComponent
|
|
14210
|
+
var PopperComponent = withFloating(PopperComponent$1);
|
|
13944
14211
|
|
|
13945
14212
|
// Compares dates year+month combinations
|
|
13946
14213
|
function hasPreSelectionChanged(date1, date2) {
|
|
@@ -13960,27 +14227,32 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
13960
14227
|
_this.calendar = null;
|
|
13961
14228
|
_this.input = null;
|
|
13962
14229
|
_this.getPreSelection = function () {
|
|
13963
|
-
|
|
14230
|
+
var timeZone = _this.props.timeZone;
|
|
14231
|
+
var baseDate = _this.props.openToDate
|
|
13964
14232
|
? _this.props.openToDate
|
|
13965
14233
|
: _this.props.selectsEnd && _this.props.startDate
|
|
13966
14234
|
? _this.props.startDate
|
|
13967
14235
|
: _this.props.selectsStart && _this.props.endDate
|
|
13968
14236
|
? _this.props.endDate
|
|
13969
14237
|
: newDate();
|
|
14238
|
+
// Convert to the specified timezone for display
|
|
14239
|
+
return timeZone ? toZonedTime(baseDate, timeZone) : baseDate;
|
|
13970
14240
|
};
|
|
13971
14241
|
// 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.
|
|
13972
14244
|
_this.modifyHolidays = function () {
|
|
13973
14245
|
var _a;
|
|
13974
14246
|
return (_a = _this.props.holidays) === null || _a === void 0 ? void 0 : _a.reduce(function (accumulator, holiday) {
|
|
13975
|
-
var date =
|
|
13976
|
-
if (!
|
|
14247
|
+
var date = parseDate(holiday.date, "yyyy-MM-dd", undefined, false);
|
|
14248
|
+
if (!date) {
|
|
13977
14249
|
return accumulator;
|
|
13978
14250
|
}
|
|
13979
14251
|
return __spreadArray(__spreadArray([], accumulator, true), [_assign(_assign({}, holiday), { date: date })], false);
|
|
13980
14252
|
}, []);
|
|
13981
14253
|
};
|
|
13982
14254
|
_this.calcInitialState = function () {
|
|
13983
|
-
var
|
|
14255
|
+
var timeZone = _this.props.timeZone;
|
|
13984
14256
|
var defaultPreSelection = _this.getPreSelection();
|
|
13985
14257
|
var minDate = getEffectiveMinDate(_this.props);
|
|
13986
14258
|
var maxDate = getEffectiveMaxDate(_this.props);
|
|
@@ -13989,13 +14261,18 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
13989
14261
|
: maxDate && isAfter(defaultPreSelection, getEndOfDay(maxDate))
|
|
13990
14262
|
? maxDate
|
|
13991
14263
|
: 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
|
+
}
|
|
13992
14271
|
return {
|
|
13993
14272
|
open: _this.props.startOpen || false,
|
|
13994
14273
|
preventFocus: false,
|
|
13995
14274
|
inputValue: null,
|
|
13996
|
-
preSelection:
|
|
13997
|
-
? _this.props.startDate
|
|
13998
|
-
: _this.props.selected)) !== null && _a !== void 0 ? _a : boundedPreSelection,
|
|
14275
|
+
preSelection: initialPreSelection !== null && initialPreSelection !== void 0 ? initialPreSelection : boundedPreSelection,
|
|
13999
14276
|
// transforming highlighted days (perhaps nested array)
|
|
14000
14277
|
// to flat Map for faster access in day.jsx
|
|
14001
14278
|
highlightDates: getHighLightDaysMap(_this.props.highlightDates),
|
|
@@ -14009,7 +14286,7 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14009
14286
|
};
|
|
14010
14287
|
_this.getInputValue = function () {
|
|
14011
14288
|
var _a;
|
|
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;
|
|
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;
|
|
14013
14290
|
var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
|
|
14014
14291
|
var inputValue = _this.state.inputValue;
|
|
14015
14292
|
if (typeof value === "string") {
|
|
@@ -14026,6 +14303,12 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14026
14303
|
});
|
|
14027
14304
|
}
|
|
14028
14305
|
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
|
+
}
|
|
14029
14312
|
return safeMultipleDatesFormat(selectedDates !== null && selectedDates !== void 0 ? selectedDates : [], {
|
|
14030
14313
|
dateFormat: dateFormat,
|
|
14031
14314
|
locale: locale,
|
|
@@ -14143,6 +14426,19 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14143
14426
|
if (!_this.state.open || _this.props.withPortal || _this.props.showTimeInput) {
|
|
14144
14427
|
(_b = (_a = _this.props).onBlur) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
14145
14428
|
}
|
|
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
|
+
}
|
|
14146
14442
|
_this.resetInputValue();
|
|
14147
14443
|
if (_this.state.open && _this.props.open === false) {
|
|
14148
14444
|
_this.setOpen(false);
|
|
@@ -14151,17 +14447,19 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14151
14447
|
};
|
|
14152
14448
|
_this.handleCalendarClickOutside = function (event) {
|
|
14153
14449
|
var _a, _b;
|
|
14154
|
-
|
|
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) {
|
|
14155
14454
|
_this.setOpen(false);
|
|
14156
14455
|
}
|
|
14157
|
-
(_b = (_a = _this.props).onClickOutside) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
14158
14456
|
if (_this.props.withPortal) {
|
|
14159
14457
|
event.preventDefault();
|
|
14160
14458
|
}
|
|
14161
14459
|
};
|
|
14162
14460
|
// handleChange is called when user types in the textbox
|
|
14163
14461
|
_this.handleChange = function () {
|
|
14164
|
-
var _a, _b, _c, _d, _e;
|
|
14462
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
14165
14463
|
var allArgs = [];
|
|
14166
14464
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
14167
14465
|
allArgs[_i] = arguments[_i];
|
|
@@ -14179,24 +14477,24 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14179
14477
|
inputValue: (event === null || event === void 0 ? void 0 : event.target) instanceof HTMLInputElement ? event.target.value : null,
|
|
14180
14478
|
lastPreSelectChange: PRESELECT_CHANGE_VIA_INPUT,
|
|
14181
14479
|
});
|
|
14182
|
-
var
|
|
14480
|
+
var _j = _this.props, selectsRange = _j.selectsRange, startDate = _j.startDate, endDate = _j.endDate;
|
|
14183
14481
|
var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
|
|
14184
14482
|
var strictParsing = (_b = _this.props.strictParsing) !== null && _b !== void 0 ? _b : DatePicker.defaultProps.strictParsing;
|
|
14185
14483
|
var value = (event === null || event === void 0 ? void 0 : event.target) instanceof HTMLInputElement ? event.target.value : "";
|
|
14186
14484
|
if (selectsRange) {
|
|
14187
14485
|
var rangeSeparator = _this.props.rangeSeparator;
|
|
14188
14486
|
var trimmedRangeSeparator = rangeSeparator.trim();
|
|
14189
|
-
var
|
|
14487
|
+
var _k = value
|
|
14190
14488
|
.split(dateFormat.includes(trimmedRangeSeparator)
|
|
14191
14489
|
? rangeSeparator
|
|
14192
14490
|
: trimmedRangeSeparator, 2)
|
|
14193
|
-
.map(function (val) { return val.trim(); }), valueStart =
|
|
14491
|
+
.map(function (val) { return val.trim(); }), valueStart = _k[0], valueEnd = _k[1];
|
|
14194
14492
|
var startDateNew = parseDate(valueStart !== null && valueStart !== void 0 ? valueStart : "", dateFormat, _this.props.locale, strictParsing);
|
|
14195
14493
|
var endDateNew = startDateNew
|
|
14196
14494
|
? parseDate(valueEnd !== null && valueEnd !== void 0 ? valueEnd : "", dateFormat, _this.props.locale, strictParsing)
|
|
14197
14495
|
: null;
|
|
14198
|
-
var startChanged = (startDate === null ||
|
|
14199
|
-
var endChanged = (endDate === 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());
|
|
14200
14498
|
if (!startChanged && !endChanged) {
|
|
14201
14499
|
return;
|
|
14202
14500
|
}
|
|
@@ -14206,15 +14504,31 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14206
14504
|
if (endDateNew && isDayDisabled(endDateNew, _this.props)) {
|
|
14207
14505
|
return;
|
|
14208
14506
|
}
|
|
14209
|
-
|
|
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);
|
|
14210
14513
|
}
|
|
14211
14514
|
else {
|
|
14212
14515
|
// not selectsRange
|
|
14213
|
-
var date = parseDate(value, dateFormat, _this.props.locale, strictParsing, (
|
|
14516
|
+
var date = parseDate(value, dateFormat, _this.props.locale, strictParsing, (_g = _this.props.selected) !== null && _g !== void 0 ? _g : undefined);
|
|
14214
14517
|
// Update selection if either (1) date was successfully parsed, or (2) input field is empty
|
|
14215
14518
|
if (date || !value) {
|
|
14216
14519
|
_this.setSelected(date, event, true);
|
|
14217
14520
|
}
|
|
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
|
+
}
|
|
14218
14532
|
}
|
|
14219
14533
|
};
|
|
14220
14534
|
_this.handleSelect = function (date, event, monthSelectedIn) {
|
|
@@ -14253,7 +14567,13 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14253
14567
|
// 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)
|
|
14254
14568
|
_this.setSelected = function (date, event, keepInput, monthSelectedIn) {
|
|
14255
14569
|
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
|
|
14256
14573
|
var changedDate = date;
|
|
14574
|
+
if (changedDate && timeZone) {
|
|
14575
|
+
changedDate = fromZonedTime(changedDate, timeZone);
|
|
14576
|
+
}
|
|
14257
14577
|
// Early return if selected year/month/day is disabled
|
|
14258
14578
|
if (_this.props.showYearPicker) {
|
|
14259
14579
|
if (changedDate !== null &&
|
|
@@ -14310,54 +14630,56 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14310
14630
|
}
|
|
14311
14631
|
}
|
|
14312
14632
|
if (selectsRange) {
|
|
14633
|
+
var onChangeRange = onChange;
|
|
14313
14634
|
var noRanges = !startDate && !endDate;
|
|
14314
14635
|
var hasStartRange = startDate && !endDate;
|
|
14315
14636
|
var hasOnlyEndRange = !startDate && !!endDate;
|
|
14316
14637
|
var isRangeFilled = startDate && endDate;
|
|
14317
14638
|
if (noRanges) {
|
|
14318
|
-
|
|
14639
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, null], event);
|
|
14319
14640
|
}
|
|
14320
14641
|
else if (hasStartRange) {
|
|
14321
14642
|
if (changedDate === null) {
|
|
14322
|
-
|
|
14643
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([null, null], event);
|
|
14323
14644
|
}
|
|
14324
14645
|
else if (isDateBefore(changedDate, startDate)) {
|
|
14325
14646
|
if (swapRange) {
|
|
14326
|
-
|
|
14647
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, startDate], event);
|
|
14327
14648
|
}
|
|
14328
14649
|
else {
|
|
14329
|
-
|
|
14650
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, null], event);
|
|
14330
14651
|
}
|
|
14331
14652
|
}
|
|
14332
14653
|
else {
|
|
14333
|
-
|
|
14654
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([startDate, changedDate], event);
|
|
14334
14655
|
}
|
|
14335
14656
|
}
|
|
14336
14657
|
else if (hasOnlyEndRange) {
|
|
14337
14658
|
if (changedDate && isDateBefore(changedDate, endDate)) {
|
|
14338
|
-
|
|
14659
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, endDate], event);
|
|
14339
14660
|
}
|
|
14340
14661
|
else {
|
|
14341
|
-
|
|
14662
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, null], event);
|
|
14342
14663
|
}
|
|
14343
14664
|
}
|
|
14344
14665
|
if (isRangeFilled) {
|
|
14345
|
-
|
|
14666
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, null], event);
|
|
14346
14667
|
}
|
|
14347
14668
|
}
|
|
14348
14669
|
else if (selectsMultiple) {
|
|
14670
|
+
var onChangeMultiple = onChange;
|
|
14349
14671
|
if (changedDate !== null) {
|
|
14350
14672
|
if (!(selectedDates === null || selectedDates === void 0 ? void 0 : selectedDates.length)) {
|
|
14351
|
-
|
|
14673
|
+
onChangeMultiple === null || onChangeMultiple === void 0 ? void 0 : onChangeMultiple([changedDate], event);
|
|
14352
14674
|
}
|
|
14353
14675
|
else {
|
|
14354
14676
|
var isChangedDateAlreadySelected = selectedDates.some(function (selectedDate) { return isSameDay(selectedDate, changedDate); });
|
|
14355
14677
|
if (isChangedDateAlreadySelected) {
|
|
14356
14678
|
var nextDates = selectedDates.filter(function (selectedDate) { return !isSameDay(selectedDate, changedDate); });
|
|
14357
|
-
|
|
14679
|
+
onChangeMultiple === null || onChangeMultiple === void 0 ? void 0 : onChangeMultiple(nextDates, event);
|
|
14358
14680
|
}
|
|
14359
14681
|
else {
|
|
14360
|
-
|
|
14682
|
+
onChangeMultiple === null || onChangeMultiple === void 0 ? void 0 : onChangeMultiple(__spreadArray(__spreadArray([], selectedDates, true), [changedDate], false), event);
|
|
14361
14683
|
}
|
|
14362
14684
|
}
|
|
14363
14685
|
}
|
|
@@ -14406,24 +14728,135 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14406
14728
|
_this.toggleCalendar = function () {
|
|
14407
14729
|
_this.setOpen(!_this.state.open);
|
|
14408
14730
|
};
|
|
14409
|
-
_this.handleTimeChange = function (time) {
|
|
14731
|
+
_this.handleTimeChange = function (time, modifyDateType) {
|
|
14410
14732
|
var _a, _b;
|
|
14411
|
-
if (_this.props.
|
|
14733
|
+
if (_this.props.selectsMultiple) {
|
|
14412
14734
|
return;
|
|
14413
14735
|
}
|
|
14414
|
-
var
|
|
14415
|
-
|
|
14416
|
-
|
|
14417
|
-
|
|
14418
|
-
|
|
14419
|
-
|
|
14420
|
-
|
|
14421
|
-
|
|
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,
|
|
14422
14853
|
});
|
|
14423
|
-
|
|
14424
|
-
|
|
14425
|
-
|
|
14426
|
-
|
|
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
|
+
}
|
|
14427
14860
|
if (_this.props.shouldCloseOnSelect && !_this.props.showTimeInput) {
|
|
14428
14861
|
_this.sendFocusBackToInput();
|
|
14429
14862
|
_this.setOpen(false);
|
|
@@ -14443,6 +14876,117 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14443
14876
|
}
|
|
14444
14877
|
(_b = (_a = _this.props).onInputClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
14445
14878
|
};
|
|
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
|
+
};
|
|
14446
14990
|
_this.onInputKeyDown = function (event) {
|
|
14447
14991
|
var _a, _b, _c, _d, _e, _f;
|
|
14448
14992
|
(_b = (_a = _this.props).onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
@@ -14457,6 +15001,18 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14457
15001
|
}
|
|
14458
15002
|
return;
|
|
14459
15003
|
}
|
|
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
|
+
}
|
|
14460
15016
|
// if calendar is open, these keys will focus the selected item
|
|
14461
15017
|
if (_this.state.open) {
|
|
14462
15018
|
if (eventKey === KeyType.ArrowDown || eventKey === KeyType.ArrowUp) {
|
|
@@ -14647,20 +15203,12 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14647
15203
|
_this.setSelected(newSelection);
|
|
14648
15204
|
}
|
|
14649
15205
|
_this.setPreSelection(newSelection);
|
|
14650
|
-
//
|
|
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.
|
|
14651
15210
|
if (inline) {
|
|
14652
|
-
|
|
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
|
-
}
|
|
15211
|
+
_this.setState({ shouldFocusDayInline: true });
|
|
14664
15212
|
}
|
|
14665
15213
|
};
|
|
14666
15214
|
// handle generic key down events in the popper that do not adjust or select dates
|
|
@@ -14707,6 +15255,9 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14707
15255
|
}
|
|
14708
15256
|
}
|
|
14709
15257
|
};
|
|
15258
|
+
_this.handleMonthSelectedInChange = function (monthSelectedIn) {
|
|
15259
|
+
_this.setState({ monthSelectedIn: monthSelectedIn });
|
|
15260
|
+
};
|
|
14710
15261
|
_this.renderCalendar = function () {
|
|
14711
15262
|
var _a, _b;
|
|
14712
15263
|
if (!_this.props.inline && !_this.isCalendarOpen()) {
|
|
@@ -14714,7 +15265,7 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14714
15265
|
}
|
|
14715
15266
|
return (React__namespace.default.createElement(Calendar, _assign({ showMonthYearDropdown: undefined, ref: function (elem) {
|
|
14716
15267
|
_this.calendar = elem;
|
|
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));
|
|
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));
|
|
14718
15269
|
};
|
|
14719
15270
|
_this.renderAriaLiveRegion = function () {
|
|
14720
15271
|
var _a;
|
|
@@ -14762,39 +15313,34 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14762
15313
|
};
|
|
14763
15314
|
_this.renderDateInput = function () {
|
|
14764
15315
|
var _a, _b;
|
|
15316
|
+
var _c, _d, _e, _f, _g;
|
|
14765
15317
|
var className = clsx(_this.props.className, (_a = {},
|
|
14766
15318
|
_a[_this.props.outsideClickIgnoreClass ||
|
|
14767
15319
|
DatePicker.defaultProps.outsideClickIgnoreClass] = _this.state.open,
|
|
14768
15320
|
_a));
|
|
14769
15321
|
var customInput = _this.props.customInput || React__namespace.default.createElement("input", { type: "text" });
|
|
14770
15322
|
var customInputRef = _this.props.customInputRef || "ref";
|
|
14771
|
-
|
|
14772
|
-
|
|
14773
|
-
|
|
14774
|
-
|
|
14775
|
-
|
|
14776
|
-
|
|
14777
|
-
|
|
14778
|
-
|
|
14779
|
-
|
|
14780
|
-
|
|
14781
|
-
|
|
14782
|
-
|
|
14783
|
-
|
|
14784
|
-
|
|
14785
|
-
|
|
14786
|
-
|
|
14787
|
-
|
|
14788
|
-
|
|
14789
|
-
|
|
14790
|
-
|
|
14791
|
-
|
|
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));
|
|
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));
|
|
14798
15344
|
};
|
|
14799
15345
|
_this.renderClearButton = function () {
|
|
14800
15346
|
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;
|
|
@@ -14874,14 +15420,30 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14874
15420
|
};
|
|
14875
15421
|
DatePicker.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
14876
15422
|
var _a, _b, _c, _d;
|
|
14877
|
-
|
|
14878
|
-
|
|
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)) {
|
|
14879
15431
|
this.setPreSelection(this.props.selected);
|
|
14880
15432
|
}
|
|
14881
15433
|
if (this.state.monthSelectedIn !== undefined &&
|
|
14882
15434
|
prevProps.monthsShown !== this.props.monthsShown) {
|
|
14883
15435
|
this.setState({ monthSelectedIn: 0 });
|
|
14884
15436
|
}
|
|
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
|
+
}
|
|
14885
15447
|
if (prevProps.highlightDates !== this.props.highlightDates) {
|
|
14886
15448
|
this.setState({
|
|
14887
15449
|
highlightDates: getHighLightDaysMap(this.props.highlightDates),
|
|
@@ -14931,11 +15493,11 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14931
15493
|
if (this.state.open && this.props.portalId) {
|
|
14932
15494
|
portalContainer = (React__namespace.default.createElement(Portal, _assign({ portalId: this.props.portalId }, this.props), portalContainer));
|
|
14933
15495
|
}
|
|
14934
|
-
return (React__namespace.default.createElement(
|
|
15496
|
+
return (React__namespace.default.createElement(React__namespace.default.Fragment, null,
|
|
14935
15497
|
this.renderInputContainer(),
|
|
14936
15498
|
portalContainer));
|
|
14937
15499
|
}
|
|
14938
|
-
return (React__namespace.default.createElement(PopperComponent
|
|
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 })));
|
|
14939
15501
|
};
|
|
14940
15502
|
return DatePicker;
|
|
14941
15503
|
}(React.Component));
|
|
@@ -15343,4 +15905,4 @@ exports.DatePickerGroup = DatePickerGroup;
|
|
|
15343
15905
|
exports.HelperText = HelperText;
|
|
15344
15906
|
exports.InlineDatePicker = InlineDatePicker;
|
|
15345
15907
|
exports.ValidationText = ValidationText;
|
|
15346
|
-
//# sourceMappingURL=InlineDatePicker-
|
|
15908
|
+
//# sourceMappingURL=InlineDatePicker-pT085Em_.js.map
|