@cerebruminc/cerebellum 16.0.0-beta.dangerous.a3d7575 → 16.0.0-beta.dangerous.aae8e29

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.
@@ -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, createElement, cloneElement, createRef, Component, useRef, useCallback, useEffect, 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';
@@ -7497,40 +7497,34 @@ function isShadowRoot(value) {
7497
7497
  }
7498
7498
  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
7499
7499
  }
7500
- const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
7501
7500
  function isOverflowElement(element) {
7502
7501
  const {
7503
7502
  overflow,
7504
7503
  overflowX,
7505
7504
  overflowY,
7506
7505
  display
7507
- } = getComputedStyle$1(element);
7508
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
7506
+ } = getComputedStyle(element);
7507
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
7509
7508
  }
7510
- const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
7511
7509
  function isTableElement(element) {
7512
- return tableElements.has(getNodeName(element));
7510
+ return ['table', 'td', 'th'].includes(getNodeName(element));
7513
7511
  }
7514
- const topLayerSelectors = [':popover-open', ':modal'];
7515
7512
  function isTopLayer(element) {
7516
- return topLayerSelectors.some(selector => {
7513
+ return [':popover-open', ':modal'].some(selector => {
7517
7514
  try {
7518
7515
  return element.matches(selector);
7519
- } catch (_e) {
7516
+ } catch (e) {
7520
7517
  return false;
7521
7518
  }
7522
7519
  });
7523
7520
  }
7524
- const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
7525
- const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
7526
- const containValues = ['paint', 'layout', 'strict', 'content'];
7527
7521
  function isContainingBlock(elementOrCss) {
7528
7522
  const webkit = isWebKit();
7529
- const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
7523
+ const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
7530
7524
 
7531
7525
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
7532
7526
  // https://drafts.csswg.org/css-transforms-2/#individual-transforms
7533
- return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
7527
+ return ['transform', 'translate', 'scale', 'rotate', 'perspective'].some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
7534
7528
  }
7535
7529
  function getContainingBlock(element) {
7536
7530
  let currentNode = getParentNode(element);
@@ -7548,11 +7542,10 @@ function isWebKit() {
7548
7542
  if (typeof CSS === 'undefined' || !CSS.supports) return false;
7549
7543
  return CSS.supports('-webkit-backdrop-filter', 'none');
7550
7544
  }
7551
- const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
7552
7545
  function isLastTraversableNode(node) {
7553
- return lastTraversableNodeNames.has(getNodeName(node));
7546
+ return ['html', 'body', '#document'].includes(getNodeName(node));
7554
7547
  }
7555
- function getComputedStyle$1(element) {
7548
+ function getComputedStyle(element) {
7556
7549
  return getWindow(element).getComputedStyle(element);
7557
7550
  }
7558
7551
  function getNodeScroll(element) {
@@ -7654,9 +7647,8 @@ function getOppositeAxis(axis) {
7654
7647
  function getAxisLength(axis) {
7655
7648
  return axis === 'y' ? 'height' : 'width';
7656
7649
  }
7657
- const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
7658
7650
  function getSideAxis(placement) {
7659
- return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
7651
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
7660
7652
  }
7661
7653
  function getAlignmentAxis(placement) {
7662
7654
  return getOppositeAxis(getSideAxis(placement));
@@ -7681,19 +7673,19 @@ function getExpandedPlacements(placement) {
7681
7673
  function getOppositeAlignmentPlacement(placement) {
7682
7674
  return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
7683
7675
  }
7684
- const lrPlacement = ['left', 'right'];
7685
- const rlPlacement = ['right', 'left'];
7686
- const tbPlacement = ['top', 'bottom'];
7687
- const btPlacement = ['bottom', 'top'];
7688
7676
  function getSideList(side, isStart, rtl) {
7677
+ const lr = ['left', 'right'];
7678
+ const rl = ['right', 'left'];
7679
+ const tb = ['top', 'bottom'];
7680
+ const bt = ['bottom', 'top'];
7689
7681
  switch (side) {
7690
7682
  case 'top':
7691
7683
  case 'bottom':
7692
- if (rtl) return isStart ? rlPlacement : lrPlacement;
7693
- return isStart ? lrPlacement : rlPlacement;
7684
+ if (rtl) return isStart ? rl : lr;
7685
+ return isStart ? lr : rl;
7694
7686
  case 'left':
7695
7687
  case 'right':
7696
- return isStart ? tbPlacement : btPlacement;
7688
+ return isStart ? tb : bt;
7697
7689
  default:
7698
7690
  return [];
7699
7691
  }
@@ -8145,7 +8137,7 @@ const flip$2 = function (options) {
8145
8137
  if (!ignoreCrossAxisOverflow ||
8146
8138
  // We leave the current main axis only if every placement on that axis
8147
8139
  // overflows the main axis.
8148
- overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
8140
+ overflowsData.every(d => d.overflows[0] > 0 && getSideAxis(d.placement) === initialSideAxis)) {
8149
8141
  // Try next placement and re-run the lifecycle.
8150
8142
  return {
8151
8143
  data: {
@@ -8202,8 +8194,6 @@ const flip$2 = function (options) {
8202
8194
  };
8203
8195
  };
8204
8196
 
8205
- const originSides = /*#__PURE__*/new Set(['left', 'top']);
8206
-
8207
8197
  // For type backwards-compatibility, the `OffsetOptions` type was also
8208
8198
  // Derivable.
8209
8199
 
@@ -8217,7 +8207,7 @@ async function convertValueToCoords(state, options) {
8217
8207
  const side = getSide(placement);
8218
8208
  const alignment = getAlignment(placement);
8219
8209
  const isVertical = getSideAxis(placement) === 'y';
8220
- const mainAxisMulti = originSides.has(side) ? -1 : 1;
8210
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
8221
8211
  const crossAxisMulti = rtl && isVertical ? -1 : 1;
8222
8212
  const rawValue = evaluate(options, state);
8223
8213
 
@@ -8289,7 +8279,7 @@ const offset$2 = function (options) {
8289
8279
  };
8290
8280
 
8291
8281
  function getCssDimensions(element) {
8292
- const css = getComputedStyle$1(element);
8282
+ const css = getComputedStyle(element);
8293
8283
  // In testing environments, the `width` and `height` properties are empty
8294
8284
  // strings for SVG elements, returning NaN. Fallback to `0` in this case.
8295
8285
  let width = parseFloat(css.width) || 0;
@@ -8394,7 +8384,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
8394
8384
  while (currentIFrame && offsetParent && offsetWin !== currentWin) {
8395
8385
  const iframeScale = getScale(currentIFrame);
8396
8386
  const iframeRect = currentIFrame.getBoundingClientRect();
8397
- const css = getComputedStyle$1(currentIFrame);
8387
+ const css = getComputedStyle(currentIFrame);
8398
8388
  const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
8399
8389
  const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
8400
8390
  x *= iframeScale.x;
@@ -8425,9 +8415,14 @@ function getWindowScrollBarX(element, rect) {
8425
8415
  return rect.left + leftScroll;
8426
8416
  }
8427
8417
 
8428
- function getHTMLOffset(documentElement, scroll) {
8418
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
8419
+ if (ignoreScrollbarX === void 0) {
8420
+ ignoreScrollbarX = false;
8421
+ }
8429
8422
  const htmlRect = documentElement.getBoundingClientRect();
8430
- const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
8423
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
8424
+ // RTL <body> scrollbar.
8425
+ getWindowScrollBarX(documentElement, htmlRect));
8431
8426
  const y = htmlRect.top + scroll.scrollTop;
8432
8427
  return {
8433
8428
  x,
@@ -8466,7 +8461,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
8466
8461
  offsets.y = offsetRect.y + offsetParent.clientTop;
8467
8462
  }
8468
8463
  }
8469
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
8464
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
8470
8465
  return {
8471
8466
  width: rect.width * scale.x,
8472
8467
  height: rect.height * scale.y,
@@ -8489,7 +8484,7 @@ function getDocumentRect(element) {
8489
8484
  const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
8490
8485
  let x = -scroll.scrollLeft + getWindowScrollBarX(element);
8491
8486
  const y = -scroll.scrollTop;
8492
- if (getComputedStyle$1(body).direction === 'rtl') {
8487
+ if (getComputedStyle(body).direction === 'rtl') {
8493
8488
  x += max(html.clientWidth, body.clientWidth) - width;
8494
8489
  }
8495
8490
  return {
@@ -8500,10 +8495,6 @@ function getDocumentRect(element) {
8500
8495
  };
8501
8496
  }
8502
8497
 
8503
- // Safety check: ensure the scrollbar space is reasonable in case this
8504
- // calculation is affected by unusual styles.
8505
- // Most scrollbars leave 15-18px of space.
8506
- const SCROLLBAR_MAX = 25;
8507
8498
  function getViewportRect(element, strategy) {
8508
8499
  const win = getWindow(element);
8509
8500
  const html = getDocumentElement(element);
@@ -8521,24 +8512,6 @@ function getViewportRect(element, strategy) {
8521
8512
  y = visualViewport.offsetTop;
8522
8513
  }
8523
8514
  }
8524
- const windowScrollbarX = getWindowScrollBarX(html);
8525
- // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
8526
- // visual width of the <html> but this is not considered in the size
8527
- // of `html.clientWidth`.
8528
- if (windowScrollbarX <= 0) {
8529
- const doc = html.ownerDocument;
8530
- const body = doc.body;
8531
- const bodyStyles = getComputedStyle(body);
8532
- const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
8533
- const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
8534
- if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
8535
- width -= clippingStableScrollbarWidth;
8536
- }
8537
- } else if (windowScrollbarX <= SCROLLBAR_MAX) {
8538
- // If the <body> scrollbar is on the left, the width needs to be extended
8539
- // by the scrollbar amount so there isn't extra space on the right.
8540
- width += windowScrollbarX;
8541
- }
8542
8515
  return {
8543
8516
  width,
8544
8517
  height,
@@ -8547,7 +8520,6 @@ function getViewportRect(element, strategy) {
8547
8520
  };
8548
8521
  }
8549
8522
 
8550
- const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
8551
8523
  // Returns the inner client rect, subtracting scrollbars if present.
8552
8524
  function getInnerBoundingClientRect(element, strategy) {
8553
8525
  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
@@ -8589,7 +8561,7 @@ function hasFixedPositionAncestor(element, stopNode) {
8589
8561
  if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
8590
8562
  return false;
8591
8563
  }
8592
- return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
8564
+ return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
8593
8565
  }
8594
8566
 
8595
8567
  // A "clipping ancestor" is an `overflow` element with the characteristic of
@@ -8602,17 +8574,17 @@ function getClippingElementAncestors(element, cache) {
8602
8574
  }
8603
8575
  let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
8604
8576
  let currentContainingBlockComputedStyle = null;
8605
- const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
8577
+ const elementIsFixed = getComputedStyle(element).position === 'fixed';
8606
8578
  let currentNode = elementIsFixed ? getParentNode(element) : element;
8607
8579
 
8608
8580
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
8609
8581
  while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
8610
- const computedStyle = getComputedStyle$1(currentNode);
8582
+ const computedStyle = getComputedStyle(currentNode);
8611
8583
  const currentNodeIsContaining = isContainingBlock(currentNode);
8612
8584
  if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
8613
8585
  currentContainingBlockComputedStyle = null;
8614
8586
  }
8615
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
8587
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
8616
8588
  if (shouldDropCurrentNode) {
8617
8589
  // Drop non-containing blocks.
8618
8590
  result = result.filter(ancestor => ancestor !== currentNode);
@@ -8708,11 +8680,11 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
8708
8680
  }
8709
8681
 
8710
8682
  function isStaticPositioned(element) {
8711
- return getComputedStyle$1(element).position === 'static';
8683
+ return getComputedStyle(element).position === 'static';
8712
8684
  }
8713
8685
 
8714
8686
  function getTrueOffsetParent(element, polyfill) {
8715
- if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
8687
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
8716
8688
  return null;
8717
8689
  }
8718
8690
  if (polyfill) {
@@ -8773,7 +8745,7 @@ const getElementRects = async function (data) {
8773
8745
  };
8774
8746
 
8775
8747
  function isRTL(element) {
8776
- return getComputedStyle$1(element).direction === 'rtl';
8748
+ return getComputedStyle(element).direction === 'rtl';
8777
8749
  }
8778
8750
 
8779
8751
  const platform = {
@@ -9413,7 +9385,7 @@ const FloatingArrow = /*#__PURE__*/React.forwardRef(function FloatingArrow(props
9413
9385
  // https://github.com/floating-ui/floating-ui/issues/2932
9414
9386
  index$1(() => {
9415
9387
  if (!floating) return;
9416
- const isRTL = getComputedStyle$1(floating).direction === 'rtl';
9388
+ const isRTL = getComputedStyle(floating).direction === 'rtl';
9417
9389
  if (isRTL) {
9418
9390
  setIsRTL(true);
9419
9391
  }
@@ -9672,7 +9644,7 @@ function useFloating(options) {
9672
9644
  }
9673
9645
 
9674
9646
  /*!
9675
- react-datepicker v8.6.0
9647
+ react-datepicker v8.4.0
9676
9648
  https://github.com/Hacker0x01/react-datepicker
9677
9649
  Released under the MIT License.
9678
9650
  */
@@ -9907,13 +9879,12 @@ var DATE_RANGE_SEPARATOR = " - ";
9907
9879
  * @returns - The formatted date range or an empty string.
9908
9880
  */
9909
9881
  function safeDateRangeFormat(startDate, endDate, props) {
9910
- if (!startDate && !endDate) {
9882
+ if (!startDate) {
9911
9883
  return "";
9912
9884
  }
9913
- var formattedStartDate = startDate ? safeDateFormat(startDate, props) : "";
9885
+ var formattedStartDate = safeDateFormat(startDate, props);
9914
9886
  var formattedEndDate = endDate ? safeDateFormat(endDate, props) : "";
9915
- var dateRangeSeparator = props.rangeSeparator || DATE_RANGE_SEPARATOR;
9916
- return "".concat(formattedStartDate).concat(dateRangeSeparator).concat(formattedEndDate);
9887
+ return "".concat(formattedStartDate).concat(DATE_RANGE_SEPARATOR).concat(formattedEndDate);
9917
9888
  }
9918
9889
  /**
9919
9890
  * Safely formats multiple dates.
@@ -11015,7 +10986,7 @@ var Day = /** @class */ (function (_super) {
11015
10986
  };
11016
10987
  _this.isInSelectingRange = function () {
11017
10988
  var _a;
11018
- 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;
10989
+ var _b = _this.props, day = _b.day, selectsStart = _b.selectsStart, selectsEnd = _b.selectsEnd, selectsRange = _b.selectsRange, selectsDisabledDaysInRange = _b.selectsDisabledDaysInRange, startDate = _b.startDate, endDate = _b.endDate;
11019
10990
  var selectingDate = (_a = _this.props.selectingDate) !== null && _a !== void 0 ? _a : _this.props.preSelection;
11020
10991
  if (!(selectsStart || selectsEnd || selectsRange) ||
11021
10992
  !selectingDate ||
@@ -11032,16 +11003,11 @@ var Day = /** @class */ (function (_super) {
11032
11003
  (isAfter(selectingDate, startDate) || isEqual(selectingDate, startDate))) {
11033
11004
  return isDayInRange(day, startDate, selectingDate);
11034
11005
  }
11035
- if (selectsRange && startDate && !endDate) {
11036
- if (isEqual(selectingDate, startDate)) {
11037
- return isDayInRange(day, startDate, selectingDate);
11038
- }
11039
- if (isAfter(selectingDate, startDate)) {
11040
- return isDayInRange(day, startDate, selectingDate);
11041
- }
11042
- if (swapRange && isBefore(selectingDate, startDate)) {
11043
- return isDayInRange(day, selectingDate, startDate);
11044
- }
11006
+ if (selectsRange &&
11007
+ startDate &&
11008
+ !endDate &&
11009
+ (isAfter(selectingDate, startDate) || isEqual(selectingDate, startDate))) {
11010
+ return isDayInRange(day, startDate, selectingDate);
11045
11011
  }
11046
11012
  return false;
11047
11013
  };
@@ -11050,33 +11016,28 @@ var Day = /** @class */ (function (_super) {
11050
11016
  if (!_this.isInSelectingRange()) {
11051
11017
  return false;
11052
11018
  }
11053
- var _b = _this.props, day = _b.day, startDate = _b.startDate, selectsStart = _b.selectsStart, swapRange = _b.swapRange, selectsRange = _b.selectsRange;
11019
+ var _b = _this.props, day = _b.day, startDate = _b.startDate, selectsStart = _b.selectsStart;
11054
11020
  var selectingDate = (_a = _this.props.selectingDate) !== null && _a !== void 0 ? _a : _this.props.preSelection;
11055
11021
  if (selectsStart) {
11056
11022
  return isSameDay(day, selectingDate);
11057
11023
  }
11058
- if (selectsRange && swapRange && startDate && selectingDate) {
11059
- return isSameDay(day, isBefore(selectingDate, startDate) ? selectingDate : startDate);
11024
+ else {
11025
+ return isSameDay(day, startDate);
11060
11026
  }
11061
- return isSameDay(day, startDate);
11062
11027
  };
11063
11028
  _this.isSelectingRangeEnd = function () {
11064
11029
  var _a;
11065
11030
  if (!_this.isInSelectingRange()) {
11066
11031
  return false;
11067
11032
  }
11068
- var _b = _this.props, day = _b.day, endDate = _b.endDate, selectsEnd = _b.selectsEnd, selectsRange = _b.selectsRange, swapRange = _b.swapRange, startDate = _b.startDate;
11033
+ var _b = _this.props, day = _b.day, endDate = _b.endDate, selectsEnd = _b.selectsEnd, selectsRange = _b.selectsRange;
11069
11034
  var selectingDate = (_a = _this.props.selectingDate) !== null && _a !== void 0 ? _a : _this.props.preSelection;
11070
- if (selectsEnd) {
11035
+ if (selectsEnd || selectsRange) {
11071
11036
  return isSameDay(day, selectingDate);
11072
11037
  }
11073
- if (selectsRange && swapRange && startDate && selectingDate) {
11074
- return isSameDay(day, isBefore(selectingDate, startDate) ? startDate : selectingDate);
11075
- }
11076
- if (selectsRange) {
11077
- return isSameDay(day, selectingDate);
11038
+ else {
11039
+ return isSameDay(day, endDate);
11078
11040
  }
11079
- return isSameDay(day, endDate);
11080
11041
  };
11081
11042
  _this.isRangeStart = function () {
11082
11043
  var _a = _this.props, day = _a.day, startDate = _a.startDate, endDate = _a.endDate;
@@ -11444,10 +11405,7 @@ var Week = /** @class */ (function (_super) {
11444
11405
  "react-datepicker__week--selected": isSameDay(this.startOfWeek(), this.props.selected),
11445
11406
  "react-datepicker__week--keyboard-selected": this.isKeyboardSelected(),
11446
11407
  };
11447
- var customWeekClassName = this.props.weekClassName
11448
- ? this.props.weekClassName(this.startOfWeek())
11449
- : undefined;
11450
- return (React__default.createElement("div", { className: clsx(weekNumberClasses, customWeekClassName) }, this.renderDays()));
11408
+ return React__default.createElement("div", { className: clsx(weekNumberClasses) }, this.renderDays());
11451
11409
  };
11452
11410
  return Week;
11453
11411
  }(Component));
@@ -12150,40 +12108,11 @@ var MonthDropdownOptions = /** @class */ (function (_super) {
12150
12108
  __extends(MonthDropdownOptions, _super);
12151
12109
  function MonthDropdownOptions() {
12152
12110
  var _this = _super !== null && _super.apply(this, arguments) || this;
12153
- _this.monthOptionButtonsRef = {};
12154
12111
  _this.isSelectedMonth = function (i) { return _this.props.month === i; };
12155
- _this.handleOptionKeyDown = function (i, e) {
12156
- var _a;
12157
- switch (e.key) {
12158
- case "Enter":
12159
- e.preventDefault();
12160
- _this.onChange(i);
12161
- break;
12162
- case "Escape":
12163
- e.preventDefault();
12164
- _this.props.onCancel();
12165
- break;
12166
- case "ArrowUp":
12167
- case "ArrowDown": {
12168
- e.preventDefault();
12169
- var newMonth = (i + (e.key === "ArrowUp" ? -1 : 1) + _this.props.monthNames.length) %
12170
- _this.props.monthNames.length;
12171
- (_a = _this.monthOptionButtonsRef[newMonth]) === null || _a === void 0 ? void 0 : _a.focus();
12172
- break;
12173
- }
12174
- }
12175
- };
12176
12112
  _this.renderOptions = function () {
12177
- // Clear refs to prevent memory leaks on re-render
12178
- _this.monthOptionButtonsRef = {};
12179
- return _this.props.monthNames.map(function (month, i) { return (React__default.createElement("div", { ref: function (el) {
12180
- _this.monthOptionButtonsRef[i] = el;
12181
- if (_this.isSelectedMonth(i)) {
12182
- el === null || el === void 0 ? void 0 : el.focus();
12183
- }
12184
- }, role: "button", tabIndex: 0, className: _this.isSelectedMonth(i)
12113
+ return _this.props.monthNames.map(function (month, i) { return (React__default.createElement("div", { className: _this.isSelectedMonth(i)
12185
12114
  ? "react-datepicker__month-option react-datepicker__month-option--selected_month"
12186
- : "react-datepicker__month-option", key: month, onClick: _this.onChange.bind(_this, i), onKeyDown: _this.handleOptionKeyDown.bind(_this, i), "aria-selected": _this.isSelectedMonth(i) ? "true" : undefined },
12115
+ : "react-datepicker__month-option", key: month, onClick: _this.onChange.bind(_this, i), "aria-selected": _this.isSelectedMonth(i) ? "true" : undefined },
12187
12116
  _this.isSelectedMonth(i) ? (React__default.createElement("span", { className: "react-datepicker__month-option--selected" }, "\u2713")) : (""),
12188
12117
  month)); });
12189
12118
  };
@@ -12208,7 +12137,7 @@ var MonthDropdown = /** @class */ (function (_super) {
12208
12137
  return monthNames.map(function (m, i) { return (React__default.createElement("option", { key: m, value: i }, m)); });
12209
12138
  };
12210
12139
  _this.renderSelectMode = function (monthNames) { return (React__default.createElement("select", { value: _this.props.month, className: "react-datepicker__month-select", onChange: function (e) { return _this.onChange(parseInt(e.target.value)); } }, _this.renderSelectOptions(monthNames))); };
12211
- _this.renderReadView = function (visible, monthNames) { return (React__default.createElement("button", { key: "read", type: "button", style: { visibility: visible ? "visible" : "hidden" }, className: "react-datepicker__month-read-view", onClick: _this.toggleDropdown },
12140
+ _this.renderReadView = function (visible, monthNames) { return (React__default.createElement("div", { key: "read", style: { visibility: visible ? "visible" : "hidden" }, className: "react-datepicker__month-read-view", onClick: _this.toggleDropdown },
12212
12141
  React__default.createElement("span", { className: "react-datepicker__month-read-view--down-arrow" }),
12213
12142
  React__default.createElement("span", { className: "react-datepicker__month-read-view--selected-month" }, monthNames[_this.props.month]))); };
12214
12143
  _this.renderDropdown = function (monthNames) { return (React__default.createElement(MonthDropdownOptions, _assign({ key: "dropdown" }, _this.props, { monthNames: monthNames, onChange: _this.onChange, onCancel: _this.toggleDropdown }))); };
@@ -12696,20 +12625,19 @@ var Year$1 = /** @class */ (function (_super) {
12696
12625
  return isSameYear(_year, endDate !== null && endDate !== void 0 ? endDate : null);
12697
12626
  };
12698
12627
  _this.isKeyboardSelected = function (y) {
12699
- if (_this.props.disabledKeyboardNavigation ||
12700
- _this.props.date === undefined ||
12628
+ if (_this.props.date === undefined ||
12629
+ _this.props.selected == null ||
12701
12630
  _this.props.preSelection == null) {
12702
12631
  return;
12703
12632
  }
12704
- var _a = _this.props, minDate = _a.minDate, maxDate = _a.maxDate, excludeDates = _a.excludeDates, includeDates = _a.includeDates, filterDate = _a.filterDate, selected = _a.selected;
12633
+ var _a = _this.props, minDate = _a.minDate, maxDate = _a.maxDate, excludeDates = _a.excludeDates, includeDates = _a.includeDates, filterDate = _a.filterDate;
12705
12634
  var date = getStartOfYear(setYear(_this.props.date, y));
12706
12635
  var isDisabled = (minDate || maxDate || excludeDates || includeDates || filterDate) &&
12707
12636
  isYearDisabled(y, _this.props);
12708
- var isSelectedDay = !!selected && isSameDay(date, getStartOfYear(selected));
12709
- var isKeyboardSelectedDay = isSameDay(date, getStartOfYear(_this.props.preSelection));
12710
- return (!_this.props.inline &&
12711
- !isSelectedDay &&
12712
- isKeyboardSelectedDay &&
12637
+ return (!_this.props.disabledKeyboardNavigation &&
12638
+ !_this.props.inline &&
12639
+ !isSameDay(date, getStartOfYear(_this.props.selected)) &&
12640
+ isSameDay(date, getStartOfYear(_this.props.preSelection)) &&
12713
12641
  !isDisabled);
12714
12642
  };
12715
12643
  _this.isSelectedYear = function (year) {
@@ -12895,42 +12823,11 @@ var YearDropdownOptions = /** @class */ (function (_super) {
12895
12823
  __extends(YearDropdownOptions, _super);
12896
12824
  function YearDropdownOptions(props) {
12897
12825
  var _this = _super.call(this, props) || this;
12898
- _this.yearOptionButtonsRef = {};
12899
- _this.handleOptionKeyDown = function (year, e) {
12900
- var _a;
12901
- switch (e.key) {
12902
- case "Enter":
12903
- e.preventDefault();
12904
- _this.onChange(year);
12905
- break;
12906
- case "Escape":
12907
- e.preventDefault();
12908
- _this.props.onCancel();
12909
- break;
12910
- case "ArrowUp":
12911
- case "ArrowDown": {
12912
- e.preventDefault();
12913
- var newYear = year + (e.key === "ArrowUp" ? 1 : -1);
12914
- // Add bounds checking to ensure the year exists in our refs
12915
- if (_this.yearOptionButtonsRef[newYear]) {
12916
- (_a = _this.yearOptionButtonsRef[newYear]) === null || _a === void 0 ? void 0 : _a.focus();
12917
- }
12918
- break;
12919
- }
12920
- }
12921
- };
12922
12826
  _this.renderOptions = function () {
12923
- // Clear refs to prevent memory leaks on re-render
12924
- _this.yearOptionButtonsRef = {};
12925
12827
  var selectedYear = _this.props.year;
12926
- var options = _this.state.yearsList.map(function (year) { return (React__default.createElement("div", { ref: function (el) {
12927
- _this.yearOptionButtonsRef[year] = el;
12928
- if (year === selectedYear) {
12929
- el === null || el === void 0 ? void 0 : el.focus();
12930
- }
12931
- }, role: "button", tabIndex: 0, className: selectedYear === year
12828
+ var options = _this.state.yearsList.map(function (year) { return (React__default.createElement("div", { className: selectedYear === year
12932
12829
  ? "react-datepicker__year-option react-datepicker__year-option--selected_year"
12933
- : "react-datepicker__year-option", key: year, onClick: _this.onChange.bind(_this, year), onKeyDown: _this.handleOptionKeyDown.bind(_this, year), "aria-selected": selectedYear === year ? "true" : undefined },
12830
+ : "react-datepicker__year-option", key: year, onClick: _this.onChange.bind(_this, year), "aria-selected": selectedYear === year ? "true" : undefined },
12934
12831
  selectedYear === year ? (React__default.createElement("span", { className: "react-datepicker__year-option--selected" }, "\u2713")) : (""),
12935
12832
  year)); });
12936
12833
  var minYear = _this.props.minDate ? getYear(_this.props.minDate) : null;
@@ -13025,7 +12922,9 @@ var YearDropdown = /** @class */ (function (_super) {
13025
12922
  _this.onChange(parseInt(event.target.value));
13026
12923
  };
13027
12924
  _this.renderSelectMode = function () { return (React__default.createElement("select", { value: _this.props.year, className: "react-datepicker__year-select", onChange: _this.onSelectChange }, _this.renderSelectOptions())); };
13028
- _this.renderReadView = function (visible) { return (React__default.createElement("button", { key: "read", type: "button", style: { visibility: visible ? "visible" : "hidden" }, className: "react-datepicker__year-read-view", onClick: _this.toggleDropdown },
12925
+ _this.renderReadView = function (visible) { return (React__default.createElement("div", { key: "read", style: { visibility: visible ? "visible" : "hidden" }, className: "react-datepicker__year-read-view", onClick: function (event) {
12926
+ return _this.toggleDropdown(event);
12927
+ } },
13029
12928
  React__default.createElement("span", { className: "react-datepicker__year-read-view--down-arrow" }),
13030
12929
  React__default.createElement("span", { className: "react-datepicker__year-read-view--selected-year" }, _this.props.year))); };
13031
12930
  _this.renderDropdown = function () { return (React__default.createElement(YearDropdownOptions, _assign({ key: "dropdown" }, _this.props, { onChange: _this.onChange, onCancel: _this.toggleDropdown }))); };
@@ -13087,7 +12986,6 @@ var DROPDOWN_FOCUS_CLASSNAMES = [
13087
12986
  "react-datepicker__month-select",
13088
12987
  "react-datepicker__month-year-select",
13089
12988
  ];
13090
- var OUTSIDE_CLICK_IGNORE_CLASS = "react-datepicker-ignore-onclickoutside";
13091
12989
  var isDropdownSelect = function (element) {
13092
12990
  var classNames = (element.className || "").split(/\s+/);
13093
12991
  return DROPDOWN_FOCUS_CLASSNAMES.some(function (testClassname) { return classNames.indexOf(testClassname) >= 0; });
@@ -13239,9 +13137,7 @@ var Calendar = /** @class */ (function (_super) {
13239
13137
  var startOfWeek = getStartOfWeek(date, _this.props.locale, _this.props.calendarStartDay);
13240
13138
  var dayNames = [];
13241
13139
  if (_this.props.showWeekNumbers) {
13242
- dayNames.push(React__default.createElement("div", { key: "W", className: "react-datepicker__day-name", role: "columnheader" },
13243
- React__default.createElement("span", { className: "sr-only" }, "Week number"),
13244
- React__default.createElement("span", { "aria-hidden": "true" }, _this.props.weekLabel || "#")));
13140
+ dayNames.push(React__default.createElement("div", { key: "W", className: "react-datepicker__day-name" }, _this.props.weekLabel || "#"));
13245
13141
  }
13246
13142
  return dayNames.concat([0, 1, 2, 3, 4, 5, 6].map(function (offset) {
13247
13143
  var day = addDays(startOfWeek, offset);
@@ -13249,9 +13145,7 @@ var Calendar = /** @class */ (function (_super) {
13249
13145
  var weekDayClassName = _this.props.weekDayClassName
13250
13146
  ? _this.props.weekDayClassName(day)
13251
13147
  : undefined;
13252
- return (React__default.createElement("div", { key: offset, role: "columnheader", className: clsx("react-datepicker__day-name", weekDayClassName) },
13253
- React__default.createElement("span", { className: "sr-only" }, formatDate(day, "EEEE", _this.props.locale)),
13254
- React__default.createElement("span", { "aria-hidden": "true" }, weekDayName)));
13148
+ return (React__default.createElement("div", { key: offset, "aria-label": formatDate(day, "EEEE", _this.props.locale), className: clsx("react-datepicker__day-name", weekDayClassName) }, weekDayName));
13255
13149
  }));
13256
13150
  };
13257
13151
  _this.formatWeekday = function (day, locale) {
@@ -13466,7 +13360,7 @@ var Calendar = /** @class */ (function (_super) {
13466
13360
  _this.renderMonthDropdown(i !== 0),
13467
13361
  _this.renderMonthYearDropdown(i !== 0),
13468
13362
  _this.renderYearDropdown(i !== 0)),
13469
- React__default.createElement("div", { className: "react-datepicker__day-names", role: "row" }, _this.header(monthDate))));
13363
+ React__default.createElement("div", { className: "react-datepicker__day-names" }, _this.header(monthDate))));
13470
13364
  };
13471
13365
  _this.renderCustomHeader = function (headerArgs) {
13472
13366
  var _a, _b;
@@ -13475,15 +13369,6 @@ var Calendar = /** @class */ (function (_super) {
13475
13369
  _this.props.showTimeSelectOnly) {
13476
13370
  return null;
13477
13371
  }
13478
- var _c = _this.props, showYearPicker = _c.showYearPicker, yearItemNumber = _c.yearItemNumber;
13479
- var visibleYearsRange;
13480
- if (showYearPicker) {
13481
- var _d = getYearsPeriod(monthDate, yearItemNumber), startYear = _d.startPeriod, endYear = _d.endPeriod;
13482
- visibleYearsRange = {
13483
- startYear: startYear,
13484
- endYear: endYear,
13485
- };
13486
- }
13487
13372
  var prevMonthButtonDisabled = monthDisabledBefore(_this.state.date, _this.props);
13488
13373
  var nextMonthButtonDisabled = monthDisabledAfter(_this.state.date, _this.props);
13489
13374
  var prevYearButtonDisabled = yearDisabledBefore(_this.state.date, _this.props);
@@ -13492,7 +13377,7 @@ var Calendar = /** @class */ (function (_super) {
13492
13377
  !_this.props.showQuarterYearPicker &&
13493
13378
  !_this.props.showYearPicker;
13494
13379
  return (React__default.createElement("div", { className: "react-datepicker__header react-datepicker__header--custom", onFocus: _this.props.onDropdownFocus }, (_b = (_a = _this.props).renderCustomHeader) === null || _b === void 0 ? void 0 :
13495
- _b.call(_a, _assign(_assign(_assign({}, _this.state), (showYearPicker && { visibleYearsRange: visibleYearsRange })), { customHeaderCount: i, monthDate: monthDate, changeMonth: _this.changeMonth, changeYear: _this.changeYear, decreaseMonth: _this.decreaseMonth, increaseMonth: _this.increaseMonth, decreaseYear: _this.decreaseYear, increaseYear: _this.increaseYear, prevMonthButtonDisabled: prevMonthButtonDisabled, nextMonthButtonDisabled: nextMonthButtonDisabled, prevYearButtonDisabled: prevYearButtonDisabled, nextYearButtonDisabled: nextYearButtonDisabled })),
13380
+ _b.call(_a, _assign(_assign({}, _this.state), { customHeaderCount: i, monthDate: monthDate, changeMonth: _this.changeMonth, changeYear: _this.changeYear, decreaseMonth: _this.decreaseMonth, increaseMonth: _this.increaseMonth, decreaseYear: _this.decreaseYear, increaseYear: _this.increaseYear, prevMonthButtonDisabled: prevMonthButtonDisabled, nextMonthButtonDisabled: nextMonthButtonDisabled, prevYearButtonDisabled: prevYearButtonDisabled, nextYearButtonDisabled: nextYearButtonDisabled })),
13496
13381
  showDayNames && (React__default.createElement("div", { className: "react-datepicker__day-names" }, _this.header(monthDate)))));
13497
13382
  };
13498
13383
  _this.renderYearHeader = function (_a) {
@@ -13612,7 +13497,6 @@ var Calendar = /** @class */ (function (_super) {
13612
13497
  return {
13613
13498
  monthsShown: 1,
13614
13499
  forceShowMonthNavigation: false,
13615
- outsideClickIgnoreClass: OUTSIDE_CLICK_IGNORE_CLASS,
13616
13500
  timeCaption: "Time",
13617
13501
  previousYearButtonLabel: "Previous Year",
13618
13502
  nextYearButtonLabel: "Next Year",
@@ -13846,7 +13730,7 @@ var TabLoop = /** @class */ (function (_super) {
13846
13730
  * @returns A new component with floating behavior.
13847
13731
  */
13848
13732
  function withFloating(Component) {
13849
- function WithFloating(props) {
13733
+ var WithFloating = function (props) {
13850
13734
  var _a;
13851
13735
  var hidePopper = typeof props.hidePopper === "boolean" ? props.hidePopper : true;
13852
13736
  var arrowRef = useRef(null);
@@ -13857,35 +13741,51 @@ function withFloating(Component) {
13857
13741
  ], ((_a = props.popperModifiers) !== null && _a !== void 0 ? _a : []), true) }, props.popperProps));
13858
13742
  var componentProps = _assign(_assign({}, props), { hidePopper: hidePopper, popperProps: _assign(_assign({}, floatingProps), { arrowRef: arrowRef }) });
13859
13743
  return React__default.createElement(Component, _assign({}, componentProps));
13860
- }
13861
- WithFloating.displayName = "withFloating(".concat(Component.displayName || Component.name || "Component", ")");
13744
+ };
13862
13745
  return WithFloating;
13863
13746
  }
13864
13747
 
13865
13748
  // Exported for testing purposes
13866
- var PopperComponent = function (props) {
13867
- 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;
13868
- var popper = undefined;
13869
- if (!hidePopper) {
13870
- var classes = clsx("react-datepicker-popper", className);
13871
- popper = (React__default.createElement(TabLoop, { enableTabLoop: enableTabLoop },
13872
- React__default.createElement("div", { ref: popperProps.refs.setFloating, style: popperProps.floatingStyles, className: classes, "data-placement": popperProps.placement, onKeyDown: popperOnKeyDown },
13873
- popperComponent,
13874
- showArrow && (React__default.createElement(FloatingArrow, { ref: popperProps.arrowRef, context: popperProps.context, fill: "currentColor", strokeWidth: 1, height: 8, width: 16, style: { transform: "translateY(-1px)" }, className: "react-datepicker__triangle" })))));
13875
- }
13876
- if (props.popperContainer) {
13877
- popper = createElement(props.popperContainer, {}, popper);
13878
- }
13879
- if (portalId && !hidePopper) {
13880
- popper = (React__default.createElement(Portal, { portalId: portalId, portalHost: portalHost }, popper));
13881
- }
13882
- var wrapperClasses = clsx("react-datepicker-wrapper", wrapperClassName);
13883
- return (React__default.createElement(React__default.Fragment, null,
13884
- React__default.createElement("div", { ref: popperProps.refs.setReference, className: wrapperClasses }, targetComponent),
13885
- popper));
13886
- };
13749
+ var PopperComponent = /** @class */ (function (_super) {
13750
+ __extends(PopperComponent, _super);
13751
+ function PopperComponent() {
13752
+ return _super !== null && _super.apply(this, arguments) || this;
13753
+ }
13754
+ Object.defineProperty(PopperComponent, "defaultProps", {
13755
+ get: function () {
13756
+ return {
13757
+ hidePopper: true,
13758
+ };
13759
+ },
13760
+ enumerable: false,
13761
+ configurable: true
13762
+ });
13763
+ PopperComponent.prototype.render = function () {
13764
+ var _a = this.props, className = _a.className, wrapperClassName = _a.wrapperClassName, _b = _a.hidePopper, hidePopper = _b === void 0 ? PopperComponent.defaultProps.hidePopper : _b, popperComponent = _a.popperComponent, targetComponent = _a.targetComponent, enableTabLoop = _a.enableTabLoop, popperOnKeyDown = _a.popperOnKeyDown, portalId = _a.portalId, portalHost = _a.portalHost, popperProps = _a.popperProps, showArrow = _a.showArrow;
13765
+ var popper = undefined;
13766
+ if (!hidePopper) {
13767
+ var classes = clsx("react-datepicker-popper", className);
13768
+ popper = (React__default.createElement(TabLoop, { enableTabLoop: enableTabLoop },
13769
+ React__default.createElement("div", { ref: popperProps.refs.setFloating, style: popperProps.floatingStyles, className: classes, "data-placement": popperProps.placement, onKeyDown: popperOnKeyDown },
13770
+ popperComponent,
13771
+ showArrow && (React__default.createElement(FloatingArrow, { ref: popperProps.arrowRef, context: popperProps.context, fill: "currentColor", strokeWidth: 1, height: 8, width: 16, style: { transform: "translateY(-1px)" }, className: "react-datepicker__triangle" })))));
13772
+ }
13773
+ if (this.props.popperContainer) {
13774
+ popper = createElement(this.props.popperContainer, {}, popper);
13775
+ }
13776
+ if (portalId && !hidePopper) {
13777
+ popper = (React__default.createElement(Portal, { portalId: portalId, portalHost: portalHost }, popper));
13778
+ }
13779
+ var wrapperClasses = clsx("react-datepicker-wrapper", wrapperClassName);
13780
+ return (React__default.createElement(React__default.Fragment, null,
13781
+ React__default.createElement("div", { ref: popperProps.refs.setReference, className: wrapperClasses }, targetComponent),
13782
+ popper));
13783
+ };
13784
+ return PopperComponent;
13785
+ }(Component));
13887
13786
  var PopperComponent$1 = withFloating(PopperComponent);
13888
13787
 
13788
+ var outsideClickIgnoreClass = "react-datepicker-ignore-onclickoutside";
13889
13789
  // Compares dates year+month combinations
13890
13790
  function hasPreSelectionChanged(date1, date2) {
13891
13791
  if (date1 && date2) {
@@ -13951,35 +13851,6 @@ var DatePicker = /** @class */ (function (_super) {
13951
13851
  wasHidden: false,
13952
13852
  };
13953
13853
  };
13954
- _this.getInputValue = function () {
13955
- var _a;
13956
- 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;
13957
- var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
13958
- var inputValue = _this.state.inputValue;
13959
- if (typeof value === "string") {
13960
- return value;
13961
- }
13962
- else if (typeof inputValue === "string") {
13963
- return inputValue;
13964
- }
13965
- else if (selectsRange) {
13966
- return safeDateRangeFormat(startDate, endDate, {
13967
- dateFormat: dateFormat,
13968
- locale: locale,
13969
- rangeSeparator: rangeSeparator,
13970
- });
13971
- }
13972
- else if (selectsMultiple) {
13973
- return safeMultipleDatesFormat(selectedDates !== null && selectedDates !== void 0 ? selectedDates : [], {
13974
- dateFormat: dateFormat,
13975
- locale: locale,
13976
- });
13977
- }
13978
- return safeDateFormat(selected, {
13979
- dateFormat: dateFormat,
13980
- locale: locale,
13981
- });
13982
- };
13983
13854
  _this.resetHiddenStatus = function () {
13984
13855
  _this.setState(_assign(_assign({}, _this.state), { wasHidden: false }));
13985
13856
  };
@@ -14079,15 +13950,11 @@ var DatePicker = /** @class */ (function (_super) {
14079
13950
  _this.handleDropdownFocus = function () {
14080
13951
  _this.cancelFocusInput();
14081
13952
  };
14082
- _this.resetInputValue = function () {
14083
- _this.setState(_assign(_assign({}, _this.state), { inputValue: null }));
14084
- };
14085
13953
  _this.handleBlur = function (event) {
14086
13954
  var _a, _b;
14087
13955
  if (!_this.state.open || _this.props.withPortal || _this.props.showTimeInput) {
14088
13956
  (_b = (_a = _this.props).onBlur) === null || _b === void 0 ? void 0 : _b.call(_a, event);
14089
13957
  }
14090
- _this.resetInputValue();
14091
13958
  if (_this.state.open && _this.props.open === false) {
14092
13959
  _this.setOpen(false);
14093
13960
  }
@@ -14128,17 +13995,11 @@ var DatePicker = /** @class */ (function (_super) {
14128
13995
  var strictParsing = (_b = _this.props.strictParsing) !== null && _b !== void 0 ? _b : DatePicker.defaultProps.strictParsing;
14129
13996
  var value = (event === null || event === void 0 ? void 0 : event.target) instanceof HTMLInputElement ? event.target.value : "";
14130
13997
  if (selectsRange) {
14131
- var rangeSeparator = _this.props.rangeSeparator;
14132
- var trimmedRangeSeparator = rangeSeparator.trim();
14133
13998
  var _g = value
14134
- .split(dateFormat.includes(trimmedRangeSeparator)
14135
- ? rangeSeparator
14136
- : trimmedRangeSeparator, 2)
13999
+ .split(dateFormat.includes("-") ? DATE_RANGE_SEPARATOR : "-", 2)
14137
14000
  .map(function (val) { return val.trim(); }), valueStart = _g[0], valueEnd = _g[1];
14138
14001
  var startDateNew = parseDate(valueStart !== null && valueStart !== void 0 ? valueStart : "", dateFormat, _this.props.locale, strictParsing);
14139
- var endDateNew = startDateNew
14140
- ? parseDate(valueEnd !== null && valueEnd !== void 0 ? valueEnd : "", dateFormat, _this.props.locale, strictParsing)
14141
- : null;
14002
+ var endDateNew = parseDate(valueEnd !== null && valueEnd !== void 0 ? valueEnd : "", dateFormat, _this.props.locale, strictParsing);
14142
14003
  var startChanged = (startDate === null || startDate === void 0 ? void 0 : startDate.getTime()) !== (startDateNew === null || startDateNew === void 0 ? void 0 : startDateNew.getTime());
14143
14004
  var endChanged = (endDate === null || endDate === void 0 ? void 0 : endDate.getTime()) !== (endDateNew === null || endDateNew === void 0 ? void 0 : endDateNew.getTime());
14144
14005
  if (!startChanged && !endChanged) {
@@ -14164,12 +14025,7 @@ var DatePicker = /** @class */ (function (_super) {
14164
14025
  _this.handleSelect = function (date, event, monthSelectedIn) {
14165
14026
  if (_this.props.readOnly)
14166
14027
  return;
14167
- var _a = _this.props, selectsRange = _a.selectsRange, startDate = _a.startDate, endDate = _a.endDate, swapRange = _a.swapRange;
14168
- var isDateSelectionComplete = !selectsRange ||
14169
- (startDate && !endDate && (swapRange || !isDateBefore(date, startDate)));
14170
- if (_this.props.shouldCloseOnSelect &&
14171
- !_this.props.showTimeSelect &&
14172
- isDateSelectionComplete) {
14028
+ if (_this.props.shouldCloseOnSelect && !_this.props.showTimeSelect) {
14173
14029
  // Preventing onFocus event to fix issue
14174
14030
  // https://github.com/Hacker0x01/react-datepicker/issues/628
14175
14031
  _this.sendFocusBackToInput();
@@ -14184,8 +14040,16 @@ var DatePicker = /** @class */ (function (_super) {
14184
14040
  if (!_this.props.shouldCloseOnSelect || _this.props.showTimeSelect) {
14185
14041
  _this.setPreSelection(date);
14186
14042
  }
14187
- else if (isDateSelectionComplete) {
14188
- _this.setOpen(false);
14043
+ else if (!_this.props.inline) {
14044
+ if (!_this.props.selectsRange) {
14045
+ _this.setOpen(false);
14046
+ }
14047
+ var _a = _this.props, startDate = _a.startDate, endDate = _a.endDate;
14048
+ if (startDate &&
14049
+ !endDate &&
14050
+ (_this.props.swapRange || !isDateBefore(date, startDate))) {
14051
+ _this.setOpen(false);
14052
+ }
14189
14053
  }
14190
14054
  };
14191
14055
  // 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)
@@ -14250,7 +14114,6 @@ var DatePicker = /** @class */ (function (_super) {
14250
14114
  if (selectsRange) {
14251
14115
  var noRanges = !startDate && !endDate;
14252
14116
  var hasStartRange = startDate && !endDate;
14253
- var hasOnlyEndRange = !startDate && !!endDate;
14254
14117
  var isRangeFilled = startDate && endDate;
14255
14118
  if (noRanges) {
14256
14119
  onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, null], event);
@@ -14271,14 +14134,6 @@ var DatePicker = /** @class */ (function (_super) {
14271
14134
  onChange === null || onChange === void 0 ? void 0 : onChange([startDate, changedDate], event);
14272
14135
  }
14273
14136
  }
14274
- else if (hasOnlyEndRange) {
14275
- if (changedDate && isDateBefore(changedDate, endDate)) {
14276
- onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, endDate], event);
14277
- }
14278
- else {
14279
- onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, null], event);
14280
- }
14281
- }
14282
14137
  if (isRangeFilled) {
14283
14138
  onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, null], event);
14284
14139
  }
@@ -14652,12 +14507,10 @@ var DatePicker = /** @class */ (function (_super) {
14652
14507
  }
14653
14508
  return (React__default.createElement(Calendar, _assign({ showMonthYearDropdown: undefined, ref: function (elem) {
14654
14509
  _this.calendar = elem;
14655
- } }, _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));
14510
+ } }, _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: 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));
14656
14511
  };
14657
14512
  _this.renderAriaLiveRegion = function () {
14658
- var _a;
14659
- var locale = _this.props.locale;
14660
- var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
14513
+ var _a = _this.props, _b = _a.dateFormat, dateFormat = _b === void 0 ? DatePicker.defaultProps.dateFormat : _b, locale = _a.locale;
14661
14514
  var isContainsTime = _this.props.showTimeInput || _this.props.showTimeSelect;
14662
14515
  var longDateFormat = isContainsTime ? "PPPPp" : "PPPP";
14663
14516
  var ariaLiveMessage;
@@ -14700,17 +14553,36 @@ var DatePicker = /** @class */ (function (_super) {
14700
14553
  };
14701
14554
  _this.renderDateInput = function () {
14702
14555
  var _a, _b;
14556
+ var _c;
14703
14557
  var className = clsx(_this.props.className, (_a = {},
14704
- _a[_this.props.outsideClickIgnoreClass ||
14705
- DatePicker.defaultProps.outsideClickIgnoreClass] = _this.state.open,
14558
+ _a[outsideClickIgnoreClass] = _this.state.open,
14706
14559
  _a));
14707
14560
  var customInput = _this.props.customInput || React__default.createElement("input", { type: "text" });
14708
14561
  var customInputRef = _this.props.customInputRef || "ref";
14562
+ var _d = _this.props, _e = _d.dateFormat, dateFormat = _e === void 0 ? DatePicker.defaultProps.dateFormat : _e, locale = _d.locale;
14563
+ var inputValue = typeof _this.props.value === "string"
14564
+ ? _this.props.value
14565
+ : typeof _this.state.inputValue === "string"
14566
+ ? _this.state.inputValue
14567
+ : _this.props.selectsRange
14568
+ ? safeDateRangeFormat(_this.props.startDate, _this.props.endDate, {
14569
+ dateFormat: dateFormat,
14570
+ locale: locale,
14571
+ })
14572
+ : _this.props.selectsMultiple
14573
+ ? safeMultipleDatesFormat((_c = _this.props.selectedDates) !== null && _c !== void 0 ? _c : [], {
14574
+ dateFormat: dateFormat,
14575
+ locale: locale,
14576
+ })
14577
+ : safeDateFormat(_this.props.selected, {
14578
+ dateFormat: dateFormat,
14579
+ locale: locale,
14580
+ });
14709
14581
  return cloneElement(customInput, (_b = {},
14710
14582
  _b[customInputRef] = function (input) {
14711
14583
  _this.input = input;
14712
14584
  },
14713
- _b.value = _this.getInputValue(),
14585
+ _b.value = inputValue,
14714
14586
  _b.onBlur = _this.handleBlur,
14715
14587
  _b.onChange = _this.handleChange,
14716
14588
  _b.onClick = _this.onInputClick,
@@ -14763,9 +14635,7 @@ var DatePicker = /** @class */ (function (_super) {
14763
14635
  dropdownMode: "scroll",
14764
14636
  preventOpenOnFocus: false,
14765
14637
  monthsShown: 1,
14766
- outsideClickIgnoreClass: OUTSIDE_CLICK_IGNORE_CLASS,
14767
14638
  readOnly: false,
14768
- rangeSeparator: DATE_RANGE_SEPARATOR,
14769
14639
  withPortal: false,
14770
14640
  selectsDisabledDaysInRange: false,
14771
14641
  shouldCloseOnSelect: true,
@@ -15278,4 +15148,4 @@ var InlineDatePicker = function (props) {
15278
15148
  };
15279
15149
 
15280
15150
  export { DatePickerGroup as D, HelperText as H, InlineDatePicker as I, ValidationText as V };
15281
- //# sourceMappingURL=InlineDatePicker-xO3XGIcG.js.map
15151
+ //# sourceMappingURL=InlineDatePicker-ClVBWEzW.js.map