From 06d6ab58e3e5ae627d63cbc9dba066bd647e1bad Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 16 Aug 2018 10:43:56 -0600 Subject: [PATCH] Allow setting autoFocus on radio group option (#1117) * Allow setting autoFocus on radio group option * pass optionRest to EuiRadio * remove autoFocus from RadioGroup since it is now passed via optionRest * pass id, value, and label via optionRest --- src/components/form/radio/radio.js | 3 +++ src/components/form/radio/radio_group.js | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/form/radio/radio.js b/src/components/form/radio/radio.js index a4a7118dd2d..5ae646b6afe 100644 --- a/src/components/form/radio/radio.js +++ b/src/components/form/radio/radio.js @@ -12,6 +12,7 @@ export const EuiRadio = ({ onChange, disabled, compressed, + autoFocus, ...rest }) => { const classes = classNames( @@ -50,6 +51,7 @@ export const EuiRadio = ({ checked={checked} onChange={onChange} disabled={disabled} + autoFocus={autoFocus} />
@@ -71,6 +73,7 @@ EuiRadio.propTypes = { * when `true` creates a shorter height radio row */ compressed: PropTypes.bool, + autoFocus: PropTypes.bool, }; EuiRadio.defaultProps = { diff --git a/src/components/form/radio/radio_group.js b/src/components/form/radio/radio_group.js index 6f578646424..44799023540 100644 --- a/src/components/form/radio/radio_group.js +++ b/src/components/form/radio/radio_group.js @@ -15,18 +15,20 @@ export const EuiRadioGroup = ({ }) => (
{options.map((option, index) => { + const { + disabled: isOptionDisabled, + ...optionRest + } = option; return ( ); })}