File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ LANDING_BLOCK-->
183
183
| aria-label | The control's ` aria-label ` attribute | ` string ` | |
184
184
| aria-labelledby | The control's ` aria-labelledby ` attribute | ` string ` | |
185
185
| autoFocus | The control's ` autofocus ` attribute | ` boolean ` | |
186
+ | cellFocusable | The control's ` cellFocusable ` attribute | ` boolean ` | |
186
187
| className | The control's wrapper class name | ` string ` | |
187
188
| [ defaultFocusedValue] ( #focused-value ) | The date that is focused when the calendar first mounts (uncontrolled) | ` DateTime ` | |
188
189
| [ defaultMode] ( #mode ) | Initial mode to show in calendar | ` days ` ` months ` ` quarters ` ` years ` | |
Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ export interface CalendarStateOptionsBase extends InputBase {
25
25
autoFocus ?: boolean ;
26
26
/** Controls the currently focused date within the calendar. */
27
27
focusedValue ?: DateTime | null ;
28
+ /** Whether to automatically focus the cell
29
+ * * @default true
30
+ */
31
+ cellFocusable ?: boolean ;
28
32
/** The date that is focused when the calendar first mounts (uncontrolled). */
29
33
defaultFocusedValue ?: DateTime ;
30
34
/** Handler that is called when the focused date changes. */
Original file line number Diff line number Diff line change @@ -46,6 +46,8 @@ export function useCalendarState(props: CalendarStateOptions): CalendarState {
46
46
) ;
47
47
const timeZone = props . timeZone || inputTimeZone ;
48
48
49
+ const cellFocusable = props . cellFocusable ?? true ;
50
+
49
51
const minValue = React . useMemo (
50
52
( ) => ( props . minValue ? props . minValue . timeZone ( timeZone ) : undefined ) ,
51
53
[ timeZone , props . minValue ] ,
@@ -225,7 +227,12 @@ export function useCalendarState(props: CalendarStateOptions): CalendarState {
225
227
}
226
228
} ,
227
229
isCellFocused ( date : DateTime ) {
228
- return this . isFocused && focusedDate && date . isSame ( focusedDate , currentMode ) ;
230
+ return (
231
+ cellFocusable &&
232
+ this . isFocused &&
233
+ focusedDate &&
234
+ date . isSame ( focusedDate , currentMode )
235
+ ) ;
229
236
} ,
230
237
isCellDisabled ( date : DateTime ) {
231
238
return this . disabled || this . isInvalid ( date ) ;
You can’t perform that action at this time.
0 commit comments