Skip to content

Commit 27ee540

Browse files
committed
Fix up review comments
1 parent 8b1af48 commit 27ee540

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

src/TextInput.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import TextInputWrapper from './_TextInputWrapper'
66

77
type NonPassthroughProps = {
88
className?: string
9-
// deprecate icon prop
9+
/** @deprecated Use `leadingIcon` or `trailingIcon` prop instead */
1010
icon?: React.ComponentType<{className?: string}>
1111
leadingIcon?: React.ComponentType<{className?: string}>
1212
trailingIcon?: React.ComponentType<{className?: string}>
1313
} & Pick<
1414
ComponentProps<typeof TextInputWrapper>,
15-
'block' | 'contrast' | 'disabled' | 'sx' | 'theme' | 'width' | 'maxWidth' | 'minWidth' | 'variant' | 'size'
15+
'block' | 'contrast' | 'disabled' | 'sx' | 'width' | 'maxWidth' | 'minWidth' | 'variant' | 'size'
1616
>
1717

1818
// Note: using ComponentProps instead of ComponentPropsWithoutRef here would cause a type issue where `css` is a required prop.
@@ -29,9 +29,8 @@ const TextInput = React.forwardRef<HTMLInputElement, TextInputInternalProps>(
2929
className,
3030
contrast,
3131
disabled,
32-
status,
32+
validationStatus,
3333
sx: sxProp,
34-
theme,
3534
size: sizeProp,
3635
// start deprecated props
3736
width: widthProp,
@@ -50,12 +49,11 @@ const TextInput = React.forwardRef<HTMLInputElement, TextInputInternalProps>(
5049
<TextInputWrapper
5150
block={block}
5251
className={wrapperClasses}
53-
status={status}
52+
validationStatus={validationStatus}
5453
contrast={contrast}
5554
disabled={disabled}
5655
hasIcon={!!IconComponent || !!(LeadingIconComponent || TrailingIconComponent)}
5756
sx={sxProp}
58-
theme={theme}
5957
size={sizeProp}
6058
width={widthProp}
6159
minWidth={minWidthProp}

src/_TextInputWrapper.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ type StyledWrapperProps = {
4343
hasIcon?: boolean
4444
block?: boolean
4545
contrast?: boolean
46-
status?: 'error' | 'warning'
46+
validationStatus?: 'error' | 'warning'
47+
/** @deprecated Use `size` prop instead */
4748
variant?: 'small' | 'large'
4849
size?: 'small' | 'large'
4950
} & WidthProps &
@@ -108,7 +109,7 @@ const TextInputWrapper = styled.span<StyledWrapperProps>`
108109
`}
109110
110111
${props =>
111-
props.status === 'error' &&
112+
props.validationStatus === 'error' &&
112113
css`
113114
border-color: ${get('colors.danger.emphasis')};
114115
&:focus-within {
@@ -118,7 +119,7 @@ const TextInputWrapper = styled.span<StyledWrapperProps>`
118119
`}
119120
120121
${props =>
121-
props.status === 'warning' &&
122+
props.validationStatus === 'warning' &&
122123
css`
123124
border-color: ${get('colors.attention.emphasis')};
124125
&:focus-within {

src/stories/TextInput.stories.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export default {
4444
options: ['small', 'medium', 'large'],
4545
control: {type: 'radio'}
4646
},
47-
status: {
48-
name: 'Status',
47+
validationStatus: {
48+
name: 'Validation Status',
4949
options: ['warning', 'error'],
5050
control: {type: 'radio'}
5151
},
@@ -173,7 +173,14 @@ export const TextInputInWarningState = (args: TextInputProps) => {
173173
<form>
174174
<Label htmlFor={inputId}>Password</Label>
175175
<br />
176-
<TextInput type="password" id={inputId} value={value} status="warning" onChange={handleChange} {...args} />
176+
<TextInput
177+
type="password"
178+
id={inputId}
179+
value={value}
180+
validationStatus="warning"
181+
onChange={handleChange}
182+
{...args}
183+
/>
177184
</form>
178185
)
179186
}

0 commit comments

Comments
 (0)