@cerebruminc/cerebellum 16.5.3-beta.dangerous.0d1dd37 → 16.5.3-beta.dangerous.2df6625

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.
@@ -4,7 +4,7 @@ require('./_tslib-ByDtMVOd.js');
4
4
  require('react/jsx-runtime');
5
5
  require('dayjs');
6
6
  require('react');
7
- var InlineDatePicker = require('./InlineDatePicker-4u82zKn2.js');
7
+ var InlineDatePicker = require('./InlineDatePicker-BJZXMxnh.js');
8
8
  require('./colors.cjs');
9
9
  require('./pressedEnter.cjs');
10
10
  require('./IconComponentStyles-oUWNoaaH.js');
package/lib/cjs/index.cjs CHANGED
@@ -31,7 +31,7 @@ var ConfirmModal = require('./ConfirmModal-DRAHS2B-.js');
31
31
  var CreditCardInput = require('./CreditCardInput-BDjEe_7W.js');
32
32
  var CurrencyInput = require('./CurrencyInput-l3tjN6Be.js');
33
33
  var DatePicker = require('./DatePicker.cjs');
34
- var InlineDatePicker = require('./InlineDatePicker-4u82zKn2.js');
34
+ var InlineDatePicker = require('./InlineDatePicker-BJZXMxnh.js');
35
35
  var DescriptiveSwitchMenu = require('./DescriptiveSwitchMenu-CoKpD5jf.js');
36
36
  var SwitchTypeEnum = require('./SwitchTypeEnum.cjs');
37
37
  var InlineInput = require('./InlineInput-C6y8SRJf.js');
@@ -44,7 +44,7 @@ var helpers$1 = require('./helpers-BBAfnycp.js');
44
44
  var DrawerDivider = require('./DrawerDivider-Dk2WXbXa.js');
45
45
  var EmailInput = require('./EmailInput-B47NyBrl.js');
46
46
  var Footer = require('./Footer.cjs');
47
- var FormikContainer = require('./FormikContainer-6Ou67s1T.js');
47
+ var FormikContainer = require('./FormikContainer-Dn3lu30W.js');
48
48
  var FormFieldTypeEnum = require('./FormFieldTypeEnum.cjs');
49
49
  var FiltersBar = require('./FiltersBar-BWs83vhr.js');
50
50
  var HorizontalTabMenu = require('./HorizontalTabMenu-B0VfB6Jb.js');
@@ -1,7 +1,7 @@
1
1
  import { _ as __assign } from './_tslib-CcAXazg4.js';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { useRef, useState, useEffect } from 'react';
4
- import { D as DatePickerGroup, I as InlineDatePicker, V as ValidationText, H as HelperText } from './InlineDatePicker-RlV9iC8j.js';
4
+ import { D as DatePickerGroup, I as InlineDatePicker, V as ValidationText, H as HelperText } from './InlineDatePicker-BIAcoggL.js';
5
5
  import { u as useMeasure } from './useMeasure-D89v6c_A.js';
6
6
  import { s as showLabel } from './showLabel-ClyqCGfq.js';
7
7
  import { L as LabelBox, A as Asterisk } from './Inputs-DIweV8Nj.js';
package/lib/esm/Form.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { F as FormWrapper } from './FormStyles-DCnDnD_Z.js';
2
- export { F as Form } from './FormikContainer-Ck23Sm9I.js';
2
+ export { F as Form } from './FormikContainer-Brcmku_E.js';
3
3
  export { FormFieldTypeEnum, RemovableFieldTypeEnum, isAddress, isCheckbox, isCheckboxGroup, isColorPicker, isConfigurableInput, isCountrySelect, isCountySelect, isCreditCard, isCurrency, isDatePicker, isDescriptiveDropdownInput, isEmail, isFormFieldType, isImagePicker, isMultiSelect, isNationalitySelect, isNumber, isPassword, isPhone, isRadioGroup, isRemovable, isSectionHeader, isSelect, isSocialSecurity, isSplitLine, isStateSelect, isTextarea, isToggle, isToggleGroup, isZipCode } from './FormFieldTypeEnum.js';
