Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(progress-bar): update styles to iOS 17 specs #28759

Merged
merged 18 commits into from Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion BREAKING.md
Expand Up @@ -19,6 +19,7 @@ This is a comprehensive list of the breaking changes introduced in the major ver
- [Content](#version-8x-content)
- [Datetime](#version-8x-datetime)
- [Picker](#version-8x-picker)
- [Progress bar](#version-8x-progress-bar)

<h2 id="version-8x-browser-platform-support">Browser and Platform Support</h2>

Expand Down Expand Up @@ -70,4 +71,9 @@ This section details the desktop browser, JavaScript framework, and mobile platf

- `ion-picker` and `ion-picker-column` have been renamed to `ion-picker-legacy` and `ion-picker-legacy-column`, respectively. This change was made to accommodate the new inline picker component while allowing developers to continue to use the legacy picker during this migration period.
- Only the component names have been changed. Usages such as `ion-picker` or `IonPicker` should be changed to `ion-picker-legacy` and `IonPickerLegacy`, respectively.
- Non-component usages such as `pickerController` or `useIonPicker` remain unchanged. The new picker displays inline with your page content and does not have equivalents for these non-component usages.
- Non-component usages such as `pickerController` or `useIonPicker` remain unchanged. The new picker displays inline with your page content and does not have equivalents for these non-component usages.


<h4 id="version-8x-progress-bar">Progress bar</h4>

- The `--buffer-background` CSS variable has been removed. Use `--background` instead.
1 change: 0 additions & 1 deletion core/api.txt
Expand Up @@ -1028,7 +1028,6 @@ ion-progress-bar,prop,reversed,boolean,false,false,false
ion-progress-bar,prop,type,"determinate" | "indeterminate",'determinate',false,false
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
Expand Down
16 changes: 15 additions & 1 deletion core/src/components/progress-bar/progress-bar.ios.scss
@@ -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);
mapsandapps marked this conversation as resolved.
Show resolved Hide resolved

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};
}
8 changes: 8 additions & 0 deletions core/src/components/progress-bar/progress-bar.ios.vars.scss
@@ -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;
8 changes: 7 additions & 1 deletion core/src/components/progress-bar/progress-bar.md.scss
@@ -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)};
}
5 changes: 5 additions & 0 deletions core/src/components/progress-bar/progress-bar.md.vars.scss
@@ -0,0 +1,5 @@
// MD Progress bar
// --------------------------------------------------

/// @prop - Height of the progress bar
$progress-bar-md-height: 4px !default;
10 changes: 2 additions & 8 deletions core/src/components/progress-bar/progress-bar.scss
Expand Up @@ -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;

Expand Down Expand Up @@ -75,7 +73,7 @@
}

.progress-buffer-bar {
background: var(--buffer-background);
background: var(--background);

z-index: 1;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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%);
}
Expand Down
3 changes: 3 additions & 0 deletions core/src/components/progress-bar/progress-bar.tsx
Expand Up @@ -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"
Expand All @@ -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)}
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/progress-bar/test/basic/index.html
Expand Up @@ -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 {
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 0 additions & 8 deletions core/src/components/progress-bar/test/buffer/index.html
Expand Up @@ -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;
}
Comment on lines -17 to -23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These classes were not applied anywhere in the file


ion-content ion-progress-bar {
margin: 10px 0;
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/progress-bar/test/determinate/index.html
Expand Up @@ -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 {
Expand Down