]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Convert progress bars to CSS variables (#35962)
authorMark Otto <markd.otto@gmail.com>
Fri, 18 Mar 2022 16:02:03 +0000 (09:02 -0700)
committerGitHub <noreply@github.com>
Fri, 18 Mar 2022 16:02:03 +0000 (09:02 -0700)
* Convert progress bars to CSS variables

* bundlewatch

.bundlewatch.config.json
scss/_progress.scss
site/content/docs/5.1/components/progress.md

index 477fa4486990f8c5590324d0a5e16d95bcc36557..1344e1ef2b9161e9b147eb3ece6a7bf05fecd4e9 100644 (file)
     },
     {
       "path": "./dist/css/bootstrap.css",
-      "maxSize": "26.8 kB"
+      "maxSize": "26.85 kB"
     },
     {
       "path": "./dist/css/bootstrap.min.css",
-      "maxSize": "24.85 kB"
+      "maxSize": "24.9 kB"
     },
     {
       "path": "./dist/js/bootstrap.bundle.js",
index 5715ab00cedf2f7517c38d4d8adf630eca379687..01f488b657e0543a211b6c1fdb56e5fb715b1e93 100644 (file)
@@ -9,13 +9,24 @@
 // scss-docs-end progress-keyframes
 
 .progress {
+  // scss-docs-start progress-css-vars
+  --#{$prefix}progress-height: #{$progress-height};
+  @include rfs($progress-font-size, --#{$prefix}progress-font-size);
+  --#{$prefix}progress-bg: #{$progress-bg}; // stylelint-disable-line custom-property-empty-line-before
+  --#{$prefix}progress-border-radius: #{$progress-border-radius};
+  --#{$prefix}progress-box-shadow: #{$progress-box-shadow};
+  --#{$prefix}progress-bar-color: #{$progress-bar-color};
+  --#{$prefix}progress-bar-bg: #{$progress-bar-bg};
+  --#{$prefix}progress-bar-transition: #{$progress-bar-transition};
+  // scss-docs-end progress-css-vars
+
   display: flex;
-  height: $progress-height;
+  height: var(--#{$prefix}progress-height);
   overflow: hidden; // force rounded corners by cropping it
-  @include font-size($progress-font-size);
-  background-color: $progress-bg;
-  @include border-radius($progress-border-radius);
-  @include box-shadow($progress-box-shadow);
+  @include font-size(var(--#{$prefix}progress-font-size));
+  background-color: var(--#{$prefix}progress-bg);
+  @include border-radius(var(--#{$prefix}progress-border-radius));
+  @include box-shadow(var(--#{$prefix}progress-box-shadow));
 }
 
 .progress-bar {
   flex-direction: column;
   justify-content: center;
   overflow: hidden;
-  color: $progress-bar-color;
+  color: var(--#{$prefix}progress-bar-color);
   text-align: center;
   white-space: nowrap;
-  background-color: $progress-bar-bg;
-  @include transition($progress-bar-transition);
+  background-color: var(--#{$prefix}progress-bar-bg);
+  @include transition(var(--#{$prefix}progress-bar-transition));
 }
 
 .progress-bar-striped {
   @include gradient-striped();
-  background-size: $progress-height $progress-height;
+  background-size: var(--#{$prefix}progress-height) var(--#{$prefix}progress-height);
 }
 
 @if $enable-transitions {
index fccd546c60751fb45e552e3ea2b65c47b7fedb61..8fbba3be7703179882bdb006179c31c2d72d7815 100644 (file)
@@ -129,10 +129,18 @@ The striped gradient can also be animated. Add `.progress-bar-animated` to `.pro
 </div>
 {{< /example >}}
 
-## Sass
+## CSS
 
 ### Variables
 
+{{< added-in "5.2.0" >}}
+
+As part of Bootstrap's evolving CSS variables approach, progress bars now use local CSS variables on `.progress` for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.
+
+{{< scss-docs name="progress-css-vars" file="scss/_progress.scss" >}}
+
+### Sass variables
+
 {{< scss-docs name="progress-variables" file="scss/_variables.scss" >}}
 
 ### Keyframes