pico/scss/components/_progress.scss

95 lines
2.4 KiB
SCSS
Raw Normal View History

2022-10-23 10:47:50 +07:00
@use "sass:map";
2022-10-22 13:11:51 +07:00
@use "../settings" as *;
2022-10-23 10:47:50 +07:00
@if map.get($modules, "components/progress") {
/**
* Progress
*/
2020-09-30 10:28:06 +07:00
2022-10-23 10:47:50 +07:00
// Reboot based on :
// - normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css
// - sanitize.css v13.0.0 | CC0 1.0 Universal | github.com/csstools/sanitize.css
//
2020-09-30 10:28:06 +07:00
2022-10-23 10:47:50 +07:00
// 1. Add the correct display in Edge 18- and IE
// 2. Add the correct vertical alignment in Chrome, Edge, and Firefox
progress {
display: inline-block; // 1
vertical-align: baseline; // 2
}
2020-09-30 10:28:06 +07:00
2022-10-23 10:47:50 +07:00
// Pico
//
2021-07-02 16:54:41 +07:00
2022-10-23 10:47:50 +07:00
progress {
// Reset the default appearance
-webkit-appearance: none;
-moz-appearance: none;
2020-09-30 10:28:06 +07:00
2022-10-23 10:47:50 +07:00
// Styles
display: inline-block;
appearance: none;
width: 100%;
height: 0.5rem;
margin-bottom: calc(var(#{$}spacing) * 0.5);
overflow: hidden;
2020-09-30 10:28:06 +07:00
2022-10-23 10:47:50 +07:00
// Remove Firefox and Opera border
border: 0;
border-radius: var(#{$}border-radius);
background-color: var(#{$}progress-background-color);
2020-09-30 10:28:06 +07:00
2022-10-23 10:47:50 +07:00
// IE10 uses `color` to set the bar background-color
color: var(#{$}progress-color);
2020-09-30 10:28:06 +07:00
2022-10-23 10:47:50 +07:00
&::-webkit-progress-bar {
border-radius: var(#{$}border-radius);
background: none;
}
&[value]::-webkit-progress-value {
background-color: var(#{$}progress-color);
}
&::-moz-progress-bar {
background-color: var(#{$}progress-color);
}
2020-09-30 10:28:06 +07:00
2022-10-23 10:47:50 +07:00
// Indeterminate state
@media (prefers-reduced-motion: no-preference) {
&:indeterminate {
background: var(#{$}progress-background-color)
linear-gradient(
to right,
var(#{$}progress-color) 30%,
var(#{$}progress-background-color) 30%
)
top left / 150% 150% no-repeat;
animation: progress-indeterminate 1s linear infinite;
2020-09-30 10:28:06 +07:00
2022-10-23 10:47:50 +07:00
&[value]::-webkit-progress-value {
background-color: transparent;
}
&::-moz-progress-bar {
background-color: transparent;
}
}
2020-09-30 10:28:06 +07:00
}
}
2022-10-23 10:47:50 +07:00
[dir="rtl"] {
@media (prefers-reduced-motion: no-preference) {
progress:indeterminate {
animation-direction: reverse;
}
2022-02-06 10:25:10 +07:00
}
}
2022-10-23 10:47:50 +07:00
@keyframes progress-indeterminate {
0% {
background-position: 200% 0;
}
100% {
background-position: -200% 0;
}
2020-09-30 10:28:06 +07:00
}
2022-10-15 23:22:12 +07:00
}