From a63a8c18729a0eb914b4485139554772ed933db1 Mon Sep 17 00:00:00 2001 From: Brion Date: Fri, 11 Oct 2024 14:19:49 +0530 Subject: [PATCH] fix(react): deprecate troublesome enums --- packages/react/src/components/IconButton/IconButton.tsx | 6 +++++- packages/react/src/components/TextField/TextField.tsx | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/react/src/components/IconButton/IconButton.tsx b/packages/react/src/components/IconButton/IconButton.tsx index 3dedb456..aa284eff 100644 --- a/packages/react/src/components/IconButton/IconButton.tsx +++ b/packages/react/src/components/IconButton/IconButton.tsx @@ -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', @@ -43,7 +47,7 @@ export type IconButtonProps< /** * The variant of the icon button. */ - variant?: IconButtonVariants; + variant?: IconButtonVariants | 'contained' | 'text'; } & Omit, 'component'>; const COMPONENT_NAME: string = 'IconButton'; diff --git a/packages/react/src/components/TextField/TextField.tsx b/packages/react/src/components/TextField/TextField.tsx index 68441096..c9af91a4 100644 --- a/packages/react/src/components/TextField/TextField.tsx +++ b/packages/react/src/components/TextField/TextField.tsx @@ -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', @@ -70,7 +74,7 @@ const PasswordField: ForwardRefExoticComponent & WithWrapperProp return (