Skip to content

Commit

Permalink
fix(react): deprecate troublesome enums
Browse files Browse the repository at this point in the history
  • Loading branch information
brionmario committed Oct 11, 2024
1 parent 262b1c9 commit a63a8c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/react/src/components/IconButton/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ import type {WithWrapperProps} from '../../models/component';
import composeComponentDisplayName from '../../utils/compose-component-display-name';
import './icon-button.scss';

/**
* @deprecated Use the string literal i.e. "contained" or "text" instead.
* This will be removed in the next major release (v2.0.0).
*/
export enum IconButtonVariants {
CONTAINED = 'contained',
TEXT = 'text',
Expand All @@ -43,7 +47,7 @@ export type IconButtonProps<
/**
* The variant of the icon button.
*/
variant?: IconButtonVariants;
variant?: IconButtonVariants | 'contained' | 'text';
} & Omit<MuiIconButtonProps<D, P>, 'component'>;

const COMPONENT_NAME: string = 'IconButton';
Expand Down
6 changes: 5 additions & 1 deletion packages/react/src/components/TextField/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ import ListItemText from '../ListItemText';
import Tooltip from '../Tooltip';
import './text-field.scss';

/**
* @deprecated Use the string literal i.e. "password" or "text" instead.
* This will be removed in the next major release (v2.0.0).
*/
export enum TextFieldInputTypes {
INPUT_PASSWORD = 'password',
INPUT_TEXT = 'text',
Expand Down Expand Up @@ -70,7 +74,7 @@ const PasswordField: ForwardRefExoticComponent<TextFieldProps> & WithWrapperProp
return (
<MuiTextField
ref={ref}
type={showPassword ? TextFieldInputTypes.INPUT_TEXT : TextFieldInputTypes.INPUT_PASSWORD}
type={showPassword ? 'text' : 'password'}
InputProps={{
endAdornment: (
<InputAdornment position="end">
Expand Down

0 comments on commit a63a8c1

Please sign in to comment.