Skip to content

Commit

Permalink
feat(text-input): add height variations to password input
Browse files Browse the repository at this point in the history
  • Loading branch information
tw15egan committed Jan 17, 2020
1 parent 023b69c commit df69045
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const ControlledPasswordInput = React.forwardRef(
togglePasswordVisibility,
tooltipPosition = 'bottom',
tooltipAlignment = 'center',
size,
...other
},
ref
Expand All @@ -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 = {
Expand Down Expand Up @@ -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 = {
Expand All @@ -229,6 +236,7 @@ ControlledPasswordInput.defaultProps = {
invalidText: '',
helperText: '',
light: false,
size: 'lg',
};

export default ControlledPasswordInput;
8 changes: 8 additions & 0 deletions packages/react/src/components/TextInput/PasswordInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default function PasswordInput({
tooltipAlignment = 'center',
hidePasswordLabel = 'Hide password',
showPasswordLabel = 'Show password',
size,
...other
}) {
const [inputType, setInputType] = useState('password');
Expand All @@ -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 = {
Expand Down Expand Up @@ -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 = {
Expand All @@ -234,4 +241,5 @@ PasswordInput.defaultProps = {
invalidText: '',
helperText: '',
light: false,
size: 'lg',
};

0 comments on commit df69045

Please sign in to comment.