Deprecate types search and password from TextField

Signed-off-by: Hermione Bird <hermioneb@spotify.com>
This commit is contained in:
Hermione Bird
2025-09-25 10:46:15 +01:00
parent 25ada301cf
commit bd68474c80
2 changed files with 30 additions and 0 deletions
@@ -48,6 +48,20 @@ export const TextField = forwardRef<HTMLDivElement, TextFieldProps>(
}
}, [label, ariaLabel, ariaLabelledBy]);
useEffect(() => {
const inputType = (props as { type?: string }).type;
if (inputType === 'search') {
console.warn(
'TextField type="search" is deprecated. Use SearchField instead.',
);
}
if (inputType === 'password') {
console.warn(
'TextField type="password" is deprecated. Use PasswordField instead.',
);
}
}, [props]);
const { classNames, dataAttributes } = useStyles('TextField', {
size,
});
@@ -23,6 +23,22 @@ import type { FieldLabelProps } from '../FieldLabel/types';
export interface TextFieldProps
extends AriaTextFieldProps,
Omit<FieldLabelProps, 'htmlFor' | 'id'> {
/**
* The HTML input type for the text field
*
* @remarks
* The values 'search' and 'password' are deprecated. Use `SearchField` for
* search inputs and `PasswordField` for password inputs.
*/
type?:
| 'text'
| 'email'
| 'tel'
| 'url'
/** @deprecated Use `SearchField` instead */
| 'search'
/** @deprecated Use `PasswordField` instead */
| 'password';
/**
* An icon to render before the input
*/