@@ -63,6 +63,7 @@ const propTypes = {
63
63
useTz : PropTypes . bool ,
64
64
closeOnOutsideClick : PropTypes . bool ,
65
65
timeConfig : PropTypes . object ,
66
+ disabled : PropTypes . bool ,
66
67
} ;
67
68
68
69
const defaultProps = {
@@ -92,7 +93,8 @@ const defaultProps = {
92
93
timeConfig : {
93
94
step : 30 ,
94
95
unit : 'minutes'
95
- }
96
+ } ,
97
+ disabled : false ,
96
98
} ;
97
99
98
100
class TimePicker extends React . PureComponent {
@@ -146,6 +148,9 @@ class TimePicker extends React.PureComponent {
146
148
}
147
149
148
150
onFocusChange ( focused ) {
151
+ const { disabled } = this . props ;
152
+ if ( disabled ) return ;
153
+
149
154
this . setState ( { focused } ) ;
150
155
const { onFocusChange } = this . props ;
151
156
onFocusChange && onFocusChange ( focused ) ;
@@ -286,6 +291,7 @@ class TimePicker extends React.PureComponent {
286
291
renderDialPlate ( ) {
287
292
const {
288
293
theme,
294
+ disabled,
289
295
timeMode,
290
296
autoMode,
291
297
autoClose,
@@ -300,6 +306,8 @@ class TimePicker extends React.PureComponent {
300
306
timezoneIsEditable,
301
307
} = this . props ;
302
308
309
+ if ( disabled ) return null ;
310
+
303
311
const dialTheme = theme === 'material' ? theme : 'classic' ;
304
312
const DialPlate = DialPlates [ dialTheme ] ;
305
313
@@ -337,6 +345,7 @@ class TimePicker extends React.PureComponent {
337
345
render ( ) {
338
346
const {
339
347
trigger,
348
+ disabled,
340
349
placeholder,
341
350
withoutIcon,
342
351
colorPalette,
@@ -348,7 +357,8 @@ class TimePicker extends React.PureComponent {
348
357
349
358
const pickerPreviewClass = cx (
350
359
'time_picker_preview' ,
351
- focused && 'active'
360
+ focused && 'active' ,
361
+ disabled && 'disabled'
352
362
) ;
353
363
const containerClass = cx (
354
364
'time_picker_container' ,
@@ -375,7 +385,7 @@ class TimePicker extends React.PureComponent {
375
385
< OutsideClickHandler
376
386
focused = { focused }
377
387
onOutsideClick = { this . onBlur }
378
- closeOnOutsideClick = { closeOnOutsideClick }
388
+ closeOnOutsideClick = { disabled ? false : closeOnOutsideClick }
379
389
>
380
390
{ this . renderDialPlate ( ) }
381
391
</ OutsideClickHandler >
0 commit comments