4
4
  import './_tslib-CcAXazg4.js';
5
5
  import 'styled-components';
@@ -94,7 +94,7 @@ import './cardValidationStateMachine.js';
94
94
  import './CurrencyInput-g7xr2KNu.js';
95
95
  import './InlineCurrencyInput-DwKvGpUL.js';
96
96
  import './DatePicker.js';
97
- import './InlineDatePicker-RlV9iC8j.js';
97
+ import './InlineDatePicker-BIAcoggL.js';
98
98
  import './Calendar.js';
99
99
  import './ClickOutHandler-CcKVoXIs.js';
100
100
  import './CaretLeft.js';
@@ -38,7 +38,7 @@ import { C as CurrencyInput } from './CurrencyInput-g7xr2KNu.js';
38
38
  import { I as InlineCurrencyInput } from './InlineCurrencyInput-DwKvGpUL.js';
39
39
  import { getFloatValueFromString } from './formatBytesToString.js';
40
40
  import { DatePicker } from './DatePicker.js';
41
- import { I as InlineDatePicker } from './InlineDatePicker-RlV9iC8j.js';
41
+ import { I as InlineDatePicker } from './InlineDatePicker-BIAcoggL.js';
42
42
  import './CheckboxStyles-Cx6hCn3t.js';
43
43
  import './RadioStyles-CjeGoQU0.js';
44
44
  import './ToggleStyles-DxTKSAXl.js';
@@ -1610,4 +1610,4 @@ var FormikContainer = function (props) {
1610
1610
  };
1611
1611
 
1612
1612
  export { FormikContainer as F, NationalityDropdown as N, nationalityList as n };
1613
- //# sourceMappingURL=FormikContainer-Ck23Sm9I.js.map
1613
+ //# sourceMappingURL=FormikContainer-Brcmku_E.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormikContainer-Ck23Sm9I.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -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, useCallback, useEffect, createElement, useState, forwardRef } from 'react';
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';
@@ -9672,7 +9672,7 @@ function useFloating(options) {
9672
9672
  }
9673
9673
 
9674
9674
  /*!
9675
- react-datepicker v8.8.0
9675
+ react-datepicker v8.10.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-label": ariaLabel, "aria-modal": "true" }, children));
9743
+ return (React__default.createElement("div", { className: className, "aria-label": ariaLabel, role: inline ? undefined : "dialog", "aria-modal": inline ? undefined : "true" }, 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
- onClickOutsideRef.current = onClickOutside;
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 &&
@@ -10452,6 +10454,7 @@ function isTimeInDisabledRange(time, _a) {
10452
10454
  valid = !isWithinInterval(baseTime, { start: min, end: max });
10453
10455
  }
10454
10456
  catch (err) {
10457
+ /* istanbul ignore next - date-fns historically threw on invalid intervals */
10455
10458
  valid = false;
10456
10459
  }
10457
10460
  return valid;
@@ -11755,7 +11758,12 @@ var Month$1 = /** @class */ (function (_super) {
11755
11758
  });
11756
11759
  };
11757
11760
  _this.isSelectedQuarter = function (day, q, selected) {
11758
- return getQuarter(day) === q && getYear(day) === getYear(selected);
11761
+ return getQuarter(selected) === q && getYear(day) === getYear(selected);
11762
+ };
11763
+ _this.isSelectQuarterInList = function (day, q, selectedDates) {
11764
+ return selectedDates.some(function (selectedDate) {
11765
+ return _this.isSelectedQuarter(day, q, selectedDate);
11766
+ });
11759
11767
  };
