@@ -23,7 +23,7 @@ const propTypes = forbidExtraProps({
23
23
onDayClick : PropTypes . func ,
24
24
onDayMouseEnter : PropTypes . func ,
25
25
onDayMouseLeave : PropTypes . func ,
26
- renderDay : PropTypes . func ,
26
+ renderDayContents : PropTypes . func ,
27
27
ariaLabelFormat : PropTypes . string ,
28
28
29
29
// internationalization
@@ -40,7 +40,7 @@ const defaultProps = {
40
40
onDayClick ( ) { } ,
41
41
onDayMouseEnter ( ) { } ,
42
42
onDayMouseLeave ( ) { } ,
43
- renderDay : null ,
43
+ renderDayContents : null ,
44
44
ariaLabelFormat : 'dddd, LL' ,
45
45
46
46
// internationalization
@@ -93,7 +93,7 @@ class CalendarDay extends React.Component {
93
93
daySize,
94
94
isOutsideDay,
95
95
modifiers,
96
- renderDay ,
96
+ renderDayContents ,
97
97
tabIndex,
98
98
styles,
99
99
phrases : {
@@ -137,7 +137,9 @@ class CalendarDay extends React.Component {
137
137
return (
138
138
< td
139
139
{ ...css (
140
- styles . CalendarDay_container ,
140
+ styles . CalendarDay ,
141
+ useDefaultCursor && styles . CalendarDay__defaultCursor ,
142
+ styles . CalendarDay__default ,
141
143
isOutsideDay && styles . CalendarDay__outside ,
142
144
modifiers . has ( 'today' ) && styles . CalendarDay__today ,
143
145
modifiers . has ( 'highlighted-calendar' ) && styles . CalendarDay__highlighted_calendar ,
@@ -152,23 +154,17 @@ class CalendarDay extends React.Component {
152
154
isOutsideRange && styles . CalendarDay__blocked_out_of_range ,
153
155
daySizeStyles ,
154
156
) }
157
+ role = "button" // eslint-disable-line jsx-a11y/no-noninteractive-element-to-interactive-role
158
+ ref = { this . setButtonRef }
159
+ aria-label = { ariaLabel }
160
+ onMouseEnter = { ( e ) => { this . onDayMouseEnter ( day , e ) ; } }
161
+ onMouseLeave = { ( e ) => { this . onDayMouseLeave ( day , e ) ; } }
162
+ onMouseUp = { ( e ) => { e . currentTarget . blur ( ) ; } }
163
+ onClick = { ( e ) => { this . onDayClick ( day , e ) ; } }
164
+ onKeyDown = { ( e ) => { this . onKeyDown ( day , e ) ; } }
165
+ tabIndex = { tabIndex }
155
166
>
156
- < button
157
- { ...css (
158
- styles . CalendarDay_button ,
159
- useDefaultCursor && styles . CalendarDay_button__default ,
160
- ) }
161
- type = "button"
162
- ref = { this . setButtonRef }
163
- aria-label = { ariaLabel }
164
- onMouseEnter = { ( e ) => { this . onDayMouseEnter ( day , e ) ; } }
165
- onMouseLeave = { ( e ) => { this . onDayMouseLeave ( day , e ) ; } }
166
- onMouseUp = { ( e ) => { e . currentTarget . blur ( ) ; } }
167
- onClick = { ( e ) => { this . onDayClick ( day , e ) ; } }
168
- tabIndex = { tabIndex }
169
- >
170
- { renderDay ? renderDay ( day , modifiers ) : day . format ( 'D' ) }
171
- </ button >
167
+ { renderDayContents ? renderDayContents ( day , modifiers ) : day . format ( 'D' ) }
172
168
</ td >
173
169
) ;
174
170
}
@@ -179,47 +175,33 @@ CalendarDay.defaultProps = defaultProps;
179
175
180
176
export { CalendarDay as PureCalendarDay } ;
181
177
export default withStyles ( ( { reactDates : { color, font } } ) => ( {
182
- CalendarDay_container : {
183
- border : `1px solid ${ color . core . borderLight } ` ,
184
- padding : 0 ,
185
- boxSizing : 'border-box' ,
186
- color : color . text ,
187
- background : color . background ,
188
-
189
- ':hover' : {
190
- background : color . core . borderLight ,
191
- border : `1px double ${ color . core . borderLight } ` ,
192
- color : 'inherit' ,
193
- } ,
194
- } ,
195
-
196
- CalendarDay_button : {
197
- position : 'relative' ,
198
- height : '100%' ,
199
- width : '100%' ,
200
- textAlign : 'center' ,
201
- background : 'none' ,
202
- border : 0 ,
203
- margin : 0 ,
204
- padding : 0 ,
205
- color : 'inherit' ,
206
- lineHeight : 'normal' ,
207
- overflow : 'visible' ,
178
+ CalendarDay : {
208
179
boxSizing : 'border-box' ,
209
180
cursor : 'pointer' ,
210
- fontFamily : 'inherit' ,
211
- fontStyle : 'inherit' ,
212
181
fontSize : font . size ,
182
+ textAlign : 'center' ,
213
183
214
184
':active' : {
215
185
outline : 0 ,
216
186
} ,
217
187
} ,
218
188
219
- CalendarDay_button__default : {
189
+ CalendarDay__defaultCursor : {
220
190
cursor : 'default' ,
221
191
} ,
222
192
193
+ CalendarDay__default : {
194
+ border : `1px solid ${ color . core . borderLight } ` ,
195
+ color : color . text ,
196
+ background : color . background ,
197
+
198
+ ':hover' : {
199
+ background : color . core . borderLight ,
200
+ border : `1px double ${ color . core . borderLight } ` ,
201
+ color : 'inherit' ,
202
+ } ,
203
+ } ,
204
+
223
205
CalendarDay__outside : {
224
206
border : 0 ,
225
207
0 commit comments