@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.
- package/lib/cjs/AddressInput-BwC_Fa3a.js.map +1 -1
- package/lib/cjs/DatePicker.cjs +1 -1
- package/lib/cjs/Form.cjs +2 -2
- package/lib/cjs/{FormikContainer-CY2nLsAs.js → FormikContainer-2SerL4WB.js} +2 -2
- package/lib/cjs/{FormikContainer-CY2nLsAs.js.map → FormikContainer-2SerL4WB.js.map} +1 -1
- package/lib/cjs/{InlineDatePicker-DFv_uHo9.js → InlineDatePicker-CmPTTPFs.js} +283 -153
- package/lib/cjs/InlineDatePicker-CmPTTPFs.js.map +1 -0
- package/lib/cjs/InlineDatePicker.cjs +1 -1
- package/lib/cjs/{InlineDescriptiveDropdown-BaBs9GC1.js → InlineDescriptiveDropdown-BLC78YOL.js} +2 -2
- package/lib/cjs/{InlineDescriptiveDropdown-BaBs9GC1.js.map → InlineDescriptiveDropdown-BLC78YOL.js.map} +1 -1
- package/lib/cjs/InlineDescriptiveDropdown.cjs +1 -1
- package/lib/cjs/index.cjs +3 -3
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/AddressInput-OGU58AzF.js.map +1 -1
- package/lib/esm/DatePicker.js +1 -1
- package/lib/esm/Form.js +2 -2
- package/lib/esm/{FormikContainer-SJPYfIkF.js → FormikContainer-Dhp0sMJc.js} +2 -2
- package/lib/esm/{FormikContainer-SJPYfIkF.js.map → FormikContainer-Dhp0sMJc.js.map} +1 -1
- package/lib/esm/{InlineDatePicker-ClVBWEzW.js → InlineDatePicker-xO3XGIcG.js} +284 -154
- package/lib/esm/InlineDatePicker-xO3XGIcG.js.map +1 -0
- package/lib/esm/InlineDatePicker.js +1 -1
- package/lib/esm/{InlineDescriptiveDropdown-Dr3tXxF5.js → InlineDescriptiveDropdown-DrkAZ12b.js} +2 -2
- package/lib/esm/{InlineDescriptiveDropdown-Dr3tXxF5.js.map → InlineDescriptiveDropdown-DrkAZ12b.js.map} +1 -1
- package/lib/esm/InlineDescriptiveDropdown.js +1 -1
- package/lib/esm/index.js +3 -3
- package/lib/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/lib/cjs/InlineDatePicker-DFv_uHo9.js.map +0 -1
- package/lib/esm/InlineDatePicker-ClVBWEzW.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { b as __makeTemplateObject, f as __rest, _ as __assign } from './_tslib-
|
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import React__default, { useLayoutEffect,
|
|
5
|
+
import React__default, { useLayoutEffect, cloneElement, createRef, Component, useRef, useCallback, useEffect, createElement, useState, forwardRef } from 'react';
|
|
6
6
|
import * as ReactDOM from 'react-dom';
|
|
7
7
|
import ReactDOM__default from 'react-dom';
|
|
8
8
|
import { colors } from './colors.js';
|
|
@@ -7497,34 +7497,40 @@ 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']);
|
|
7500
7501
|
function isOverflowElement(element) {
|
|
7501
7502
|
const {
|
|
7502
7503
|
overflow,
|
|
7503
7504
|
overflowX,
|
|
7504
7505
|
overflowY,
|
|
7505
7506
|
display
|
|
7506
|
-
} = getComputedStyle(element);
|
|
7507
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !
|
|
7507
|
+
} = getComputedStyle$1(element);
|
|
7508
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
|
|
7508
7509
|
}
|
|
7510
|
+
const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
|
|
7509
7511
|
function isTableElement(element) {
|
|
7510
|
-
return
|
|
7512
|
+
return tableElements.has(getNodeName(element));
|
|
7511
7513
|
}
|
|
7514
|
+
const topLayerSelectors = [':popover-open', ':modal'];
|
|
7512
7515
|
function isTopLayer(element) {
|
|
7513
|
-
return
|
|
7516
|
+
return topLayerSelectors.some(selector => {
|
|
7514
7517
|
try {
|
|
7515
7518
|
return element.matches(selector);
|
|
7516
|
-
} catch (
|
|
7519
|
+
} catch (_e) {
|
|
7517
7520
|
return false;
|
|
7518
7521
|
}
|
|
7519
7522
|
});
|
|
7520
7523
|
}
|
|
7524
|
+
const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
|
|
7525
|
+
const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
|
|
7526
|
+
const containValues = ['paint', 'layout', 'strict', 'content'];
|
|
7521
7527
|
function isContainingBlock(elementOrCss) {
|
|
7522
7528
|
const webkit = isWebKit();
|
|
7523
|
-
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
7529
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
7524
7530
|
|
|
7525
7531
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
7526
7532
|
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
7527
|
-
return
|
|
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));
|
|
7528
7534
|
}
|
|
7529
7535
|
function getContainingBlock(element) {
|
|
7530
7536
|
let currentNode = getParentNode(element);
|
|
@@ -7542,10 +7548,11 @@ function isWebKit() {
|
|
|
7542
7548
|
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
7543
7549
|
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
7544
7550
|
}
|
|
7551
|
+
const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
|
|
7545
7552
|
function isLastTraversableNode(node) {
|
|
7546
|
-
return
|
|
7553
|
+
return lastTraversableNodeNames.has(getNodeName(node));
|
|
7547
7554
|
}
|
|
7548
|
-
function getComputedStyle(element) {
|
|
7555
|
+
function getComputedStyle$1(element) {
|
|
7549
7556
|
return getWindow(element).getComputedStyle(element);
|
|
7550
7557
|
}
|
|
7551
7558
|
function getNodeScroll(element) {
|
|
@@ -7647,8 +7654,9 @@ function getOppositeAxis(axis) {
|
|
|
7647
7654
|
function getAxisLength(axis) {
|
|
7648
7655
|
return axis === 'y' ? 'height' : 'width';
|
|
7649
7656
|
}
|
|
7657
|
+
const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
|
|
7650
7658
|
function getSideAxis(placement) {
|
|
7651
|
-
return
|
|
7659
|
+
return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
|
|
7652
7660
|
}
|
|
7653
7661
|
function getAlignmentAxis(placement) {
|
|
7654
7662
|
return getOppositeAxis(getSideAxis(placement));
|
|
@@ -7673,19 +7681,19 @@ function getExpandedPlacements(placement) {
|
|
|
7673
7681
|
function getOppositeAlignmentPlacement(placement) {
|
|
7674
7682
|
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
7675
7683
|
}
|
|
7684
|
+
const lrPlacement = ['left', 'right'];
|
|
7685
|
+
const rlPlacement = ['right', 'left'];
|
|
7686
|
+
const tbPlacement = ['top', 'bottom'];
|
|
7687
|
+
const btPlacement = ['bottom', 'top'];
|
|
7676
7688
|
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'];
|
|
7681
7689
|
switch (side) {
|
|
7682
7690
|
case 'top':
|
|
7683
7691
|
case 'bottom':
|
|
7684
|
-
if (rtl) return isStart ?
|
|
7685
|
-
return isStart ?
|
|
7692
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
7693
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
7686
7694
|
case 'left':
|
|
7687
7695
|
case 'right':
|
|
7688
|
-
return isStart ?
|
|
7696
|
+
return isStart ? tbPlacement : btPlacement;
|
|
7689
7697
|
default:
|
|
7690
7698
|
return [];
|
|
7691
7699
|
}
|
|
@@ -8137,7 +8145,7 @@ const flip$2 = function (options) {
|
|
|
8137
8145
|
if (!ignoreCrossAxisOverflow ||
|
|
8138
8146
|
// We leave the current main axis only if every placement on that axis
|
|
8139
8147
|
// overflows the main axis.
|
|
8140
|
-
overflowsData.every(d => d.overflows[0] > 0
|
|
8148
|
+
overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
8141
8149
|
// Try next placement and re-run the lifecycle.
|
|
8142
8150
|
return {
|
|
8143
8151
|
data: {
|
|
@@ -8194,6 +8202,8 @@ const flip$2 = function (options) {
|
|
|
8194
8202
|
};
|
|
8195
8203
|
};
|
|
8196
8204
|
|
|
8205
|
+
const originSides = /*#__PURE__*/new Set(['left', 'top']);
|
|
8206
|
+
|
|
8197
8207
|
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
8198
8208
|
// Derivable.
|
|
8199
8209
|
|
|
@@ -8207,7 +8217,7 @@ async function convertValueToCoords(state, options) {
|
|
|
8207
8217
|
const side = getSide(placement);
|
|
8208
8218
|
const alignment = getAlignment(placement);
|
|
8209
8219
|
const isVertical = getSideAxis(placement) === 'y';
|
|
8210
|
-
const mainAxisMulti =
|
|
8220
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
8211
8221
|
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
8212
8222
|
const rawValue = evaluate(options, state);
|
|
8213
8223
|
|
|
@@ -8279,7 +8289,7 @@ const offset$2 = function (options) {
|
|
|
8279
8289
|
};
|
|
8280
8290
|
|
|
8281
8291
|
function getCssDimensions(element) {
|
|
8282
|
-
const css = getComputedStyle(element);
|
|
8292
|
+
const css = getComputedStyle$1(element);
|
|
8283
8293
|
// In testing environments, the `width` and `height` properties are empty
|
|
8284
8294
|
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
8285
8295
|
let width = parseFloat(css.width) || 0;
|
|
@@ -8384,7 +8394,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
8384
8394
|
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
8385
8395
|
const iframeScale = getScale(currentIFrame);
|
|
8386
8396
|
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
8387
|
-
const css = getComputedStyle(currentIFrame);
|
|
8397
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
8388
8398
|
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
8389
8399
|
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
8390
8400
|
x *= iframeScale.x;
|
|
@@ -8415,14 +8425,9 @@ function getWindowScrollBarX(element, rect) {
|
|
|
8415
8425
|
return rect.left + leftScroll;
|
|
8416
8426
|
}
|
|
8417
8427
|
|
|
8418
|
-
function getHTMLOffset(documentElement, scroll
|
|
8419
|
-
if (ignoreScrollbarX === void 0) {
|
|
8420
|
-
ignoreScrollbarX = false;
|
|
8421
|
-
}
|
|
8428
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
8422
8429
|
const htmlRect = documentElement.getBoundingClientRect();
|
|
8423
|
-
const x = htmlRect.left + scroll.scrollLeft - (
|
|
8424
|
-
// RTL <body> scrollbar.
|
|
8425
|
-
getWindowScrollBarX(documentElement, htmlRect));
|
|
8430
|
+
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
8426
8431
|
const y = htmlRect.top + scroll.scrollTop;
|
|
8427
8432
|
return {
|
|
8428
8433
|
x,
|
|
@@ -8461,7 +8466,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
8461
8466
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
8462
8467
|
}
|
|
8463
8468
|
}
|
|
8464
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll
|
|
8469
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
8465
8470
|
return {
|
|
8466
8471
|
width: rect.width * scale.x,
|
|
8467
8472
|
height: rect.height * scale.y,
|
|
@@ -8484,7 +8489,7 @@ function getDocumentRect(element) {
|
|
|
8484
8489
|
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
8485
8490
|
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
8486
8491
|
const y = -scroll.scrollTop;
|
|
8487
|
-
if (getComputedStyle(body).direction === 'rtl') {
|
|
8492
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
8488
8493
|
x += max(html.clientWidth, body.clientWidth) - width;
|
|
8489
8494
|
}
|
|
8490
8495
|
return {
|
|
@@ -8495,6 +8500,10 @@ function getDocumentRect(element) {
|
|
|
8495
8500
|
};
|
|
8496
8501
|
}
|
|
8497
8502
|
|
|
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;
|
|
8498
8507
|
function getViewportRect(element, strategy) {
|
|
8499
8508
|
const win = getWindow(element);
|
|
8500
8509
|
const html = getDocumentElement(element);
|
|
@@ -8512,6 +8521,24 @@ function getViewportRect(element, strategy) {
|
|
|
8512
8521
|
y = visualViewport.offsetTop;
|
|
8513
8522
|
}
|
|
8514
8523
|
}
|
|
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
|
+
}
|
|
8515
8542
|
return {
|
|
8516
8543
|
width,
|
|
8517
8544
|
height,
|
|
@@ -8520,6 +8547,7 @@ function getViewportRect(element, strategy) {
|
|
|
8520
8547
|
};
|
|
8521
8548
|
}
|
|
8522
8549
|
|
|
8550
|
+
const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
|
|
8523
8551
|
// Returns the inner client rect, subtracting scrollbars if present.
|
|
8524
8552
|
function getInnerBoundingClientRect(element, strategy) {
|
|
8525
8553
|
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
@@ -8561,7 +8589,7 @@ function hasFixedPositionAncestor(element, stopNode) {
|
|
|
8561
8589
|
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
8562
8590
|
return false;
|
|
8563
8591
|
}
|
|
8564
|
-
return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
8592
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
8565
8593
|
}
|
|
8566
8594
|
|
|
8567
8595
|
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
@@ -8574,17 +8602,17 @@ function getClippingElementAncestors(element, cache) {
|
|
|
8574
8602
|
}
|
|
8575
8603
|
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
8576
8604
|
let currentContainingBlockComputedStyle = null;
|
|
8577
|
-
const elementIsFixed = getComputedStyle(element).position === 'fixed';
|
|
8605
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
8578
8606
|
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
8579
8607
|
|
|
8580
8608
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
8581
8609
|
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
8582
|
-
const computedStyle = getComputedStyle(currentNode);
|
|
8610
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
8583
8611
|
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
8584
8612
|
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
8585
8613
|
currentContainingBlockComputedStyle = null;
|
|
8586
8614
|
}
|
|
8587
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle &&
|
|
8615
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
8588
8616
|
if (shouldDropCurrentNode) {
|
|
8589
8617
|
// Drop non-containing blocks.
|
|
8590
8618
|
result = result.filter(ancestor => ancestor !== currentNode);
|
|
@@ -8680,11 +8708,11 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
8680
8708
|
}
|
|
8681
8709
|
|
|
8682
8710
|
function isStaticPositioned(element) {
|
|
8683
|
-
return getComputedStyle(element).position === 'static';
|
|
8711
|
+
return getComputedStyle$1(element).position === 'static';
|
|
8684
8712
|
}
|
|
8685
8713
|
|
|
8686
8714
|
function getTrueOffsetParent(element, polyfill) {
|
|
8687
|
-
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
8715
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
8688
8716
|
return null;
|
|
8689
8717
|
}
|
|
8690
8718
|
if (polyfill) {
|
|
@@ -8745,7 +8773,7 @@ const getElementRects = async function (data) {
|
|
|
8745
8773
|
};
|
|
8746
8774
|
|
|
8747
8775
|
function isRTL(element) {
|
|
8748
|
-
return getComputedStyle(element).direction === 'rtl';
|
|
8776
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
8749
8777
|
}
|
|
8750
8778
|
|
|
8751
8779
|
const platform = {
|
|
@@ -9385,7 +9413,7 @@ const FloatingArrow = /*#__PURE__*/React.forwardRef(function FloatingArrow(props
|
|
|
9385
9413
|
// https://github.com/floating-ui/floating-ui/issues/2932
|
|
9386
9414
|
index$1(() => {
|
|
9387
9415
|
if (!floating) return;
|
|
9388
|
-
const isRTL = getComputedStyle(floating).direction === 'rtl';
|
|
9416
|
+
const isRTL = getComputedStyle$1(floating).direction === 'rtl';
|
|
9389
9417
|
if (isRTL) {
|
|
9390
9418
|
setIsRTL(true);
|
|
9391
9419
|
}
|
|
@@ -9644,7 +9672,7 @@ function useFloating(options) {
|
|
|
9644
9672
|
}
|
|
9645
9673
|
|
|
9646
9674
|
/*!
|
|
9647
|
-
react-datepicker v8.
|
|
9675
|
+
react-datepicker v8.6.0
|
|
9648
9676
|
https://github.com/Hacker0x01/react-datepicker
|
|
9649
9677
|
Released under the MIT License.
|
|
9650
9678
|
*/
|
|
@@ -9879,12 +9907,13 @@ var DATE_RANGE_SEPARATOR = " - ";
|
|
|
9879
9907
|
* @returns - The formatted date range or an empty string.
|
|
9880
9908
|
*/
|
|
9881
9909
|
function safeDateRangeFormat(startDate, endDate, props) {
|
|
9882
|
-
if (!startDate) {
|
|
9910
|
+
if (!startDate && !endDate) {
|
|
9883
9911
|
return "";
|
|
9884
9912
|
}
|
|
9885
|
-
var formattedStartDate = safeDateFormat(startDate, props);
|
|
9913
|
+
var formattedStartDate = startDate ? safeDateFormat(startDate, props) : "";
|
|
9886
9914
|
var formattedEndDate = endDate ? safeDateFormat(endDate, props) : "";
|
|
9887
|
-
|
|
9915
|
+
var dateRangeSeparator = props.rangeSeparator || DATE_RANGE_SEPARATOR;
|
|
9916
|
+
return "".concat(formattedStartDate).concat(dateRangeSeparator).concat(formattedEndDate);
|
|
9888
9917
|
}
|
|
9889
9918
|
/**
|
|
9890
9919
|
* Safely formats multiple dates.
|
|
@@ -10986,7 +11015,7 @@ var Day = /** @class */ (function (_super) {
|
|
|
10986
11015
|
};
|
|
10987
11016
|
_this.isInSelectingRange = function () {
|
|
10988
11017
|
var _a;
|
|
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;
|
|
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;
|
|
10990
11019
|
var selectingDate = (_a = _this.props.selectingDate) !== null && _a !== void 0 ? _a : _this.props.preSelection;
|
|
10991
11020
|
if (!(selectsStart || selectsEnd || selectsRange) ||
|
|
10992
11021
|
!selectingDate ||
|
|
@@ -11003,11 +11032,16 @@ var Day = /** @class */ (function (_super) {
|
|
|
11003
11032
|
(isAfter(selectingDate, startDate) || isEqual(selectingDate, startDate))) {
|
|
11004
11033
|
return isDayInRange(day, startDate, selectingDate);
|
|
11005
11034
|
}
|
|
11006
|
-
if (selectsRange &&
|
|
11007
|
-
startDate
|
|
11008
|
-
|
|
11009
|
-
|
|
11010
|
-
|
|
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
|
+
}
|
|
11011
11045
|
}
|
|
11012
11046
|
return false;
|
|
11013
11047
|
};
|
|
@@ -11016,28 +11050,33 @@ var Day = /** @class */ (function (_super) {
|
|
|
11016
11050
|
if (!_this.isInSelectingRange()) {
|
|
11017
11051
|
return false;
|
|
11018
11052
|
}
|
|
11019
|
-
var _b = _this.props, day = _b.day, startDate = _b.startDate, selectsStart = _b.selectsStart;
|
|
11053
|
+
var _b = _this.props, day = _b.day, startDate = _b.startDate, selectsStart = _b.selectsStart, swapRange = _b.swapRange, selectsRange = _b.selectsRange;
|
|
11020
11054
|
var selectingDate = (_a = _this.props.selectingDate) !== null && _a !== void 0 ? _a : _this.props.preSelection;
|
|
11021
11055
|
if (selectsStart) {
|
|
11022
11056
|
return isSameDay(day, selectingDate);
|
|
11023
11057
|
}
|
|
11024
|
-
|
|
11025
|
-
return isSameDay(day, startDate);
|
|
11058
|
+
if (selectsRange && swapRange && startDate && selectingDate) {
|
|
11059
|
+
return isSameDay(day, isBefore(selectingDate, startDate) ? selectingDate : startDate);
|
|
11026
11060
|
}
|
|
11061
|
+
return isSameDay(day, startDate);
|
|
11027
11062
|
};
|
|
11028
11063
|
_this.isSelectingRangeEnd = function () {
|
|
11029
11064
|
var _a;
|
|
11030
11065
|
if (!_this.isInSelectingRange()) {
|
|
11031
11066
|
return false;
|
|
11032
11067
|
}
|
|
11033
|
-
var _b = _this.props, day = _b.day, endDate = _b.endDate, selectsEnd = _b.selectsEnd, selectsRange = _b.selectsRange;
|
|
11068
|
+
var _b = _this.props, day = _b.day, endDate = _b.endDate, selectsEnd = _b.selectsEnd, selectsRange = _b.selectsRange, swapRange = _b.swapRange, startDate = _b.startDate;
|
|
11034
11069
|
var selectingDate = (_a = _this.props.selectingDate) !== null && _a !== void 0 ? _a : _this.props.preSelection;
|
|
11035
|
-
if (selectsEnd
|
|
11070
|
+
if (selectsEnd) {
|
|
11036
11071
|
return isSameDay(day, selectingDate);
|
|
11037
11072
|
}
|
|
11038
|
-
|
|
11039
|
-
return isSameDay(day,
|
|
11073
|
+
if (selectsRange && swapRange && startDate && selectingDate) {
|
|
11074
|
+
return isSameDay(day, isBefore(selectingDate, startDate) ? startDate : selectingDate);
|
|
11040
11075
|
}
|
|
11076
|
+
if (selectsRange) {
|
|
11077
|
+
return isSameDay(day, selectingDate);
|
|
11078
|
+
}
|
|
11079
|
+
return isSameDay(day, endDate);
|
|
11041
11080
|
};
|
|
11042
11081
|
_this.isRangeStart = function () {
|
|
11043
11082
|
var _a = _this.props, day = _a.day, startDate = _a.startDate, endDate = _a.endDate;
|
|
@@ -11405,7 +11444,10 @@ var Week = /** @class */ (function (_super) {
|
|
|
11405
11444
|
"react-datepicker__week--selected": isSameDay(this.startOfWeek(), this.props.selected),
|
|
11406
11445
|
"react-datepicker__week--keyboard-selected": this.isKeyboardSelected(),
|
|
11407
11446
|
};
|
|
11408
|
-
|
|
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()));
|
|
11409
11451
|
};
|
|
11410
11452
|
return Week;
|
|
11411
11453
|
}(Component));
|
|
@@ -12108,11 +12150,40 @@ var MonthDropdownOptions = /** @class */ (function (_super) {
|
|
|
12108
12150
|
__extends(MonthDropdownOptions, _super);
|
|
12109
12151
|
function MonthDropdownOptions() {
|
|
12110
12152
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
12153
|
+
_this.monthOptionButtonsRef = {};
|
|
12111
12154
|
_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
|
+
};
|
|
12112
12176
|
_this.renderOptions = function () {
|
|
12113
|
-
|
|
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)
|
|
12114
12185
|
? "react-datepicker__month-option react-datepicker__month-option--selected_month"
|
|
12115
|
-
: "react-datepicker__month-option", key: month, onClick: _this.onChange.bind(_this, i), "aria-selected": _this.isSelectedMonth(i) ? "true" : undefined },
|
|
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 },
|
|
12116
12187
|
_this.isSelectedMonth(i) ? (React__default.createElement("span", { className: "react-datepicker__month-option--selected" }, "\u2713")) : (""),
|
|
12117
12188
|
month)); });
|
|
12118
12189
|
};
|
|
@@ -12137,7 +12208,7 @@ var MonthDropdown = /** @class */ (function (_super) {
|
|
|
12137
12208
|
return monthNames.map(function (m, i) { return (React__default.createElement("option", { key: m, value: i }, m)); });
|
|
12138
12209
|
};
|
|
12139
12210
|
_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))); };
|
|
12140
|
-
_this.renderReadView = function (visible, monthNames) { return (React__default.createElement("
|
|
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 },
|
|
12141
12212
|
React__default.createElement("span", { className: "react-datepicker__month-read-view--down-arrow" }),
|
|
12142
12213
|
React__default.createElement("span", { className: "react-datepicker__month-read-view--selected-month" }, monthNames[_this.props.month]))); };
|
|
12143
12214
|
_this.renderDropdown = function (monthNames) { return (React__default.createElement(MonthDropdownOptions, _assign({ key: "dropdown" }, _this.props, { monthNames: monthNames, onChange: _this.onChange, onCancel: _this.toggleDropdown }))); };
|
|
@@ -12625,19 +12696,20 @@ var Year$1 = /** @class */ (function (_super) {
|
|
|
12625
12696
|
return isSameYear(_year, endDate !== null && endDate !== void 0 ? endDate : null);
|
|
12626
12697
|
};
|
|
12627
12698
|
_this.isKeyboardSelected = function (y) {
|
|
12628
|
-
if (_this.props.
|
|
12629
|
-
_this.props.
|
|
12699
|
+
if (_this.props.disabledKeyboardNavigation ||
|
|
12700
|
+
_this.props.date === undefined ||
|
|
12630
12701
|
_this.props.preSelection == null) {
|
|
12631
12702
|
return;
|
|
12632
12703
|
}
|
|
12633
|
-
var _a = _this.props, minDate = _a.minDate, maxDate = _a.maxDate, excludeDates = _a.excludeDates, includeDates = _a.includeDates, filterDate = _a.filterDate;
|
|
12704
|
+
var _a = _this.props, minDate = _a.minDate, maxDate = _a.maxDate, excludeDates = _a.excludeDates, includeDates = _a.includeDates, filterDate = _a.filterDate, selected = _a.selected;
|
|
12634
12705
|
var date = getStartOfYear(setYear(_this.props.date, y));
|
|
12635
12706
|
var isDisabled = (minDate || maxDate || excludeDates || includeDates || filterDate) &&
|
|
12636
12707
|
isYearDisabled(y, _this.props);
|
|
12637
|
-
|
|
12638
|
-
|
|
12639
|
-
|
|
12640
|
-
|
|
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 &&
|
|
12641
12713
|
!isDisabled);
|
|
12642
12714
|
};
|
|
12643
12715
|
_this.isSelectedYear = function (year) {
|
|
@@ -12823,11 +12895,42 @@ var YearDropdownOptions = /** @class */ (function (_super) {
|
|
|
12823
12895
|
__extends(YearDropdownOptions, _super);
|
|
12824
12896
|
function YearDropdownOptions(props) {
|
|
12825
12897
|
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
|
+
};
|
|
12826
12922
|
_this.renderOptions = function () {
|
|
12923
|
+
// Clear refs to prevent memory leaks on re-render
|
|
12924
|
+
_this.yearOptionButtonsRef = {};
|
|
12827
12925
|
var selectedYear = _this.props.year;
|
|
12828
|
-
var options = _this.state.yearsList.map(function (year) { return (React__default.createElement("div", {
|
|
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
|
|
12829
12932
|
? "react-datepicker__year-option react-datepicker__year-option--selected_year"
|
|
12830
|
-
: "react-datepicker__year-option", key: year, onClick: _this.onChange.bind(_this, year), "aria-selected": selectedYear === year ? "true" : undefined },
|
|
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 },
|
|
12831
12934
|
selectedYear === year ? (React__default.createElement("span", { className: "react-datepicker__year-option--selected" }, "\u2713")) : (""),
|
|
12832
12935
|
year)); });
|
|
12833
12936
|
var minYear = _this.props.minDate ? getYear(_this.props.minDate) : null;
|
|
@@ -12922,9 +13025,7 @@ var YearDropdown = /** @class */ (function (_super) {
|
|
|
12922
13025
|
_this.onChange(parseInt(event.target.value));
|
|
12923
13026
|
};
|
|
12924
13027
|
_this.renderSelectMode = function () { return (React__default.createElement("select", { value: _this.props.year, className: "react-datepicker__year-select", onChange: _this.onSelectChange }, _this.renderSelectOptions())); };
|
|
12925
|
-
_this.renderReadView = function (visible) { return (React__default.createElement("
|
|
12926
|
-
return _this.toggleDropdown(event);
|
|
12927
|
-
} },
|
|
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 },
|
|
12928
13029
|
React__default.createElement("span", { className: "react-datepicker__year-read-view--down-arrow" }),
|
|
12929
13030
|
React__default.createElement("span", { className: "react-datepicker__year-read-view--selected-year" }, _this.props.year))); };
|
|
12930
13031
|
_this.renderDropdown = function () { return (React__default.createElement(YearDropdownOptions, _assign({ key: "dropdown" }, _this.props, { onChange: _this.onChange, onCancel: _this.toggleDropdown }))); };
|
|
@@ -12986,6 +13087,7 @@ var DROPDOWN_FOCUS_CLASSNAMES = [
|
|
|
12986
13087
|
"react-datepicker__month-select",
|
|
12987
13088
|
"react-datepicker__month-year-select",
|
|
12988
13089
|
];
|
|
13090
|
+
var OUTSIDE_CLICK_IGNORE_CLASS = "react-datepicker-ignore-onclickoutside";
|
|
12989
13091
|
var isDropdownSelect = function (element) {
|
|
12990
13092
|
var classNames = (element.className || "").split(/\s+/);
|
|
12991
13093
|
return DROPDOWN_FOCUS_CLASSNAMES.some(function (testClassname) { return classNames.indexOf(testClassname) >= 0; });
|
|
@@ -13137,7 +13239,9 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13137
13239
|
var startOfWeek = getStartOfWeek(date, _this.props.locale, _this.props.calendarStartDay);
|
|
13138
13240
|
var dayNames = [];
|
|
13139
13241
|
if (_this.props.showWeekNumbers) {
|
|
13140
|
-
dayNames.push(React__default.createElement("div", { key: "W", className: "react-datepicker__day-name"
|
|
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 || "#")));
|
|
13141
13245
|
}
|
|
13142
13246
|
return dayNames.concat([0, 1, 2, 3, 4, 5, 6].map(function (offset) {
|
|
13143
13247
|
var day = addDays(startOfWeek, offset);
|
|
@@ -13145,7 +13249,9 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13145
13249
|
var weekDayClassName = _this.props.weekDayClassName
|
|
13146
13250
|
? _this.props.weekDayClassName(day)
|
|
13147
13251
|
: undefined;
|
|
13148
|
-
return (React__default.createElement("div", { key: offset,
|
|
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)));
|
|
13149
13255
|
}));
|
|
13150
13256
|
};
|
|
13151
13257
|
_this.formatWeekday = function (day, locale) {
|
|
@@ -13360,7 +13466,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13360
13466
|
_this.renderMonthDropdown(i !== 0),
|
|
13361
13467
|
_this.renderMonthYearDropdown(i !== 0),
|
|
13362
13468
|
_this.renderYearDropdown(i !== 0)),
|
|
13363
|
-
React__default.createElement("div", { className: "react-datepicker__day-names" }, _this.header(monthDate))));
|
|
13469
|
+
React__default.createElement("div", { className: "react-datepicker__day-names", role: "row" }, _this.header(monthDate))));
|
|
13364
13470
|
};
|
|
13365
13471
|
_this.renderCustomHeader = function (headerArgs) {
|
|
13366
13472
|
var _a, _b;
|
|
@@ -13369,6 +13475,15 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13369
13475
|
_this.props.showTimeSelectOnly) {
|
|
13370
13476
|
return null;
|
|
13371
13477
|
}
|
|
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
|
+
}
|
|
13372
13487
|
var prevMonthButtonDisabled = monthDisabledBefore(_this.state.date, _this.props);
|
|
13373
13488
|
var nextMonthButtonDisabled = monthDisabledAfter(_this.state.date, _this.props);
|
|
13374
13489
|
var prevYearButtonDisabled = yearDisabledBefore(_this.state.date, _this.props);
|
|
@@ -13377,7 +13492,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13377
13492
|
!_this.props.showQuarterYearPicker &&
|
|
13378
13493
|
!_this.props.showYearPicker;
|
|
13379
13494
|
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 :
|
|
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 })),
|
|
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 })),
|
|
13381
13496
|
showDayNames && (React__default.createElement("div", { className: "react-datepicker__day-names" }, _this.header(monthDate)))));
|
|
13382
13497
|
};
|
|
13383
13498
|
_this.renderYearHeader = function (_a) {
|
|
@@ -13497,6 +13612,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13497
13612
|
return {
|
|
13498
13613
|
monthsShown: 1,
|
|
13499
13614
|
forceShowMonthNavigation: false,
|
|
13615
|
+
outsideClickIgnoreClass: OUTSIDE_CLICK_IGNORE_CLASS,
|
|
13500
13616
|
timeCaption: "Time",
|
|
13501
13617
|
previousYearButtonLabel: "Previous Year",
|
|
13502
13618
|
nextYearButtonLabel: "Next Year",
|
|
@@ -13730,7 +13846,7 @@ var TabLoop = /** @class */ (function (_super) {
|
|
|
13730
13846
|
* @returns A new component with floating behavior.
|
|
13731
13847
|
*/
|
|
13732
13848
|
function withFloating(Component) {
|
|
13733
|
-
|
|
13849
|
+
function WithFloating(props) {
|
|
13734
13850
|
var _a;
|
|
13735
13851
|
var hidePopper = typeof props.hidePopper === "boolean" ? props.hidePopper : true;
|
|
13736
13852
|
var arrowRef = useRef(null);
|
|
@@ -13741,51 +13857,35 @@ function withFloating(Component) {
|
|
|
13741
13857
|
], ((_a = props.popperModifiers) !== null && _a !== void 0 ? _a : []), true) }, props.popperProps));
|
|
13742
13858
|
var componentProps = _assign(_assign({}, props), { hidePopper: hidePopper, popperProps: _assign(_assign({}, floatingProps), { arrowRef: arrowRef }) });
|
|
13743
13859
|
return React__default.createElement(Component, _assign({}, componentProps));
|
|
13744
|
-
}
|
|
13860
|
+
}
|
|
13861
|
+
WithFloating.displayName = "withFloating(".concat(Component.displayName || Component.name || "Component", ")");
|
|
13745
13862
|
return WithFloating;
|
|
13746
13863
|
}
|
|
13747
13864
|
|
|
13748
13865
|
// Exported for testing purposes
|
|
13749
|
-
var PopperComponent =
|
|
13750
|
-
|
|
13751
|
-
|
|
13752
|
-
|
|
13753
|
-
|
|
13754
|
-
|
|
13755
|
-
|
|
13756
|
-
|
|
13757
|
-
|
|
13758
|
-
|
|
13759
|
-
|
|
13760
|
-
|
|
13761
|
-
|
|
13762
|
-
|
|
13763
|
-
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
13768
|
-
|
|
13769
|
-
|
|
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));
|
|
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
|
+
};
|
|
13786
13887
|
var PopperComponent$1 = withFloating(PopperComponent);
|
|
13787
13888
|
|
|
13788
|
-
var outsideClickIgnoreClass = "react-datepicker-ignore-onclickoutside";
|
|
13789
13889
|
// Compares dates year+month combinations
|
|
13790
13890
|
function hasPreSelectionChanged(date1, date2) {
|
|
13791
13891
|
if (date1 && date2) {
|
|
@@ -13851,6 +13951,35 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
13851
13951
|
wasHidden: false,
|
|
13852
13952
|
};
|
|
13853
13953
|
};
|
|
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
|
+
};
|
|
13854
13983
|
_this.resetHiddenStatus = function () {
|
|
13855
13984
|
_this.setState(_assign(_assign({}, _this.state), { wasHidden: false }));
|
|
13856
13985
|
};
|
|
@@ -13950,11 +14079,15 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
13950
14079
|
_this.handleDropdownFocus = function () {
|
|
13951
14080
|
_this.cancelFocusInput();
|
|
13952
14081
|
};
|
|
14082
|
+
_this.resetInputValue = function () {
|
|
14083
|
+
_this.setState(_assign(_assign({}, _this.state), { inputValue: null }));
|
|
14084
|
+
};
|
|
13953
14085
|
_this.handleBlur = function (event) {
|
|
13954
14086
|
var _a, _b;
|
|
13955
14087
|
if (!_this.state.open || _this.props.withPortal || _this.props.showTimeInput) {
|
|
13956
14088
|
(_b = (_a = _this.props).onBlur) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
13957
14089
|
}
|
|
14090
|
+
_this.resetInputValue();
|
|
13958
14091
|
if (_this.state.open && _this.props.open === false) {
|
|
13959
14092
|
_this.setOpen(false);
|
|
13960
14093
|
}
|
|
@@ -13995,11 +14128,17 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
13995
14128
|
var strictParsing = (_b = _this.props.strictParsing) !== null && _b !== void 0 ? _b : DatePicker.defaultProps.strictParsing;
|
|
13996
14129
|
var value = (event === null || event === void 0 ? void 0 : event.target) instanceof HTMLInputElement ? event.target.value : "";
|
|
13997
14130
|
if (selectsRange) {
|
|
14131
|
+
var rangeSeparator = _this.props.rangeSeparator;
|
|
14132
|
+
var trimmedRangeSeparator = rangeSeparator.trim();
|
|
13998
14133
|
var _g = value
|
|
13999
|
-
.split(dateFormat.includes(
|
|
14134
|
+
.split(dateFormat.includes(trimmedRangeSeparator)
|
|
14135
|
+
? rangeSeparator
|
|
14136
|
+
: trimmedRangeSeparator, 2)
|
|
14000
14137
|
.map(function (val) { return val.trim(); }), valueStart = _g[0], valueEnd = _g[1];
|
|
14001
14138
|
var startDateNew = parseDate(valueStart !== null && valueStart !== void 0 ? valueStart : "", dateFormat, _this.props.locale, strictParsing);
|
|
14002
|
-
var endDateNew =
|
|
14139
|
+
var endDateNew = startDateNew
|
|
14140
|
+
? parseDate(valueEnd !== null && valueEnd !== void 0 ? valueEnd : "", dateFormat, _this.props.locale, strictParsing)
|
|
14141
|
+
: null;
|
|
14003
14142
|
var startChanged = (startDate === null || startDate === void 0 ? void 0 : startDate.getTime()) !== (startDateNew === null || startDateNew === void 0 ? void 0 : startDateNew.getTime());
|
|
14004
14143
|
var endChanged = (endDate === null || endDate === void 0 ? void 0 : endDate.getTime()) !== (endDateNew === null || endDateNew === void 0 ? void 0 : endDateNew.getTime());
|
|
14005
14144
|
if (!startChanged && !endChanged) {
|
|
@@ -14025,7 +14164,12 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14025
14164
|
_this.handleSelect = function (date, event, monthSelectedIn) {
|
|
14026
14165
|
if (_this.props.readOnly)
|
|
14027
14166
|
return;
|
|
14028
|
-
|
|
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) {
|
|
14029
14173
|
// Preventing onFocus event to fix issue
|
|
14030
14174
|
// https://github.com/Hacker0x01/react-datepicker/issues/628
|
|
14031
14175
|
_this.sendFocusBackToInput();
|
|
@@ -14040,16 +14184,8 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14040
14184
|
if (!_this.props.shouldCloseOnSelect || _this.props.showTimeSelect) {
|
|
14041
14185
|
_this.setPreSelection(date);
|
|
14042
14186
|
}
|
|
14043
|
-
else if (
|
|
14044
|
-
|
|
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
|
-
}
|
|
14187
|
+
else if (isDateSelectionComplete) {
|
|
14188
|
+
_this.setOpen(false);
|
|
14053
14189
|
}
|
|
14054
14190
|
};
|
|
14055
14191
|
// 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)
|
|
@@ -14114,6 +14250,7 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14114
14250
|
if (selectsRange) {
|
|
14115
14251
|
var noRanges = !startDate && !endDate;
|
|
14116
14252
|
var hasStartRange = startDate && !endDate;
|
|
14253
|
+
var hasOnlyEndRange = !startDate && !!endDate;
|
|
14117
14254
|
var isRangeFilled = startDate && endDate;
|
|
14118
14255
|
if (noRanges) {
|
|
14119
14256
|
onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, null], event);
|
|
@@ -14134,6 +14271,14 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14134
14271
|
onChange === null || onChange === void 0 ? void 0 : onChange([startDate, changedDate], event);
|
|
14135
14272
|
}
|
|
14136
14273
|
}
|
|
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
|
+
}
|
|
14137
14282
|
if (isRangeFilled) {
|
|
14138
14283
|
onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, null], event);
|
|
14139
14284
|
}
|
|
@@ -14507,10 +14652,12 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14507
14652
|
}
|
|
14508
14653
|
return (React__default.createElement(Calendar, _assign({ showMonthYearDropdown: undefined, ref: function (elem) {
|
|
14509
14654
|
_this.calendar = elem;
|
|
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));
|
|
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));
|
|
14511
14656
|
};
|
|
14512
14657
|
_this.renderAriaLiveRegion = function () {
|
|
14513
|
-
var _a
|
|
14658
|
+
var _a;
|
|
14659
|
+
var locale = _this.props.locale;
|
|
14660
|
+
var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
|
|
14514
14661
|
var isContainsTime = _this.props.showTimeInput || _this.props.showTimeSelect;
|
|
14515
14662
|
var longDateFormat = isContainsTime ? "PPPPp" : "PPPP";
|
|
14516
14663
|
var ariaLiveMessage;
|
|
@@ -14553,36 +14700,17 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14553
14700
|
};
|
|
14554
14701
|
_this.renderDateInput = function () {
|
|
14555
14702
|
var _a, _b;
|
|
14556
|
-
var _c;
|
|
14557
14703
|
var className = clsx(_this.props.className, (_a = {},
|
|
14558
|
-
_a[
|
|
14704
|
+
_a[_this.props.outsideClickIgnoreClass ||
|
|
14705
|
+
DatePicker.defaultProps.outsideClickIgnoreClass] = _this.state.open,
|
|
14559
14706
|
_a));
|
|
14560
14707
|
var customInput = _this.props.customInput || React__default.createElement("input", { type: "text" });
|
|
14561
14708
|
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
|
-
});
|
|
14581
14709
|
return cloneElement(customInput, (_b = {},
|
|
14582
14710
|
_b[customInputRef] = function (input) {
|
|
14583
14711
|
_this.input = input;
|
|
14584
14712
|
},
|
|
14585
|
-
_b.value =
|
|
14713
|
+
_b.value = _this.getInputValue(),
|
|
14586
14714
|
_b.onBlur = _this.handleBlur,
|
|
14587
14715
|
_b.onChange = _this.handleChange,
|
|
14588
14716
|
_b.onClick = _this.onInputClick,
|
|
@@ -14635,7 +14763,9 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14635
14763
|
dropdownMode: "scroll",
|
|
14636
14764
|
preventOpenOnFocus: false,
|
|
14637
14765
|
monthsShown: 1,
|
|
14766
|
+
outsideClickIgnoreClass: OUTSIDE_CLICK_IGNORE_CLASS,
|
|
14638
14767
|
readOnly: false,
|
|
14768
|
+
rangeSeparator: DATE_RANGE_SEPARATOR,
|
|
14639
14769
|
withPortal: false,
|
|
14640
14770
|
selectsDisabledDaysInRange: false,
|
|
14641
14771
|
shouldCloseOnSelect: true,
|
|
@@ -15148,4 +15278,4 @@ var InlineDatePicker = function (props) {
|
|
|
15148
15278
|
};
|
|
15149
15279
|
|
|
15150
15280
|
export { DatePickerGroup as D, HelperText as H, InlineDatePicker as I, ValidationText as V };
|
|
15151
|
-
//# sourceMappingURL=InlineDatePicker-
|
|
15281
|
+
//# sourceMappingURL=InlineDatePicker-xO3XGIcG.js.map
|