Skip to content

Commit

Permalink
chore(TextInput): size audit (#10589)
Browse files Browse the repository at this point in the history
* chore(TextInput): size audit

* chore(TextInput): re-added defaultProps

* chore(TextInput): updated public snapshot

* chore(TextInput): moved defaultProps, updated public api snapshot

* chore(TextInput): updated default props

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
sstrubberg and kodiakhq[bot] authored Feb 2, 2022
1 parent 92f3805 commit 4060572
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 46 deletions.
13 changes: 0 additions & 13 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7196,19 +7196,6 @@ Map {
},
"render": [Function],
},
"defaultProps": Object {
"disabled": false,
"helperText": "",
"inline": false,
"invalid": false,
"invalidText": "",
"light": false,
"onChange": [Function],
"onClick": [Function],
"type": "text",
"warn": false,
"warnText": "",
},
"propTypes": Object {
"className": Object {
"type": "string",
Expand Down
54 changes: 21 additions & 33 deletions packages/react/src/components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,30 @@ import ControlledPasswordInput from './ControlledPasswordInput';
import { textInputProps } from './util';
import { FormContext } from '../FluidForm';
import { useFeatureFlag } from '../FeatureFlags';
import * as FeatureFlags from '@carbon/feature-flags';
import { usePrefix } from '../../internal/usePrefix';

const TextInput = React.forwardRef(function TextInput(
{
labelText,
className,
id,
placeholder,
type,
onChange,
onClick,
disabled = false,
helperText,
hideLabel,
disabled,
invalid,
id,
inline = false,
invalid = false,
invalidText,
warn,
warnText,
helperText,
light,
size,
inline,
labelText,
light = false,
onChange = () => {},
onClick = () => {},
placeholder,
readOnly,
...other
size = 'md',
type = 'text',
warn = false,
warnText,
...rest
},
ref
) {
Expand Down Expand Up @@ -86,7 +87,7 @@ const TextInput = React.forwardRef(function TextInput(
disabled: normalizedProps.disabled,
readOnly,
['aria-describedby']: helperText && normalizedProps.helperId,
...other,
...rest,
};
const inputWrapperClasses = classNames(
[
Expand Down Expand Up @@ -267,10 +268,11 @@ TextInput.propTypes = {
readOnly: PropTypes.bool,

/**
* Specify the size of the Text Input. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
* TODO V11: remove `xl` (replaced with lg)
* Specify the size of the Text Input. Currently supports the following:
*/
size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl']),
size: FeatureFlags.enabled('enable-v11-release')
? PropTypes.oneOf(['sm', 'md', 'lg'])
: PropTypes.oneOf(['sm', 'md', 'lg', 'xl']),

/**
* Specify the type of the `<input>`
Expand All @@ -293,18 +295,4 @@ TextInput.propTypes = {
warnText: PropTypes.node,
};

TextInput.defaultProps = {
disabled: false,
type: 'text',
onChange: () => {},
onClick: () => {},
invalid: false,
invalidText: '',
warn: false,
warnText: '',
helperText: '',
light: false,
inline: false,
};

export default TextInput;

0 comments on commit 4060572

Please sign in to comment.