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-slider {
|
|
|
|
position: relative;
|
|
|
|
background: ${dt('slider.track.background')};
|
2024-05-08 12:27:02 +00:00
|
|
|
border-radius: ${dt('slider.border.radius')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-slider-handle {
|
|
|
|
cursor: grab;
|
|
|
|
touch-action: none;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
2024-05-08 12:27:02 +00:00
|
|
|
height: ${dt('slider.handle.height')};
|
|
|
|
width: ${dt('slider.handle.width')};
|
2024-05-01 08:26:48 +00:00
|
|
|
background: ${dt('slider.handle.background')};
|
2024-05-08 12:27:02 +00:00
|
|
|
border-radius: ${dt('slider.handle.border.radius')};
|
2024-05-26 21:38:39 +00:00
|
|
|
transition: background ${dt('slider.transition.duration')}, color ${dt('slider.transition.duration')}, border-color ${dt('slider.transition.duration')}, box-shadow ${dt('slider.transition.duration')}, outline-color ${dt(
|
|
|
|
'slider.transition.duration'
|
|
|
|
)};
|
2024-05-01 08:26:48 +00:00
|
|
|
outline-color: transparent;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-slider-handle::before {
|
|
|
|
content: "";
|
2024-05-08 12:27:02 +00:00
|
|
|
width: ${dt('slider.handle.content.width')};
|
|
|
|
height: ${dt('slider.handle.content.height')};
|
2024-05-01 08:26:48 +00:00
|
|
|
display: block;
|
2024-05-08 12:27:02 +00:00
|
|
|
background: ${dt('slider.handle.content.background')};
|
|
|
|
border-radius: ${dt('slider.handle.content.border.radius')};
|
|
|
|
box-shadow: ${dt('slider.handle.content.shadow')};
|
2024-05-25 08:18:55 +00:00
|
|
|
transition: background ${dt('slider.transition.duration')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-slider:not(.p-disabled) .p-slider-handle:hover {
|
|
|
|
background: ${dt('slider.handle.hover.background')};
|
2024-05-08 12:27:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-slider:not(.p-disabled) .p-slider-handle:hover::before {
|
|
|
|
background: ${dt('slider.handle.content.hover.background')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-slider-handle:focus-visible {
|
2024-05-08 12:27:02 +00:00
|
|
|
border-color: ${dt('slider.handle.focus.border.color')};
|
|
|
|
box-shadow: ${dt('slider.handle.focus.ring.shadow')};
|
|
|
|
outline: ${dt('slider.handle.focus.ring.width')} ${dt('slider.handle.focus.ring.style')} ${dt('slider.handle.focus.ring.color')};
|
|
|
|
outline-offset: ${dt('slider.handle.focus.ring.offset')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-slider-range {
|
|
|
|
display: block;
|
|
|
|
background: ${dt('slider.range.background')};
|
2024-05-08 12:27:02 +00:00
|
|
|
border-radius: ${dt('slider.border.radius')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-slider.p-slider-horizontal {
|
2024-05-08 12:27:02 +00:00
|
|
|
height: ${dt('slider.track.size')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-slider-horizontal .p-slider-range {
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-slider-horizontal .p-slider-handle {
|
|
|
|
top: 50%;
|
2024-05-08 12:27:02 +00:00
|
|
|
margin-top: calc(-1 * calc(${dt('slider.handle.height')} / 2));
|
|
|
|
margin-left: calc(-1 * calc(${dt('slider.handle.width')} / 2));
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-slider-vertical {
|
2024-05-08 12:27:02 +00:00
|
|
|
min-height: 100px;
|
2024-05-21 22:30:28 +00:00
|
|
|
width: ${dt('slider.track.size')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-slider-vertical .p-slider-handle {
|
|
|
|
left: 50%;
|
2024-05-08 12:27:02 +00:00
|
|
|
margin-left: calc(-1 * calc(${dt('slider.handle.width')} / 2));
|
|
|
|
margin-bottom: calc(-1 * calc(${dt('slider.handle.height')} / 2));
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-slider-vertical .p-slider-range {
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2023-10-02 10:46:09 +00:00
|
|
|
const inlineStyles = {
|
|
|
|
handle: { position: 'absolute' },
|
|
|
|
range: { position: 'absolute' }
|
|
|
|
};
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
root: ({ props }) => [
|
|
|
|
'p-slider p-component',
|
|
|
|
{
|
|
|
|
'p-disabled': props.disabled,
|
|
|
|
'p-slider-horizontal': props.orientation === 'horizontal',
|
|
|
|
'p-slider-vertical': props.orientation === 'vertical'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
range: 'p-slider-range',
|
|
|
|
handle: 'p-slider-handle'
|
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'slider',
|
2024-05-01 08:26:48 +00:00
|
|
|
theme,
|
2023-10-02 10:46:09 +00:00
|
|
|
classes,
|
|
|
|
inlineStyles
|
|
|
|
});
|