diff --git a/core/api.txt b/core/api.txt index 77c6bf1bc5..65efcba081 100644 --- a/core/api.txt +++ b/core/api.txt @@ -844,6 +844,9 @@ ion-progress-bar,prop,value,number,0,false,false ion-progress-bar,css-prop,--background ion-progress-bar,css-prop,--buffer-background ion-progress-bar,css-prop,--progress-background +ion-progress-bar,part,progress +ion-progress-bar,part,stream +ion-progress-bar,part,track ion-radio,shadow ion-radio,prop,color,string | undefined,undefined,false,false diff --git a/core/src/components/progress-bar/progress-bar.scss b/core/src/components/progress-bar/progress-bar.scss index e9904e1d23..d9bc8dfe0c 100644 --- a/core/src/components/progress-bar/progress-bar.scss +++ b/core/src/components/progress-bar/progress-bar.scss @@ -1,18 +1,19 @@ @import "../../themes/ionic.globals"; // Progress bar -// -------------------------------------------------- -// Host has no background by default - this will be added to the progress-buffer-bar +// ------------------------------------------------------------------------ +// Host has no background by default - this will be added to the progress-buffer-bar :host { /** - * @prop --background: Same as --buffer-background when using a determinate progress bar, otherwise it styles the background of the ion-progress-bar itself. - * @prop --progress-background: Color of the progress bar - * @prop --buffer-background: Color of the buffer bar - */ + * @prop --background: Background of the progress track, or the buffer bar if `buffer` is set + * @prop --progress-background: Background of the progress bar representing the current value + * @prop --buffer-background: DEPRECATED, use `--background` instead + */ --background: #{ion-color(primary, base, 0.3)}; --progress-background: #{ion-color(primary, base)}; --buffer-background: var(--background); + display: block; position: relative; @@ -25,16 +26,6 @@ overflow: hidden; } -:host(.ion-color) { - --progress-background: #{current-color(base)}; - --buffer-background: #{current-color(base, 0.3)}; -} - -// indeterminate has no progress-buffer-bar, so it will be added to the host -:host(.progress-bar-indeterminate) { - background: var(--buffer-background); -} - .progress, .progress-indeterminate, .indeterminate-bar-primary, @@ -128,27 +119,33 @@ } } -// Buffer style -// -------------------------------------------------- +// Progress Bar: Buffer Circles +// ------------------------------------------------------------------------ .buffer-circles { - background: radial-gradient(ellipse at center, var(--buffer-background) 0%, var(--buffer-background) 30%, transparent 30%) repeat-x 5px center; + background-image: radial-gradient(ellipse at center, var(--buffer-background) 0%, var(--buffer-background) 30%, transparent 30%); + + /* stylelint-disable property-blacklist */ + background-repeat: repeat-x; + background-position: 5px center; background-size: 10px 10px; + /* stylelint-enable property-blacklist */ z-index: 0; animation: buffering 450ms infinite linear; } +// Progress Bar: Reversed +// ------------------------------------------------------------------------ // If reversed is set to true, the animation will be reversed -// and the bars starting at the top right -// -------------------------------------------------- +// and the bar will start at the top right :host(.progress-bar-reversed) { transform: scaleX(-1); } -// Progress paused -// -------------------------------------------------- +// Progress Bar: Paused +// ------------------------------------------------------------------------ :host(.progress-paused) { .indeterminate-bar-secondary, @@ -158,8 +155,27 @@ } } -// Animation Keyframes -// -------------------------------------------------- +// Progress Bar: Color +// ------------------------------------------------------------------------ + +:host(.ion-color) .progress-buffer-bar { + background: #{current-color(base, 0.3)}; +} + +:host(.ion-color) .buffer-circles { + background-image: radial-gradient(ellipse at center, #{current-color(base, 0.3)} 0%, #{current-color(base, 0.3)} 30%, transparent 30%); +} + +:host(.ion-color) { + .progress, + .progress-indeterminate { + background: #{current-color(base)}; + } +} + + +// Progress Bar: Animation Keyframes +// ------------------------------------------------------------------------ // Source: https://github.com/material-components/material-components-web/blob/master/packages/mdc-linear-progress/_keyframes.scss @keyframes primary-indeterminate-translate { @@ -259,3 +275,4 @@ transform: translateX(-10px); } } + diff --git a/core/src/components/progress-bar/progress-bar.tsx b/core/src/components/progress-bar/progress-bar.tsx index 20d05d0e66..a7cd34a884 100644 --- a/core/src/components/progress-bar/progress-bar.tsx +++ b/core/src/components/progress-bar/progress-bar.tsx @@ -8,6 +8,11 @@ import { createColorClasses } from '../../utils/theme'; /** * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use. + * + * @part progress - The progress bar that shows the current value when `type` is `"determinate"` and slides back and forth when `type` is `"indeterminate"`. + * @part stream - The animated circles that appear while buffering. This only shows when `buffer` is set and `type` is `"determinate"`. + * @part track - The track bar behind the progress bar. If the `buffer` property is set and `type` is `"determinate"` the track will be the + * width of the `buffer` value. */ @Component({ tag: 'ion-progress-bar', @@ -77,10 +82,12 @@ export class ProgressBar implements ComponentInterface { } const renderIndeterminate = () => { - return [ -
, - - ]; + return ( + + ); }; const renderProgress = (value: number, buffer: number) => { @@ -88,7 +95,7 @@ const renderProgress = (value: number, buffer: number) => { const finalBuffer = clamp(0, buffer, 1); return [ - , + , /** * Buffer circles with two container to move * the circles behind the buffer progress @@ -98,9 +105,9 @@ const renderProgress = (value: number, buffer: number) => { */