UNPKG

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