@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,445 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { forbidExtraProps } from 'airbnb-prop-types';
|
|
4
|
+
import { withStyles, withStylesPropTypes } from 'react-with-styles';
|
|
5
|
+
|
|
6
|
+
import { DayPickerNavigationPhrases } from '../defaultPhrases';
|
|
7
|
+
import getPhrasePropTypes from '../utils/getPhrasePropTypes';
|
|
8
|
+
import noflip from '../utils/noflip';
|
|
9
|
+
|
|
10
|
+
import LeftArrow from './LeftArrow';
|
|
11
|
+
import RightArrow from './RightArrow';
|
|
12
|
+
import ChevronUp from './ChevronUp';
|
|
13
|
+
import ChevronDown from './ChevronDown';
|
|
14
|
+
import NavPositionShape from '../shapes/NavPositionShape';
|
|
15
|
+
import ScrollableOrientationShape from '../shapes/ScrollableOrientationShape';
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
HORIZONTAL_ORIENTATION,
|
|
19
|
+
NAV_POSITION_BOTTOM,
|
|
20
|
+
NAV_POSITION_TOP,
|
|
21
|
+
VERTICAL_SCROLLABLE,
|
|
22
|
+
} from '../constants';
|
|
23
|
+
|
|
24
|
+
const propTypes = forbidExtraProps({
|
|
25
|
+
...withStylesPropTypes,
|
|
26
|
+
disablePrev: PropTypes.bool,
|
|
27
|
+
disableNext: PropTypes.bool,
|
|
28
|
+
inlineStyles: PropTypes.object,
|
|
29
|
+
isRTL: PropTypes.bool,
|
|
30
|
+
navPosition: NavPositionShape,
|
|
31
|
+
navPrev: PropTypes.node,
|
|
32
|
+
navNext: PropTypes.node,
|
|
33
|
+
orientation: ScrollableOrientationShape,
|
|
34
|
+
|
|
35
|
+
onPrevMonthClick: PropTypes.func,
|
|
36
|
+
onNextMonthClick: PropTypes.func,
|
|
37
|
+
|
|
38
|
+
// internationalization
|
|
39
|
+
phrases: PropTypes.shape(getPhrasePropTypes(DayPickerNavigationPhrases)),
|
|
40
|
+
|
|
41
|
+
renderNavPrevButton: PropTypes.func,
|
|
42
|
+
renderNavNextButton: PropTypes.func,
|
|
43
|
+
showNavPrevButton: PropTypes.bool,
|
|
44
|
+
showNavNextButton: PropTypes.bool,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const defaultProps = {
|
|
48
|
+
disablePrev: false,
|
|
49
|
+
disableNext: false,
|
|
50
|
+
inlineStyles: null,
|
|
51
|
+
isRTL: false,
|
|
52
|
+
navPosition: NAV_POSITION_TOP,
|
|
53
|
+
navPrev: null,
|
|
54
|
+
navNext: null,
|
|
55
|
+
orientation: HORIZONTAL_ORIENTATION,
|
|
56
|
+
|
|
57
|
+
onPrevMonthClick() {},
|
|
58
|
+
onNextMonthClick() {},
|
|
59
|
+
|
|
60
|
+
// internationalization
|
|
61
|
+
phrases: DayPickerNavigationPhrases,
|
|
62
|
+
|
|
63
|
+
renderNavPrevButton: null,
|
|
64
|
+
renderNavNextButton: null,
|
|
65
|
+
showNavPrevButton: true,
|
|
66
|
+
showNavNextButton: true,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
class DayPickerNavigation extends React.PureComponent {
|
|
70
|
+
render() {
|
|
71
|
+
const {
|
|
72
|
+
inlineStyles,
|
|
73
|
+
isRTL,
|
|
74
|
+
disablePrev,
|
|
75
|
+
disableNext,
|
|
76
|
+
navPosition,
|
|
77
|
+
navPrev,
|
|
78
|
+
navNext,
|
|
79
|
+
onPrevMonthClick,
|
|
80
|
+
onNextMonthClick,
|
|
81
|
+
orientation,
|
|
82
|
+
phrases,
|
|
83
|
+
renderNavPrevButton,
|
|
84
|
+
renderNavNextButton,
|
|
85
|
+
showNavPrevButton,
|
|
86
|
+
showNavNextButton,
|
|
87
|
+
css,
|
|
88
|
+
styles,
|
|
89
|
+
} = this.props;
|
|
90
|
+
|
|
91
|
+
if (!showNavNextButton && !showNavPrevButton) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const isHorizontal = orientation === HORIZONTAL_ORIENTATION;
|
|
96
|
+
const isVertical = orientation !== HORIZONTAL_ORIENTATION;
|
|
97
|
+
const isVerticalScrollable = orientation === VERTICAL_SCROLLABLE;
|
|
98
|
+
const isBottomNavPosition = navPosition === NAV_POSITION_BOTTOM;
|
|
99
|
+
const hasInlineStyles = !!inlineStyles;
|
|
100
|
+
|
|
101
|
+
let navPrevIcon = navPrev;
|
|
102
|
+
let navNextIcon = navNext;
|
|
103
|
+
let isDefaultNavPrev = false;
|
|
104
|
+
let isDefaultNavNext = false;
|
|
105
|
+
let navPrevTabIndex = {};
|
|
106
|
+
let navNextTabIndex = {};
|
|
107
|
+
|
|
108
|
+
if (!navPrevIcon && !renderNavPrevButton && showNavPrevButton) {
|
|
109
|
+
navPrevTabIndex = { tabIndex: '0' };
|
|
110
|
+
isDefaultNavPrev = true;
|
|
111
|
+
let Icon = isVertical ? ChevronUp : LeftArrow;
|
|
112
|
+
if (isRTL && !isVertical) {
|
|
113
|
+
Icon = RightArrow;
|
|
114
|
+
}
|
|
115
|
+
navPrevIcon = (
|
|
116
|
+
<Icon
|
|
117
|
+
{...css(
|
|
118
|
+
isHorizontal && styles.DayPickerNavigation_svg__horizontal,
|
|
119
|
+
isVertical && styles.DayPickerNavigation_svg__vertical,
|
|
120
|
+
disablePrev && styles.DayPickerNavigation_svg__disabled,
|
|
121
|
+
)}
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (!navNextIcon && !renderNavNextButton && showNavNextButton) {
|
|
127
|
+
navNextTabIndex = { tabIndex: '0' };
|
|
128
|
+
isDefaultNavNext = true;
|
|
129
|
+
let Icon = isVertical ? ChevronDown : RightArrow;
|
|
130
|
+
if (isRTL && !isVertical) {
|
|
131
|
+
Icon = LeftArrow;
|
|
132
|
+
}
|
|
133
|
+
navNextIcon = (
|
|
134
|
+
<Icon
|
|
135
|
+
{...css(
|
|
136
|
+
isHorizontal && styles.DayPickerNavigation_svg__horizontal,
|
|
137
|
+
isVertical && styles.DayPickerNavigation_svg__vertical,
|
|
138
|
+
disableNext && styles.DayPickerNavigation_svg__disabled,
|
|
139
|
+
)}
|
|
140
|
+
/>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const isDefaultNav = isDefaultNavNext || isDefaultNavPrev;
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<div
|
|
148
|
+
{...css(
|
|
149
|
+
styles.DayPickerNavigation,
|
|
150
|
+
isHorizontal && styles.DayPickerNavigation__horizontal,
|
|
151
|
+
...(isVertical ? [
|
|
152
|
+
styles.DayPickerNavigation__vertical,
|
|
153
|
+
isDefaultNav && styles.DayPickerNavigation__verticalDefault,
|
|
154
|
+
] : []),
|
|
155
|
+
...(isVerticalScrollable ? [
|
|
156
|
+
styles.DayPickerNavigation__verticalScrollable,
|
|
157
|
+
isDefaultNav && styles.DayPickerNavigation__verticalScrollableDefault,
|
|
158
|
+
showNavPrevButton && styles.DayPickerNavigation__verticalScrollable_prevNav,
|
|
159
|
+
] : []),
|
|
160
|
+
...(isBottomNavPosition ? [
|
|
161
|
+
styles.DayPickerNavigation__bottom,
|
|
162
|
+
isDefaultNav && styles.DayPickerNavigation__bottomDefault,
|
|
163
|
+
] : []),
|
|
164
|
+
hasInlineStyles && inlineStyles,
|
|
165
|
+
)}
|
|
166
|
+
>
|
|
167
|
+
{showNavPrevButton
|
|
168
|
+
&& (renderNavPrevButton ? (
|
|
169
|
+
renderNavPrevButton({
|
|
170
|
+
ariaLabel: phrases.jumpToPrevMonth,
|
|
171
|
+
disabled: disablePrev,
|
|
172
|
+
onClick: disablePrev ? undefined : onPrevMonthClick,
|
|
173
|
+
onKeyUp: disablePrev ? undefined : (e) => {
|
|
174
|
+
const { key } = e;
|
|
175
|
+
if (key === 'Enter' || key === ' ') {
|
|
176
|
+
onPrevMonthClick(e);
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
onMouseUp: disablePrev ? undefined : (e) => {
|
|
180
|
+
e.currentTarget.blur();
|
|
181
|
+
},
|
|
182
|
+
})
|
|
183
|
+
) : (
|
|
184
|
+
<div // eslint-disable-line jsx-a11y/interactive-supports-focus
|
|
185
|
+
role="button"
|
|
186
|
+
{...navPrevTabIndex}
|
|
187
|
+
{...css(
|
|
188
|
+
styles.DayPickerNavigation_button,
|
|
189
|
+
isDefaultNavPrev && styles.DayPickerNavigation_button__default,
|
|
190
|
+
disablePrev && styles.DayPickerNavigation_button__disabled,
|
|
191
|
+
...(isHorizontal ? [
|
|
192
|
+
styles.DayPickerNavigation_button__horizontal,
|
|
193
|
+
...(isDefaultNavPrev ? [
|
|
194
|
+
styles.DayPickerNavigation_button__horizontalDefault,
|
|
195
|
+
isBottomNavPosition
|
|
196
|
+
&& styles.DayPickerNavigation_bottomButton__horizontalDefault,
|
|
197
|
+
!isRTL && styles.DayPickerNavigation_leftButton__horizontalDefault,
|
|
198
|
+
isRTL && styles.DayPickerNavigation_rightButton__horizontalDefault,
|
|
199
|
+
] : []),
|
|
200
|
+
] : []),
|
|
201
|
+
...(isVertical ? [
|
|
202
|
+
styles.DayPickerNavigation_button__vertical,
|
|
203
|
+
...(isDefaultNavPrev ? [
|
|
204
|
+
styles.DayPickerNavigation_button__verticalDefault,
|
|
205
|
+
styles.DayPickerNavigation_prevButton__verticalDefault,
|
|
206
|
+
isVerticalScrollable
|
|
207
|
+
&& styles.DayPickerNavigation_prevButton__verticalScrollableDefault,
|
|
208
|
+
] : []),
|
|
209
|
+
] : []),
|
|
210
|
+
)}
|
|
211
|
+
aria-disabled={disablePrev ? true : undefined}
|
|
212
|
+
aria-label={phrases.jumpToPrevMonth}
|
|
213
|
+
onClick={disablePrev ? undefined : onPrevMonthClick}
|
|
214
|
+
onKeyUp={disablePrev ? undefined : (e) => {
|
|
215
|
+
const { key } = e;
|
|
216
|
+
if (key === 'Enter' || key === ' ') {
|
|
217
|
+
onPrevMonthClick(e);
|
|
218
|
+
}
|
|
219
|
+
}}
|
|
220
|
+
onMouseUp={disablePrev ? undefined : (e) => {
|
|
221
|
+
e.currentTarget.blur();
|
|
222
|
+
}}
|
|
223
|
+
>
|
|
224
|
+
{navPrevIcon}
|
|
225
|
+
</div>
|
|
226
|
+
))}
|
|
227
|
+
|
|
228
|
+
{showNavNextButton
|
|
229
|
+
&& (renderNavNextButton ? (
|
|
230
|
+
renderNavNextButton({
|
|
231
|
+
ariaLabel: phrases.jumpToNextMonth,
|
|
232
|
+
disabled: disableNext,
|
|
233
|
+
onClick: disableNext ? undefined : onNextMonthClick,
|
|
234
|
+
onKeyUp: disableNext ? undefined : (e) => {
|
|
235
|
+
const { key } = e;
|
|
236
|
+
if (key === 'Enter' || key === ' ') {
|
|
237
|
+
onNextMonthClick(e);
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
onMouseUp: disableNext ? undefined : (e) => {
|
|
241
|
+
e.currentTarget.blur();
|
|
242
|
+
},
|
|
243
|
+
})
|
|
244
|
+
) : (
|
|
245
|
+
<div // eslint-disable-line jsx-a11y/interactive-supports-focus
|
|
246
|
+
role="button"
|
|
247
|
+
{...navNextTabIndex}
|
|
248
|
+
{...css(
|
|
249
|
+
styles.DayPickerNavigation_button,
|
|
250
|
+
isDefaultNavNext && styles.DayPickerNavigation_button__default,
|
|
251
|
+
disableNext && styles.DayPickerNavigation_button__disabled,
|
|
252
|
+
...(isHorizontal ? [
|
|
253
|
+
styles.DayPickerNavigation_button__horizontal,
|
|
254
|
+
...(isDefaultNavNext ? [
|
|
255
|
+
styles.DayPickerNavigation_button__horizontalDefault,
|
|
256
|
+
isBottomNavPosition
|
|
257
|
+
&& styles.DayPickerNavigation_bottomButton__horizontalDefault,
|
|
258
|
+
isRTL && styles.DayPickerNavigation_leftButton__horizontalDefault,
|
|
259
|
+
!isRTL && styles.DayPickerNavigation_rightButton__horizontalDefault,
|
|
260
|
+
] : []),
|
|
261
|
+
] : []),
|
|
262
|
+
...(isVertical ? [
|
|
263
|
+
styles.DayPickerNavigation_button__vertical,
|
|
264
|
+
...(isDefaultNavNext ? [
|
|
265
|
+
styles.DayPickerNavigation_button__verticalDefault,
|
|
266
|
+
styles.DayPickerNavigation_nextButton__verticalDefault,
|
|
267
|
+
isVerticalScrollable
|
|
268
|
+
&& styles.DayPickerNavigation_nextButton__verticalScrollableDefault,
|
|
269
|
+
] : []),
|
|
270
|
+
] : []),
|
|
271
|
+
)}
|
|
272
|
+
aria-disabled={disableNext ? true : undefined}
|
|
273
|
+
aria-label={phrases.jumpToNextMonth}
|
|
274
|
+
onClick={disableNext ? undefined : onNextMonthClick}
|
|
275
|
+
onKeyUp={disableNext ? undefined : (e) => {
|
|
276
|
+
const { key } = e;
|
|
277
|
+
if (key === 'Enter' || key === ' ') {
|
|
278
|
+
onNextMonthClick(e);
|
|
279
|
+
}
|
|
280
|
+
}}
|
|
281
|
+
onMouseUp={disableNext ? undefined : (e) => {
|
|
282
|
+
e.currentTarget.blur();
|
|
283
|
+
}}
|
|
284
|
+
>
|
|
285
|
+
{navNextIcon}
|
|
286
|
+
</div>
|
|
287
|
+
))}
|
|
288
|
+
</div>
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
DayPickerNavigation.propTypes = propTypes;
|
|
294
|
+
DayPickerNavigation.defaultProps = defaultProps;
|
|
295
|
+
|
|
296
|
+
export default withStyles(({ reactDates: { color, zIndex } }) => ({
|
|
297
|
+
DayPickerNavigation: {
|
|
298
|
+
position: 'relative',
|
|
299
|
+
zIndex: zIndex + 2,
|
|
300
|
+
},
|
|
301
|
+
|
|
302
|
+
DayPickerNavigation__horizontal: {
|
|
303
|
+
height: 0,
|
|
304
|
+
},
|
|
305
|
+
|
|
306
|
+
DayPickerNavigation__vertical: {},
|
|
307
|
+
DayPickerNavigation__verticalScrollable: {},
|
|
308
|
+
DayPickerNavigation__verticalScrollable_prevNav: {
|
|
309
|
+
zIndex: zIndex + 1, // zIndex + 2 causes the button to show on top of the day of week headers
|
|
310
|
+
},
|
|
311
|
+
|
|
312
|
+
DayPickerNavigation__verticalDefault: {
|
|
313
|
+
position: 'absolute',
|
|
314
|
+
width: '100%',
|
|
315
|
+
height: 52,
|
|
316
|
+
bottom: 0,
|
|
317
|
+
left: noflip(0),
|
|
318
|
+
},
|
|
319
|
+
|
|
320
|
+
DayPickerNavigation__verticalScrollableDefault: {
|
|
321
|
+
position: 'relative',
|
|
322
|
+
},
|
|
323
|
+
|
|
324
|
+
DayPickerNavigation__bottom: {
|
|
325
|
+
height: 'auto',
|
|
326
|
+
},
|
|
327
|
+
|
|
328
|
+
DayPickerNavigation__bottomDefault: {
|
|
329
|
+
display: 'flex',
|
|
330
|
+
justifyContent: 'space-between',
|
|
331
|
+
},
|
|
332
|
+
|
|
333
|
+
DayPickerNavigation_button: {
|
|
334
|
+
cursor: 'pointer',
|
|
335
|
+
userSelect: 'none',
|
|
336
|
+
border: 0,
|
|
337
|
+
padding: 0,
|
|
338
|
+
margin: 0,
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
DayPickerNavigation_button__default: {
|
|
342
|
+
border: `1px solid ${color.core.borderLight}`,
|
|
343
|
+
backgroundColor: color.background,
|
|
344
|
+
color: color.placeholderText,
|
|
345
|
+
|
|
346
|
+
':focus': {
|
|
347
|
+
border: `1px solid ${color.core.borderMedium}`,
|
|
348
|
+
},
|
|
349
|
+
|
|
350
|
+
':hover': {
|
|
351
|
+
border: `1px solid ${color.core.borderMedium}`,
|
|
352
|
+
},
|
|
353
|
+
|
|
354
|
+
':active': {
|
|
355
|
+
background: color.backgroundDark,
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
DayPickerNavigation_button__disabled: {
|
|
360
|
+
cursor: 'default',
|
|
361
|
+
border: `1px solid ${color.disabled}`,
|
|
362
|
+
|
|
363
|
+
':focus': {
|
|
364
|
+
border: `1px solid ${color.disabled}`,
|
|
365
|
+
},
|
|
366
|
+
|
|
367
|
+
':hover': {
|
|
368
|
+
border: `1px solid ${color.disabled}`,
|
|
369
|
+
},
|
|
370
|
+
|
|
371
|
+
':active': {
|
|
372
|
+
background: 'none',
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
|
|
376
|
+
DayPickerNavigation_button__horizontal: {},
|
|
377
|
+
|
|
378
|
+
DayPickerNavigation_button__horizontalDefault: {
|
|
379
|
+
position: 'absolute',
|
|
380
|
+
top: 18,
|
|
381
|
+
lineHeight: 0.78,
|
|
382
|
+
borderRadius: 3,
|
|
383
|
+
padding: '6px 9px',
|
|
384
|
+
},
|
|
385
|
+
|
|
386
|
+
DayPickerNavigation_bottomButton__horizontalDefault: {
|
|
387
|
+
position: 'static',
|
|
388
|
+
marginLeft: 22,
|
|
389
|
+
marginRight: 22,
|
|
390
|
+
marginBottom: 30,
|
|
391
|
+
marginTop: -10,
|
|
392
|
+
},
|
|
393
|
+
|
|
394
|
+
DayPickerNavigation_leftButton__horizontalDefault: {
|
|
395
|
+
left: noflip(22),
|
|
396
|
+
},
|
|
397
|
+
|
|
398
|
+
DayPickerNavigation_rightButton__horizontalDefault: {
|
|
399
|
+
right: noflip(22),
|
|
400
|
+
},
|
|
401
|
+
|
|
402
|
+
DayPickerNavigation_button__vertical: {},
|
|
403
|
+
|
|
404
|
+
DayPickerNavigation_button__verticalDefault: {
|
|
405
|
+
padding: 5,
|
|
406
|
+
background: color.background,
|
|
407
|
+
boxShadow: noflip('0 0 5px 2px rgba(0, 0, 0, 0.1)'),
|
|
408
|
+
position: 'relative',
|
|
409
|
+
display: 'inline-block',
|
|
410
|
+
textAlign: 'center',
|
|
411
|
+
height: '100%',
|
|
412
|
+
width: '50%',
|
|
413
|
+
},
|
|
414
|
+
|
|
415
|
+
DayPickerNavigation_prevButton__verticalDefault: {},
|
|
416
|
+
|
|
417
|
+
DayPickerNavigation_nextButton__verticalDefault: {
|
|
418
|
+
borderLeft: noflip(0),
|
|
419
|
+
},
|
|
420
|
+
|
|
421
|
+
DayPickerNavigation_nextButton__verticalScrollableDefault: {
|
|
422
|
+
width: '100%',
|
|
423
|
+
},
|
|
424
|
+
|
|
425
|
+
DayPickerNavigation_prevButton__verticalScrollableDefault: {
|
|
426
|
+
width: '100%',
|
|
427
|
+
},
|
|
428
|
+
|
|
429
|
+
DayPickerNavigation_svg__horizontal: {
|
|
430
|
+
height: 19,
|
|
431
|
+
width: 19,
|
|
432
|
+
fill: color.core.grayLight,
|
|
433
|
+
display: 'block',
|
|
434
|
+
},
|
|
435
|
+
|
|
436
|
+
DayPickerNavigation_svg__vertical: {
|
|
437
|
+
height: 42,
|
|
438
|
+
width: 42,
|
|
439
|
+
fill: color.text,
|
|
440
|
+
},
|
|
441
|
+
|
|
442
|
+
DayPickerNavigation_svg__disabled: {
|
|
443
|
+
fill: color.disabled,
|
|
444
|
+
},
|
|
445
|
+
}), { pureComponent: typeof React.PureComponent !== 'undefined' })(DayPickerNavigation);
|