@cerebruminc/cerebellum 16.1.1-beta.dangerous.fe9f73b → 16.2.0
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/ColorPickerInput-CBPI8IJ-.js +187 -0
- package/lib/cjs/ColorPickerInput-CBPI8IJ-.js.map +1 -0
- package/lib/cjs/ColorPickerInput.cjs +25 -0
- package/lib/cjs/ColorPickerInput.cjs.map +1 -0
- package/lib/cjs/DatePicker.cjs +1 -1
- package/lib/cjs/Form.cjs +7 -4
- package/lib/cjs/Form.cjs.map +1 -1
- package/lib/cjs/FormFieldTypeEnum.cjs +5 -0
- package/lib/cjs/FormFieldTypeEnum.cjs.map +1 -1
- package/lib/cjs/FormSeparator.cjs +3 -1
- package/lib/cjs/FormSeparator.cjs.map +1 -1
- package/lib/cjs/{FormStyles-CxgYRZOl.js → FormStyles-CM25rbhG.js} +38 -21
- package/lib/cjs/{FormStyles-CxgYRZOl.js.map → FormStyles-CM25rbhG.js.map} +1 -1
- package/lib/cjs/FormWrapper.cjs +3 -1
- package/lib/cjs/FormWrapper.cjs.map +1 -1
- package/lib/cjs/{FormikContainer-CY2nLsAs.js → FormikContainer-DVL86Jri.js} +33 -3
- package/lib/cjs/{FormikContainer-CY2nLsAs.js.map → FormikContainer-DVL86Jri.js.map} +1 -1
- package/lib/cjs/InlineColorPickerInput.cjs +25 -0
- package/lib/cjs/InlineColorPickerInput.cjs.map +1 -0
- package/lib/cjs/{InlineDatePicker-DFv_uHo9.js → InlineDatePicker-B7DTwvhv.js} +344 -176
- package/lib/cjs/InlineDatePicker-B7DTwvhv.js.map +1 -0
- package/lib/cjs/InlineDatePicker.cjs +1 -1
- package/lib/cjs/TitleGroup.cjs +3 -1
- package/lib/cjs/TitleGroup.cjs.map +1 -1
- package/lib/cjs/cerebellumTheme.cjs +5 -0
- package/lib/cjs/cerebellumTheme.cjs.map +1 -1
- package/lib/cjs/index.cjs +9 -3
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/validateColorContrast.cjs +53 -0
- package/lib/cjs/validateColorContrast.cjs.map +1 -0
- package/lib/cjs/validateColorContrastWithMessage.cjs +10 -0
- package/lib/cjs/validateColorContrastWithMessage.cjs.map +1 -0
- package/lib/esm/ColorPickerInput-S8X2gIA5.js +180 -0
- package/lib/esm/ColorPickerInput-S8X2gIA5.js.map +1 -0
- package/lib/esm/ColorPickerInput.js +18 -0
- package/lib/esm/ColorPickerInput.js.map +1 -0
- package/lib/esm/DatePicker.js +1 -1
- package/lib/esm/Form.js +7 -5
- package/lib/esm/Form.js.map +1 -1
- package/lib/esm/FormFieldTypeEnum.js +5 -1
- package/lib/esm/FormFieldTypeEnum.js.map +1 -1
- package/lib/esm/FormSeparator.js +3 -1
- package/lib/esm/FormSeparator.js.map +1 -1
- package/lib/esm/{FormStyles-BQJPyTS0.js → FormStyles-CyqyMC1o.js} +39 -22
- package/lib/esm/{FormStyles-BQJPyTS0.js.map → FormStyles-CyqyMC1o.js.map} +1 -1
- package/lib/esm/FormWrapper.js +3 -1
- package/lib/esm/FormWrapper.js.map +1 -1
- package/lib/esm/{FormikContainer-SJPYfIkF.js → FormikContainer-uI5oe1px.js} +34 -4
- package/lib/esm/{FormikContainer-SJPYfIkF.js.map → FormikContainer-uI5oe1px.js.map} +1 -1
- package/lib/esm/InlineColorPickerInput.js +18 -0
- package/lib/esm/InlineColorPickerInput.js.map +1 -0
- package/lib/esm/{InlineDatePicker-ClVBWEzW.js → InlineDatePicker-BuxjkoV0.js} +345 -177
- package/lib/esm/InlineDatePicker-BuxjkoV0.js.map +1 -0
- package/lib/esm/InlineDatePicker.js +1 -1
- package/lib/esm/TitleGroup.js +3 -1
- package/lib/esm/TitleGroup.js.map +1 -1
- package/lib/esm/cerebellumTheme.js +5 -0
- package/lib/esm/cerebellumTheme.js.map +1 -1
- package/lib/esm/index.js +6 -4
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/validateColorContrast.js +50 -0
- package/lib/esm/validateColorContrast.js.map +1 -0
- package/lib/esm/validateColorContrastWithMessage.js +3 -0
- package/lib/esm/validateColorContrastWithMessage.js.map +1 -0
- package/lib/types/src/components/ColorPickerInput/ColorPickerInput.d.ts +3 -0
- package/lib/types/src/components/ColorPickerInput/InlineColorPickerInput.d.ts +3 -0
- package/lib/types/src/components/ColorPickerInput/index.d.ts +3 -0
- package/lib/types/src/components/ColorPickerInput/types.d.ts +48 -0
- package/lib/types/src/components/Form/fields/ColorPickerField/ColorPickerField.d.ts +4 -0
- package/lib/types/src/components/Form/fields/ColorPickerField/index.d.ts +1 -0
- package/lib/types/src/components/Form/fields/index.d.ts +2 -1
- package/lib/types/src/components/Form/index.d.ts +3 -3
- package/lib/types/src/components/Form/mocks/fields.d.ts +62 -0
- package/lib/types/src/components/Form/types.d.ts +36 -2
- package/lib/types/src/helpers/colorValidators.d.ts +19 -0
- package/lib/types/src/index.d.ts +5 -1
- package/lib/types/src/theme.d.ts +6 -0
- 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.8.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.
|
|
@@ -10220,7 +10249,10 @@ function getQuarterShortInLocale(quarter, locale) {
|
|
|
10220
10249
|
* @returns - Returns true if the day is disabled, false otherwise.
|
|
10221
10250
|
*/
|
|
10222
10251
|
function isDayDisabled(day, _a) {
|
|
10223
|
-
var _b = _a === void 0 ? {} : _a, minDate = _b.minDate, maxDate = _b.maxDate, excludeDates = _b.excludeDates, excludeDateIntervals = _b.excludeDateIntervals, includeDates = _b.includeDates, includeDateIntervals = _b.includeDateIntervals, filterDate = _b.filterDate;
|
|
10252
|
+
var _b = _a === void 0 ? {} : _a, minDate = _b.minDate, maxDate = _b.maxDate, excludeDates = _b.excludeDates, excludeDateIntervals = _b.excludeDateIntervals, includeDates = _b.includeDates, includeDateIntervals = _b.includeDateIntervals, filterDate = _b.filterDate, disabled = _b.disabled;
|
|
10253
|
+
if (disabled) {
|
|
10254
|
+
return true;
|
|
10255
|
+
}
|
|
10224
10256
|
return (isOutOfBounds(day, { minDate: minDate, maxDate: maxDate }) ||
|
|
10225
10257
|
(excludeDates &&
|
|
10226
10258
|
excludeDates.some(function (excludeDate) {
|
|
@@ -10320,7 +10352,10 @@ function isMonthYearDisabled(date, _a) {
|
|
|
10320
10352
|
false);
|
|
10321
10353
|
}
|
|
10322
10354
|
function isQuarterDisabled(quarter, _a) {
|
|
10323
|
-
var _b = _a === void 0 ? {} : _a, minDate = _b.minDate, maxDate = _b.maxDate, excludeDates = _b.excludeDates, includeDates = _b.includeDates, filterDate = _b.filterDate;
|
|
10355
|
+
var _b = _a === void 0 ? {} : _a, minDate = _b.minDate, maxDate = _b.maxDate, excludeDates = _b.excludeDates, includeDates = _b.includeDates, filterDate = _b.filterDate, disabled = _b.disabled;
|
|
10356
|
+
if (disabled) {
|
|
10357
|
+
return true;
|
|
10358
|
+
}
|
|
10324
10359
|
return (isOutOfBounds(quarter, { minDate: minDate, maxDate: maxDate }) ||
|
|
10325
10360
|
(excludeDates === null || excludeDates === void 0 ? void 0 : excludeDates.some(function (excludeDate) {
|
|
10326
10361
|
return isSameQuarter(quarter, excludeDate instanceof Date ? excludeDate : excludeDate.date);
|
|
@@ -10342,7 +10377,10 @@ function isYearInRange(year, start, end) {
|
|
|
10342
10377
|
return startYear <= year && endYear >= year;
|
|
10343
10378
|
}
|
|
10344
10379
|
function isYearDisabled(year, _a) {
|
|
10345
|
-
var _b = _a === void 0 ? {} : _a, minDate = _b.minDate, maxDate = _b.maxDate, excludeDates = _b.excludeDates, includeDates = _b.includeDates, filterDate = _b.filterDate;
|
|
10380
|
+
var _b = _a === void 0 ? {} : _a, minDate = _b.minDate, maxDate = _b.maxDate, excludeDates = _b.excludeDates, includeDates = _b.includeDates, filterDate = _b.filterDate, disabled = _b.disabled;
|
|
10381
|
+
if (disabled) {
|
|
10382
|
+
return true;
|
|
10383
|
+
}
|
|
10346
10384
|
var date = new Date(year, 0, 1);
|
|
10347
10385
|
return (isOutOfBounds(date, {
|
|
10348
10386
|
minDate: minDate ? startOfYear(minDate) : undefined,
|
|
@@ -10932,6 +10970,7 @@ var Day = /** @class */ (function (_super) {
|
|
|
10932
10970
|
includeDateIntervals: _this.props.includeDateIntervals,
|
|
10933
10971
|
includeDates: _this.props.includeDates,
|
|
10934
10972
|
filterDate: _this.props.filterDate,
|
|
10973
|
+
disabled: _this.props.disabled,
|
|
10935
10974
|
});
|
|
10936
10975
|
};
|
|
10937
10976
|
_this.isExcluded = function () {
|
|
@@ -10986,7 +11025,7 @@ var Day = /** @class */ (function (_super) {
|
|
|
10986
11025
|
};
|
|
10987
11026
|
_this.isInSelectingRange = function () {
|
|
10988
11027
|
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;
|
|
11028
|
+
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
11029
|
var selectingDate = (_a = _this.props.selectingDate) !== null && _a !== void 0 ? _a : _this.props.preSelection;
|
|
10991
11030
|
if (!(selectsStart || selectsEnd || selectsRange) ||
|
|
10992
11031
|
!selectingDate ||
|
|
@@ -11003,11 +11042,16 @@ var Day = /** @class */ (function (_super) {
|
|
|
11003
11042
|
(isAfter(selectingDate, startDate) || isEqual(selectingDate, startDate))) {
|
|
11004
11043
|
return isDayInRange(day, startDate, selectingDate);
|
|
11005
11044
|
}
|
|
11006
|
-
if (selectsRange &&
|
|
11007
|
-
startDate
|
|
11008
|
-
|
|
11009
|
-
|
|
11010
|
-
|
|
11045
|
+
if (selectsRange && startDate && !endDate) {
|
|
11046
|
+
if (isEqual(selectingDate, startDate)) {
|
|
11047
|
+
return isDayInRange(day, startDate, selectingDate);
|
|
11048
|
+
}
|
|
11049
|
+
if (isAfter(selectingDate, startDate)) {
|
|
11050
|
+
return isDayInRange(day, startDate, selectingDate);
|
|
11051
|
+
}
|
|
11052
|
+
if (swapRange && isBefore(selectingDate, startDate)) {
|
|
11053
|
+
return isDayInRange(day, selectingDate, startDate);
|
|
11054
|
+
}
|
|
11011
11055
|
}
|
|
11012
11056
|
return false;
|
|
11013
11057
|
};
|
|
@@ -11016,28 +11060,33 @@ var Day = /** @class */ (function (_super) {
|
|
|
11016
11060
|
if (!_this.isInSelectingRange()) {
|
|
11017
11061
|
return false;
|
|
11018
11062
|
}
|
|
11019
|
-
var _b = _this.props, day = _b.day, startDate = _b.startDate, selectsStart = _b.selectsStart;
|
|
11063
|
+
var _b = _this.props, day = _b.day, startDate = _b.startDate, selectsStart = _b.selectsStart, swapRange = _b.swapRange, selectsRange = _b.selectsRange;
|
|
11020
11064
|
var selectingDate = (_a = _this.props.selectingDate) !== null && _a !== void 0 ? _a : _this.props.preSelection;
|
|
11021
11065
|
if (selectsStart) {
|
|
11022
11066
|
return isSameDay(day, selectingDate);
|
|
11023
11067
|
}
|
|
11024
|
-
|
|
11025
|
-
return isSameDay(day, startDate);
|
|
11068
|
+
if (selectsRange && swapRange && startDate && selectingDate) {
|
|
11069
|
+
return isSameDay(day, isBefore(selectingDate, startDate) ? selectingDate : startDate);
|
|
11026
11070
|
}
|
|
11071
|
+
return isSameDay(day, startDate);
|
|
11027
11072
|
};
|
|
11028
11073
|
_this.isSelectingRangeEnd = function () {
|
|
11029
11074
|
var _a;
|
|
11030
11075
|
if (!_this.isInSelectingRange()) {
|
|
11031
11076
|
return false;
|
|
11032
11077
|
}
|
|
11033
|
-
var _b = _this.props, day = _b.day, endDate = _b.endDate, selectsEnd = _b.selectsEnd, selectsRange = _b.selectsRange;
|
|
11078
|
+
var _b = _this.props, day = _b.day, endDate = _b.endDate, selectsEnd = _b.selectsEnd, selectsRange = _b.selectsRange, swapRange = _b.swapRange, startDate = _b.startDate;
|
|
11034
11079
|
var selectingDate = (_a = _this.props.selectingDate) !== null && _a !== void 0 ? _a : _this.props.preSelection;
|
|
11035
|
-
if (selectsEnd
|
|
11080
|
+
if (selectsEnd) {
|
|
11036
11081
|
return isSameDay(day, selectingDate);
|
|
11037
11082
|
}
|
|
11038
|
-
|
|
11039
|
-
return isSameDay(day,
|
|
11083
|
+
if (selectsRange && swapRange && startDate && selectingDate) {
|
|
11084
|
+
return isSameDay(day, isBefore(selectingDate, startDate) ? startDate : selectingDate);
|
|
11085
|
+
}
|
|
11086
|
+
if (selectsRange) {
|
|
11087
|
+
return isSameDay(day, selectingDate);
|
|
11040
11088
|
}
|
|
11089
|
+
return isSameDay(day, endDate);
|
|
11041
11090
|
};
|
|
11042
11091
|
_this.isRangeStart = function () {
|
|
11043
11092
|
var _a = _this.props, day = _a.day, startDate = _a.startDate, endDate = _a.endDate;
|
|
@@ -11158,7 +11207,7 @@ var Day = /** @class */ (function (_super) {
|
|
|
11158
11207
|
};
|
|
11159
11208
|
_this.render = function () { return (
|
|
11160
11209
|
// TODO: Use <option> instead of the "option" role to ensure accessibility across all devices.
|
|
11161
|
-
React__default.createElement("div", { ref: _this.dayEl, className: _this.getClassNames(_this.props.day), onKeyDown: _this.handleOnKeyDown, onClick: _this.handleClick, onMouseEnter: !_this.props.usePointerEvent ? _this.handleMouseEnter : undefined, onPointerEnter: _this.props.usePointerEvent ? _this.handleMouseEnter : undefined, tabIndex: _this.getTabIndex(), "aria-label": _this.getAriaLabel(), role: "
|
|
11210
|
+
React__default.createElement("div", { ref: _this.dayEl, className: _this.getClassNames(_this.props.day), onKeyDown: _this.handleOnKeyDown, onClick: _this.handleClick, onMouseEnter: !_this.props.usePointerEvent ? _this.handleMouseEnter : undefined, onPointerEnter: _this.props.usePointerEvent ? _this.handleMouseEnter : undefined, tabIndex: _this.getTabIndex(), "aria-label": _this.getAriaLabel(), role: "gridcell", title: _this.getTitle(), "aria-disabled": _this.isDisabled(), "aria-current": _this.isCurrentDay() ? "date" : undefined, "aria-selected": _this.isSelected() || _this.isInRange() },
|
|
11162
11211
|
_this.renderDayContents(),
|
|
11163
11212
|
_this.getTitle() !== "" && (React__default.createElement("span", { className: "overlay" }, _this.getTitle())))); };
|
|
11164
11213
|
return _this;
|
|
@@ -11296,7 +11345,7 @@ var WeekNumber = /** @class */ (function (_super) {
|
|
|
11296
11345
|
"react-datepicker__week-number--clickable": !!onClick && !isWeekDisabled,
|
|
11297
11346
|
"react-datepicker__week-number--selected": !!onClick && isSameDay(this.props.date, this.props.selected),
|
|
11298
11347
|
};
|
|
11299
|
-
return (React__default.createElement("div", { ref: this.weekNumberEl, className: clsx(weekNumberClasses), "aria-label": "".concat(ariaLabelPrefix, " ").concat(this.props.weekNumber), onClick: this.handleClick, onKeyDown: this.handleOnKeyDown, tabIndex: this.getTabIndex() }, weekNumber));
|
|
11348
|
+
return (React__default.createElement("div", { ref: this.weekNumberEl, className: clsx(weekNumberClasses), "aria-label": "".concat(ariaLabelPrefix, " ").concat(this.props.weekNumber), onClick: this.handleClick, onKeyDown: this.handleOnKeyDown, tabIndex: this.getTabIndex(), role: "gridcell" }, weekNumber));
|
|
11300
11349
|
};
|
|
11301
11350
|
return WeekNumber;
|
|
11302
11351
|
}(Component));
|
|
@@ -11405,7 +11454,10 @@ var Week = /** @class */ (function (_super) {
|
|
|
11405
11454
|
"react-datepicker__week--selected": isSameDay(this.startOfWeek(), this.props.selected),
|
|
11406
11455
|
"react-datepicker__week--keyboard-selected": this.isKeyboardSelected(),
|
|
11407
11456
|
};
|
|
11408
|
-
|
|
11457
|
+
var customWeekClassName = this.props.weekClassName
|
|
11458
|
+
? this.props.weekClassName(this.startOfWeek())
|
|
11459
|
+
: undefined;
|
|
11460
|
+
return (React__default.createElement("div", { className: clsx(weekNumberClasses, customWeekClassName), role: "row" }, this.renderDays()));
|
|
11409
11461
|
};
|
|
11410
11462
|
return Week;
|
|
11411
11463
|
}(Component));
|
|
@@ -11566,6 +11618,7 @@ var Month$1 = /** @class */ (function (_super) {
|
|
|
11566
11618
|
includeDateIntervals: _this.props.includeDateIntervals,
|
|
11567
11619
|
includeDates: _this.props.includeDates,
|
|
11568
11620
|
filterDate: _this.props.filterDate,
|
|
11621
|
+
disabled: _this.props.disabled,
|
|
11569
11622
|
});
|
|
11570
11623
|
};
|
|
11571
11624
|
_this.isExcluded = function (day) {
|
|
@@ -11933,8 +11986,14 @@ var Month$1 = /** @class */ (function (_super) {
|
|
|
11933
11986
|
};
|
|
11934
11987
|
_this.isMonthDisabledForLabelDate = function (month) {
|
|
11935
11988
|
var _a;
|
|
11936
|
-
var _b = _this.props, day = _b.day, minDate = _b.minDate, maxDate = _b.maxDate, excludeDates = _b.excludeDates, includeDates = _b.includeDates;
|
|
11989
|
+
var _b = _this.props, day = _b.day, disabled = _b.disabled, minDate = _b.minDate, maxDate = _b.maxDate, excludeDates = _b.excludeDates, includeDates = _b.includeDates;
|
|
11937
11990
|
var labelDate = setMonth(day, month);
|
|
11991
|
+
if (disabled) {
|
|
11992
|
+
return {
|
|
11993
|
+
isDisabled: true,
|
|
11994
|
+
labelDate: setMonth(day, month),
|
|
11995
|
+
};
|
|
11996
|
+
}
|
|
11938
11997
|
return {
|
|
11939
11998
|
isDisabled: (_a = ((minDate || maxDate || excludeDates || includeDates) &&
|
|
11940
11999
|
isMonthDisabled(labelDate, _this.props))) !== null && _a !== void 0 ? _a : false,
|
|
@@ -12005,8 +12064,13 @@ var Month$1 = /** @class */ (function (_super) {
|
|
|
12005
12064
|
return "".concat(prefix, " ").concat(formatDate(labelDate, "MMMM yyyy", locale));
|
|
12006
12065
|
};
|
|
12007
12066
|
_this.getQuarterClassNames = function (q) {
|
|
12008
|
-
var _a = _this.props, day = _a.day, startDate = _a.startDate, endDate = _a.endDate, selected = _a.selected, minDate = _a.minDate, maxDate = _a.maxDate, excludeDates = _a.excludeDates, includeDates = _a.includeDates, filterDate = _a.filterDate, preSelection = _a.preSelection, disabledKeyboardNavigation = _a.disabledKeyboardNavigation;
|
|
12009
|
-
var isDisabled = (minDate ||
|
|
12067
|
+
var _a = _this.props, day = _a.day, startDate = _a.startDate, endDate = _a.endDate, selected = _a.selected, minDate = _a.minDate, maxDate = _a.maxDate, excludeDates = _a.excludeDates, includeDates = _a.includeDates, filterDate = _a.filterDate, preSelection = _a.preSelection, disabledKeyboardNavigation = _a.disabledKeyboardNavigation, disabled = _a.disabled;
|
|
12068
|
+
var isDisabled = (minDate ||
|
|
12069
|
+
maxDate ||
|
|
12070
|
+
excludeDates ||
|
|
12071
|
+
includeDates ||
|
|
12072
|
+
filterDate ||
|
|
12073
|
+
disabled) &&
|
|
12010
12074
|
isQuarterDisabled(setQuarter(day, q), _this.props);
|
|
12011
12075
|
return clsx("react-datepicker__quarter-text", "react-datepicker__quarter-".concat(q), {
|
|
12012
12076
|
"react-datepicker__quarter-text--disabled": isDisabled,
|
|
@@ -12095,11 +12159,14 @@ var Month$1 = /** @class */ (function (_super) {
|
|
|
12095
12159
|
var formattedAriaLabelPrefix = ariaLabelPrefix
|
|
12096
12160
|
? ariaLabelPrefix.trim() + " "
|
|
12097
12161
|
: "";
|
|
12098
|
-
|
|
12099
|
-
|
|
12100
|
-
:
|
|
12101
|
-
|
|
12102
|
-
|
|
12162
|
+
var shouldUseListboxRole = showMonthYearPicker || showQuarterYearPicker;
|
|
12163
|
+
if (shouldUseListboxRole) {
|
|
12164
|
+
return (React__default.createElement("div", { className: this.getClassNames(), onMouseLeave: !this.props.usePointerEvent ? this.handleMouseLeave : undefined, onPointerLeave: this.props.usePointerEvent ? this.handleMouseLeave : undefined, "aria-label": "".concat(formattedAriaLabelPrefix).concat(formatDate(day, "MMMM, yyyy", this.props.locale)), role: "listbox" }, showMonthYearPicker ? this.renderMonths() : this.renderQuarters()));
|
|
12165
|
+
}
|
|
12166
|
+
// For regular calendar view, use table structure
|
|
12167
|
+
return (React__default.createElement("div", { role: "table" },
|
|
12168
|
+
this.props.dayNamesHeader && (React__default.createElement("div", { role: "rowgroup" }, this.props.dayNamesHeader)),
|
|
12169
|
+
React__default.createElement("div", { className: this.getClassNames(), onMouseLeave: !this.props.usePointerEvent ? this.handleMouseLeave : undefined, onPointerLeave: this.props.usePointerEvent ? this.handleMouseLeave : undefined, "aria-label": "".concat(formattedAriaLabelPrefix).concat(formatDate(day, "MMMM, yyyy", this.props.locale)), role: "rowgroup" }, this.renderWeeks())));
|
|
12103
12170
|
};
|
|
12104
12171
|
return Month;
|
|
12105
12172
|
}(Component));
|
|
@@ -12108,11 +12175,40 @@ var MonthDropdownOptions = /** @class */ (function (_super) {
|
|
|
12108
12175
|
__extends(MonthDropdownOptions, _super);
|
|
12109
12176
|
function MonthDropdownOptions() {
|
|
12110
12177
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
12178
|
+
_this.monthOptionButtonsRef = {};
|
|
12111
12179
|
_this.isSelectedMonth = function (i) { return _this.props.month === i; };
|
|
12180
|
+
_this.handleOptionKeyDown = function (i, e) {
|
|
12181
|
+
var _a;
|
|
12182
|
+
switch (e.key) {
|
|
12183
|
+
case "Enter":
|
|
12184
|
+
e.preventDefault();
|
|
12185
|
+
_this.onChange(i);
|
|
12186
|
+
break;
|
|
12187
|
+
case "Escape":
|
|
12188
|
+
e.preventDefault();
|
|
12189
|
+
_this.props.onCancel();
|
|
12190
|
+
break;
|
|
12191
|
+
case "ArrowUp":
|
|
12192
|
+
case "ArrowDown": {
|
|
12193
|
+
e.preventDefault();
|
|
12194
|
+
var newMonth = (i + (e.key === "ArrowUp" ? -1 : 1) + _this.props.monthNames.length) %
|
|
12195
|
+
_this.props.monthNames.length;
|
|
12196
|
+
(_a = _this.monthOptionButtonsRef[newMonth]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
12197
|
+
break;
|
|
12198
|
+
}
|
|
12199
|
+
}
|
|
12200
|
+
};
|
|
12112
12201
|
_this.renderOptions = function () {
|
|
12113
|
-
|
|
12202
|
+
// Clear refs to prevent memory leaks on re-render
|
|
12203
|
+
_this.monthOptionButtonsRef = {};
|
|
12204
|
+
return _this.props.monthNames.map(function (month, i) { return (React__default.createElement("div", { ref: function (el) {
|
|
12205
|
+
_this.monthOptionButtonsRef[i] = el;
|
|
12206
|
+
if (_this.isSelectedMonth(i)) {
|
|
12207
|
+
el === null || el === void 0 ? void 0 : el.focus();
|
|
12208
|
+
}
|
|
12209
|
+
}, role: "button", tabIndex: 0, className: _this.isSelectedMonth(i)
|
|
12114
12210
|
? "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 },
|
|
12211
|
+
: "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
12212
|
_this.isSelectedMonth(i) ? (React__default.createElement("span", { className: "react-datepicker__month-option--selected" }, "\u2713")) : (""),
|
|
12117
12213
|
month)); });
|
|
12118
12214
|
};
|
|
@@ -12137,7 +12233,7 @@ var MonthDropdown = /** @class */ (function (_super) {
|
|
|
12137
12233
|
return monthNames.map(function (m, i) { return (React__default.createElement("option", { key: m, value: i }, m)); });
|
|
12138
12234
|
};
|
|
12139
12235
|
_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("
|
|
12236
|
+
_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
12237
|
React__default.createElement("span", { className: "react-datepicker__month-read-view--down-arrow" }),
|
|
12142
12238
|
React__default.createElement("span", { className: "react-datepicker__month-read-view--selected-month" }, monthNames[_this.props.month]))); };
|
|
12143
12239
|
_this.renderDropdown = function (monthNames) { return (React__default.createElement(MonthDropdownOptions, _assign({ key: "dropdown" }, _this.props, { monthNames: monthNames, onChange: _this.onChange, onCancel: _this.toggleDropdown }))); };
|
|
@@ -12625,19 +12721,20 @@ var Year$1 = /** @class */ (function (_super) {
|
|
|
12625
12721
|
return isSameYear(_year, endDate !== null && endDate !== void 0 ? endDate : null);
|
|
12626
12722
|
};
|
|
12627
12723
|
_this.isKeyboardSelected = function (y) {
|
|
12628
|
-
if (_this.props.
|
|
12629
|
-
_this.props.
|
|
12724
|
+
if (_this.props.disabledKeyboardNavigation ||
|
|
12725
|
+
_this.props.date === undefined ||
|
|
12630
12726
|
_this.props.preSelection == null) {
|
|
12631
12727
|
return;
|
|
12632
12728
|
}
|
|
12633
|
-
var _a = _this.props, minDate = _a.minDate, maxDate = _a.maxDate, excludeDates = _a.excludeDates, includeDates = _a.includeDates, filterDate = _a.filterDate;
|
|
12729
|
+
var _a = _this.props, minDate = _a.minDate, maxDate = _a.maxDate, excludeDates = _a.excludeDates, includeDates = _a.includeDates, filterDate = _a.filterDate, selected = _a.selected;
|
|
12634
12730
|
var date = getStartOfYear(setYear(_this.props.date, y));
|
|
12635
12731
|
var isDisabled = (minDate || maxDate || excludeDates || includeDates || filterDate) &&
|
|
12636
12732
|
isYearDisabled(y, _this.props);
|
|
12637
|
-
|
|
12638
|
-
|
|
12639
|
-
|
|
12640
|
-
|
|
12733
|
+
var isSelectedDay = !!selected && isSameDay(date, getStartOfYear(selected));
|
|
12734
|
+
var isKeyboardSelectedDay = isSameDay(date, getStartOfYear(_this.props.preSelection));
|
|
12735
|
+
return (!_this.props.inline &&
|
|
12736
|
+
!isSelectedDay &&
|
|
12737
|
+
isKeyboardSelectedDay &&
|
|
12641
12738
|
!isDisabled);
|
|
12642
12739
|
};
|
|
12643
12740
|
_this.isSelectedYear = function (year) {
|
|
@@ -12732,10 +12829,15 @@ var Year$1 = /** @class */ (function (_super) {
|
|
|
12732
12829
|
handleOnKeyDown && handleOnKeyDown(event);
|
|
12733
12830
|
};
|
|
12734
12831
|
_this.getYearClassNames = function (y) {
|
|
12735
|
-
var _a = _this.props, date = _a.date, minDate = _a.minDate, maxDate = _a.maxDate, excludeDates = _a.excludeDates, includeDates = _a.includeDates, filterDate = _a.filterDate, yearClassName = _a.yearClassName;
|
|
12832
|
+
var _a = _this.props, date = _a.date, disabled = _a.disabled, minDate = _a.minDate, maxDate = _a.maxDate, excludeDates = _a.excludeDates, includeDates = _a.includeDates, filterDate = _a.filterDate, yearClassName = _a.yearClassName;
|
|
12736
12833
|
return clsx("react-datepicker__year-text", "react-datepicker__year-".concat(y), date ? yearClassName === null || yearClassName === void 0 ? void 0 : yearClassName(setYear(date, y)) : undefined, {
|
|
12737
12834
|
"react-datepicker__year-text--selected": _this.isSelectedYear(y),
|
|
12738
|
-
"react-datepicker__year-text--disabled": (minDate ||
|
|
12835
|
+
"react-datepicker__year-text--disabled": (minDate ||
|
|
12836
|
+
maxDate ||
|
|
12837
|
+
excludeDates ||
|
|
12838
|
+
includeDates ||
|
|
12839
|
+
filterDate ||
|
|
12840
|
+
disabled) &&
|
|
12739
12841
|
isYearDisabled(y, _this.props),
|
|
12740
12842
|
"react-datepicker__year-text--keyboard-selected": _this.isKeyboardSelected(y),
|
|
12741
12843
|
"react-datepicker__year-text--range-start": _this.isRangeStart(y),
|
|
@@ -12823,11 +12925,42 @@ var YearDropdownOptions = /** @class */ (function (_super) {
|
|
|
12823
12925
|
__extends(YearDropdownOptions, _super);
|
|
12824
12926
|
function YearDropdownOptions(props) {
|
|
12825
12927
|
var _this = _super.call(this, props) || this;
|
|
12928
|
+
_this.yearOptionButtonsRef = {};
|
|
12929
|
+
_this.handleOptionKeyDown = function (year, e) {
|
|
12930
|
+
var _a;
|
|
12931
|
+
switch (e.key) {
|
|
12932
|
+
case "Enter":
|
|
12933
|
+
e.preventDefault();
|
|
12934
|
+
_this.onChange(year);
|
|
12935
|
+
break;
|
|
12936
|
+
case "Escape":
|
|
12937
|
+
e.preventDefault();
|
|
12938
|
+
_this.props.onCancel();
|
|
12939
|
+
break;
|
|
12940
|
+
case "ArrowUp":
|
|
12941
|
+
case "ArrowDown": {
|
|
12942
|
+
e.preventDefault();
|
|
12943
|
+
var newYear = year + (e.key === "ArrowUp" ? 1 : -1);
|
|
12944
|
+
// Add bounds checking to ensure the year exists in our refs
|
|
12945
|
+
if (_this.yearOptionButtonsRef[newYear]) {
|
|
12946
|
+
(_a = _this.yearOptionButtonsRef[newYear]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
12947
|
+
}
|
|
12948
|
+
break;
|
|
12949
|
+
}
|
|
12950
|
+
}
|
|
12951
|
+
};
|
|
12826
12952
|
_this.renderOptions = function () {
|
|
12953
|
+
// Clear refs to prevent memory leaks on re-render
|
|
12954
|
+
_this.yearOptionButtonsRef = {};
|
|
12827
12955
|
var selectedYear = _this.props.year;
|
|
12828
|
-
var options = _this.state.yearsList.map(function (year) { return (React__default.createElement("div", {
|
|
12956
|
+
var options = _this.state.yearsList.map(function (year) { return (React__default.createElement("div", { ref: function (el) {
|
|
12957
|
+
_this.yearOptionButtonsRef[year] = el;
|
|
12958
|
+
if (year === selectedYear) {
|
|
12959
|
+
el === null || el === void 0 ? void 0 : el.focus();
|
|
12960
|
+
}
|
|
12961
|
+
}, role: "button", tabIndex: 0, className: selectedYear === year
|
|
12829
12962
|
? "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 },
|
|
12963
|
+
: "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
12964
|
selectedYear === year ? (React__default.createElement("span", { className: "react-datepicker__year-option--selected" }, "\u2713")) : (""),
|
|
12832
12965
|
year)); });
|
|
12833
12966
|
var minYear = _this.props.minDate ? getYear(_this.props.minDate) : null;
|
|
@@ -12922,9 +13055,7 @@ var YearDropdown = /** @class */ (function (_super) {
|
|
|
12922
13055
|
_this.onChange(parseInt(event.target.value));
|
|
12923
13056
|
};
|
|
12924
13057
|
_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
|
-
} },
|
|
13058
|
+
_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
13059
|
React__default.createElement("span", { className: "react-datepicker__year-read-view--down-arrow" }),
|
|
12929
13060
|
React__default.createElement("span", { className: "react-datepicker__year-read-view--selected-year" }, _this.props.year))); };
|
|
12930
13061
|
_this.renderDropdown = function () { return (React__default.createElement(YearDropdownOptions, _assign({ key: "dropdown" }, _this.props, { onChange: _this.onChange, onCancel: _this.toggleDropdown }))); };
|
|
@@ -12986,6 +13117,7 @@ var DROPDOWN_FOCUS_CLASSNAMES = [
|
|
|
12986
13117
|
"react-datepicker__month-select",
|
|
12987
13118
|
"react-datepicker__month-year-select",
|
|
12988
13119
|
];
|
|
13120
|
+
var OUTSIDE_CLICK_IGNORE_CLASS = "react-datepicker-ignore-onclickoutside";
|
|
12989
13121
|
var isDropdownSelect = function (element) {
|
|
12990
13122
|
var classNames = (element.className || "").split(/\s+/);
|
|
12991
13123
|
return DROPDOWN_FOCUS_CLASSNAMES.some(function (testClassname) { return classNames.indexOf(testClassname) >= 0; });
|
|
@@ -13134,10 +13266,13 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13134
13266
|
};
|
|
13135
13267
|
_this.header = function (date) {
|
|
13136
13268
|
if (date === void 0) { date = _this.state.date; }
|
|
13269
|
+
var disabled = _this.props.disabled;
|
|
13137
13270
|
var startOfWeek = getStartOfWeek(date, _this.props.locale, _this.props.calendarStartDay);
|
|
13138
13271
|
var dayNames = [];
|
|
13139
13272
|
if (_this.props.showWeekNumbers) {
|
|
13140
|
-
dayNames.push(React__default.createElement("div", { key: "W", className: "react-datepicker__day-name"
|
|
13273
|
+
dayNames.push(React__default.createElement("div", { key: "W", className: "react-datepicker__day-name ".concat(disabled ? "react-datepicker__day-name--disabled" : ""), role: "columnheader" },
|
|
13274
|
+
React__default.createElement("span", { className: "react-datepicker__sr-only" }, "Week number"),
|
|
13275
|
+
React__default.createElement("span", { "aria-hidden": "true" }, _this.props.weekLabel || "#")));
|
|
13141
13276
|
}
|
|
13142
13277
|
return dayNames.concat([0, 1, 2, 3, 4, 5, 6].map(function (offset) {
|
|
13143
13278
|
var day = addDays(startOfWeek, offset);
|
|
@@ -13145,7 +13280,9 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13145
13280
|
var weekDayClassName = _this.props.weekDayClassName
|
|
13146
13281
|
? _this.props.weekDayClassName(day)
|
|
13147
13282
|
: undefined;
|
|
13148
|
-
return (React__default.createElement("div", { key: offset,
|
|
13283
|
+
return (React__default.createElement("div", { key: offset, role: "columnheader", className: clsx("react-datepicker__day-name", weekDayClassName, disabled ? "react-datepicker__day-name--disabled" : "") },
|
|
13284
|
+
React__default.createElement("span", { className: "react-datepicker__sr-only" }, formatDate(day, "EEEE", _this.props.locale)),
|
|
13285
|
+
React__default.createElement("span", { "aria-hidden": "true" }, weekDayName)));
|
|
13149
13286
|
}));
|
|
13150
13287
|
};
|
|
13151
13288
|
_this.formatWeekday = function (day, locale) {
|
|
@@ -13183,6 +13320,9 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13183
13320
|
var fromMonthDate = subMonths(_this.state.date, monthSelectedIn);
|
|
13184
13321
|
var allPrevDaysDisabled;
|
|
13185
13322
|
switch (true) {
|
|
13323
|
+
case _this.props.disabled:
|
|
13324
|
+
allPrevDaysDisabled = true;
|
|
13325
|
+
break;
|
|
13186
13326
|
case _this.props.showMonthYearPicker:
|
|
13187
13327
|
allPrevDaysDisabled = yearDisabledBefore(_this.state.date, _this.props);
|
|
13188
13328
|
break;
|
|
@@ -13250,6 +13390,9 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13250
13390
|
}
|
|
13251
13391
|
var allNextDaysDisabled;
|
|
13252
13392
|
switch (true) {
|
|
13393
|
+
case _this.props.disabled:
|
|
13394
|
+
allNextDaysDisabled = true;
|
|
13395
|
+
break;
|
|
13253
13396
|
case _this.props.showMonthYearPicker:
|
|
13254
13397
|
allNextDaysDisabled = yearDisabledAfter(_this.state.date, _this.props);
|
|
13255
13398
|
break;
|
|
@@ -13350,6 +13493,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13350
13493
|
}
|
|
13351
13494
|
return (React__default.createElement("div", { className: "react-datepicker__today-button", onClick: _this.handleTodayButtonClick }, _this.props.todayButton));
|
|
13352
13495
|
};
|
|
13496
|
+
_this.renderDayNamesHeader = function (monthDate) { return (React__default.createElement("div", { className: "react-datepicker__day-names", role: "row" }, _this.header(monthDate))); };
|
|
13353
13497
|
_this.renderDefaultHeader = function (_a) {
|
|
13354
13498
|
var monthDate = _a.monthDate, i = _a.i;
|
|
13355
13499
|
return (React__default.createElement("div", { className: "react-datepicker__header ".concat(_this.props.showTimeSelect
|
|
@@ -13359,8 +13503,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13359
13503
|
React__default.createElement("div", { className: "react-datepicker__header__dropdown react-datepicker__header__dropdown--".concat(_this.props.dropdownMode), onFocus: _this.handleDropdownFocus },
|
|
13360
13504
|
_this.renderMonthDropdown(i !== 0),
|
|
13361
13505
|
_this.renderMonthYearDropdown(i !== 0),
|
|
13362
|
-
_this.renderYearDropdown(i !== 0))
|
|
13363
|
-
React__default.createElement("div", { className: "react-datepicker__day-names" }, _this.header(monthDate))));
|
|
13506
|
+
_this.renderYearDropdown(i !== 0))));
|
|
13364
13507
|
};
|
|
13365
13508
|
_this.renderCustomHeader = function (headerArgs) {
|
|
13366
13509
|
var _a, _b;
|
|
@@ -13369,16 +13512,20 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13369
13512
|
_this.props.showTimeSelectOnly) {
|
|
13370
13513
|
return null;
|
|
13371
13514
|
}
|
|
13515
|
+
var _c = _this.props, showYearPicker = _c.showYearPicker, yearItemNumber = _c.yearItemNumber;
|
|
13516
|
+
var visibleYearsRange;
|
|
13517
|
+
if (showYearPicker) {
|
|
13518
|
+
var _d = getYearsPeriod(monthDate, yearItemNumber), startYear = _d.startPeriod, endYear = _d.endPeriod;
|
|
13519
|
+
visibleYearsRange = {
|
|
13520
|
+
startYear: startYear,
|
|
13521
|
+
endYear: endYear,
|
|
13522
|
+
};
|
|
13523
|
+
}
|
|
13372
13524
|
var prevMonthButtonDisabled = monthDisabledBefore(_this.state.date, _this.props);
|
|
13373
13525
|
var nextMonthButtonDisabled = monthDisabledAfter(_this.state.date, _this.props);
|
|
13374
13526
|
var prevYearButtonDisabled = yearDisabledBefore(_this.state.date, _this.props);
|
|
13375
13527
|
var nextYearButtonDisabled = yearDisabledAfter(_this.state.date, _this.props);
|
|
13376
|
-
|
|
13377
|
-
!_this.props.showQuarterYearPicker &&
|
|
13378
|
-
!_this.props.showYearPicker;
|
|
13379
|
-
return (React__default.createElement("div", { className: "react-datepicker__header react-datepicker__header--custom", onFocus: _this.props.onDropdownFocus }, (_b = (_a = _this.props).renderCustomHeader) === null || _b === void 0 ? void 0 :
|
|
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 })),
|
|
13381
|
-
showDayNames && (React__default.createElement("div", { className: "react-datepicker__day-names" }, _this.header(monthDate)))));
|
|
13528
|
+
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 : _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 }))));
|
|
13382
13529
|
};
|
|
13383
13530
|
_this.renderYearHeader = function (_a) {
|
|
13384
13531
|
var monthDate = _a.monthDate;
|
|
@@ -13426,7 +13573,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13426
13573
|
_this.monthContainer = div !== null && div !== void 0 ? div : undefined;
|
|
13427
13574
|
}, className: "react-datepicker__month-container" },
|
|
13428
13575
|
_this.renderHeader({ monthDate: monthDate, i: i }),
|
|
13429
|
-
React__default.createElement(Month$1, _assign({}, Calendar.defaultProps, _this.props, { containerRef: _this.containerRef, ariaLabelPrefix: _this.props.monthAriaLabelPrefix, day: monthDate, onDayClick: _this.handleDayClick, handleOnKeyDown: _this.props.handleOnDayKeyDown, handleOnMonthKeyDown: _this.props.handleOnKeyDown, onDayMouseEnter: _this.handleDayMouseEnter, onMouseLeave: _this.handleMonthMouseLeave, orderInDisplay: i, selectingDate: _this.state.selectingDate, monthShowsDuplicateDaysEnd: monthShowsDuplicateDaysEnd, monthShowsDuplicateDaysStart: monthShowsDuplicateDaysStart }))));
|
|
13576
|
+
React__default.createElement(Month$1, _assign({}, Calendar.defaultProps, _this.props, { containerRef: _this.containerRef, ariaLabelPrefix: _this.props.monthAriaLabelPrefix, day: monthDate, onDayClick: _this.handleDayClick, handleOnKeyDown: _this.props.handleOnDayKeyDown, handleOnMonthKeyDown: _this.props.handleOnKeyDown, onDayMouseEnter: _this.handleDayMouseEnter, onMouseLeave: _this.handleMonthMouseLeave, orderInDisplay: i, selectingDate: _this.state.selectingDate, monthShowsDuplicateDaysEnd: monthShowsDuplicateDaysEnd, monthShowsDuplicateDaysStart: monthShowsDuplicateDaysStart, dayNamesHeader: _this.renderDayNamesHeader(monthDate) }))));
|
|
13430
13577
|
}
|
|
13431
13578
|
return monthList;
|
|
13432
13579
|
};
|
|
@@ -13497,6 +13644,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
13497
13644
|
return {
|
|
13498
13645
|
monthsShown: 1,
|
|
13499
13646
|
forceShowMonthNavigation: false,
|
|
13647
|
+
outsideClickIgnoreClass: OUTSIDE_CLICK_IGNORE_CLASS,
|
|
13500
13648
|
timeCaption: "Time",
|
|
13501
13649
|
previousYearButtonLabel: "Previous Year",
|
|
13502
13650
|
nextYearButtonLabel: "Next Year",
|
|
@@ -13730,7 +13878,7 @@ var TabLoop = /** @class */ (function (_super) {
|
|
|
13730
13878
|
* @returns A new component with floating behavior.
|
|
13731
13879
|
*/
|
|
13732
13880
|
function withFloating(Component) {
|
|
13733
|
-
|
|
13881
|
+
function WithFloating(props) {
|
|
13734
13882
|
var _a;
|
|
13735
13883
|
var hidePopper = typeof props.hidePopper === "boolean" ? props.hidePopper : true;
|
|
13736
13884
|
var arrowRef = useRef(null);
|
|
@@ -13741,51 +13889,35 @@ function withFloating(Component) {
|
|
|
13741
13889
|
], ((_a = props.popperModifiers) !== null && _a !== void 0 ? _a : []), true) }, props.popperProps));
|
|
13742
13890
|
var componentProps = _assign(_assign({}, props), { hidePopper: hidePopper, popperProps: _assign(_assign({}, floatingProps), { arrowRef: arrowRef }) });
|
|
13743
13891
|
return React__default.createElement(Component, _assign({}, componentProps));
|
|
13744
|
-
}
|
|
13892
|
+
}
|
|
13893
|
+
WithFloating.displayName = "withFloating(".concat(Component.displayName || Component.name || "Component", ")");
|
|
13745
13894
|
return WithFloating;
|
|
13746
13895
|
}
|
|
13747
13896
|
|
|
13748
13897
|
// 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));
|
|
13898
|
+
var PopperComponent = function (props) {
|
|
13899
|
+
var className = props.className, wrapperClassName = props.wrapperClassName, _a = props.hidePopper, hidePopper = _a === void 0 ? true : _a, popperComponent = props.popperComponent, targetComponent = props.targetComponent, enableTabLoop = props.enableTabLoop, popperOnKeyDown = props.popperOnKeyDown, portalId = props.portalId, portalHost = props.portalHost, popperProps = props.popperProps, showArrow = props.showArrow;
|
|
13900
|
+
var popper = undefined;
|
|
13901
|
+
if (!hidePopper) {
|
|
13902
|
+
var classes = clsx("react-datepicker-popper", className);
|
|
13903
|
+
popper = (React__default.createElement(TabLoop, { enableTabLoop: enableTabLoop },
|
|
13904
|
+
React__default.createElement("div", { ref: popperProps.refs.setFloating, style: popperProps.floatingStyles, className: classes, "data-placement": popperProps.placement, onKeyDown: popperOnKeyDown },
|
|
13905
|
+
popperComponent,
|
|
13906
|
+
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" })))));
|
|
13907
|
+
}
|
|
13908
|
+
if (props.popperContainer) {
|
|
13909
|
+
popper = createElement(props.popperContainer, {}, popper);
|
|
13910
|
+
}
|
|
13911
|
+
if (portalId && !hidePopper) {
|
|
13912
|
+
popper = (React__default.createElement(Portal, { portalId: portalId, portalHost: portalHost }, popper));
|
|
13913
|
+
}
|
|
13914
|
+
var wrapperClasses = clsx("react-datepicker-wrapper", wrapperClassName);
|
|
13915
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
13916
|
+
React__default.createElement("div", { ref: popperProps.refs.setReference, className: wrapperClasses }, targetComponent),
|
|
13917
|
+
popper));
|
|
13918
|
+
};
|
|
13786
13919
|
var PopperComponent$1 = withFloating(PopperComponent);
|
|
13787
13920
|
|
|
13788
|
-
var outsideClickIgnoreClass = "react-datepicker-ignore-onclickoutside";
|
|
13789
13921
|
// Compares dates year+month combinations
|
|
13790
13922
|
function hasPreSelectionChanged(date1, date2) {
|
|
13791
13923
|
if (date1 && date2) {
|
|
@@ -13851,6 +13983,35 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
13851
13983
|
wasHidden: false,
|
|
13852
13984
|
};
|
|
13853
13985
|
};
|
|
13986
|
+
_this.getInputValue = function () {
|
|
13987
|
+
var _a;
|
|
13988
|
+
var _b = _this.props, locale = _b.locale, startDate = _b.startDate, endDate = _b.endDate, rangeSeparator = _b.rangeSeparator, selected = _b.selected, selectedDates = _b.selectedDates, selectsMultiple = _b.selectsMultiple, selectsRange = _b.selectsRange, value = _b.value;
|
|
13989
|
+
var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
|
|
13990
|
+
var inputValue = _this.state.inputValue;
|
|
13991
|
+
if (typeof value === "string") {
|
|
13992
|
+
return value;
|
|
13993
|
+
}
|
|
13994
|
+
else if (typeof inputValue === "string") {
|
|
13995
|
+
return inputValue;
|
|
13996
|
+
}
|
|
13997
|
+
else if (selectsRange) {
|
|
13998
|
+
return safeDateRangeFormat(startDate, endDate, {
|
|
13999
|
+
dateFormat: dateFormat,
|
|
14000
|
+
locale: locale,
|
|
14001
|
+
rangeSeparator: rangeSeparator,
|
|
14002
|
+
});
|
|
14003
|
+
}
|
|
14004
|
+
else if (selectsMultiple) {
|
|
14005
|
+
return safeMultipleDatesFormat(selectedDates !== null && selectedDates !== void 0 ? selectedDates : [], {
|
|
14006
|
+
dateFormat: dateFormat,
|
|
14007
|
+
locale: locale,
|
|
14008
|
+
});
|
|
14009
|
+
}
|
|
14010
|
+
return safeDateFormat(selected, {
|
|
14011
|
+
dateFormat: dateFormat,
|
|
14012
|
+
locale: locale,
|
|
14013
|
+
});
|
|
14014
|
+
};
|
|
13854
14015
|
_this.resetHiddenStatus = function () {
|
|
13855
14016
|
_this.setState(_assign(_assign({}, _this.state), { wasHidden: false }));
|
|
13856
14017
|
};
|
|
@@ -13950,11 +14111,15 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
13950
14111
|
_this.handleDropdownFocus = function () {
|
|
13951
14112
|
_this.cancelFocusInput();
|
|
13952
14113
|
};
|
|
14114
|
+
_this.resetInputValue = function () {
|
|
14115
|
+
_this.setState(_assign(_assign({}, _this.state), { inputValue: null }));
|
|
14116
|
+
};
|
|
13953
14117
|
_this.handleBlur = function (event) {
|
|
13954
14118
|
var _a, _b;
|
|
13955
14119
|
if (!_this.state.open || _this.props.withPortal || _this.props.showTimeInput) {
|
|
13956
14120
|
(_b = (_a = _this.props).onBlur) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
13957
14121
|
}
|
|
14122
|
+
_this.resetInputValue();
|
|
13958
14123
|
if (_this.state.open && _this.props.open === false) {
|
|
13959
14124
|
_this.setOpen(false);
|
|
13960
14125
|
}
|
|
@@ -13995,11 +14160,17 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
13995
14160
|
var strictParsing = (_b = _this.props.strictParsing) !== null && _b !== void 0 ? _b : DatePicker.defaultProps.strictParsing;
|
|
13996
14161
|
var value = (event === null || event === void 0 ? void 0 : event.target) instanceof HTMLInputElement ? event.target.value : "";
|
|
13997
14162
|
if (selectsRange) {
|
|
14163
|
+
var rangeSeparator = _this.props.rangeSeparator;
|
|
14164
|
+
var trimmedRangeSeparator = rangeSeparator.trim();
|
|
13998
14165
|
var _g = value
|
|
13999
|
-
.split(dateFormat.includes(
|
|
14166
|
+
.split(dateFormat.includes(trimmedRangeSeparator)
|
|
14167
|
+
? rangeSeparator
|
|
14168
|
+
: trimmedRangeSeparator, 2)
|
|
14000
14169
|
.map(function (val) { return val.trim(); }), valueStart = _g[0], valueEnd = _g[1];
|
|
14001
14170
|
var startDateNew = parseDate(valueStart !== null && valueStart !== void 0 ? valueStart : "", dateFormat, _this.props.locale, strictParsing);
|
|
14002
|
-
var endDateNew =
|
|
14171
|
+
var endDateNew = startDateNew
|
|
14172
|
+
? parseDate(valueEnd !== null && valueEnd !== void 0 ? valueEnd : "", dateFormat, _this.props.locale, strictParsing)
|
|
14173
|
+
: null;
|
|
14003
14174
|
var startChanged = (startDate === null || startDate === void 0 ? void 0 : startDate.getTime()) !== (startDateNew === null || startDateNew === void 0 ? void 0 : startDateNew.getTime());
|
|
14004
14175
|
var endChanged = (endDate === null || endDate === void 0 ? void 0 : endDate.getTime()) !== (endDateNew === null || endDateNew === void 0 ? void 0 : endDateNew.getTime());
|
|
14005
14176
|
if (!startChanged && !endChanged) {
|
|
@@ -14023,15 +14194,26 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14023
14194
|
}
|
|
14024
14195
|
};
|
|
14025
14196
|
_this.handleSelect = function (date, event, monthSelectedIn) {
|
|
14197
|
+
var _a;
|
|
14026
14198
|
if (_this.props.readOnly)
|
|
14027
14199
|
return;
|
|
14028
|
-
|
|
14200
|
+
var _b = _this.props, selectsRange = _b.selectsRange, startDate = _b.startDate, endDate = _b.endDate, locale = _b.locale, swapRange = _b.swapRange;
|
|
14201
|
+
var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
|
|
14202
|
+
var isDateSelectionComplete = !selectsRange ||
|
|
14203
|
+
(startDate && !endDate && (swapRange || !isDateBefore(date, startDate)));
|
|
14204
|
+
if (_this.props.shouldCloseOnSelect &&
|
|
14205
|
+
!_this.props.showTimeSelect &&
|
|
14206
|
+
isDateSelectionComplete) {
|
|
14029
14207
|
// Preventing onFocus event to fix issue
|
|
14030
14208
|
// https://github.com/Hacker0x01/react-datepicker/issues/628
|
|
14031
14209
|
_this.sendFocusBackToInput();
|
|
14032
14210
|
}
|
|
14033
14211
|
if (_this.props.onChangeRaw) {
|
|
14034
|
-
|
|
14212
|
+
var formattedDate = safeDateFormat(date, {
|
|
14213
|
+
dateFormat: dateFormat,
|
|
14214
|
+
locale: locale,
|
|
14215
|
+
});
|
|
14216
|
+
_this.props.onChangeRaw(event, { date: date, formattedDate: formattedDate });
|
|
14035
14217
|
}
|
|
14036
14218
|
_this.setSelected(date, event, false, monthSelectedIn);
|
|
14037
14219
|
if (_this.props.showDateSelect) {
|
|
@@ -14040,16 +14222,8 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14040
14222
|
if (!_this.props.shouldCloseOnSelect || _this.props.showTimeSelect) {
|
|
14041
14223
|
_this.setPreSelection(date);
|
|
14042
14224
|
}
|
|
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
|
-
}
|
|
14225
|
+
else if (isDateSelectionComplete) {
|
|
14226
|
+
_this.setOpen(false);
|
|
14053
14227
|
}
|
|
14054
14228
|
};
|
|
14055
14229
|
// 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 +14288,7 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14114
14288
|
if (selectsRange) {
|
|
14115
14289
|
var noRanges = !startDate && !endDate;
|
|
14116
14290
|
var hasStartRange = startDate && !endDate;
|
|
14291
|
+
var hasOnlyEndRange = !startDate && !!endDate;
|
|
14117
14292
|
var isRangeFilled = startDate && endDate;
|
|
14118
14293
|
if (noRanges) {
|
|
14119
14294
|
onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, null], event);
|
|
@@ -14134,6 +14309,14 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14134
14309
|
onChange === null || onChange === void 0 ? void 0 : onChange([startDate, changedDate], event);
|
|
14135
14310
|
}
|
|
14136
14311
|
}
|
|
14312
|
+
else if (hasOnlyEndRange) {
|
|
14313
|
+
if (changedDate && isDateBefore(changedDate, endDate)) {
|
|
14314
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, endDate], event);
|
|
14315
|
+
}
|
|
14316
|
+
else {
|
|
14317
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, null], event);
|
|
14318
|
+
}
|
|
14319
|
+
}
|
|
14137
14320
|
if (isRangeFilled) {
|
|
14138
14321
|
onChange === null || onChange === void 0 ? void 0 : onChange([changedDate, null], event);
|
|
14139
14322
|
}
|
|
@@ -14507,10 +14690,12 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14507
14690
|
}
|
|
14508
14691
|
return (React__default.createElement(Calendar, _assign({ showMonthYearDropdown: undefined, ref: function (elem) {
|
|
14509
14692
|
_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));
|
|
14693
|
+
} }, _this.props, _this.state, { setOpen: _this.setOpen, dateFormat: (_a = _this.props.dateFormatCalendar) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormatCalendar, onSelect: _this.handleSelect, onClickOutside: _this.handleCalendarClickOutside, holidays: getHolidaysMap(_this.modifyHolidays()), outsideClickIgnoreClass: _this.props.outsideClickIgnoreClass, onDropdownFocus: _this.handleDropdownFocus, onTimeChange: _this.handleTimeChange, className: _this.props.calendarClassName, container: _this.props.calendarContainer, handleOnKeyDown: _this.props.onKeyDown, handleOnDayKeyDown: _this.onDayKeyDown, setPreSelection: _this.setPreSelection, dropdownMode: (_b = _this.props.dropdownMode) !== null && _b !== void 0 ? _b : DatePicker.defaultProps.dropdownMode }), _this.props.children));
|
|
14511
14694
|
};
|
|
14512
14695
|
_this.renderAriaLiveRegion = function () {
|
|
14513
|
-
var _a
|
|
14696
|
+
var _a;
|
|
14697
|
+
var locale = _this.props.locale;
|
|
14698
|
+
var dateFormat = (_a = _this.props.dateFormat) !== null && _a !== void 0 ? _a : DatePicker.defaultProps.dateFormat;
|
|
14514
14699
|
var isContainsTime = _this.props.showTimeInput || _this.props.showTimeSelect;
|
|
14515
14700
|
var longDateFormat = isContainsTime ? "PPPPp" : "PPPP";
|
|
14516
14701
|
var ariaLiveMessage;
|
|
@@ -14553,36 +14738,17 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14553
14738
|
};
|
|
14554
14739
|
_this.renderDateInput = function () {
|
|
14555
14740
|
var _a, _b;
|
|
14556
|
-
var _c;
|
|
14557
14741
|
var className = clsx(_this.props.className, (_a = {},
|
|
14558
|
-
_a[
|
|
14742
|
+
_a[_this.props.outsideClickIgnoreClass ||
|
|
14743
|
+
DatePicker.defaultProps.outsideClickIgnoreClass] = _this.state.open,
|
|
14559
14744
|
_a));
|
|
14560
14745
|
var customInput = _this.props.customInput || React__default.createElement("input", { type: "text" });
|
|
14561
14746
|
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
14747
|
return cloneElement(customInput, (_b = {},
|
|
14582
14748
|
_b[customInputRef] = function (input) {
|
|
14583
14749
|
_this.input = input;
|
|
14584
14750
|
},
|
|
14585
|
-
_b.value =
|
|
14751
|
+
_b.value = _this.getInputValue(),
|
|
14586
14752
|
_b.onBlur = _this.handleBlur,
|
|
14587
14753
|
_b.onChange = _this.handleChange,
|
|
14588
14754
|
_b.onClick = _this.onInputClick,
|
|
@@ -14635,7 +14801,9 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
14635
14801
|
dropdownMode: "scroll",
|
|
14636
14802
|
preventOpenOnFocus: false,
|
|
14637
14803
|
monthsShown: 1,
|
|
14804
|
+
outsideClickIgnoreClass: OUTSIDE_CLICK_IGNORE_CLASS,
|
|
14638
14805
|
readOnly: false,
|
|
14806
|
+
rangeSeparator: DATE_RANGE_SEPARATOR,
|
|
14639
14807
|
withPortal: false,
|
|
14640
14808
|
selectsDisabledDaysInRange: false,
|
|
14641
14809
|
shouldCloseOnSelect: true,
|
|
@@ -15148,4 +15316,4 @@ var InlineDatePicker = function (props) {
|
|
|
15148
15316
|
};
|
|
15149
15317
|
|
|
15150
15318
|
export { DatePickerGroup as D, HelperText as H, InlineDatePicker as I, ValidationText as V };
|
|
15151
|
-
//# sourceMappingURL=InlineDatePicker-
|
|
15319
|
+
//# sourceMappingURL=InlineDatePicker-BuxjkoV0.js.map
|