pico/scss/components/_progress.scss

86 lines
2.0 KiB
SCSS
Raw Normal View History

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