Skip to content

Commit

Permalink
chore(PasswordInput): updated size props (#10612)
Browse files Browse the repository at this point in the history
* chore(PasswordInput): updated size props

* chore(PasswordInput): updated default props
  • Loading branch information
sstrubberg committed Feb 11, 2022
1 parent c2a62f9 commit 7558fe0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 51 deletions.
22 changes: 0 additions & 22 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4766,17 +4766,6 @@ Map {
},
"PasswordInput" => Object {
"$$typeof": Symbol(react.forward_ref),
"defaultProps": Object {
"className": "\${prefix}--text__input",
"disabled": false,
"helperText": "",
"invalid": false,
"invalidText": "",
"light": false,
"onChange": [Function],
"onClick": [Function],
"size": "",
},
"propTypes": Object {
"className": Object {
"type": "string",
Expand Down Expand Up @@ -7075,17 +7064,6 @@ Map {
},
"PasswordInput": Object {
"$$typeof": Symbol(react.forward_ref),
"defaultProps": Object {
"className": "\${prefix}--text__input",
"disabled": false,
"helperText": "",
"invalid": false,
"invalidText": "",
"light": false,
"onChange": [Function],
"onClick": [Function],
"size": "",
},
"propTypes": Object {
"className": Object {
"type": "string",
Expand Down
49 changes: 20 additions & 29 deletions packages/react/src/components/TextInput/PasswordInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,35 @@ import { View16, ViewOff16 } from '@carbon/icons-react';
import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps';
import { textInputProps } from './util';
import { FormContext } from '../FluidForm';
import * as FeatureFlags from '@carbon/feature-flags';

const { prefix } = settings;

const PasswordInput = React.forwardRef(function PasswordInput(
{
labelText,
className,
disabled,
id,
placeholder,
onChange,
onClick,
disabled = false,
helperText,
hideLabel,
hidePasswordLabel = 'Hide password',
id,
inline,
invalid,
invalid = false,
invalidText,
helperText,
light,
labelText,
light = false,
onChange = () => {},
onClick = () => {},
onTogglePasswordVisibility,
placeholder,
size = 'md',
showPasswordLabel = 'Show password',
tooltipPosition = 'bottom',
tooltipAlignment = 'center',
type = 'password',
hidePasswordLabel = 'Hide password',
showPasswordLabel = 'Show password',
size,
onTogglePasswordVisibility,
warn,
warnText,
...other
...rest
},
ref
) {
Expand Down Expand Up @@ -78,7 +79,7 @@ const PasswordInput = React.forwardRef(function PasswordInput(
type: inputType,
className: textInputClasses,
ref,
...other,
...rest,
};
const inputWrapperClasses = classNames(
`${prefix}--form-item`,
Expand Down Expand Up @@ -298,9 +299,11 @@ PasswordInput.propTypes = {
showPasswordLabel: PropTypes.string,

/**
* Specify the size of the Text Input. Currently supports either `small` or `large` as an option. If omitted, defaults to standard size
* Specify the size of the Text Input. Supports `sm`, `md`, or `lg`.
*/
size: PropTypes.string,
size: FeatureFlags.enabled('enable-v11-release')
? PropTypes.oneOf(['sm', 'md', 'lg'])
: PropTypes.string,

/**
* Specify the alignment of the tooltip to the icon-only button.
Expand Down Expand Up @@ -335,16 +338,4 @@ PasswordInput.propTypes = {
warnText: PropTypes.node,
};

PasswordInput.defaultProps = {
className: '${prefix}--text__input',
disabled: false,
onChange: () => {},
onClick: () => {},
invalid: false,
invalidText: '',
helperText: '',
light: false,
size: '',
};

export default PasswordInput;

0 comments on commit 7558fe0

Please sign in to comment.