diff --git a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap index 5f80db5af331..2367e37075c4 100644 --- a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap +++ b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap @@ -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", @@ -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", diff --git a/packages/react/src/components/TextInput/PasswordInput.js b/packages/react/src/components/TextInput/PasswordInput.js index 6a9e0134ba02..d236c62b9e92 100644 --- a/packages/react/src/components/TextInput/PasswordInput.js +++ b/packages/react/src/components/TextInput/PasswordInput.js @@ -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 ) { @@ -78,7 +79,7 @@ const PasswordInput = React.forwardRef(function PasswordInput( type: inputType, className: textInputClasses, ref, - ...other, + ...rest, }; const inputWrapperClasses = classNames( `${prefix}--form-item`, @@ -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. @@ -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;