@cerebruminc/cerebellum 16.0.0-beta.dangerous.99fc6b7 → 16.0.0-beta.dangerous.a3d7575

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.
Files changed (29) hide show
  1. package/lib/cjs/AddressInput-BwC_Fa3a.js.map +1 -1
  2. package/lib/cjs/DatePicker.cjs +1 -1
  3. package/lib/cjs/Form.cjs +2 -2
  4. package/lib/cjs/{FormikContainer-CY2nLsAs.js → FormikContainer-2SerL4WB.js} +2 -2
  5. package/lib/cjs/{FormikContainer-CY2nLsAs.js.map → FormikContainer-2SerL4WB.js.map} +1 -1
  6. package/lib/cjs/{InlineDatePicker-DFv_uHo9.js → InlineDatePicker-CmPTTPFs.js} +283 -153
  7. package/lib/cjs/InlineDatePicker-CmPTTPFs.js.map +1 -0
  8. package/lib/cjs/InlineDatePicker.cjs +1 -1
  9. package/lib/cjs/{InlineDescriptiveDropdown-BaBs9GC1.js → InlineDescriptiveDropdown-BLC78YOL.js} +2 -2
  10. package/lib/cjs/{InlineDescriptiveDropdown-BaBs9GC1.js.map → InlineDescriptiveDropdown-BLC78YOL.js.map} +1 -1
  11. package/lib/cjs/InlineDescriptiveDropdown.cjs +1 -1
  12. package/lib/cjs/index.cjs +3 -3
  13. package/lib/cjs/index.cjs.map +1 -1
  14. package/lib/esm/AddressInput-OGU58AzF.js.map +1 -1
  15. package/lib/esm/DatePicker.js +1 -1
  16. package/lib/esm/Form.js +2 -2
  17. package/lib/esm/{FormikContainer-SJPYfIkF.js → FormikContainer-Dhp0sMJc.js} +2 -2
  18. package/lib/esm/{FormikContainer-SJPYfIkF.js.map → FormikContainer-Dhp0sMJc.js.map} +1 -1
  19. package/lib/esm/{InlineDatePicker-ClVBWEzW.js → InlineDatePicker-xO3XGIcG.js} +284 -154
  20. package/lib/esm/InlineDatePicker-xO3XGIcG.js.map +1 -0
  21. package/lib/esm/InlineDatePicker.js +1 -1
  22. package/lib/esm/{InlineDescriptiveDropdown-Dr3tXxF5.js → InlineDescriptiveDropdown-DrkAZ12b.js} +2 -2
  23. package/lib/esm/{InlineDescriptiveDropdown-Dr3tXxF5.js.map → InlineDescriptiveDropdown-DrkAZ12b.js.map} +1 -1
  24. package/lib/esm/InlineDescriptiveDropdown.js +1 -1
  25. package/lib/esm/index.js +3 -3
  26. package/lib/esm/index.js.map +1 -1
  27. package/package.json +1 -1
  28. package/lib/cjs/InlineDatePicker-DFv_uHo9.js.map +0 -1
  29. package/lib/esm/InlineDatePicker-ClVBWEzW.js.map +0 -1
@@ -7521,34 +7521,40 @@ function isShadowRoot(value) {
7521
7521
  }
7522
7522
  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
7523
7523
  }
7524
+ const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
7524
7525
  function isOverflowElement(element) {
7525
7526
  const {
7526
7527
  overflow,
7527
7528
  overflowX,
7528
7529
  overflowY,
7529
7530
  display
7530
- } = getComputedStyle(element);
7531
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
7531
+ } = getComputedStyle$1(element);
7532
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
7532
7533
  }
7534
+ const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
7533
7535
  function isTableElement(element) {
7534
- return ['table', 'td', 'th'].includes(getNodeName(element));
7536
+ return tableElements.has(getNodeName(element));
7535
7537
  }
7538
+ const topLayerSelectors = [':popover-open', ':modal'];
7536
7539
  function isTopLayer(element) {
7537
- return [':popover-open', ':modal'].some(selector => {
7540
+ return topLayerSelectors.some(selector => {
7538
7541
  try {
7539
7542
  return element.matches(selector);
7540
- } catch (e) {
7543
+ } catch (_e) {
7541
7544
  return false;
7542
7545
  }
7543
7546
  });
7544
7547
  }
7548
+ const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
7549
+ const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
7550
+ const containValues = ['paint', 'layout', 'strict', 'content'];
7545
7551
  function isContainingBlock(elementOrCss) {
7546
7552
  const webkit = isWebKit();
7547
- const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
7553
+ const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
7548
7554
 
7549
7555
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
7550
7556
  // https://drafts.csswg.org/css-transforms-2/#individual-transforms
7551
- 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));
7557
+ 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));
7552
7558
  }
