From df69045850286b3d0d6235ba90149762ea1f2f03 Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Fri, 17 Jan 2020 08:55:17 -0800 Subject: [PATCH] feat(text-input): add height variations to password input --- .../src/components/TextInput/ControlledPasswordInput.js | 8 ++++++++ packages/react/src/components/TextInput/PasswordInput.js | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/packages/react/src/components/TextInput/ControlledPasswordInput.js b/packages/react/src/components/TextInput/ControlledPasswordInput.js index 6b37fe987f32..fc939b4b2406 100644 --- a/packages/react/src/components/TextInput/ControlledPasswordInput.js +++ b/packages/react/src/components/TextInput/ControlledPasswordInput.js @@ -25,6 +25,7 @@ const ControlledPasswordInput = React.forwardRef( togglePasswordVisibility, tooltipPosition = 'bottom', tooltipAlignment = 'center', + size, ...other }, ref @@ -37,6 +38,7 @@ const ControlledPasswordInput = React.forwardRef( { [`${prefix}--text-input--light`]: light, [`${prefix}--text-input--invalid`]: invalid, + [`${prefix}--text-input--${size}`]: size, } ); const sharedTextInputProps = { @@ -218,6 +220,11 @@ ControlledPasswordInput.propTypes = { * Can be one of: start, center, or end. */ tooltipAlignment: PropTypes.oneOf(['start', 'center', 'end']), + + /** + * Specify the size of the Text Input. Currently supports either `sm`, `lg` or `xl` as an option. + */ + size: PropTypes.string, }; ControlledPasswordInput.defaultProps = { @@ -229,6 +236,7 @@ ControlledPasswordInput.defaultProps = { invalidText: '', helperText: '', light: false, + size: 'lg', }; export default ControlledPasswordInput; diff --git a/packages/react/src/components/TextInput/PasswordInput.js b/packages/react/src/components/TextInput/PasswordInput.js index ec95b3fae317..7c2975a0b236 100644 --- a/packages/react/src/components/TextInput/PasswordInput.js +++ b/packages/react/src/components/TextInput/PasswordInput.js @@ -23,6 +23,7 @@ export default function PasswordInput({ tooltipAlignment = 'center', hidePasswordLabel = 'Hide password', showPasswordLabel = 'Show password', + size, ...other }) { const [inputType, setInputType] = useState('password'); @@ -36,6 +37,7 @@ export default function PasswordInput({ { [`${prefix}--text-input--light`]: light, [`${prefix}--text-input--invalid`]: invalid, + [`${prefix}--text-input--${size}`]: size, } ); const sharedTextInputProps = { @@ -223,6 +225,11 @@ PasswordInput.propTypes = { * "Show password" tooltip text on password visibility toggle */ showPasswordLabel: PropTypes.string, + + /** + * Specify the size of the Text Input. Currently supports either `sm`, `lg` or `xl` as an option. + */ + size: PropTypes.string, }; PasswordInput.defaultProps = { @@ -234,4 +241,5 @@ PasswordInput.defaultProps = { invalidText: '', helperText: '', light: false, + size: 'lg', };