Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(PasswordInput): updated size props #10612

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -4777,17 +4777,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 @@ -7078,17 +7067,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
51 changes: 21 additions & 30 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 = '',
sstrubberg marked this conversation as resolved.
Show resolved Hide resolved
hideLabel,
hidePasswordLabel = 'Hide password',
id,
inline,
invalid,
invalidText,
helperText,
light,
invalid = false,
invalidText = '',
sstrubberg marked this conversation as resolved.
Show resolved Hide resolved
labelText,
light = false,
onChange = () => {},
onClick = () => {},
onTogglePasswordVisibility,
placeholder,
size = '',
sstrubberg marked this conversation as resolved.
Show resolved Hide resolved
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;