2023-10-02 10:46:09 +00:00
|
|
|
import BaseStyle from 'primevue/base/style';
|
|
|
|
|
2024-05-01 08:26:48 +00:00
|
|
|
const theme = ({ dt }) => `
|
|
|
|
.p-password {
|
|
|
|
display: inline-flex;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-password .p-password-overlay {
|
|
|
|
min-width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-password-meter {
|
2024-05-08 11:42:10 +00:00
|
|
|
height: ${dt('password.meter.height')};
|
2024-05-01 08:26:48 +00:00
|
|
|
background: ${dt('password.meter.border.color')};
|
2024-05-08 11:42:10 +00:00
|
|
|
border-radius: ${dt('password.meter.border.radius')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
2024-05-06 13:10:13 +00:00
|
|
|
.p-password-meter-label {
|
2024-05-01 08:26:48 +00:00
|
|
|
height: 100%;
|
|
|
|
width: 0;
|
|
|
|
transition: width 1s ease-in-out;
|
2024-05-08 11:42:10 +00:00
|
|
|
border-radius: ${dt('password.meter.border.radius')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-password-meter-weak {
|
|
|
|
background: ${dt('password.strength.weak.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-password-meter-medium {
|
|
|
|
background: ${dt('password.strength.medium.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-password-meter-strong {
|
|
|
|
background: ${dt('password.strength.strong.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-fluid .p-password {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-password-input::-ms-reveal,
|
|
|
|
.p-password-input::-ms-clear {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-password-overlay {
|
2024-05-08 11:42:10 +00:00
|
|
|
padding: ${dt('password.overlay.padding')};
|
2024-05-01 08:26:48 +00:00
|
|
|
background: ${dt('password.overlay.background')};
|
|
|
|
color: ${dt('password.overlay.color')};
|
|
|
|
border: 1px solid ${dt('password.overlay.border.color')};
|
2024-05-08 11:42:10 +00:00
|
|
|
box-shadow: ${dt('password.overlay.shadow')};
|
|
|
|
border-radius: ${dt('password.overlay.border.radius')};
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
gap: ${dt('password.overlay.gap')}
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-password-toggle-mask-icon {
|
2024-05-08 11:42:10 +00:00
|
|
|
right: ${dt('form.field.padding.x')};
|
2024-05-01 08:26:48 +00:00
|
|
|
color: ${dt('password.icon.color')};
|
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
2024-05-08 11:42:10 +00:00
|
|
|
margin-top: calc(-1 * calc(${dt('icon.size')} / 2));
|
|
|
|
width: ${dt('icon.size')};
|
|
|
|
height: ${dt('icon.size')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-password:has(.p-password-toggle-mask-icon) .p-password-input {
|
2024-05-08 11:42:10 +00:00
|
|
|
padding-right: calc((${dt('form.field.padding.x')} * 2) + ${dt('icon.size')});
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2023-10-02 10:46:09 +00:00
|
|
|
const inlineStyles = {
|
|
|
|
root: ({ props }) => ({ position: props.appendTo === 'self' ? 'relative' : undefined })
|
|
|
|
};
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
root: ({ instance, props }) => [
|
|
|
|
'p-password p-component p-inputwrapper',
|
|
|
|
{
|
|
|
|
'p-inputwrapper-filled': instance.filled,
|
2024-04-07 10:51:31 +00:00
|
|
|
'p-inputwrapper-focus': instance.focused
|
2023-10-02 10:46:09 +00:00
|
|
|
}
|
|
|
|
],
|
2024-05-22 17:19:16 +00:00
|
|
|
pcInput: 'p-password-input',
|
2024-05-03 20:26:53 +00:00
|
|
|
maskIcon: 'p-password-toggle-mask-icon p-password-mask-icon',
|
|
|
|
unmaskIcon: 'p-password-toggle-mask-icon p-password-unmask-icon',
|
2024-05-08 15:58:22 +00:00
|
|
|
overlay: 'p-password-overlay p-component',
|
2023-10-02 10:46:09 +00:00
|
|
|
meter: 'p-password-meter',
|
2024-05-06 13:10:13 +00:00
|
|
|
meterLabel: ({ instance }) => `p-password-meter-label ${instance.meter ? 'p-password-meter-' + instance.meter.strength : ''}`,
|
|
|
|
meterText: 'p-password-meter-text'
|
2023-10-02 10:46:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'password',
|
2024-05-01 08:26:48 +00:00
|
|
|
theme,
|
2023-10-02 10:46:09 +00:00
|
|
|
classes,
|
|
|
|
inlineStyles
|
|
|
|
});
|