pico/scss/forms/_input-range.scss

95 lines
1.9 KiB
SCSS
Raw Normal View History

2022-10-22 13:11:51 +07:00
@use "../settings" as *;
2022-10-22 11:44:10 +07:00
/**
* Input type range
*/
[type="range"] {
// Config
$height-track: 0.25rem;
$height-thumb: 1.25rem;
$border-thumb: 2px;
// Styles
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
width: 100%;
height: $height-thumb;
background: none;
// Slider Track
@mixin slider-track {
width: 100%;
height: $height-track;
2022-10-22 13:11:51 +07:00
border-radius: var(#{$}border-radius);
background-color: var(#{$}range-border-color);
2022-10-22 11:44:10 +07:00
2022-10-22 13:11:51 +07:00
@if $enable-transitions {
transition: background-color var(#{$}transition), box-shadow var(#{$}transition);
2022-10-22 11:44:10 +07:00
}
}
&::-webkit-slider-runnable-track {
@include slider-track;
}
&::-moz-range-track {
@include slider-track;
}
&::-ms-track {
@include slider-track;
}
// Slider Thumb
@mixin slider-thumb {
-webkit-appearance: none;
width: $height-thumb;
height: $height-thumb;
margin-top: #{(-($height-thumb * 0.5) + ($height-track * 0.5))};
2022-10-22 13:11:51 +07:00
border: $border-thumb solid var(#{$}range-thumb-border-color);
2022-10-22 11:44:10 +07:00
border-radius: 50%;
2022-10-22 13:11:51 +07:00
background-color: var(#{$}range-thumb-color);
2022-10-22 11:44:10 +07:00
cursor: pointer;
2022-10-22 13:11:51 +07:00
@if $enable-transitions {
transition: background-color var(#{$}transition), transform var(#{$}transition);
2022-10-22 11:44:10 +07:00
}
}
&::-webkit-slider-thumb {
@include slider-thumb;
}
&::-moz-range-thumb {
@include slider-thumb;
}
&::-ms-thumb {
@include slider-thumb;
}
&:hover,
&:focus {
2022-10-22 13:11:51 +07:00
#{$✨}range-border-color: var(#{$}range-active-border-color);
#{$✨}range-thumb-color: var(#{$}range-thumb-hover-color);
2022-10-22 11:44:10 +07:00
}
&:active {
2022-10-22 13:11:51 +07:00
#{$✨}range-thumb-color: var(#{$}range-thumb-active-color);
2022-10-22 11:44:10 +07:00
// Slider Thumb
&::-webkit-slider-thumb {
transform: scale(1.25);
}
&::-moz-range-thumb {
transform: scale(1.25);
}
&::-ms-thumb {
transform: scale(1.25);
}
}
}