feat(progress-bar): update styles to iOS 17 specs (#28759)
Issue number: Internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Ionic's progress bar implementation deviates from the appearance of a progress bar on iOS 17. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Progress bar is updated to have rounded corners (around the container). - Increases progress bar height to `4px` - Solid progress bars (progress bars with a buffer value of `1`) will have a consistent background appearance. - Buffer progress bars will continue to have the colored background appearance as they do in v7. ## Does this introduce a breaking change? - [x] Yes - [ ] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer for more information. --> ### Breaking Changes - `--buffer-background` has been removed in favor of `--background`. ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Accomplishing rounded caps for the inner progress with Ionic's scale transformation was not viable. To maintain 60fps animations for the progress, rounded corners were applied to the container. --------- Co-authored-by: ionitron <hi@ionicframework.com> Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
@ -1,8 +1,22 @@
|
||||
@import "./progress-bar";
|
||||
@import "./progress-bar.ios.vars";
|
||||
|
||||
// iOS Progress bar
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
height: 3px;
|
||||
@include border-radius($progress-bar-ios-border-radius);
|
||||
|
||||
height: $progress-bar-ios-height;
|
||||
}
|
||||
|
||||
:host(.progress-bar-solid) {
|
||||
/**
|
||||
* On iOS the unfilled portion of the progress bar
|
||||
* is always a consistent background color. We
|
||||
* only apply this style when the progress bar is
|
||||
* solid (with a buffer value of 1). This maintains
|
||||
* the custom Ionic appearance for a buffered progress bar.
|
||||
*/
|
||||
--background: #{$background-color-step-100};
|
||||
}
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
// iOS Progress bar
|
||||
// --------------------------------------------------
|
||||
|
||||
/// @prop - Height of the progress bar
|
||||
$progress-bar-ios-height: 4px !default;
|
||||
|
||||
/// @prop - Border radius of the progress bar container
|
||||
$progress-bar-ios-border-radius: 9999px !default;
|
||||
@ -1,8 +1,14 @@
|
||||
@import "./progress-bar";
|
||||
@import "./progress-bar.md.vars";
|
||||
|
||||
// Material Design Progress bar
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
height: 4px;
|
||||
height: $progress-bar-md-height;
|
||||
}
|
||||
|
||||
|
||||
:host(.ion-color) .progress-buffer-bar {
|
||||
background: #{current-color(base, 0.3)};
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
// MD Progress bar
|
||||
// --------------------------------------------------
|
||||
|
||||
/// @prop - Height of the progress bar
|
||||
$progress-bar-md-height: 4px !default;
|
||||
@ -8,11 +8,9 @@
|
||||
/**
|
||||
* @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;
|
||||
|
||||
@ -75,7 +73,7 @@
|
||||
}
|
||||
|
||||
.progress-buffer-bar {
|
||||
background: var(--buffer-background);
|
||||
background: var(--background);
|
||||
|
||||
z-index: 1;
|
||||
}
|
||||
@ -123,7 +121,7 @@
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
.buffer-circles {
|
||||
background-image: radial-gradient(ellipse at center, var(--buffer-background) 0%, var(--buffer-background) 30%, transparent 30%);
|
||||
background-image: radial-gradient(ellipse at center, var(--background) 0%, var(--background) 30%, transparent 30%);
|
||||
|
||||
/* stylelint-disable property-disallowed-list */
|
||||
background-repeat: repeat-x;
|
||||
@ -158,10 +156,6 @@
|
||||
// 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%);
|
||||
}
|
||||
|
||||
@ -59,6 +59,8 @@ export class ProgressBar implements ComponentInterface {
|
||||
const { color, type, reversed, value, buffer } = this;
|
||||
const paused = config.getBoolean('_testing');
|
||||
const mode = getIonMode(this);
|
||||
// If the progress is displayed as a solid bar.
|
||||
const progressSolid = buffer === 1;
|
||||
return (
|
||||
<Host
|
||||
role="progressbar"
|
||||
@ -70,6 +72,7 @@ export class ProgressBar implements ComponentInterface {
|
||||
[`progress-bar-${type}`]: true,
|
||||
'progress-paused': paused,
|
||||
'progress-bar-reversed': document.dir === 'rtl' ? !reversed : reversed,
|
||||
'progress-bar-solid': progressSolid,
|
||||
})}
|
||||
>
|
||||
{type === 'indeterminate' ? renderIndeterminate() : renderProgress(value, buffer)}
|
||||
|
||||
@ -15,11 +15,11 @@
|
||||
|
||||
<style>
|
||||
.custom-bar-background {
|
||||
--buffer-background: red;
|
||||
--background: red;
|
||||
}
|
||||
|
||||
.no-bar-background {
|
||||
--buffer-background: none;
|
||||
--background: none;
|
||||
}
|
||||
|
||||
ion-content ion-progress-bar {
|
||||
|
||||
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 45 KiB |
@ -14,14 +14,6 @@
|
||||
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
|
||||
|
||||
<style>
|
||||
.custom-bar-background {
|
||||
--buffer-background: red;
|
||||
}
|
||||
|
||||
.no-bar-background {
|
||||
--buffer-background: none;
|
||||
}
|
||||
|
||||
ion-content ion-progress-bar {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
@ -15,11 +15,11 @@
|
||||
|
||||
<style>
|
||||
.custom-bar-background {
|
||||
--buffer-background: red;
|
||||
--background: red;
|
||||
}
|
||||
|
||||
.no-bar-background {
|
||||
--buffer-background: none;
|
||||
--background: none;
|
||||
}
|
||||
|
||||
ion-content ion-progress-bar {
|
||||
|
||||