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-knob-range {
|
|
|
|
fill: none;
|
|
|
|
transition: stroke 0.1s ease-in;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-knob-value {
|
|
|
|
animation-name: p-knob-dash-frame;
|
|
|
|
animation-fill-mode: forwards;
|
|
|
|
fill: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-knob-text {
|
|
|
|
font-size: 1.3rem;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-knob svg {
|
2024-05-06 21:18:22 +00:00
|
|
|
border-radius: ${dt('border.radius.md')};
|
2024-05-01 08:26:48 +00:00
|
|
|
outline-color: transparent;
|
2024-05-25 08:18:55 +00:00
|
|
|
transition: outline-color ${dt('knob.transition.duration')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
.p-knob svg:focus-visible {
|
|
|
|
outline: ${dt('focus.ring.width')} ${dt('focus.ring.style')} ${dt('focus.ring.color')};
|
|
|
|
outline-offset: ${dt('focus.ring.offset')};
|
|
|
|
}
|
|
|
|
|
|
|
|
@keyframes p-knob-dash-frame {
|
|
|
|
100% {
|
|
|
|
stroke-dashoffset: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2023-10-02 10:46:09 +00:00
|
|
|
const classes = {
|
|
|
|
root: ({ props }) => ['p-knob p-component', { 'p-disabled': props.disabled }],
|
|
|
|
range: 'p-knob-range',
|
|
|
|
value: 'p-knob-value',
|
2024-05-03 12:23:10 +00:00
|
|
|
text: 'p-knob-text'
|
2023-10-02 10:46:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'knob',
|
2024-05-01 08:26:48 +00:00
|
|
|
theme,
|
2023-10-02 10:46:09 +00:00
|
|
|
classes
|
|
|
|
});
|