Skip to content

Commit

Permalink
fix(PasswordInput): tooltip issue in show password label or hide pass…
Browse files Browse the repository at this point in the history
…word label (#17103)

* fix: show warning if showPasswordLabel or hidePasswordLabel is blank

* fix: show warning if showPasswordLabel or hidePasswordLabel is blank
  • Loading branch information
preetibansalui authored Aug 5, 2024
1 parent 796f838 commit aa7b805
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/react/src/components/TextInput/PasswordInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
<>
<input
Expand All @@ -349,6 +354,7 @@ const PasswordInput = React.forwardRef(function PasswordInput(
data-toggle-password-visibility={inputType === 'password'}
/>
{isFluid && <hr className={`${prefix}--text-input__divider`} />}

<Tooltip
align={align}
className={`${prefix}--toggle-password-tooltip`}
Expand Down
6 changes: 5 additions & 1 deletion packages/styles/scss/components/text-input/_text-input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@
}

.#{$prefix}--toggle-password-tooltip .#{$prefix}--popover {
inset-inline-start: -(convert.to-rem(40px));
inset-inline-start: -($spacing-08);
}

.#{$prefix}--toggle-password-tooltip .#{$prefix}--popover-content {
min-inline-size: $spacing-08;
}

.#{$prefix}--text-input--sm
Expand Down

0 comments on commit aa7b805

Please sign in to comment.