@birdnet/advanced-react-dates 0.0.0-stage → 1.0.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/.babelrc +67 -0
- package/.eslintrc +66 -0
- package/.nvmrc +1 -0
- package/.nyc_output/4d8efcd220c2aec1f2b4ffd49d875001.json +1 -0
- package/.nyc_output/66d34779498a5d49bcf9d757dfc7fdb5.json +1 -0
- package/.nyc_output/8ca7e04140934515928bc7d4ae476b73.json +1 -0
- package/.nyc_output/afc270bb597bfc50e690436959c2ae54.json +1 -0
- package/.nycrc +19 -0
- package/.travis.yml +13 -0
- package/CHANGELOG.md +665 -0
- package/CLAUDE.md +56 -0
- package/INTHEWILD.md +9 -0
- package/LICENSE +21 -0
- package/README.md +421 -2
- package/constants.js +2 -0
- package/esm/components/CalendarDay.js +321 -0
- package/esm/components/CalendarIcon.js +11 -0
- package/esm/components/CalendarMonth.js +254 -0
- package/esm/components/CalendarMonthGrid.js +365 -0
- package/esm/components/CalendarWeek.js +11 -0
- package/esm/components/ChevronDown.js +11 -0
- package/esm/components/ChevronUp.js +11 -0
- package/esm/components/CloseButton.js +12 -0
- package/esm/components/CustomizableCalendarDay.js +341 -0
- package/esm/components/DateInput.js +344 -0
- package/esm/components/DateRangePicker.js +647 -0
- package/esm/components/DateRangePickerInput.js +341 -0
- package/esm/components/DateRangePickerInputController.js +348 -0
- package/esm/components/DayPicker.js +1167 -0
- package/esm/components/DayPickerKeyboardShortcuts.js +364 -0
- package/esm/components/DayPickerNavigation.js +314 -0
- package/esm/components/DayPickerRangeController.js +1202 -0
- package/esm/components/DayPickerSingleDateController.js +690 -0
- package/esm/components/KeyboardShortcutRow.js +69 -0
- package/esm/components/LeftArrow.js +11 -0
- package/esm/components/RightArrow.js +11 -0
- package/esm/components/SingleDatePicker.js +605 -0
- package/esm/components/SingleDatePickerInput.js +264 -0
- package/esm/components/SingleDatePickerInputController.js +260 -0
- package/esm/constants.js +28 -0
- package/esm/defaultPhrases.js +225 -0
- package/esm/index.js +20 -0
- package/esm/initialize.js +2 -0
- package/esm/shapes/AnchorDirectionShape.js +3 -0
- package/esm/shapes/CalendarInfoPositionShape.js +3 -0
- package/esm/shapes/DateRangePickerShape.js +101 -0
- package/esm/shapes/DayOfWeekShape.js +3 -0
- package/esm/shapes/DisabledShape.js +3 -0
- package/esm/shapes/FocusedInputShape.js +3 -0
- package/esm/shapes/IconPositionShape.js +3 -0
- package/esm/shapes/ModifiersShape.js +18 -0
- package/esm/shapes/NavPositionShape.js +3 -0
- package/esm/shapes/OpenDirectionShape.js +3 -0
- package/esm/shapes/OrientationShape.js +3 -0
- package/esm/shapes/ScrollableOrientationShape.js +3 -0
- package/esm/shapes/SingleDatePickerShape.js +90 -0
- package/esm/theme/DefaultTheme.js +176 -0
- package/esm/utils/calculateDimension.js +28 -0
- package/esm/utils/disableScroll.js +67 -0
- package/esm/utils/getActiveElement.js +3 -0
- package/esm/utils/getCalendarDaySettings.js +48 -0
- package/esm/utils/getCalendarMonthWeeks.js +37 -0
- package/esm/utils/getCalendarMonthWidth.js +4 -0
- package/esm/utils/getDetachedContainerStyles.js +36 -0
- package/esm/utils/getInputHeight.js +42 -0
- package/esm/utils/getNumberOfCalendarMonthWeeks.js +11 -0
- package/esm/utils/getPhrase.js +7 -0
- package/esm/utils/getPhrasePropTypes.js +9 -0
- package/esm/utils/getPooledMoment.js +8 -0
- package/esm/utils/getPreviousMonthMemoLast.js +9 -0
- package/esm/utils/getResponsiveContainerStyles.js +8 -0
- package/esm/utils/getSelectedDateOffset.js +8 -0
- package/esm/utils/getTransformStyles.js +8 -0
- package/esm/utils/getVisibleDays.js +42 -0
- package/esm/utils/isAfterDay.js +7 -0
- package/esm/utils/isBeforeDay.js +13 -0
- package/esm/utils/isDayVisible.js +38 -0
- package/esm/utils/isInclusivelyAfterDay.js +6 -0
- package/esm/utils/isInclusivelyBeforeDay.js +6 -0
- package/esm/utils/isNextDay.js +7 -0
- package/esm/utils/isNextMonth.js +6 -0
- package/esm/utils/isPrevMonth.js +6 -0
- package/esm/utils/isPreviousDay.js +7 -0
- package/esm/utils/isSameDay.js +7 -0
- package/esm/utils/isSameMonth.js +7 -0
- package/esm/utils/isTransitionEndSupported.js +3 -0
- package/esm/utils/modifiers.js +94 -0
- package/esm/utils/noflip.js +10 -0
- package/esm/utils/registerCSSInterfaceWithDefaultTheme.js +5 -0
- package/esm/utils/registerInterfaceWithDefaultTheme.js +6 -0
- package/esm/utils/toISODateString.js +12 -0
- package/esm/utils/toISOMonthString.js +12 -0
- package/esm/utils/toLocalizedDateString.js +8 -0
- package/esm/utils/toMomentObject.js +7 -0
- package/index.js +2 -0
- package/initialize.js +2 -0
- package/karma.conf.js +82 -0
- package/lib/components/CalendarDay.js +327 -0
- package/lib/components/CalendarIcon.js +18 -0
- package/lib/components/CalendarMonth.js +259 -0
- package/lib/components/CalendarMonthGrid.js +372 -0
- package/lib/components/CalendarWeek.js +18 -0
- package/lib/components/ChevronDown.js +18 -0
- package/lib/components/ChevronUp.js +18 -0
- package/lib/components/CloseButton.js +19 -0
- package/lib/components/CustomizableCalendarDay.js +347 -0
- package/lib/components/DateInput.js +351 -0
- package/lib/components/DateRangePicker.js +653 -0
- package/lib/components/DateRangePickerInput.js +348 -0
- package/lib/components/DateRangePickerInputController.js +354 -0
- package/lib/components/DayPicker.js +1175 -0
- package/lib/components/DayPickerKeyboardShortcuts.js +371 -0
- package/lib/components/DayPickerNavigation.js +321 -0
- package/lib/components/DayPickerRangeController.js +1208 -0
- package/lib/components/DayPickerSingleDateController.js +695 -0
- package/lib/components/KeyboardShortcutRow.js +76 -0
- package/lib/components/LeftArrow.js +18 -0
- package/lib/components/RightArrow.js +18 -0
- package/lib/components/SingleDatePicker.js +611 -0
- package/lib/components/SingleDatePickerInput.js +271 -0
- package/lib/components/SingleDatePickerInputController.js +266 -0
- package/lib/constants.js +34 -0
- package/lib/css/_datepicker.css +886 -0
- package/lib/defaultPhrases.js +231 -0
- package/lib/index.js +146 -0
- package/lib/initialize.js +5 -0
- package/lib/shapes/AnchorDirectionShape.js +10 -0
- package/lib/shapes/CalendarInfoPositionShape.js +10 -0
- package/lib/shapes/DateRangePickerShape.js +108 -0
- package/lib/shapes/DayOfWeekShape.js +10 -0
- package/lib/shapes/DisabledShape.js +10 -0
- package/lib/shapes/FocusedInputShape.js +10 -0
- package/lib/shapes/IconPositionShape.js +10 -0
- package/lib/shapes/ModifiersShape.js +25 -0
- package/lib/shapes/NavPositionShape.js +10 -0
- package/lib/shapes/OpenDirectionShape.js +10 -0
- package/lib/shapes/OrientationShape.js +10 -0
- package/lib/shapes/ScrollableOrientationShape.js +10 -0
- package/lib/shapes/SingleDatePickerShape.js +97 -0
- package/lib/theme/DefaultTheme.js +182 -0
- package/lib/utils/calculateDimension.js +34 -0
- package/lib/utils/disableScroll.js +75 -0
- package/lib/utils/getActiveElement.js +9 -0
- package/lib/utils/getCalendarDaySettings.js +55 -0
- package/lib/utils/getCalendarMonthWeeks.js +44 -0
- package/lib/utils/getCalendarMonthWidth.js +10 -0
- package/lib/utils/getDetachedContainerStyles.js +41 -0
- package/lib/utils/getInputHeight.js +48 -0
- package/lib/utils/getNumberOfCalendarMonthWeeks.js +18 -0
- package/lib/utils/getPhrase.js +13 -0
- package/lib/utils/getPhrasePropTypes.js +16 -0
- package/lib/utils/getPooledMoment.js +15 -0
- package/lib/utils/getPreviousMonthMemoLast.js +15 -0
- package/lib/utils/getResponsiveContainerStyles.js +15 -0
- package/lib/utils/getSelectedDateOffset.js +14 -0
- package/lib/utils/getTransformStyles.js +14 -0
- package/lib/utils/getVisibleDays.js +49 -0
- package/lib/utils/isAfterDay.js +14 -0
- package/lib/utils/isBeforeDay.js +20 -0
- package/lib/utils/isDayVisible.js +45 -0
- package/lib/utils/isInclusivelyAfterDay.js +13 -0
- package/lib/utils/isInclusivelyBeforeDay.js +13 -0
- package/lib/utils/isNextDay.js +14 -0
- package/lib/utils/isNextMonth.js +13 -0
- package/lib/utils/isPrevMonth.js +13 -0
- package/lib/utils/isPreviousDay.js +14 -0
- package/lib/utils/isSameDay.js +14 -0
- package/lib/utils/isSameMonth.js +14 -0
- package/lib/utils/isTransitionEndSupported.js +9 -0
- package/lib/utils/modifiers.js +102 -0
- package/lib/utils/noflip.js +16 -0
- package/lib/utils/registerCSSInterfaceWithDefaultTheme.js +12 -0
- package/lib/utils/registerInterfaceWithDefaultTheme.js +13 -0
- package/lib/utils/toISODateString.js +19 -0
- package/lib/utils/toISOMonthString.js +19 -0
- package/lib/utils/toLocalizedDateString.js +15 -0
- package/lib/utils/toMomentObject.js +14 -0
- package/package.json +141 -4
- package/scripts/.eslintrc +7 -0
- package/scripts/buildCSS.js +37 -0
- package/scripts/pure-component-fallback.js +70 -0
- package/scripts/renderAllComponents.jsx +25 -0
- package/src/components/CalendarDay.jsx +366 -0
- package/src/components/CalendarIcon.jsx +3 -0
- package/src/components/CalendarMonth.jsx +300 -0
- package/src/components/CalendarMonthGrid.jsx +427 -0
- package/src/components/CalendarWeek.jsx +17 -0
- package/src/components/ChevronDown.jsx +3 -0
- package/src/components/ChevronUp.jsx +3 -0
- package/src/components/CloseButton.jsx +3 -0
- package/src/components/CustomizableCalendarDay.jsx +382 -0
- package/src/components/DateInput.jsx +401 -0
- package/src/components/DateRangePicker.jsx +777 -0
- package/src/components/DateRangePickerInput.jsx +434 -0
- package/src/components/DateRangePickerInputController.jsx +379 -0
- package/src/components/DayPicker.jsx +1407 -0
- package/src/components/DayPickerKeyboardShortcuts.jsx +443 -0
- package/src/components/DayPickerNavigation.jsx +445 -0
- package/src/components/DayPickerRangeController.jsx +1409 -0
- package/src/components/DayPickerSingleDateController.jsx +769 -0
- package/src/components/KeyboardShortcutRow.jsx +93 -0
- package/src/components/LeftArrow.jsx +3 -0
- package/src/components/RightArrow.jsx +3 -0
- package/src/components/SingleDatePicker.jsx +731 -0
- package/src/components/SingleDatePickerInput.jsx +329 -0
- package/src/components/SingleDatePickerInputController.jsx +280 -0
- package/src/constants.js +37 -0
- package/src/defaultPhrases.js +215 -0
- package/src/index.js +20 -0
- package/src/initialize.js +3 -0
- package/src/shapes/AnchorDirectionShape.js +8 -0
- package/src/shapes/CalendarInfoPositionShape.js +15 -0
- package/src/shapes/DateRangePickerShape.js +111 -0
- package/src/shapes/DayOfWeekShape.js +5 -0
- package/src/shapes/DisabledShape.js +5 -0
- package/src/shapes/FocusedInputShape.js +8 -0
- package/src/shapes/IconPositionShape.js +8 -0
- package/src/shapes/ModifiersShape.js +20 -0
- package/src/shapes/NavPositionShape.js +8 -0
- package/src/shapes/OpenDirectionShape.js +8 -0
- package/src/shapes/OrientationShape.js +8 -0
- package/src/shapes/ScrollableOrientationShape.js +13 -0
- package/src/shapes/SingleDatePickerShape.js +100 -0
- package/src/svg/arrow-left.svg +1 -0
- package/src/svg/arrow-right.svg +1 -0
- package/src/svg/calendar.svg +1 -0
- package/src/svg/chevron-down.svg +1 -0
- package/src/svg/chevron-up.svg +1 -0
- package/src/svg/close.svg +1 -0
- package/src/theme/DefaultTheme.js +196 -0
- package/src/utils/calculateDimension.js +32 -0
- package/src/utils/disableScroll.js +65 -0
- package/src/utils/getActiveElement.js +3 -0
- package/src/utils/getCalendarDaySettings.js +61 -0
- package/src/utils/getCalendarMonthWeeks.js +49 -0
- package/src/utils/getCalendarMonthWidth.js +3 -0
- package/src/utils/getDetachedContainerStyles.js +39 -0
- package/src/utils/getInputHeight.js +67 -0
- package/src/utils/getNumberOfCalendarMonthWeeks.js +15 -0
- package/src/utils/getPhrase.jsx +9 -0
- package/src/utils/getPhrasePropTypes.js +9 -0
- package/src/utils/getPooledMoment.js +10 -0
- package/src/utils/getPreviousMonthMemoLast.js +11 -0
- package/src/utils/getResponsiveContainerStyles.js +18 -0
- package/src/utils/getSelectedDateOffset.js +6 -0
- package/src/utils/getTransformStyles.js +8 -0
- package/src/utils/getVisibleDays.js +54 -0
- package/src/utils/isAfterDay.js +9 -0
- package/src/utils/isBeforeDay.js +18 -0
- package/src/utils/isDayVisible.js +57 -0
- package/src/utils/isInclusivelyAfterDay.js +8 -0
- package/src/utils/isInclusivelyBeforeDay.js +8 -0
- package/src/utils/isNextDay.js +9 -0
- package/src/utils/isNextMonth.js +8 -0
- package/src/utils/isPrevMonth.js +8 -0
- package/src/utils/isPreviousDay.js +9 -0
- package/src/utils/isSameDay.js +10 -0
- package/src/utils/isSameMonth.js +9 -0
- package/src/utils/isTransitionEndSupported.js +3 -0
- package/src/utils/modifiers.js +116 -0
- package/src/utils/noflip.js +11 -0
- package/src/utils/registerCSSInterfaceWithDefaultTheme.js +7 -0
- package/src/utils/registerInterfaceWithDefaultTheme.js +7 -0
- package/src/utils/toISODateString.js +14 -0
- package/src/utils/toISOMonthString.js +14 -0
- package/src/utils/toLocalizedDateString.js +12 -0
- package/src/utils/toMomentObject.js +12 -0
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
import shallowEqual from "enzyme-shallow-equal";
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import moment from 'moment';
|
|
9
|
+
import { withStyles, withStylesPropTypes } from 'react-with-styles';
|
|
10
|
+
import { Portal } from 'react-portal';
|
|
11
|
+
import { forbidExtraProps } from 'airbnb-prop-types';
|
|
12
|
+
import { addEventListener } from 'consolidated-events';
|
|
13
|
+
import isTouchDevice from 'is-touch-device';
|
|
14
|
+
import OutsideClickHandler from 'react-outside-click-handler';
|
|
15
|
+
import { darken } from 'color2k';
|
|
16
|
+
import SingleDatePickerShape from '../shapes/SingleDatePickerShape';
|
|
17
|
+
import { SingleDatePickerPhrases } from '../defaultPhrases';
|
|
18
|
+
import getResponsiveContainerStyles from '../utils/getResponsiveContainerStyles';
|
|
19
|
+
import getDetachedContainerStyles from '../utils/getDetachedContainerStyles';
|
|
20
|
+
import getInputHeight from '../utils/getInputHeight';
|
|
21
|
+
import isInclusivelyAfterDay from '../utils/isInclusivelyAfterDay';
|
|
22
|
+
import _disableScroll from '../utils/disableScroll';
|
|
23
|
+
import noflip from '../utils/noflip';
|
|
24
|
+
import SingleDatePickerInputController from './SingleDatePickerInputController';
|
|
25
|
+
import DayPickerSingleDateController from './DayPickerSingleDateController';
|
|
26
|
+
import CloseButton from './CloseButton';
|
|
27
|
+
import { HORIZONTAL_ORIENTATION, VERTICAL_ORIENTATION, ANCHOR_LEFT, ANCHOR_RIGHT, OPEN_DOWN, OPEN_UP, DAY_SIZE, ICON_BEFORE_POSITION, INFO_POSITION_BOTTOM, FANG_HEIGHT_PX, DEFAULT_VERTICAL_SPACING, NAV_POSITION_TOP } from '../constants';
|
|
28
|
+
var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectSpread(_objectSpread({}, withStylesPropTypes), SingleDatePickerShape)) : {};
|
|
29
|
+
var defaultProps = {
|
|
30
|
+
// required props for a functional interactive SingleDatePicker
|
|
31
|
+
date: null,
|
|
32
|
+
focused: false,
|
|
33
|
+
minDate: null,
|
|
34
|
+
maxDate: null,
|
|
35
|
+
// input related props
|
|
36
|
+
id: 'date',
|
|
37
|
+
placeholder: 'Date',
|
|
38
|
+
ariaLabel: undefined,
|
|
39
|
+
autoComplete: 'off',
|
|
40
|
+
titleText: undefined,
|
|
41
|
+
disabled: false,
|
|
42
|
+
required: false,
|
|
43
|
+
readOnly: false,
|
|
44
|
+
screenReaderInputMessage: '',
|
|
45
|
+
showClearDate: false,
|
|
46
|
+
showDefaultInputIcon: false,
|
|
47
|
+
inputIconPosition: ICON_BEFORE_POSITION,
|
|
48
|
+
customInputIcon: null,
|
|
49
|
+
customCloseIcon: null,
|
|
50
|
+
noBorder: false,
|
|
51
|
+
block: false,
|
|
52
|
+
small: false,
|
|
53
|
+
regular: false,
|
|
54
|
+
verticalSpacing: DEFAULT_VERTICAL_SPACING,
|
|
55
|
+
keepFocusOnInput: false,
|
|
56
|
+
// calendar presentation and interaction related props
|
|
57
|
+
orientation: HORIZONTAL_ORIENTATION,
|
|
58
|
+
anchorDirection: ANCHOR_LEFT,
|
|
59
|
+
openDirection: OPEN_DOWN,
|
|
60
|
+
horizontalMargin: 0,
|
|
61
|
+
withPortal: false,
|
|
62
|
+
withFullScreenPortal: false,
|
|
63
|
+
appendToBody: false,
|
|
64
|
+
disableScroll: false,
|
|
65
|
+
initialVisibleMonth: null,
|
|
66
|
+
firstDayOfWeek: null,
|
|
67
|
+
numberOfMonths: 2,
|
|
68
|
+
keepOpenOnDateSelect: false,
|
|
69
|
+
reopenPickerOnClearDate: false,
|
|
70
|
+
renderCalendarInfo: null,
|
|
71
|
+
calendarInfoPosition: INFO_POSITION_BOTTOM,
|
|
72
|
+
hideKeyboardShortcutsPanel: false,
|
|
73
|
+
daySize: DAY_SIZE,
|
|
74
|
+
isRTL: false,
|
|
75
|
+
verticalHeight: null,
|
|
76
|
+
transitionDuration: undefined,
|
|
77
|
+
horizontalMonthPadding: 13,
|
|
78
|
+
// navigation related props
|
|
79
|
+
dayPickerNavigationInlineStyles: null,
|
|
80
|
+
navPosition: NAV_POSITION_TOP,
|
|
81
|
+
navPrev: null,
|
|
82
|
+
navNext: null,
|
|
83
|
+
renderNavPrevButton: null,
|
|
84
|
+
renderNavNextButton: null,
|
|
85
|
+
onPrevMonthClick: function onPrevMonthClick() {},
|
|
86
|
+
onNextMonthClick: function onNextMonthClick() {},
|
|
87
|
+
onClose: function onClose() {},
|
|
88
|
+
// month presentation and interaction related props
|
|
89
|
+
renderMonthText: null,
|
|
90
|
+
renderWeekHeaderElement: null,
|
|
91
|
+
// day presentation and interaction related props
|
|
92
|
+
renderCalendarDay: undefined,
|
|
93
|
+
renderDayContents: null,
|
|
94
|
+
renderMonthElement: null,
|
|
95
|
+
enableOutsideDays: false,
|
|
96
|
+
isDayBlocked: function isDayBlocked() {
|
|
97
|
+
return false;
|
|
98
|
+
},
|
|
99
|
+
isOutsideRange: function isOutsideRange(day) {
|
|
100
|
+
return !isInclusivelyAfterDay(day, moment());
|
|
101
|
+
},
|
|
102
|
+
isDayHighlighted: function isDayHighlighted() {},
|
|
103
|
+
// internationalization props
|
|
104
|
+
displayFormat: function displayFormat() {
|
|
105
|
+
return moment.localeData().longDateFormat('L');
|
|
106
|
+
},
|
|
107
|
+
monthFormat: 'MMMM YYYY',
|
|
108
|
+
weekDayFormat: 'dd',
|
|
109
|
+
phrases: SingleDatePickerPhrases,
|
|
110
|
+
dayAriaLabelFormat: undefined
|
|
111
|
+
};
|
|
112
|
+
var SingleDatePicker = /*#__PURE__*/function (_ref2, _ref) {
|
|
113
|
+
function SingleDatePicker(props) {
|
|
114
|
+
var _this;
|
|
115
|
+
_this = _ref2.call(this, props) || this;
|
|
116
|
+
_this.isTouchDevice = false;
|
|
117
|
+
_this.state = {
|
|
118
|
+
dayPickerContainerStyles: {},
|
|
119
|
+
isDayPickerFocused: false,
|
|
120
|
+
isInputFocused: false,
|
|
121
|
+
showKeyboardShortcuts: false
|
|
122
|
+
};
|
|
123
|
+
_this.onFocusOut = _this.onFocusOut.bind(_this);
|
|
124
|
+
_this.onOutsideClick = _this.onOutsideClick.bind(_this);
|
|
125
|
+
_this.onInputFocus = _this.onInputFocus.bind(_this);
|
|
126
|
+
_this.onDayPickerFocus = _this.onDayPickerFocus.bind(_this);
|
|
127
|
+
_this.onDayPickerBlur = _this.onDayPickerBlur.bind(_this);
|
|
128
|
+
_this.showKeyboardShortcutsPanel = _this.showKeyboardShortcutsPanel.bind(_this);
|
|
129
|
+
_this.responsivizePickerPosition = _this.responsivizePickerPosition.bind(_this);
|
|
130
|
+
_this.disableScroll = _this.disableScroll.bind(_this);
|
|
131
|
+
_this.setDayPickerContainerRef = _this.setDayPickerContainerRef.bind(_this);
|
|
132
|
+
_this.setContainerRef = _this.setContainerRef.bind(_this);
|
|
133
|
+
return _this;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* istanbul ignore next */
|
|
137
|
+
_inheritsLoose(SingleDatePicker, _ref2);
|
|
138
|
+
var _proto = SingleDatePicker.prototype;
|
|
139
|
+
_proto[_ref] = function (nextProps, nextState) {
|
|
140
|
+
return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
|
|
141
|
+
};
|
|
142
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
143
|
+
this.removeResizeEventListener = addEventListener(window, 'resize', this.responsivizePickerPosition, {
|
|
144
|
+
passive: true
|
|
145
|
+
});
|
|
146
|
+
this.responsivizePickerPosition();
|
|
147
|
+
this.disableScroll();
|
|
148
|
+
var focused = this.props.focused;
|
|
149
|
+
if (focused) {
|
|
150
|
+
this.setState({
|
|
151
|
+
isInputFocused: true
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
this.isTouchDevice = isTouchDevice();
|
|
155
|
+
};
|
|
156
|
+
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
157
|
+
var focused = this.props.focused;
|
|
158
|
+
if (!prevProps.focused && focused) {
|
|
159
|
+
this.responsivizePickerPosition();
|
|
160
|
+
this.disableScroll();
|
|
161
|
+
} else if (prevProps.focused && !focused) {
|
|
162
|
+
if (this.enableScroll) this.enableScroll();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* istanbul ignore next */;
|
|
167
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
168
|
+
if (this.removeResizeEventListener) this.removeResizeEventListener();
|
|
169
|
+
if (this.removeFocusOutEventListener) this.removeFocusOutEventListener();
|
|
170
|
+
if (this.enableScroll) this.enableScroll();
|
|
171
|
+
};
|
|
172
|
+
_proto.onOutsideClick = function onOutsideClick(event) {
|
|
173
|
+
var _this$props = this.props,
|
|
174
|
+
focused = _this$props.focused,
|
|
175
|
+
onFocusChange = _this$props.onFocusChange,
|
|
176
|
+
onClose = _this$props.onClose,
|
|
177
|
+
date = _this$props.date,
|
|
178
|
+
appendToBody = _this$props.appendToBody;
|
|
179
|
+
if (!focused) return;
|
|
180
|
+
if (appendToBody && this.dayPickerContainer.contains(event.target)) return;
|
|
181
|
+
this.setState({
|
|
182
|
+
isInputFocused: false,
|
|
183
|
+
isDayPickerFocused: false,
|
|
184
|
+
showKeyboardShortcuts: false
|
|
185
|
+
});
|
|
186
|
+
onFocusChange({
|
|
187
|
+
focused: false
|
|
188
|
+
});
|
|
189
|
+
onClose({
|
|
190
|
+
date: date
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
_proto.onInputFocus = function onInputFocus(_ref3) {
|
|
194
|
+
var focused = _ref3.focused;
|
|
195
|
+
var _this$props2 = this.props,
|
|
196
|
+
onFocusChange = _this$props2.onFocusChange,
|
|
197
|
+
readOnly = _this$props2.readOnly,
|
|
198
|
+
withPortal = _this$props2.withPortal,
|
|
199
|
+
withFullScreenPortal = _this$props2.withFullScreenPortal,
|
|
200
|
+
keepFocusOnInput = _this$props2.keepFocusOnInput;
|
|
201
|
+
if (focused) {
|
|
202
|
+
var withAnyPortal = withPortal || withFullScreenPortal;
|
|
203
|
+
var moveFocusToDayPicker = withAnyPortal || readOnly && !keepFocusOnInput || this.isTouchDevice && !keepFocusOnInput;
|
|
204
|
+
if (moveFocusToDayPicker) {
|
|
205
|
+
this.onDayPickerFocus();
|
|
206
|
+
} else {
|
|
207
|
+
this.onDayPickerBlur();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
onFocusChange({
|
|
211
|
+
focused: focused
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
_proto.onDayPickerFocus = function onDayPickerFocus() {
|
|
215
|
+
this.setState({
|
|
216
|
+
isInputFocused: false,
|
|
217
|
+
isDayPickerFocused: true,
|
|
218
|
+
showKeyboardShortcuts: false
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
_proto.onDayPickerBlur = function onDayPickerBlur() {
|
|
222
|
+
this.setState({
|
|
223
|
+
isInputFocused: true,
|
|
224
|
+
isDayPickerFocused: false,
|
|
225
|
+
showKeyboardShortcuts: false
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
_proto.onFocusOut = function onFocusOut(e) {
|
|
229
|
+
var onFocusChange = this.props.onFocusChange;
|
|
230
|
+
// In cases where **relatedTarget** is not null, it points to the right
|
|
231
|
+
// element here. However, in cases where it is null (such as clicking on a
|
|
232
|
+
// specific day) or it is **document.body** (IE11), the appropriate value is **event.target**.
|
|
233
|
+
//
|
|
234
|
+
// We handle both situations here by using the ` || ` operator to fallback
|
|
235
|
+
// to *event.target** when **relatedTarget** is not provided.
|
|
236
|
+
var relatedTarget = e.relatedTarget === document.body ? e.target : e.relatedTarget || e.target;
|
|
237
|
+
if (this.dayPickerContainer.contains(relatedTarget)) return;
|
|
238
|
+
onFocusChange({
|
|
239
|
+
focused: false
|
|
240
|
+
});
|
|
241
|
+
};
|
|
242
|
+
_proto.setDayPickerContainerRef = function setDayPickerContainerRef(ref) {
|
|
243
|
+
if (ref === this.dayPickerContainer) return;
|
|
244
|
+
this.removeEventListeners();
|
|
245
|
+
this.dayPickerContainer = ref;
|
|
246
|
+
if (!ref) return;
|
|
247
|
+
this.addEventListeners();
|
|
248
|
+
};
|
|
249
|
+
_proto.setContainerRef = function setContainerRef(ref) {
|
|
250
|
+
this.container = ref;
|
|
251
|
+
};
|
|
252
|
+
_proto.addEventListeners = function addEventListeners() {
|
|
253
|
+
// We manually set event because React has not implemented onFocusIn/onFocusOut.
|
|
254
|
+
// Keep an eye on https://github.com/facebook/react/issues/6410 for updates
|
|
255
|
+
// We use "blur w/ useCapture param" vs "onfocusout" for FF browser support
|
|
256
|
+
this.removeFocusOutEventListener = addEventListener(this.dayPickerContainer, 'focusout', this.onFocusOut);
|
|
257
|
+
};
|
|
258
|
+
_proto.removeEventListeners = function removeEventListeners() {
|
|
259
|
+
if (this.removeFocusOutEventListener) this.removeFocusOutEventListener();
|
|
260
|
+
};
|
|
261
|
+
_proto.disableScroll = function disableScroll() {
|
|
262
|
+
var _this$props3 = this.props,
|
|
263
|
+
appendToBody = _this$props3.appendToBody,
|
|
264
|
+
propDisableScroll = _this$props3.disableScroll,
|
|
265
|
+
focused = _this$props3.focused;
|
|
266
|
+
if (!appendToBody && !propDisableScroll) return;
|
|
267
|
+
if (!focused) return;
|
|
268
|
+
|
|
269
|
+
// Disable scroll for every ancestor of this <SingleDatePicker> up to the
|
|
270
|
+
// document level. This ensures the input and the picker never move. Other
|
|
271
|
+
// sibling elements or the picker itself can scroll.
|
|
272
|
+
this.enableScroll = _disableScroll(this.container);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/* istanbul ignore next */;
|
|
276
|
+
_proto.responsivizePickerPosition = function responsivizePickerPosition() {
|
|
277
|
+
// It's possible the portal props have been changed in response to window resizes
|
|
278
|
+
// So let's ensure we reset this back to the base state each time
|
|
279
|
+
this.setState({
|
|
280
|
+
dayPickerContainerStyles: {}
|
|
281
|
+
});
|
|
282
|
+
var _this$props4 = this.props,
|
|
283
|
+
openDirection = _this$props4.openDirection,
|
|
284
|
+
anchorDirection = _this$props4.anchorDirection,
|
|
285
|
+
horizontalMargin = _this$props4.horizontalMargin,
|
|
286
|
+
withPortal = _this$props4.withPortal,
|
|
287
|
+
withFullScreenPortal = _this$props4.withFullScreenPortal,
|
|
288
|
+
appendToBody = _this$props4.appendToBody,
|
|
289
|
+
focused = _this$props4.focused;
|
|
290
|
+
var dayPickerContainerStyles = this.state.dayPickerContainerStyles;
|
|
291
|
+
if (!focused) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
var isAnchoredLeft = anchorDirection === ANCHOR_LEFT;
|
|
295
|
+
if (!withPortal && !withFullScreenPortal) {
|
|
296
|
+
var containerRect = this.dayPickerContainer.getBoundingClientRect();
|
|
297
|
+
var currentOffset = dayPickerContainerStyles[anchorDirection] || 0;
|
|
298
|
+
var containerEdge = isAnchoredLeft ? containerRect[ANCHOR_RIGHT] : containerRect[ANCHOR_LEFT];
|
|
299
|
+
this.setState({
|
|
300
|
+
dayPickerContainerStyles: _objectSpread(_objectSpread({}, getResponsiveContainerStyles(anchorDirection, currentOffset, containerEdge, horizontalMargin)), appendToBody && getDetachedContainerStyles(openDirection, anchorDirection, this.container))
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
_proto.showKeyboardShortcutsPanel = function showKeyboardShortcutsPanel() {
|
|
305
|
+
this.setState({
|
|
306
|
+
isInputFocused: false,
|
|
307
|
+
isDayPickerFocused: true,
|
|
308
|
+
showKeyboardShortcuts: true
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
_proto.maybeRenderDayPickerWithPortal = function maybeRenderDayPickerWithPortal() {
|
|
312
|
+
var _this$props5 = this.props,
|
|
313
|
+
focused = _this$props5.focused,
|
|
314
|
+
withPortal = _this$props5.withPortal,
|
|
315
|
+
withFullScreenPortal = _this$props5.withFullScreenPortal,
|
|
316
|
+
appendToBody = _this$props5.appendToBody;
|
|
317
|
+
if (!focused) {
|
|
318
|
+
return null;
|
|
319
|
+
}
|
|
320
|
+
if (withPortal || withFullScreenPortal || appendToBody) {
|
|
321
|
+
return /*#__PURE__*/React.createElement(Portal, null, this.renderDayPicker());
|
|
322
|
+
}
|
|
323
|
+
return this.renderDayPicker();
|
|
324
|
+
};
|
|
325
|
+
_proto.renderDayPicker = function renderDayPicker() {
|
|
326
|
+
var _this$props6 = this.props,
|
|
327
|
+
anchorDirection = _this$props6.anchorDirection,
|
|
328
|
+
openDirection = _this$props6.openDirection,
|
|
329
|
+
onDateChange = _this$props6.onDateChange,
|
|
330
|
+
date = _this$props6.date,
|
|
331
|
+
minDate = _this$props6.minDate,
|
|
332
|
+
maxDate = _this$props6.maxDate,
|
|
333
|
+
onFocusChange = _this$props6.onFocusChange,
|
|
334
|
+
focused = _this$props6.focused,
|
|
335
|
+
enableOutsideDays = _this$props6.enableOutsideDays,
|
|
336
|
+
numberOfMonths = _this$props6.numberOfMonths,
|
|
337
|
+
orientation = _this$props6.orientation,
|
|
338
|
+
monthFormat = _this$props6.monthFormat,
|
|
339
|
+
dayPickerNavigationInlineStyles = _this$props6.dayPickerNavigationInlineStyles,
|
|
340
|
+
navPosition = _this$props6.navPosition,
|
|
341
|
+
navPrev = _this$props6.navPrev,
|
|
342
|
+
navNext = _this$props6.navNext,
|
|
343
|
+
renderNavPrevButton = _this$props6.renderNavPrevButton,
|
|
344
|
+
renderNavNextButton = _this$props6.renderNavNextButton,
|
|
345
|
+
onPrevMonthClick = _this$props6.onPrevMonthClick,
|
|
346
|
+
onNextMonthClick = _this$props6.onNextMonthClick,
|
|
347
|
+
onClose = _this$props6.onClose,
|
|
348
|
+
withPortal = _this$props6.withPortal,
|
|
349
|
+
withFullScreenPortal = _this$props6.withFullScreenPortal,
|
|
350
|
+
keepOpenOnDateSelect = _this$props6.keepOpenOnDateSelect,
|
|
351
|
+
initialVisibleMonth = _this$props6.initialVisibleMonth,
|
|
352
|
+
renderMonthText = _this$props6.renderMonthText,
|
|
353
|
+
renderWeekHeaderElement = _this$props6.renderWeekHeaderElement,
|
|
354
|
+
renderCalendarDay = _this$props6.renderCalendarDay,
|
|
355
|
+
renderDayContents = _this$props6.renderDayContents,
|
|
356
|
+
renderCalendarInfo = _this$props6.renderCalendarInfo,
|
|
357
|
+
renderMonthElement = _this$props6.renderMonthElement,
|
|
358
|
+
calendarInfoPosition = _this$props6.calendarInfoPosition,
|
|
359
|
+
hideKeyboardShortcutsPanel = _this$props6.hideKeyboardShortcutsPanel,
|
|
360
|
+
firstDayOfWeek = _this$props6.firstDayOfWeek,
|
|
361
|
+
customCloseIcon = _this$props6.customCloseIcon,
|
|
362
|
+
phrases = _this$props6.phrases,
|
|
363
|
+
dayAriaLabelFormat = _this$props6.dayAriaLabelFormat,
|
|
364
|
+
daySize = _this$props6.daySize,
|
|
365
|
+
isRTL = _this$props6.isRTL,
|
|
366
|
+
isOutsideRange = _this$props6.isOutsideRange,
|
|
367
|
+
isDayBlocked = _this$props6.isDayBlocked,
|
|
368
|
+
isDayHighlighted = _this$props6.isDayHighlighted,
|
|
369
|
+
weekDayFormat = _this$props6.weekDayFormat,
|
|
370
|
+
css = _this$props6.css,
|
|
371
|
+
styles = _this$props6.styles,
|
|
372
|
+
verticalHeight = _this$props6.verticalHeight,
|
|
373
|
+
transitionDuration = _this$props6.transitionDuration,
|
|
374
|
+
verticalSpacing = _this$props6.verticalSpacing,
|
|
375
|
+
horizontalMonthPadding = _this$props6.horizontalMonthPadding,
|
|
376
|
+
small = _this$props6.small,
|
|
377
|
+
reactDates = _this$props6.theme.reactDates;
|
|
378
|
+
var _this$state = this.state,
|
|
379
|
+
dayPickerContainerStyles = _this$state.dayPickerContainerStyles,
|
|
380
|
+
isDayPickerFocused = _this$state.isDayPickerFocused,
|
|
381
|
+
showKeyboardShortcuts = _this$state.showKeyboardShortcuts;
|
|
382
|
+
var onOutsideClick = !withFullScreenPortal && withPortal ? this.onOutsideClick : undefined;
|
|
383
|
+
var closeIcon = customCloseIcon || /*#__PURE__*/React.createElement(CloseButton, null);
|
|
384
|
+
var inputHeight = getInputHeight(reactDates, small);
|
|
385
|
+
var withAnyPortal = withPortal || withFullScreenPortal;
|
|
386
|
+
|
|
387
|
+
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
388
|
+
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
389
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
390
|
+
ref: this.setDayPickerContainerRef
|
|
391
|
+
}, css(styles.SingleDatePicker_picker, anchorDirection === ANCHOR_LEFT && styles.SingleDatePicker_picker__directionLeft, anchorDirection === ANCHOR_RIGHT && styles.SingleDatePicker_picker__directionRight, openDirection === OPEN_DOWN && styles.SingleDatePicker_picker__openDown, openDirection === OPEN_UP && styles.SingleDatePicker_picker__openUp, !withAnyPortal && openDirection === OPEN_DOWN && {
|
|
392
|
+
top: inputHeight + verticalSpacing
|
|
393
|
+
}, !withAnyPortal && openDirection === OPEN_UP && {
|
|
394
|
+
bottom: inputHeight + verticalSpacing
|
|
395
|
+
}, orientation === HORIZONTAL_ORIENTATION && styles.SingleDatePicker_picker__horizontal, orientation === VERTICAL_ORIENTATION && styles.SingleDatePicker_picker__vertical, withAnyPortal && styles.SingleDatePicker_picker__portal, withFullScreenPortal && styles.SingleDatePicker_picker__fullScreenPortal, isRTL && styles.SingleDatePicker_picker__rtl, dayPickerContainerStyles), {
|
|
396
|
+
onClick: onOutsideClick
|
|
397
|
+
}), /*#__PURE__*/React.createElement(DayPickerSingleDateController, {
|
|
398
|
+
date: date,
|
|
399
|
+
minDate: minDate,
|
|
400
|
+
maxDate: maxDate,
|
|
401
|
+
onDateChange: onDateChange,
|
|
402
|
+
onFocusChange: onFocusChange,
|
|
403
|
+
orientation: orientation,
|
|
404
|
+
enableOutsideDays: enableOutsideDays,
|
|
405
|
+
numberOfMonths: numberOfMonths,
|
|
406
|
+
monthFormat: monthFormat,
|
|
407
|
+
withPortal: withAnyPortal,
|
|
408
|
+
focused: focused,
|
|
409
|
+
keepOpenOnDateSelect: keepOpenOnDateSelect,
|
|
410
|
+
hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
|
|
411
|
+
initialVisibleMonth: initialVisibleMonth,
|
|
412
|
+
dayPickerNavigationInlineStyles: dayPickerNavigationInlineStyles,
|
|
413
|
+
navPosition: navPosition,
|
|
414
|
+
navPrev: navPrev,
|
|
415
|
+
navNext: navNext,
|
|
416
|
+
renderNavPrevButton: renderNavPrevButton,
|
|
417
|
+
renderNavNextButton: renderNavNextButton,
|
|
418
|
+
onPrevMonthClick: onPrevMonthClick,
|
|
419
|
+
onNextMonthClick: onNextMonthClick,
|
|
420
|
+
onClose: onClose,
|
|
421
|
+
renderMonthText: renderMonthText,
|
|
422
|
+
renderWeekHeaderElement: renderWeekHeaderElement,
|
|
423
|
+
renderCalendarDay: renderCalendarDay,
|
|
424
|
+
renderDayContents: renderDayContents,
|
|
425
|
+
renderCalendarInfo: renderCalendarInfo,
|
|
426
|
+
renderMonthElement: renderMonthElement,
|
|
427
|
+
calendarInfoPosition: calendarInfoPosition,
|
|
428
|
+
isFocused: isDayPickerFocused,
|
|
429
|
+
showKeyboardShortcuts: showKeyboardShortcuts,
|
|
430
|
+
onBlur: this.onDayPickerBlur,
|
|
431
|
+
phrases: phrases,
|
|
432
|
+
dayAriaLabelFormat: dayAriaLabelFormat,
|
|
433
|
+
daySize: daySize,
|
|
434
|
+
isRTL: isRTL,
|
|
435
|
+
isOutsideRange: isOutsideRange,
|
|
436
|
+
isDayBlocked: isDayBlocked,
|
|
437
|
+
isDayHighlighted: isDayHighlighted,
|
|
438
|
+
firstDayOfWeek: firstDayOfWeek,
|
|
439
|
+
weekDayFormat: weekDayFormat,
|
|
440
|
+
verticalHeight: verticalHeight,
|
|
441
|
+
transitionDuration: transitionDuration,
|
|
442
|
+
horizontalMonthPadding: horizontalMonthPadding
|
|
443
|
+
}), withFullScreenPortal && /*#__PURE__*/React.createElement("button", _extends({}, css(styles.SingleDatePicker_closeButton), {
|
|
444
|
+
"aria-label": phrases.closeDatePicker,
|
|
445
|
+
type: "button",
|
|
446
|
+
onClick: this.onOutsideClick
|
|
447
|
+
}), /*#__PURE__*/React.createElement("div", css(styles.SingleDatePicker_closeButton_svg), closeIcon)));
|
|
448
|
+
/* eslint-enable jsx-a11y/no-static-element-interactions */
|
|
449
|
+
/* eslint-enable jsx-a11y/click-events-have-key-events */
|
|
450
|
+
};
|
|
451
|
+
_proto.render = function render() {
|
|
452
|
+
var _this$props7 = this.props,
|
|
453
|
+
id = _this$props7.id,
|
|
454
|
+
placeholder = _this$props7.placeholder,
|
|
455
|
+
ariaLabel = _this$props7.ariaLabel,
|
|
456
|
+
autoComplete = _this$props7.autoComplete,
|
|
457
|
+
titleText = _this$props7.titleText,
|
|
458
|
+
disabled = _this$props7.disabled,
|
|
459
|
+
focused = _this$props7.focused,
|
|
460
|
+
required = _this$props7.required,
|
|
461
|
+
readOnly = _this$props7.readOnly,
|
|
462
|
+
openDirection = _this$props7.openDirection,
|
|
463
|
+
showClearDate = _this$props7.showClearDate,
|
|
464
|
+
showDefaultInputIcon = _this$props7.showDefaultInputIcon,
|
|
465
|
+
inputIconPosition = _this$props7.inputIconPosition,
|
|
466
|
+
customCloseIcon = _this$props7.customCloseIcon,
|
|
467
|
+
customInputIcon = _this$props7.customInputIcon,
|
|
468
|
+
date = _this$props7.date,
|
|
469
|
+
onDateChange = _this$props7.onDateChange,
|
|
470
|
+
displayFormat = _this$props7.displayFormat,
|
|
471
|
+
phrases = _this$props7.phrases,
|
|
472
|
+
withPortal = _this$props7.withPortal,
|
|
473
|
+
withFullScreenPortal = _this$props7.withFullScreenPortal,
|
|
474
|
+
screenReaderInputMessage = _this$props7.screenReaderInputMessage,
|
|
475
|
+
isRTL = _this$props7.isRTL,
|
|
476
|
+
noBorder = _this$props7.noBorder,
|
|
477
|
+
block = _this$props7.block,
|
|
478
|
+
small = _this$props7.small,
|
|
479
|
+
regular = _this$props7.regular,
|
|
480
|
+
verticalSpacing = _this$props7.verticalSpacing,
|
|
481
|
+
reopenPickerOnClearDate = _this$props7.reopenPickerOnClearDate,
|
|
482
|
+
keepOpenOnDateSelect = _this$props7.keepOpenOnDateSelect,
|
|
483
|
+
css = _this$props7.css,
|
|
484
|
+
styles = _this$props7.styles,
|
|
485
|
+
isOutsideRange = _this$props7.isOutsideRange,
|
|
486
|
+
isDayBlocked = _this$props7.isDayBlocked;
|
|
487
|
+
var isInputFocused = this.state.isInputFocused;
|
|
488
|
+
var enableOutsideClick = !withPortal && !withFullScreenPortal;
|
|
489
|
+
var hideFang = verticalSpacing < FANG_HEIGHT_PX;
|
|
490
|
+
var input = /*#__PURE__*/React.createElement(SingleDatePickerInputController, {
|
|
491
|
+
id: id,
|
|
492
|
+
placeholder: placeholder,
|
|
493
|
+
ariaLabel: ariaLabel,
|
|
494
|
+
autoComplete: autoComplete,
|
|
495
|
+
titleText: titleText,
|
|
496
|
+
focused: focused,
|
|
497
|
+
isFocused: isInputFocused,
|
|
498
|
+
disabled: disabled,
|
|
499
|
+
required: required,
|
|
500
|
+
readOnly: readOnly,
|
|
501
|
+
openDirection: openDirection,
|
|
502
|
+
showCaret: !withPortal && !withFullScreenPortal && !hideFang,
|
|
503
|
+
showClearDate: showClearDate,
|
|
504
|
+
showDefaultInputIcon: showDefaultInputIcon,
|
|
505
|
+
inputIconPosition: inputIconPosition,
|
|
506
|
+
isOutsideRange: isOutsideRange,
|
|
507
|
+
isDayBlocked: isDayBlocked,
|
|
508
|
+
customCloseIcon: customCloseIcon,
|
|
509
|
+
customInputIcon: customInputIcon,
|
|
510
|
+
date: date,
|
|
511
|
+
onDateChange: onDateChange,
|
|
512
|
+
displayFormat: displayFormat,
|
|
513
|
+
onFocusChange: this.onInputFocus,
|
|
514
|
+
onKeyDownArrowDown: this.onDayPickerFocus,
|
|
515
|
+
onKeyDownQuestionMark: this.showKeyboardShortcutsPanel,
|
|
516
|
+
screenReaderMessage: screenReaderInputMessage,
|
|
517
|
+
phrases: phrases,
|
|
518
|
+
isRTL: isRTL,
|
|
519
|
+
noBorder: noBorder,
|
|
520
|
+
block: block,
|
|
521
|
+
small: small,
|
|
522
|
+
regular: regular,
|
|
523
|
+
verticalSpacing: verticalSpacing,
|
|
524
|
+
reopenPickerOnClearDate: reopenPickerOnClearDate,
|
|
525
|
+
keepOpenOnDateSelect: keepOpenOnDateSelect
|
|
526
|
+
}, this.maybeRenderDayPickerWithPortal());
|
|
527
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
528
|
+
ref: this.setContainerRef
|
|
529
|
+
}, css(styles.SingleDatePicker, block && styles.SingleDatePicker__block)), enableOutsideClick && /*#__PURE__*/React.createElement(OutsideClickHandler, {
|
|
530
|
+
onOutsideClick: this.onOutsideClick
|
|
531
|
+
}, input), enableOutsideClick || input);
|
|
532
|
+
};
|
|
533
|
+
return SingleDatePicker;
|
|
534
|
+
}(React.PureComponent || React.Component, !React.PureComponent && "shouldComponentUpdate");
|
|
535
|
+
SingleDatePicker.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
|
536
|
+
SingleDatePicker.defaultProps = defaultProps;
|
|
537
|
+
export { SingleDatePicker as PureSingleDatePicker };
|
|
538
|
+
export default withStyles(function (_ref4) {
|
|
539
|
+
var _ref4$reactDates = _ref4.reactDates,
|
|
540
|
+
color = _ref4$reactDates.color,
|
|
541
|
+
zIndex = _ref4$reactDates.zIndex;
|
|
542
|
+
return {
|
|
543
|
+
SingleDatePicker: {
|
|
544
|
+
position: 'relative',
|
|
545
|
+
display: 'inline-block'
|
|
546
|
+
},
|
|
547
|
+
SingleDatePicker__block: {
|
|
548
|
+
display: 'block'
|
|
549
|
+
},
|
|
550
|
+
SingleDatePicker_picker: {
|
|
551
|
+
zIndex: zIndex + 1,
|
|
552
|
+
backgroundColor: color.background,
|
|
553
|
+
position: 'absolute'
|
|
554
|
+
},
|
|
555
|
+
SingleDatePicker_picker__rtl: {
|
|
556
|
+
direction: noflip('rtl')
|
|
557
|
+
},
|
|
558
|
+
SingleDatePicker_picker__directionLeft: {
|
|
559
|
+
left: noflip(0)
|
|
560
|
+
},
|
|
561
|
+
SingleDatePicker_picker__directionRight: {
|
|
562
|
+
right: noflip(0)
|
|
563
|
+
},
|
|
564
|
+
SingleDatePicker_picker__portal: {
|
|
565
|
+
backgroundColor: 'rgba(0, 0, 0, 0.3)',
|
|
566
|
+
position: 'fixed',
|
|
567
|
+
top: 0,
|
|
568
|
+
left: noflip(0),
|
|
569
|
+
height: '100%',
|
|
570
|
+
width: '100%'
|
|
571
|
+
},
|
|
572
|
+
SingleDatePicker_picker__fullScreenPortal: {
|
|
573
|
+
backgroundColor: color.background
|
|
574
|
+
},
|
|
575
|
+
SingleDatePicker_closeButton: {
|
|
576
|
+
background: 'none',
|
|
577
|
+
border: 0,
|
|
578
|
+
color: 'inherit',
|
|
579
|
+
font: 'inherit',
|
|
580
|
+
lineHeight: 'normal',
|
|
581
|
+
overflow: 'visible',
|
|
582
|
+
cursor: 'pointer',
|
|
583
|
+
position: 'absolute',
|
|
584
|
+
top: 0,
|
|
585
|
+
right: noflip(0),
|
|
586
|
+
padding: 15,
|
|
587
|
+
zIndex: zIndex + 2,
|
|
588
|
+
':hover': {
|
|
589
|
+
color: darken(color.core.grayLighter, 0.1),
|
|
590
|
+
textDecoration: 'none'
|
|
591
|
+
},
|
|
592
|
+
':focus': {
|
|
593
|
+
color: darken(color.core.grayLighter, 0.1),
|
|
594
|
+
textDecoration: 'none'
|
|
595
|
+
}
|
|
596
|
+
},
|
|
597
|
+
SingleDatePicker_closeButton_svg: {
|
|
598
|
+
height: 15,
|
|
599
|
+
width: 15,
|
|
600
|
+
fill: color.core.grayLighter
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
}, {
|
|
604
|
+
pureComponent: typeof React.PureComponent !== 'undefined'
|
|
605
|
+
})(SingleDatePicker);
|