diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-24 12:44:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-24 12:44:36 +0000 |
commit | c1d5a801b4bc66e3866f815be00e11d1b20d3539 (patch) | |
tree | 394cfedf644640ac80b78aaddaff93ceb8eefa5e /scss | |
parent | Adding upstream version 5.2.3+dfsg. (diff) | |
download | bootstrap-html-c1d5a801b4bc66e3866f815be00e11d1b20d3539.tar.xz bootstrap-html-c1d5a801b4bc66e3866f815be00e11d1b20d3539.zip |
Adding upstream version 5.3.0+dfsg.upstream/5.3.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
55 files changed, 1780 insertions, 338 deletions
diff --git a/scss/_accordion.scss b/scss/_accordion.scss index f09601b..75588a5 100644 --- a/scss/_accordion.scss +++ b/scss/_accordion.scss @@ -147,3 +147,12 @@ } } } + +@if $enable-dark-mode { + @include color-mode(dark) { + .accordion-button::after { + --#{$prefix}accordion-btn-icon: #{escape-svg($accordion-button-icon-dark)}; + --#{$prefix}accordion-btn-active-icon: #{escape-svg($accordion-button-active-icon-dark)}; + } + } +} diff --git a/scss/_alert.scss b/scss/_alert.scss index c8bc91b..b8cff9b 100644 --- a/scss/_alert.scss +++ b/scss/_alert.scss @@ -12,6 +12,7 @@ --#{$prefix}alert-border-color: transparent; --#{$prefix}alert-border: #{$alert-border-width} solid var(--#{$prefix}alert-border-color); --#{$prefix}alert-border-radius: #{$alert-border-radius}; + --#{$prefix}alert-link-color: inherit; // scss-docs-end alert-css-vars position: relative; @@ -32,6 +33,7 @@ // Provide class for links that match alerts .alert-link { font-weight: $alert-link-font-weight; + color: var(--#{$prefix}alert-link-color); } @@ -54,18 +56,13 @@ // scss-docs-start alert-modifiers -// Generate contextual modifier classes for colorizing the alert. - -@each $state, $value in $theme-colors { - $alert-background: shift-color($value, $alert-bg-scale); - $alert-border: shift-color($value, $alert-border-scale); - $alert-color: shift-color($value, $alert-color-scale); - - @if (contrast-ratio($alert-background, $alert-color) < $min-contrast-ratio) { - $alert-color: mix($value, color-contrast($alert-background), abs($alert-color-scale)); - } +// Generate contextual modifier classes for colorizing the alert +@each $state in map-keys($theme-colors) { .alert-#{$state} { - @include alert-variant($alert-background, $alert-border, $alert-color); + --#{$prefix}alert-color: var(--#{$prefix}#{$state}-text-emphasis); + --#{$prefix}alert-bg: var(--#{$prefix}#{$state}-bg-subtle); + --#{$prefix}alert-border-color: var(--#{$prefix}#{$state}-border-subtle); + --#{$prefix}alert-link-color: var(--#{$prefix}#{$state}-text-emphasis); } } // scss-docs-end alert-modifiers diff --git a/scss/_button-group.scss b/scss/_button-group.scss index 79b100c..55ae3f6 100644 --- a/scss/_button-group.scss +++ b/scss/_button-group.scss @@ -39,7 +39,7 @@ // Prevent double borders when buttons are next to each other > :not(.btn-check:first-child) + .btn, > .btn-group:not(:first-child) { - margin-left: -$btn-border-width; + margin-left: calc(#{$btn-border-width} * -1); // stylelint-disable-line function-disallowed-list } // Reset rounded corners @@ -126,7 +126,7 @@ > .btn:not(:first-child), > .btn-group:not(:first-child) { - margin-top: -$btn-border-width; + margin-top: calc(#{$btn-border-width} * -1); // stylelint-disable-line function-disallowed-list } // Reset rounded corners diff --git a/scss/_buttons.scss b/scss/_buttons.scss index f2c4c13..cbc0784 100644 --- a/scss/_buttons.scss +++ b/scss/_buttons.scss @@ -10,7 +10,7 @@ @include rfs($btn-font-size, --#{$prefix}btn-font-size); --#{$prefix}btn-font-weight: #{$btn-font-weight}; --#{$prefix}btn-line-height: #{$btn-line-height}; - --#{$prefix}btn-color: #{$body-color}; + --#{$prefix}btn-color: #{$btn-color}; --#{$prefix}btn-bg: transparent; --#{$prefix}btn-border-width: #{$btn-border-width}; --#{$prefix}btn-border-color: transparent; @@ -169,8 +169,8 @@ --#{$prefix}btn-active-border-color: transparent; --#{$prefix}btn-disabled-color: #{$btn-link-disabled-color}; --#{$prefix}btn-disabled-border-color: transparent; - --#{$prefix}btn-box-shadow: none; - --#{$prefix}btn-focus-shadow-rgb: #{to-rgb(mix(color-contrast($primary), $primary, 15%))}; + --#{$prefix}btn-box-shadow: 0 0 0 #000; // Can't use `none` as keyword negates all values when used with multiple shadows + --#{$prefix}btn-focus-shadow-rgb: #{to-rgb(mix(color-contrast($link-color), $link-color, 15%))}; text-decoration: $link-decoration; @if $enable-gradients { diff --git a/scss/_card.scss b/scss/_card.scss index ce8c02f..d3535a9 100644 --- a/scss/_card.scss +++ b/scss/_card.scss @@ -7,6 +7,8 @@ --#{$prefix}card-spacer-y: #{$card-spacer-y}; --#{$prefix}card-spacer-x: #{$card-spacer-x}; --#{$prefix}card-title-spacer-y: #{$card-title-spacer-y}; + --#{$prefix}card-title-color: #{$card-title-color}; + --#{$prefix}card-subtitle-color: #{$card-subtitle-color}; --#{$prefix}card-border-width: #{$card-border-width}; --#{$prefix}card-border-color: #{$card-border-color}; --#{$prefix}card-border-radius: #{$card-border-radius}; @@ -28,6 +30,7 @@ flex-direction: column; min-width: 0; // See https://github.com/twbs/bootstrap/pull/22740#issuecomment-305868106 height: var(--#{$prefix}card-height); + color: var(--#{$prefix}body-color); word-wrap: break-word; background-color: var(--#{$prefix}card-bg); background-clip: border-box; @@ -73,11 +76,13 @@ .card-title { margin-bottom: var(--#{$prefix}card-title-spacer-y); + color: var(--#{$prefix}card-title-color); } .card-subtitle { margin-top: calc(-.5 * var(--#{$prefix}card-title-spacer-y)); // stylelint-disable-line function-disallowed-list margin-bottom: 0; + color: var(--#{$prefix}card-subtitle-color); } .card-text:last-child { diff --git a/scss/_carousel.scss b/scss/_carousel.scss index 858b836..0ac8f87 100644 --- a/scss/_carousel.scss +++ b/scss/_carousel.scss @@ -165,7 +165,6 @@ margin-right: $carousel-control-width; margin-bottom: 1rem; margin-left: $carousel-control-width; - list-style: none; [data-bs-target] { box-sizing: content-box; @@ -210,7 +209,7 @@ // Dark mode carousel -.carousel-dark { +@mixin carousel-dark() { .carousel-control-prev-icon, .carousel-control-next-icon { filter: $carousel-dark-control-icon-filter; @@ -224,3 +223,22 @@ color: $carousel-dark-caption-color; } } + +.carousel-dark { + @include carousel-dark(); +} + +@if $enable-dark-mode { + @include color-mode(dark) { + @if $color-mode-type == "media-query" { + .carousel { + @include carousel-dark(); + } + } @else { + .carousel, + &.carousel { + @include carousel-dark(); + } + } + } +} diff --git a/scss/_close.scss b/scss/_close.scss index a0813de..4d6e73c 100644 --- a/scss/_close.scss +++ b/scss/_close.scss @@ -4,37 +4,60 @@ // See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile .btn-close { + // scss-docs-start close-css-vars + --#{$prefix}btn-close-color: #{$btn-close-color}; + --#{$prefix}btn-close-bg: #{ escape-svg($btn-close-bg) }; + --#{$prefix}btn-close-opacity: #{$btn-close-opacity}; + --#{$prefix}btn-close-hover-opacity: #{$btn-close-hover-opacity}; + --#{$prefix}btn-close-focus-shadow: #{$btn-close-focus-shadow}; + --#{$prefix}btn-close-focus-opacity: #{$btn-close-focus-opacity}; + --#{$prefix}btn-close-disabled-opacity: #{$btn-close-disabled-opacity}; + --#{$prefix}btn-close-white-filter: #{$btn-close-white-filter}; + // scss-docs-end close-css-vars + box-sizing: content-box; width: $btn-close-width; height: $btn-close-height; padding: $btn-close-padding-y $btn-close-padding-x; - color: $btn-close-color; - background: transparent escape-svg($btn-close-bg) center / $btn-close-width auto no-repeat; // include transparent for button elements + color: var(--#{$prefix}btn-close-color); + background: transparent var(--#{$prefix}btn-close-bg) center / $btn-close-width auto no-repeat; // include transparent for button elements border: 0; // for button elements @include border-radius(); - opacity: $btn-close-opacity; + opacity: var(--#{$prefix}btn-close-opacity); // Override <a>'s hover style &:hover { - color: $btn-close-color; + color: var(--#{$prefix}btn-close-color); text-decoration: none; - opacity: $btn-close-hover-opacity; + opacity: var(--#{$prefix}btn-close-hover-opacity); } &:focus { outline: 0; - box-shadow: $btn-close-focus-shadow; - opacity: $btn-close-focus-opacity; + box-shadow: var(--#{$prefix}btn-close-focus-shadow); + opacity: var(--#{$prefix}btn-close-focus-opacity); } &:disabled, &.disabled { pointer-events: none; user-select: none; - opacity: $btn-close-disabled-opacity; + opacity: var(--#{$prefix}btn-close-disabled-opacity); } } +@mixin btn-close-white() { + filter: var(--#{$prefix}btn-close-white-filter); +} + .btn-close-white { - filter: $btn-close-white-filter; + @include btn-close-white(); +} + +@if $enable-dark-mode { + @include color-mode(dark) { + .btn-close { + @include btn-close-white(); + } + } } diff --git a/scss/_dropdown.scss b/scss/_dropdown.scss index 8899d25..587ebb4 100644 --- a/scss/_dropdown.scss +++ b/scss/_dropdown.scss @@ -184,6 +184,7 @@ white-space: nowrap; // prevent links from randomly breaking onto new lines background-color: transparent; // For `<button>`s border: 0; // For `<button>`s + @include border-radius(var(--#{$prefix}dropdown-item-border-radius, 0)); &:hover, &:focus { diff --git a/scss/_functions.scss b/scss/_functions.scss index 26c953b..9029658 100644 --- a/scss/_functions.scss +++ b/scss/_functions.scss @@ -188,7 +188,7 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003 ); @each $name, $value in $rgb { - $value: if(divide($value, 255) < .03928, divide(divide($value, 255), 12.92), nth($_luminance-list, $value + 1)); + $value: if(divide($value, 255) < .04045, divide(divide($value, 255), 12.92), nth($_luminance-list, $value + 1)); $rgb: map-merge($rgb, ($name: $value)); } diff --git a/scss/_grid.scss b/scss/_grid.scss index 0e0ba21..048f800 100644 --- a/scss/_grid.scss +++ b/scss/_grid.scss @@ -2,6 +2,12 @@ // // Rows contain your columns. +:root { + @each $name, $value in $grid-breakpoints { + --#{$prefix}breakpoint-#{$name}: #{$value}; + } +} + @if $enable-grid-classes { .row { @include make-row(); diff --git a/scss/_helpers.scss b/scss/_helpers.scss index 644b693..13f2752 100644 --- a/scss/_helpers.scss +++ b/scss/_helpers.scss @@ -1,6 +1,8 @@ @import "helpers/clearfix"; @import "helpers/color-bg"; @import "helpers/colored-links"; +@import "helpers/focus-ring"; +@import "helpers/icon-link"; @import "helpers/ratio"; @import "helpers/position"; @import "helpers/stacks"; diff --git a/scss/_list-group.scss b/scss/_list-group.scss index c0ec164..455531e 100644 --- a/scss/_list-group.scss +++ b/scss/_list-group.scss @@ -180,13 +180,18 @@ // Add modifier classes to change text and background color on individual items. // Organizationally, this must come after the `:hover` states. -@each $state, $value in $theme-colors { - $list-group-variant-bg: shift-color($value, $list-group-item-bg-scale); - $list-group-variant-color: shift-color($value, $list-group-item-color-scale); - @if (contrast-ratio($list-group-variant-bg, $list-group-variant-color) < $min-contrast-ratio) { - $list-group-variant-color: mix($value, color-contrast($list-group-variant-bg), abs($list-group-item-color-scale)); +@each $state in map-keys($theme-colors) { + .list-group-item-#{$state} { + --#{$prefix}list-group-color: var(--#{$prefix}#{$state}-text-emphasis); + --#{$prefix}list-group-bg: var(--#{$prefix}#{$state}-bg-subtle); + --#{$prefix}list-group-border-color: var(--#{$prefix}#{$state}-border-subtle); + --#{$prefix}list-group-action-hover-color: var(--#{$prefix}emphasis-color); + --#{$prefix}list-group-action-hover-bg: var(--#{$prefix}#{$state}-border-subtle); + --#{$prefix}list-group-action-active-color: var(--#{$prefix}emphasis-color); + --#{$prefix}list-group-action-active-bg: var(--#{$prefix}#{$state}-border-subtle); + --#{$prefix}list-group-active-color: var(--#{$prefix}#{$state}-bg-subtle); + --#{$prefix}list-group-active-bg: var(--#{$prefix}#{$state}-text-emphasis); + --#{$prefix}list-group-active-border-color: var(--#{$prefix}#{$state}-text-emphasis); } - - @include list-group-item-variant($state, $list-group-variant-bg, $list-group-variant-color); } // scss-docs-end list-group-modifiers diff --git a/scss/_maps.scss b/scss/_maps.scss index 2770a67..68ee421 100644 --- a/scss/_maps.scss +++ b/scss/_maps.scss @@ -6,6 +6,90 @@ $theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value") !default; // scss-docs-end theme-colors-rgb +// scss-docs-start theme-text-map +$theme-colors-text: ( + "primary": $primary-text-emphasis, + "secondary": $secondary-text-emphasis, + "success": $success-text-emphasis, + "info": $info-text-emphasis, + "warning": $warning-text-emphasis, + "danger": $danger-text-emphasis, + "light": $light-text-emphasis, + "dark": $dark-text-emphasis, +) !default; +// scss-docs-end theme-text-map + +// scss-docs-start theme-bg-subtle-map +$theme-colors-bg-subtle: ( + "primary": $primary-bg-subtle, + "secondary": $secondary-bg-subtle, + "success": $success-bg-subtle, + "info": $info-bg-subtle, + "warning": $warning-bg-subtle, + "danger": $danger-bg-subtle, + "light": $light-bg-subtle, + "dark": $dark-bg-subtle, +) !default; +// scss-docs-end theme-bg-subtle-map + +// scss-docs-start theme-border-subtle-map +$theme-colors-border-subtle: ( + "primary": $primary-border-subtle, + "secondary": $secondary-border-subtle, + "success": $success-border-subtle, + "info": $info-border-subtle, + "warning": $warning-border-subtle, + "danger": $danger-border-subtle, + "light": $light-border-subtle, + "dark": $dark-border-subtle, +) !default; +// scss-docs-end theme-border-subtle-map + +$theme-colors-text-dark: null !default; +$theme-colors-bg-subtle-dark: null !default; +$theme-colors-border-subtle-dark: null !default; + +@if $enable-dark-mode { + // scss-docs-start theme-text-dark-map + $theme-colors-text-dark: ( + "primary": $primary-text-emphasis-dark, + "secondary": $secondary-text-emphasis-dark, + "success": $success-text-emphasis-dark, + "info": $info-text-emphasis-dark, + "warning": $warning-text-emphasis-dark, + "danger": $danger-text-emphasis-dark, + "light": $light-text-emphasis-dark, + "dark": $dark-text-emphasis-dark, + ) !default; + // scss-docs-end theme-text-dark-map + + // scss-docs-start theme-bg-subtle-dark-map + $theme-colors-bg-subtle-dark: ( + "primary": $primary-bg-subtle-dark, + "secondary": $secondary-bg-subtle-dark, + "success": $success-bg-subtle-dark, + "info": $info-bg-subtle-dark, + "warning": $warning-bg-subtle-dark, + "danger": $danger-bg-subtle-dark, + "light": $light-bg-subtle-dark, + "dark": $dark-bg-subtle-dark, + ) !default; + // scss-docs-end theme-bg-subtle-dark-map + + // scss-docs-start theme-border-subtle-dark-map + $theme-colors-border-subtle-dark: ( + "primary": $primary-border-subtle-dark, + "secondary": $secondary-border-subtle-dark, + "success": $success-border-subtle-dark, + "info": $info-border-subtle-dark, + "warning": $warning-border-subtle-dark, + "danger": $danger-border-subtle-dark, + "light": $light-border-subtle-dark, + "dark": $dark-border-subtle-dark, + ) !default; + // scss-docs-end theme-border-subtle-dark-map +} + // Utilities maps // // Extends the default `$theme-colors` maps to help create our utilities. @@ -25,6 +109,17 @@ $utilities-text: map-merge( ) ) !default; $utilities-text-colors: map-loop($utilities-text, rgba-css-var, "$key", "text") !default; + +$utilities-text-emphasis-colors: ( + "primary-emphasis": var(--#{$prefix}primary-text-emphasis), + "secondary-emphasis": var(--#{$prefix}secondary-text-emphasis), + "success-emphasis": var(--#{$prefix}success-text-emphasis), + "info-emphasis": var(--#{$prefix}info-text-emphasis), + "warning-emphasis": var(--#{$prefix}warning-text-emphasis), + "danger-emphasis": var(--#{$prefix}danger-text-emphasis), + "light-emphasis": var(--#{$prefix}light-text-emphasis), + "dark-emphasis": var(--#{$prefix}dark-text-emphasis) +) !default; // scss-docs-end utilities-text-colors // scss-docs-start utilities-bg-colors @@ -37,18 +132,43 @@ $utilities-bg: map-merge( ) ) !default; $utilities-bg-colors: map-loop($utilities-bg, rgba-css-var, "$key", "bg") !default; + +$utilities-bg-subtle: ( + "primary-subtle": var(--#{$prefix}primary-bg-subtle), + "secondary-subtle": var(--#{$prefix}secondary-bg-subtle), + "success-subtle": var(--#{$prefix}success-bg-subtle), + "info-subtle": var(--#{$prefix}info-bg-subtle), + "warning-subtle": var(--#{$prefix}warning-bg-subtle), + "danger-subtle": var(--#{$prefix}danger-bg-subtle), + "light-subtle": var(--#{$prefix}light-bg-subtle), + "dark-subtle": var(--#{$prefix}dark-bg-subtle) +) !default; // scss-docs-end utilities-bg-colors // scss-docs-start utilities-border-colors $utilities-border: map-merge( $utilities-colors, ( + "black": to-rgb($black), "white": to-rgb($white) ) ) !default; $utilities-border-colors: map-loop($utilities-border, rgba-css-var, "$key", "border") !default; + +$utilities-border-subtle: ( + "primary-subtle": var(--#{$prefix}primary-border-subtle), + "secondary-subtle": var(--#{$prefix}secondary-border-subtle), + "success-subtle": var(--#{$prefix}success-border-subtle), + "info-subtle": var(--#{$prefix}info-border-subtle), + "warning-subtle": var(--#{$prefix}warning-border-subtle), + "danger-subtle": var(--#{$prefix}danger-border-subtle), + "light-subtle": var(--#{$prefix}light-border-subtle), + "dark-subtle": var(--#{$prefix}dark-border-subtle) +) !default; // scss-docs-end utilities-border-colors +$utilities-links-underline: map-loop($utilities-colors, rgba-css-var, "$key", "link-underline") !default; + $negative-spacers: if($enable-negative-margins, negativify-map($spacers), null) !default; $gutters: $spacers !default; diff --git a/scss/_mixins.scss b/scss/_mixins.scss index af1f74f..e1e130b 100644 --- a/scss/_mixins.scss +++ b/scss/_mixins.scss @@ -10,6 +10,7 @@ // Helpers @import "mixins/breakpoints"; +@import "mixins/color-mode"; @import "mixins/color-scheme"; @import "mixins/image"; @import "mixins/resize"; @@ -21,13 +22,11 @@ @import "mixins/utilities"; // Components -@import "mixins/alert"; @import "mixins/backdrop"; @import "mixins/buttons"; @import "mixins/caret"; @import "mixins/pagination"; @import "mixins/lists"; -@import "mixins/list-group"; @import "mixins/forms"; @import "mixins/table-variants"; diff --git a/scss/_nav.scss b/scss/_nav.scss index 9efc03b..aedbdba 100644 --- a/scss/_nav.scss +++ b/scss/_nav.scss @@ -28,6 +28,8 @@ font-weight: var(--#{$prefix}nav-link-font-weight); color: var(--#{$prefix}nav-link-color); text-decoration: if($link-decoration == none, null, none); + background: none; + border: 0; @include transition($nav-link-transition); &:hover, @@ -36,6 +38,11 @@ text-decoration: if($link-hover-decoration == underline, none, null); } + &:focus-visible { + outline: 0; + box-shadow: $nav-link-focus-box-shadow; + } + // Disabled state lightens text &.disabled { color: var(--#{$prefix}nav-link-disabled-color); @@ -63,7 +70,6 @@ .nav-link { margin-bottom: calc(-1 * var(--#{$prefix}nav-tabs-border-width)); // stylelint-disable-line function-disallowed-list - background: none; border: var(--#{$prefix}nav-tabs-border-width) solid transparent; @include border-top-radius(var(--#{$prefix}nav-tabs-border-radius)); @@ -110,8 +116,6 @@ // scss-docs-end nav-pills-css-vars .nav-link { - background: none; - border: 0; @include border-radius(var(--#{$prefix}nav-pills-border-radius)); &:disabled { @@ -130,6 +134,39 @@ // +// Underline +// + +.nav-underline { + // scss-docs-start nav-underline-css-vars + --#{$prefix}nav-underline-gap: #{$nav-underline-gap}; + --#{$prefix}nav-underline-border-width: #{$nav-underline-border-width}; + --#{$prefix}nav-underline-link-active-color: #{$nav-underline-link-active-color}; + // scss-docs-end nav-underline-css-vars + + gap: var(--#{$prefix}nav-underline-gap); + + .nav-link { + padding-right: 0; + padding-left: 0; + border-bottom: var(--#{$prefix}nav-underline-border-width) solid transparent; + + &:hover, + &:focus { + border-bottom-color: currentcolor; + } + } + + .nav-link.active, + .show > .nav-link { + font-weight: $font-weight-bold; + color: var(--#{$prefix}nav-underline-link-active-color); + border-bottom-color: currentcolor; + } +} + + +// // Justified variants // diff --git a/scss/_navbar.scss b/scss/_navbar.scss index 599b055..7161938 100644 --- a/scss/_navbar.scss +++ b/scss/_navbar.scss @@ -100,9 +100,11 @@ margin-bottom: 0; list-style: none; - .show > .nav-link, - .nav-link.active { - color: var(--#{$prefix}navbar-active-color); + .nav-link { + &.active, + &.show { + color: var(--#{$prefix}navbar-active-color); + } } .dropdown-menu { @@ -264,7 +266,8 @@ @include deprecate("`.navbar-light`", "v5.2.0", "v6.0.0", true); } -.navbar-dark { +.navbar-dark, +.navbar[data-bs-theme="dark"] { // scss-docs-start navbar-dark-css-vars --#{$prefix}navbar-color: #{$navbar-dark-color}; --#{$prefix}navbar-hover-color: #{$navbar-dark-hover-color}; @@ -276,3 +279,11 @@ --#{$prefix}navbar-toggler-icon-bg: #{escape-svg($navbar-dark-toggler-icon-bg)}; // scss-docs-end navbar-dark-css-vars } + +@if $enable-dark-mode { + @include color-mode(dark) { + .navbar-toggler-icon { + --#{$prefix}navbar-toggler-icon-bg: #{escape-svg($navbar-dark-toggler-icon-bg)}; + } + } +} diff --git a/scss/_offcanvas.scss b/scss/_offcanvas.scss index 23fc357..04e3ce6 100644 --- a/scss/_offcanvas.scss +++ b/scss/_offcanvas.scss @@ -12,6 +12,8 @@ --#{$prefix}offcanvas-border-width: #{$offcanvas-border-width}; --#{$prefix}offcanvas-border-color: #{$offcanvas-border-color}; --#{$prefix}offcanvas-box-shadow: #{$offcanvas-box-shadow}; + --#{$prefix}offcanvas-transition: #{transform $offcanvas-transition-duration ease-in-out}; + --#{$prefix}offcanvas-title-line-height: #{$offcanvas-title-line-height}; // scss-docs-end offcanvas-css-vars } @@ -42,7 +44,7 @@ background-clip: padding-box; outline: 0; @include box-shadow(var(--#{$prefix}offcanvas-box-shadow)); - @include transition(transform $offcanvas-transition-duration ease-in-out); + @include transition(var(--#{$prefix}offcanvas-transition)); &.offcanvas-start { top: 0; @@ -134,7 +136,7 @@ .offcanvas-title { margin-bottom: 0; - line-height: $offcanvas-title-line-height; + line-height: var(--#{$prefix}offcanvas-title-line-height); } .offcanvas-body { diff --git a/scss/_pagination.scss b/scss/_pagination.scss index cf4db3c..f275a62 100644 --- a/scss/_pagination.scss +++ b/scss/_pagination.scss @@ -75,7 +75,7 @@ margin-left: $pagination-margin-start; } - @if $pagination-margin-start == ($pagination-border-width * -1) { + @if $pagination-margin-start == calc(#{$pagination-border-width} * -1) { &:first-child { .page-link { @include border-start-radius(var(--#{$prefix}pagination-border-radius)); diff --git a/scss/_progress.scss b/scss/_progress.scss index 1bfafb5..148c381 100644 --- a/scss/_progress.scss +++ b/scss/_progress.scss @@ -8,7 +8,8 @@ } // scss-docs-end progress-keyframes -.progress { +.progress, +.progress-stacked { // scss-docs-start progress-css-vars --#{$prefix}progress-height: #{$progress-height}; @include rfs($progress-font-size, --#{$prefix}progress-font-size); @@ -46,6 +47,14 @@ background-size: var(--#{$prefix}progress-height) var(--#{$prefix}progress-height); } +.progress-stacked > .progress { + overflow: visible; +} + +.progress-stacked > .progress > .progress-bar { + width: 100%; +} + @if $enable-transitions { .progress-bar-animated { animation: $progress-bar-animation-timing progress-bar-stripes; diff --git a/scss/_reboot.scss b/scss/_reboot.scss index 8ac7903..4226ab8 100644 --- a/scss/_reboot.scss +++ b/scss/_reboot.scss @@ -87,7 +87,7 @@ hr { font-style: $headings-font-style; font-weight: $headings-font-weight; line-height: $headings-line-height; - color: $headings-color; + color: var(--#{$prefix}heading-color); } h1 { @@ -241,11 +241,11 @@ sup { top: -.5em; } // Links a { - color: var(--#{$prefix}link-color); + color: rgba(var(--#{$prefix}link-color-rgb), var(--#{$prefix}link-opacity, 1)); text-decoration: $link-decoration; &:hover { - color: var(--#{$prefix}link-hover-color); + --#{$prefix}link-color-rgb: var(--#{$prefix}link-hover-color-rgb); text-decoration: $link-hover-decoration; } } diff --git a/scss/_root.scss b/scss/_root.scss index e64ae04..ab720a3 100644 --- a/scss/_root.scss +++ b/scss/_root.scss @@ -1,4 +1,5 @@ -:root { +:root, +[data-bs-theme="light"] { // Note: Custom variable values only support SassScript inside `#{}`. // Colors @@ -21,10 +22,20 @@ --#{$prefix}#{$color}-rgb: #{$value}; } + @each $color, $value in $theme-colors-text { + --#{$prefix}#{$color}-text-emphasis: #{$value}; + } + + @each $color, $value in $theme-colors-bg-subtle { + --#{$prefix}#{$color}-bg-subtle: #{$value}; + } + + @each $color, $value in $theme-colors-border-subtle { + --#{$prefix}#{$color}-border-subtle: #{$value}; + } + --#{$prefix}white-rgb: #{to-rgb($white)}; --#{$prefix}black-rgb: #{to-rgb($black)}; - --#{$prefix}body-color-rgb: #{to-rgb($body-color)}; - --#{$prefix}body-bg-rgb: #{to-rgb($body-bg)}; // Fonts @@ -39,17 +50,49 @@ @if $font-size-root != null { --#{$prefix}root-font-size: #{$font-size-root}; } - --#{$prefix}body-font-family: #{$font-family-base}; + --#{$prefix}body-font-family: #{inspect($font-family-base)}; @include rfs($font-size-base, --#{$prefix}body-font-size); --#{$prefix}body-font-weight: #{$font-weight-base}; --#{$prefix}body-line-height: #{$line-height-base}; - --#{$prefix}body-color: #{$body-color}; @if $body-text-align != null { --#{$prefix}body-text-align: #{$body-text-align}; } + + --#{$prefix}body-color: #{$body-color}; + --#{$prefix}body-color-rgb: #{to-rgb($body-color)}; --#{$prefix}body-bg: #{$body-bg}; + --#{$prefix}body-bg-rgb: #{to-rgb($body-bg)}; + + --#{$prefix}emphasis-color: #{$body-emphasis-color}; + --#{$prefix}emphasis-color-rgb: #{to-rgb($body-emphasis-color)}; + + --#{$prefix}secondary-color: #{$body-secondary-color}; + --#{$prefix}secondary-color-rgb: #{to-rgb($body-secondary-color)}; + --#{$prefix}secondary-bg: #{$body-secondary-bg}; + --#{$prefix}secondary-bg-rgb: #{to-rgb($body-secondary-bg)}; + + --#{$prefix}tertiary-color: #{$body-tertiary-color}; + --#{$prefix}tertiary-color-rgb: #{to-rgb($body-tertiary-color)}; + --#{$prefix}tertiary-bg: #{$body-tertiary-bg}; + --#{$prefix}tertiary-bg-rgb: #{to-rgb($body-tertiary-bg)}; // scss-docs-end root-body-variables + --#{$prefix}heading-color: #{$headings-color}; + + --#{$prefix}link-color: #{$link-color}; + --#{$prefix}link-color-rgb: #{to-rgb($link-color)}; + --#{$prefix}link-decoration: #{$link-decoration}; + + --#{$prefix}link-hover-color: #{$link-hover-color}; + --#{$prefix}link-hover-color-rgb: #{to-rgb($link-hover-color)}; + + @if $link-hover-decoration != null { + --#{$prefix}link-hover-decoration: #{$link-hover-decoration}; + } + + --#{$prefix}code-color: #{$code-color}; + --#{$prefix}highlight-bg: #{$mark-bg}; + // scss-docs-start root-border-var --#{$prefix}border-width: #{$border-width}; --#{$prefix}border-style: #{$border-style}; @@ -60,14 +103,82 @@ --#{$prefix}border-radius-sm: #{$border-radius-sm}; --#{$prefix}border-radius-lg: #{$border-radius-lg}; --#{$prefix}border-radius-xl: #{$border-radius-xl}; - --#{$prefix}border-radius-2xl: #{$border-radius-2xl}; + --#{$prefix}border-radius-xxl: #{$border-radius-xxl}; + --#{$prefix}border-radius-2xl: var(--#{$prefix}border-radius-xxl); // Deprecated in v5.3.0 for consistency --#{$prefix}border-radius-pill: #{$border-radius-pill}; // scss-docs-end root-border-var - --#{$prefix}link-color: #{$link-color}; - --#{$prefix}link-hover-color: #{$link-hover-color}; + --#{$prefix}box-shadow: #{$box-shadow}; + --#{$prefix}box-shadow-sm: #{$box-shadow-sm}; + --#{$prefix}box-shadow-lg: #{$box-shadow-lg}; + --#{$prefix}box-shadow-inset: #{$box-shadow-inset}; - --#{$prefix}code-color: #{$code-color}; + // Focus styles + // scss-docs-start root-focus-variables + --#{$prefix}focus-ring-width: #{$focus-ring-width}; + --#{$prefix}focus-ring-opacity: #{$focus-ring-opacity}; + --#{$prefix}focus-ring-color: #{$focus-ring-color}; + // scss-docs-end root-focus-variables - --#{$prefix}highlight-bg: #{$mark-bg}; + // scss-docs-start root-form-validation-variables + --#{$prefix}form-valid-color: #{$form-valid-color}; + --#{$prefix}form-valid-border-color: #{$form-valid-border-color}; + --#{$prefix}form-invalid-color: #{$form-invalid-color}; + --#{$prefix}form-invalid-border-color: #{$form-invalid-border-color}; + // scss-docs-end root-form-validation-variables +} + +@if $enable-dark-mode { + @include color-mode(dark, true) { + color-scheme: dark; + + // scss-docs-start root-dark-mode-vars + --#{$prefix}body-color: #{$body-color-dark}; + --#{$prefix}body-color-rgb: #{to-rgb($body-color-dark)}; + --#{$prefix}body-bg: #{$body-bg-dark}; + --#{$prefix}body-bg-rgb: #{to-rgb($body-bg-dark)}; + + --#{$prefix}emphasis-color: #{$body-emphasis-color-dark}; + --#{$prefix}emphasis-color-rgb: #{to-rgb($body-emphasis-color-dark)}; + + --#{$prefix}secondary-color: #{$body-secondary-color-dark}; + --#{$prefix}secondary-color-rgb: #{to-rgb($body-secondary-color-dark)}; + --#{$prefix}secondary-bg: #{$body-secondary-bg-dark}; + --#{$prefix}secondary-bg-rgb: #{to-rgb($body-secondary-bg-dark)}; + + --#{$prefix}tertiary-color: #{$body-tertiary-color-dark}; + --#{$prefix}tertiary-color-rgb: #{to-rgb($body-tertiary-color-dark)}; + --#{$prefix}tertiary-bg: #{$body-tertiary-bg-dark}; + --#{$prefix}tertiary-bg-rgb: #{to-rgb($body-tertiary-bg-dark)}; + + @each $color, $value in $theme-colors-text-dark { + --#{$prefix}#{$color}-text-emphasis: #{$value}; + } + + @each $color, $value in $theme-colors-bg-subtle-dark { + --#{$prefix}#{$color}-bg-subtle: #{$value}; + } + + @each $color, $value in $theme-colors-border-subtle-dark { + --#{$prefix}#{$color}-border-subtle: #{$value}; + } + + --#{$prefix}heading-color: #{$headings-color-dark}; + + --#{$prefix}link-color: #{$link-color-dark}; + --#{$prefix}link-hover-color: #{$link-hover-color-dark}; + --#{$prefix}link-color-rgb: #{to-rgb($link-color-dark)}; + --#{$prefix}link-hover-color-rgb: #{to-rgb($link-hover-color-dark)}; + + --#{$prefix}code-color: #{$code-color-dark}; + + --#{$prefix}border-color: #{$border-color-dark}; + --#{$prefix}border-color-translucent: #{$border-color-translucent-dark}; + + --#{$prefix}form-valid-color: #{$form-valid-color-dark}; + --#{$prefix}form-valid-border-color: #{$form-valid-border-color-dark}; + --#{$prefix}form-invalid-color: #{$form-invalid-color-dark}; + --#{$prefix}form-invalid-border-color: #{$form-invalid-border-color-dark}; + // scss-docs-end root-dark-mode-vars + } } diff --git a/scss/_tables.scss b/scss/_tables.scss index 1fdd43c..ebfc00a 100644 --- a/scss/_tables.scss +++ b/scss/_tables.scss @@ -3,6 +3,12 @@ // .table { + // Reset needed for nesting tables + --#{$prefix}table-color-type: initial; + --#{$prefix}table-bg-type: initial; + --#{$prefix}table-color-state: initial; + --#{$prefix}table-bg-state: initial; + // End of reset --#{$prefix}table-color: #{$table-color}; --#{$prefix}table-bg: #{$table-bg}; --#{$prefix}table-border-color: #{$table-border-color}; @@ -16,7 +22,6 @@ width: 100%; margin-bottom: $spacer; - color: var(--#{$prefix}table-color); vertical-align: $table-cell-vertical-align; border-color: var(--#{$prefix}table-border-color); @@ -27,9 +32,11 @@ // stylelint-disable-next-line selector-max-universal > :not(caption) > * > * { padding: $table-cell-padding-y $table-cell-padding-x; + // Following the precept of cascades: https://codepen.io/miriamsuzanne/full/vYNgodb + color: var(--#{$prefix}table-color-state, var(--#{$prefix}table-color-type, var(--#{$prefix}table-color))); background-color: var(--#{$prefix}table-bg); border-bottom-width: $table-border-width; - box-shadow: inset 0 0 0 9999px var(--#{$prefix}table-accent-bg); + box-shadow: inset 0 0 0 9999px var(--#{$prefix}table-bg-state, var(--#{$prefix}table-bg-type, var(--#{$prefix}table-accent-bg))); } > tbody { @@ -42,7 +49,7 @@ } .table-group-divider { - border-top: ($table-border-width * 2) solid $table-group-separator-color; + border-top: calc(#{$table-border-width} * 2) solid $table-group-separator-color; // stylelint-disable-line function-disallowed-list } // @@ -104,16 +111,16 @@ // For rows .table-striped { > tbody > tr:nth-of-type(#{$table-striped-order}) > * { - --#{$prefix}table-accent-bg: var(--#{$prefix}table-striped-bg); - color: var(--#{$prefix}table-striped-color); + --#{$prefix}table-color-type: var(--#{$prefix}table-striped-color); + --#{$prefix}table-bg-type: var(--#{$prefix}table-striped-bg); } } // For columns .table-striped-columns { > :not(caption) > tr > :nth-child(#{$table-striped-columns-order}) { - --#{$prefix}table-accent-bg: var(--#{$prefix}table-striped-bg); - color: var(--#{$prefix}table-striped-color); + --#{$prefix}table-color-type: var(--#{$prefix}table-striped-color); + --#{$prefix}table-bg-type: var(--#{$prefix}table-striped-bg); } } @@ -122,8 +129,8 @@ // The `.table-active` class can be added to highlight rows or cells .table-active { - --#{$prefix}table-accent-bg: var(--#{$prefix}table-active-bg); - color: var(--#{$prefix}table-active-color); + --#{$prefix}table-color-state: var(--#{$prefix}table-active-color); + --#{$prefix}table-bg-state: var(--#{$prefix}table-active-bg); } // Hover effect @@ -132,8 +139,8 @@ .table-hover { > tbody > tr:hover > * { - --#{$prefix}table-accent-bg: var(--#{$prefix}table-hover-bg); - color: var(--#{$prefix}table-hover-color); + --#{$prefix}table-color-state: var(--#{$prefix}table-hover-color); + --#{$prefix}table-bg-state: var(--#{$prefix}table-hover-bg); } } diff --git a/scss/_tooltip.scss b/scss/_tooltip.scss index 7da3df3..85de90f 100644 --- a/scss/_tooltip.scss +++ b/scss/_tooltip.scss @@ -17,7 +17,6 @@ z-index: var(--#{$prefix}tooltip-zindex); display: block; - padding: var(--#{$prefix}tooltip-arrow-height); margin: var(--#{$prefix}tooltip-margin); @include deprecate("`$tooltip-margin`", "v5", "v5.x", true); // Our parent element can be arbitrary since tooltips are by default inserted as a sibling of their target element. @@ -45,7 +44,7 @@ } .bs-tooltip-top .tooltip-arrow { - bottom: 0; + bottom: calc(-1 * var(--#{$prefix}tooltip-arrow-height)); // stylelint-disable-line function-disallowed-list &::before { top: -1px; @@ -56,7 +55,7 @@ /* rtl:begin:ignore */ .bs-tooltip-end .tooltip-arrow { - left: 0; + left: calc(-1 * var(--#{$prefix}tooltip-arrow-height)); // stylelint-disable-line function-disallowed-list width: var(--#{$prefix}tooltip-arrow-height); height: var(--#{$prefix}tooltip-arrow-width); @@ -70,7 +69,7 @@ /* rtl:end:ignore */ .bs-tooltip-bottom .tooltip-arrow { - top: 0; + top: calc(-1 * var(--#{$prefix}tooltip-arrow-height)); // stylelint-disable-line function-disallowed-list &::before { bottom: -1px; @@ -81,7 +80,7 @@ /* rtl:begin:ignore */ .bs-tooltip-start .tooltip-arrow { - right: 0; + right: calc(-1 * var(--#{$prefix}tooltip-arrow-height)); // stylelint-disable-line function-disallowed-list width: var(--#{$prefix}tooltip-arrow-height); height: var(--#{$prefix}tooltip-arrow-width); diff --git a/scss/_utilities.scss b/scss/_utilities.scss index 1e0d141..e6069c9 100644 --- a/scss/_utilities.scss +++ b/scss/_utilities.scss @@ -22,6 +22,20 @@ $utilities: map-merge( ) ), // scss-docs-end utils-float + // Object Fit utilities + // scss-docs-start utils-object-fit + "object-fit": ( + responsive: true, + property: object-fit, + values: ( + contain: contain, + cover: cover, + fill: fill, + scale: scale-down, + none: none, + ) + ), + // scss-docs-end utils-object-fit // Opacity utilities // scss-docs-start utils-opacity "opacity": ( @@ -40,6 +54,14 @@ $utilities: map-merge( property: overflow, values: auto hidden visible scroll, ), + "overflow-x": ( + property: overflow-x, + values: auto hidden visible scroll, + ), + "overflow-y": ( + property: overflow-y, + values: auto hidden visible scroll, + ), // scss-docs-end utils-overflow // scss-docs-start utils-display "display": ( @@ -47,7 +69,7 @@ $utilities: map-merge( print: true, property: display, class: d, - values: inline inline-block block grid table table-row table-cell flex inline-flex none + values: inline inline-block block grid inline-grid table table-row table-cell flex inline-flex none ), // scss-docs-end utils-display // scss-docs-start utils-shadow @@ -62,6 +84,14 @@ $utilities: map-merge( ) ), // scss-docs-end utils-shadow + // scss-docs-start utils-focus-ring + "focus-ring": ( + css-var: true, + css-variable-name: focus-ring-color, + class: focus-ring, + values: map-loop($theme-colors-rgb, rgba-css-var, "$key", "focus-ring") + ), + // scss-docs-end utils-focus-ring // scss-docs-start utils-position "position": ( property: position, @@ -141,9 +171,13 @@ $utilities: map-merge( ), values: $utilities-border-colors ), + "subtle-border-color": ( + property: border-color, + class: border, + values: $utilities-border-subtle + ), "border-width": ( - css-var: true, - css-variable-name: border-width, + property: border-width, class: border, values: $border-widths ), @@ -450,6 +484,18 @@ $utilities: map-merge( class: gap, values: $spacers ), + "row-gap": ( + responsive: true, + property: row-gap, + class: row-gap, + values: $spacers + ), + "column-gap": ( + responsive: true, + property: column-gap, + class: column-gap, + values: $spacers + ), // scss-docs-end utils-spacing // Text // scss-docs-start utils-text @@ -473,11 +519,12 @@ $utilities: map-merge( property: font-weight, class: fw, values: ( - light: $font-weight-light, lighter: $font-weight-lighter, + light: $font-weight-light, normal: $font-weight-normal, - bold: $font-weight-bold, + medium: $font-weight-medium, semibold: $font-weight-semibold, + bold: $font-weight-bold, bolder: $font-weight-bolder ) ), @@ -535,9 +582,12 @@ $utilities: map-merge( values: map-merge( $utilities-text-colors, ( - "muted": $text-muted, + "muted": var(--#{$prefix}secondary-color), // deprecated "black-50": rgba($black, .5), // deprecated "white-50": rgba($white, .5), // deprecated + "body-secondary": var(--#{$prefix}secondary-color), + "body-tertiary": var(--#{$prefix}tertiary-color), + "body-emphasis": var(--#{$prefix}emphasis-color), "reset": inherit, ) ) @@ -552,7 +602,62 @@ $utilities: map-merge( 100: 1 ) ), + "text-color": ( + property: color, + class: text, + values: $utilities-text-emphasis-colors + ), // scss-docs-end utils-color + // scss-docs-start utils-links + "link-opacity": ( + css-var: true, + class: link-opacity, + state: hover, + values: ( + 10: .1, + 25: .25, + 50: .5, + 75: .75, + 100: 1 + ) + ), + "link-offset": ( + property: text-underline-offset, + class: link-offset, + state: hover, + values: ( + 1: .125em, + 2: .25em, + 3: .375em, + ) + ), + "link-underline": ( + property: text-decoration-color, + class: link-underline, + local-vars: ( + "link-underline-opacity": 1 + ), + values: map-merge( + $utilities-links-underline, + ( + null: rgba(var(--#{$prefix}link-color-rgb), var(--#{$prefix}link-underline-opacity, 1)), + ) + ) + ), + "link-underline-opacity": ( + css-var: true, + class: link-underline-opacity, + state: hover, + values: ( + 0: 0, + 10: .1, + 25: .25, + 50: .5, + 75: .75, + 100: 1 + ), + ), + // scss-docs-end utils-links // scss-docs-start utils-bg-color "background-color": ( property: background-color, @@ -563,7 +668,9 @@ $utilities: map-merge( values: map-merge( $utilities-bg-colors, ( - "transparent": transparent + "transparent": transparent, + "body-secondary": rgba(var(--#{$prefix}secondary-bg-rgb), var(--#{$prefix}bg-opacity)), + "body-tertiary": rgba(var(--#{$prefix}tertiary-bg-rgb), var(--#{$prefix}bg-opacity)), ) ) ), @@ -578,6 +685,11 @@ $utilities: map-merge( 100: 1 ) ), + "subtle-background-color": ( + property: background-color, + class: bg, + values: $utilities-bg-subtle + ), // scss-docs-end utils-bg-color "gradient": ( property: background-image, @@ -606,7 +718,7 @@ $utilities: map-merge( 2: var(--#{$prefix}border-radius), 3: var(--#{$prefix}border-radius-lg), 4: var(--#{$prefix}border-radius-xl), - 5: var(--#{$prefix}border-radius-2xl), + 5: var(--#{$prefix}border-radius-xxl), circle: 50%, pill: var(--#{$prefix}border-radius-pill) ) @@ -614,22 +726,62 @@ $utilities: map-merge( "rounded-top": ( property: border-top-left-radius border-top-right-radius, class: rounded-top, - values: (null: var(--#{$prefix}border-radius)) + values: ( + null: var(--#{$prefix}border-radius), + 0: 0, + 1: var(--#{$prefix}border-radius-sm), + 2: var(--#{$prefix}border-radius), + 3: var(--#{$prefix}border-radius-lg), + 4: var(--#{$prefix}border-radius-xl), + 5: var(--#{$prefix}border-radius-xxl), + circle: 50%, + pill: var(--#{$prefix}border-radius-pill) + ) ), "rounded-end": ( property: border-top-right-radius border-bottom-right-radius, class: rounded-end, - values: (null: var(--#{$prefix}border-radius)) + values: ( + null: var(--#{$prefix}border-radius), + 0: 0, + 1: var(--#{$prefix}border-radius-sm), + 2: var(--#{$prefix}border-radius), + 3: var(--#{$prefix}border-radius-lg), + 4: var(--#{$prefix}border-radius-xl), + 5: var(--#{$prefix}border-radius-xxl), + circle: 50%, + pill: var(--#{$prefix}border-radius-pill) + ) ), "rounded-bottom": ( property: border-bottom-right-radius border-bottom-left-radius, class: rounded-bottom, - values: (null: var(--#{$prefix}border-radius)) + values: ( + null: var(--#{$prefix}border-radius), + 0: 0, + 1: var(--#{$prefix}border-radius-sm), + 2: var(--#{$prefix}border-radius), + 3: var(--#{$prefix}border-radius-lg), + 4: var(--#{$prefix}border-radius-xl), + 5: var(--#{$prefix}border-radius-xxl), + circle: 50%, + pill: var(--#{$prefix}border-radius-pill) + ) ), "rounded-start": ( property: border-bottom-left-radius border-top-left-radius, class: rounded-start, - values: (null: var(--#{$prefix}border-radius)) + values: ( + null: var(--#{$prefix}border-radius), + 0: 0, + 1: var(--#{$prefix}border-radius-sm), + 2: var(--#{$prefix}border-radius), + 3: var(--#{$prefix}border-radius-lg), + 4: var(--#{$prefix}border-radius-xl), + 5: var(--#{$prefix}border-radius-xxl), + circle: 50%, + pill: var(--#{$prefix}border-radius-pill) + ) ), // scss-docs-end utils-border-radius // scss-docs-start utils-visibility @@ -640,8 +792,15 @@ $utilities: map-merge( visible: visible, invisible: hidden, ) - ) + ), // scss-docs-end utils-visibility + // scss-docs-start utils-zindex + "z-index": ( + property: z-index, + class: z, + values: $zindex-levels, + ) + // scss-docs-end utils-zindex ), $utilities ); diff --git a/scss/_variables-dark.scss b/scss/_variables-dark.scss new file mode 100644 index 0000000..494eefa --- /dev/null +++ b/scss/_variables-dark.scss @@ -0,0 +1,85 @@ +// Dark color mode variables +// +// Custom variables for the `[data-bs-theme="dark"]` theme. Use this as a starting point for your own custom color modes by creating a new theme-specific file like `_variables-dark.scss` and adding the variables you need. + +// +// Global colors +// + +// scss-docs-start sass-dark-mode-vars +// scss-docs-start theme-text-dark-variables +$primary-text-emphasis-dark: tint-color($primary, 40%) !default; +$secondary-text-emphasis-dark: tint-color($secondary, 40%) !default; +$success-text-emphasis-dark: tint-color($success, 40%) !default; +$info-text-emphasis-dark: tint-color($info, 40%) !default; +$warning-text-emphasis-dark: tint-color($warning, 40%) !default; +$danger-text-emphasis-dark: tint-color($danger, 40%) !default; +$light-text-emphasis-dark: $gray-100 !default; +$dark-text-emphasis-dark: $gray-300 !default; +// scss-docs-end theme-text-dark-variables + +// scss-docs-start theme-bg-subtle-dark-variables +$primary-bg-subtle-dark: shade-color($primary, 80%) !default; +$secondary-bg-subtle-dark: shade-color($secondary, 80%) !default; +$success-bg-subtle-dark: shade-color($success, 80%) !default; +$info-bg-subtle-dark: shade-color($info, 80%) !default; +$warning-bg-subtle-dark: shade-color($warning, 80%) !default; +$danger-bg-subtle-dark: shade-color($danger, 80%) !default; +$light-bg-subtle-dark: $gray-800 !default; +$dark-bg-subtle-dark: mix($gray-800, $black) !default; +// scss-docs-end theme-bg-subtle-dark-variables + +// scss-docs-start theme-border-subtle-dark-variables +$primary-border-subtle-dark: shade-color($primary, 40%) !default; +$secondary-border-subtle-dark: shade-color($secondary, 40%) !default; +$success-border-subtle-dark: shade-color($success, 40%) !default; +$info-border-subtle-dark: shade-color($info, 40%) !default; +$warning-border-subtle-dark: shade-color($warning, 40%) !default; +$danger-border-subtle-dark: shade-color($danger, 40%) !default; +$light-border-subtle-dark: $gray-700 !default; +$dark-border-subtle-dark: $gray-800 !default; +// scss-docs-end theme-border-subtle-dark-variables + +$body-color-dark: $gray-500 !default; +$body-bg-dark: $gray-900 !default; +$body-secondary-color-dark: rgba($body-color-dark, .75) !default; +$body-secondary-bg-dark: $gray-800 !default; +$body-tertiary-color-dark: rgba($body-color-dark, .5) !default; +$body-tertiary-bg-dark: mix($gray-800, $gray-900, 50%) !default; +$body-emphasis-color-dark: $white !default; +$border-color-dark: $gray-700 !default; +$border-color-translucent-dark: rgba($white, .15) !default; +$headings-color-dark: inherit !default; +$link-color-dark: tint-color($primary, 40%) !default; +$link-hover-color-dark: shift-color($link-color-dark, -$link-shade-percentage) !default; +$code-color-dark: tint-color($code-color, 40%) !default; + + +// +// Forms +// + +$form-select-indicator-color-dark: $body-color-dark !default; +$form-select-indicator-dark: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='#{$form-select-indicator-color-dark}' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/></svg>") !default; + +$form-switch-color-dark: rgba($white, .25) !default; +$form-switch-bg-image-dark: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='#{$form-switch-color-dark}'/></svg>") !default; + +// scss-docs-start form-validation-colors-dark +$form-valid-color-dark: $green-300 !default; +$form-valid-border-color-dark: $green-300 !default; +$form-invalid-color-dark: $red-300 !default; +$form-invalid-border-color-dark: $red-300 !default; +// scss-docs-end form-validation-colors-dark + + +// +// Accordion +// + +$accordion-icon-color-dark: $primary-text-emphasis-dark !default; +$accordion-icon-active-color-dark: $primary-text-emphasis-dark !default; + +$accordion-button-icon-dark: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='#{$accordion-icon-color-dark}'><path fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/></svg>") !default; +$accordion-button-active-icon-dark: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='#{$accordion-icon-active-color-dark}'><path fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/></svg>") !default; +// scss-docs-end sass-dark-mode-vars diff --git a/scss/_variables.scss b/scss/_variables.scss index e021836..0288898 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -321,6 +321,39 @@ $theme-colors: ( ) !default; // scss-docs-end theme-colors-map +// scss-docs-start theme-text-variables +$primary-text-emphasis: shade-color($primary, 60%) !default; +$secondary-text-emphasis: shade-color($secondary, 60%) !default; +$success-text-emphasis: shade-color($success, 60%) !default; +$info-text-emphasis: shade-color($info, 60%) !default; +$warning-text-emphasis: shade-color($warning, 60%) !default; +$danger-text-emphasis: shade-color($danger, 60%) !default; +$light-text-emphasis: $gray-700 !default; +$dark-text-emphasis: $gray-700 !default; +// scss-docs-end theme-text-variables + +// scss-docs-start theme-bg-subtle-variables +$primary-bg-subtle: tint-color($primary, 80%) !default; +$secondary-bg-subtle: tint-color($secondary, 80%) !default; +$success-bg-subtle: tint-color($success, 80%) !default; +$info-bg-subtle: tint-color($info, 80%) !default; +$warning-bg-subtle: tint-color($warning, 80%) !default; +$danger-bg-subtle: tint-color($danger, 80%) !default; +$light-bg-subtle: mix($gray-100, $white) !default; +$dark-bg-subtle: $gray-400 !default; +// scss-docs-end theme-bg-subtle-variables + +// scss-docs-start theme-border-subtle-variables +$primary-border-subtle: tint-color($primary, 60%) !default; +$secondary-border-subtle: tint-color($secondary, 60%) !default; +$success-border-subtle: tint-color($success, 60%) !default; +$info-border-subtle: tint-color($info, 60%) !default; +$warning-border-subtle: tint-color($warning, 60%) !default; +$danger-border-subtle: tint-color($danger, 60%) !default; +$light-border-subtle: $gray-200 !default; +$dark-border-subtle: $gray-500 !default; +// scss-docs-end theme-border-subtle-variables + // Characters which are escaped by the escape-svg function $escaped-characters: ( ("<", "%3c"), @@ -351,6 +384,9 @@ $enable-negative-margins: false !default; $enable-deprecation-messages: true !default; $enable-important-utilities: true !default; +$enable-dark-mode: true !default; +$color-mode-type: data !default; // `data` or `media-query` + // Prefix for :root CSS variables $variable-prefix: bs- !default; // Deprecated in v5.2.0 for the shorter `$prefix` @@ -398,9 +434,17 @@ $position-values: ( // // Settings for the `<body>` element. -$body-bg: $white !default; -$body-color: $gray-900 !default; $body-text-align: null !default; +$body-color: $gray-900 !default; +$body-bg: $white !default; + +$body-secondary-color: rgba($body-color, .75) !default; +$body-secondary-bg: $gray-200 !default; + +$body-tertiary-color: rgba($body-color, .5) !default; +$body-tertiary-bg: $gray-100 !default; + +$body-emphasis-color: $black !default; // Links // @@ -415,6 +459,15 @@ $link-hover-decoration: null !default; $stretched-link-pseudo-element: after !default; $stretched-link-z-index: 1 !default; +// Icon links +// scss-docs-start icon-link-variables +$icon-link-gap: .375rem !default; +$icon-link-underline-offset: .25em !default; +$icon-link-icon-size: 1em !default; +$icon-link-icon-transition: .2s ease-in-out transform !default; +$icon-link-icon-transform: translate3d(.25em, 0, 0) !default; +// scss-docs-end icon-link-variables + // Paragraphs // // Style p element. @@ -485,7 +538,6 @@ $border-widths: ( 4: 4px, 5: 5px ) !default; - $border-style: solid !default; $border-color: $gray-300 !default; $border-color-translucent: rgba($black, .175) !default; @@ -496,9 +548,12 @@ $border-radius: .375rem !default; $border-radius-sm: .25rem !default; $border-radius-lg: .5rem !default; $border-radius-xl: 1rem !default; -$border-radius-2xl: 2rem !default; +$border-radius-xxl: 2rem !default; $border-radius-pill: 50rem !default; // scss-docs-end border-radius-variables +// fusv-disable +$border-radius-2xl: $border-radius-xxl !default; // Deprecated in v5.3.0 +// fusv-enable // scss-docs-start box-shadow-variables $box-shadow: 0 .5rem 1rem rgba($black, .15) !default; @@ -510,6 +565,14 @@ $box-shadow-inset: inset 0 1px 2px rgba($black, .075) !default; $component-active-color: $white !default; $component-active-bg: $primary !default; +// scss-docs-start focus-ring-variables +$focus-ring-width: .25rem !default; +$focus-ring-opacity: .25 !default; +$focus-ring-color: rgba($primary, $focus-ring-opacity) !default; +$focus-ring-blur: 0 !default; +$focus-ring-box-shadow: 0 0 $focus-ring-blur $focus-ring-width $focus-ring-color !default; +// scss-docs-end focus-ring-variables + // scss-docs-start caret-variables $caret-width: .3em !default; $caret-vertical-align: $caret-width * .85 !default; @@ -556,6 +619,7 @@ $font-size-lg: $font-size-base * 1.25 !default; $font-weight-lighter: lighter !default; $font-weight-light: 300 !default; $font-weight-normal: 400 !default; +$font-weight-medium: 500 !default; $font-weight-semibold: 600 !default; $font-weight-bold: 700 !default; $font-weight-bolder: bolder !default; @@ -591,7 +655,7 @@ $headings-font-family: null !default; $headings-font-style: null !default; $headings-font-weight: 500 !default; $headings-line-height: 1.2 !default; -$headings-color: null !default; +$headings-color: inherit !default; // scss-docs-end headings-variables // scss-docs-start display-headings @@ -618,7 +682,9 @@ $small-font-size: .875em !default; $sub-sup-font-size: .75em !default; -$text-muted: $gray-600 !default; +// fusv-disable +$text-muted: var(--#{$prefix}secondary-color) !default; // Deprecated in 5.3.0 +// fusv-enable $initialism-font-size: $small-font-size !default; @@ -636,7 +702,7 @@ $hr-height: null !default; // Deprecated in v5.2.0 // fusv-enable $hr-border-color: null !default; // Allows for inherited colors -$hr-border-width: $border-width !default; +$hr-border-width: var(--#{$prefix}border-width) !default; $hr-opacity: .25 !default; $legend-margin-bottom: .5rem !default; @@ -665,7 +731,7 @@ $table-cell-padding-x-sm: .25rem !default; $table-cell-vertical-align: top !default; $table-color: var(--#{$prefix}body-color) !default; -$table-bg: transparent !default; +$table-bg: var(--#{$prefix}body-bg) !default; $table-accent-bg: transparent !default; $table-th-font-weight: null !default; @@ -683,7 +749,7 @@ $table-hover-bg-factor: .075 !default; $table-hover-bg: rgba($black, $table-hover-bg-factor) !default; $table-border-factor: .1 !default; -$table-border-width: $border-width !default; +$table-border-width: var(--#{$prefix}border-width) !default; $table-border-color: var(--#{$prefix}border-color) !default; $table-striped-order: odd !default; @@ -691,7 +757,7 @@ $table-striped-columns-order: even !default; $table-group-separator-color: currentcolor !default; -$table-caption-color: $text-muted !default; +$table-caption-color: var(--#{$prefix}secondary-color) !default; $table-bg-scale: -80% !default; // scss-docs-end table-variables @@ -721,11 +787,11 @@ $input-btn-font-family: null !default; $input-btn-font-size: $font-size-base !default; $input-btn-line-height: $line-height-base !default; -$input-btn-focus-width: .25rem !default; -$input-btn-focus-color-opacity: .25 !default; -$input-btn-focus-color: rgba($component-active-bg, $input-btn-focus-color-opacity) !default; -$input-btn-focus-blur: 0 !default; -$input-btn-focus-box-shadow: 0 0 $input-btn-focus-blur $input-btn-focus-width $input-btn-focus-color !default; +$input-btn-focus-width: $focus-ring-width !default; +$input-btn-focus-color-opacity: $focus-ring-opacity !default; +$input-btn-focus-color: $focus-ring-color !default; +$input-btn-focus-blur: $focus-ring-blur !default; +$input-btn-focus-box-shadow: $focus-ring-box-shadow !default; $input-btn-padding-y-sm: .25rem !default; $input-btn-padding-x-sm: .5rem !default; @@ -735,7 +801,7 @@ $input-btn-padding-y-lg: .5rem !default; $input-btn-padding-x-lg: 1rem !default; $input-btn-font-size-lg: $font-size-lg !default; -$input-btn-border-width: $border-width !default; +$input-btn-border-width: var(--#{$prefix}border-width) !default; // scss-docs-end input-btn-variables @@ -744,6 +810,7 @@ $input-btn-border-width: $border-width !default; // For each of Bootstrap's buttons, define text, background, and border color. // scss-docs-start btn-variables +$btn-color: var(--#{$prefix}body-color) !default; $btn-padding-y: $input-btn-padding-y !default; $btn-padding-x: $input-btn-padding-x !default; $btn-font-family: $input-btn-font-family !default; @@ -773,9 +840,9 @@ $btn-link-hover-color: var(--#{$prefix}link-hover-color) !default; $btn-link-disabled-color: $gray-600 !default; // Allows for customizing button radius independently from global border radius -$btn-border-radius: $border-radius !default; -$btn-border-radius-sm: $border-radius-sm !default; -$btn-border-radius-lg: $border-radius-lg !default; +$btn-border-radius: var(--#{$prefix}border-radius) !default; +$btn-border-radius-sm: var(--#{$prefix}border-radius-sm) !default; +$btn-border-radius-lg: var(--#{$prefix}border-radius-lg) !default; $btn-transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out !default; @@ -797,7 +864,7 @@ $form-text-margin-top: .25rem !default; $form-text-font-size: $small-font-size !default; $form-text-font-style: null !default; $form-text-font-weight: null !default; -$form-text-color: $text-muted !default; +$form-text-color: var(--#{$prefix}secondary-color) !default; // scss-docs-end form-text-variables // scss-docs-start form-label-variables @@ -824,19 +891,19 @@ $input-padding-y-lg: $input-btn-padding-y-lg !default; $input-padding-x-lg: $input-btn-padding-x-lg !default; $input-font-size-lg: $input-btn-font-size-lg !default; -$input-bg: $body-bg !default; +$input-bg: var(--#{$prefix}body-bg) !default; $input-disabled-color: null !default; -$input-disabled-bg: $gray-200 !default; +$input-disabled-bg: var(--#{$prefix}secondary-bg) !default; $input-disabled-border-color: null !default; -$input-color: $body-color !default; -$input-border-color: $gray-400 !default; +$input-color: var(--#{$prefix}body-color) !default; +$input-border-color: var(--#{$prefix}border-color) !default; $input-border-width: $input-btn-border-width !default; $input-box-shadow: $box-shadow-inset !default; -$input-border-radius: $border-radius !default; -$input-border-radius-sm: $border-radius-sm !default; -$input-border-radius-lg: $border-radius-lg !default; +$input-border-radius: var(--#{$prefix}border-radius) !default; +$input-border-radius-sm: var(--#{$prefix}border-radius-sm) !default; +$input-border-radius-lg: var(--#{$prefix}border-radius-lg) !default; $input-focus-bg: $input-bg !default; $input-focus-border-color: tint-color($component-active-bg, 50%) !default; @@ -844,10 +911,10 @@ $input-focus-color: $input-color !default; $input-focus-width: $input-btn-focus-width !default; $input-focus-box-shadow: $input-btn-focus-box-shadow !default; -$input-placeholder-color: $gray-600 !default; -$input-plaintext-color: $body-color !default; +$input-placeholder-color: var(--#{$prefix}secondary-color) !default; +$input-plaintext-color: var(--#{$prefix}body-color) !default; -$input-height-border: $input-border-width * 2 !default; +$input-height-border: calc(#{$input-border-width} * 2) !default; // stylelint-disable-line function-disallowed-list $input-height-inner: add($input-line-height * 1em, $input-padding-y * 2) !default; $input-height-inner-half: add($input-line-height * .5em, $input-padding-y) !default; @@ -874,11 +941,11 @@ $form-check-transition: null !default; $form-check-input-active-filter: brightness(90%) !default; $form-check-input-bg: $input-bg !default; -$form-check-input-border: 1px solid rgba($black, .25) !default; +$form-check-input-border: var(--#{$prefix}border-width) solid var(--#{$prefix}border-color) !default; $form-check-input-border-radius: .25em !default; $form-check-radio-border-radius: 50% !default; $form-check-input-focus-border: $input-focus-border-color !default; -$form-check-input-focus-box-shadow: $input-btn-focus-box-shadow !default; +$form-check-input-focus-box-shadow: $focus-ring-box-shadow !default; $form-check-input-checked-color: $component-active-color !default; $form-check-input-checked-bg-color: $component-active-bg !default; @@ -919,7 +986,7 @@ $input-group-addon-padding-y: $input-padding-y !default; $input-group-addon-padding-x: $input-padding-x !default; $input-group-addon-font-weight: $input-font-weight !default; $input-group-addon-color: $input-color !default; -$input-group-addon-bg: $gray-200 !default; +$input-group-addon-bg: var(--#{$prefix}tertiary-bg) !default; $input-group-addon-border-color: $input-border-color !default; // scss-docs-end input-group-variables @@ -934,7 +1001,7 @@ $form-select-line-height: $input-line-height !default; $form-select-color: $input-color !default; $form-select-bg: $input-bg !default; $form-select-disabled-color: null !default; -$form-select-disabled-bg: $gray-200 !default; +$form-select-disabled-bg: $input-disabled-bg !default; $form-select-disabled-border-color: $input-disabled-border-color !default; $form-select-bg-position: right $form-select-padding-x center !default; $form-select-bg-size: 16px 12px !default; // In pixels because image dimensions @@ -971,7 +1038,7 @@ $form-select-transition: $input-transition !default; $form-range-track-width: 100% !default; $form-range-track-height: .5rem !default; $form-range-track-cursor: pointer !default; -$form-range-track-bg: $gray-300 !default; +$form-range-track-bg: var(--#{$prefix}tertiary-bg) !default; $form-range-track-border-radius: 1rem !default; $form-range-track-box-shadow: $box-shadow-inset !default; @@ -984,26 +1051,28 @@ $form-range-thumb-box-shadow: 0 .1rem .25rem rgba($black, .1) !defa $form-range-thumb-focus-box-shadow: 0 0 0 1px $body-bg, $input-focus-box-shadow !default; $form-range-thumb-focus-box-shadow-width: $input-focus-width !default; // For focus box shadow issue in Edge $form-range-thumb-active-bg: tint-color($component-active-bg, 70%) !default; -$form-range-thumb-disabled-bg: $gray-500 !default; +$form-range-thumb-disabled-bg: var(--#{$prefix}secondary-color) !default; $form-range-thumb-transition: background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out !default; // scss-docs-end form-range-variables // scss-docs-start form-file-variables $form-file-button-color: $input-color !default; -$form-file-button-bg: $input-group-addon-bg !default; -$form-file-button-hover-bg: shade-color($form-file-button-bg, 5%) !default; +$form-file-button-bg: var(--#{$prefix}tertiary-bg) !default; +$form-file-button-hover-bg: var(--#{$prefix}secondary-bg) !default; // scss-docs-end form-file-variables // scss-docs-start form-floating-variables -$form-floating-height: add(3.5rem, $input-height-border) !default; -$form-floating-line-height: 1.25 !default; -$form-floating-padding-x: $input-padding-x !default; -$form-floating-padding-y: 1rem !default; -$form-floating-input-padding-t: 1.625rem !default; -$form-floating-input-padding-b: .625rem !default; -$form-floating-label-opacity: .65 !default; -$form-floating-label-transform: scale(.85) translateY(-.5rem) translateX(.15rem) !default; -$form-floating-transition: opacity .1s ease-in-out, transform .1s ease-in-out !default; +$form-floating-height: add(3.5rem, $input-height-border) !default; +$form-floating-line-height: 1.25 !default; +$form-floating-padding-x: $input-padding-x !default; +$form-floating-padding-y: 1rem !default; +$form-floating-input-padding-t: 1.625rem !default; +$form-floating-input-padding-b: .625rem !default; +$form-floating-label-height: 1.5em !default; +$form-floating-label-opacity: .65 !default; +$form-floating-label-transform: scale(.85) translateY(-.5rem) translateX(.15rem) !default; +$form-floating-label-disabled-color: $gray-600 !default; +$form-floating-transition: opacity .1s ease-in-out, transform .1s ease-in-out !default; // scss-docs-end form-floating-variables // Form validation @@ -1021,15 +1090,30 @@ $form-feedback-icon-invalid-color: $form-feedback-invalid-color !default; $form-feedback-icon-invalid: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='#{$form-feedback-icon-invalid-color}'><circle cx='6' cy='6' r='4.5'/><path stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/><circle cx='6' cy='8.2' r='.6' fill='#{$form-feedback-icon-invalid-color}' stroke='none'/></svg>") !default; // scss-docs-end form-feedback-variables +// scss-docs-start form-validation-colors +$form-valid-color: $form-feedback-valid-color !default; +$form-valid-border-color: $form-feedback-valid-color !default; +$form-invalid-color: $form-feedback-invalid-color !default; +$form-invalid-border-color: $form-feedback-invalid-color !default; +// scss-docs-end form-validation-colors + // scss-docs-start form-validation-states $form-validation-states: ( "valid": ( - "color": $form-feedback-valid-color, - "icon": $form-feedback-icon-valid + "color": var(--#{$prefix}form-valid-color), + "icon": $form-feedback-icon-valid, + "tooltip-color": #fff, + "tooltip-bg-color": var(--#{$prefix}success), + "focus-box-shadow": 0 0 $input-btn-focus-blur $input-focus-width rgba(var(--#{$prefix}success-rgb), $input-btn-focus-color-opacity), + "border-color": var(--#{$prefix}form-valid-border-color), ), "invalid": ( - "color": $form-feedback-invalid-color, - "icon": $form-feedback-icon-invalid + "color": var(--#{$prefix}form-invalid-color), + "icon": $form-feedback-icon-invalid, + "tooltip-color": #fff, + "tooltip-bg-color": var(--#{$prefix}danger), + "focus-box-shadow": 0 0 $input-btn-focus-blur $input-focus-width rgba(var(--#{$prefix}danger-rgb), $input-btn-focus-color-opacity), + "border-color": var(--#{$prefix}form-invalid-border-color), ) ) !default; // scss-docs-end form-validation-states @@ -1052,6 +1136,16 @@ $zindex-tooltip: 1080 !default; $zindex-toast: 1090 !default; // scss-docs-end zindex-stack +// scss-docs-start zindex-levels-map +$zindex-levels: ( + n1: -1, + 0: 0, + 1: 1, + 2: 2, + 3: 3 +) !default; +// scss-docs-end zindex-levels-map + // Navs @@ -1063,19 +1157,24 @@ $nav-link-font-weight: null !default; $nav-link-color: var(--#{$prefix}link-color) !default; $nav-link-hover-color: var(--#{$prefix}link-hover-color) !default; $nav-link-transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out !default; -$nav-link-disabled-color: $gray-600 !default; - -$nav-tabs-border-color: $gray-300 !default; -$nav-tabs-border-width: $border-width !default; -$nav-tabs-border-radius: $border-radius !default; -$nav-tabs-link-hover-border-color: $gray-200 $gray-200 $nav-tabs-border-color !default; -$nav-tabs-link-active-color: $gray-700 !default; -$nav-tabs-link-active-bg: $body-bg !default; -$nav-tabs-link-active-border-color: $gray-300 $gray-300 $nav-tabs-link-active-bg !default; - -$nav-pills-border-radius: $border-radius !default; +$nav-link-disabled-color: var(--#{$prefix}secondary-color) !default; +$nav-link-focus-box-shadow: $focus-ring-box-shadow !default; + +$nav-tabs-border-color: var(--#{$prefix}border-color) !default; +$nav-tabs-border-width: var(--#{$prefix}border-width) !default; +$nav-tabs-border-radius: var(--#{$prefix}border-radius) !default; +$nav-tabs-link-hover-border-color: var(--#{$prefix}secondary-bg) var(--#{$prefix}secondary-bg) $nav-tabs-border-color !default; +$nav-tabs-link-active-color: var(--#{$prefix}emphasis-color) !default; +$nav-tabs-link-active-bg: var(--#{$prefix}body-bg) !default; +$nav-tabs-link-active-border-color: var(--#{$prefix}border-color) var(--#{$prefix}border-color) $nav-tabs-link-active-bg !default; + +$nav-pills-border-radius: var(--#{$prefix}border-radius) !default; $nav-pills-link-active-color: $component-active-color !default; $nav-pills-link-active-bg: $component-active-bg !default; + +$nav-underline-gap: 1rem !default; +$nav-underline-border-width: .125rem !default; +$nav-underline-link-active-color: var(--#{$prefix}emphasis-color) !default; // scss-docs-end nav-variables @@ -1101,12 +1200,13 @@ $navbar-toggler-border-radius: $btn-border-radius !default; $navbar-toggler-focus-width: $btn-focus-width !default; $navbar-toggler-transition: box-shadow .15s ease-in-out !default; -$navbar-light-color: rgba($black, .55) !default; -$navbar-light-hover-color: rgba($black, .7) !default; -$navbar-light-active-color: rgba($black, .9) !default; -$navbar-light-disabled-color: rgba($black, .3) !default; -$navbar-light-toggler-icon-bg: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke='#{$navbar-light-color}' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg>") !default; -$navbar-light-toggler-border-color: rgba($black, .1) !default; +$navbar-light-color: rgba(var(--#{$prefix}emphasis-color-rgb), .65) !default; +$navbar-light-hover-color: rgba(var(--#{$prefix}emphasis-color-rgb), .8) !default; +$navbar-light-active-color: rgba(var(--#{$prefix}emphasis-color-rgb), 1) !default; +$navbar-light-disabled-color: rgba(var(--#{$prefix}emphasis-color-rgb), .3) !default; +$navbar-light-icon-color: rgba($body-color, .75) !default; +$navbar-light-toggler-icon-bg: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke='#{$navbar-light-icon-color}' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg>") !default; +$navbar-light-toggler-border-color: rgba(var(--#{$prefix}emphasis-color-rgb), .15) !default; $navbar-light-brand-color: $navbar-light-active-color !default; $navbar-light-brand-hover-color: $navbar-light-active-color !default; // scss-docs-end navbar-variables @@ -1133,24 +1233,24 @@ $dropdown-padding-x: 0 !default; $dropdown-padding-y: .5rem !default; $dropdown-spacer: .125rem !default; $dropdown-font-size: $font-size-base !default; -$dropdown-color: $body-color !default; -$dropdown-bg: $white !default; +$dropdown-color: var(--#{$prefix}body-color) !default; +$dropdown-bg: var(--#{$prefix}body-bg) !default; $dropdown-border-color: var(--#{$prefix}border-color-translucent) !default; -$dropdown-border-radius: $border-radius !default; -$dropdown-border-width: $border-width !default; -$dropdown-inner-border-radius: subtract($dropdown-border-radius, $dropdown-border-width) !default; +$dropdown-border-radius: var(--#{$prefix}border-radius) !default; +$dropdown-border-width: var(--#{$prefix}border-width) !default; +$dropdown-inner-border-radius: calc(#{$dropdown-border-radius} - #{$dropdown-border-width}) !default; // stylelint-disable-line function-disallowed-list $dropdown-divider-bg: $dropdown-border-color !default; $dropdown-divider-margin-y: $spacer * .5 !default; $dropdown-box-shadow: $box-shadow !default; -$dropdown-link-color: $gray-900 !default; -$dropdown-link-hover-color: shade-color($dropdown-link-color, 10%) !default; -$dropdown-link-hover-bg: $gray-200 !default; +$dropdown-link-color: var(--#{$prefix}body-color) !default; +$dropdown-link-hover-color: $dropdown-link-color !default; +$dropdown-link-hover-bg: var(--#{$prefix}tertiary-bg) !default; $dropdown-link-active-color: $component-active-color !default; $dropdown-link-active-bg: $component-active-bg !default; -$dropdown-link-disabled-color: $gray-500 !default; +$dropdown-link-disabled-color: var(--#{$prefix}tertiary-color) !default; $dropdown-item-padding-y: $spacer * .25 !default; $dropdown-item-padding-x: $spacer !default; @@ -1192,33 +1292,33 @@ $pagination-padding-x-lg: 1.5rem !default; $pagination-font-size: $font-size-base !default; $pagination-color: var(--#{$prefix}link-color) !default; -$pagination-bg: $white !default; -$pagination-border-radius: $border-radius !default; -$pagination-border-width: $border-width !default; -$pagination-margin-start: ($pagination-border-width * -1) !default; -$pagination-border-color: $gray-300 !default; +$pagination-bg: var(--#{$prefix}body-bg) !default; +$pagination-border-radius: var(--#{$prefix}border-radius) !default; +$pagination-border-width: var(--#{$prefix}border-width) !default; +$pagination-margin-start: calc(#{$pagination-border-width} * -1) !default; // stylelint-disable-line function-disallowed-list +$pagination-border-color: var(--#{$prefix}border-color) !default; $pagination-focus-color: var(--#{$prefix}link-hover-color) !default; -$pagination-focus-bg: $gray-200 !default; -$pagination-focus-box-shadow: $input-btn-focus-box-shadow !default; +$pagination-focus-bg: var(--#{$prefix}secondary-bg) !default; +$pagination-focus-box-shadow: $focus-ring-box-shadow !default; $pagination-focus-outline: 0 !default; $pagination-hover-color: var(--#{$prefix}link-hover-color) !default; -$pagination-hover-bg: $gray-200 !default; -$pagination-hover-border-color: $gray-300 !default; +$pagination-hover-bg: var(--#{$prefix}tertiary-bg) !default; +$pagination-hover-border-color: var(--#{$prefix}border-color) !default; // Todo in v6: remove this? $pagination-active-color: $component-active-color !default; $pagination-active-bg: $component-active-bg !default; -$pagination-active-border-color: $pagination-active-bg !default; +$pagination-active-border-color: $component-active-bg !default; -$pagination-disabled-color: $gray-600 !default; -$pagination-disabled-bg: $white !default; -$pagination-disabled-border-color: $gray-300 !default; +$pagination-disabled-color: var(--#{$prefix}secondary-color) !default; +$pagination-disabled-bg: var(--#{$prefix}secondary-bg) !default; +$pagination-disabled-border-color: var(--#{$prefix}border-color) !default; $pagination-transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out !default; -$pagination-border-radius-sm: $border-radius-sm !default; -$pagination-border-radius-lg: $border-radius-lg !default; +$pagination-border-radius-sm: var(--#{$prefix}border-radius-sm) !default; +$pagination-border-radius-lg: var(--#{$prefix}border-radius-lg) !default; // scss-docs-end pagination-variables @@ -1235,18 +1335,20 @@ $placeholder-opacity-min: .2 !default; $card-spacer-y: $spacer !default; $card-spacer-x: $spacer !default; $card-title-spacer-y: $spacer * .5 !default; -$card-border-width: $border-width !default; +$card-title-color: null !default; +$card-subtitle-color: null !default; +$card-border-width: var(--#{$prefix}border-width) !default; $card-border-color: var(--#{$prefix}border-color-translucent) !default; -$card-border-radius: $border-radius !default; +$card-border-radius: var(--#{$prefix}border-radius) !default; $card-box-shadow: null !default; $card-inner-border-radius: subtract($card-border-radius, $card-border-width) !default; $card-cap-padding-y: $card-spacer-y * .5 !default; $card-cap-padding-x: $card-spacer-x !default; -$card-cap-bg: rgba($black, .03) !default; +$card-cap-bg: rgba(var(--#{$prefix}body-color-rgb), .03) !default; $card-cap-color: null !default; $card-height: null !default; $card-color: null !default; -$card-bg: $white !default; +$card-bg: var(--#{$prefix}body-bg) !default; $card-img-overlay-padding: $spacer !default; $card-group-margin: $grid-gutter-width * .5 !default; // scss-docs-end card-variables @@ -1256,11 +1358,11 @@ $card-group-margin: $grid-gutter-width * .5 !default; // scss-docs-start accordion-variables $accordion-padding-y: 1rem !default; $accordion-padding-x: 1.25rem !default; -$accordion-color: $body-color !default; // Sass variable because of $accordion-button-icon -$accordion-bg: $body-bg !default; -$accordion-border-width: $border-width !default; +$accordion-color: var(--#{$prefix}body-color) !default; +$accordion-bg: var(--#{$prefix}body-bg) !default; +$accordion-border-width: var(--#{$prefix}border-width) !default; $accordion-border-color: var(--#{$prefix}border-color) !default; -$accordion-border-radius: $border-radius !default; +$accordion-border-radius: var(--#{$prefix}border-radius) !default; $accordion-inner-border-radius: subtract($accordion-border-radius, $accordion-border-width) !default; $accordion-body-padding-y: $accordion-padding-y !default; @@ -1268,18 +1370,18 @@ $accordion-body-padding-x: $accordion-padding-x !default; $accordion-button-padding-y: $accordion-padding-y !default; $accordion-button-padding-x: $accordion-padding-x !default; -$accordion-button-color: $accordion-color !default; +$accordion-button-color: var(--#{$prefix}body-color) !default; $accordion-button-bg: var(--#{$prefix}accordion-bg) !default; $accordion-transition: $btn-transition, border-radius .15s ease !default; -$accordion-button-active-bg: tint-color($component-active-bg, 90%) !default; -$accordion-button-active-color: shade-color($primary, 10%) !default; +$accordion-button-active-bg: var(--#{$prefix}primary-bg-subtle) !default; +$accordion-button-active-color: var(--#{$prefix}primary-text-emphasis) !default; $accordion-button-focus-border-color: $input-focus-border-color !default; $accordion-button-focus-box-shadow: $btn-focus-box-shadow !default; $accordion-icon-width: 1.25rem !default; -$accordion-icon-color: $accordion-button-color !default; -$accordion-icon-active-color: $accordion-button-active-color !default; +$accordion-icon-color: $body-color !default; +$accordion-icon-active-color: $primary-text-emphasis !default; $accordion-icon-transition: transform .2s ease-in-out !default; $accordion-icon-transform: rotate(-180deg) !default; @@ -1292,9 +1394,9 @@ $accordion-button-active-icon: url("data:image/svg+xml,<svg xmlns='http://www.w // scss-docs-start tooltip-variables $tooltip-font-size: $font-size-sm !default; $tooltip-max-width: 200px !default; -$tooltip-color: $white !default; -$tooltip-bg: $black !default; -$tooltip-border-radius: $border-radius !default; +$tooltip-color: var(--#{$prefix}body-bg) !default; +$tooltip-bg: var(--#{$prefix}emphasis-color) !default; +$tooltip-border-radius: var(--#{$prefix}border-radius) !default; $tooltip-opacity: .9 !default; $tooltip-padding-y: $spacer * .25 !default; $tooltip-padding-x: $spacer * .5 !default; @@ -1322,21 +1424,21 @@ $form-feedback-tooltip-border-radius: $tooltip-border-radius !default; // scss-docs-start popover-variables $popover-font-size: $font-size-sm !default; -$popover-bg: $white !default; +$popover-bg: var(--#{$prefix}body-bg) !default; $popover-max-width: 276px !default; -$popover-border-width: $border-width !default; +$popover-border-width: var(--#{$prefix}border-width) !default; $popover-border-color: var(--#{$prefix}border-color-translucent) !default; -$popover-border-radius: $border-radius-lg !default; -$popover-inner-border-radius: subtract($popover-border-radius, $popover-border-width) !default; +$popover-border-radius: var(--#{$prefix}border-radius-lg) !default; +$popover-inner-border-radius: calc(#{$popover-border-radius} - #{$popover-border-width}) !default; // stylelint-disable-line function-disallowed-list $popover-box-shadow: $box-shadow !default; $popover-header-font-size: $font-size-base !default; -$popover-header-bg: shade-color($popover-bg, 6%) !default; +$popover-header-bg: var(--#{$prefix}secondary-bg) !default; $popover-header-color: $headings-color !default; $popover-header-padding-y: .5rem !default; $popover-header-padding-x: $spacer !default; -$popover-body-color: $body-color !default; +$popover-body-color: var(--#{$prefix}body-color) !default; $popover-body-padding-y: $spacer !default; $popover-body-padding-x: $spacer !default; @@ -1359,16 +1461,16 @@ $toast-padding-x: .75rem !default; $toast-padding-y: .5rem !default; $toast-font-size: .875rem !default; $toast-color: null !default; -$toast-background-color: rgba($white, .85) !default; -$toast-border-width: $border-width !default; +$toast-background-color: rgba(var(--#{$prefix}body-bg-rgb), .85) !default; +$toast-border-width: var(--#{$prefix}border-width) !default; $toast-border-color: var(--#{$prefix}border-color-translucent) !default; -$toast-border-radius: $border-radius !default; -$toast-box-shadow: $box-shadow !default; +$toast-border-radius: var(--#{$prefix}border-radius) !default; +$toast-box-shadow: var(--#{$prefix}box-shadow) !default; $toast-spacing: $container-padding-x !default; -$toast-header-color: $gray-600 !default; -$toast-header-background-color: rgba($white, .85) !default; -$toast-header-border-color: rgba($black, .05) !default; +$toast-header-color: var(--#{$prefix}secondary-color) !default; +$toast-header-background-color: rgba(var(--#{$prefix}body-bg-rgb), .85) !default; +$toast-header-border-color: $toast-border-color !default; // scss-docs-end toast-variables @@ -1380,7 +1482,7 @@ $badge-font-weight: $font-weight-bold !default; $badge-color: $white !default; $badge-padding-y: .35em !default; $badge-padding-x: .65em !default; -$badge-border-radius: $border-radius !default; +$badge-border-radius: var(--#{$prefix}border-radius) !default; // scss-docs-end badge-variables @@ -1397,10 +1499,10 @@ $modal-dialog-margin-y-sm-up: 1.75rem !default; $modal-title-line-height: $line-height-base !default; $modal-content-color: null !default; -$modal-content-bg: $white !default; +$modal-content-bg: var(--#{$prefix}body-bg) !default; $modal-content-border-color: var(--#{$prefix}border-color-translucent) !default; -$modal-content-border-width: $border-width !default; -$modal-content-border-radius: $border-radius-lg !default; +$modal-content-border-width: var(--#{$prefix}border-width) !default; +$modal-content-border-radius: var(--#{$prefix}border-radius-lg) !default; $modal-content-inner-border-radius: subtract($modal-content-border-radius, $modal-content-border-width) !default; $modal-content-box-shadow-xs: $box-shadow-sm !default; $modal-content-box-shadow-sm-up: $box-shadow !default; @@ -1438,24 +1540,29 @@ $modal-scale-transform: scale(1.02) !default; $alert-padding-y: $spacer !default; $alert-padding-x: $spacer !default; $alert-margin-bottom: 1rem !default; -$alert-border-radius: $border-radius !default; +$alert-border-radius: var(--#{$prefix}border-radius) !default; $alert-link-font-weight: $font-weight-bold !default; -$alert-border-width: $border-width !default; +$alert-border-width: var(--#{$prefix}border-width) !default; $alert-bg-scale: -80% !default; $alert-border-scale: -70% !default; $alert-color-scale: 40% !default; $alert-dismissible-padding-r: $alert-padding-x * 3 !default; // 3x covers width of x plus default padding on either side // scss-docs-end alert-variables +// fusv-disable +$alert-bg-scale: -80% !default; // Deprecated in v5.2.0, to be removed in v6 +$alert-border-scale: -70% !default; // Deprecated in v5.2.0, to be removed in v6 +$alert-color-scale: 40% !default; // Deprecated in v5.2.0, to be removed in v6 +// fusv-enable // Progress bars // scss-docs-start progress-variables $progress-height: 1rem !default; $progress-font-size: $font-size-base * .75 !default; -$progress-bg: $gray-200 !default; -$progress-border-radius: $border-radius !default; -$progress-box-shadow: $box-shadow-inset !default; +$progress-bg: var(--#{$prefix}secondary-bg) !default; +$progress-border-radius: var(--#{$prefix}border-radius) !default; +$progress-box-shadow: var(--#{$prefix}box-shadow-inset) !default; $progress-bar-color: $white !default; $progress-bar-bg: $primary !default; $progress-bar-animation-timing: 1s linear infinite !default; @@ -1466,30 +1573,32 @@ $progress-bar-transition: width .6s ease !default; // List group // scss-docs-start list-group-variables -$list-group-color: $gray-900 !default; -$list-group-bg: $white !default; -$list-group-border-color: rgba($black, .125) !default; -$list-group-border-width: $border-width !default; -$list-group-border-radius: $border-radius !default; +$list-group-color: var(--#{$prefix}body-color) !default; +$list-group-bg: var(--#{$prefix}body-bg) !default; +$list-group-border-color: var(--#{$prefix}border-color) !default; +$list-group-border-width: var(--#{$prefix}border-width) !default; +$list-group-border-radius: var(--#{$prefix}border-radius) !default; $list-group-item-padding-y: $spacer * .5 !default; $list-group-item-padding-x: $spacer !default; -$list-group-item-bg-scale: -80% !default; -$list-group-item-color-scale: 40% !default; +// fusv-disable +$list-group-item-bg-scale: -80% !default; // Deprecated in v5.3.0 +$list-group-item-color-scale: 40% !default; // Deprecated in v5.3.0 +// fusv-enable -$list-group-hover-bg: $gray-100 !default; +$list-group-hover-bg: var(--#{$prefix}tertiary-bg) !default; $list-group-active-color: $component-active-color !default; $list-group-active-bg: $component-active-bg !default; $list-group-active-border-color: $list-group-active-bg !default; -$list-group-disabled-color: $gray-600 !default; +$list-group-disabled-color: var(--#{$prefix}secondary-color) !default; $list-group-disabled-bg: $list-group-bg !default; -$list-group-action-color: $gray-700 !default; -$list-group-action-hover-color: $list-group-action-color !default; +$list-group-action-color: var(--#{$prefix}secondary-color) !default; +$list-group-action-hover-color: var(--#{$prefix}emphasis-color) !default; -$list-group-action-active-color: $body-color !default; -$list-group-action-active-bg: $gray-200 !default; +$list-group-action-active-color: var(--#{$prefix}body-color) !default; +$list-group-action-active-bg: var(--#{$prefix}secondary-bg) !default; // scss-docs-end list-group-variables @@ -1497,11 +1606,11 @@ $list-group-action-active-bg: $gray-200 !default; // scss-docs-start thumbnail-variables $thumbnail-padding: .25rem !default; -$thumbnail-bg: $body-bg !default; -$thumbnail-border-width: $border-width !default; +$thumbnail-bg: var(--#{$prefix}body-bg) !default; +$thumbnail-border-width: var(--#{$prefix}border-width) !default; $thumbnail-border-color: var(--#{$prefix}border-color) !default; -$thumbnail-border-radius: $border-radius !default; -$thumbnail-box-shadow: $box-shadow-sm !default; +$thumbnail-border-radius: var(--#{$prefix}border-radius) !default; +$thumbnail-box-shadow: var(--#{$prefix}box-shadow-sm) !default; // scss-docs-end thumbnail-variables @@ -1509,7 +1618,7 @@ $thumbnail-box-shadow: $box-shadow-sm !default; // scss-docs-start figure-variables $figure-caption-font-size: $small-font-size !default; -$figure-caption-color: $gray-600 !default; +$figure-caption-color: var(--#{$prefix}secondary-color) !default; // scss-docs-end figure-variables @@ -1522,8 +1631,8 @@ $breadcrumb-padding-x: 0 !default; $breadcrumb-item-padding-x: .5rem !default; $breadcrumb-margin-bottom: 1rem !default; $breadcrumb-bg: null !default; -$breadcrumb-divider-color: $gray-600 !default; -$breadcrumb-active-color: $gray-600 !default; +$breadcrumb-divider-color: var(--#{$prefix}secondary-color) !default; +$breadcrumb-active-color: var(--#{$prefix}secondary-color) !default; $breadcrumb-divider: quote("/") !default; $breadcrumb-divider-flipped: $breadcrumb-divider !default; $breadcrumb-border-radius: null !default; @@ -1592,7 +1701,7 @@ $btn-close-padding-x: .25em !default; $btn-close-padding-y: $btn-close-padding-x !default; $btn-close-color: $black !default; $btn-close-bg: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='#{$btn-close-color}'><path d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/></svg>") !default; -$btn-close-focus-shadow: $input-btn-focus-box-shadow !default; +$btn-close-focus-shadow: $focus-ring-box-shadow !default; $btn-close-opacity: .5 !default; $btn-close-hover-opacity: .75 !default; $btn-close-focus-opacity: 1 !default; @@ -1612,8 +1721,8 @@ $offcanvas-transition-duration: .3s !default; $offcanvas-border-color: $modal-content-border-color !default; $offcanvas-border-width: $modal-content-border-width !default; $offcanvas-title-line-height: $modal-title-line-height !default; -$offcanvas-bg-color: $modal-content-bg !default; -$offcanvas-color: $modal-content-color !default; +$offcanvas-bg-color: var(--#{$prefix}body-bg) !default; +$offcanvas-color: var(--#{$prefix}body-color) !default; $offcanvas-box-shadow: $modal-content-box-shadow-xs !default; $offcanvas-backdrop-bg: $modal-backdrop-bg !default; $offcanvas-backdrop-opacity: $modal-backdrop-opacity !default; diff --git a/scss/bootstrap-grid.scss b/scss/bootstrap-grid.scss index 1c4cdd1..52bd577 100644 --- a/scss/bootstrap-grid.scss +++ b/scss/bootstrap-grid.scss @@ -5,9 +5,9 @@ $include-column-box-sizing: true !default; @import "functions"; @import "variables"; +@import "variables-dark"; @import "maps"; -@import "mixins/lists"; @import "mixins/breakpoints"; @import "mixins/container"; @import "mixins/grid"; @@ -15,8 +15,6 @@ $include-column-box-sizing: true !default; @import "vendor/rfs"; -@import "root"; - @import "containers"; @import "grid"; diff --git a/scss/bootstrap-reboot.scss b/scss/bootstrap-reboot.scss index af52745..5b69b95 100644 --- a/scss/bootstrap-reboot.scss +++ b/scss/bootstrap-reboot.scss @@ -3,6 +3,7 @@ @import "functions"; @import "variables"; +@import "variables-dark"; @import "maps"; @import "mixins"; @import "root"; diff --git a/scss/bootstrap-utilities.scss b/scss/bootstrap-utilities.scss index 2b3dbc5..99c4a35 100644 --- a/scss/bootstrap-utilities.scss +++ b/scss/bootstrap-utilities.scss @@ -4,6 +4,7 @@ // Configuration @import "functions"; @import "variables"; +@import "variables-dark"; @import "maps"; @import "mixins"; @import "utilities"; diff --git a/scss/bootstrap.scss b/scss/bootstrap.scss index 8f8296d..449d704 100644 --- a/scss/bootstrap.scss +++ b/scss/bootstrap.scss @@ -6,6 +6,7 @@ // Configuration @import "functions"; @import "variables"; +@import "variables-dark"; @import "maps"; @import "mixins"; @import "utilities"; diff --git a/scss/forms/_floating-labels.scss b/scss/forms/_floating-labels.scss index 6e5c9a7..3ca4264 100644 --- a/scss/forms/_floating-labels.scss +++ b/scss/forms/_floating-labels.scss @@ -5,6 +5,7 @@ > .form-control-plaintext, > .form-select { height: $form-floating-height; + min-height: $form-floating-height; line-height: $form-floating-line-height; } @@ -12,7 +13,7 @@ position: absolute; top: 0; left: 0; - width: 100%; + z-index: 2; height: 100%; // allow textareas padding: $form-floating-padding-y $form-floating-padding-x; overflow: hidden; @@ -55,14 +56,24 @@ > .form-control-plaintext, > .form-select { ~ label { - opacity: $form-floating-label-opacity; + color: rgba(var(--#{$prefix}body-color-rgb), #{$form-floating-label-opacity}); transform: $form-floating-label-transform; + + &::after { + position: absolute; + inset: $form-floating-padding-y ($form-floating-padding-x * .5); + z-index: -1; + height: $form-floating-label-height; + content: ""; + background-color: $input-bg; + @include border-radius($input-border-radius); + } } } // Duplicated because `:-webkit-autofill` invalidates other selectors when grouped > .form-control:-webkit-autofill { ~ label { - opacity: $form-floating-label-opacity; + color: rgba(var(--#{$prefix}body-color-rgb), #{$form-floating-label-opacity}); transform: $form-floating-label-transform; } } @@ -72,4 +83,12 @@ border-width: $input-border-width 0; // Required to properly position label text - as explained above } } + + > :disabled ~ label { + color: $form-floating-label-disabled-color; + + &::after { + background-color: $input-disabled-bg; + } + } } diff --git a/scss/forms/_form-check.scss b/scss/forms/_form-check.scss index 42a2a96..83aacba 100644 --- a/scss/forms/_form-check.scss +++ b/scss/forms/_form-check.scss @@ -27,11 +27,14 @@ } .form-check-input { + --#{$prefix}form-check-bg: #{$form-check-input-bg}; + width: $form-check-input-width; height: $form-check-input-width; margin-top: ($line-height-base - $form-check-input-width) * .5; // line-height minus check height vertical-align: top; - background-color: $form-check-input-bg; + background-color: var(--#{$prefix}form-check-bg); + background-image: var(--#{$prefix}form-check-bg-image); background-repeat: no-repeat; background-position: center; background-size: contain; @@ -65,17 +68,17 @@ &[type="checkbox"] { @if $enable-gradients { - background-image: escape-svg($form-check-input-checked-bg-image), var(--#{$prefix}gradient); + --#{$prefix}form-check-bg-image: #{escape-svg($form-check-input-checked-bg-image)}, var(--#{$prefix}gradient); } @else { - background-image: escape-svg($form-check-input-checked-bg-image); + --#{$prefix}form-check-bg-image: #{escape-svg($form-check-input-checked-bg-image)}; } } &[type="radio"] { @if $enable-gradients { - background-image: escape-svg($form-check-radio-checked-bg-image), var(--#{$prefix}gradient); + --#{$prefix}form-check-bg-image: #{escape-svg($form-check-radio-checked-bg-image)}, var(--#{$prefix}gradient); } @else { - background-image: escape-svg($form-check-radio-checked-bg-image); + --#{$prefix}form-check-bg-image: #{escape-svg($form-check-radio-checked-bg-image)}; } } } @@ -85,9 +88,9 @@ border-color: $form-check-input-indeterminate-border-color; @if $enable-gradients { - background-image: escape-svg($form-check-input-indeterminate-bg-image), var(--#{$prefix}gradient); + --#{$prefix}form-check-bg-image: #{escape-svg($form-check-input-indeterminate-bg-image)}, var(--#{$prefix}gradient); } @else { - background-image: escape-svg($form-check-input-indeterminate-bg-image); + --#{$prefix}form-check-bg-image: #{escape-svg($form-check-input-indeterminate-bg-image)}; } } @@ -121,24 +124,26 @@ padding-left: $form-switch-padding-start; .form-check-input { + --#{$prefix}form-switch-bg: #{escape-svg($form-switch-bg-image)}; + width: $form-switch-width; margin-left: $form-switch-padding-start * -1; - background-image: escape-svg($form-switch-bg-image); + background-image: var(--#{$prefix}form-switch-bg); background-position: left center; @include border-radius($form-switch-border-radius); @include transition($form-switch-transition); &:focus { - background-image: escape-svg($form-switch-focus-bg-image); + --#{$prefix}form-switch-bg: #{escape-svg($form-switch-focus-bg-image)}; } &:checked { background-position: $form-switch-checked-bg-position; @if $enable-gradients { - background-image: escape-svg($form-switch-checked-bg-image), var(--#{$prefix}gradient); + --#{$prefix}form-switch-bg: #{escape-svg($form-switch-checked-bg-image)}, var(--#{$prefix}gradient); } @else { - background-image: escape-svg($form-switch-checked-bg-image); + --#{$prefix}form-switch-bg: #{escape-svg($form-switch-checked-bg-image)}; } } } @@ -173,3 +178,11 @@ } } } + +@if $enable-dark-mode { + @include color-mode(dark) { + .form-switch .form-check-input:not(:checked):not(:focus) { + --#{$prefix}form-switch-bg: #{escape-svg($form-switch-bg-image-dark)}; + } + } +} diff --git a/scss/forms/_form-control.scss b/scss/forms/_form-control.scss index e707c57..ca2a7df 100644 --- a/scss/forms/_form-control.scss +++ b/scss/forms/_form-control.scss @@ -44,12 +44,31 @@ } } - // Add some height to date inputs on iOS - // https://github.com/twbs/bootstrap/issues/23307 - // TODO: we can remove this workaround once https://bugs.webkit.org/show_bug.cgi?id=198959 is resolved &::-webkit-date-and-time-value { + // On Android Chrome, form-control's "width: 100%" makes the input width too small + // Tested under Android 11 / Chrome 89, Android 12 / Chrome 100, Android 13 / Chrome 109 + // + // On iOS Safari, form-control's "appearance: none" + "width: 100%" makes the input width too small + // Tested under iOS 16.2 / Safari 16.2 + min-width: 85px; // Seems to be a good minimum safe width + + // Add some height to date inputs on iOS + // https://github.com/twbs/bootstrap/issues/23307 + // TODO: we can remove this workaround once https://bugs.webkit.org/show_bug.cgi?id=198959 is resolved // Multiply line-height by 1em if it has no unit height: if(unit($input-line-height) == "", $input-line-height * 1em, $input-line-height); + + // Android Chrome type="date" is taller than the other inputs + // because of "margin: 1px 24px 1px 4px" inside the shadow DOM + // Tested under Android 11 / Chrome 89, Android 12 / Chrome 100, Android 13 / Chrome 109 + margin: 0; + } + + // Prevent excessive date input height in Webkit + // https://github.com/twbs/bootstrap/issues/34433 + &::-webkit-datetime-edit { + display: block; + padding: 0; } // Placeholder @@ -186,6 +205,7 @@ textarea { } &::-webkit-color-swatch { + border: 0 !important; // stylelint-disable-line declaration-no-important @include border-radius($input-border-radius); } diff --git a/scss/forms/_form-select.scss b/scss/forms/_form-select.scss index 78c34b8..0b26323 100644 --- a/scss/forms/_form-select.scss +++ b/scss/forms/_form-select.scss @@ -4,17 +4,18 @@ // https://primer.github.io/. .form-select { + --#{$prefix}form-select-bg-img: #{escape-svg($form-select-indicator)}; + display: block; width: 100%; padding: $form-select-padding-y $form-select-indicator-padding $form-select-padding-y $form-select-padding-x; - -moz-padding-start: subtract($form-select-padding-x, 3px); // See https://github.com/twbs/bootstrap/issues/32636 font-family: $form-select-font-family; @include font-size($form-select-font-size); font-weight: $form-select-font-weight; line-height: $form-select-line-height; color: $form-select-color; background-color: $form-select-bg; - background-image: escape-svg($form-select-indicator); + background-image: var(--#{$prefix}form-select-bg-img), var(--#{$prefix}form-select-bg-icon, none); background-repeat: no-repeat; background-position: $form-select-bg-position; background-size: $form-select-bg-size; @@ -69,3 +70,11 @@ @include font-size($form-select-font-size-lg); @include border-radius($form-select-border-radius-lg); } + +@if $enable-dark-mode { + @include color-mode(dark) { + .form-select { + --#{$prefix}form-select-bg-img: #{escape-svg($form-select-indicator-dark)}; + } + } +} diff --git a/scss/forms/_input-group.scss b/scss/forms/_input-group.scss index 247f74a..58e4d40 100644 --- a/scss/forms/_input-group.scss +++ b/scss/forms/_input-group.scss @@ -121,7 +121,7 @@ } > :not(:first-child):not(.dropdown-menu)#{$validation-messages} { - margin-left: -$input-border-width; + margin-left: calc(#{$input-border-width} * -1); // stylelint-disable-line function-disallowed-list @include border-start-radius(0); } diff --git a/scss/helpers/_color-bg.scss b/scss/helpers/_color-bg.scss index b5ce770..c00acde 100644 --- a/scss/helpers/_color-bg.scss +++ b/scss/helpers/_color-bg.scss @@ -1,5 +1,3 @@ -// stylelint-disable function-name-case - // All-caps `RGBA()` function used because of this Sass bug: https://github.com/sass/node-sass/issues/2251 @each $color, $value in $theme-colors { $color-rgb: to-rgb($value); diff --git a/scss/helpers/_colored-links.scss b/scss/helpers/_colored-links.scss index 1cb4182..5f86857 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 !important; // stylelint-disable-line declaration-no-important + 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)) !important; // stylelint-disable-line declaration-no-important + $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 0000000..26508a8 --- /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 0000000..3f8bcb3 --- /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/mixins/_alert.scss b/scss/mixins/_alert.scss index 231f068..fb524af 100644 --- a/scss/mixins/_alert.scss +++ b/scss/mixins/_alert.scss @@ -1,15 +1,18 @@ +@include deprecate("`alert-variant()`", "v5.3.0", "v6.0.0"); + // scss-docs-start alert-variant-mixin @mixin alert-variant($background, $border, $color) { --#{$prefix}alert-color: #{$color}; --#{$prefix}alert-bg: #{$background}; --#{$prefix}alert-border-color: #{$border}; + --#{$prefix}alert-link-color: #{shade-color($color, 20%)}; @if $enable-gradients { background-image: var(--#{$prefix}gradient); } .alert-link { - color: shade-color($color, 20%); + color: var(--#{$prefix}alert-link-color); } } // scss-docs-end alert-variant-mixin diff --git a/scss/mixins/_banner.scss b/scss/mixins/_banner.scss index 97ec9d1..4323989 100644 --- a/scss/mixins/_banner.scss +++ b/scss/mixins/_banner.scss @@ -1,9 +1,7 @@ @mixin bsBanner($file) { /*! - * Bootstrap #{$file} v5.2.3 (https://getbootstrap.com/) - * Copyright 2011-2022 The Bootstrap Authors - * Copyright 2011-2022 Twitter, Inc. + * Bootstrap #{$file} v5.3.0 (https://getbootstrap.com/) + * Copyright 2011-2023 The Bootstrap Authors * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ } - diff --git a/scss/mixins/_caret.scss b/scss/mixins/_caret.scss index 4b0f036..be73116 100644 --- a/scss/mixins/_caret.scss +++ b/scss/mixins/_caret.scss @@ -1,44 +1,49 @@ // scss-docs-start caret-mixins -@mixin caret-down { - border-top: $caret-width solid; - border-right: $caret-width solid transparent; +@mixin caret-down($width: $caret-width) { + border-top: $width solid; + border-right: $width solid transparent; border-bottom: 0; - border-left: $caret-width solid transparent; + border-left: $width solid transparent; } -@mixin caret-up { +@mixin caret-up($width: $caret-width) { border-top: 0; - border-right: $caret-width solid transparent; - border-bottom: $caret-width solid; - border-left: $caret-width solid transparent; + border-right: $width solid transparent; + border-bottom: $width solid; + border-left: $width solid transparent; } -@mixin caret-end { - border-top: $caret-width solid transparent; +@mixin caret-end($width: $caret-width) { + border-top: $width solid transparent; border-right: 0; - border-bottom: $caret-width solid transparent; - border-left: $caret-width solid; + border-bottom: $width solid transparent; + border-left: $width solid; } -@mixin caret-start { - border-top: $caret-width solid transparent; - border-right: $caret-width solid; - border-bottom: $caret-width solid transparent; +@mixin caret-start($width: $caret-width) { + border-top: $width solid transparent; + border-right: $width solid; + border-bottom: $width solid transparent; } -@mixin caret($direction: down) { +@mixin caret( + $direction: down, + $width: $caret-width, + $spacing: $caret-spacing, + $vertical-align: $caret-vertical-align +) { @if $enable-caret { &::after { display: inline-block; - margin-left: $caret-spacing; - vertical-align: $caret-vertical-align; + margin-left: $spacing; + vertical-align: $vertical-align; content: ""; @if $direction == down { - @include caret-down(); + @include caret-down($width); } @else if $direction == up { - @include caret-up(); + @include caret-up($width); } @else if $direction == end { - @include caret-end(); + @include caret-end($width); } } @@ -49,10 +54,10 @@ &::before { display: inline-block; - margin-right: $caret-spacing; - vertical-align: $caret-vertical-align; + margin-right: $spacing; + vertical-align: $vertical-align; content: ""; - @include caret-start(); + @include caret-start($width); } } diff --git a/scss/mixins/_color-mode.scss b/scss/mixins/_color-mode.scss new file mode 100644 index 0000000..03338b0 --- /dev/null +++ b/scss/mixins/_color-mode.scss @@ -0,0 +1,21 @@ +// scss-docs-start color-mode-mixin +@mixin color-mode($mode: light, $root: false) { + @if $color-mode-type == "media-query" { + @if $root == true { + @media (prefers-color-scheme: $mode) { + :root { + @content; + } + } + } @else { + @media (prefers-color-scheme: $mode) { + @content; + } + } + } @else { + [data-bs-theme="#{$mode}"] { + @content; + } + } +} +// scss-docs-end color-mode-mixin diff --git a/scss/mixins/_forms.scss b/scss/mixins/_forms.scss index 2a853a7..d47b1e4 100644 --- a/scss/mixins/_forms.scss +++ b/scss/mixins/_forms.scss @@ -21,7 +21,8 @@ $icon, $tooltip-color: color-contrast($color), $tooltip-bg-color: rgba($color, $form-feedback-tooltip-opacity), - $focus-box-shadow: 0 0 $input-btn-focus-blur $input-focus-width rgba($color, $input-btn-focus-color-opacity) + $focus-box-shadow: 0 0 $input-btn-focus-blur $input-focus-width rgba($color, $input-btn-focus-color-opacity), + $border-color: $color ) { .#{$state}-feedback { display: none; @@ -56,7 +57,7 @@ .form-control { @include form-validation-state-selector($state) { - border-color: $color; + border-color: $border-color; @if $enable-validation-icons { padding-right: $input-height-inner; @@ -67,7 +68,7 @@ } &:focus { - border-color: $color; + border-color: $border-color; box-shadow: $focus-box-shadow; } } @@ -85,20 +86,20 @@ .form-select { @include form-validation-state-selector($state) { - border-color: $color; + border-color: $border-color; @if $enable-validation-icons { &:not([multiple]):not([size]), &:not([multiple])[size="1"] { + --#{$prefix}form-select-bg-icon: #{escape-svg($icon)}; padding-right: $form-select-feedback-icon-padding-end; - background-image: escape-svg($form-select-indicator), escape-svg($icon); background-position: $form-select-bg-position, $form-select-feedback-icon-position; background-size: $form-select-bg-size, $form-select-feedback-icon-size; } } &:focus { - border-color: $color; + border-color: $border-color; box-shadow: $focus-box-shadow; } } @@ -114,7 +115,7 @@ .form-check-input { @include form-validation-state-selector($state) { - border-color: $color; + border-color: $border-color; &:checked { background-color: $color; diff --git a/scss/mixins/_list-group.scss b/scss/mixins/_list-group.scss index e55415f..6274f34 100644 --- a/scss/mixins/_list-group.scss +++ b/scss/mixins/_list-group.scss @@ -1,3 +1,5 @@ +@include deprecate("`list-group-item-variant()`", "v5.3.0", "v6.0.0"); + // List Groups // scss-docs-start list-group-mixin diff --git a/scss/mixins/_utilities.scss b/scss/mixins/_utilities.scss index 59a2374..4795e89 100644 --- a/scss/mixins/_utilities.scss +++ b/scss/mixins/_utilities.scss @@ -1,6 +1,6 @@ // Utility generator // Used to generate utilities & print utilities -@mixin generate-utility($utility, $infix, $is-rfs-media-query: false) { +@mixin generate-utility($utility, $infix: "", $is-rfs-media-query: false) { $values: map-get($utility, values); // If the values are a list or string, convert it into a map diff --git a/scss/mixins/_visually-hidden.scss b/scss/mixins/_visually-hidden.scss index 4fc7f49..082aeec 100644 --- a/scss/mixins/_visually-hidden.scss +++ b/scss/mixins/_visually-hidden.scss @@ -6,7 +6,6 @@ // See: https://kittygiraudel.com/2016/10/13/css-hide-and-seek/ @mixin visually-hidden() { - position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; @@ -15,6 +14,11 @@ clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; + + // Fix for positioned table caption that could become anonymous cells + &:not(caption) { + position: absolute !important; + } } // Use to only display content when it's focused, or one of its child elements is focused diff --git a/scss/tests/jasmine.js b/scss/tests/jasmine.js new file mode 100644 index 0000000..25d838c --- /dev/null +++ b/scss/tests/jasmine.js @@ -0,0 +1,16 @@ +/* eslint-disable camelcase */ + +'use strict' + +const path = require('node:path') + +module.exports = { + spec_dir: 'scss', + // Make Jasmine look for `.test.scss` files + spec_files: ['**/*.{test,spec}.scss'], + // Compile them into JS scripts running `sass-true` + requires: [path.join(__dirname, 'sass-true/register')], + // Ensure we use `require` so that the require.extensions works + // as `import` completely bypasses it + jsLoader: 'require' +} diff --git a/scss/tests/mixins/_color-modes.test.scss b/scss/tests/mixins/_color-modes.test.scss new file mode 100644 index 0000000..9ecc628 --- /dev/null +++ b/scss/tests/mixins/_color-modes.test.scss @@ -0,0 +1,69 @@ +// stylelint-disable selector-attribute-quotes + +@import "../../functions"; +@import "../../variables"; +@import "../../variables-dark"; +@import "../../maps"; +@import "../../mixins"; + +@include describe("global $color-mode-type: data") { + @include it("generates data attribute selectors for dark mode") { + @include assert() { + @include output() { + @include color-mode(dark) { + .element { + color: var(--bs-primary-text-emphasis); + background-color: var(--bs-primary-bg-subtle); + } + } + @include color-mode(dark, true) { + --custom-color: #{mix($indigo, $blue, 50%)}; + } + } + @include expect() { + [data-bs-theme=dark] .element { + color: var(--bs-primary-text-emphasis); + background-color: var(--bs-primary-bg-subtle); + } + [data-bs-theme=dark] { + --custom-color: #3a3ff8; + } + } + } + } +} + +@include describe("global $color-mode-type: media-query") { + @include it("generates media queries for dark mode") { + $color-mode-type: media-query !global; + + @include assert() { + @include output() { + @include color-mode(dark) { + .element { + color: var(--bs-primary-text-emphasis); + background-color: var(--bs-primary-bg-subtle); + } + } + @include color-mode(dark, true) { + --custom-color: #{mix($indigo, $blue, 50%)}; + } + } + @include expect() { + @media (prefers-color-scheme: dark) { + .element { + color: var(--bs-primary-text-emphasis); + background-color: var(--bs-primary-bg-subtle); + } + } + @media (prefers-color-scheme: dark) { + :root { + --custom-color: #3a3ff8; + } + } + } + } + + $color-mode-type: data !global; + } +} diff --git a/scss/tests/mixins/_media-query-color-mode-full.test.scss b/scss/tests/mixins/_media-query-color-mode-full.test.scss new file mode 100644 index 0000000..00ed82d --- /dev/null +++ b/scss/tests/mixins/_media-query-color-mode-full.test.scss @@ -0,0 +1,8 @@ +$color-mode-type: media-query; + +@import "../../bootstrap"; + +@include describe("global $color-mode-type: media-query") { + @include it("compiles entirely Bootstrap CSS with media-query color mode") { // stylelint-disable-line block-no-empty + } +} diff --git a/scss/tests/mixins/_utilities.test.scss b/scss/tests/mixins/_utilities.test.scss new file mode 100644 index 0000000..63fcae3 --- /dev/null +++ b/scss/tests/mixins/_utilities.test.scss @@ -0,0 +1,393 @@ +$prefix: bs-; +$enable-important-utilities: false; + +// Important: Do not import rfs to check that the mixin just calls the appropriate functions from it +@import "../../mixins/utilities"; + +@mixin test-generate-utility($params...) { + @include assert() { + @include output() { + @include generate-utility($params...); + } + + @include expect() { + @content; + } + } +} + +@include describe(generate-utility) { + @include it("generates a utility class for each value") { + @include test-generate-utility( + ( + property: "padding", + values: (small: .5rem, large: 2rem) + ) + ) { + .padding-small { + padding: .5rem; + } + + .padding-large { + padding: 2rem; + } + } + } + + @include describe("global $enable-important-utilities: true") { + @include it("sets !important") { + $enable-important-utilities: true !global; + + @include test-generate-utility( + ( + property: "padding", + values: (small: .5rem, large: 2rem) + ) + ) { + .padding-small { + padding: .5rem !important; + } + + .padding-large { + padding: 2rem !important; + } + } + + $enable-important-utilities: false !global; + } + } + + @include describe("$utility") { + @include describe("values") { + @include it("supports null keys") { + @include test-generate-utility( + ( + property: "padding", + values: (null: 1rem, small: .5rem, large: 2rem) + ), + ) { + .padding { + padding: 1rem; + } + + .padding-small { + padding: .5rem; + } + + .padding-large { + padding: 2rem; + } + } + } + + @include it("ignores null values") { + @include test-generate-utility( + ( + property: "padding", + values: (small: null, large: 2rem) + ) + ) { + .padding-large { + padding: 2rem; + } + } + } + + @include it("supports lists") { + @include test-generate-utility( + ( + property: "padding", + values: 1rem 2rem + ) + ) { + .padding-1rem { + padding: 1rem; + } + + .padding-2rem { + padding: 2rem; + } + } + } + + @include it("supports single values") { + @include test-generate-utility( + ( + property: padding, + values: 1rem + ) + ) { + .padding-1rem { + padding: 1rem; + } + } + } + } + + @include describe("class & property") { + @include it("adds each property to the declaration") { + @include test-generate-utility( + ( + class: padding-x, + property: padding-inline-start padding-inline-end, + values: 1rem + ) + ) { + .padding-x-1rem { + padding-inline-start: 1rem; + padding-inline-end: 1rem; + } + } + } + + @include it("uses the first property as class name") { + @include test-generate-utility( + ( + property: padding-inline-start padding-inline-end, + values: 1rem + ) + ) { + .padding-inline-start-1rem { + padding-inline-start: 1rem; + padding-inline-end: 1rem; + } + } + } + + @include it("supports a null class to create classes straight from the values") { + @include test-generate-utility( + ( + property: visibility, + class: null, + values: ( + visible: visible, + invisible: hidden, + ) + ) + ) { + .visible { + visibility: visible; + } + + .invisible { + visibility: hidden; + } + } + } + } + + @include describe("state") { + @include it("Generates selectors for each states") { + @include test-generate-utility( + ( + property: padding, + values: 1rem, + state: hover focus, + ) + ) { + .padding-1rem { + padding: 1rem; + } + + .padding-1rem-hover:hover { + padding: 1rem; + } + + .padding-1rem-focus:focus { + padding: 1rem; + } + } + } + } + + @include describe("css-var"){ + @include it("sets a CSS variable instead of the property") { + @include test-generate-utility( + ( + property: padding, + css-variable-name: padding, + css-var: true, + values: 1rem 2rem + ) + ) { + .padding-1rem { + --bs-padding: 1rem; + } + + .padding-2rem { + --bs-padding: 2rem; + } + } + } + + @include it("defaults to class") { + @include test-generate-utility( + ( + property: padding, + class: padding, + css-var: true, + values: 1rem 2rem + ) + ) { + .padding-1rem { + --bs-padding: 1rem; + } + + .padding-2rem { + --bs-padding: 2rem; + } + } + } + } + + @include describe("local-vars") { + @include it("generates the listed variables") { + @include test-generate-utility( + ( + property: color, + class: desaturated-color, + local-vars: ( + color-opacity: 1, + color-saturation: .25 + ), + values: ( + blue: hsla(192deg, var(--bs-color-saturation), 0, var(--bs-color-opacity)) + ) + ) + ) { + .desaturated-color-blue { + --bs-color-opacity: 1; + // Sass compilation will put a leading zero so we want to keep that one + // stylelint-disable-next-line stylistic/number-leading-zero + --bs-color-saturation: 0.25; + color: hsla(192deg, var(--bs-color-saturation), 0, var(--bs-color-opacity)); + } + } + } + } + + @include describe("css-var & state") { + @include it("Generates a rule with for each state with a CSS variable") { + @include test-generate-utility( + ( + property: padding, + css-var: true, + css-variable-name: padding, + values: 1rem, + state: hover focus, + ) + ) { + .padding-1rem { + --bs-padding: 1rem; + } + + .padding-1rem-hover:hover { + --bs-padding: 1rem; + } + + .padding-1rem-focus:focus { + --bs-padding: 1rem; + } + } + } + } + + @include describe("rtl") { + @include it("sets up RTLCSS for removal when false") { + @include test-generate-utility( + ( + property: padding, + values: 1rem, + rtl: false + ) + ) { + /* rtl:begin:remove */ + + .padding-1rem { + padding: 1rem; + } + + /* rtl:end:remove */ + + } + } + } + + @include describe("rfs") { + @include it("sets the fluid value when not inside media query") { + @include test-generate-utility( + ( + property: padding, + values: 1rem, + rfs: true + ) + ) { + .padding-1rem { + padding: rfs-fluid-value(1rem); + } + } + } + + @include it("sets the value when inside the media query") { + @include test-generate-utility( + ( + property: padding, + values: 1rem, + rfs: true + ), + $is-rfs-media-query: true + ) { + .padding-1rem { + padding: rfs-value(1rem); + } + } + } + } + } + + @include describe("$infix") { + @include it("inserts the given infix") { + @include test-generate-utility( + ( + property: "padding", + values: (null: 1rem, small: .5rem, large: 2rem) + ), + $infix: -sm + ) { + .padding-sm { + padding: 1rem; + } + + .padding-sm-small { + padding: .5rem; + } + + .padding-sm-large { + padding: 2rem; + } + } + } + + @include it("strips leading - if class is null") { + @include test-generate-utility( + ( + property: visibility, + class: null, + values: ( + visible: visible, + invisible: hidden, + ) + ), + -sm + ) { + .sm-visible { + visibility: visible; + } + + .sm-invisible { + visibility: hidden; + } + } + } + } +} diff --git a/scss/tests/sass-true/register.js b/scss/tests/sass-true/register.js new file mode 100644 index 0000000..d93e414 --- /dev/null +++ b/scss/tests/sass-true/register.js @@ -0,0 +1,14 @@ +'use strict' + +const path = require('node:path') + +const runnerPath = path.join(__dirname, 'runner').replace(/\\/g, '/') + +require.extensions['.scss'] = (module, filename) => { + const normalizedFilename = filename.replace(/\\/g, '/') + + return module._compile(` + const runner = require('${runnerPath}') + runner('${normalizedFilename}', { describe, it }) + `, filename) +} diff --git a/scss/tests/sass-true/runner.js b/scss/tests/sass-true/runner.js new file mode 100644 index 0000000..bef870a --- /dev/null +++ b/scss/tests/sass-true/runner.js @@ -0,0 +1,17 @@ +'use strict' + +const fs = require('node:fs') +const path = require('node:path') +const { runSass } = require('sass-true') + +module.exports = (filename, { describe, it }) => { + const data = fs.readFileSync(filename, 'utf8') + const TRUE_SETUP = '$true-terminal-output: false; @import "true";' + const sassString = TRUE_SETUP + data + + runSass( + { describe, it, sourceType: 'string' }, + sassString, + { loadPaths: [path.dirname(filename)] } + ) +} diff --git a/scss/tests/utilities/_api.test.scss b/scss/tests/utilities/_api.test.scss new file mode 100644 index 0000000..304d8d1 --- /dev/null +++ b/scss/tests/utilities/_api.test.scss @@ -0,0 +1,75 @@ +@import "../../functions"; +@import "../../variables"; +@import "../../variables-dark"; +@import "../../maps"; +@import "../../mixins"; + +$utilities: (); + +@include describe("utilities/api") { + @include it("generates utilities for each breakpoints") { + $utilities: ( + margin: ( + property: margin, + values: auto + ), + padding: ( + property: padding, + responsive: true, + values: 1rem + ), + font-size: ( + property: font-size, + values: (large: 1.25rem), + print: true + ) + ) !global; + + $grid-breakpoints: ( + xs: 0, + sm: 333px, + md: 666px + ) !global; + + @include assert() { + @include output() { + @import "../../utilities/api"; + } + + @include expect() { + // margin is not set to responsive + .margin-auto { + margin: auto !important; + } + + // padding is, though + .padding-1rem { + padding: 1rem !important; + } + + .font-size-large { + font-size: 1.25rem !important; + } + + @media (min-width: 333px) { + .padding-sm-1rem { + padding: 1rem !important; + } + } + + @media (min-width: 666px) { + .padding-md-1rem { + padding: 1rem !important; + } + } + + @media print { + .font-size-print-large { + font-size: 1.25rem !important; + } + } + } + + } + } +} diff --git a/scss/vendor/_rfs.scss b/scss/vendor/_rfs.scss index 7e9a6c7..aa1f82b 100644 --- a/scss/vendor/_rfs.scss +++ b/scss/vendor/_rfs.scss @@ -1,4 +1,4 @@ -// stylelint-disable property-blacklist, scss/dollar-variable-default +// stylelint-disable scss/dimension-no-non-numeric-values // SCSS RFS mixin // @@ -154,8 +154,7 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height &.enable-rfs { @content; } - } - @else { + } @else { @content; } } @@ -168,7 +167,7 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height @content; } - @include _rfs-media-query { + @include _rfs-media-query () { .enable-rfs &, &.enable-rfs { @content; @@ -182,7 +181,7 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height @content; } } - @include _rfs-media-query { + @include _rfs-media-query () { @content; } } @@ -193,12 +192,12 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height // Convert to list $values: if(type-of($values) != list, ($values,), $values); - $val: ''; + $val: ""; // Loop over each value and calculate value @each $value in $values { @if $value == 0 { - $val: $val + ' 0'; + $val: $val + " 0"; } @else { // Cache $value unit @@ -206,15 +205,14 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height @if $unit == px { // Convert to rem if needed - $val: $val + ' ' + if($rfs-unit == rem, #{divide($value, $value * 0 + $rfs-rem-value)}rem, $value); + $val: $val + " " + if($rfs-unit == rem, #{divide($value, $value * 0 + $rfs-rem-value)}rem, $value); } @else if $unit == rem { // Convert to px if needed - $val: $val + ' ' + if($rfs-unit == px, #{divide($value, $value * 0 + 1) * $rfs-rem-value}px, $value); - } - @else { + $val: $val + " " + if($rfs-unit == px, #{divide($value, $value * 0 + 1) * $rfs-rem-value}px, $value); + } @else { // If $value isn't a number (like inherit) or $value has a unit (not px or rem, like 1.5em) or $ is 0, just print the value - $val: $val + ' ' + $value; + $val: $val + " " + $value; } } } @@ -228,30 +226,26 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height // Convert to list $values: if(type-of($values) != list, ($values,), $values); - $val: ''; + $val: ""; // Loop over each value and calculate value @each $value in $values { @if $value == 0 { - $val: $val + ' 0'; - } - - @else { + $val: $val + " 0"; + } @else { // Cache $value unit $unit: if(type-of($value) == "number", unit($value), false); // If $value isn't a number (like inherit) or $value has a unit (not px or rem, like 1.5em) or $ is 0, just print the value @if not $unit or $unit != px and $unit != rem { - $val: $val + ' ' + $value; - } - - @else { + $val: $val + " " + $value; + } @else { // Remove unit from $value for calculations $value: divide($value, $value * 0 + if($unit == px, 1, divide(1, $rfs-rem-value))); // Only add the media query if the value is greater than the minimum value @if abs($value) <= $rfs-base-value or not $enable-rfs { - $val: $val + ' ' + if($rfs-unit == rem, #{divide($value, $rfs-rem-value)}rem, #{$value}px); + $val: $val + " " + if($rfs-unit == rem, #{divide($value, $rfs-rem-value)}rem, #{$value}px); } @else { // Calculate the minimum value @@ -273,7 +267,7 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height $variable-width: #{divide($value-diff * 100, $rfs-breakpoint)}#{$variable-unit}; // Return the calculated value - $val: $val + ' calc(' + $min-width + if($value < 0, ' - ', ' + ') + $variable-width + ')'; + $val: $val + " calc(" + $min-width + if($value < 0, " - ", " + ") + $variable-width + ")"; } } } @@ -287,22 +281,22 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height @mixin rfs($values, $property: font-size) { @if $values != null { $val: rfs-value($values); - $fluidVal: rfs-fluid-value($values); + $fluid-val: rfs-fluid-value($values); // Do not print the media query if responsive & non-responsive values are the same - @if $val == $fluidVal { + @if $val == $fluid-val { #{$property}: $val; } @else { - @include _rfs-rule { - #{$property}: if($rfs-mode == max-media-query, $val, $fluidVal); + @include _rfs-rule () { + #{$property}: if($rfs-mode == max-media-query, $val, $fluid-val); // Include safari iframe resize fix if needed min-width: if($rfs-safari-iframe-resize-bug-fix, (0 * 1vw), null); } - @include _rfs-media-query-rule { - #{$property}: if($rfs-mode == max-media-query, $fluidVal, $val); + @include _rfs-media-query-rule () { + #{$property}: if($rfs-mode == max-media-query, $fluid-val, $val); } } } |