@@ -299,6 +299,7 @@ function CalendarDateControl< Item >( {
299299 isValid,
300300 format : fieldFormat ,
301301 } = field ;
302+ const disabled = field . isDisabled ( { item : data , field } ) ;
302303 const [ selectedPresetId , setSelectedPresetId ] = useState < string | null > (
303304 null
304305 ) ;
@@ -406,6 +407,8 @@ function CalendarDateControl< Item >( {
406407 variant = "tertiary"
407408 isPressed = { isSelected }
408409 size = "small"
410+ disabled = { disabled }
411+ accessibleWhenDisabled
409412 onClick = { ( ) =>
410413 handlePresetClick ( preset )
411414 }
@@ -419,8 +422,8 @@ function CalendarDateControl< Item >( {
419422 variant = "tertiary"
420423 isPressed = { ! selectedPresetId }
421424 size = "small"
422- disabled = { ! ! selectedPresetId }
423- accessibleWhenDisabled = { false }
425+ disabled = { ! ! selectedPresetId || disabled }
426+ accessibleWhenDisabled
424427 >
425428 { __ ( 'Custom' ) }
426429 </ Button >
@@ -436,6 +439,7 @@ function CalendarDateControl< Item >( {
436439 value = { value }
437440 onChange = { handleManualDateChange }
438441 required = { ! ! field . isValid ?. required }
442+ disabled = { disabled }
439443 />
440444
441445 { /* Calendar widget */ }
@@ -449,6 +453,7 @@ function CalendarDateControl< Item >( {
449453 onMonthChange = { setCalendarMonth }
450454 timeZone = { timezoneString || undefined }
451455 weekStartsOn = { weekStartsOn }
456+ disabled = { disabled }
452457 />
453458 </ Stack >
454459 </ BaseControl >
@@ -472,6 +477,7 @@ function CalendarDateRangeControl< Item >( {
472477 setValue,
473478 format : fieldFormat ,
474479 } = field ;
480+ const disabled = field . isDisabled ( { item : data , field } ) ;
475481 let value : DateRange ;
476482 const fieldValue = getValue ( { item : data } ) ;
477483 if (
@@ -626,6 +632,8 @@ function CalendarDateRangeControl< Item >( {
626632 variant = "tertiary"
627633 isPressed = { isSelected }
628634 size = "small"
635+ disabled = { disabled }
636+ accessibleWhenDisabled
629637 onClick = { ( ) =>
630638 handlePresetClick ( preset )
631639 }
@@ -639,8 +647,8 @@ function CalendarDateRangeControl< Item >( {
639647 variant = "tertiary"
640648 isPressed = { ! selectedPresetId }
641649 size = "small"
642- accessibleWhenDisabled = { false }
643- disabled = { ! ! selectedPresetId }
650+ accessibleWhenDisabled
651+ disabled = { ! ! selectedPresetId || disabled }
644652 >
645653 { __ ( 'Custom' ) }
646654 </ Button >
@@ -664,6 +672,7 @@ function CalendarDateRangeControl< Item >( {
664672 handleManualDateChange ( 'from' , newValue )
665673 }
666674 required = { ! ! field . isValid ?. required }
675+ disabled = { disabled }
667676 />
668677 < InputControl
669678 __next40pxDefaultSize
@@ -676,6 +685,7 @@ function CalendarDateRangeControl< Item >( {
676685 handleManualDateChange ( 'to' , newValue )
677686 }
678687 required = { ! ! field . isValid ?. required }
688+ disabled = { disabled }
679689 />
680690 </ Stack >
681691
@@ -687,6 +697,7 @@ function CalendarDateRangeControl< Item >( {
687697 onMonthChange = { setCalendarMonth }
688698 timeZone = { timezone . string || undefined }
689699 weekStartsOn = { weekStartsOn }
700+ disabled = { disabled }
690701 />
691702 </ Stack >
692703 </ BaseControl >
0 commit comments