@cerebruminc/cerebellum 16.5.10-beta.dangerous.7085159 → 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 +4 -4
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/{AddMenu-UH1K7oqD.js → AddMenu-BDCYm3vd.js} +3 -3
- package/lib/esm/AddMenu-BDCYm3vd.js.map +1 -0
- package/lib/esm/AddMenu.js +5 -5
- package/lib/esm/{AddressInput-CMB-aSpl.js → AddressInput-BPU-AgUH.js} +2 -2
- package/lib/esm/{AddressInput-CMB-aSpl.js.map → AddressInput-BPU-AgUH.js.map} +1 -1
- package/lib/esm/AddressInput.js +3 -3
- package/lib/esm/{ClearableTag-BJIB27YM.js → ClearableTag-B75LS4vK.js} +2 -2
- package/lib/esm/{ClearableTag-BJIB27YM.js.map → ClearableTag-B75LS4vK.js.map} +1 -1
- package/lib/esm/ClearableTag.js +2 -2
- package/lib/esm/{ColorDotDropdown-B_OuF8Hq.js → ColorDotDropdown-BeOc8NvF.js} +2 -2
- package/lib/esm/ColorDotDropdown-BeOc8NvF.js.map +1 -0
- package/lib/esm/ColorDotDropdown.js +8 -8
- package/lib/esm/{ColorPicker-2vZVVqj1.js → ColorPicker-GpiQKQBz.js} +2 -2
- package/lib/esm/ColorPicker-GpiQKQBz.js.map +1 -0
- package/lib/esm/ColorPicker.js +2 -2
- package/lib/esm/{ColorPickerInput-E6c59vTb.js → ColorPickerInput-UTUr_6J-.js} +2 -2
- package/lib/esm/{ColorPickerInput-E6c59vTb.js.map → ColorPickerInput-UTUr_6J-.js.map} +1 -1
- package/lib/esm/ColorPickerInput.js +2 -2
- package/lib/esm/{ConfigurableInput-Bs3GjtQt.js → ConfigurableInput-CDiobLxl.js} +2 -2
- package/lib/esm/ConfigurableInput-CDiobLxl.js.map +1 -0
- package/lib/esm/ConfigurableInput.js +3 -3
- package/lib/esm/{CountryDropdown-DAFJO1pQ.js → CountryDropdown-DIgXi9aq.js} +2 -2
- package/lib/esm/{CountryDropdown-DAFJO1pQ.js.map → CountryDropdown-DIgXi9aq.js.map} +1 -1
- package/lib/esm/CountryDropdown.js +8 -8
- package/lib/esm/{CountyDropdown-SEts7B0p.js → CountyDropdown-DS3voXCP.js} +2 -2
- package/lib/esm/CountyDropdown-DS3voXCP.js.map +1 -0
- package/lib/esm/CountyDropdown.js +8 -8
- package/lib/esm/{CreditCardInput-DpuPJonz.js → CreditCardInput-CghnwKIk.js} +2 -2
- package/lib/esm/CreditCardInput-CghnwKIk.js.map +1 -0
- package/lib/esm/CreditCardInput.js +2 -2
- package/lib/esm/{CurrencyInput-DNA2SGSw.js → CurrencyInput-g7xr2KNu.js} +2 -2
- package/lib/esm/CurrencyInput-g7xr2KNu.js.map +1 -0
- package/lib/esm/CurrencyInput.js +2 -2
- package/lib/esm/DatePicker.js +5 -5
- package/lib/esm/{DescriptiveDropdownInput-CBRq50wI.js → DescriptiveDropdownInput-yeeDsjp2.js} +2 -2
- package/lib/esm/{DescriptiveDropdownInput-CBRq50wI.js.map → DescriptiveDropdownInput-yeeDsjp2.js.map} +1 -1
- package/lib/esm/DescriptiveDropdownInput.js +5 -5
- package/lib/esm/DialogHandler.js +6 -6
- package/lib/esm/{Drawer-tKGvNQHb.js → Drawer-B8Q-IadJ.js} +3 -3
- package/lib/esm/{Drawer-tKGvNQHb.js.map → Drawer-B8Q-IadJ.js.map} +1 -1
- package/lib/esm/Drawer.js +4 -4
- package/lib/esm/{DropdownInput-DSda6bKL.js → DropdownInput-D24oxl-L.js} +3 -3
- package/lib/esm/DropdownInput-D24oxl-L.js.map +1 -0
- package/lib/esm/DropdownInput.js +7 -7
- package/lib/esm/{EmailInput-BLkBCctF.js → EmailInput-D3Afiw2u.js} +2 -2
- package/lib/esm/EmailInput-D3Afiw2u.js.map +1 -0
- package/lib/esm/EmailInput.js +2 -2
- package/lib/esm/{FiltersBar-CCOUkfpA.js → FiltersBar-DiF5ZpHq.js} +3 -3
- package/lib/esm/FiltersBar-DiF5ZpHq.js.map +1 -0
- package/lib/esm/FiltersBar.js +5 -5
- package/lib/esm/Form.js +25 -25
- package/lib/esm/{FormikContainer-DYqfZHS2.js → FormikContainer-BjsSb293.js} +19 -19
- package/lib/esm/{FormikContainer-DYqfZHS2.js.map → FormikContainer-BjsSb293.js.map} +1 -1
- package/lib/esm/{IconSwitcher-CuP_MoLJ.js → IconSwitcher-mVxz0mRd.js} +4 -4
- package/lib/esm/{IconSwitcher-CuP_MoLJ.js.map → IconSwitcher-mVxz0mRd.js.map} +1 -1
- package/lib/esm/IconSwitcher.js +6 -6
- package/lib/esm/{IconTile-DHjx6lHa.js → IconTile-CLuncuXQ.js} +2 -2
- package/lib/esm/IconTile-CLuncuXQ.js.map +1 -0
- package/lib/esm/IconTile.js +3 -3
- package/lib/esm/{ImagePicker-C6pPUj_K.js → ImagePicker-0qNeB1j3.js} +3 -3
- package/lib/esm/{ImagePicker-C6pPUj_K.js.map → ImagePicker-0qNeB1j3.js.map} +1 -1
- package/lib/esm/ImagePicker.js +6 -6
- package/lib/esm/InlineColorPickerInput.js +2 -2
- package/lib/esm/{InlineDatePicker-DsfFp3j8.js → InlineDatePicker-XiMGS9jI.js} +705 -143
- package/lib/{cjs/InlineDatePicker-4u82zKn2.js.map → esm/InlineDatePicker-XiMGS9jI.js.map} +1 -1
- package/lib/esm/InlineDatePicker.js +5 -5
- package/lib/esm/{InlineDescriptiveDropdown-CKa_mFLO.js → InlineDescriptiveDropdown-C7rsk6By.js} +3 -3
- package/lib/esm/{InlineDescriptiveDropdown-CKa_mFLO.js.map → InlineDescriptiveDropdown-C7rsk6By.js.map} +1 -1
- package/lib/esm/InlineDescriptiveDropdown.js +5 -5
- package/lib/esm/{InlineDropdown-D7g8tYjS.js → InlineDropdown-BWR3Gk3p.js} +4 -4
- package/lib/esm/InlineDropdown-BWR3Gk3p.js.map +1 -0
- package/lib/esm/InlineDropdown.js +6 -6
- package/lib/esm/InlineInputButton.js +3 -3
- package/lib/esm/InlinePasswordInput.js +2 -2
- package/lib/esm/{Input-MOGe-w-5.js → Input-B8MC70c7.js} +2 -2
- package/lib/esm/Input-B8MC70c7.js.map +1 -0
- package/lib/esm/InputButton.js +3 -3
- package/lib/esm/{LogoSidebar-D6blyPPy.js → LogoSidebar-CVQVe2zk.js} +2 -2
- package/lib/esm/LogoSidebar-CVQVe2zk.js.map +1 -0
- package/lib/esm/LogoSidebar.js +2 -2
- package/lib/esm/{MultiSelect-DjXCIElV.js → MultiSelect-DU7lLJbS.js} +3 -3
- package/lib/esm/MultiSelect-DU7lLJbS.js.map +1 -0
- package/lib/esm/MultiSelect.js +7 -7
- package/lib/esm/PasswordInput.js +2 -2
- package/lib/esm/{PhoneInput-DIqPauaT.js → PhoneInput-0geNzv1r.js} +2 -2
- package/lib/esm/PhoneInput-0geNzv1r.js.map +1 -0
- package/lib/esm/PhoneInput.js +2 -2
- package/lib/esm/{SearchMenu-CoKcmZ9S.js → SearchMenu-ZabWbEp-.js} +3 -3
- package/lib/esm/{SearchMenu-CoKcmZ9S.js.map → SearchMenu-ZabWbEp-.js.map} +1 -1
- package/lib/esm/SearchMenu.js +4 -4
- package/lib/esm/{SelectSearch-C_XJAa95.js → SelectSearch-Bj4E8W2Z.js} +3 -3
- package/lib/esm/{SelectSearch-C_XJAa95.js.map → SelectSearch-Bj4E8W2Z.js.map} +1 -1
- package/lib/esm/SelectSearch.js +6 -6
- package/lib/esm/{SnackContainer-Cm_pBeQM.js → SnackContainer-fFyf0QWo.js} +3 -3
- package/lib/esm/{SnackContainer-Cm_pBeQM.js.map → SnackContainer-fFyf0QWo.js.map} +1 -1
- package/lib/esm/SsnInput.js +1 -1
- package/lib/esm/{StateDropdown-l2hXRaEj.js → StateDropdown-C4MrSD0F.js} +2 -2
- package/lib/esm/StateDropdown-C4MrSD0F.js.map +1 -0
- package/lib/esm/StateDropdown.js +8 -8
- package/lib/esm/{StatusDropdown-G88DmPLw.js → StatusDropdown-CX8toPyk.js} +3 -3
- package/lib/esm/StatusDropdown-CX8toPyk.js.map +1 -0
- package/lib/esm/StatusDropdown.js +9 -9
- package/lib/esm/Table.js +12 -12
- package/lib/esm/{TableFiltersPanel-BFOdyGAf.js → TableFiltersPanel-CZxgZYbK.js} +2 -2
- package/lib/esm/TableFiltersPanel-CZxgZYbK.js.map +1 -0
- package/lib/esm/TableFiltersPanel.js +5 -5
- package/lib/esm/{TextLink-fh9xydpq.js → TextLink-C8F1k_X3.js} +2 -2
- package/lib/esm/{TextLink-fh9xydpq.js.map → TextLink-C8F1k_X3.js.map} +1 -1
- package/lib/esm/TextLink.js +3 -3
- package/lib/esm/Textarea.js +1 -1
- package/lib/esm/ThemeProvider.js +6 -6
- package/lib/esm/{Toast-CJ97adrB.js → Toast-CSu9ByR8.js} +6 -6
- package/lib/esm/{Toast-CJ97adrB.js.map → Toast-CSu9ByR8.js.map} +1 -1
- package/lib/esm/{ToggleGroup-BSVBOp66.js → ToggleGroup-Bbo9mT9m.js} +2 -2
- package/lib/esm/ToggleGroup-Bbo9mT9m.js.map +1 -0
- package/lib/esm/ToggleGroup.js +4 -4
- package/lib/esm/{ToggleItem-SbiGeEX-.js → ToggleItem-fnjRXOJM.js} +2 -2
- package/lib/esm/ToggleItem-fnjRXOJM.js.map +1 -0
- package/lib/esm/ToggleItem.js +3 -3
- package/lib/esm/Truncate.js +2 -2
- package/lib/esm/{TruncatePicker-DJLf2gHf.js → TruncatePicker-DQ324crv.js} +2 -2
- package/lib/esm/{TruncatePicker-DJLf2gHf.js.map → TruncatePicker-DQ324crv.js.map} +1 -1
- package/lib/esm/{Typography-DeKIi_CD.js → Typography-S6KywMR5.js} +2 -2
- package/lib/esm/Typography-S6KywMR5.js.map +1 -0
- package/lib/esm/Typography.js +3 -3
- package/lib/esm/{UploadDropzone-CWUGFy2q.js → UploadDropzone-B1MB6e30.js} +5 -5
- package/lib/esm/{UploadDropzone-CWUGFy2q.js.map → UploadDropzone-B1MB6e30.js.map} +1 -1
- package/lib/esm/UploadDropzone.js +5 -5
- package/lib/esm/UserCard.js +3 -3
- package/lib/esm/UserCardModal.js +3 -3
- package/lib/esm/{UserInformationCard-DJgjYUaI.js → UserInformationCard-BG3IMWkV.js} +4 -4
- package/lib/esm/{UserInformationCard-DJgjYUaI.js.map → UserInformationCard-BG3IMWkV.js.map} +1 -1
- package/lib/esm/UserInformationCard.js +4 -4
- package/lib/esm/ZipCodeInput.js +1 -1
- package/lib/esm/altPostalCodeNames.js +8 -8
- package/lib/esm/altRegionNames.js +8 -8
- package/lib/esm/countryList.js +8 -8
- package/lib/esm/countryLookup.js +8 -8
- package/lib/esm/index.js +46 -46
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/{useMeasure-NeXhBxO-.js → useMeasure-D89v6c_A.js} +5 -5
- package/lib/esm/{useMeasure-NeXhBxO-.js.map → useMeasure-D89v6c_A.js.map} +1 -1
- package/lib/esm/{useMeasureWatchResize-DvGmNtKg.js → useMeasureWatchResize-B9b4IJ01.js} +6 -6
- package/lib/esm/useMeasureWatchResize-B9b4IJ01.js.map +1 -0
- package/package.json +2 -2
- package/lib/esm/AddMenu-UH1K7oqD.js.map +0 -1
- package/lib/esm/ColorDotDropdown-B_OuF8Hq.js.map +0 -1
- package/lib/esm/ColorPicker-2vZVVqj1.js.map +0 -1
- package/lib/esm/ConfigurableInput-Bs3GjtQt.js.map +0 -1
- package/lib/esm/CountyDropdown-SEts7B0p.js.map +0 -1
- package/lib/esm/CreditCardInput-DpuPJonz.js.map +0 -1
- package/lib/esm/CurrencyInput-DNA2SGSw.js.map +0 -1
- package/lib/esm/DropdownInput-DSda6bKL.js.map +0 -1
- package/lib/esm/EmailInput-BLkBCctF.js.map +0 -1
- package/lib/esm/FiltersBar-CCOUkfpA.js.map +0 -1
- package/lib/esm/IconTile-DHjx6lHa.js.map +0 -1
- package/lib/esm/InlineDatePicker-DsfFp3j8.js.map +0 -1
- package/lib/esm/InlineDropdown-D7g8tYjS.js.map +0 -1
- package/lib/esm/Input-MOGe-w-5.js.map +0 -1
- package/lib/esm/LogoSidebar-D6blyPPy.js.map +0 -1
- package/lib/esm/MultiSelect-DjXCIElV.js.map +0 -1
- package/lib/esm/PhoneInput-DIqPauaT.js.map +0 -1
- package/lib/esm/StateDropdown-l2hXRaEj.js.map +0 -1
- package/lib/esm/StatusDropdown-G88DmPLw.js.map +0 -1
- package/lib/esm/TableFiltersPanel-BFOdyGAf.js.map +0 -1
- package/lib/esm/ToggleGroup-BSVBOp66.js.map +0 -1
- package/lib/esm/ToggleItem-SbiGeEX-.js.map +0 -1
- package/lib/esm/Typography-DeKIi_CD.js.map +0 -1
- package/lib/esm/useMeasureWatchResize-DvGmNtKg.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { b as __makeTemplateObject, f as __rest, _ as __assign } from './_tslib-
|
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import React__default, { useLayoutEffect, cloneElement, createRef, Component, useRef,
|
|
5
|
+
import React__default, { useLayoutEffect, cloneElement, createRef, Component, useRef, useEffect, useCallback, createElement, useState, forwardRef } from 'react';
|
|
6
6
|
import * as ReactDOM from 'react-dom';
|
|
7
7
|
import ReactDOM__default from 'react-dom';
|
|
8
8
|
import { colors } from './colors.js';
|
|
@@ -16,10 +16,10 @@ import { C as ClickOutHandler } from './ClickOutHandler-CcKVoXIs.js';
|
|
|
16
16
|
import { I as IconButton } from './IconButton-Dl665Zh7.js';
|
|
17
17
|
import { CaretLeft } from './CaretLeft.js';
|
|
18
18
|
import { CaretRight } from './CaretRight.js';
|
|
19
|
-
import { S as SearchMenu } from './SearchMenu-
|
|
19
|
+
import { S as SearchMenu } from './SearchMenu-ZabWbEp-.js';
|
|
20
20
|
import { S as SlideIn } from './SlideIn-BX00RoGX.js';
|
|
21
21
|
import { D as DropdownButton } from './DropdownButton-dZOEHTtk.js';
|
|
22
|
-
import { u as useMeasure } from './useMeasure-
|
|
22
|
+
import { u as useMeasure } from './useMeasure-D89v6c_A.js';
|
|
23
23
|
import { focusAfter } from './focusAfter.js';
|
|
24
24
|
|
|
25
25
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
@@ -9672,7 +9672,7 @@ function useFloating(options) {
|
|
|
9672
9672
|
}
|
|
9673
9673
|
|
|
9674
9674
|
/*!
|
|
9675
|
-
react-datepicker
|
|
9675
|
+
react-datepicker v9.1.0
|
|
9676
9676
|
https://github.com/Hacker0x01/react-datepicker
|
|
9677
9677
|
Released under the MIT License.
|
|
9678
9678
|
*/
|
|
@@ -9736,17 +9736,19 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
9736
9736
|
};
|
|
9737
9737
|
|
|
9738
9738
|
var CalendarContainer = function (_a) {
|
|
9739
|
-
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;
|
|
9739
|
+
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;
|
|
9740
9740
|
var ariaLabel = showTimeSelectOnly
|
|
9741
9741
|
? "Choose Time"
|
|
9742
9742
|
: "Choose Date".concat(showTime ? " and Time" : "");
|
|
9743
|
-
return (React__default.createElement("div", { className: className, role: "dialog", "aria-
|
|
9743
|
+
return (React__default.createElement("div", { className: className, "aria-label": ariaLabel, role: inline ? undefined : "dialog", "aria-modal": inline ? undefined : "true", translate: "no" }, children));
|
|
9744
9744
|
};
|
|
9745
9745
|
|
|
9746
9746
|
var useDetectClickOutside = function (onClickOutside, ignoreClass) {
|
|
9747
9747
|
var ref = useRef(null);
|
|
9748
9748
|
var onClickOutsideRef = useRef(onClickOutside);
|
|
9749
|
-
|
|
9749
|
+
useEffect(function () {
|
|
9750
|
+
onClickOutsideRef.current = onClickOutside;
|
|
9751
|
+
}, [onClickOutside]);
|
|
9750
9752
|
var handleClickOutside = useCallback(function (event) {
|
|
9751
9753
|
var _a;
|
|
9752
9754
|
var target = (event.composed &&
|
|
@@ -9782,6 +9784,77 @@ var ClickOutsideWrapper = function (_a) {
|
|
|
9782
9784
|
} }, children));
|
|
9783
9785
|
};
|
|
9784
9786
|
|
|
9787
|
+
// Cache for the date-fns-tz module
|
|
9788
|
+
var dateFnsTz = null;
|
|
9789
|
+
var dateFnsTzLoadAttempted = false;
|
|
9790
|
+
/**
|
|
9791
|
+
* Attempts to load date-fns-tz module.
|
|
9792
|
+
* Returns null if the module is not installed.
|
|
9793
|
+
*/
|
|
9794
|
+
function getDateFnsTz() {
|
|
9795
|
+
if (dateFnsTzLoadAttempted) {
|
|
9796
|
+
return dateFnsTz;
|
|
9797
|
+
}
|
|
9798
|
+
dateFnsTzLoadAttempted = true;
|
|
9799
|
+
try {
|
|
9800
|
+
// Dynamic require for date-fns-tz
|
|
9801
|
+
// Use a variable to prevent webpack from statically analyzing the require
|
|
9802
|
+
// and showing warnings when the optional dependency is not installed
|
|
9803
|
+
// See: https://github.com/Hacker0x01/react-datepicker/issues/6154
|
|
9804
|
+
var dateFnsTzModuleName = "date-fns-tz";
|
|
9805
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
9806
|
+
dateFnsTz = require(dateFnsTzModuleName);
|
|
9807
|
+
}
|
|
9808
|
+
catch (_a) {
|
|
9809
|
+
/* istanbul ignore next - only executes when date-fns-tz is not installed */
|
|
9810
|
+
dateFnsTz = null;
|
|
9811
|
+
}
|
|
9812
|
+
return dateFnsTz;
|
|
9813
|
+
}
|
|
9814
|
+
/**
|
|
9815
|
+
* Converts a date to the specified timezone.
|
|
9816
|
+
* If no timezone is specified or date-fns-tz is not installed, returns the original date.
|
|
9817
|
+
*
|
|
9818
|
+
* @param date - The date to convert
|
|
9819
|
+
* @param timeZone - The IANA timezone identifier (e.g., "America/New_York", "UTC")
|
|
9820
|
+
* @returns The date in the specified timezone
|
|
9821
|
+
*/
|
|
9822
|
+
function toZonedTime(date, timeZone) {
|
|
9823
|
+
if (!timeZone) {
|
|
9824
|
+
return date;
|
|
9825
|
+
}
|
|
9826
|
+
var tz = getDateFnsTz();
|
|
9827
|
+
if (!tz) {
|
|
9828
|
+
if (process.env.NODE_ENV !== "production") {
|
|
9829
|
+
console.warn('react-datepicker: timeZone prop requires "date-fns-tz" package. ' +
|
|
9830
|
+
"Please install it: npm install date-fns-tz");
|
|
9831
|
+
}
|
|
9832
|
+
return date;
|
|
9833
|
+
}
|
|
9834
|
+
return tz.toZonedTime(date, timeZone);
|
|
9835
|
+
}
|
|
9836
|
+
/**
|
|
9837
|
+
* Converts a date from the specified timezone to UTC.
|
|
9838
|
+
* If no timezone is specified or date-fns-tz is not installed, returns the original date.
|
|
9839
|
+
*
|
|
9840
|
+
* @param date - The date in the specified timezone
|
|
9841
|
+
* @param timeZone - The IANA timezone identifier (e.g., "America/New_York", "UTC")
|
|
9842
|
+
* @returns The date in UTC
|
|
9843
|
+
*/
|
|
9844
|
+
function fromZonedTime(date, timeZone) {
|
|
9845
|
+
if (!timeZone) {
|
|
9846
|
+
return date;
|
|
9847
|
+
}
|
|
9848
|
+
var tz = getDateFnsTz();
|
|
9849
|
+
if (!tz) {
|
|
9850
|
+
if (process.env.NODE_ENV !== "production") {
|
|
9851
|
+
console.warn('react-datepicker: timeZone prop requires "date-fns-tz" package. ' +
|
|
9852
|
+
"Please install it: npm install date-fns-tz");
|
|
9853
|
+
}
|
|
9854
|
+
return date;
|
|
9855
|
+
}
|
|
9856
|
+
return tz.fromZonedTime(date, timeZone);
|
|
9857
|
+
}
|
|
9785
9858
|
var KeyType;
|
|
9786
9859
|
(function (KeyType) {
|
|
9787
9860
|
KeyType["ArrowUp"] = "ArrowUp";
|
|
@@ -9838,20 +9911,72 @@ function parseDate(value, dateFormat, locale, strictParsing, refDate) {
|
|
|
9838
9911
|
return parsedDate;
|
|
9839
9912
|
}
|
|
9840
9913
|
}
|
|
9914
|
+
// When strictParsing is false, try native Date parsing as a fallback
|
|
9915
|
+
// This allows flexible input formats like "12/05/2025" or "2025-12-16"
|
|
9916
|
+
// even when the dateFormat prop specifies a different format.
|
|
9917
|
+
// Only attempt this for inputs that look like complete dates (minimum
|
|
9918
|
+
// length of 8 characters, e.g., "1/1/2000") to avoid parsing partial
|
|
9919
|
+
// inputs like "03/" or "2000" which should be handled by parseDateForNavigation.
|
|
9920
|
+
if (!strictParsing && value && value.length >= 8) {
|
|
9921
|
+
var nativeDate = new Date(value);
|
|
9922
|
+
if (isValid$1(nativeDate)) {
|
|
9923
|
+
return nativeDate;
|
|
9924
|
+
}
|
|
9925
|
+
}
|
|
9841
9926
|
return null;
|
|
9842
9927
|
}
|
|
9843
9928
|
/**
|
|
9844
|
-
*
|
|
9929
|
+
* Parses a partial date string for calendar navigation purposes.
|
|
9930
|
+
* Unlike parseDate, this function attempts to extract whatever date
|
|
9931
|
+
* information is available (year, month) from a partial input,
|
|
9932
|
+
* returning a date suitable for navigating the calendar view.
|
|
9933
|
+
*
|
|
9934
|
+
* @param value - The date string to parse.
|
|
9935
|
+
* @param refDate - The reference date to use for missing components.
|
|
9936
|
+
* @returns - A date for navigation or null if no date info could be extracted.
|
|
9937
|
+
*/
|
|
9938
|
+
function parseDateForNavigation(value, refDate) {
|
|
9939
|
+
if (refDate === void 0) { refDate = newDate(); }
|
|
9940
|
+
if (!value)
|
|
9941
|
+
return null;
|
|
9942
|
+
// Try to extract a 4-digit year from the input
|
|
9943
|
+
var yearMatch = value.match(/\b(1\d{3}|2\d{3})\b/);
|
|
9944
|
+
if (!yearMatch || !yearMatch[1])
|
|
9945
|
+
return null;
|
|
9946
|
+
var year = parseInt(yearMatch[1], 10);
|
|
9947
|
+
// Try to extract a month (1-12) from the input
|
|
9948
|
+
// Look for patterns like "03/", "/03", "03-", "-03" or standalone "03" at start
|
|
9949
|
+
var monthMatch = value.match(/(?:^|[/\-\s])?(0?[1-9]|1[0-2])(?:[/\-\s]|$)/);
|
|
9950
|
+
var month = monthMatch && monthMatch[1]
|
|
9951
|
+
? parseInt(monthMatch[1], 10) - 1
|
|
9952
|
+
: refDate.getMonth();
|
|
9953
|
+
// Return a date with the extracted year and month, using day 1
|
|
9954
|
+
return new Date(year, month, 1);
|
|
9955
|
+
}
|
|
9956
|
+
/**
|
|
9957
|
+
* Checks if a given date is a valid Date object.
|
|
9845
9958
|
* @param date - The date to be checked.
|
|
9846
|
-
* @
|
|
9847
|
-
|
|
9959
|
+
* @returns A boolean value indicating whether the date is valid.
|
|
9960
|
+
*/
|
|
9961
|
+
function isValid(date) {
|
|
9962
|
+
return isValid$1(date);
|
|
9963
|
+
}
|
|
9964
|
+
/**
|
|
9965
|
+
* Safely returns a valid Date or null.
|
|
9966
|
+
* This handles cases where a value might be passed as a string or other
|
|
9967
|
+
* invalid type at runtime, even though TypeScript expects a Date.
|
|
9968
|
+
* @param date - The value to check (typed as Date but could be anything at runtime)
|
|
9969
|
+
* @returns The date if it's a valid Date object, otherwise null
|
|
9848
9970
|
*/
|
|
9849
|
-
function
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9971
|
+
function safeToDate(date) {
|
|
9972
|
+
if (date == null) {
|
|
9973
|
+
return null;
|
|
9974
|
+
}
|
|
9975
|
+
// Check if it's actually a Date object AND is valid
|
|
9976
|
+
if (isDate(date) && isValid$1(date)) {
|
|
9977
|
+
return date;
|
|
9978
|
+
}
|
|
9979
|
+
return null;
|
|
9855
9980
|
}
|
|
9856
9981
|
// ** Date Formatting **
|
|
9857
9982
|
/**
|
|
@@ -10452,6 +10577,7 @@ function isTimeInDisabledRange(time, _a) {
|
|
|
10452
10577
|
valid = !isWithinInterval(baseTime, { start: min, end: max });
|
|
10453
10578
|
}
|
|
10454
10579
|
catch (err) {
|
|
10580
|
+
/* istanbul ignore next - date-fns historically threw on invalid intervals */
|
|
10455
10581
|
valid = false;
|
|
10456
10582
|
}
|
|
10457
10583
|
return valid;
|
|
@@ -11027,6 +11153,10 @@ var Day = /** @class */ (function (_super) {
|
|
|
11027
11153
|
var _a;
|
|
11028
11154
|
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;
|
|
11029
11155
|
var selectingDate = (_a = _this.props.selectingDate) !== null && _a !== void 0 ? _a : _this.props.preSelection;
|
|
11156
|
+
// Don't highlight days outside the current month
|
|
11157
|
+
if (_this.isAfterMonth() || _this.isBeforeMonth()) {
|
|
11158
|
+
return false;
|
|
11159
|
+
}
|
|
11030
11160
|
if (!(selectsStart || selectsEnd || selectsRange) ||
|
|
11031
11161
|
!selectingDate ||
|
|
11032
11162
|
(!selectsDisabledDaysInRange && _this.isDisabled())) {
|
|
@@ -11755,7 +11885,12 @@ var Month$1 = /** @class */ (function (_super) {
|
|
|
11755
11885
|
});
|
|
11756
11886
|
};
|
|
11757
11887
|
_this.isSelectedQuarter = function (day, q, selected) {
|
|
11758
|
-
return getQuarter(
|
|
11888
|
+
return getQuarter(selected) === q && getYear(day) === getYear(selected);
|
|
11889
|
+
};
|
|
11890
|
+
_this.isSelectQuarterInList = function (day, q, selectedDates) {
|
|
11891
|
+
return selectedDates.some(function (selectedDate) {
|
|
11892
|
+
return _this.isSelectedQuarter(day, q, selectedDate);
|
|
11893
|
+
});
|
|
11759
11894
|
};
|
|
11760
11895
|
_this.isMonthSelected = function () {
|
|
11761
11896
|
var _a = _this.props, day = _a.day, selected = _a.selected, selectedDates = _a.selectedDates, selectsMultiple = _a.selectsMultiple;
|
|
@@ -11767,7 +11902,21 @@ var Month$1 = /** @class */ (function (_super) {
|
|
|
11767
11902
|
}
|
|
11768
11903
|
return !!selected && _this.isSelectedMonth(day, monthIdx, selected);
|
|
11769
11904
|
};
|
|
11905
|
+
_this.isQuarterSelected = function () {
|
|
11906
|
+
var _a = _this.props, day = _a.day, selected = _a.selected, selectedDates = _a.selectedDates, selectsMultiple = _a.selectsMultiple;
|
|
11907
|
+
var quarterIdx = getQuarter(day);
|
|
11908
|
+
if (selectsMultiple) {
|
|
11909
|
+
return selectedDates === null || selectedDates === void 0 ? void 0 : selectedDates.some(function (selectedDate) {
|
|
11910
|
+
return _this.isSelectedQuarter(day, quarterIdx, selectedDate);
|
|
11911
|
+
});
|
|
11912
|
+
}
|
|
11913
|
+
return !!selected && _this.isSelectedQuarter(day, quarterIdx, selected);
|
|
11914
|
+
};
|
|
11770
11915
|
_this.renderWeeks = function () {
|
|
11916
|
+
// Return empty array if day is invalid
|
|
11917
|
+
if (!isValid(_this.props.day)) {
|
|
11918
|
+
return [];
|
|
11919
|
+
}
|
|
11771
11920
|
var weeks = [];
|
|
11772
11921
|
var isFixedHeight = _this.props.fixedHeight;
|
|
11773
11922
|
var i = 0;
|
|
@@ -12064,7 +12213,7 @@ var Month$1 = /** @class */ (function (_super) {
|
|
|
12064
12213
|
return "".concat(prefix, " ").concat(formatDate(labelDate, "MMMM yyyy", locale));
|
|
12065
12214
|
};
|
|
12066
12215
|
_this.getQuarterClassNames = function (q) {
|
|
12067
|
-
var _a = _this.props, day = _a.day, startDate = _a.startDate, endDate = _a.endDate,
|
|
12216
|
+
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;
|
|
12068
12217
|
var isDisabled = (minDate ||
|
|
12069
12218
|
maxDate ||
|
|
12070
12219
|
excludeDates ||
|
|
@@ -12072,14 +12221,16 @@ var Month$1 = /** @class */ (function (_super) {
|
|
|
12072
12221
|
filterDate ||
|
|
12073
12222
|
disabled) &&
|
|
12074
12223
|
isQuarterDisabled(setQuarter(day, q), _this.props);
|
|
12224
|
+
var selection = _this.getSelection();
|
|
12075
12225
|
return clsx("react-datepicker__quarter-text", "react-datepicker__quarter-".concat(q), {
|
|
12076
12226
|
"react-datepicker__quarter-text--disabled": isDisabled,
|
|
12077
|
-
"react-datepicker__quarter-text--selected":
|
|
12078
|
-
? _this.
|
|
12227
|
+
"react-datepicker__quarter-text--selected": selection
|
|
12228
|
+
? _this.isSelectQuarterInList(day, q, selection)
|
|
12079
12229
|
: undefined,
|
|
12080
12230
|
"react-datepicker__quarter-text--keyboard-selected": !disabledKeyboardNavigation &&
|
|
12081
12231
|
preSelection &&
|
|
12082
12232
|
_this.isSelectedQuarter(day, q, preSelection) &&
|
|
12233
|
+
!_this.isQuarterSelected() &&
|
|
12083
12234
|
!isDisabled,
|
|
12084
12235
|
"react-datepicker__quarter-text--in-selecting-range": _this.isInSelectingRangeQuarter(q),
|
|
12085
12236
|
"react-datepicker__quarter-text--in-range": startDate && endDate
|
|
@@ -12159,14 +12310,20 @@ var Month$1 = /** @class */ (function (_super) {
|
|
|
12159
12310
|
var formattedAriaLabelPrefix = ariaLabelPrefix
|
|
12160
12311
|
? ariaLabelPrefix.trim() + " "
|
|
12161
12312
|
: "";
|
|
12313
|
+
// Format aria-label, return empty string if date is invalid
|
|
12314
|
+
var formattedAriaLabel = isValid(day)
|
|
12315
|
+
? "".concat(formattedAriaLabelPrefix).concat(formatDate(day, "MMMM, yyyy", this.props.locale))
|
|
12316
|
+
: "";
|
|
12162
12317
|
var shouldUseListboxRole = showMonthYearPicker || showQuarterYearPicker;
|
|
12163
12318
|
if (shouldUseListboxRole) {
|
|
12164
|
-
return (React__default.createElement("div", { className: this.getClassNames(), onMouseLeave: !this.props.usePointerEvent ? this.handleMouseLeave : undefined, onPointerLeave: this.props.usePointerEvent ? this.handleMouseLeave : undefined, "aria-label":
|
|
12319
|
+
return (React__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()));
|
|
12165
12320
|
}
|
|
12166
12321
|
// For regular calendar view, use table structure
|
|
12167
12322
|
return (React__default.createElement("div", { role: "table" },
|
|
12168
12323
|
this.props.dayNamesHeader && (React__default.createElement("div", { role: "rowgroup" }, this.props.dayNamesHeader)),
|
|
12169
|
-
|
|
12324
|
+
this.props.monthHeader && (React__default.createElement("div", { role: "rowgroup" }, this.props.monthHeader)),
|
|
12325
|
+
React__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()),
|
|
12326
|
+
this.props.monthFooter && (React__default.createElement("div", { role: "rowgroup" }, this.props.monthFooter))));
|
|
12170
12327
|
};
|
|
12171
12328
|
return Month;
|
|
12172
12329
|
}(Component));
|
|
@@ -12277,10 +12434,15 @@ var MonthDropdown = /** @class */ (function (_super) {
|
|
|
12277
12434
|
return MonthDropdown;
|
|
12278
12435
|
}(Component));
|
|
12279
12436
|
|
|
12280
|
-
|
|
12437
|
+
// Default range: 5 years before and after current date
|
|
12438
|
+
var DEFAULT_YEAR_RANGE$1 = 5;
|
|
12439
|
+
function generateMonthYears(minDate, maxDate, currentDate) {
|
|
12281
12440
|
var list = [];
|
|
12282
|
-
|
|
12283
|
-
var
|
|
12441
|
+
// Use defaults if minDate/maxDate not provided
|
|
12442
|
+
var effectiveMinDate = minDate !== null && minDate !== void 0 ? minDate : subYears(currentDate, DEFAULT_YEAR_RANGE$1);
|
|
12443
|
+
var effectiveMaxDate = maxDate !== null && maxDate !== void 0 ? maxDate : addYears(currentDate, DEFAULT_YEAR_RANGE$1);
|
|
12444
|
+
var currDate = getStartOfMonth(effectiveMinDate);
|
|
12445
|
+
var lastDate = getStartOfMonth(effectiveMaxDate);
|
|
12284
12446
|
while (!isAfter(currDate, lastDate)) {
|
|
12285
12447
|
list.push(newDate(currDate));
|
|
12286
12448
|
currDate = addMonths(currDate, 1);
|
|
@@ -12308,7 +12470,7 @@ var MonthYearDropdownOptions = /** @class */ (function (_super) {
|
|
|
12308
12470
|
_this.props.onCancel();
|
|
12309
12471
|
};
|
|
12310
12472
|
_this.state = {
|
|
12311
|
-
monthYearsList: generateMonthYears(_this.props.minDate, _this.props.maxDate),
|
|
12473
|
+
monthYearsList: generateMonthYears(_this.props.minDate, _this.props.maxDate, _this.props.date),
|
|
12312
12474
|
};
|
|
12313
12475
|
return _this;
|
|
12314
12476
|
}
|
|
@@ -12322,6 +12484,8 @@ var MonthYearDropdownOptions = /** @class */ (function (_super) {
|
|
|
12322
12484
|
return MonthYearDropdownOptions;
|
|
12323
12485
|
}(Component));
|
|
12324
12486
|
|
|
12487
|
+
// Default range: 5 years before and after current date
|
|
12488
|
+
var DEFAULT_YEAR_RANGE = 5;
|
|
12325
12489
|
var MonthYearDropdown = /** @class */ (function (_super) {
|
|
12326
12490
|
__extends(MonthYearDropdown, _super);
|
|
12327
12491
|
function MonthYearDropdown() {
|
|
@@ -12330,8 +12494,12 @@ var MonthYearDropdown = /** @class */ (function (_super) {
|
|
|
12330
12494
|
dropdownVisible: false,
|
|
12331
12495
|
};
|
|
12332
12496
|
_this.renderSelectOptions = function () {
|
|
12333
|
-
var
|
|
12334
|
-
|
|
12497
|
+
var _a, _b;
|
|
12498
|
+
// Use defaults if minDate/maxDate not provided
|
|
12499
|
+
var minDate = (_a = _this.props.minDate) !== null && _a !== void 0 ? _a : subYears(_this.props.date, DEFAULT_YEAR_RANGE);
|
|
12500
|
+
var maxDate = (_b = _this.props.maxDate) !== null && _b !== void 0 ? _b : addYears(_this.props.date, DEFAULT_YEAR_RANGE);
|
|
12501
|
+
var currDate = getStartOfMonth(minDate);
|
|
12502
|
+
var lastDate = getStartOfMonth(maxDate);
|
|
12335
12503
|
var options = [];
|
|
12336
12504
|
while (!isAfter(currDate, lastDate)) {
|
|
12337
12505
|
var timePoint = getTime(currDate);
|
|
@@ -12423,7 +12591,8 @@ var Time = /** @class */ (function (_super) {
|
|
|
12423
12591
|
(_b = (_a = _this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, time);
|
|
12424
12592
|
};
|
|
12425
12593
|
_this.isSelectedTime = function (time) {
|
|
12426
|
-
|
|
12594
|
+
var selected = safeToDate(_this.props.selected);
|
|
12595
|
+
return selected && isSameMinute(selected, time);
|
|
12427
12596
|
};
|
|
12428
12597
|
_this.isDisabledTime = function (time) {
|
|
12429
12598
|
return ((_this.props.minTime || _this.props.maxTime) &&
|
|
@@ -12484,7 +12653,9 @@ var Time = /** @class */ (function (_super) {
|
|
|
12484
12653
|
var times = [];
|
|
12485
12654
|
var format = typeof _this.props.format === "string" ? _this.props.format : "p";
|
|
12486
12655
|
var intervals = (_a = _this.props.intervals) !== null && _a !== void 0 ? _a : Time.defaultProps.intervals;
|
|
12487
|
-
var activeDate = _this.props.selected ||
|
|
12656
|
+
var activeDate = safeToDate(_this.props.selected) ||
|
|
12657
|
+
safeToDate(_this.props.openToDate) ||
|
|
12658
|
+
newDate();
|
|
12488
12659
|
var base = getStartOfDay(activeDate);
|
|
12489
12660
|
var sortedInjectTimes = _this.props.injectTimes &&
|
|
12490
12661
|
_this.props.injectTimes.sort(function (a, b) {
|
|
@@ -12564,9 +12735,13 @@ var Time = /** @class */ (function (_super) {
|
|
|
12564
12735
|
};
|
|
12565
12736
|
Time.prototype.updateContainerHeight = function () {
|
|
12566
12737
|
if (this.props.monthRef && this.header) {
|
|
12567
|
-
this.
|
|
12568
|
-
|
|
12569
|
-
|
|
12738
|
+
var newHeight = this.props.monthRef.clientHeight - this.header.clientHeight;
|
|
12739
|
+
// Only update state if height actually changed to prevent infinite resize loops
|
|
12740
|
+
if (this.state.height !== newHeight) {
|
|
12741
|
+
this.setState({
|
|
12742
|
+
height: newHeight,
|
|
12743
|
+
});
|
|
12744
|
+
}
|
|
12570
12745
|
}
|
|
12571
12746
|
};
|
|
12572
12747
|
Time.prototype.render = function () {
|
|
@@ -13254,7 +13429,13 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13254
13429
|
return ({
|
|
13255
13430
|
date: setMonth(date, Number(month)),
|
|
13256
13431
|
});
|
|
13257
|
-
}, function () {
|
|
13432
|
+
}, function () {
|
|
13433
|
+
var _a, _b;
|
|
13434
|
+
_this.handleMonthChange(_this.state.date);
|
|
13435
|
+
// Reset monthSelectedIn to 0 so the target month appears in the leftmost position
|
|
13436
|
+
// This ensures consistent behavior when using changeMonth in custom headers
|
|
13437
|
+
(_b = (_a = _this.props).onMonthSelectedInChange) === null || _b === void 0 ? void 0 : _b.call(_a, 0);
|
|
13438
|
+
});
|
|
13258
13439
|
};
|
|
13259
13440
|
_this.changeMonthYear = function (monthYear) {
|
|
13260
13441
|
_this.setState(function (_a) {
|
|
@@ -13264,8 +13445,13 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13264
13445
|
});
|
|
13265
13446
|
}, function () { return _this.handleMonthYearChange(_this.state.date); });
|
|
13266
13447
|
};
|
|
13267
|
-
_this.header = function (date) {
|
|
13448
|
+
_this.header = function (date, customDayNameCount) {
|
|
13268
13449
|
if (date === void 0) { date = _this.state.date; }
|
|
13450
|
+
if (customDayNameCount === void 0) { customDayNameCount = 0; }
|
|
13451
|
+
// Return empty array if date is invalid
|
|
13452
|
+
if (!isValid(date)) {
|
|
13453
|
+
return [];
|
|
13454
|
+
}
|
|
13269
13455
|
var disabled = _this.props.disabled;
|
|
13270
13456
|
var startOfWeek = getStartOfWeek(date, _this.props.locale, _this.props.calendarStartDay);
|
|
13271
13457
|
var dayNames = [];
|
|
@@ -13277,11 +13463,24 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13277
13463
|
return dayNames.concat([0, 1, 2, 3, 4, 5, 6].map(function (offset) {
|
|
13278
13464
|
var day = addDays(startOfWeek, offset);
|
|
13279
13465
|
var weekDayName = _this.formatWeekday(day, _this.props.locale);
|
|
13466
|
+
var fullDayName = formatDate(day, "EEEE", _this.props.locale);
|
|
13280
13467
|
var weekDayClassName = _this.props.weekDayClassName
|
|
13281
13468
|
? _this.props.weekDayClassName(day)
|
|
13282
13469
|
: undefined;
|
|
13470
|
+
// Use custom render if provided
|
|
13471
|
+
if (_this.props.renderCustomDayName) {
|
|
13472
|
+
var customContent = _this.props.renderCustomDayName({
|
|
13473
|
+
day: day,
|
|
13474
|
+
shortName: weekDayName,
|
|
13475
|
+
fullName: fullDayName,
|
|
13476
|
+
locale: _this.props.locale,
|
|
13477
|
+
customDayNameCount: customDayNameCount,
|
|
13478
|
+
});
|
|
13479
|
+
return (React__default.createElement("div", { key: offset, role: "columnheader", className: clsx("react-datepicker__day-name", weekDayClassName, disabled ? "react-datepicker__day-name--disabled" : "") }, customContent));
|
|
13480
|
+
}
|
|
13481
|
+
// Default render
|
|
13283
13482
|
return (React__default.createElement("div", { key: offset, role: "columnheader", className: clsx("react-datepicker__day-name", weekDayClassName, disabled ? "react-datepicker__day-name--disabled" : "") },
|
|
13284
|
-
React__default.createElement("span", { className: "react-datepicker__sr-only" },
|
|
13483
|
+
React__default.createElement("span", { className: "react-datepicker__sr-only" }, fullDayName),
|
|
13285
13484
|
React__default.createElement("span", { "aria-hidden": "true" }, weekDayName)));
|
|
13286
13485
|
}));
|
|
13287
13486
|
};
|
|
@@ -13460,7 +13659,9 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13460
13659
|
if (_this.props.showMonthYearDropdown) {
|
|
13461
13660
|
classes.push("react-datepicker__current-month--hasMonthYearDropdown");
|
|
13462
13661
|
}
|
|
13463
|
-
return (React__default.createElement("h2", { className: classes.join(" ") },
|
|
13662
|
+
return (React__default.createElement("h2", { className: classes.join(" ") }, isValid(date)
|
|
13663
|
+
? formatDate(date, _this.props.dateFormat, _this.props.locale)
|
|
13664
|
+
: ""));
|
|
13464
13665
|
};
|
|
13465
13666
|
_this.renderYearDropdown = function (overrideHide) {
|
|
13466
13667
|
if (overrideHide === void 0) { overrideHide = false; }
|
|
@@ -13493,17 +13694,31 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13493
13694
|
}
|
|
13494
13695
|
return (React__default.createElement("div", { className: "react-datepicker__today-button", onClick: _this.handleTodayButtonClick }, _this.props.todayButton));
|
|
13495
13696
|
};
|
|
13496
|
-
_this.renderDayNamesHeader = function (monthDate
|
|
13697
|
+
_this.renderDayNamesHeader = function (monthDate, customDayNameCount) {
|
|
13698
|
+
if (customDayNameCount === void 0) { customDayNameCount = 0; }
|
|
13699
|
+
return (React__default.createElement("div", { className: "react-datepicker__day-names", role: "row" }, _this.header(monthDate, customDayNameCount)));
|
|
13700
|
+
};
|
|
13497
13701
|
_this.renderDefaultHeader = function (_a) {
|
|
13498
13702
|
var monthDate = _a.monthDate, i = _a.i;
|
|
13499
|
-
|
|
13500
|
-
|
|
13501
|
-
: ""
|
|
13703
|
+
var headerContent = (React__default.createElement("div", { className: clsx("react-datepicker__header", {
|
|
13704
|
+
"react-datepicker__header--has-time-select": _this.props.showTimeSelect,
|
|
13705
|
+
"react-datepicker__header--middle": _this.props.monthHeaderPosition === "middle",
|
|
13706
|
+
"react-datepicker__header--bottom": _this.props.monthHeaderPosition === "bottom",
|
|
13707
|
+
}) },
|
|
13502
13708
|
_this.renderCurrentMonth(monthDate),
|
|
13503
13709
|
React__default.createElement("div", { className: "react-datepicker__header__dropdown react-datepicker__header__dropdown--".concat(_this.props.dropdownMode), onFocus: _this.handleDropdownFocus },
|
|
13504
13710
|
_this.renderMonthDropdown(i !== 0),
|
|
13505
13711
|
_this.renderMonthYearDropdown(i !== 0),
|
|
13506
13712
|
_this.renderYearDropdown(i !== 0))));
|
|
13713
|
+
// Top position: render header directly in default location
|
|
13714
|
+
if (_this.props.monthHeaderPosition === "top") {
|
|
13715
|
+
return headerContent;
|
|
13716
|
+
}
|
|
13717
|
+
// Middle/bottom positions: wrap with navigation buttons
|
|
13718
|
+
return (React__default.createElement("div", { className: "react-datepicker__header-wrapper" },
|
|
13719
|
+
_this.renderPreviousButton() || null,
|
|
13720
|
+
_this.renderNextButton() || null,
|
|
13721
|
+
headerContent));
|
|
13507
13722
|
};
|
|
13508
13723
|
_this.renderCustomHeader = function (headerArgs) {
|
|
13509
13724
|
var _a, _b;
|
|
@@ -13572,8 +13787,13 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13572
13787
|
monthList.push(React__default.createElement("div", { key: monthKey, ref: function (div) {
|
|
13573
13788
|
_this.monthContainer = div !== null && div !== void 0 ? div : undefined;
|
|
13574
13789
|
}, className: "react-datepicker__month-container" },
|
|
13575
|
-
_this.
|
|
13576
|
-
|
|
13790
|
+
_this.props.monthHeaderPosition === "top" &&
|
|
13791
|
+
_this.renderHeader({ monthDate: monthDate, i: i }),
|
|
13792
|
+
React__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"
|
|
13793
|
+
? _this.renderHeader({ monthDate: monthDate, i: i })
|
|
13794
|
+
: undefined, monthFooter: _this.props.monthHeaderPosition === "bottom"
|
|
13795
|
+
? _this.renderHeader({ monthDate: monthDate, i: i })
|
|
13796
|
+
: undefined }))));
|
|
13577
13797
|
}
|
|
13578
13798
|
return monthList;
|
|
13579
13799
|
};
|
|
@@ -13596,6 +13816,34 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13596
13816
|
return;
|
|
13597
13817
|
};
|
|
13598
13818
|
_this.renderInputTimeSection = function () {
|
|
13819
|
+
var _a, _b;
|
|
13820
|
+
if (!_this.props.showTimeInput) {
|
|
13821
|
+
return;
|
|
13822
|
+
}
|
|
13823
|
+
// Handle selectsRange mode - render two time inputs
|
|
13824
|
+
if (_this.props.selectsRange) {
|
|
13825
|
+
var _c = _this.props, startDate = _c.startDate, endDate = _c.endDate;
|
|
13826
|
+
var startTime = startDate ? new Date(startDate) : undefined;
|
|
13827
|
+
var startTimeValid = startTime && isValid(startTime) && Boolean(startDate);
|
|
13828
|
+
var startTimeString = startTimeValid
|
|
13829
|
+
? "".concat(addZero(startTime.getHours()), ":").concat(addZero(startTime.getMinutes()))
|
|
13830
|
+
: "";
|
|
13831
|
+
var endTime = endDate ? new Date(endDate) : undefined;
|
|
13832
|
+
var endTimeValid = endTime && isValid(endTime) && Boolean(endDate);
|
|
13833
|
+
var endTimeString = endTimeValid
|
|
13834
|
+
? "".concat(addZero(endTime.getHours()), ":").concat(addZero(endTime.getMinutes()))
|
|
13835
|
+
: "";
|
|
13836
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
13837
|
+
React__default.createElement(InputTime, _assign({}, Calendar.defaultProps, _this.props, { date: startTime, timeString: startTimeString, onChange: function (time) {
|
|
13838
|
+
var _a, _b;
|
|
13839
|
+
(_b = (_a = _this.props).onTimeChange) === null || _b === void 0 ? void 0 : _b.call(_a, time, "start");
|
|
13840
|
+
}, timeInputLabel: ((_a = _this.props.timeInputLabel) !== null && _a !== void 0 ? _a : "Time") + " (Start)" })),
|
|
13841
|
+
React__default.createElement(InputTime, _assign({}, Calendar.defaultProps, _this.props, { date: endTime, timeString: endTimeString, onChange: function (time) {
|
|
13842
|
+
var _a, _b;
|
|
13843
|
+
(_b = (_a = _this.props).onTimeChange) === null || _b === void 0 ? void 0 : _b.call(_a, time, "end");
|
|
13844
|
+
}, timeInputLabel: ((_b = _this.props.timeInputLabel) !== null && _b !== void 0 ? _b : "Time") + " (End)" }))));
|
|
13845
|
+
}
|
|
13846
|
+
// Single date mode (original behavior)
|
|
13599
13847
|
var time = _this.props.selected
|
|
13600
13848
|
? new Date(_this.props.selected)
|
|
13601
13849
|
: undefined;
|
|
@@ -13603,13 +13851,17 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13603
13851
|
var timeString = timeValid
|
|
13604
13852
|
? "".concat(addZero(time.getHours()), ":").concat(addZero(time.getMinutes()))
|
|
13605
13853
|
: "";
|
|
13606
|
-
|
|
13607
|
-
|
|
13608
|
-
|
|
13609
|
-
|
|
13854
|
+
return (React__default.createElement(InputTime, _assign({}, Calendar.defaultProps, _this.props, { date: time, timeString: timeString, onChange: function (time) {
|
|
13855
|
+
var _a, _b;
|
|
13856
|
+
(_b = (_a = _this.props).onTimeChange) === null || _b === void 0 ? void 0 : _b.call(_a, time);
|
|
13857
|
+
} })));
|
|
13610
13858
|
};
|
|
13611
13859
|
_this.renderAriaLiveRegion = function () {
|
|
13612
13860
|
var _a;
|
|
13861
|
+
// Don't render aria-live message if date is invalid
|
|
13862
|
+
if (!isValid(_this.state.date)) {
|
|
13863
|
+
return (React__default.createElement("span", { role: "alert", "aria-live": "polite", className: "react-datepicker__aria-live" }));
|
|
13864
|
+
}
|
|
13613
13865
|
var _b = getYearsPeriod(_this.state.date, (_a = _this.props.yearItemNumber) !== null && _a !== void 0 ? _a : Calendar.defaultProps.yearItemNumber), startPeriod = _b.startPeriod, endPeriod = _b.endPeriod;
|
|
13614
13866
|
var ariaLiveMessage;
|
|
13615
13867
|
if (_this.props.showYearPicker) {
|
|
@@ -13651,6 +13903,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13651
13903
|
previousMonthButtonLabel: "Previous Month",
|
|
13652
13904
|
nextMonthButtonLabel: "Next Month",
|
|
13653
13905
|
yearItemNumber: DEFAULT_YEAR_ITEM_NUMBER,
|
|
13906
|
+
monthHeaderPosition: "top",
|
|
13654
13907
|
};
|
|
13655
13908
|
},
|
|
13656
13909
|
enumerable: false,
|
|
@@ -13671,6 +13924,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13671
13924
|
Calendar.prototype.componentDidUpdate = function (prevProps) {
|
|
13672
13925
|
var _this = this;
|
|
13673
13926
|
if (this.props.preSelection &&
|
|
13927
|
+
isValid(this.props.preSelection) &&
|
|
13674
13928
|
(!isSameDay(this.props.preSelection, prevProps.preSelection) ||
|
|
13675
13929
|
this.props.monthSelectedIn !== prevProps.monthSelectedIn)) {
|
|
13676
13930
|
var hasMonthChanged_1 = !isSameMonth(this.state.date, this.props.preSelection);
|
|
@@ -13691,10 +13945,12 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13691
13945
|
React__default.createElement("div", { style: { display: "contents" }, ref: this.containerRef },
|
|
13692
13946
|
React__default.createElement(Container, { className: clsx("react-datepicker", this.props.className, {
|
|
13693
13947
|
"react-datepicker--time-only": this.props.showTimeSelectOnly,
|
|
13694
|
-
}), showTime: this.props.showTimeSelect || this.props.showTimeInput, showTimeSelectOnly: this.props.showTimeSelectOnly },
|
|
13948
|
+
}), showTime: this.props.showTimeSelect || this.props.showTimeInput, showTimeSelectOnly: this.props.showTimeSelectOnly, inline: this.props.inline },
|
|
13695
13949
|
this.renderAriaLiveRegion(),
|
|
13696
|
-
this.
|
|
13697
|
-
|
|
13950
|
+
this.props.monthHeaderPosition === "top" &&
|
|
13951
|
+
this.renderPreviousButton(),
|
|
13952
|
+
this.props.monthHeaderPosition === "top" &&
|
|
13953
|
+
this.renderNextButton(),
|
|
13698
13954
|
this.renderMonths(),
|
|
13699
13955
|
this.renderYears(),
|
|
13700
13956
|
this.renderTodayButton(),
|
|
@@ -13885,6 +14141,7 @@ function withFloating(Component) {
|
|
|
13885
14141
|
var floatingProps = useFloating(_assign({ open: !hidePopper, whileElementsMounted: autoUpdate, placement: props.popperPlacement, middleware: __spreadArray([
|
|
13886
14142
|
flip({ padding: 15 }),
|
|
13887
14143
|
offset(10),
|
|
14144
|
+
// eslint-disable-next-line react-hooks/refs -- Floating UI requires refs to be passed during render
|
|
13888
14145
|
arrow({ element: arrowRef })
|
|
13889
14146
|
], ((_a = props.popperModifiers) !== null && _a !== void 0 ? _a : []), true) }, props.popperProps));
|
|
13890
14147
|
var componentProps = _assign(_assign({}, props), { hidePopper: hidePopper, popperProps: _assign(_assign({}, floatingProps), { arrowRef: arrowRef }) });
|
|
@@ -13895,11 +14152,21 @@ function withFloating(Component) {
|
|
|
13895
14152
|
}
|
|
13896
14153
|
|
|
13897
14154
|
// Exported for testing purposes
|
|
13898
|
-
var PopperComponent = function (props) {
|
|
13899
|
-
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;
|
|
14155
|
+
var PopperComponent$1 = function (props) {
|
|
14156
|
+
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;
|
|
14157
|
+
// When a custom popperTargetRef is provided, use it as the position reference
|
|
14158
|
+
// This allows the popper to be positioned relative to a specific element
|
|
14159
|
+
// within the custom input, rather than the wrapper div
|
|
14160
|
+
useEffect(function () {
|
|
14161
|
+
if (popperTargetRef === null || popperTargetRef === void 0 ? void 0 : popperTargetRef.current) {
|
|
14162
|
+
popperProps.refs.setPositionReference(popperTargetRef.current);
|
|
14163
|
+
}
|
|
14164
|
+
}, [popperTargetRef, popperProps.refs]);
|
|
13900
14165
|
var popper = undefined;
|
|
13901
14166
|
if (!hidePopper) {
|
|
13902
|
-
var classes = clsx("react-datepicker-popper",
|
|
14167
|
+
var classes = clsx("react-datepicker-popper", !showArrow && "react-datepicker-popper-offset", monthHeaderPosition === "middle" &&
|
|
14168
|
+
"react-datepicker-popper--header-middle", monthHeaderPosition === "bottom" &&
|
|
14169
|
+
"react-datepicker-popper--header-bottom", className);
|
|
13903
14170
|
popper = (React__default.createElement(TabLoop, { enableTabLoop: enableTabLoop },
|
|
13904
14171
|
React__default.createElement("div", { ref: popperProps.refs.setFloating, style: popperProps.floatingStyles, className: classes, "data-placement": popperProps.placement, onKeyDown: popperOnKeyDown },
|
|
13905
14172
|
popperComponent,
|
|
@@ -13916,7 +14183,7 @@ var PopperComponent = function (props) {
|
|
|
13916
14183
|
React__default.createElement("div", { ref: popperProps.refs.setReference, className: wrapperClasses }, targetComponent),
|
|
13917
14184
|
popper));
|
|
13918
14185
|
};
|
|
13919
|
-
var PopperComponent
|
|
14186
|
+
var PopperComponent = withFloating(PopperComponent$1);
|
|
13920
14187
|
|
|
13921
14188
|
// Compares dates year+month combinations
|
|
13922
14189
|
function hasPreSelectionChanged(date1, date2) {
|
|
@@ -13936,27 +14203,32 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
13936
14203
|
_this.calendar = null;
|
|
13937
14204
|
_this.input = null;
|
|
13938
14205
|
_this.getPreSelection = function () {
|
|
13939
|
-
|
|
14206
|
+
var timeZone = _this.props.timeZone;
|
|
14207
|
+
var baseDate = _this.props.openToDate
|
|
13940
14208
|
? _this.props.openToDate
|
|
13941
14209
|
: _this.props.selectsEnd && _this.props.startDate
|
|
13942
14210
|
? _this.props.startDate
|
|
13943
14211
|
: _this.props.selectsStart && _this.props.endDate
|
|
13944
14212
|
? _this.props.endDate
|
|
13945
14213
|
: newDate();
|
|
14214
|
+
// Convert to the specified timezone for display
|
|
14215
|
+
return timeZone ? toZonedTime(baseDate, timeZone) : baseDate;
|
|
13946
14216
|
};
|
|
13947
14217
|
// Convert the date from string format to standard Date format
|
|
14218
|
+
// Uses parseDate with ISO format to parse as local time, preventing
|
|
14219
|
+
// dates from shifting in timezones west of UTC. See issue #6105.
|
|
13948
14220
|
_this.modifyHolidays = function () {
|
|
13949
14221
|
var _a;
|
|
13950
14222
|
return (_a = _this.props.holidays) === null || _a === void 0 ? void 0 : _a.reduce(function (accumulator, holiday) {
|
|
13951
|
-
var date =
|
|
13952
|
-
if (!
|
|
14223
|
+
var date = parseDate(holiday.date, "yyyy-MM-dd", undefined, false);
|
|
14224
|
+
if (!date) {
|
|
13953
14225
|
return accumulator;
|
|
13954
14226
|
}
|
|
13955
14227
|
return __spreadArray(__spreadArray([], accumulator, true), [_assign(_assign({}, holiday), { date: date })], false);
|
|
13956
14228
|
}, []);
|
|
13957
14229
|
};
|
|
13958
14230
|
_this.calcInitialState = function () {
|
|
13959
|
-
var
|
|
14231
|
+
var timeZone = _this.props.timeZone;
|
|
13960
14232
|
var defaultPreSelection = _this.getPreSelection();
|
|
13961
14233
|
var minDate = getEffectiveMinDate(_this.props);
|
|
13962
14234
|
var maxDate = getEffectiveMaxDate(_this.props);
|
|
@@ -13965,13 +14237,18 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
13965
14237
|
: maxDate && isAfter(defaultPreSelection, getEndOfDay(maxDate))
|
|
13966
14238
|
? maxDate
|
|
13967
14239
|
: defaultPreSelection;
|
|
14240
|
+
// Convert selected/startDate to zoned time for display if timezone is specified
|
|
14241
|
+
var initialPreSelection = _this.props.selectsRange
|
|
14242
|
+
? _this.props.startDate
|
|
14243
|
+
: _this.props.selected;
|
|
14244
|
+
if (initialPreSelection && timeZone) {
|
|
14245
|
+
initialPreSelection = toZonedTime(initialPreSelection, timeZone);
|
|
14246
|
+
}
|
|
13968
14247
|
return {
|
|
13969
14248
|
open: _this.props.startOpen || false,
|
|
13970
14249
|
preventFocus: false,
|
|
13971
14250
|
inputValue: null,
|
|
13972
|
-
preSelection:
|
|
13973
|
-
? _this.props.startDate
|
|
13974
|
-
: _this.props.selected)) !== null && _a !== void 0 ? _a : boundedPreSelection,
|
|
14251
|
+
preSelection: initialPreSelection !== null && initialPreSelection !== void 0 ? initialPreSelection : boundedPreSelection,
|
|
13975
14252
|
// transforming highlighted days (perhaps nested array)
|
|
13976
14253
|
// to flat Map for faster access in day.jsx
|
|
13977
14254
|
highlightDates: getHighLightDaysMap(_this.props.highlightDates),
|
|
@@ -13985,7 +14262,7 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
13985
14262
|
};
|
|
13986
14263
|
_this.getInputValue = function () {
|
|
13987
14264
|
var _a;
|
|
13988
|
-
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;
|
|
14265
|
+
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;
|
|
13989
14266
|
var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
|
|
13990
14267
|
var inputValue = _this.state.inputValue;
|
|
13991
14268
|
if (typeof value === "string") {
|
|
@@ -14002,6 +14279,12 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14002
14279
|
});
|
|
14003
14280
|
}
|
|
14004
14281
|
else if (selectsMultiple) {
|
|
14282
|
+
if (formatMultipleDates) {
|
|
14283
|
+
var formatDateFn = function (date) {
|
|
14284
|
+
return safeDateFormat(date, { dateFormat: dateFormat, locale: locale });
|
|
14285
|
+
};
|
|
14286
|
+
return formatMultipleDates(selectedDates !== null && selectedDates !== void 0 ? selectedDates : [], formatDateFn);
|
|
14287
|
+
}
|
|
14005
14288
|
return safeMultipleDatesFormat(selectedDates !== null && selectedDates !== void 0 ? selectedDates : [], {
|
|
14006
14289
|
dateFormat: dateFormat,
|
|
14007
14290
|
locale: locale,
|
|
@@ -14119,6 +14402,19 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14119
14402
|
if (!_this.state.open || _this.props.withPortal || _this.props.showTimeInput) {
|
|
14120
14403
|
(_b = (_a = _this.props).onBlur) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
14121
14404
|
}
|
|
14405
|
+
// If user cleared the input via a mask library (inputValue has no date-like
|
|
14406
|
+
// characters), clear the selection on blur (fixes issue #5814 with mask inputs)
|
|
14407
|
+
var inputValue = _this.state.inputValue;
|
|
14408
|
+
if (typeof inputValue === "string" && inputValue.length > 0) {
|
|
14409
|
+
// Check if input looks like a cleared mask (no alphanumeric characters)
|
|
14410
|
+
// This distinguishes between:
|
|
14411
|
+
// - "__/__/____" (cleared mask) → should clear selection
|
|
14412
|
+
// - "2025-02-45" (invalid date) → should keep previous selection
|
|
14413
|
+
var hasDateCharacters = /[a-zA-Z0-9]/.test(inputValue);
|
|
14414
|
+
if (!hasDateCharacters && _this.props.selected) {
|
|
14415
|
+
_this.setSelected(null, undefined, true);
|
|
14416
|
+
}
|
|
14417
|
+
}
|
|
14122
14418
|
_this.resetInputValue();
|
|
14123
14419
|
if (_this.state.open && _this.props.open === false) {
|
|
14124
14420
|
_this.setOpen(false);
|
|
@@ -14127,17 +14423,19 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14127
14423
|
};
|
|
14128
14424
|
_this.handleCalendarClickOutside = function (event) {
|
|
14129
14425
|
var _a, _b;
|
|
14130
|
-
|
|
14426
|
+
// Call user's onClickOutside first, allowing them to call preventDefault()
|
|
14427
|
+
(_b = (_a = _this.props).onClickOutside) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
14428
|
+
// Only close if not prevented and not inline
|
|
14429
|
+
if (!_this.props.inline && !event.defaultPrevented) {
|
|
14131
14430
|
_this.setOpen(false);
|
|
14132
14431
|
}
|
|
14133
|
-
(_b = (_a = _this.props).onClickOutside) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
14134
14432
|
if (_this.props.withPortal) {
|
|
14135
14433
|
event.preventDefault();
|
|
14136
14434
|
}
|
|
14137
14435
|
};
|
|
14138
14436
|
// handleChange is called when user types in the textbox
|
|
14139
14437
|
_this.handleChange = function () {
|
|
14140
|
-
var _a, _b, _c, _d, _e;
|
|
14438
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
14141
14439
|
var allArgs = [];
|
|
14142
14440
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
14143
14441
|
allArgs[_i] = arguments[_i];
|
|
@@ -14155,24 +14453,24 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14155
14453
|
inputValue: (event === null || event === void 0 ? void 0 : event.target) instanceof HTMLInputElement ? event.target.value : null,
|
|
14156
14454
|
lastPreSelectChange: PRESELECT_CHANGE_VIA_INPUT,
|
|
14157
14455
|
});
|
|
14158
|
-
var
|
|
14456
|
+
var _j = _this.props, selectsRange = _j.selectsRange, startDate = _j.startDate, endDate = _j.endDate;
|
|
14159
14457
|
var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
|
|
14160
14458
|
var strictParsing = (_b = _this.props.strictParsing) !== null && _b !== void 0 ? _b : DatePicker.defaultProps.strictParsing;
|
|
14161
14459
|
var value = (event === null || event === void 0 ? void 0 : event.target) instanceof HTMLInputElement ? event.target.value : "";
|
|
14162
14460
|
if (selectsRange) {
|
|
14163
14461
|
var rangeSeparator = _this.props.rangeSeparator;
|
|
14164
14462
|
var trimmedRangeSeparator = rangeSeparator.trim();
|
|
14165
|
-
var
|
|
14463
|
+
var _k = value
|
|
14166
14464
|
.split(dateFormat.includes(trimmedRangeSeparator)
|
|
14167
14465
|
? rangeSeparator
|
|
14168
14466
|
: trimmedRangeSeparator, 2)
|
|
14169
|
-
.map(function (val) { return val.trim(); }), valueStart =
|
|
14467
|
+
.map(function (val) { return val.trim(); }), valueStart = _k[0], valueEnd = _k[1];
|
|
14170
14468
|
var startDateNew = parseDate(valueStart !== null && valueStart !== void 0 ? valueStart : "", dateFormat, _this.props.locale, strictParsing);
|
|
14171
14469
|
var endDateNew = startDateNew
|
|
14172
14470
|
? parseDate(valueEnd !== null && valueEnd !== void 0 ? valueEnd : "", dateFormat, _this.props.locale, strictParsing)
|
|
14173
14471
|
: null;
|
|
14174
|
-
var startChanged = (startDate === null ||
|
|
14175
|
-
var endChanged = (endDate === null ||
|
|
14472
|
+
var startChanged = ((_c = safeToDate(startDate)) === null || _c === void 0 ? void 0 : _c.getTime()) !== (startDateNew === null || startDateNew === void 0 ? void 0 : startDateNew.getTime());
|
|
14473
|
+
var endChanged = ((_d = safeToDate(endDate)) === null || _d === void 0 ? void 0 : _d.getTime()) !== (endDateNew === null || endDateNew === void 0 ? void 0 : endDateNew.getTime());
|
|
14176
14474
|
if (!startChanged && !endChanged) {
|
|
14177
14475
|
return;
|
|
14178
14476
|
}
|
|
@@ -14182,15 +14480,31 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14182
14480
|
if (endDateNew && isDayDisabled(endDateNew, _this.props)) {
|
|
14183
14481
|
return;
|
|
14184
14482
|
}
|
|
14185
|
-
|
|
14483
|
+
// Update preSelection to keep calendar viewport consistent when reopening
|
|
14484
|
+
// Use startDate for preSelection to match calcInitialState behavior
|
|
14485
|
+
if (startDateNew) {
|
|
14486
|
+
_this.setState({ preSelection: startDateNew });
|
|
14487
|
+
}
|
|
14488
|
+
(_f = (_e = _this.props).onChange) === null || _f === void 0 ? void 0 : _f.call(_e, [startDateNew, endDateNew], event);
|
|
14186
14489
|
}
|
|
14187
14490
|
else {
|
|
14188
14491
|
// not selectsRange
|
|
14189
|
-
var date = parseDate(value, dateFormat, _this.props.locale, strictParsing, (
|
|
14492
|
+
var date = parseDate(value, dateFormat, _this.props.locale, strictParsing, (_g = _this.props.selected) !== null && _g !== void 0 ? _g : undefined);
|
|
14190
14493
|
// Update selection if either (1) date was successfully parsed, or (2) input field is empty
|
|
14191
14494
|
if (date || !value) {
|
|
14192
14495
|
_this.setSelected(date, event, true);
|
|
14193
14496
|
}
|
|
14497
|
+
else if (!_this.props.inline) {
|
|
14498
|
+
// If full date parsing failed but we have partial input,
|
|
14499
|
+
// try to extract date info for calendar navigation
|
|
14500
|
+
var navDate = parseDateForNavigation(value, (_h = _this.state.preSelection) !== null && _h !== void 0 ? _h : undefined);
|
|
14501
|
+
// Only update preSelection if navDate is valid and within min/max bounds
|
|
14502
|
+
if (navDate &&
|
|
14503
|
+
(!_this.props.minDate || !isBefore(navDate, _this.props.minDate)) &&
|
|
14504
|
+
(!_this.props.maxDate || !isAfter(navDate, _this.props.maxDate))) {
|
|
14505
|
+
_this.setState({ preSelection: navDate });
|
|
14506
|
+
}
|
|
14507
|
+
}
|
|
14194
14508
|
}
|
|
14195
14509
|
};
|
|
14196
14510
|
_this.handleSelect = function (date, event, monthSelectedIn) {
|
|
@@ -14229,7 +14543,13 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14229
14543
|
// 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)
|
|
14230
14544
|
_this.setSelected = function (date, event, keepInput, monthSelectedIn) {
|
|
14231
14545
|
var _a, _b;
|
|
14546
|
+
var timeZone = _this.props.timeZone;
|
|
14547
|
+
// If timezone is specified, convert the selected date from zoned time to UTC
|
|
14548
|
+
// This ensures the onChange callback receives a proper UTC Date object
|
|
14232
14549
|
var changedDate = date;
|
|
14550
|
+
if (changedDate && timeZone) {
|
|
14551
|
+
changedDate = fromZonedTime(changedDate, timeZone);
|
|
14552
|
+
}
|
|
14233
14553
|
// Early return if selected year/month/day is disabled
|
|
14234
14554
|
if (_this.props.showYearPicker) {
|
|
14235
14555
|
if (changedDate !== null &&
|
|
@@ -14286,54 +14606,56 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14286
14606
|
}
|
|
14287
14607
|
}
|
|
14288
14608
|
if (selectsRange) {
|
|
14609
|
+
var onChangeRange = onChange;
|
|
14289
14610
|
var noRanges = !startDate && !endDate;
|
|
14290
14611
|
var hasStartRange = startDate && !endDate;
|
|
14291
14612
|
var hasOnlyEndRange = !startDate && !!endDate;
|
|
14292
14613
|
var isRangeFilled = startDate && endDate;
|
|
14293
14614
|
if (noRanges) {
|
|
14294
|
-
|
|
14615
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, null], event);
|
|
14295
14616
|
}
|
|
14296
14617
|
else if (hasStartRange) {
|
|
14297
14618
|
if (changedDate === null) {
|
|
14298
|
-
|
|
14619
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([null, null], event);
|
|
14299
14620
|
}
|
|
14300
14621
|
else if (isDateBefore(changedDate, startDate)) {
|
|
14301
14622
|
if (swapRange) {
|
|
14302
|
-
|
|
14623
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, startDate], event);
|
|
14303
14624
|
}
|
|
14304
14625
|
else {
|
|
14305
|
-
|
|
14626
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, null], event);
|
|
14306
14627
|
}
|
|
14307
14628
|
}
|
|
14308
14629
|
else {
|
|
14309
|
-
|
|
14630
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([startDate, changedDate], event);
|
|
14310
14631
|
}
|
|
14311
14632
|
}
|
|
14312
14633
|
else if (hasOnlyEndRange) {
|
|
14313
14634
|
if (changedDate && isDateBefore(changedDate, endDate)) {
|
|
14314
|
-
|
|
14635
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, endDate], event);
|
|
14315
14636
|
}
|
|
14316
14637
|
else {
|
|
14317
|
-
|
|
14638
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, null], event);
|
|
14318
14639
|
}
|
|
14319
14640
|
}
|
|
14320
14641
|
if (isRangeFilled) {
|
|
14321
|
-
|
|
14642
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedDate, null], event);
|
|
14322
14643
|
}
|
|
14323
14644
|
}
|
|
14324
14645
|
else if (selectsMultiple) {
|
|
14646
|
+
var onChangeMultiple = onChange;
|
|
14325
14647
|
if (changedDate !== null) {
|
|
14326
14648
|
if (!(selectedDates === null || selectedDates === void 0 ? void 0 : selectedDates.length)) {
|
|
14327
|
-
|
|
14649
|
+
onChangeMultiple === null || onChangeMultiple === void 0 ? void 0 : onChangeMultiple([changedDate], event);
|
|
14328
14650
|
}
|
|
14329
14651
|
else {
|
|
14330
14652
|
var isChangedDateAlreadySelected = selectedDates.some(function (selectedDate) { return isSameDay(selectedDate, changedDate); });
|
|
14331
14653
|
if (isChangedDateAlreadySelected) {
|
|
14332
14654
|
var nextDates = selectedDates.filter(function (selectedDate) { return !isSameDay(selectedDate, changedDate); });
|
|
14333
|
-
|
|
14655
|
+
onChangeMultiple === null || onChangeMultiple === void 0 ? void 0 : onChangeMultiple(nextDates, event);
|
|
14334
14656
|
}
|
|
14335
14657
|
else {
|
|
14336
|
-
|
|
14658
|
+
onChangeMultiple === null || onChangeMultiple === void 0 ? void 0 : onChangeMultiple(__spreadArray(__spreadArray([], selectedDates, true), [changedDate], false), event);
|
|
14337
14659
|
}
|
|
14338
14660
|
}
|
|
14339
14661
|
}
|
|
@@ -14382,24 +14704,135 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14382
14704
|
_this.toggleCalendar = function () {
|
|
14383
14705
|
_this.setOpen(!_this.state.open);
|
|
14384
14706
|
};
|
|
14385
|
-
_this.handleTimeChange = function (time) {
|
|
14707
|
+
_this.handleTimeChange = function (time, modifyDateType) {
|
|
14386
14708
|
var _a, _b;
|
|
14387
|
-
if (_this.props.
|
|
14709
|
+
if (_this.props.selectsMultiple) {
|
|
14388
14710
|
return;
|
|
14389
14711
|
}
|
|
14390
|
-
var
|
|
14391
|
-
|
|
14392
|
-
|
|
14393
|
-
|
|
14394
|
-
|
|
14395
|
-
|
|
14396
|
-
|
|
14397
|
-
|
|
14712
|
+
var _c = _this.props, selectsRange = _c.selectsRange, startDate = _c.startDate, endDate = _c.endDate, onChange = _c.onChange, timeZone = _c.timeZone;
|
|
14713
|
+
if (selectsRange) {
|
|
14714
|
+
var onChangeRange = onChange;
|
|
14715
|
+
// In range mode, apply time to the appropriate date
|
|
14716
|
+
// If modifyDateType is specified, use that to determine which date to modify
|
|
14717
|
+
// Otherwise, use the legacy behavior:
|
|
14718
|
+
// - If we have a startDate but no endDate, apply time to startDate
|
|
14719
|
+
// - If we have both, apply time to endDate
|
|
14720
|
+
if (modifyDateType === "start") {
|
|
14721
|
+
// Explicitly modify start date
|
|
14722
|
+
if (startDate) {
|
|
14723
|
+
var changedStartDate = setTime(startDate, {
|
|
14724
|
+
hour: getHours(time),
|
|
14725
|
+
minute: getMinutes(time),
|
|
14726
|
+
});
|
|
14727
|
+
_this.setState({
|
|
14728
|
+
preSelection: changedStartDate,
|
|
14729
|
+
});
|
|
14730
|
+
// Convert from zoned time to UTC if timezone is specified
|
|
14731
|
+
if (timeZone) {
|
|
14732
|
+
changedStartDate = fromZonedTime(changedStartDate, timeZone);
|
|
14733
|
+
}
|
|
14734
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([
|
|
14735
|
+
changedStartDate,
|
|
14736
|
+
endDate
|
|
14737
|
+
? timeZone
|
|
14738
|
+
? fromZonedTime(endDate, timeZone)
|
|
14739
|
+
: endDate
|
|
14740
|
+
: null,
|
|
14741
|
+
], undefined);
|
|
14742
|
+
}
|
|
14743
|
+
}
|
|
14744
|
+
else if (modifyDateType === "end") {
|
|
14745
|
+
// Explicitly modify end date
|
|
14746
|
+
if (endDate) {
|
|
14747
|
+
var changedEndDate = setTime(endDate, {
|
|
14748
|
+
hour: getHours(time),
|
|
14749
|
+
minute: getMinutes(time),
|
|
14750
|
+
});
|
|
14751
|
+
_this.setState({
|
|
14752
|
+
preSelection: changedEndDate,
|
|
14753
|
+
});
|
|
14754
|
+
// Convert from zoned time to UTC if timezone is specified
|
|
14755
|
+
if (timeZone) {
|
|
14756
|
+
changedEndDate = fromZonedTime(changedEndDate, timeZone);
|
|
14757
|
+
}
|
|
14758
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([
|
|
14759
|
+
startDate
|
|
14760
|
+
? timeZone
|
|
14761
|
+
? fromZonedTime(startDate, timeZone)
|
|
14762
|
+
: startDate
|
|
14763
|
+
: null,
|
|
14764
|
+
changedEndDate,
|
|
14765
|
+
], undefined);
|
|
14766
|
+
}
|
|
14767
|
+
}
|
|
14768
|
+
else {
|
|
14769
|
+
// Legacy behavior for showTimeSelect (single time picker)
|
|
14770
|
+
var hasStartRange = startDate && !endDate;
|
|
14771
|
+
if (hasStartRange) {
|
|
14772
|
+
// Apply time to startDate
|
|
14773
|
+
var changedStartDate = setTime(startDate, {
|
|
14774
|
+
hour: getHours(time),
|
|
14775
|
+
minute: getMinutes(time),
|
|
14776
|
+
});
|
|
14777
|
+
_this.setState({
|
|
14778
|
+
preSelection: changedStartDate,
|
|
14779
|
+
});
|
|
14780
|
+
// Convert from zoned time to UTC if timezone is specified
|
|
14781
|
+
if (timeZone) {
|
|
14782
|
+
changedStartDate = fromZonedTime(changedStartDate, timeZone);
|
|
14783
|
+
}
|
|
14784
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([changedStartDate, null], undefined);
|
|
14785
|
+
}
|
|
14786
|
+
else if (startDate && endDate) {
|
|
14787
|
+
// Apply time to endDate
|
|
14788
|
+
var changedEndDate = setTime(endDate, {
|
|
14789
|
+
hour: getHours(time),
|
|
14790
|
+
minute: getMinutes(time),
|
|
14791
|
+
});
|
|
14792
|
+
_this.setState({
|
|
14793
|
+
preSelection: changedEndDate,
|
|
14794
|
+
});
|
|
14795
|
+
// Convert from zoned time to UTC if timezone is specified
|
|
14796
|
+
if (timeZone) {
|
|
14797
|
+
changedEndDate = fromZonedTime(changedEndDate, timeZone);
|
|
14798
|
+
}
|
|
14799
|
+
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange([
|
|
14800
|
+
timeZone ? fromZonedTime(startDate, timeZone) : startDate,
|
|
14801
|
+
changedEndDate,
|
|
14802
|
+
], undefined);
|
|
14803
|
+
}
|
|
14804
|
+
else {
|
|
14805
|
+
// No dates selected yet, just update preSelection
|
|
14806
|
+
var changedDate = setTime(_this.getPreSelection(), {
|
|
14807
|
+
hour: getHours(time),
|
|
14808
|
+
minute: getMinutes(time),
|
|
14809
|
+
});
|
|
14810
|
+
_this.setState({
|
|
14811
|
+
preSelection: changedDate,
|
|
14812
|
+
});
|
|
14813
|
+
}
|
|
14814
|
+
}
|
|
14815
|
+
}
|
|
14816
|
+
else {
|
|
14817
|
+
// Single date mode (original behavior)
|
|
14818
|
+
var selected = _this.props.selected
|
|
14819
|
+
? _this.props.selected
|
|
14820
|
+
: _this.getPreSelection();
|
|
14821
|
+
var changedDate = _this.props.selected
|
|
14822
|
+
? time
|
|
14823
|
+
: setTime(selected, {
|
|
14824
|
+
hour: getHours(time),
|
|
14825
|
+
minute: getMinutes(time),
|
|
14826
|
+
});
|
|
14827
|
+
_this.setState({
|
|
14828
|
+
preSelection: changedDate,
|
|
14398
14829
|
});
|
|
14399
|
-
|
|
14400
|
-
|
|
14401
|
-
|
|
14402
|
-
|
|
14830
|
+
// Convert from zoned time to UTC if timezone is specified
|
|
14831
|
+
if (changedDate && timeZone) {
|
|
14832
|
+
changedDate = fromZonedTime(changedDate, timeZone);
|
|
14833
|
+
}
|
|
14834
|
+
(_b = (_a = _this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, changedDate);
|
|
14835
|
+
}
|
|
14403
14836
|
if (_this.props.shouldCloseOnSelect && !_this.props.showTimeInput) {
|
|
14404
14837
|
_this.sendFocusBackToInput();
|
|
14405
14838
|
_this.setOpen(false);
|
|
@@ -14419,6 +14852,117 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14419
14852
|
}
|
|
14420
14853
|
(_b = (_a = _this.props).onInputClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
14421
14854
|
};
|
|
14855
|
+
_this.handleTimeOnlyArrowKey = function (eventKey) {
|
|
14856
|
+
var _a, _b, _c, _d;
|
|
14857
|
+
var currentTime = safeToDate(_this.props.selected) || _this.state.preSelection || newDate();
|
|
14858
|
+
var timeIntervals = (_a = _this.props.timeIntervals) !== null && _a !== void 0 ? _a : 30;
|
|
14859
|
+
var dateFormat = (_b = _this.props.dateFormat) !== null && _b !== void 0 ? _b : DatePicker.defaultProps.dateFormat;
|
|
14860
|
+
var formatStr = Array.isArray(dateFormat) ? dateFormat[0] : dateFormat;
|
|
14861
|
+
var baseDate = getStartOfDay(currentTime);
|
|
14862
|
+
var currentMinutes = getHours(currentTime) * 60 + getMinutes(currentTime);
|
|
14863
|
+
var maxMinutes = 23 * 60 + 60 - timeIntervals; // Cap at last valid interval of the day
|
|
14864
|
+
var newTime;
|
|
14865
|
+
if (eventKey === KeyType.ArrowUp) {
|
|
14866
|
+
var newMinutes = Math.max(0, currentMinutes - timeIntervals);
|
|
14867
|
+
newTime = addMinutes(baseDate, newMinutes);
|
|
14868
|
+
}
|
|
14869
|
+
else {
|
|
14870
|
+
var newMinutes = Math.min(maxMinutes, currentMinutes + timeIntervals);
|
|
14871
|
+
newTime = addMinutes(baseDate, newMinutes);
|
|
14872
|
+
}
|
|
14873
|
+
var formattedTime = formatDate(newTime, formatStr || DatePicker.defaultProps.dateFormat, _this.props.locale);
|
|
14874
|
+
_this.setState({
|
|
14875
|
+
preSelection: newTime,
|
|
14876
|
+
inputValue: formattedTime,
|
|
14877
|
+
});
|
|
14878
|
+
if (_this.props.selectsRange || _this.props.selectsMultiple) {
|
|
14879
|
+
return;
|
|
14880
|
+
}
|
|
14881
|
+
var selected = _this.props.selected
|
|
14882
|
+
? _this.props.selected
|
|
14883
|
+
: _this.getPreSelection();
|
|
14884
|
+
var changedDate = _this.props.selected
|
|
14885
|
+
? newTime
|
|
14886
|
+
: setTime(selected, {
|
|
14887
|
+
hour: getHours(newTime),
|
|
14888
|
+
minute: getMinutes(newTime),
|
|
14889
|
+
});
|
|
14890
|
+
(_d = (_c = _this.props).onChange) === null || _d === void 0 ? void 0 : _d.call(_c, changedDate);
|
|
14891
|
+
if (_this.props.showTimeSelectOnly || _this.props.showTimeSelect) {
|
|
14892
|
+
_this.setState({ isRenderAriaLiveMessage: true });
|
|
14893
|
+
}
|
|
14894
|
+
requestAnimationFrame(function () {
|
|
14895
|
+
_this.scrollToTimeOption(newTime);
|
|
14896
|
+
});
|
|
14897
|
+
};
|
|
14898
|
+
_this.handleTimeOnlyEnterKey = function (event) {
|
|
14899
|
+
var _a, _b, _c, _d;
|
|
14900
|
+
var inputElement = event.target;
|
|
14901
|
+
var inputValue = inputElement.value;
|
|
14902
|
+
var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
|
|
14903
|
+
var timeFormat = _this.props.timeFormat || "p";
|
|
14904
|
+
var defaultTime = _this.state.preSelection || safeToDate(_this.props.selected) || newDate();
|
|
14905
|
+
var parsedDate = parseDate(inputValue, dateFormat, _this.props.locale, (_b = _this.props.strictParsing) !== null && _b !== void 0 ? _b : false, defaultTime);
|
|
14906
|
+
var timeToCommit = defaultTime;
|
|
14907
|
+
if (parsedDate && isValid(parsedDate)) {
|
|
14908
|
+
timeToCommit = parsedDate;
|
|
14909
|
+
}
|
|
14910
|
+
else {
|
|
14911
|
+
var highlightedItem = ((_c = _this.calendar) === null || _c === void 0 ? void 0 : _c.containerRef.current) instanceof Element &&
|
|
14912
|
+
_this.calendar.containerRef.current.querySelector(".react-datepicker__time-list-item[tabindex='0']");
|
|
14913
|
+
if (highlightedItem instanceof HTMLElement) {
|
|
14914
|
+
var itemText = (_d = highlightedItem.textContent) === null || _d === void 0 ? void 0 : _d.trim();
|
|
14915
|
+
if (itemText) {
|
|
14916
|
+
var itemTime = parseDate(itemText, timeFormat, _this.props.locale, false, defaultTime);
|
|
14917
|
+
if (itemTime && isValid(itemTime)) {
|
|
14918
|
+
timeToCommit = itemTime;
|
|
14919
|
+
}
|
|
14920
|
+
}
|
|
14921
|
+
}
|
|
14922
|
+
}
|
|
14923
|
+
_this.handleTimeChange(timeToCommit);
|
|
14924
|
+
_this.setOpen(false);
|
|
14925
|
+
_this.sendFocusBackToInput();
|
|
14926
|
+
};
|
|
14927
|
+
_this.scrollToTimeOption = function (time) {
|
|
14928
|
+
var _a, _b;
|
|
14929
|
+
if (!((_a = _this.calendar) === null || _a === void 0 ? void 0 : _a.containerRef.current)) {
|
|
14930
|
+
return;
|
|
14931
|
+
}
|
|
14932
|
+
var container = _this.calendar.containerRef.current;
|
|
14933
|
+
var timeListItems = Array.from(container.querySelectorAll(".react-datepicker__time-list-item"));
|
|
14934
|
+
var targetItem = null;
|
|
14935
|
+
var closestTimeDiff = Infinity;
|
|
14936
|
+
var timeFormat = _this.props.timeFormat || "p";
|
|
14937
|
+
for (var _i = 0, timeListItems_1 = timeListItems; _i < timeListItems_1.length; _i++) {
|
|
14938
|
+
var item = timeListItems_1[_i];
|
|
14939
|
+
var itemText = (_b = item.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
14940
|
+
if (itemText) {
|
|
14941
|
+
var itemTime = parseDate(itemText, timeFormat, _this.props.locale, false, time);
|
|
14942
|
+
if (itemTime && isValid(itemTime)) {
|
|
14943
|
+
if (isSameMinute(itemTime, time)) {
|
|
14944
|
+
targetItem = item;
|
|
14945
|
+
break;
|
|
14946
|
+
}
|
|
14947
|
+
var timeDiff = Math.abs(itemTime.getTime() - time.getTime());
|
|
14948
|
+
if (timeDiff < closestTimeDiff) {
|
|
14949
|
+
closestTimeDiff = timeDiff;
|
|
14950
|
+
targetItem = item;
|
|
14951
|
+
}
|
|
14952
|
+
}
|
|
14953
|
+
}
|
|
14954
|
+
}
|
|
14955
|
+
if (targetItem) {
|
|
14956
|
+
timeListItems.forEach(function (item) {
|
|
14957
|
+
item.setAttribute("tabindex", "-1");
|
|
14958
|
+
});
|
|
14959
|
+
targetItem.setAttribute("tabindex", "0");
|
|
14960
|
+
targetItem.scrollIntoView({
|
|
14961
|
+
behavior: "smooth",
|
|
14962
|
+
block: "center",
|
|
14963
|
+
});
|
|
14964
|
+
}
|
|
14965
|
+
};
|
|
14422
14966
|
_this.onInputKeyDown = function (event) {
|
|
14423
14967
|
var _a, _b, _c, _d, _e, _f;
|
|
14424
14968
|
(_b = (_a = _this.props).onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
@@ -14433,6 +14977,18 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14433
14977
|
}
|
|
14434
14978
|
return;
|
|
14435
14979
|
}
|
|
14980
|
+
if (_this.state.open && _this.props.showTimeSelectOnly) {
|
|
14981
|
+
if (eventKey === KeyType.ArrowDown || eventKey === KeyType.ArrowUp) {
|
|
14982
|
+
event.preventDefault();
|
|
14983
|
+
_this.handleTimeOnlyArrowKey(eventKey);
|
|
14984
|
+
return;
|
|
14985
|
+
}
|
|
14986
|
+
if (eventKey === KeyType.Enter) {
|
|
14987
|
+
event.preventDefault();
|
|
14988
|
+
_this.handleTimeOnlyEnterKey(event);
|
|
14989
|
+
return;
|
|
14990
|
+
}
|
|
14991
|
+
}
|
|
14436
14992
|
// if calendar is open, these keys will focus the selected item
|
|
14437
14993
|
if (_this.state.open) {
|
|
14438
14994
|
if (eventKey === KeyType.ArrowDown || eventKey === KeyType.ArrowUp) {
|
|
@@ -14623,20 +15179,12 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14623
15179
|
_this.setSelected(newSelection);
|
|
14624
15180
|
}
|
|
14625
15181
|
_this.setPreSelection(newSelection);
|
|
14626
|
-
//
|
|
15182
|
+
// In inline mode, always set shouldFocusDayInline to true when navigating via keyboard.
|
|
15183
|
+
// This ensures focus is properly transferred to the new day element regardless of
|
|
15184
|
+
// whether the month changed. The user initiated this navigation from a focused day,
|
|
15185
|
+
// so we should always focus the destination day.
|
|
14627
15186
|
if (inline) {
|
|
14628
|
-
|
|
14629
|
-
var newMonth = getMonth(newSelection);
|
|
14630
|
-
var prevYear = getYear(copy);
|
|
14631
|
-
var newYear = getYear(newSelection);
|
|
14632
|
-
if (prevMonth !== newMonth || prevYear !== newYear) {
|
|
14633
|
-
// month has changed
|
|
14634
|
-
_this.setState({ shouldFocusDayInline: true });
|
|
14635
|
-
}
|
|
14636
|
-
else {
|
|
14637
|
-
// month hasn't changed
|
|
14638
|
-
_this.setState({ shouldFocusDayInline: false });
|
|
14639
|
-
}
|
|
15187
|
+
_this.setState({ shouldFocusDayInline: true });
|
|
14640
15188
|
}
|
|
14641
15189
|
};
|
|
14642
15190
|
// handle generic key down events in the popper that do not adjust or select dates
|
|
@@ -14683,6 +15231,9 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14683
15231
|
}
|
|
14684
15232
|
}
|
|
14685
15233
|
};
|
|
15234
|
+
_this.handleMonthSelectedInChange = function (monthSelectedIn) {
|
|
15235
|
+
_this.setState({ monthSelectedIn: monthSelectedIn });
|
|
15236
|
+
};
|
|
14686
15237
|
_this.renderCalendar = function () {
|
|
14687
15238
|
var _a, _b;
|
|
14688
15239
|
if (!_this.props.inline && !_this.isCalendarOpen()) {
|
|
@@ -14690,7 +15241,7 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14690
15241
|
}
|
|
14691
15242
|
return (React__default.createElement(Calendar, _assign({ showMonthYearDropdown: undefined, ref: function (elem) {
|
|
14692
15243
|
_this.calendar = elem;
|
|
14693
|
-
} }, _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));
|
|
15244
|
+
} }, _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));
|
|
14694
15245
|
};
|
|
14695
15246
|
_this.renderAriaLiveRegion = function () {
|
|
14696
15247
|
var _a;
|
|
@@ -14738,39 +15289,34 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14738
15289
|
};
|
|
14739
15290
|
_this.renderDateInput = function () {
|
|
14740
15291
|
var _a, _b;
|
|
15292
|
+
var _c, _d, _e, _f, _g;
|
|
14741
15293
|
var className = clsx(_this.props.className, (_a = {},
|
|
14742
15294
|
_a[_this.props.outsideClickIgnoreClass ||
|
|
14743
15295
|
DatePicker.defaultProps.outsideClickIgnoreClass] = _this.state.open,
|
|
14744
15296
|
_a));
|
|
14745
15297
|
var customInput = _this.props.customInput || React__default.createElement("input", { type: "text" });
|
|
14746
15298
|
var customInputRef = _this.props.customInputRef || "ref";
|
|
14747
|
-
|
|
14748
|
-
|
|
14749
|
-
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
|
|
14756
|
-
|
|
14757
|
-
|
|
14758
|
-
|
|
14759
|
-
|
|
14760
|
-
|
|
14761
|
-
|
|
14762
|
-
|
|
14763
|
-
|
|
14764
|
-
|
|
14765
|
-
|
|
14766
|
-
|
|
14767
|
-
|
|
14768
|
-
_b.tabIndex = _this.props.tabIndex,
|
|
14769
|
-
_b["aria-describedby"] = _this.props.ariaDescribedBy,
|
|
14770
|
-
_b["aria-invalid"] = _this.props.ariaInvalid,
|
|
14771
|
-
_b["aria-labelledby"] = _this.props.ariaLabelledBy,
|
|
14772
|
-
_b["aria-required"] = _this.props.ariaRequired,
|
|
14773
|
-
_b));
|
|
15299
|
+
// Build aria props object, only including defined values to avoid
|
|
15300
|
+
// overwriting aria attributes that may be set on the custom input
|
|
15301
|
+
var ariaProps = {};
|
|
15302
|
+
var ariaDescribedBy = (_c = _this.props["aria-describedby"]) !== null && _c !== void 0 ? _c : _this.props.ariaDescribedBy;
|
|
15303
|
+
var ariaInvalid = (_d = _this.props["aria-invalid"]) !== null && _d !== void 0 ? _d : _this.props.ariaInvalid;
|
|
15304
|
+
var ariaLabel = (_e = _this.props["aria-label"]) !== null && _e !== void 0 ? _e : _this.props.ariaLabel;
|
|
15305
|
+
var ariaLabelledBy = (_f = _this.props["aria-labelledby"]) !== null && _f !== void 0 ? _f : _this.props.ariaLabelledBy;
|
|
15306
|
+
var ariaRequired = (_g = _this.props["aria-required"]) !== null && _g !== void 0 ? _g : _this.props.ariaRequired;
|
|
15307
|
+
if (ariaDescribedBy != null)
|
|
15308
|
+
ariaProps["aria-describedby"] = ariaDescribedBy;
|
|
15309
|
+
if (ariaInvalid != null)
|
|
15310
|
+
ariaProps["aria-invalid"] = ariaInvalid;
|
|
15311
|
+
if (ariaLabel != null)
|
|
15312
|
+
ariaProps["aria-label"] = ariaLabel;
|
|
15313
|
+
if (ariaLabelledBy != null)
|
|
15314
|
+
ariaProps["aria-labelledby"] = ariaLabelledBy;
|
|
15315
|
+
if (ariaRequired != null)
|
|
15316
|
+
ariaProps["aria-required"] = ariaRequired;
|
|
15317
|
+
return cloneElement(customInput, _assign((_b = {}, _b[customInputRef] = function (input) {
|
|
15318
|
+
_this.input = input;
|
|
15319
|
+
}, _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));
|
|
14774
15320
|
};
|
|
14775
15321
|
_this.renderClearButton = function () {
|
|
14776
15322
|
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;
|
|
@@ -14850,14 +15396,30 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14850
15396
|
};
|
|
14851
15397
|
DatePicker.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
14852
15398
|
var _a, _b, _c, _d;
|
|
14853
|
-
|
|
14854
|
-
|
|
15399
|
+
// Update preSelection when selected/startDate prop changes to a different month/year.
|
|
15400
|
+
// This ensures the calendar view updates when dates are programmatically set
|
|
15401
|
+
// (e.g., via "Today" or "This Week" buttons). (Fix for #3367)
|
|
15402
|
+
if (this.props.selectsRange &&
|
|
15403
|
+
hasPreSelectionChanged(prevProps.startDate, this.props.startDate)) {
|
|
15404
|
+
this.setPreSelection(this.props.startDate);
|
|
15405
|
+
}
|
|
15406
|
+
else if (hasPreSelectionChanged(prevProps.selected, this.props.selected)) {
|
|
14855
15407
|
this.setPreSelection(this.props.selected);
|
|
14856
15408
|
}
|
|
14857
15409
|
if (this.state.monthSelectedIn !== undefined &&
|
|
14858
15410
|
prevProps.monthsShown !== this.props.monthsShown) {
|
|
14859
15411
|
this.setState({ monthSelectedIn: 0 });
|
|
14860
15412
|
}
|
|
15413
|
+
// Reset monthSelectedIn when calendar opens for range selection
|
|
15414
|
+
// This ensures startDate is displayed as the first month when reopening
|
|
15415
|
+
// (Fix for #5939), but we don't reset during active selection to avoid
|
|
15416
|
+
// the view jumping when clicking dates in the second calendar (Fix for #5275)
|
|
15417
|
+
if (this.props.selectsRange &&
|
|
15418
|
+
prevState.open === false &&
|
|
15419
|
+
this.state.open === true &&
|
|
15420
|
+
this.state.monthSelectedIn !== 0) {
|
|
15421
|
+
this.setState({ monthSelectedIn: 0 });
|
|
15422
|
+
}
|
|
14861
15423
|
if (prevProps.highlightDates !== this.props.highlightDates) {
|
|
14862
15424
|
this.setState({
|
|
14863
15425
|
highlightDates: getHighLightDaysMap(this.props.highlightDates),
|
|
@@ -14907,11 +15469,11 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14907
15469
|
if (this.state.open && this.props.portalId) {
|
|
14908
15470
|
portalContainer = (React__default.createElement(Portal, _assign({ portalId: this.props.portalId }, this.props), portalContainer));
|
|
14909
15471
|
}
|
|
14910
|
-
return (React__default.createElement(
|
|
15472
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
14911
15473
|
this.renderInputContainer(),
|
|
14912
15474
|
portalContainer));
|
|
14913
15475
|
}
|
|
14914
|
-
return (React__default.createElement(PopperComponent
|
|
15476
|
+
return (React__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 })));
|
|
14915
15477
|
};
|
|
14916
15478
|
return DatePicker;
|
|
14917
15479
|
}(Component));
|
|
@@ -15316,4 +15878,4 @@ var InlineDatePicker = function (props) {
|
|
|
15316
15878
|
};
|
|
15317
15879
|
|
|
15318
15880
|
export { DatePickerGroup as D, HelperText as H, InlineDatePicker as I, ValidationText as V };
|
|
15319
|
-
//# sourceMappingURL=InlineDatePicker-
|
|
15881
|
+
//# sourceMappingURL=InlineDatePicker-XiMGS9jI.js.map
|