11760
11768
  _this.isMonthSelected = function () {
11761
11769
  var _a = _this.props, day = _a.day, selected = _a.selected, selectedDates = _a.selectedDates, selectsMultiple = _a.selectsMultiple;
@@ -11767,7 +11775,21 @@ var Month$1 = /** @class */ (function (_super) {
11767
11775
  }
11768
11776
  return !!selected && _this.isSelectedMonth(day, monthIdx, selected);
11769
11777
  };
11778
+ _this.isQuarterSelected = function () {
11779
+ var _a = _this.props, day = _a.day, selected = _a.selected, selectedDates = _a.selectedDates, selectsMultiple = _a.selectsMultiple;
11780
+ var quarterIdx = getQuarter(day);
11781
+ if (selectsMultiple) {
11782
+ return selectedDates === null || selectedDates === void 0 ? void 0 : selectedDates.some(function (selectedDate) {
11783
+ return _this.isSelectedQuarter(day, quarterIdx, selectedDate);
11784
+ });
11785
+ }
11786
+ return !!selected && _this.isSelectedQuarter(day, quarterIdx, selected);
11787
+ };
11770
11788
  _this.renderWeeks = function () {
11789
+ // Return empty array if day is invalid
11790
+ if (!isValid(_this.props.day)) {
11791
+ return [];
11792
+ }
11771
11793
  var weeks = [];
11772
11794
  var isFixedHeight = _this.props.fixedHeight;
11773
11795
  var i = 0;
@@ -12064,7 +12086,7 @@ var Month$1 = /** @class */ (function (_super) {
12064
12086
  return "".concat(prefix, " ").concat(formatDate(labelDate, "MMMM yyyy", locale));
12065
12087
  };
12066
12088
  _this.getQuarterClassNames = function (q) {
12067
- var _a = _this.props, day = _a.day, startDate = _a.startDate, endDate = _a.endDate, selected = _a.selected, minDate = _a.minDate, maxDate = _a.maxDate, excludeDates = _a.excludeDates, includeDates = _a.includeDates, filterDate = _a.filterDate, preSelection = _a.preSelection, disabledKeyboardNavigation = _a.disabledKeyboardNavigation, disabled = _a.disabled;
12089
+ 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
12090
  var isDisabled = (minDate ||
12069
12091
  maxDate ||
12070
12092
  excludeDates ||
@@ -12072,14 +12094,16 @@ var Month$1 = /** @class */ (function (_super) {
12072
12094
  filterDate ||
12073
12095
  disabled) &&
12074
12096
  isQuarterDisabled(setQuarter(day, q), _this.props);
12097
+ var selection = _this.getSelection();
12075
12098
  return clsx("react-datepicker__quarter-text", "react-datepicker__quarter-".concat(q), {
12076
12099
  "react-datepicker__quarter-text--disabled": isDisabled,
12077
- "react-datepicker__quarter-text--selected": selected
12078
- ? _this.isSelectedQuarter(day, q, selected)
12100
+ "react-datepicker__quarter-text--selected": selection
12101
+ ? _this.isSelectQuarterInList(day, q, selection)
12079
12102
  : undefined,
12080
12103
  "react-datepicker__quarter-text--keyboard-selected": !disabledKeyboardNavigation &&
12081
12104
  preSelection &&
12082
12105
  _this.isSelectedQuarter(day, q, preSelection) &&
12106
+ !_this.isQuarterSelected() &&
12083
12107
  !isDisabled,
12084
12108
  "react-datepicker__quarter-text--in-selecting-range": _this.isInSelectingRangeQuarter(q),
12085
12109
  "react-datepicker__quarter-text--in-range": startDate && endDate
@@ -12159,14 +12183,18 @@ var Month$1 = /** @class */ (function (_super) {
12159
12183
  var formattedAriaLabelPrefix = ariaLabelPrefix
12160
12184
  ? ariaLabelPrefix.trim() + " "
12161
12185
  : "";
12186
+ // Format aria-label, return empty string if date is invalid
12187
+ var formattedAriaLabel = isValid(day)
12188
+ ? "".concat(formattedAriaLabelPrefix).concat(formatDate(day, "MMMM, yyyy", this.props.locale))
12189
+ : "";
12162
12190
  var shouldUseListboxRole = showMonthYearPicker || showQuarterYearPicker;
12163
12191
  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": "".concat(formattedAriaLabelPrefix).concat(formatDate(day, "MMMM, yyyy", this.props.locale)), role: "listbox" }, showMonthYearPicker ? this.renderMonths() : this.renderQuarters()));
12192
+ 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
12193
  }
12166
12194
  // For regular calendar view, use table structure
12167
12195
  return (React__default.createElement("div", { role: "table" },
12168
12196
  this.props.dayNamesHeader && (React__default.createElement("div", { role: "rowgroup" }, this.props.dayNamesHeader)),
12169
- React__default.createElement("div", { className: this.getClassNames(), onMouseLeave: !this.props.usePointerEvent ? this.handleMouseLeave : undefined, onPointerLeave: this.props.usePointerEvent ? this.handleMouseLeave : undefined, "aria-label": "".concat(formattedAriaLabelPrefix).concat(formatDate(day, "MMMM, yyyy", this.props.locale)), role: "rowgroup" }, this.renderWeeks())));
12197
+ 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())));
12170
12198
  };
12171
12199
  return Month;
12172
12200
  }(Component));
@@ -13266,6 +13294,10 @@ var Calendar = /** @class */ (function (_super) {
13266
13294
  };
13267
13295
  _this.header = function (date) {
13268
13296
  if (date === void 0) { date = _this.state.date; }
13297
+ // Return empty array if date is invalid
13298
+ if (!isValid(date)) {
13299
+ return [];
13300
+ }
13269
13301
  var disabled = _this.props.disabled;
13270
13302
  var startOfWeek = getStartOfWeek(date, _this.props.locale, _this.props.calendarStartDay);
13271
13303
  var dayNames = [];
@@ -13460,7 +13492,9 @@ var Calendar = /** @class */ (function (_super) {
13460
13492
  if (_this.props.showMonthYearDropdown) {
13461
13493
  classes.push("react-datepicker__current-month--hasMonthYearDropdown");
13462
13494
  }
13463
- return (React__default.createElement("h2", { className: classes.join(" ") }, formatDate(date, _this.props.dateFormat, _this.props.locale)));
13495
+ return (React__default.createElement("h2", { className: classes.join(" ") }, isValid(date)
13496
+ ? formatDate(date, _this.props.dateFormat, _this.props.locale)
13497
+ : ""));
13464
13498
  };
13465
13499
  _this.renderYearDropdown = function (overrideHide) {
13466
13500
  if (overrideHide === void 0) { overrideHide = false; }
@@ -13610,6 +13644,10 @@ var Calendar = /** @class */ (function (_super) {
13610
13644
  };
13611
13645
  _this.renderAriaLiveRegion = function () {
13612
13646
  var _a;
13647
+ // Don't render aria-live message if date is invalid
13648
+ if (!isValid(_this.state.date)) {
13649
+ return (React__default.createElement("span", { role: "alert", "aria-live": "polite", className: "react-datepicker__aria-live" }));
13650
+ }
13613
13651
  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
13652
  var ariaLiveMessage;
13615
13653
  if (_this.props.showYearPicker) {
@@ -13671,6 +13709,7 @@ var Calendar = /** @class */ (function (_super) {
13671
13709
  Calendar.prototype.componentDidUpdate = function (prevProps) {
13672
13710
  var _this = this;
13673
13711
  if (this.props.preSelection &&
13712
+ isValid(this.props.preSelection) &&
13674
13713
  (!isSameDay(this.props.preSelection, prevProps.preSelection) ||
13675
13714
  this.props.monthSelectedIn !== prevProps.monthSelectedIn)) {
13676
13715
  var hasMonthChanged_1 = !isSameMonth(this.state.date, this.props.preSelection);
@@ -13691,7 +13730,7 @@ var Calendar = /** @class */ (function (_super) {
13691
13730
  React__default.createElement("div", { style: { display: "contents" }, ref: this.containerRef },
13692
13731
  React__default.createElement(Container, { className: clsx("react-datepicker", this.props.className, {
13693
13732
  "react-datepicker--time-only": this.props.showTimeSelectOnly,
13694
- }), showTime: this.props.showTimeSelect || this.props.showTimeInput, showTimeSelectOnly: this.props.showTimeSelectOnly },
13733
+ }), showTime: this.props.showTimeSelect || this.props.showTimeInput, showTimeSelectOnly: this.props.showTimeSelectOnly, inline: this.props.inline },
13695
13734
  this.renderAriaLiveRegion(),
13696
13735
  this.renderPreviousButton(),
13697
13736
  this.renderNextButton(),
@@ -13885,6 +13924,7 @@ function withFloating(Component) {
13885
13924
  var floatingProps = useFloating(_assign({ open: !hidePopper, whileElementsMounted: autoUpdate, placement: props.popperPlacement, middleware: __spreadArray([
13886
13925
  flip({ padding: 15 }),
13887
13926
  offset(10),
13927
+ // eslint-disable-next-line react-hooks/refs -- Floating UI requires refs to be passed during render
13888
13928
  arrow({ element: arrowRef })
13889
13929
  ], ((_a = props.popperModifiers) !== null && _a !== void 0 ? _a : []), true) }, props.popperProps));
13890
13930
  var componentProps = _assign(_assign({}, props), { hidePopper: hidePopper, popperProps: _assign(_assign({}, floatingProps), { arrowRef: arrowRef }) });
@@ -13895,7 +13935,7 @@ function withFloating(Component) {
13895
13935
  }
13896
13936
 
13897
13937
  // Exported for testing purposes
13898
- var PopperComponent = function (props) {
13938
+ var PopperComponent$1 = function (props) {
13899
13939
  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;
13900
13940
  var popper = undefined;
13901
13941
  if (!hidePopper) {
@@ -13916,7 +13956,7 @@ var PopperComponent = function (props) {
13916
13956
  React__default.createElement("div", { ref: popperProps.refs.setReference, className: wrapperClasses }, targetComponent),
13917
13957
  popper));
13918
13958
  };
13919
- var PopperComponent$1 = withFloating(PopperComponent);
13959
+ var PopperComponent = withFloating(PopperComponent$1);
13920
13960
 
13921
13961
  // Compares dates year+month combinations
13922
13962
  function hasPreSelectionChanged(date1, date2) {
@@ -14419,6 +14459,117 @@ var DatePicker = /** @class */ (function (_super) {
14419
14459
  }
14420
14460
  (_b = (_a = _this.props).onInputClick) === null || _b === void 0 ? void 0 : _b.call(_a);
14421
14461
  };
14462
+ _this.handleTimeOnlyArrowKey = function (eventKey) {
14463
+ var _a, _b, _c, _d;
14464
+ var currentTime = _this.props.selected || _this.state.preSelection || newDate();
14465
+ var timeIntervals = (_a = _this.props.timeIntervals) !== null && _a !== void 0 ? _a : 30;
14466
+ var dateFormat = (_b = _this.props.dateFormat) !== null && _b !== void 0 ? _b : DatePicker.defaultProps.dateFormat;
14467
+ var formatStr = Array.isArray(dateFormat) ? dateFormat[0] : dateFormat;
14468
+ var baseDate = getStartOfDay(currentTime);
14469
+ var currentMinutes = getHours(currentTime) * 60 + getMinutes(currentTime);
14470
+ var maxMinutes = 23 * 60 + 60 - timeIntervals; // Cap at last valid interval of the day
14471
+ var newTime;
14472
+ if (eventKey === KeyType.ArrowUp) {
14473
+ var newMinutes = Math.max(0, currentMinutes - timeIntervals);
14474
+ newTime = addMinutes(baseDate, newMinutes);
14475
+ }
14476
+ else {
14477
+ var newMinutes = Math.min(maxMinutes, currentMinutes + timeIntervals);
14478
+ newTime = addMinutes(baseDate, newMinutes);
14479
+ }
14480
+ var formattedTime = formatDate(newTime, formatStr || DatePicker.defaultProps.dateFormat, _this.props.locale);
14481
+ _this.setState({
14482
+ preSelection: newTime,
14483
+ inputValue: formattedTime,
14484
+ });
14485
+ if (_this.props.selectsRange || _this.props.selectsMultiple) {
14486
+ return;
14487
+ }
14488
+ var selected = _this.props.selected
14489
+ ? _this.props.selected
14490
+ : _this.getPreSelection();
14491
+ var changedDate = _this.props.selected
14492
+ ? newTime
14493
+ : setTime(selected, {
14494
+ hour: getHours(newTime),
14495
+ minute: getMinutes(newTime),
14496
+ });
14497
+ (_d = (_c = _this.props).onChange) === null || _d === void 0 ? void 0 : _d.call(_c, changedDate);
14498
+ if (_this.props.showTimeSelectOnly || _this.props.showTimeSelect) {
14499
+ _this.setState({ isRenderAriaLiveMessage: true });
14500
+ }
14501
+ requestAnimationFrame(function () {
14502
+ _this.scrollToTimeOption(newTime);
14503
+ });
14504
+ };
14505
+ _this.handleTimeOnlyEnterKey = function (event) {
14506
+ var _a, _b, _c, _d;
14507
+ var inputElement = event.target;
14508
+ var inputValue = inputElement.value;
14509
+ var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
14510
+ var timeFormat = _this.props.timeFormat || "p";
14511
+ var defaultTime = _this.state.preSelection || _this.props.selected || newDate();
14512
+ var parsedDate = parseDate(inputValue, dateFormat, _this.props.locale, (_b = _this.props.strictParsing) !== null && _b !== void 0 ? _b : false, defaultTime);
14513
+ var timeToCommit = defaultTime;
14514
+ if (parsedDate && isValid(parsedDate)) {
14515
+ timeToCommit = parsedDate;
14516
+ }
14517
+ else {
14518
+ var highlightedItem = ((_c = _this.calendar) === null || _c === void 0 ? void 0 : _c.containerRef.current) instanceof Element &&
14519
+ _this.calendar.containerRef.current.querySelector(".react-datepicker__time-list-item[tabindex='0']");
14520
+ if (highlightedItem instanceof HTMLElement) {
14521
+ var itemText = (_d = highlightedItem.textContent) === null || _d === void 0 ? void 0 : _d.trim();
14522
+ if (itemText) {
14523
+ var itemTime = parseDate(itemText, timeFormat, _this.props.locale, false, defaultTime);
14524
+ if (itemTime && isValid(itemTime)) {
14525
+ timeToCommit = itemTime;
14526
+ }
14527
+ }
14528
+ }
14529
+ }
14530
+ _this.handleTimeChange(timeToCommit);
14531
+ _this.setOpen(false);
14532
+ _this.sendFocusBackToInput();
14533
+ };
14534
+ _this.scrollToTimeOption = function (time) {
14535
+ var _a, _b;
14536
+ if (!((_a = _this.calendar) === null || _a === void 0 ? void 0 : _a.containerRef.current)) {
14537
+ return;
14538
+ }
14539
+ var container = _this.calendar.containerRef.current;
14540
+ var timeListItems = Array.from(container.querySelectorAll(".react-datepicker__time-list-item"));
14541
+ var targetItem = null;
14542
+ var closestTimeDiff = Infinity;
14543
+ var timeFormat = _this.props.timeFormat || "p";
14544
+ for (var _i = 0, timeListItems_1 = timeListItems; _i < timeListItems_1.length; _i++) {
14545
+ var item = timeListItems_1[_i];
14546
+ var itemText = (_b = item.textContent) === null || _b === void 0 ? void 0 : _b.trim();
14547
+ if (itemText) {
14548
+ var itemTime = parseDate(itemText, timeFormat, _this.props.locale, false, time);
14549
+ if (itemTime && isValid(itemTime)) {
14550
+ if (isSameMinute(itemTime, time)) {
14551
+ targetItem = item;
14552
+ break;
14553
+ }
14554
+ var timeDiff = Math.abs(itemTime.getTime() - time.getTime());
14555
+ if (timeDiff < closestTimeDiff) {
14556
+ closestTimeDiff = timeDiff;
14557
+ targetItem = item;
14558
+ }
14559
+ }
14560
+ }
14561
+ }
14562
+ if (targetItem) {
14563
+ timeListItems.forEach(function (item) {
14564
+ item.setAttribute("tabindex", "-1");
14565
+ });
14566
+ targetItem.setAttribute("tabindex", "0");
14567
+ targetItem.scrollIntoView({
14568
+ behavior: "smooth",
14569
+ block: "center",
14570
+ });
14571
+ }
14572
+ };
14422
14573
  _this.onInputKeyDown = function (event) {
14423
14574
  var _a, _b, _c, _d, _e, _f;
14424
14575
  (_b = (_a = _this.props).onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a, event);
@@ -14433,6 +14584,18 @@ var DatePicker = /** @class */ (function (_super) {
14433
14584
  }
14434
14585
  return;
14435
14586
  }
14587
+ if (_this.state.open && _this.props.showTimeSelectOnly) {
14588
+ if (eventKey === KeyType.ArrowDown || eventKey === KeyType.ArrowUp) {
14589
+ event.preventDefault();
14590
+ _this.handleTimeOnlyArrowKey(eventKey);
14591
+ return;
14592
+ }
14593
+ if (eventKey === KeyType.Enter) {
14594
+ event.preventDefault();
14595
+ _this.handleTimeOnlyEnterKey(event);
14596
+ return;
14597
+ }
14598
+ }
14436
14599
  // if calendar is open, these keys will focus the selected item
14437
14600
  if (_this.state.open) {
14438
14601
  if (eventKey === KeyType.ArrowDown || eventKey === KeyType.ArrowUp) {
@@ -14623,20 +14786,12 @@ var DatePicker = /** @class */ (function (_super) {
14623
14786
  _this.setSelected(newSelection);
14624
14787
  }
14625
14788
  _this.setPreSelection(newSelection);
14626
- // need to figure out whether month has changed to focus day in inline version
14789
+ // In inline mode, always set shouldFocusDayInline to true when navigating via keyboard.
14790
+ // This ensures focus is properly transferred to the new day element regardless of
14791
+ // whether the month changed. The user initiated this navigation from a focused day,
14792
+ // so we should always focus the destination day.
14627
14793
  if (inline) {
14628
- var prevMonth = getMonth(copy);
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
- }
14794
+ _this.setState({ shouldFocusDayInline: true });
14640
14795
  }
14641
14796
  };
14642
14797
  // handle generic key down events in the popper that do not adjust or select dates
@@ -14738,39 +14893,31 @@ var DatePicker = /** @class */ (function (_super) {
14738
14893
  };
14739
14894
  _this.renderDateInput = function () {
14740
14895
  var _a, _b;
14896
+ var _c, _d, _e, _f;
14741
14897
  var className = clsx(_this.props.className, (_a = {},
14742
14898
  _a[_this.props.outsideClickIgnoreClass ||
14743
14899
  DatePicker.defaultProps.outsideClickIgnoreClass] = _this.state.open,
14744
14900
  _a));
14745
14901
  var customInput = _this.props.customInput || React__default.createElement("input", { type: "text" });
14746
14902
  var customInputRef = _this.props.customInputRef || "ref";
14747
- return cloneElement(customInput, (_b = {},
14748
- _b[customInputRef] = function (input) {
14749
- _this.input = input;
14750
- },
14751
- _b.value = _this.getInputValue(),
14752
- _b.onBlur = _this.handleBlur,
14753
- _b.onChange = _this.handleChange,
14754
- _b.onClick = _this.onInputClick,
14755
- _b.onFocus = _this.handleFocus,
14756
- _b.onKeyDown = _this.onInputKeyDown,
14757
- _b.id = _this.props.id,
14758
- _b.name = _this.props.name,
14759
- _b.form = _this.props.form,
14760
- _b.autoFocus = _this.props.autoFocus,
14761
- _b.placeholder = _this.props.placeholderText,
14762
- _b.disabled = _this.props.disabled,
14763
- _b.autoComplete = _this.props.autoComplete,
14764
- _b.className = clsx(customInput.props.className, className),
14765
- _b.title = _this.props.title,
14766
- _b.readOnly = _this.props.readOnly,
14767
- _b.required = _this.props.required,
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));
14903
+ // Build aria props object, only including defined values to avoid
14904
+ // overwriting aria attributes that may be set on the custom input
14905
+ var ariaProps = {};
14906
+ var ariaDescribedBy = (_c = _this.props["aria-describedby"]) !== null && _c !== void 0 ? _c : _this.props.ariaDescribedBy;
14907
+ var ariaInvalid = (_d = _this.props["aria-invalid"]) !== null && _d !== void 0 ? _d : _this.props.ariaInvalid;
14908
+ var ariaLabelledBy = (_e = _this.props["aria-labelledby"]) !== null && _e !== void 0 ? _e : _this.props.ariaLabelledBy;
14909
+ var ariaRequired = (_f = _this.props["aria-required"]) !== null && _f !== void 0 ? _f : _this.props.ariaRequired;
14910
+ if (ariaDescribedBy != null)
14911
+ ariaProps["aria-describedby"] = ariaDescribedBy;
14912
+ if (ariaInvalid != null)
14913
+ ariaProps["aria-invalid"] = ariaInvalid;
14914
+ if (ariaLabelledBy != null)
14915
+ ariaProps["aria-labelledby"] = ariaLabelledBy;
14916
+ if (ariaRequired != null)
14917
+ ariaProps["aria-required"] = ariaRequired;
14918
+ return cloneElement(customInput, _assign((_b = {}, _b[customInputRef] = function (input) {
14919
+ _this.input = input;
14920
+ }, _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
14921
  };
14775
14922
  _this.renderClearButton = function () {
14776
14923
  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;
@@ -14858,6 +15005,9 @@ var DatePicker = /** @class */ (function (_super) {
14858
15005
  prevProps.monthsShown !== this.props.monthsShown) {
14859
15006
  this.setState({ monthSelectedIn: 0 });
14860
15007
  }
15008
+ if (this.props.selectsRange && this.state.monthSelectedIn !== 0) {
15009
+ this.setState({ monthSelectedIn: 0 });
15010
+ }
14861
15011
  if (prevProps.highlightDates !== this.props.highlightDates) {
14862
15012
  this.setState({
14863
15013
  highlightDates: getHighLightDaysMap(this.props.highlightDates),
@@ -14911,7 +15061,7 @@ var DatePicker = /** @class */ (function (_super) {
14911
15061
  this.renderInputContainer(),
14912
15062
  portalContainer));
14913
15063
  }
14914
- return (React__default.createElement(PopperComponent$1, _assign({}, this.props, { className: this.props.popperClassName, hidePopper: !this.isCalendarOpen(), targetComponent: this.renderInputContainer(), popperComponent: calendar, popperOnKeyDown: this.onPopperKeyDown, showArrow: this.props.showPopperArrow })));
15064
+ 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 })));
14915
15065
  };
14916
15066
  return DatePicker;
14917
15067
  }(Component));
@@ -15316,4 +15466,4 @@ var InlineDatePicker = function (props) {
15316
15466
  };
15317
15467
 
15318
15468
  export { DatePickerGroup as D, HelperText as H, InlineDatePicker as I, ValidationText as V };
15319
- //# sourceMappingURL=InlineDatePicker-RlV9iC8j.js.map
15469
+ //# sourceMappingURL=InlineDatePicker-BIAcoggL.js.map