aboutsummaryrefslogtreecommitdiff
path: root/scss/helpers
diff options
context:
space:
mode:
authorBobby <[email protected]>2024-08-16 20:47:33 -0400
committerGitHub <[email protected]>2024-08-16 20:47:33 -0400
commit6b28433d9cfde435be8ec2bd6cf91e6324d08865 (patch)
tree8343c27b8b95ff5639233e81cf157f92e5688466 /scss/helpers
parentd53094ec16ba385faae2973ddee648698b32ab24 (diff)
parent048f56f51460df75e92a2f7b472e1c56baeb68f7 (diff)
downloadbootstrap-main.tar.xz
bootstrap-main.zip
Merge branch 'twbs:main' into mainHEADmain
Diffstat (limited to 'scss/helpers')
-rw-r--r--scss/helpers/_color-bg.scss7
-rw-r--r--scss/helpers/_colored-links.scss22
-rw-r--r--scss/helpers/_focus-ring.scss5
-rw-r--r--scss/helpers/_icon-link.scss25
-rw-r--r--scss/helpers/_position.scss8
-rw-r--r--scss/helpers/_ratio.scss4
-rw-r--r--scss/helpers/_vr.scss4
7 files changed, 68 insertions, 7 deletions
diff --git a/scss/helpers/_color-bg.scss b/scss/helpers/_color-bg.scss
new file mode 100644
index 000000000..1a3a4cffd
--- /dev/null
+++ b/scss/helpers/_color-bg.scss
@@ -0,0 +1,7 @@
+// All-caps `RGBA()` function used because of this Sass bug: https://github.com/sass/node-sass/issues/2251
+@each $color, $value in $theme-colors {
+ .text-bg-#{$color} {
+ color: color-contrast($value) if($enable-important-utilities, !important, null);
+ background-color: RGBA(var(--#{$prefix}#{$color}-rgb), var(--#{$prefix}bg-opacity, 1)) if($enable-important-utilities, !important, null);
+ }
+}
diff --git a/scss/helpers/_colored-links.scss b/scss/helpers/_colored-links.scss
index 8c167dedf..5f8685780 100644
--- a/scss/helpers/_colored-links.scss
+++ b/scss/helpers/_colored-links.scss
@@ -1,12 +1,30 @@
+// All-caps `RGBA()` function used because of this Sass bug: https://github.com/sass/node-sass/issues/2251
@each $color, $value in $theme-colors {
.link-#{$color} {
- color: $value;
+ color: RGBA(var(--#{$prefix}#{$color}-rgb), var(--#{$prefix}link-opacity, 1)) if($enable-important-utilities, !important, null);
+ text-decoration-color: RGBA(var(--#{$prefix}#{$color}-rgb), var(--#{$prefix}link-underline-opacity, 1)) if($enable-important-utilities, !important, null);
@if $link-shade-percentage != 0 {
&:hover,
&:focus {
- color: if(color-contrast($value) == $color-contrast-light, shade-color($value, $link-shade-percentage), tint-color($value, $link-shade-percentage));
+ $hover-color: if(color-contrast($value) == $color-contrast-light, shade-color($value, $link-shade-percentage), tint-color($value, $link-shade-percentage));
+ color: RGBA(#{to-rgb($hover-color)}, var(--#{$prefix}link-opacity, 1)) if($enable-important-utilities, !important, null);
+ text-decoration-color: RGBA(to-rgb($hover-color), var(--#{$prefix}link-underline-opacity, 1)) if($enable-important-utilities, !important, null);
}
}
}
}
+
+// One-off special link helper as a bridge until v6
+.link-body-emphasis {
+ color: RGBA(var(--#{$prefix}emphasis-color-rgb), var(--#{$prefix}link-opacity, 1)) if($enable-important-utilities, !important, null);
+ text-decoration-color: RGBA(var(--#{$prefix}emphasis-color-rgb), var(--#{$prefix}link-underline-opacity, 1)) if($enable-important-utilities, !important, null);
+
+ @if $link-shade-percentage != 0 {
+ &:hover,
+ &:focus {
+ color: RGBA(var(--#{$prefix}emphasis-color-rgb), var(--#{$prefix}link-opacity, .75)) if($enable-important-utilities, !important, null);
+ text-decoration-color: RGBA(var(--#{$prefix}emphasis-color-rgb), var(--#{$prefix}link-underline-opacity, .75)) if($enable-important-utilities, !important, null);
+ }
+ }
+}
diff --git a/scss/helpers/_focus-ring.scss b/scss/helpers/_focus-ring.scss
new file mode 100644
index 000000000..26508a8d6
--- /dev/null
+++ b/scss/helpers/_focus-ring.scss
@@ -0,0 +1,5 @@
+.focus-ring:focus {
+ outline: 0;
+ // By default, there is no `--bs-focus-ring-x`, `--bs-focus-ring-y`, or `--bs-focus-ring-blur`, but we provide CSS variables with fallbacks to initial `0` values
+ box-shadow: var(--#{$prefix}focus-ring-x, 0) var(--#{$prefix}focus-ring-y, 0) var(--#{$prefix}focus-ring-blur, 0) var(--#{$prefix}focus-ring-width) var(--#{$prefix}focus-ring-color);
+}
diff --git a/scss/helpers/_icon-link.scss b/scss/helpers/_icon-link.scss
new file mode 100644
index 000000000..3f8bcb335
--- /dev/null
+++ b/scss/helpers/_icon-link.scss
@@ -0,0 +1,25 @@
+.icon-link {
+ display: inline-flex;
+ gap: $icon-link-gap;
+ align-items: center;
+ text-decoration-color: rgba(var(--#{$prefix}link-color-rgb), var(--#{$prefix}link-opacity, .5));
+ text-underline-offset: $icon-link-underline-offset;
+ backface-visibility: hidden;
+
+ > .bi {
+ flex-shrink: 0;
+ width: $icon-link-icon-size;
+ height: $icon-link-icon-size;
+ fill: currentcolor;
+ @include transition($icon-link-icon-transition);
+ }
+}
+
+.icon-link-hover {
+ &:hover,
+ &:focus-visible {
+ > .bi {
+ transform: var(--#{$prefix}icon-link-transform, $icon-link-icon-transform);
+ }
+ }
+}
diff --git a/scss/helpers/_position.scss b/scss/helpers/_position.scss
index 31851eb72..59103d943 100644
--- a/scss/helpers/_position.scss
+++ b/scss/helpers/_position.scss
@@ -16,7 +16,7 @@
z-index: $zindex-fixed;
}
-// Responsive sticky top
+// Responsive sticky top and bottom
@each $breakpoint in map-keys($grid-breakpoints) {
@include media-breakpoint-up($breakpoint) {
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
@@ -26,5 +26,11 @@
top: 0;
z-index: $zindex-sticky;
}
+
+ .sticky#{$infix}-bottom {
+ position: sticky;
+ bottom: 0;
+ z-index: $zindex-sticky;
+ }
}
}
diff --git a/scss/helpers/_ratio.scss b/scss/helpers/_ratio.scss
index 2390ee339..b6a7654c5 100644
--- a/scss/helpers/_ratio.scss
+++ b/scss/helpers/_ratio.scss
@@ -6,7 +6,7 @@
&::before {
display: block;
- padding-top: var(--#{$variable-prefix}aspect-ratio);
+ padding-top: var(--#{$prefix}aspect-ratio);
content: "";
}
@@ -21,6 +21,6 @@
@each $key, $ratio in $aspect-ratios {
.ratio-#{$key} {
- --#{$variable-prefix}aspect-ratio: #{$ratio};
+ --#{$prefix}aspect-ratio: #{$ratio};
}
}
diff --git a/scss/helpers/_vr.scss b/scss/helpers/_vr.scss
index 37f864777..b6f9d42cb 100644
--- a/scss/helpers/_vr.scss
+++ b/scss/helpers/_vr.scss
@@ -1,8 +1,8 @@
.vr {
display: inline-block;
align-self: stretch;
- width: 1px;
+ width: $vr-border-width;
min-height: 1em;
- background-color: currentColor;
+ background-color: currentcolor;
opacity: $hr-opacity;
}