diff --git a/LICENSE b/LICENSE index 72dda23..dda75ca 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ The MIT License (MIT) -Copyright (c) 2011-2021 Twitter, Inc. -Copyright (c) 2011-2021 The Bootstrap Authors +Copyright (c) 2011-2022 Twitter, Inc. +Copyright (c) 2011-2022 The Bootstrap Authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 9ae8534..8b98fd0 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

- Bootstrap logo + Bootstrap logo

@@ -13,7 +13,7 @@

Sleek, intuitive, and powerful front-end framework for faster and easier web development.
- Explore Bootstrap docs » + Explore Bootstrap docs »

Report bug @@ -43,7 +43,7 @@ Several quick start options are available: - Install with [npm](https://www.npmjs.com/): `npm install bootstrap-scss` - Install with [yarn](https://yarnpkg.com/): `yarn add bootstrap-scss` -Read the [Getting started page](https://getbootstrap.com/docs/5.1/getting-started/introduction/) for information on the framework contents, templates and examples, and more. +Read the [Getting started page](https://getbootstrap.com/docs/5.2/getting-started/introduction/) for information on the framework contents, templates and examples, and more. ## Status @@ -77,8 +77,8 @@ For simplicity, this project will use the same version numbers as Bootstrap. ## Changelog -https://github.com/twbs/bootstrap/releases/tag/v5.1.3 +https://github.com/twbs/bootstrap/releases/tag/v5.2.0 ## Copyright and license -Code and documentation copyright 2011-2021 the [Bootstrap Authors](https://github.com/twbs/bootstrap/graphs/contributors) and [Twitter, Inc.](https://twitter.com) Code released under the [MIT License](https://github.com/twbs/bootstrap/blob/main/LICENSE). +Code and documentation copyright 2011-2022 the [Bootstrap Authors](https://github.com/twbs/bootstrap/graphs/contributors) and [Twitter, Inc.](https://twitter.com) Code released under the [MIT License](https://github.com/twbs/bootstrap/blob/main/LICENSE). diff --git a/_accordion.scss b/_accordion.scss index fc62ceb..b306540 100644 --- a/_accordion.scss +++ b/_accordion.scss @@ -2,43 +2,70 @@ // Base styles // +.accordion { + // scss-docs-start accordion-css-vars + --#{$prefix}accordion-color: #{color-contrast($accordion-bg)}; + --#{$prefix}accordion-bg: #{$accordion-bg}; + --#{$prefix}accordion-transition: #{$accordion-transition}; + --#{$prefix}accordion-border-color: #{$accordion-border-color}; + --#{$prefix}accordion-border-width: #{$accordion-border-width}; + --#{$prefix}accordion-border-radius: #{$accordion-border-radius}; + --#{$prefix}accordion-inner-border-radius: #{$accordion-inner-border-radius}; + --#{$prefix}accordion-btn-padding-x: #{$accordion-button-padding-x}; + --#{$prefix}accordion-btn-padding-y: #{$accordion-button-padding-y}; + --#{$prefix}accordion-btn-color: #{$accordion-color}; + --#{$prefix}accordion-btn-bg: #{$accordion-button-bg}; + --#{$prefix}accordion-btn-icon: #{escape-svg($accordion-button-icon)}; + --#{$prefix}accordion-btn-icon-width: #{$accordion-icon-width}; + --#{$prefix}accordion-btn-icon-transform: #{$accordion-icon-transform}; + --#{$prefix}accordion-btn-icon-transition: #{$accordion-icon-transition}; + --#{$prefix}accordion-btn-active-icon: #{escape-svg($accordion-button-active-icon)}; + --#{$prefix}accordion-btn-focus-border-color: #{$accordion-button-focus-border-color}; + --#{$prefix}accordion-btn-focus-box-shadow: #{$accordion-button-focus-box-shadow}; + --#{$prefix}accordion-body-padding-x: #{$accordion-body-padding-x}; + --#{$prefix}accordion-body-padding-y: #{$accordion-body-padding-y}; + --#{$prefix}accordion-active-color: #{$accordion-button-active-color}; + --#{$prefix}accordion-active-bg: #{$accordion-button-active-bg}; + // scss-docs-end accordion-css-vars +} + .accordion-button { position: relative; display: flex; align-items: center; width: 100%; - padding: $accordion-button-padding-y $accordion-button-padding-x; + padding: var(--#{$prefix}accordion-btn-padding-y) var(--#{$prefix}accordion-btn-padding-x); @include font-size($font-size-base); - color: $accordion-button-color; + color: var(--#{$prefix}accordion-btn-color); text-align: left; // Reset button style - background-color: $accordion-button-bg; + background-color: var(--#{$prefix}accordion-btn-bg); border: 0; @include border-radius(0); overflow-anchor: none; - @include transition($accordion-transition); + @include transition(var(--#{$prefix}accordion-transition)); &:not(.collapsed) { - color: $accordion-button-active-color; - background-color: $accordion-button-active-bg; - box-shadow: inset 0 ($accordion-border-width * -1) 0 $accordion-border-color; + color: var(--#{$prefix}accordion-active-color); + background-color: var(--#{$prefix}accordion-active-bg); + box-shadow: inset 0 calc(var(--#{$prefix}accordion-border-width) * -1) 0 var(--#{$prefix}accordion-border-color); // stylelint-disable-line function-disallowed-list &::after { - background-image: escape-svg($accordion-button-active-icon); - transform: $accordion-icon-transform; + background-image: var(--#{$prefix}accordion-btn-active-icon); + transform: var(--#{$prefix}accordion-btn-icon-transform); } } // Accordion icon &::after { flex-shrink: 0; - width: $accordion-icon-width; - height: $accordion-icon-width; + width: var(--#{$prefix}accordion-btn-icon-width); + height: var(--#{$prefix}accordion-btn-icon-width); margin-left: auto; content: ""; - background-image: escape-svg($accordion-button-icon); + background-image: var(--#{$prefix}accordion-btn-icon); background-repeat: no-repeat; - background-size: $accordion-icon-width; - @include transition($accordion-icon-transition); + background-size: var(--#{$prefix}accordion-btn-icon-width); + @include transition(var(--#{$prefix}accordion-btn-icon-transition)); } &:hover { @@ -47,9 +74,9 @@ &:focus { z-index: 3; - border-color: $accordion-button-focus-border-color; + border-color: var(--#{$prefix}accordion-btn-focus-border-color); outline: 0; - box-shadow: $accordion-button-focus-box-shadow; + box-shadow: var(--#{$prefix}accordion-btn-focus-box-shadow); } } @@ -58,14 +85,15 @@ } .accordion-item { - background-color: $accordion-bg; - border: $accordion-border-width solid $accordion-border-color; + color: var(--#{$prefix}accordion-color); + background-color: var(--#{$prefix}accordion-bg); + border: var(--#{$prefix}accordion-border-width) solid var(--#{$prefix}accordion-border-color); &:first-of-type { - @include border-top-radius($accordion-border-radius); + @include border-top-radius(var(--#{$prefix}accordion-border-radius)); .accordion-button { - @include border-top-radius($accordion-inner-border-radius); + @include border-top-radius(var(--#{$prefix}accordion-inner-border-radius)); } } @@ -75,22 +103,22 @@ // Only set a border-radius on the last item if the accordion is collapsed &:last-of-type { - @include border-bottom-radius($accordion-border-radius); + @include border-bottom-radius(var(--#{$prefix}accordion-border-radius)); .accordion-button { &.collapsed { - @include border-bottom-radius($accordion-inner-border-radius); + @include border-bottom-radius(var(--#{$prefix}accordion-inner-border-radius)); } } .accordion-collapse { - @include border-bottom-radius($accordion-border-radius); + @include border-bottom-radius(var(--#{$prefix}accordion-border-radius)); } } } .accordion-body { - padding: $accordion-body-padding-y $accordion-body-padding-x; + padding: var(--#{$prefix}accordion-body-padding-y) var(--#{$prefix}accordion-body-padding-x); } diff --git a/_alert.scss b/_alert.scss index 34f1e84..c8bc91b 100644 --- a/_alert.scss +++ b/_alert.scss @@ -3,11 +3,24 @@ // .alert { + // scss-docs-start alert-css-vars + --#{$prefix}alert-bg: transparent; + --#{$prefix}alert-padding-x: #{$alert-padding-x}; + --#{$prefix}alert-padding-y: #{$alert-padding-y}; + --#{$prefix}alert-margin-bottom: #{$alert-margin-bottom}; + --#{$prefix}alert-color: inherit; + --#{$prefix}alert-border-color: transparent; + --#{$prefix}alert-border: #{$alert-border-width} solid var(--#{$prefix}alert-border-color); + --#{$prefix}alert-border-radius: #{$alert-border-radius}; + // scss-docs-end alert-css-vars + position: relative; - padding: $alert-padding-y $alert-padding-x; - margin-bottom: $alert-margin-bottom; - border: $alert-border-width solid transparent; - @include border-radius($alert-border-radius); + padding: var(--#{$prefix}alert-padding-y) var(--#{$prefix}alert-padding-x); + margin-bottom: var(--#{$prefix}alert-margin-bottom); + color: var(--#{$prefix}alert-color); + background-color: var(--#{$prefix}alert-bg); + border: var(--#{$prefix}alert-border); + @include border-radius(var(--#{$prefix}alert-border-radius)); } // Headings for larger alerts @@ -47,6 +60,7 @@ $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)); } diff --git a/_badge.scss b/_badge.scss index 08df1b8..cc3d269 100644 --- a/_badge.scss +++ b/_badge.scss @@ -4,16 +4,25 @@ // `background-color`. .badge { + // scss-docs-start badge-css-vars + --#{$prefix}badge-padding-x: #{$badge-padding-x}; + --#{$prefix}badge-padding-y: #{$badge-padding-y}; + @include rfs($badge-font-size, --#{$prefix}badge-font-size); + --#{$prefix}badge-font-weight: #{$badge-font-weight}; + --#{$prefix}badge-color: #{$badge-color}; + --#{$prefix}badge-border-radius: #{$badge-border-radius}; + // scss-docs-end badge-css-vars + display: inline-block; - padding: $badge-padding-y $badge-padding-x; - @include font-size($badge-font-size); - font-weight: $badge-font-weight; + padding: var(--#{$prefix}badge-padding-y) var(--#{$prefix}badge-padding-x); + @include font-size(var(--#{$prefix}badge-font-size)); + font-weight: var(--#{$prefix}badge-font-weight); line-height: 1; - color: $badge-color; + color: var(--#{$prefix}badge-color); text-align: center; white-space: nowrap; vertical-align: baseline; - @include border-radius($badge-border-radius); + @include border-radius(var(--#{$prefix}badge-border-radius)); @include gradient-bg(); // Empty badges collapse automatically diff --git a/_breadcrumb.scss b/_breadcrumb.scss index f7fafe7..b8252ff 100644 --- a/_breadcrumb.scss +++ b/_breadcrumb.scss @@ -1,28 +1,40 @@ .breadcrumb { + // scss-docs-start breadcrumb-css-vars + --#{$prefix}breadcrumb-padding-x: #{$breadcrumb-padding-x}; + --#{$prefix}breadcrumb-padding-y: #{$breadcrumb-padding-y}; + --#{$prefix}breadcrumb-margin-bottom: #{$breadcrumb-margin-bottom}; + @include rfs($breadcrumb-font-size, --#{$prefix}breadcrumb-font-size); + --#{$prefix}breadcrumb-bg: #{$breadcrumb-bg}; + --#{$prefix}breadcrumb-border-radius: #{$breadcrumb-border-radius}; + --#{$prefix}breadcrumb-divider-color: #{$breadcrumb-divider-color}; + --#{$prefix}breadcrumb-item-padding-x: #{$breadcrumb-item-padding-x}; + --#{$prefix}breadcrumb-item-active-color: #{$breadcrumb-active-color}; + // scss-docs-end breadcrumb-css-vars + display: flex; flex-wrap: wrap; - padding: $breadcrumb-padding-y $breadcrumb-padding-x; - margin-bottom: $breadcrumb-margin-bottom; - @include font-size($breadcrumb-font-size); + padding: var(--#{$prefix}breadcrumb-padding-y) var(--#{$prefix}breadcrumb-padding-x); + margin-bottom: var(--#{$prefix}breadcrumb-margin-bottom); + @include font-size(var(--#{$prefix}breadcrumb-font-size)); list-style: none; - background-color: $breadcrumb-bg; - @include border-radius($breadcrumb-border-radius); + background-color: var(--#{$prefix}breadcrumb-bg); + @include border-radius(var(--#{$prefix}breadcrumb-border-radius)); } .breadcrumb-item { // The separator between breadcrumbs (by default, a forward-slash: "/") + .breadcrumb-item { - padding-left: $breadcrumb-item-padding-x; + padding-left: var(--#{$prefix}breadcrumb-item-padding-x); &::before { float: left; // Suppress inline spacings and underlining of the separator - padding-right: $breadcrumb-item-padding-x; - color: $breadcrumb-divider-color; - content: var(--#{$variable-prefix}breadcrumb-divider, escape-svg($breadcrumb-divider)) #{"/* rtl:"} var(--#{$variable-prefix}breadcrumb-divider, escape-svg($breadcrumb-divider-flipped)) #{"*/"}; + padding-right: var(--#{$prefix}breadcrumb-item-padding-x); + color: var(--#{$prefix}breadcrumb-divider-color); + content: var(--#{$prefix}breadcrumb-divider, escape-svg($breadcrumb-divider)) #{"/* rtl:"} var(--#{$prefix}breadcrumb-divider, escape-svg($breadcrumb-divider-flipped)) #{"*/"}; } } &.active { - color: $breadcrumb-active-color; + color: var(--#{$prefix}breadcrumb-item-active-color); } } diff --git a/_button-group.scss b/_button-group.scss index 13aa056..f78b8c1 100644 --- a/_button-group.scss +++ b/_button-group.scss @@ -34,6 +34,8 @@ } .btn-group { + @include border-radius($btn-border-radius); + // Prevent double borders when buttons are next to each other > .btn:not(:first-child), > .btn-group:not(:first-child) { @@ -42,6 +44,7 @@ // Reset rounded corners > .btn:not(:last-child):not(.dropdown-toggle), + > .btn.dropdown-toggle-split:first-child, > .btn-group:not(:last-child) > .btn { @include border-end-radius(0); } diff --git a/_buttons.scss b/_buttons.scss index ee4287c..044b8d6 100644 --- a/_buttons.scss +++ b/_buttons.scss @@ -3,49 +3,94 @@ // .btn { + // scss-docs-start btn-css-vars + --#{$prefix}btn-padding-x: #{$btn-padding-x}; + --#{$prefix}btn-padding-y: #{$btn-padding-y}; + --#{$prefix}btn-font-family: #{$btn-font-family}; + @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-bg: transparent; + --#{$prefix}btn-border-width: #{$btn-border-width}; + --#{$prefix}btn-border-color: transparent; + --#{$prefix}btn-border-radius: #{$btn-border-radius}; + --#{$prefix}btn-box-shadow: #{$btn-box-shadow}; + --#{$prefix}btn-disabled-opacity: #{$btn-disabled-opacity}; + --#{$prefix}btn-focus-box-shadow: 0 0 0 #{$btn-focus-width} rgba(var(--#{$prefix}btn-focus-shadow-rgb), .5); + // scss-docs-end btn-css-vars + display: inline-block; - font-family: $btn-font-family; - font-weight: $btn-font-weight; - line-height: $btn-line-height; - color: $body-color; + padding: var(--#{$prefix}btn-padding-y) var(--#{$prefix}btn-padding-x); + font-family: var(--#{$prefix}btn-font-family); + @include font-size(var(--#{$prefix}btn-font-size)); + font-weight: var(--#{$prefix}btn-font-weight); + line-height: var(--#{$prefix}btn-line-height); + color: var(--#{$prefix}btn-color); text-align: center; text-decoration: if($link-decoration == none, null, none); white-space: $btn-white-space; vertical-align: middle; cursor: if($enable-button-pointers, pointer, null); user-select: none; - background-color: transparent; - border: $btn-border-width solid transparent; - @include button-size($btn-padding-y, $btn-padding-x, $btn-font-size, $btn-border-radius); + border: var(--#{$prefix}btn-border-width) solid var(--#{$prefix}btn-border-color); + @include border-radius(var(--#{$prefix}btn-border-radius)); + @include gradient-bg(var(--#{$prefix}btn-bg)); + @include box-shadow(var(--#{$prefix}btn-box-shadow)); @include transition($btn-transition); &:hover { - color: $body-color; + color: var(--#{$prefix}btn-hover-color); text-decoration: if($link-hover-decoration == underline, none, null); + background-color: var(--#{$prefix}btn-hover-bg); + border-color: var(--#{$prefix}btn-hover-border-color); } .btn-check:focus + &, &:focus { + color: var(--#{$prefix}btn-hover-color); + @include gradient-bg(var(--#{$prefix}btn-hover-bg)); + border-color: var(--#{$prefix}btn-hover-border-color); outline: 0; - box-shadow: $btn-focus-box-shadow; + // Avoid using mixin so we can pass custom focus shadow properly + @if $enable-shadows { + box-shadow: var(--#{$prefix}btn-box-shadow), var(--#{$prefix}btn-focus-box-shadow); + } @else { + box-shadow: var(--#{$prefix}btn-focus-box-shadow); + } } .btn-check:checked + &, .btn-check:active + &, &:active, - &.active { - @include box-shadow($btn-active-box-shadow); + &.active, + &.show { + color: var(--#{$prefix}btn-active-color); + background-color: var(--#{$prefix}btn-active-bg); + // Remove CSS gradients if they're enabled + background-image: if($enable-gradients, none, null); + border-color: var(--#{$prefix}btn-active-border-color); + @include box-shadow(var(--#{$prefix}btn-active-shadow)); &:focus { - @include box-shadow($btn-focus-box-shadow, $btn-active-box-shadow); + // Avoid using mixin so we can pass custom focus shadow properly + @if $enable-shadows { + box-shadow: var(--#{$prefix}btn-active-shadow), var(--#{$prefix}btn-focus-box-shadow); + } @else { + box-shadow: var(--#{$prefix}btn-focus-box-shadow); + } } } &:disabled, &.disabled, fieldset:disabled & { + color: var(--#{$prefix}btn-disabled-color); pointer-events: none; - opacity: $btn-disabled-opacity; + background-color: var(--#{$prefix}btn-disabled-bg); + background-image: if($enable-gradients, none, null); + border-color: var(--#{$prefix}btn-disabled-border-color); + opacity: var(--#{$prefix}btn-disabled-opacity); @include box-shadow(none); } } @@ -58,7 +103,27 @@ // scss-docs-start btn-variant-loops @each $color, $value in $theme-colors { .btn-#{$color} { - @include button-variant($value, $value); + @if $color == "light" { + @include button-variant( + $value, + $value, + $hover-background: shade-color($value, $btn-hover-bg-shade-amount), + $hover-border: shade-color($value, $btn-hover-border-shade-amount), + $active-background: shade-color($value, $btn-active-bg-shade-amount), + $active-border: shade-color($value, $btn-active-border-shade-amount) + ); + } @else if $color == "dark" { + @include button-variant( + $value, + $value, + $hover-background: tint-color($value, $btn-hover-bg-tint-amount), + $hover-border: tint-color($value, $btn-hover-border-tint-amount), + $active-background: tint-color($value, $btn-active-bg-tint-amount), + $active-border: tint-color($value, $btn-active-border-tint-amount) + ); + } @else { + @include button-variant($value, $value); + } } } @@ -76,22 +141,32 @@ // Make a button look and behave like a link .btn-link { - font-weight: $font-weight-normal; - color: $btn-link-color; + --#{$prefix}btn-font-weight: #{$font-weight-normal}; + --#{$prefix}btn-color: #{$btn-link-color}; + --#{$prefix}btn-bg: transparent; + --#{$prefix}btn-border-color: transparent; + --#{$prefix}btn-hover-color: #{$btn-link-hover-color}; + --#{$prefix}btn-hover-border-color: transparent; + --#{$prefix}btn-active-color: #{$btn-link-hover-color}; + --#{$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%))}; + text-decoration: $link-decoration; - &:hover { - color: $btn-link-hover-color; + &:hover, + &:focus { text-decoration: $link-hover-decoration; } &:focus { - text-decoration: $link-hover-decoration; + color: var(--#{$prefix}btn-color); } - &:disabled, - &.disabled { - color: $btn-link-disabled-color; + &:hover { + color: var(--#{$prefix}btn-hover-color); } // No need for an active state here diff --git a/_card.scss b/_card.scss index 22890f5..ce8c02f 100644 --- a/_card.scss +++ b/_card.scss @@ -3,17 +3,37 @@ // .card { + // scss-docs-start card-css-vars + --#{$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-border-width: #{$card-border-width}; + --#{$prefix}card-border-color: #{$card-border-color}; + --#{$prefix}card-border-radius: #{$card-border-radius}; + --#{$prefix}card-box-shadow: #{$card-box-shadow}; + --#{$prefix}card-inner-border-radius: #{$card-inner-border-radius}; + --#{$prefix}card-cap-padding-y: #{$card-cap-padding-y}; + --#{$prefix}card-cap-padding-x: #{$card-cap-padding-x}; + --#{$prefix}card-cap-bg: #{$card-cap-bg}; + --#{$prefix}card-cap-color: #{$card-cap-color}; + --#{$prefix}card-height: #{$card-height}; + --#{$prefix}card-color: #{$card-color}; + --#{$prefix}card-bg: #{$card-bg}; + --#{$prefix}card-img-overlay-padding: #{$card-img-overlay-padding}; + --#{$prefix}card-group-margin: #{$card-group-margin}; + // scss-docs-end card-css-vars + position: relative; display: flex; flex-direction: column; min-width: 0; // See https://github.com/twbs/bootstrap/pull/22740#issuecomment-305868106 - height: $card-height; + height: var(--#{$prefix}card-height); word-wrap: break-word; - background-color: $card-bg; + background-color: var(--#{$prefix}card-bg); background-clip: border-box; - border: $card-border-width solid $card-border-color; - @include border-radius($card-border-radius); - @include box-shadow($card-box-shadow); + border: var(--#{$prefix}card-border-width) solid var(--#{$prefix}card-border-color); + @include border-radius(var(--#{$prefix}card-border-radius)); + @include box-shadow(var(--#{$prefix}card-box-shadow)); > hr { margin-right: 0; @@ -26,12 +46,12 @@ &:first-child { border-top-width: 0; - @include border-top-radius($card-inner-border-radius); + @include border-top-radius(var(--#{$prefix}card-inner-border-radius)); } &:last-child { border-bottom-width: 0; - @include border-bottom-radius($card-inner-border-radius); + @include border-bottom-radius(var(--#{$prefix}card-inner-border-radius)); } } @@ -47,16 +67,16 @@ // Enable `flex-grow: 1` for decks and groups so that card blocks take up // as much space as possible, ensuring footers are aligned to the bottom. flex: 1 1 auto; - padding: $card-spacer-y $card-spacer-x; - color: $card-color; + padding: var(--#{$prefix}card-spacer-y) var(--#{$prefix}card-spacer-x); + color: var(--#{$prefix}card-color); } .card-title { - margin-bottom: $card-title-spacer-y; + margin-bottom: var(--#{$prefix}card-title-spacer-y); } .card-subtitle { - margin-top: -$card-title-spacer-y * .5; + margin-top: calc(-.5 * var(--#{$prefix}card-title-spacer-y)); // stylelint-disable-line function-disallowed-list margin-bottom: 0; } @@ -70,7 +90,7 @@ } + .card-link { - margin-left: $card-spacer-x; + margin-left: var(--#{$prefix}card-spacer-x); } } @@ -79,25 +99,25 @@ // .card-header { - padding: $card-cap-padding-y $card-cap-padding-x; + padding: var(--#{$prefix}card-cap-padding-y) var(--#{$prefix}card-cap-padding-x); margin-bottom: 0; // Removes the default margin-bottom of - color: $card-cap-color; - background-color: $card-cap-bg; - border-bottom: $card-border-width solid $card-border-color; + color: var(--#{$prefix}card-cap-color); + background-color: var(--#{$prefix}card-cap-bg); + border-bottom: var(--#{$prefix}card-border-width) solid var(--#{$prefix}card-border-color); &:first-child { - @include border-radius($card-inner-border-radius $card-inner-border-radius 0 0); + @include border-radius(var(--#{$prefix}card-inner-border-radius) var(--#{$prefix}card-inner-border-radius) 0 0); } } .card-footer { - padding: $card-cap-padding-y $card-cap-padding-x; - color: $card-cap-color; - background-color: $card-cap-bg; - border-top: $card-border-width solid $card-border-color; + padding: var(--#{$prefix}card-cap-padding-y) var(--#{$prefix}card-cap-padding-x); + color: var(--#{$prefix}card-cap-color); + background-color: var(--#{$prefix}card-cap-bg); + border-top: var(--#{$prefix}card-border-width) solid var(--#{$prefix}card-border-color); &:last-child { - @include border-radius(0 0 $card-inner-border-radius $card-inner-border-radius); + @include border-radius(0 0 var(--#{$prefix}card-inner-border-radius) var(--#{$prefix}card-inner-border-radius)); } } @@ -107,22 +127,20 @@ // .card-header-tabs { - margin-right: -$card-cap-padding-x * .5; - margin-bottom: -$card-cap-padding-y; - margin-left: -$card-cap-padding-x * .5; + margin-right: calc(-.5 * var(--#{$prefix}card-cap-padding-x)); // stylelint-disable-line function-disallowed-list + margin-bottom: calc(-1 * var(--#{$prefix}card-cap-padding-y)); // stylelint-disable-line function-disallowed-list + margin-left: calc(-.5 * var(--#{$prefix}card-cap-padding-x)); // stylelint-disable-line function-disallowed-list border-bottom: 0; - @if $nav-tabs-link-active-bg != $card-bg { - .nav-link.active { - background-color: $card-bg; - border-bottom-color: $card-bg; - } + .nav-link.active { + background-color: var(--#{$prefix}card-bg); + border-bottom-color: var(--#{$prefix}card-bg); } } .card-header-pills { - margin-right: -$card-cap-padding-x * .5; - margin-left: -$card-cap-padding-x * .5; + margin-right: calc(-.5 * var(--#{$prefix}card-cap-padding-x)); // stylelint-disable-line function-disallowed-list + margin-left: calc(-.5 * var(--#{$prefix}card-cap-padding-x)); // stylelint-disable-line function-disallowed-list } // Card image @@ -132,8 +150,8 @@ right: 0; bottom: 0; left: 0; - padding: $card-img-overlay-padding; - @include border-radius($card-inner-border-radius); + padding: var(--#{$prefix}card-img-overlay-padding); + @include border-radius(var(--#{$prefix}card-inner-border-radius)); } .card-img, @@ -144,12 +162,12 @@ .card-img, .card-img-top { - @include border-top-radius($card-inner-border-radius); + @include border-top-radius(var(--#{$prefix}card-inner-border-radius)); } .card-img, .card-img-bottom { - @include border-bottom-radius($card-inner-border-radius); + @include border-bottom-radius(var(--#{$prefix}card-inner-border-radius)); } @@ -161,7 +179,7 @@ // The child selector allows nested `.card` within `.card-group` // to display properly. > .card { - margin-bottom: $card-group-margin; + margin-bottom: var(--#{$prefix}card-group-margin); } @include media-breakpoint-up(sm) { diff --git a/_close.scss b/_close.scss index 32a0f68..a0813de 100644 --- a/_close.scss +++ b/_close.scss @@ -1,4 +1,4 @@ -// transparent background and border properties included for button version. +// Transparent background and border properties included for button version. // iOS requires the button element instead of an anchor tag. // If you want the anchor version, it requires `href="#"`. // See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile diff --git a/_containers.scss b/_containers.scss index f88f1e5..83b3138 100644 --- a/_containers.scss +++ b/_containers.scss @@ -2,7 +2,7 @@ // // Set the container width, and override it for fixed navbars in media queries. -@if $enable-grid-classes { +@if $enable-container-classes { // Single container class with breakpoint max-widths .container, // 100% wide container at all breakpoints diff --git a/_dropdown.scss b/_dropdown.scss index adc1143..62125b9 100644 --- a/_dropdown.scss +++ b/_dropdown.scss @@ -2,7 +2,9 @@ .dropup, .dropend, .dropdown, -.dropstart { +.dropstart, +.dropup-center, +.dropdown-center { position: relative; } @@ -15,26 +17,66 @@ // The dropdown menu .dropdown-menu { + // scss-docs-start dropdown-css-vars + --#{$prefix}dropdown-min-width: #{$dropdown-min-width}; + --#{$prefix}dropdown-padding-x: #{$dropdown-padding-x}; + --#{$prefix}dropdown-padding-y: #{$dropdown-padding-y}; + --#{$prefix}dropdown-spacer: #{$dropdown-spacer}; + @include rfs($dropdown-font-size, --#{$prefix}dropdown-font-size); + --#{$prefix}dropdown-color: #{$dropdown-color}; + --#{$prefix}dropdown-bg: #{$dropdown-bg}; + --#{$prefix}dropdown-border-color: #{$dropdown-border-color}; + --#{$prefix}dropdown-border-radius: #{$dropdown-border-radius}; + --#{$prefix}dropdown-border-width: #{$dropdown-border-width}; + --#{$prefix}dropdown-inner-border-radius: #{$dropdown-inner-border-radius}; + --#{$prefix}dropdown-divider-bg: #{$dropdown-divider-bg}; + --#{$prefix}dropdown-divider-margin-y: #{$dropdown-divider-margin-y}; + --#{$prefix}dropdown-box-shadow: #{$dropdown-box-shadow}; + --#{$prefix}dropdown-link-color: #{$dropdown-link-color}; + --#{$prefix}dropdown-link-hover-color: #{$dropdown-link-hover-color}; + --#{$prefix}dropdown-link-hover-bg: #{$dropdown-link-hover-bg}; + --#{$prefix}dropdown-link-active-color: #{$dropdown-link-active-color}; + --#{$prefix}dropdown-link-active-bg: #{$dropdown-link-active-bg}; + --#{$prefix}dropdown-link-disabled-color: #{$dropdown-link-disabled-color}; + --#{$prefix}dropdown-item-padding-x: #{$dropdown-item-padding-x}; + --#{$prefix}dropdown-item-padding-y: #{$dropdown-item-padding-y}; + --#{$prefix}dropdown-header-color: #{$dropdown-header-color}; + --#{$prefix}dropdown-header-padding-x: #{$dropdown-header-padding-x}; + --#{$prefix}dropdown-header-padding-y: #{$dropdown-header-padding-y}; + // scss-docs-end dropdown-css-vars + position: absolute; z-index: $zindex-dropdown; display: none; // none by default, but block on "open" of the menu - min-width: $dropdown-min-width; - padding: $dropdown-padding-y $dropdown-padding-x; + min-width: var(--#{$prefix}dropdown-min-width); + padding: var(--#{$prefix}dropdown-padding-y) var(--#{$prefix}dropdown-padding-x); margin: 0; // Override default margin of ul - @include font-size($dropdown-font-size); - color: $dropdown-color; + @include font-size(var(--#{$prefix}dropdown-font-size)); + color: var(--#{$prefix}dropdown-color); text-align: left; // Ensures proper alignment if parent has it changed (e.g., modal footer) list-style: none; - background-color: $dropdown-bg; + background-color: var(--#{$prefix}dropdown-bg); background-clip: padding-box; - border: $dropdown-border-width solid $dropdown-border-color; - @include border-radius($dropdown-border-radius); - @include box-shadow($dropdown-box-shadow); + border: var(--#{$prefix}dropdown-border-width) solid var(--#{$prefix}dropdown-border-color); + @include border-radius(var(--#{$prefix}dropdown-border-radius)); + @include box-shadow(var(--#{$prefix}dropdown-box-shadow)); &[data-bs-popper] { top: 100%; left: 0; - margin-top: $dropdown-spacer; + margin-top: var(--#{$prefix}dropdown-spacer); + } + + @if $dropdown-padding-y == 0 { + > .dropdown-item:first-child, + > li:first-child .dropdown-item { + @include border-top-radius(var(--#{$prefix}dropdown-inner-border-radius)); + } + > .dropdown-item:last-child, + > li:last-child .dropdown-item { + @include border-bottom-radius(var(--#{$prefix}dropdown-inner-border-radius)); + } + } } @@ -74,7 +116,7 @@ top: auto; bottom: 100%; margin-top: 0; - margin-bottom: $dropdown-spacer; + margin-bottom: var(--#{$prefix}dropdown-spacer); } .dropdown-toggle { @@ -88,7 +130,7 @@ right: auto; left: 100%; margin-top: 0; - margin-left: $dropdown-spacer; + margin-left: var(--#{$prefix}dropdown-spacer); } .dropdown-toggle { @@ -105,7 +147,7 @@ right: 100%; left: auto; margin-top: 0; - margin-right: $dropdown-spacer; + margin-right: var(--#{$prefix}dropdown-spacer); } .dropdown-toggle { @@ -120,9 +162,10 @@ // Dividers (basically an `


`) within the dropdown .dropdown-divider { height: 0; - margin: $dropdown-divider-margin-y 0; + margin: var(--#{$prefix}dropdown-divider-margin-y) 0; overflow: hidden; - border-top: 1px solid $dropdown-divider-bg; + border-top: 1px solid var(--#{$prefix}dropdown-divider-bg); + opacity: 1; // Revisit in v6 to de-dupe styles that conflict with
element } // Links, buttons, and more within the dropdown menu @@ -131,45 +174,33 @@ .dropdown-item { display: block; width: 100%; // For `