Skip to content

Commit

Permalink
Fix #5905: Password icon classes and cursor:pointer (#5912)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Feb 6, 2024
1 parent bc3853e commit 53c9072
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
27 changes: 23 additions & 4 deletions components/lib/password/Password.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,32 @@ export const Password = React.memo(
const createIcon = () => {
let icon;

const hideIconProps = mergeProps(ptm('hideIcon'));
const showIconProps = mergeProps(ptm('showIcon'));
const hideIconProps = mergeProps(
{
key: 'hideIcon',
role: 'button',
tabIndex: props.tabIndex,
className: cx('hideIcon'),
onClick: toggleMask
},
ptm('hideIcon')
);

const showIconProps = mergeProps(
{
key: 'showIcon',
role: 'button',
tabIndex: props.tabIndex,
className: cx('showIcon'),
onClick: toggleMask
},
ptm('showIcon')
);

if (unmaskedState) {
icon = props.hideIcon || <EyeSlashIcon {...hideIconProps} onClick={toggleMask} />;
icon = props.hideIcon || <EyeSlashIcon {...hideIconProps} />;
} else {
icon = props.showIcon || <EyeIcon {...showIconProps} onClick={toggleMask} />;
icon = props.showIcon || <EyeIcon {...showIconProps} />;
}

const eyeIcon = IconUtils.getJSXIcon(icon, unmaskedState ? { ...hideIconProps } : { ...showIconProps }, { props });
Expand Down
8 changes: 8 additions & 0 deletions components/lib/password/PasswordBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const classes = {
meter: 'p-password-meter',
meterLabel: ({ strength }) => classNames('p-password-strength', strength),
info: ({ strength }) => classNames('p-password-info', strength),
showIcon: 'p-password-show-icon',
hideIcon: 'p-password-hide-icon',
transition: 'p-connected-overlay'
};

Expand Down Expand Up @@ -60,6 +62,12 @@ const styles = `
.p-password-input::-ms-clear {
display: none;
}
.p-password .p-password-show-icon,
.p-password .p-password-hide-icon {
line-height: 1.5;
cursor: pointer;
}
}
`;

Expand Down

0 comments on commit 53c9072

Please sign in to comment.