68 lines
1.5 KiB
JavaScript
68 lines
1.5 KiB
JavaScript
import BaseStyle from 'primevue/base/style';
|
|
|
|
const theme = ({ dt }) => `
|
|
.p-floatlabel {
|
|
display: block;
|
|
position: relative;
|
|
}
|
|
|
|
.p-floatlabel label {
|
|
position: absolute;
|
|
pointer-events: none;
|
|
top: 50%;
|
|
margin-top: -.5rem;
|
|
transition-property: all;
|
|
transition-timing-function: ease;
|
|
line-height: 1;
|
|
left: 0.75rem;
|
|
color: ${dt('floatlabel.color')};
|
|
transition-duration: ${dt('floatlabel.transition.duration')};
|
|
}
|
|
|
|
.p-floatlabel:has(textarea) label {
|
|
top: 1rem;
|
|
}
|
|
|
|
.p-floatlabel:has(input:focus) label,
|
|
.p-floatlabel:has(input.p-filled) label,
|
|
.p-floatlabel:has(input:-webkit-autofill) label,
|
|
.p-floatlabel:has(textarea:focus) label,
|
|
.p-floatlabel:has(textarea.p-filled) label,
|
|
.p-floatlabel:has(.p-inputwrapper-focus) label,
|
|
.p-floatlabel:has(.p-inputwrapper-filled) label {
|
|
top: -.75rem;
|
|
font-size: 12px;
|
|
color: ${dt('floatlabel.focus.color')};
|
|
}
|
|
|
|
.p-floatlabel .p-placeholder,
|
|
.p-floatlabel input::placeholder,
|
|
.p-floatlabel .p-inputtext::placeholder {
|
|
opacity: 0;
|
|
transition-property: all;
|
|
transition-timing-function: ease;
|
|
}
|
|
|
|
.p-floatlabel .p-focus .p-placeholder,
|
|
.p-floatlabel input:focus::placeholder,
|
|
.p-floatlabel .p-inputtext:focus::placeholder {
|
|
opacity: 1;
|
|
transition-property: all;
|
|
transition-timing-function: ease;
|
|
}
|
|
|
|
.p-floatlabel > .p-invalid + label {
|
|
color: ${dt('floatlabel.invalid.color')};
|
|
}
|
|
`;
|
|
|
|
const classes = {
|
|
root: 'p-floatlabel'
|
|
};
|
|
|
|
export default BaseStyle.extend({
|
|
name: 'floatlabel',
|
|
theme,
|
|
classes
|
|
});
|