7553
7559
  function getContainingBlock(element) {
7554
7560
  let currentNode = getParentNode(element);
@@ -7566,10 +7572,11 @@ function isWebKit() {
7566
7572
  if (typeof CSS === 'undefined' || !CSS.supports) return false;
7567
7573
  return CSS.supports('-webkit-backdrop-filter', 'none');
7568
7574
  }
7575
+ const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
7569
7576
  function isLastTraversableNode(node) {
7570
- return ['html', 'body', '#document'].includes(getNodeName(node));
7577
+ return lastTraversableNodeNames.has(getNodeName(node));
7571
7578
  }
7572
- function getComputedStyle(element) {
7579
+ function getComputedStyle$1(element) {
7573
7580
  return getWindow(element).getComputedStyle(element);
7574
7581
  }
7575
7582
  function getNodeScroll(element) {
@@ -7671,8 +7678,9 @@ function getOppositeAxis(axis) {
7671
7678
  function getAxisLength(axis) {
7672
7679
  return axis === 'y' ? 'height' : 'width';
7673
7680
  }
7681
+ const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
7674
7682
  function getSideAxis(placement) {
7675
- return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
7683
+ return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
7676
7684
  }
7677
7685
  function getAlignmentAxis(placement) {
7678
7686
  return getOppositeAxis(getSideAxis(placement));
@@ -7697,19 +7705,19 @@ function getExpandedPlacements(placement) {
7697
7705
  function getOppositeAlignmentPlacement(placement) {
7698
7706
  return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
7699
7707
  }
7708
+ const lrPlacement = ['left', 'right'];
7709
+ const rlPlacement = ['right', 'left'];
7710
+ const tbPlacement = ['top', 'bottom'];
7711
+ const btPlacement = ['bottom', 'top'];
7700
7712
  function getSideList(side, isStart, rtl) {
7701
- const lr = ['left', 'right'];
7702
- const rl = ['right', 'left'];
7703
- const tb = ['top', 'bottom'];
7704
- const bt = ['bottom', 'top'];
7705
7713
  switch (side) {
7706
7714
  case 'top':
7707
7715
  case 'bottom':
7708
- if (rtl) return isStart ? rl : lr;
7709
- return isStart ? lr : rl;
7716
+ if (rtl) return isStart ? rlPlacement : lrPlacement;
7717
+ return isStart ? lrPlacement : rlPlacement;
7710
7718
  case 'left':
7711
7719
  case 'right':
7712
- return isStart ? tb : bt;
7720
+ return isStart ? tbPlacement : btPlacement;
7713
7721
  default:
7714
7722
  return [];
7715
7723
  }
@@ -8161,7 +8169,7 @@ const flip$2 = function (options) {
8161
8169
  if (!ignoreCrossAxisOverflow ||
8162
8170
  // We leave the current main axis only if every placement on that axis
8163
8171
  // overflows the main axis.
8164
- overflowsData.every(d => d.overflows[0] > 0 && getSideAxis(d.placement) === initialSideAxis)) {
8172
+ overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
8165
8173
  // Try next placement and re-run the lifecycle.
8166
8174
  return {
8167
8175
  data: {
@@ -8218,6 +8226,8 @@ const flip$2 = function (options) {
8218
8226
  };
8219
8227
  };
8220
8228
 
8229
+ const originSides = /*#__PURE__*/new Set(['left', 'top']);
8230
+
8221
8231
  // For type backwards-compatibility, the `OffsetOptions` type was also
8222
8232
  // Derivable.
8223
8233
 
@@ -8231,7 +8241,7 @@ async function convertValueToCoords(state, options) {
8231
8241
  const side = getSide(placement);
8232
8242
  const alignment = getAlignment(placement);
8233
8243
  const isVertical = getSideAxis(placement) === 'y';
8234
- const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
8244
+ const mainAxisMulti = originSides.has(side) ? -1 : 1;
8235
8245
  const crossAxisMulti = rtl && isVertical ? -1 : 1;
8236
8246
  const rawValue = evaluate(options, state);
8237
8247
 
@@ -8303,7 +8313,7 @@ const offset$2 = function (options) {
8303
8313
  };
8304
8314
 
8305
8315
  function getCssDimensions(element) {
8306
- const css = getComputedStyle(element);
8316
+ const css = getComputedStyle$1(element);
8307
8317
  // In testing environments, the `width` and `height` properties are empty
8308
8318
  // strings for SVG elements, returning NaN. Fallback to `0` in this case.
8309
8319
  let width = parseFloat(css.width) || 0;
@@ -8408,7 +8418,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
8408
8418
  while (currentIFrame && offsetParent && offsetWin !== currentWin) {
8409
8419
  const iframeScale = getScale(currentIFrame);
8410
8420
  const iframeRect = currentIFrame.getBoundingClientRect();
8411
- const css = getComputedStyle(currentIFrame);
8421
+ const css = getComputedStyle$1(currentIFrame);
8412
8422
  const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
8413
8423
  const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
8414
8424
  x *= iframeScale.x;
@@ -8439,14 +8449,9 @@ function getWindowScrollBarX(element, rect) {
8439
8449
  return rect.left + leftScroll;
8440
8450
  }
8441
8451
 
8442
- function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
8443
- if (ignoreScrollbarX === void 0) {
8444
- ignoreScrollbarX = false;
8445
- }
8452
+ function getHTMLOffset(documentElement, scroll) {
8446
8453
  const htmlRect = documentElement.getBoundingClientRect();
8447
- const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
8448
- // RTL <body> scrollbar.
8449
- getWindowScrollBarX(documentElement, htmlRect));
8454
+ const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
8450
8455
  const y = htmlRect.top + scroll.scrollTop;
8451
8456
  return {
8452
8457
  x,
@@ -8485,7 +8490,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
8485
8490
  offsets.y = offsetRect.y + offsetParent.clientTop;
8486
8491
  }
8487
8492
  }
8488
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
8493
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
8489
8494
  return {
8490
8495
  width: rect.width * scale.x,
8491
8496
  height: rect.height * scale.y,
@@ -8508,7 +8513,7 @@ function getDocumentRect(element) {
8508
8513
  const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
8509
8514
  let x = -scroll.scrollLeft + getWindowScrollBarX(element);
8510
8515
  const y = -scroll.scrollTop;
8511
- if (getComputedStyle(body).direction === 'rtl') {
8516
+ if (getComputedStyle$1(body).direction === 'rtl') {
8512
8517
  x += max(html.clientWidth, body.clientWidth) - width;
8513
8518
  }
8514
8519
  return {
@@ -8519,6 +8524,10 @@ function getDocumentRect(element) {
8519
8524
  };
8520
8525
  }
8521
8526
 
8527
+ // Safety check: ensure the scrollbar space is reasonable in case this
8528
+ // calculation is affected by unusual styles.
8529
+ // Most scrollbars leave 15-18px of space.
8530
+ const SCROLLBAR_MAX = 25;
8522
8531
  function getViewportRect(element, strategy) {
8523
8532
  const win = getWindow(element);
8524
8533
  const html = getDocumentElement(element);
@@ -8536,6 +8545,24 @@ function getViewportRect(element, strategy) {
8536
8545
  y = visualViewport.offsetTop;
8537
8546
  }
8538
8547
  }
8548
+ const windowScrollbarX = getWindowScrollBarX(html);
8549
+ // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
8550
+ // visual width of the <html> but this is not considered in the size
8551
+ // of `html.clientWidth`.
8552
+ if (windowScrollbarX <= 0) {
8553
+ const doc = html.ownerDocument;
8554
+ const body = doc.body;
8555
+ const bodyStyles = getComputedStyle(body);
8556
+ const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
8557
+ const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
8558
+ if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
8559
+ width -= clippingStableScrollbarWidth;
8560
+ }
8561
+ } else if (windowScrollbarX <= SCROLLBAR_MAX) {
8562
+ // If the <body> scrollbar is on the left, the width needs to be extended
8563
+ // by the scrollbar amount so there isn't extra space on the right.
8564
+ width += windowScrollbarX;
8565
+ }
8539
8566
  return {
8540
8567
  width,
8541
8568
  height,
@@ -8544,6 +8571,7 @@ function getViewportRect(element, strategy) {
8544
8571
  };
8545
8572
  }
8546
8573
 
8574
+ const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
8547
8575
  // Returns the inner client rect, subtracting scrollbars if present.
8548
8576
  function getInnerBoundingClientRect(element, strategy) {
8549
8577
  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
@@ -8585,7 +8613,7 @@ function hasFixedPositionAncestor(element, stopNode) {
8585
8613
  if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
8586
8614
  return false;
8587
8615
  }
8588
- return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
8616
+ return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
8589
8617
  }
8590
8618
 
8591
8619
  // A "clipping ancestor" is an `overflow` element with the characteristic of
@@ -8598,17 +8626,17 @@ function getClippingElementAncestors(element, cache) {
8598
8626
  }
8599
8627
  let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
8600
8628
  let currentContainingBlockComputedStyle = null;
8601
- const elementIsFixed = getComputedStyle(element).position === 'fixed';
8629
+ const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
8602
8630
  let currentNode = elementIsFixed ? getParentNode(element) : element;
8603
8631
 
8604
8632
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
8605
8633
  while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
8606
- const computedStyle = getComputedStyle(currentNode);
8634
+ const computedStyle = getComputedStyle$1(currentNode);
8607
8635
  const currentNodeIsContaining = isContainingBlock(currentNode);
8608
8636
  if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
8609
8637
  currentContainingBlockComputedStyle = null;
8610
8638
  }
8611
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
8639
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
8612
8640
  if (shouldDropCurrentNode) {
8613
8641
  // Drop non-containing blocks.
8614
8642
  result = result.filter(ancestor => ancestor !== currentNode);
@@ -8704,11 +8732,11 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
8704
8732
  }
8705
8733
 
8706
8734
  function isStaticPositioned(element) {
8707
- return getComputedStyle(element).position === 'static';
8735
+ return getComputedStyle$1(element).position === 'static';
8708
8736
  }
8709
8737
 
8710
8738
  function getTrueOffsetParent(element, polyfill) {
8711
- if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
8739
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
8712
8740
  return null;
8713
8741
  }
8714
8742
  if (polyfill) {
@@ -8769,7 +8797,7 @@ const getElementRects = async function (data) {
8769
8797
  };
8770
8798
 
8771
8799
  function isRTL(element) {
8772
- return getComputedStyle(element).direction === 'rtl';
8800
+ return getComputedStyle$1(element).direction === 'rtl';
8773
8801
  }
8774
8802
 
8775
8803
  const platform = {
@@ -9409,7 +9437,7 @@ const FloatingArrow = /*#__PURE__*/React__namespace.forwardRef(function Floating
9409
9437
  // https://github.com/floating-ui/floating-ui/issues/2932
9410
9438
  index$1(() => {
9411
9439
  if (!floating) return;
9412
- const isRTL = getComputedStyle(floating).direction === 'rtl';
9440
+ const isRTL = getComputedStyle$1(floating).direction === 'rtl';
9413
9441
  if (isRTL) {
9414
9442
  setIsRTL(true);
9415
9443
  }
@@ -9668,7 +9696,7 @@ function useFloating(options) {
9668
9696
  }
9669
9697
 
9670
9698
  /*!
9671
- react-datepicker v8.4.0
9699
+ react-datepicker v8.6.0
9672
9700
  https://github.com/Hacker0x01/react-datepicker
9673
9701
  Released under the MIT License.
9674
9702
  */
@@ -9903,12 +9931,13 @@ var DATE_RANGE_SEPARATOR = " - ";
9903
9931
  * @returns - The formatted date range or an empty string.
9904
9932
  */
9905
9933
  function safeDateRangeFormat(startDate, endDate, props) {
9906
- if (!startDate) {
9934
+ if (!startDate && !endDate) {
9907
9935
  return "";
9908
9936
  }
9909
- var formattedStartDate = safeDateFormat(startDate, props);
9937
+ var formattedStartDate = startDate ? safeDateFormat(startDate, props) : "";
9910
9938
  var formattedEndDate = endDate ? safeDateFormat(endDate, props) : "";
9911
- return "".concat(formattedStartDate).concat(DATE_RANGE_SEPARATOR).concat(formattedEndDate);
9939
+ var dateRangeSeparator = props.rangeSeparator || DATE_RANGE_SEPARATOR;
9940
+ return "".concat(formattedStartDate).concat(dateRangeSeparator).concat(formattedEndDate);
9912
9941
  }
9913
9942
  /**
9914
9943
  * Safely formats multiple dates.
@@ -11010,7 +11039,7 @@ var Day = /** @class */ (function (_super) {
11010
11039
  };
11011
11040
  _this.isInSelectingRange = function () {
11012
11041
  var _a;
11013
- 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;
11042
+ 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;
11014
11043
  var selectingDate = (_a = _this.props.selectingDate) !== null && _a !== void 0 ? _a : _this.props.preSelection;
11015
11044
  if (!(selectsStart || selectsEnd || selectsRange) ||
11016
11045
  !selectingDate ||
@@ -11027,11 +11056,16 @@ var Day = /** @class */ (function (_super) {
11027
11056
  (isAfter(selectingDate, startDate) || isEqual(selectingDate, startDate))) {
11028
11057
  return isDayInRange(day, startDate, selectingDate);
11029
11058
  }
11030
- if (selectsRange &&
11031
- startDate &&
11032
- !endDate &&
11033
- (isAfter(selectingDate, startDate) || isEqual(selectingDate, startDate))) {
11034
- return isDayInRange(day, startDate, selectingDate);
11059
+ if (selectsRange && startDate && !endDate) {
11060
+ if (isEqual(selectingDate, startDate)) {
11061
+ return isDayInRange(day, startDate, selectingDate);
11062
+ }
11063
+ if (isAfter(selectingDate, startDate)) {
11064
+ return isDayInRange(day, startDate, selectingDate);
11065
+ }
11066
+ if (swapRange && isBefore(selectingDate, startDate)) {
11067
+ return isDayInRange(day, selectingDate, startDate);
11068
+ }
11035
11069
  }
11036
11070
  return false;
11037
11071
  };
@@ -11040,28 +11074,33 @@ var Day = /** @class */ (function (_super) {
11040
11074
  if (!_this.isInSelectingRange()) {
11041
11075
  return false;
11042
11076
  }
11043
- var _b = _this.props, day = _b.day, startDate = _b.startDate, selectsStart = _b.selectsStart;
11077
+ var _b = _this.props, day = _b.day, startDate = _b.startDate, selectsStart = _b.selectsStart, swapRange = _b.swapRange, selectsRange = _b.selectsRange;
11044
11078
  var selectingDate = (_a = _this.props.selectingDate) !== null && _a !== void 0 ? _a : _this.props.preSelection;
11045
11079
  if (selectsStart) {
11046
11080
  return isSameDay(day, selectingDate);
11047
11081
  }
11048
- else {
11049
- return isSameDay(day, startDate);
11082
+ if (selectsRange && swapRange && startDate && selectingDate) {
11083
+ return isSameDay(day, isBefore(selectingDate, startDate) ? selectingDate : startDate);
11050
11084
  }
11085
+ return isSameDay(day, startDate);
11051
11086
  };
11052
11087
  _this.isSelectingRangeEnd = function () {
11053
11088
  var _a;
11054
11089
  if (!_this.isInSelectingRange()) {
11055
11090
  return false;
11056
11091
  }
11057
- var _b = _this.props, day = _b.day, endDate = _b.endDate, selectsEnd = _b.selectsEnd, selectsRange = _b.selectsRange;
11092
+ var _b = _this.props, day = _b.day, endDate = _b.endDate, selectsEnd = _b.selectsEnd, selectsRange = _b.selectsRange, swapRange = _b.swapRange, startDate = _b.startDate;
11058
11093
  var selectingDate = (_a = _this.props.selectingDate) !== null && _a !== void 0 ? _a : _this.props.preSelection;
11059
- if (selectsEnd || selectsRange) {
11094
+ if (selectsEnd) {
11060
11095
  return isSameDay(day, selectingDate);
11061
11096
  }
11062
- else {
11063
- return isSameDay(day, endDate);
11097
+ if (selectsRange && swapRange && startDate && selectingDate) {
11098
+ return isSameDay(day, isBefore(selectingDate, startDate) ? startDate : selectingDate);
11064
11099
  }
11100
+ if (selectsRange) {
11101
+ return isSameDay(day, selectingDate);
11102
+ }
11103
+ return isSameDay(day, endDate);
11065
11104
  };
11066
11105
  _this.isRangeStart = function () {
11067
11106
  var _a = _this.props, day = _a.day, startDate = _a.startDate, endDate = _a.endDate;
@@ -11429,7 +11468,10 @@ var Week = /** @class */ (function (_super) {
11429
11468
  "react-datepicker__week--selected": isSameDay(this.startOfWeek(), this.props.selected),
11430
11469
  "react-datepicker__week--keyboard-selected": this.isKeyboardSelected(),
11431
11470
  };
11432
- return React__namespace.default.createElement("div", { className: clsx(weekNumberClasses) }, this.renderDays());
11471
+ var customWeekClassName = this.props.weekClassName
11472
+ ? this.props.weekClassName(this.startOfWeek())
11473
+ : undefined;
11474
+ return (React__namespace.default.createElement("div", { className: clsx(weekNumberClasses, customWeekClassName) }, this.renderDays()));
11433
11475
  };
11434
11476
  return Week;
11435
11477
  }(React.Component));
@@ -12132,11 +12174,40 @@ var MonthDropdownOptions = /** @class */ (function (_super) {
12132
12174
  __extends(MonthDropdownOptions, _super);
12133
12175
  function MonthDropdownOptions() {
12134
12176
  var _this = _super !== null && _super.apply(this, arguments) || this;
12177
+ _this.monthOptionButtonsRef = {};
12135
12178
  _this.isSelectedMonth = function (i) { return _this.props.month === i; };
12179
+ _this.handleOptionKeyDown = function (i, e) {
12180
+ var _a;
12181
+ switch (e.key) {
12182
+ case "Enter":
12183
+ e.preventDefault();
12184
+ _this.onChange(i);
12185
+ break;
12186
+ case "Escape":
12187
+ e.preventDefault();
12188
+ _this.props.onCancel();
12189
+ break;
12190
+ case "ArrowUp":
12191
+ case "ArrowDown": {
12192
+ e.preventDefault();
12193
+ var newMonth = (i + (e.key === "ArrowUp" ? -1 : 1) + _this.props.monthNames.length) %
12194
+ _this.props.monthNames.length;
12195
+ (_a = _this.monthOptionButtonsRef[newMonth]) === null || _a === void 0 ? void 0 : _a.focus();
12196
+ break;
12197
+ }
12198
+ }
12199
+ };
12136
12200
  _this.renderOptions = function () {
12137
- return _this.props.monthNames.map(function (month, i) { return (React__namespace.default.createElement("div", { className: _this.isSelectedMonth(i)
12201
+ // Clear refs to prevent memory leaks on re-render
12202
+ _this.monthOptionButtonsRef = {};
12203
+ return _this.props.monthNames.map(function (month, i) { return (React__namespace.default.createElement("div", { ref: function (el) {
12204
+ _this.monthOptionButtonsRef[i] = el;
12205
+ if (_this.isSelectedMonth(i)) {
12206
+ el === null || el === void 0 ? void 0 : el.focus();
12207
+ }
12208
+ }, role: "button", tabIndex: 0, className: _this.isSelectedMonth(i)
12138
12209
  ? "react-datepicker__month-option react-datepicker__month-option--selected_month"
12139
- : "react-datepicker__month-option", key: month, onClick: _this.onChange.bind(_this, i), "aria-selected": _this.isSelectedMonth(i) ? "true" : undefined },
12210
+ : "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 },
12140
12211
  _this.isSelectedMonth(i) ? (React__namespace.default.createElement("span", { className: "react-datepicker__month-option--selected" }, "\u2713")) : (""),
12141
12212
  month)); });
12142
12213
  };
@@ -12161,7 +12232,7 @@ var MonthDropdown = /** @class */ (function (_super) {
12161
12232
  return monthNames.map(function (m, i) { return (React__namespace.default.createElement("option", { key: m, value: i }, m)); });
12162
12233
  };
12163
12234
  _this.renderSelectMode = function (monthNames) { return (React__namespace.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))); };
12164
- _this.renderReadView = function (visible, monthNames) { return (React__namespace.default.createElement("div", { key: "read", style: { visibility: visible ? "visible" : "hidden" }, className: "react-datepicker__month-read-view", onClick: _this.toggleDropdown },
12235
+ _this.renderReadView = function (visible, monthNames) { return (React__namespace.default.createElement("button", { key: "read", type: "button", style: { visibility: visible ? "visible" : "hidden" }, className: "react-datepicker__month-read-view", onClick: _this.toggleDropdown },
12165
12236
  React__namespace.default.createElement("span", { className: "react-datepicker__month-read-view--down-arrow" }),
12166
12237
  React__namespace.default.createElement("span", { className: "react-datepicker__month-read-view--selected-month" }, monthNames[_this.props.month]))); };
12167
12238
  _this.renderDropdown = function (monthNames) { return (React__namespace.default.createElement(MonthDropdownOptions, _assign({ key: "dropdown" }, _this.props, { monthNames: monthNames, onChange: _this.onChange, onCancel: _this.toggleDropdown }))); };
@@ -12649,19 +12720,20 @@ var Year$1 = /** @class */ (function (_super) {
12649
12720
  return isSameYear(_year, endDate !== null && endDate !== void 0 ? endDate : null);
12650
12721
  };
12651
12722
  _this.isKeyboardSelected = function (y) {
12652
- if (_this.props.date === undefined ||
12653
- _this.props.selected == null ||
12723
+ if (_this.props.disabledKeyboardNavigation ||
12724
+ _this.props.date === undefined ||
12654
12725
  _this.props.preSelection == null) {
12655
12726
  return;
12656
12727
  }
12657
- var _a = _this.props, minDate = _a.minDate, maxDate = _a.maxDate, excludeDates = _a.excludeDates, includeDates = _a.includeDates, filterDate = _a.filterDate;
12728
+ var _a = _this.props, minDate = _a.minDate, maxDate = _a.maxDate, excludeDates = _a.excludeDates, includeDates = _a.includeDates, filterDate = _a.filterDate, selected = _a.selected;
12658
12729
  var date = getStartOfYear(setYear(_this.props.date, y));
12659
12730
  var isDisabled = (minDate || maxDate || excludeDates || includeDates || filterDate) &&
12660
12731
  isYearDisabled(y, _this.props);
12661
- return (!_this.props.disabledKeyboardNavigation &&
12662
- !_this.props.inline &&
12663
- !isSameDay(date, getStartOfYear(_this.props.selected)) &&
12664
- isSameDay(date, getStartOfYear(_this.props.preSelection)) &&
12732
+ var isSelectedDay = !!selected && isSameDay(date, getStartOfYear(selected));
12733
+ var isKeyboardSelectedDay = isSameDay(date, getStartOfYear(_this.props.preSelection));
12734
+ return (!_this.props.inline &&
12735
+ !isSelectedDay &&
12736
+ isKeyboardSelectedDay &&
12665
12737
  !isDisabled);
12666
12738
  };
12667
12739
  _this.isSelectedYear = function (year) {
@@ -12847,11 +12919,42 @@ var YearDropdownOptions = /** @class */ (function (_super) {
12847
12919
  __extends(YearDropdownOptions, _super);
12848
12920
  function YearDropdownOptions(props) {
12849
12921
  var _this = _super.call(this, props) || this;
12922
+ _this.yearOptionButtonsRef = {};
12923
+ _this.handleOptionKeyDown = function (year, e) {
12924
+ var _a;
12925
+ switch (e.key) {
12926
+ case "Enter":
12927
+ e.preventDefault();
12928
+ _this.onChange(year);
12929
+ break;
12930
+ case "Escape":
12931
+ e.preventDefault();
12932
+ _this.props.onCancel();
12933
+ break;
12934
+ case "ArrowUp":
12935
+ case "ArrowDown": {
12936
+ e.preventDefault();
12937
+ var newYear = year + (e.key === "ArrowUp" ? 1 : -1);
12938
+ // Add bounds checking to ensure the year exists in our refs
12939
+ if (_this.yearOptionButtonsRef[newYear]) {
12940
+ (_a = _this.yearOptionButtonsRef[newYear]) === null || _a === void 0 ? void 0 : _a.focus();
12941
+ }
12942
+ break;
12943
+ }
12944
+ }
12945
+ };
12850
12946
  _this.renderOptions = function () {
12947
+ // Clear refs to prevent memory leaks on re-render
12948
+ _this.yearOptionButtonsRef = {};
12851
12949
  var selectedYear = _this.props.year;
12852
- var options = _this.state.yearsList.map(function (year) { return (React__namespace.default.createElement("div", { className: selectedYear === year
12950
+ var options = _this.state.yearsList.map(function (year) { return (React__namespace.default.createElement("div", { ref: function (el) {
12951
+ _this.yearOptionButtonsRef[year] = el;
12952
+ if (year === selectedYear) {
12953
+ el === null || el === void 0 ? void 0 : el.focus();
12954
+ }
12955
+ }, role: "button", tabIndex: 0, className: selectedYear === year
12853
12956
  ? "react-datepicker__year-option react-datepicker__year-option--selected_year"
12854
- : "react-datepicker__year-option", key: year, onClick: _this.onChange.bind(_this, year), "aria-selected": selectedYear === year ? "true" : undefined },
12957
+ : "react-datepicker__year-option", key: year, onClick: _this.onChange.bind(_this, year), onKeyDown: _this.handleOptionKeyDown.bind(_this, year), "aria-selected": selectedYear === year ? "true" : undefined },
12855
12958
  selectedYear === year ? (React__namespace.default.createElement("span", { className: "react-datepicker__year-option--selected" }, "\u2713")) : (""),
12856
12959
  year)); });
12857
12960
  var minYear = _this.props.minDate ? getYear(_this.props.minDate) : null;
@@ -12946,9 +13049,7 @@ var YearDropdown = /** @class */ (function (_super) {
12946
13049
  _this.onChange(parseInt(event.target.value));
12947
13050
  };
12948
13051
  _this.renderSelectMode = function () { return (React__namespace.default.createElement("select", { value: _this.props.year, className: "react-datepicker__year-select", onChange: _this.onSelectChange }, _this.renderSelectOptions())); };
12949
- _this.renderReadView = function (visible) { return (React__namespace.default.createElement("div", { key: "read", style: { visibility: visible ? "visible" : "hidden" }, className: "react-datepicker__year-read-view", onClick: function (event) {
12950
- return _this.toggleDropdown(event);
12951
- } },
13052
+ _this.renderReadView = function (visible) { return (React__namespace.default.createElement("button", { key: "read", type: "button", style: { visibility: visible ? "visible" : "hidden" }, className: "react-datepicker__year-read-view", onClick: _this.toggleDropdown },
12952
13053
  React__namespace.default.createElement("span", { className: "react-datepicker__year-read-view--down-arrow" }),
12953
13054
  React__namespace.default.createElement("span", { className: "react-datepicker__year-read-view--selected-year" }, _this.props.year))); };
12954
13055
  _this.renderDropdown = function () { return (React__namespace.default.createElement(YearDropdownOptions, _assign({ key: "dropdown" }, _this.props, { onChange: _this.onChange, onCancel: _this.toggleDropdown }))); };
@@ -13010,6 +13111,7 @@ var DROPDOWN_FOCUS_CLASSNAMES = [
13010
13111
  "react-datepicker__month-select",
13011
13112
  "react-datepicker__month-year-select",
13012
13113
  ];
13114
+ var OUTSIDE_CLICK_IGNORE_CLASS = "react-datepicker-ignore-onclickoutside";
13013
13115
  var isDropdownSelect = function (element) {
13014
13116
  var classNames = (element.className || "").split(/\s+/);
13015
13117
  return DROPDOWN_FOCUS_CLASSNAMES.some(function (testClassname) { return classNames.indexOf(testClassname) >= 0; });
@@ -13161,7 +13263,9 @@ var Calendar = /** @class */ (function (_super) {
13161
13263
  var startOfWeek = getStartOfWeek(date, _this.props.locale, _this.props.calendarStartDay);
13162
13264
  var dayNames = [];
13163
13265
  if (_this.props.showWeekNumbers) {
13164
- dayNames.push(React__namespace.default.createElement("div", { key: "W", className: "react-datepicker__day-name" }, _this.props.weekLabel || "#"));
13266
+ dayNames.push(React__namespace.default.createElement("div", { key: "W", className: "react-datepicker__day-name", role: "columnheader" },
13267
+ React__namespace.default.createElement("span", { className: "sr-only" }, "Week number"),
13268
+ React__namespace.default.createElement("span", { "aria-hidden": "true" }, _this.props.weekLabel || "#")));
13165
13269
  }
13166
13270
  return dayNames.concat([0, 1, 2, 3, 4, 5, 6].map(function (offset) {
13167
13271
  var day = addDays(startOfWeek, offset);
@@ -13169,7 +13273,9 @@ var Calendar = /** @class */ (function (_super) {
13169
13273
  var weekDayClassName = _this.props.weekDayClassName
13170
13274
  ? _this.props.weekDayClassName(day)
13171
13275
  : undefined;
13172
- return (React__namespace.default.createElement("div", { key: offset, "aria-label": formatDate(day, "EEEE", _this.props.locale), className: clsx("react-datepicker__day-name", weekDayClassName) }, weekDayName));
13276
+ return (React__namespace.default.createElement("div", { key: offset, role: "columnheader", className: clsx("react-datepicker__day-name", weekDayClassName) },
13277
+ React__namespace.default.createElement("span", { className: "sr-only" }, formatDate(day, "EEEE", _this.props.locale)),
13278
+ React__namespace.default.createElement("span", { "aria-hidden": "true" }, weekDayName)));
13173
13279
  }));
13174
13280
  };
13175
13281
  _this.formatWeekday = function (day, locale) {
@@ -13384,7 +13490,7 @@ var Calendar = /** @class */ (function (_super) {
13384
13490
  _this.renderMonthDropdown(i !== 0),
13385
13491
  _this.renderMonthYearDropdown(i !== 0),
13386
13492
  _this.renderYearDropdown(i !== 0)),
13387
- React__namespace.default.createElement("div", { className: "react-datepicker__day-names" }, _this.header(monthDate))));
13493
+ React__namespace.default.createElement("div", { className: "react-datepicker__day-names", role: "row" }, _this.header(monthDate))));
13388
13494
  };
13389
13495
  _this.renderCustomHeader = function (headerArgs) {
13390
13496
  var _a, _b;
@@ -13393,6 +13499,15 @@ var Calendar = /** @class */ (function (_super) {
13393
13499
  _this.props.showTimeSelectOnly) {
13394
13500
  return null;
13395
13501
  }
13502
+ var _c = _this.props, showYearPicker = _c.showYearPicker, yearItemNumber = _c.yearItemNumber;
13503
+ var visibleYearsRange;
13504
+ if (showYearPicker) {
13505
+ var _d = getYearsPeriod(monthDate, yearItemNumber), startYear = _d.startPeriod, endYear = _d.endPeriod;
13506
+ visibleYearsRange = {
13507
+ startYear: startYear,
13508
+ endYear: endYear,
13509
+ };
13510
+ }
13396
13511
  var prevMonthButtonDisabled = monthDisabledBefore(_this.state.date, _this.props);
13397
13512
  var nextMonthButtonDisabled = monthDisabledAfter(_this.state.date, _this.props);
13398
13513
  var prevYearButtonDisabled = yearDisabledBefore(_this.state.date, _this.props);
@@ -13401,7 +13516,7 @@ var Calendar = /** @class */ (function (_super) {
13401
13516
  !_this.props.showQuarterYearPicker &&
13402
13517
  !_this.props.showYearPicker;
13403
13518
  return (React__namespace.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 :
13404
- _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 })),
13519
+ _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 })),
13405
13520
  showDayNames && (React__namespace.default.createElement("div", { className: "react-datepicker__day-names" }, _this.header(monthDate)))));
13406
13521
  };
13407
13522
  _this.renderYearHeader = function (_a) {
@@ -13521,6 +13636,7 @@ var Calendar = /** @class */ (function (_super) {
13521
13636
  return {
13522
13637
  monthsShown: 1,
13523
13638
  forceShowMonthNavigation: false,
13639
+ outsideClickIgnoreClass: OUTSIDE_CLICK_IGNORE_CLASS,
13524
13640
  timeCaption: "Time",
13525
13641
  previousYearButtonLabel: "Previous Year",
13526
13642
  nextYearButtonLabel: "Next Year",
@@ -13754,7 +13870,7 @@ var TabLoop = /** @class */ (function (_super) {
13754
13870
  * @returns A new component with floating behavior.
13755
13871
  */
13756
13872
  function withFloating(Component) {
13757
- var WithFloating = function (props) {
13873
+ function WithFloating(props) {
13758
13874
  var _a;
13759
13875
  var hidePopper = typeof props.hidePopper === "boolean" ? props.hidePopper : true;
13760
13876
  var arrowRef = React.useRef(null);
@@ -13765,51 +13881,35 @@ function withFloating(Component) {
13765
13881
  ], ((_a = props.popperModifiers) !== null && _a !== void 0 ? _a : []), true) }, props.popperProps));
13766
13882
  var componentProps = _assign(_assign({}, props), { hidePopper: hidePopper, popperProps: _assign(_assign({}, floatingProps), { arrowRef: arrowRef }) });
13767
13883
  return React__namespace.default.createElement(Component, _assign({}, componentProps));
13768
- };
13884
+ }
13885
+ WithFloating.displayName = "withFloating(".concat(Component.displayName || Component.name || "Component", ")");
13769
13886
  return WithFloating;
13770
13887
  }
13771
13888
 
13772
13889
  // Exported for testing purposes
13773
- var PopperComponent = /** @class */ (function (_super) {
13774
- __extends(PopperComponent, _super);
13775
- function PopperComponent() {
13776
- return _super !== null && _super.apply(this, arguments) || this;
13777
- }
13778
- Object.defineProperty(PopperComponent, "defaultProps", {
13779
- get: function () {
13780
- return {
13781
- hidePopper: true,
13782
- };
13783
- },
13784
- enumerable: false,
13785
- configurable: true
13786
- });
13787
- PopperComponent.prototype.render = function () {
13788
- 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;
13789
- var popper = undefined;
13790
- if (!hidePopper) {
13791
- var classes = clsx("react-datepicker-popper", className);
13792
- popper = (React__namespace.default.createElement(TabLoop, { enableTabLoop: enableTabLoop },
13793
- React__namespace.default.createElement("div", { ref: popperProps.refs.setFloating, style: popperProps.floatingStyles, className: classes, "data-placement": popperProps.placement, onKeyDown: popperOnKeyDown },
13794
- popperComponent,
13795
- showArrow && (React__namespace.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" })))));
13796
- }
13797
- if (this.props.popperContainer) {
13798
- popper = React.createElement(this.props.popperContainer, {}, popper);
13799
- }
13800
- if (portalId && !hidePopper) {
13801
- popper = (React__namespace.default.createElement(Portal, { portalId: portalId, portalHost: portalHost }, popper));
13802
- }
13803
- var wrapperClasses = clsx("react-datepicker-wrapper", wrapperClassName);
13804
- return (React__namespace.default.createElement(React__namespace.default.Fragment, null,
13805
- React__namespace.default.createElement("div", { ref: popperProps.refs.setReference, className: wrapperClasses }, targetComponent),
13806
- popper));
13807
- };
13808
- return PopperComponent;
13809
- }(React.Component));
13890
+ var PopperComponent = function (props) {
13891
+ 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;
13892
+ var popper = undefined;
13893
+ if (!hidePopper) {
13894
+ var classes = clsx("react-datepicker-popper", className);
13895
+ popper = (React__namespace.default.createElement(TabLoop, { enableTabLoop: enableTabLoop },
13896
+ React__namespace.default.createElement("div", { ref: popperProps.refs.setFloating, style: popperProps.floatingStyles, className: classes, "data-placement": popperProps.placement, onKeyDown: popperOnKeyDown },
13897
+ popperComponent,
13898
+ showArrow && (React__namespace.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" })))));
13899
+ }
13900
+ if (props.popperContainer) {
13901
+ popper = React.createElement(props.popperContainer, {}, popper);
13902
+ }
13903
+ if (portalId && !hidePopper) {
13904
+ popper = (React__namespace.default.createElement(Portal, { portalId: portalId, portalHost: portalHost }, popper));
13905
+ }
13906
+ var wrapperClasses = clsx("react-datepicker-wrapper", wrapperClassName);
13907
+ return (React__namespace.default.createElement(React__namespace.default.Fragment, null,
13908
+ React__namespace.default.createElement("div", { ref: popperProps.refs.setReference, className: wrapperClasses }, targetComponent),
13909
+ popper));
13910
+ };
13810
13911
  var PopperComponent$1 = withFloating(PopperComponent);
13811
13912
 
13812
- var outsideClickIgnoreClass = "react-datepicker-ignore-onclickoutside";
13813
13913
  // Compares dates year+month combinations
13814
13914
  function hasPreSelectionChanged(date1, date2) {
13815
13915
  if (date1 && date2) {
@@ -13875,6 +13975,35 @@ var DatePicker = /** @class */ (function (_super) {
13875
13975
  wasHidden: false,
13876
13976
  };
13877
13977
  };
13978
+ _this.getInputValue = function () {
13979
+ var _a;
13980
+ 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;
13981
+ var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
13982
+ var inputValue = _this.state.inputValue;
13983
+ if (typeof value === "string") {
13984
+ return value;
13985
+ }
13986
+ else if (typeof inputValue === "string") {
13987
+ return inputValue;
13988
+ }
13989
+ else if (selectsRange) {
13990
+ return safeDateRangeFormat(startDate, endDate, {
13991
+ dateFormat: dateFormat,
13992
+ locale: locale,
13993
+ rangeSeparator: rangeSeparator,
13994
+ });
13995
+ }
13996
+ else if (selectsMultiple) {
13997
+ return safeMultipleDatesFormat(selectedDates !== null && selectedDates !== void 0 ? selectedDates : [], {
13998
+ dateFormat: dateFormat,
13999
+ locale: locale,
14000
+ });
14001
+ }
14002
+ return safeDateFormat(selected, {
14003
+ dateFormat: dateFormat,
14004
+ locale: locale,
14005
+ });
14006
+ };
13878
14007
  _this.resetHiddenStatus = function () {
13879
14008
  _this.setState(_assign(_assign({}, _this.state), { wasHidden: false }));
13880
14009
  };
@@ -13974,11 +14103,15 @@ var DatePicker = /** @class */ (function (_super) {
13974
14103
  _this.handleDropdownFocus = function () {
13975
14104
  _this.cancelFocusInput();
13976
14105
  };
14106
+ _this.resetInputValue = function () {
14107
+ _this.setState(_assign(_assign({}, _this.state), { inputValue: null }));
14108
+ };
13977
14109
  _this.handleBlur = function (event) {
13978
14110
  var _a, _b;
13979
14111
  if (!_this.state.open || _this.props.withPortal || _this.props.showTimeInput) {
13980
14112
  (_b = (_a = _this.props).onBlur) === null || _b === void 0 ? void 0 : _b.call(_a, event);
13981
14113
  }
14114
+ _this.resetInputValue();
13982
14115
  if (_this.state.open && _this.props.open === false) {
13983
14116
  _this.setOpen(false);
13984
14117
  }
@@ -14019,11 +14152,17 @@ var DatePicker = /** @class */ (function (_super) {
14019
14152
  var strictParsing = (_b = _this.props.strictParsing) !== null && _b !== void 0 ? _b : DatePicker.defaultProps.strictParsing;
14020
14153
  var value = (event === null || event === void 0 ? void 0 : event.target) instanceof HTMLInputElement ? event.target.value : "";
14021
14154
  if (selectsRange) {
14155
+ var rangeSeparator = _this.props.rangeSeparator;
14156
+ var trimmedRangeSeparator = rangeSeparator.trim();
14022
14157
  var _g = value
14023
- .split(dateFormat.includes("-") ? DATE_RANGE_SEPARATOR : "-", 2)
14158
+ .split(dateFormat.includes(trimmedRangeSeparator)
14159
+ ? rangeSeparator
14160
+ : trimmedRangeSeparator, 2)
14024
14161
  .map(function (val) { return val.trim(); }), valueStart = _g[0], valueEnd = _g[1];
14025
14162
  var startDateNew = parseDate(valueStart !== null && valueStart !== void 0 ? valueStart : "", dateFormat, _this.props.locale, strictParsing);
14026
- var endDateNew = parseDate(valueEnd !== null && valueEnd !== void 0 ? valueEnd : "", dateFormat, _this.props.locale, strictParsing);
14163
+ var endDateNew = startDateNew
14164
+ ? parseDate(valueEnd !== null && valueEnd !== void 0 ? valueEnd : "", dateFormat, _this.props.locale, strictParsing)
14165
+ : null;
14027
14166
  var startChanged = (startDate === null || startDate === void 0 ? void 0 : startDate.getTime()) !== (startDateNew === null || startDateNew === void 0 ? void 0 : startDateNew.getTime());
14028
14167
  var endChanged = (endDate === null || endDate === void 0 ? void 0 : endDate.getTime()) !== (endDateNew === null || endDateNew === void 0 ? void 0 : endDateNew.getTime());
14029
14168
  if (!startChanged && !endChanged) {
@@ -14049,7 +14188,12 @@ var DatePicker = /** @class */ (function (_super) {
14049
14188
  _this.handleSelect = function (date, event, monthSelectedIn) {
14050
14189
  if (_this.props.readOnly)
14051
14190
  return;
14052
- if (_this.props.shouldCloseOnSelect && !_this.props.showTimeSelect) {
14191
+ var _a = _this.props, selectsRange = _a.selectsRange, startDate = _a.startDate, endDate = _a.endDate, swapRange = _a.swapRange;
14192
+ var isDateSelectionComplete = !selectsRange ||
14193
+ (startDate && !endDate && (swapRange || !isDateBefore(date, startDate)));
14194
+ if (_this.props.shouldCloseOnSelect &&
14195
+ !_this.props.showTimeSelect &&
14196
+ isDateSelectionComplete) {
14053
14197
  // Preventing onFocus event to fix issue
14054
14198
  // https://github.com/Hacker0x01/react-datepicker/issues/628
14055
14199
  _this.sendFocusBackToInput();
@@ -14064,16 +14208,8 @@ var DatePicker = /** @class */ (function (_super) {
14064
14208
  if (!_this.props.shouldCloseOnSelect || _this.props.showTimeSelect) {
14065
14209
  _this.setPreSelection(date);
14066
14210
  }
14067
- else if (!_this.props.inline) {
14068
- if (!_this.props.selectsRange) {
14069
- _this.setOpen(false);
14070
- }
14071
- var _a = _this.props, startDate = _a.startDate, endDate = _a.endDate;
14072
- if (startDate &&
14073
- !endDate &&
14074
- (_this.props.swapRange || !isDateBefore(date, startDate))) {
14075
- _this.setOpen(false);
14076
- }
14211
+ else if (isDateSelectionComplete) {
14212
+ _this.setOpen(false);
14077
14213
  }
14078
14214
  };
14079
14215
  // 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)
@@ -14138,6 +14274,7 @@ var DatePicker = /** @class */ (function (_super) {
14138
14274
  if (selectsRange) {
14139
14275
  var noRanges = !startDate && !endDate;
14140
14276
  var hasStartRange = startDate && !endDate;
14277
+ var hasOnlyEndRange = !startDate && !!endDate;
14141
14278
  var isRangeFilled = startDate && endDate;
14142
14279
  if (noRanges) {
14143
14280
  onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, null], event);
@@ -14158,6 +14295,14 @@ var DatePicker = /** @class */ (function (_super) {
14158
14295
  onChange === null || onChange === void 0 ? void 0 : onChange([startDate, changedDate], event);
14159
14296
  }
14160
14297
  }
14298
+ else if (hasOnlyEndRange) {
14299
+ if (changedDate && isDateBefore(changedDate, endDate)) {
14300
+ onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, endDate], event);
14301
+ }
14302
+ else {
14303
+ onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, null], event);
14304
+ }
14305
+ }
14161
14306
  if (isRangeFilled) {
14162
14307
  onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, null], event);
14163
14308
  }
@@ -14531,10 +14676,12 @@ var DatePicker = /** @class */ (function (_super) {
14531
14676
  }
14532
14677
  return (React__namespace.default.createElement(Calendar, _assign({ showMonthYearDropdown: undefined, ref: function (elem) {
14533
14678
  _this.calendar = elem;
14534
- } }, _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));
14679
+ } }, _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));
14535
14680
  };
14536
14681
  _this.renderAriaLiveRegion = function () {
14537
- var _a = _this.props, _b = _a.dateFormat, dateFormat = _b === void 0 ? DatePicker.defaultProps.dateFormat : _b, locale = _a.locale;
14682
+ var _a;
14683
+ var locale = _this.props.locale;
14684
+ var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
14538
14685
  var isContainsTime = _this.props.showTimeInput || _this.props.showTimeSelect;
14539
14686
  var longDateFormat = isContainsTime ? "PPPPp" : "PPPP";
14540
14687
  var ariaLiveMessage;
@@ -14577,36 +14724,17 @@ var DatePicker = /** @class */ (function (_super) {
14577
14724
  };
14578
14725
  _this.renderDateInput = function () {
14579
14726
  var _a, _b;
14580
- var _c;
14581
14727
  var className = clsx(_this.props.className, (_a = {},
14582
- _a[outsideClickIgnoreClass] = _this.state.open,
14728
+ _a[_this.props.outsideClickIgnoreClass ||
14729
+ DatePicker.defaultProps.outsideClickIgnoreClass] = _this.state.open,
14583
14730
  _a));
14584
14731
  var customInput = _this.props.customInput || React__namespace.default.createElement("input", { type: "text" });
14585
14732
  var customInputRef = _this.props.customInputRef || "ref";
14586
- var _d = _this.props, _e = _d.dateFormat, dateFormat = _e === void 0 ? DatePicker.defaultProps.dateFormat : _e, locale = _d.locale;
14587
- var inputValue = typeof _this.props.value === "string"
14588
- ? _this.props.value
14589
- : typeof _this.state.inputValue === "string"
14590
- ? _this.state.inputValue
14591
- : _this.props.selectsRange
14592
- ? safeDateRangeFormat(_this.props.startDate, _this.props.endDate, {
14593
- dateFormat: dateFormat,
14594
- locale: locale,
14595
- })
14596
- : _this.props.selectsMultiple
14597
- ? safeMultipleDatesFormat((_c = _this.props.selectedDates) !== null && _c !== void 0 ? _c : [], {
14598
- dateFormat: dateFormat,
14599
- locale: locale,
14600
- })
14601
- : safeDateFormat(_this.props.selected, {
14602
- dateFormat: dateFormat,
14603
- locale: locale,
14604
- });
14605
14733
  return React.cloneElement(customInput, (_b = {},
14606
14734
  _b[customInputRef] = function (input) {
14607
14735
  _this.input = input;
14608
14736
  },
14609
- _b.value = inputValue,
14737
+ _b.value = _this.getInputValue(),
14610
14738
  _b.onBlur = _this.handleBlur,
14611
14739
  _b.onChange = _this.handleChange,
14612
14740
  _b.onClick = _this.onInputClick,
@@ -14659,7 +14787,9 @@ var DatePicker = /** @class */ (function (_super) {
14659
14787
  dropdownMode: "scroll",
14660
14788
  preventOpenOnFocus: false,
14661
14789
  monthsShown: 1,
14790
+ outsideClickIgnoreClass: OUTSIDE_CLICK_IGNORE_CLASS,
14662
14791
  readOnly: false,
14792
+ rangeSeparator: DATE_RANGE_SEPARATOR,
14663
14793
  withPortal: false,
14664
14794
  selectsDisabledDaysInRange: false,
14665
14795
  shouldCloseOnSelect: true,
@@ -15175,4 +15305,4 @@ exports.DatePickerGroup = DatePickerGroup;
15175
15305
  exports.HelperText = HelperText;
15176
15306
  exports.InlineDatePicker = InlineDatePicker;
15177
15307
  exports.ValidationText = ValidationText;
15178
- //# sourceMappingURL=InlineDatePicker-DFv_uHo9.js.map
15308
+ //# sourceMappingURL=InlineDatePicker-CmPTTPFs.js.map