@@ -7,25 +7,27 @@ import FormControl from 'react-bootstrap/lib/FormControl';
7
7
import InputGroup from 'react-bootstrap/lib/InputGroup' ;
8
8
import Overlay from 'react-bootstrap/lib/Overlay' ;
9
9
import Popover from 'react-bootstrap/lib/Popover' ;
10
+ import PropTypes from 'prop-types' ;
11
+ import createReactClass from 'create-react-class' ;
10
12
11
13
let instanceCount = 0 ;
12
14
13
- const CalendarHeader = React . createClass ( {
15
+ const CalendarHeader = createReactClass ( {
14
16
displayName : 'DatePickerHeader' ,
15
17
16
18
propTypes : {
17
- displayDate : React . PropTypes . object . isRequired ,
18
- minDate : React . PropTypes . string ,
19
- maxDate : React . PropTypes . string ,
20
- onChange : React . PropTypes . func . isRequired ,
21
- monthLabels : React . PropTypes . array . isRequired ,
22
- previousButtonElement : React . PropTypes . oneOfType ( [
23
- React . PropTypes . string ,
24
- React . PropTypes . object
19
+ displayDate : PropTypes . object . isRequired ,
20
+ minDate : PropTypes . string ,
21
+ maxDate : PropTypes . string ,
22
+ onChange : PropTypes . func . isRequired ,
23
+ monthLabels : PropTypes . array . isRequired ,
24
+ previousButtonElement : PropTypes . oneOfType ( [
25
+ PropTypes . string ,
26
+ PropTypes . object
25
27
] ) . isRequired ,
26
- nextButtonElement : React . PropTypes . oneOfType ( [
27
- React . PropTypes . string ,
28
- React . PropTypes . object
28
+ nextButtonElement : PropTypes . oneOfType ( [
29
+ PropTypes . string ,
30
+ PropTypes . object
29
31
] ) . isRequired ,
30
32
} ,
31
33
@@ -74,21 +76,21 @@ const CalendarHeader = React.createClass({
74
76
75
77
const daysInMonth = [ 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 ] ;
76
78
77
- const Calendar = React . createClass ( {
79
+ const Calendar = createReactClass ( {
78
80
displayName : 'DatePickerCalendar' ,
79
81
80
82
propTypes : {
81
- selectedDate : React . PropTypes . object ,
82
- displayDate : React . PropTypes . object . isRequired ,
83
- minDate : React . PropTypes . string ,
84
- maxDate : React . PropTypes . string ,
85
- onChange : React . PropTypes . func . isRequired ,
86
- dayLabels : React . PropTypes . array . isRequired ,
87
- cellPadding : React . PropTypes . string . isRequired ,
88
- weekStartsOn : React . PropTypes . number ,
89
- showTodayButton : React . PropTypes . bool ,
90
- todayButtonLabel : React . PropTypes . string ,
91
- roundedCorners : React . PropTypes . bool
83
+ selectedDate : PropTypes . object ,
84
+ displayDate : PropTypes . object . isRequired ,
85
+ minDate : PropTypes . string ,
86
+ maxDate : PropTypes . string ,
87
+ onChange : PropTypes . func . isRequired ,
88
+ dayLabels : PropTypes . array . isRequired ,
89
+ cellPadding : PropTypes . string . isRequired ,
90
+ weekStartsOn : PropTypes . number ,
91
+ showTodayButton : PropTypes . bool ,
92
+ todayButtonLabel : PropTypes . string ,
93
+ roundedCorners : PropTypes . bool
92
94
} ,
93
95
94
96
handleClick ( day ) {
@@ -209,65 +211,65 @@ const Calendar = React.createClass({
209
211
}
210
212
} ) ;
211
213
212
- export default React . createClass ( {
214
+ export default createReactClass ( {
213
215
displayName : 'DatePicker' ,
214
216
215
217
propTypes : {
216
- defaultValue : React . PropTypes . string ,
217
- value : React . PropTypes . string ,
218
- required : React . PropTypes . bool ,
219
- className : React . PropTypes . string ,
220
- style : React . PropTypes . object ,
221
- minDate : React . PropTypes . string ,
222
- maxDate : React . PropTypes . string ,
223
- cellPadding : React . PropTypes . string ,
224
- autoComplete : React . PropTypes . string ,
225
- placeholder : React . PropTypes . string ,
226
- dayLabels : React . PropTypes . array ,
227
- monthLabels : React . PropTypes . array ,
228
- onChange : React . PropTypes . func ,
229
- onClear : React . PropTypes . func ,
230
- onBlur : React . PropTypes . func ,
231
- onFocus : React . PropTypes . func ,
232
- autoFocus : React . PropTypes . bool ,
233
- disabled : React . PropTypes . bool ,
218
+ defaultValue : PropTypes . string ,
219
+ value : PropTypes . string ,
220
+ required : PropTypes . bool ,
221
+ className : PropTypes . string ,
222
+ style : PropTypes . object ,
223
+ minDate : PropTypes . string ,
224
+ maxDate : PropTypes . string ,
225
+ cellPadding : PropTypes . string ,
226
+ autoComplete : PropTypes . string ,
227
+ placeholder : PropTypes . string ,
228
+ dayLabels : PropTypes . array ,
229
+ monthLabels : PropTypes . array ,
230
+ onChange : PropTypes . func ,
231
+ onClear : PropTypes . func ,
232
+ onBlur : PropTypes . func ,
233
+ onFocus : PropTypes . func ,
234
+ autoFocus : PropTypes . bool ,
235
+ disabled : PropTypes . bool ,
234
236
weekStartsOnMonday : ( props , propName , componentName ) => {
235
237
if ( props [ propName ] ) {
236
238
return new Error ( `Prop '${ propName } ' supplied to '${ componentName } ' is obsolete. Use 'weekStartsOn' instead.` ) ;
237
239
}
238
240
} ,
239
- weekStartsOn : React . PropTypes . number ,
240
- clearButtonElement : React . PropTypes . oneOfType ( [
241
- React . PropTypes . string ,
242
- React . PropTypes . object
241
+ weekStartsOn : PropTypes . number ,
242
+ clearButtonElement : PropTypes . oneOfType ( [
243
+ PropTypes . string ,
244
+ PropTypes . object
243
245
] ) ,
244
- showClearButton : React . PropTypes . bool ,
245
- previousButtonElement : React . PropTypes . oneOfType ( [
246
- React . PropTypes . string ,
247
- React . PropTypes . object
246
+ showClearButton : PropTypes . bool ,
247
+ previousButtonElement : PropTypes . oneOfType ( [
248
+ PropTypes . string ,
249
+ PropTypes . object
248
250
] ) ,
249
- nextButtonElement : React . PropTypes . oneOfType ( [
250
- React . PropTypes . string ,
251
- React . PropTypes . object
251
+ nextButtonElement : PropTypes . oneOfType ( [
252
+ PropTypes . string ,
253
+ PropTypes . object
252
254
] ) ,
253
- calendarPlacement : React . PropTypes . oneOfType ( [
254
- React . PropTypes . string ,
255
- React . PropTypes . func
255
+ calendarPlacement : PropTypes . oneOfType ( [
256
+ PropTypes . string ,
257
+ PropTypes . func
256
258
] ) ,
257
- dateFormat : React . PropTypes . string , // 'MM/DD/YYYY', 'DD/MM/YYYY', 'YYYY/MM/DD', 'DD-MM-YYYY'
258
- bsClass : React . PropTypes . string ,
259
- bsSize : React . PropTypes . string ,
260
- calendarContainer : React . PropTypes . object ,
261
- id : React . PropTypes . string ,
262
- name : React . PropTypes . string ,
263
- showTodayButton : React . PropTypes . bool ,
264
- todayButtonLabel : React . PropTypes . string ,
265
- instanceCount : React . PropTypes . number ,
266
- customControl : React . PropTypes . object ,
267
- roundedCorners : React . PropTypes . bool ,
268
- children : React . PropTypes . oneOfType ( [
269
- React . PropTypes . arrayOf ( React . PropTypes . node ) ,
270
- React . PropTypes . node
259
+ dateFormat : PropTypes . string , // 'MM/DD/YYYY', 'DD/MM/YYYY', 'YYYY/MM/DD', 'DD-MM-YYYY'
260
+ bsClass : PropTypes . string ,
261
+ bsSize : PropTypes . string ,
262
+ calendarContainer : PropTypes . object ,
263
+ id : PropTypes . string ,
264
+ name : PropTypes . string ,
265
+ showTodayButton : PropTypes . bool ,
266
+ todayButtonLabel : PropTypes . string ,
267
+ instanceCount : PropTypes . number ,
268
+ customControl : PropTypes . object ,
269
+ roundedCorners : PropTypes . bool ,
270
+ children : PropTypes . oneOfType ( [
271
+ PropTypes . arrayOf ( PropTypes . node ) ,
272
+ PropTypes . node
271
273
] )
272
274
} ,
273
275
0 commit comments