@@ -513,7 +513,7 @@ function Weekday(_ref) {
513
513
514
514
return _react2 . default . createElement (
515
515
'div' ,
516
- { className : className } ,
516
+ { className : className , role : 'columnheader' } ,
517
517
_react2 . default . createElement (
518
518
'abbr' ,
519
519
{ title : title } ,
@@ -1154,19 +1154,19 @@ var DayPicker = function (_Component) {
1154
1154
locale : locale ,
1155
1155
localeUtils : localeUtils
1156
1156
} ;
1157
- return _react2 . default . cloneElement ( navbarElement , props ) ;
1157
+ return _react2 . default . isValidElement ( navbarElement ) ? _react2 . default . cloneElement ( navbarElement , props ) : _react2 . default . createElement ( navbarElement , props ) ;
1158
1158
}
1159
1159
} , {
1160
1160
key : 'renderDayInMonth' ,
1161
1161
value : function renderDayInMonth ( day , month ) {
1162
- var dayModifiers = [ ] ;
1163
- if ( DateUtils . isSameDay ( day , new Date ( ) ) ) {
1162
+ var propModifiers = Helpers . getModifiersFromProps ( this . props ) ;
1163
+ var dayModifiers = Helpers . getModifiersForDay ( day , propModifiers ) ;
1164
+ if ( DateUtils . isSameDay ( day , new Date ( ) ) && ! Object . prototype . hasOwnProperty . call ( propModifiers , this . props . classNames . today ) ) {
1164
1165
dayModifiers . push ( this . props . classNames . today ) ;
1165
1166
}
1166
1167
if ( day . getMonth ( ) !== month . getMonth ( ) ) {
1167
1168
dayModifiers . push ( this . props . classNames . outside ) ;
1168
1169
}
1169
- dayModifiers = [ ] . concat ( _toConsumableArray ( dayModifiers ) , _toConsumableArray ( Helpers . getModifiersForDay ( day , Helpers . getModifiersFromProps ( this . props ) ) ) ) ;
1170
1170
1171
1171
var isOutside = day . getMonth ( ) !== month . getMonth ( ) ;
1172
1172
var tabIndex = null ;
@@ -1228,9 +1228,7 @@ var DayPicker = function (_Component) {
1228
1228
months : this . props . months ,
1229
1229
1230
1230
weekdayElement : this . props . weekdayElement ,
1231
- captionElement : _react2 . default . cloneElement ( this . props . captionElement , {
1232
- classNames : this . props . classNames
1233
- } ) ,
1231
+ captionElement : this . props . captionElement ,
1234
1232
fixedWeeks : this . props . fixedWeeks ,
1235
1233
1236
1234
weekdaysShort : this . props . weekdaysShort ,
@@ -1287,7 +1285,7 @@ var DayPicker = function (_Component) {
1287
1285
return DayPicker ;
1288
1286
} ( _react . Component ) ;
1289
1287
1290
- DayPicker . VERSION = '5.1.2 ' ;
1288
+ DayPicker . VERSION = '5.2.0 ' ;
1291
1289
DayPicker . propTypes = {
1292
1290
1293
1291
// Rendering months
@@ -1342,9 +1340,9 @@ DayPicker.propTypes = {
1342
1340
1343
1341
// Custom elements
1344
1342
renderDay : _react . PropTypes . func ,
1345
- weekdayElement : _react . PropTypes . element ,
1346
- navbarElement : _react . PropTypes . element ,
1347
- captionElement : _react . PropTypes . element ,
1343
+ weekdayElement : _react . PropTypes . oneOfType ( [ _react . PropTypes . element , _react . PropTypes . func , _react . PropTypes . instanceOf ( _react . Component ) ] ) ,
1344
+ navbarElement : _react . PropTypes . oneOfType ( [ _react . PropTypes . element , _react . PropTypes . func , _react . PropTypes . instanceOf ( _react . Component ) ] ) ,
1345
+ captionElement : _react . PropTypes . oneOfType ( [ _react . PropTypes . element , _react . PropTypes . func , _react . PropTypes . instanceOf ( _react . Component ) ] ) ,
1348
1346
1349
1347
// Events
1350
1348
onBlur : _react . PropTypes . func ,
@@ -1611,18 +1609,21 @@ function Month(_ref) {
1611
1609
1612
1610
var captionProps = {
1613
1611
date : month ,
1612
+ classNames : classNames ,
1614
1613
months : months ,
1615
1614
localeUtils : localeUtils ,
1616
1615
locale : locale ,
1617
1616
onClick : onCaptionClick ? function ( e ) {
1618
1617
return onCaptionClick ( month , e ) ;
1619
1618
} : undefined
1620
1619
} ;
1620
+ var caption = _react2 . default . isValidElement ( captionElement ) ? _react2 . default . cloneElement ( captionElement , captionProps ) : _react2 . default . createElement ( captionElement , captionProps ) ;
1621
+
1621
1622
var weeks = ( 0 , _Helpers . getWeekArray ) ( month , firstDayOfWeek , fixedWeeks ) ;
1622
1623
return _react2 . default . createElement (
1623
1624
'div' ,
1624
- { className : classNames . month } ,
1625
- _react2 . default . cloneElement ( captionElement , captionProps ) ,
1625
+ { className : classNames . month , role : 'grid' } ,
1626
+ caption ,
1626
1627
_react2 . default . createElement ( _Weekdays2 . default , {
1627
1628
classNames : classNames ,
1628
1629
weekdaysShort : weekdaysShort ,
@@ -1634,7 +1635,7 @@ function Month(_ref) {
1634
1635
} ) ,
1635
1636
_react2 . default . createElement (
1636
1637
'div' ,
1637
- { className : classNames . body , role : 'grid ' } ,
1638
+ { className : classNames . body , role : 'rowgroup ' } ,
1638
1639
weeks . map ( function ( week , j ) {
1639
1640
return _react2 . default . createElement (
1640
1641
'div' ,
@@ -1659,8 +1660,8 @@ Month.propTypes = {
1659
1660
months : _react2 . default . PropTypes . arrayOf ( _react2 . default . PropTypes . string ) ,
1660
1661
1661
1662
fixedWeeks : _react . PropTypes . bool ,
1662
- captionElement : _react . PropTypes . node . isRequired ,
1663
- weekdayElement : _react . PropTypes . element ,
1663
+ captionElement : _react . PropTypes . oneOfType ( [ _react . PropTypes . element , _react . PropTypes . func , _react . PropTypes . instanceOf ( _react2 . default . Component ) ] ) . isRequired ,
1664
+ weekdayElement : _react . PropTypes . oneOfType ( [ _react . PropTypes . element , _react . PropTypes . func , _react . PropTypes . instanceOf ( _react2 . default . Component ) ] ) ,
1664
1665
1665
1666
locale : _react . PropTypes . string . isRequired ,
1666
1667
localeUtils : _PropTypes2 . default . localeUtils . isRequired ,
@@ -1717,7 +1718,7 @@ function Weekdays(_ref) {
1717
1718
localeUtils : localeUtils ,
1718
1719
locale : locale
1719
1720
} ;
1720
- var element = _react2 . default . cloneElement ( weekdayElement , elementProps ) ;
1721
+ var element = _react2 . default . isValidElement ( weekdayElement ) ? _react2 . default . cloneElement ( weekdayElement , elementProps ) : _react2 . default . createElement ( weekdayElement , elementProps ) ;
1721
1722
days . push ( element ) ;
1722
1723
}
1723
1724
@@ -1726,7 +1727,7 @@ function Weekdays(_ref) {
1726
1727
{ className : classNames . weekdays , role : 'rowgroup' } ,
1727
1728
_react2 . default . createElement (
1728
1729
'div' ,
1729
- { className : classNames . weekdaysRow , role : 'columnheader ' } ,
1730
+ { className : classNames . weekdaysRow , role : 'row ' } ,
1730
1731
days
1731
1732
)
1732
1733
) ;
@@ -1745,7 +1746,7 @@ Weekdays.propTypes = {
1745
1746
weekdaysShort : _react . PropTypes . arrayOf ( _react . PropTypes . string ) ,
1746
1747
locale : _react . PropTypes . string . isRequired ,
1747
1748
localeUtils : _PropTypes2 . default . localeUtils . isRequired ,
1748
- weekdayElement : _react . PropTypes . element
1749
+ weekdayElement : _react . PropTypes . oneOfType ( [ _react . PropTypes . element , _react . PropTypes . func , _react . PropTypes . instanceOf ( _react2 . default . Component ) ] )
1749
1750
} ;
1750
1751
//# sourceMappingURL=Weekdays.js.map
1751
1752
0 commit comments