From 2b817044b137c41405ca4e40ea4f3276022e7392 Mon Sep 17 00:00:00 2001 From: Preeti Bansal Date: Mon, 5 Aug 2024 12:40:52 +0530 Subject: [PATCH 1/2] fix: show warning if showPasswordLabel or hidePasswordLabel is blank --- .../react/src/components/TextInput/PasswordInput.stories.js | 2 ++ packages/react/src/components/TextInput/PasswordInput.tsx | 6 ++++++ packages/styles/scss/components/text-input/_text-input.scss | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/react/src/components/TextInput/PasswordInput.stories.js b/packages/react/src/components/TextInput/PasswordInput.stories.js index db89614d0bc0..0180ab4f2e2c 100644 --- a/packages/react/src/components/TextInput/PasswordInput.stories.js +++ b/packages/react/src/components/TextInput/PasswordInput.stories.js @@ -37,6 +37,8 @@ export const Playground = (args) => ( labelText="Text input label" helperText="Optional help text" autoComplete="true" + hidePasswordLabel="sssfdfddcff dfdfdf" + showPasswordLabel="" /> ); diff --git a/packages/react/src/components/TextInput/PasswordInput.tsx b/packages/react/src/components/TextInput/PasswordInput.tsx index d14ca95769b4..611bee4df11f 100644 --- a/packages/react/src/components/TextInput/PasswordInput.tsx +++ b/packages/react/src/components/TextInput/PasswordInput.tsx @@ -329,6 +329,11 @@ const PasswordInput = React.forwardRef(function PasswordInput( if (tooltipPosition === 'right' || tooltipPosition === 'left') { align = tooltipPosition; } + if (!hidePasswordLabel || hidePasswordLabel.trim() === '') { + console.warn('Warning: The "hidePasswordLabel" should not be blank.'); + } else if (!showPasswordLabel || showPasswordLabel.trim() === '') { + console.warn('Warning: The "showPasswordLabel" should not be blank.'); + } const input = ( <> {isFluid &&
} + Date: Mon, 5 Aug 2024 12:41:42 +0530 Subject: [PATCH 2/2] fix: show warning if showPasswordLabel or hidePasswordLabel is blank --- .../react/src/components/TextInput/PasswordInput.stories.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/react/src/components/TextInput/PasswordInput.stories.js b/packages/react/src/components/TextInput/PasswordInput.stories.js index 0180ab4f2e2c..db89614d0bc0 100644 --- a/packages/react/src/components/TextInput/PasswordInput.stories.js +++ b/packages/react/src/components/TextInput/PasswordInput.stories.js @@ -37,8 +37,6 @@ export const Playground = (args) => ( labelText="Text input label" helperText="Optional help text" autoComplete="true" - hidePasswordLabel="sssfdfddcff dfdfdf" - showPasswordLabel="" /> );