UNPKG

3.76 kBJavaScriptView Raw
1import PropTypes from 'prop-types';
2import momentPropTypes from 'react-moment-proptypes';
3import { mutuallyExclusiveProps, nonNegativeInteger } from 'airbnb-prop-types';
4
5import { DateRangePickerPhrases } from '../defaultPhrases';
6import getPhrasePropTypes from '../utils/getPhrasePropTypes';
7
8import FocusedInputShape from './FocusedInputShape';
9import IconPositionShape from './IconPositionShape';
10import OrientationShape from './OrientationShape';
11import DisabledShape from './DisabledShape';
12import anchorDirectionShape from './AnchorDirectionShape';
13import openDirectionShape from './OpenDirectionShape';
14import DayOfWeekShape from './DayOfWeekShape';
15import CalendarInfoPositionShape from './CalendarInfoPositionShape';
16
17export default {
18 // required props for a functional interactive DateRangePicker
19 startDate: momentPropTypes.momentObj,
20 endDate: momentPropTypes.momentObj,
21 onDatesChange: PropTypes.func.isRequired,
22
23 focusedInput: FocusedInputShape,
24 onFocusChange: PropTypes.func.isRequired,
25
26 onClose: PropTypes.func,
27
28 // input related props
29 startDateId: PropTypes.string.isRequired,
30 startDatePlaceholderText: PropTypes.string,
31 startDateOffset: PropTypes.func,
32 endDateOffset: PropTypes.func,
33 endDateId: PropTypes.string.isRequired,
34 endDatePlaceholderText: PropTypes.string,
35 startDateAriaLabel: PropTypes.string,
36 endDateAriaLabel: PropTypes.string,
37 disabled: DisabledShape,
38 required: PropTypes.bool,
39 readOnly: PropTypes.bool,
40 screenReaderInputMessage: PropTypes.string,
41 showClearDates: PropTypes.bool,
42 showDefaultInputIcon: PropTypes.bool,
43 inputIconPosition: IconPositionShape,
44 customInputIcon: PropTypes.node,
45 customArrowIcon: PropTypes.node,
46 customCloseIcon: PropTypes.node,
47 noBorder: PropTypes.bool,
48 block: PropTypes.bool,
49 small: PropTypes.bool,
50 regular: PropTypes.bool,
51 keepFocusOnInput: PropTypes.bool,
52
53 // calendar presentation and interaction related props
54 renderMonthText: mutuallyExclusiveProps(PropTypes.func, 'renderMonthText', 'renderMonthElement'),
55 renderMonthElement: mutuallyExclusiveProps(PropTypes.func, 'renderMonthText', 'renderMonthElement'),
56 renderWeekHeaderElement: PropTypes.func,
57 orientation: OrientationShape,
58 anchorDirection: anchorDirectionShape,
59 openDirection: openDirectionShape,
60 horizontalMargin: PropTypes.number,
61 withPortal: PropTypes.bool,
62 withFullScreenPortal: PropTypes.bool,
63 appendToBody: PropTypes.bool,
64 disableScroll: PropTypes.bool,
65 daySize: nonNegativeInteger,
66 isRTL: PropTypes.bool,
67 firstDayOfWeek: DayOfWeekShape,
68 initialVisibleMonth: PropTypes.func,
69 numberOfMonths: PropTypes.number,
70 keepOpenOnDateSelect: PropTypes.bool,
71 reopenPickerOnClearDates: PropTypes.bool,
72 renderCalendarInfo: PropTypes.func,
73 calendarInfoPosition: CalendarInfoPositionShape,
74 hideKeyboardShortcutsPanel: PropTypes.bool,
75 verticalHeight: nonNegativeInteger,
76 transitionDuration: nonNegativeInteger,
77 verticalSpacing: nonNegativeInteger,
78 horizontalMonthPadding: nonNegativeInteger,
79
80 // navigation related props
81 navPrev: PropTypes.node,
82 navNext: PropTypes.node,
83 onPrevMonthClick: PropTypes.func,
84 onNextMonthClick: PropTypes.func,
85
86 // day presentation and interaction related props
87 renderCalendarDay: PropTypes.func,
88 renderDayContents: PropTypes.func,
89 minimumNights: PropTypes.number,
90 enableOutsideDays: PropTypes.bool,
91 isDayBlocked: PropTypes.func,
92 isOutsideRange: PropTypes.func,
93 isDayHighlighted: PropTypes.func,
94
95 // internationalization props
96 displayFormat: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
97 monthFormat: PropTypes.string,
98 weekDayFormat: PropTypes.string,
99 phrases: PropTypes.shape(getPhrasePropTypes(DateRangePickerPhrases)),
100 dayAriaLabelFormat: PropTypes.string,
101};