Skip to content

Commit a4e487c

Browse files
cpsievertgadenbuie
andauthored
Upgrade to Bootstrap v5.3.1 (#749)
Co-authored-by: Garrick Aden-Buie <[email protected]> Co-authored-by: cpsievert <[email protected]>
1 parent 8d9c0dd commit a4e487c

File tree

145 files changed

+2099
-1561
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+2099
-1561
lines changed

R/bs-theme.R

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ bootstrap_bundle <- function(version) {
277277
# Don't name this "core" bundle so it can't easily be removed
278278
sass_layer(
279279
functions = bs5_sass_files("functions"),
280-
defaults = bs5_sass_files("variables"),
280+
defaults = list(bs5_sass_files("variables"), bs5_sass_files("variables-dark")),
281281
mixins = list(bs5_sass_files("maps"), bs5_sass_files("mixins")),
282282
rules = list(bs5_sass_files("mixins/banner"), "@include bsBanner('')")
283283
),
@@ -352,15 +352,7 @@ bootstrap_bundle <- function(version) {
352352

353353
sass_bundle(
354354
main_bundle,
355-
# color-contrast() was introduced in Bootstrap 5.
356-
# We include our own version for a few reasons:
357-
# 1. Easily turn off warnings options(bslib.color_contrast_warnings=F)
358-
# 2. Allow Bootstrap 3 & 4 to use color-contrast() in variable definitions
359-
# 3. Allow Bootstrap 3 & 4 to use bs_get_contrast()
360-
sass_layer(
361-
functions = sass_file(path_inst("sass-utils/color-contrast.scss")),
362-
rules = sass_file(path_inst("bslib-scss", "bslib.scss"))
363-
)
355+
bslib_bundle()
364356
)
365357
}
366358

@@ -380,6 +372,16 @@ bootstrap_javascript <- function(version) {
380372
)
381373
}
382374

375+
# -----------------------------------------------------------------
376+
# bslib specific Sass that gets bundled with Bootstrap
377+
# -----------------------------------------------------------------
378+
379+
bslib_bundle <- function() {
380+
sass_layer(
381+
functions = sass_file(path_inst("bslib-scss", "functions.scss")),
382+
rules = sass_file(path_inst("bslib-scss", "bslib.scss"))
383+
)
384+
}
383385

384386
# -----------------------------------------------------------------
385387
# BS3 compatibility bundle

R/sysdata.rda

482 Bytes
Binary file not shown.

R/versions.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# DO NOT EDIT
22
# This file is auto-generated by tools/yarn_install.R
3-
version_bs5 <- "5.2.2"
3+
version_bs5 <- "5.3.1"
44
version_bs4 <- "4.6.0"
55
version_bs3 <- "3.4.1"
66
version_accessibility <- "1.0.6"

inst/bs3compat/_declarations.scss

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
// Cards are white by default, but we want a smarter default for .well
22
// that it appears gray by default
3-
$well-bg: $card-cap-bg !default;
3+
$well-bg: rgba($black, .03) !default;
44
$well-color: $body-color !default;
5+
6+
// Bootstrap 5.3.1 + selectize.js v0.12.4 (i.e., shiny v1.7.5) shim
7+
//
8+
// Starting with 5.3.x, Bootstrap started having Sass variables default to CSS
9+
// variables (e.g., $input-color: var(--bs-body-color)), which is problematic for
10+
// compuation that happens in Sass (e.g., `mix($color1, $color2)`). This bundle
11+
// fixes this problem for shiny::selectizeInput()'s Sass code (future versions of
12+
// selectizeInput() should hopefully address this problem, making this temporary
13+
// stopgap solution no longer required).
14+
$selectize-color-text: if(is-css-variable($input-color), $body-color, $input-color) !default;
15+
$selectize-color-item: rgba($selectize-color-text, 0.1) !default;
16+
$selectize-color-item-border: if(is-css-variable($input-border-color), $border-color, $input-border-color) !default;
17+
$selectize-color-dropdown: if(is-css-variable($dropdown-bg), $body-bg, $dropdown-bg) !default;
18+
$selectize-color-dropdown-border-top: rgba($input-border-color, 0.2) !default;
19+
$selectize-color-dropdown-item-create-text: rgba($selectize-color-text, 0.5) !default;

inst/bs3compat/_defaults.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
// BS3 had .navbar { margin-bottom: 20px; }
22
$navbar-margin-bottom: 20px !default;
3+
4+
// BS5+ variable used for prefixing CSS vars
5+
$prefix: bs- !default;

inst/bs3compat/_navbar_compat.scss

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,20 @@ ul.nav.navbar-nav {
3838
}
3939
}
4040

41-
ul.nav.navbar-nav>li:not(.dropdown) {
42-
@extend .nav-item;
43-
}
44-
ul.nav.navbar-nav>li>a {
45-
@extend .nav-link;
41+
ul.nav.navbar-nav > li {
42+
&:not(.dropdown) {
43+
@extend .nav-item;
44+
}
45+
46+
> a {
47+
@extend .nav-link;
48+
}
49+
50+
&.active, &.show {
51+
> a {
52+
color: var(--#{$prefix}navbar-active-color);
53+
}
54+
}
4655
}
4756

4857
// BS3 .navbar-default -> BS4 .navbar-light

inst/bslib-scss/functions.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// color-contrast() was introduced in Bootstrap 5.
2+
// We include our own version for a few reasons:
3+
// 1. Easily turn off warnings options(bslib.color_contrast_warnings=F)
4+
// 2. Allow Bootstrap 3 & 4 to use color-contrast() in variable definitions
5+
// 3. Allow Bootstrap 3 & 4 to use bs_get_contrast()
6+
7+
// Also note that color-contrast() lives in sass-utils since projects like Quarto
8+
// and flexdashboard currently assume it exists there....
9+
@import "../sass-utils/color-contrast.scss";
10+
11+
12+
@function is-css-variable($x) {
13+
@if (type-of($x) != string) {
14+
@return false;
15+
} @else {
16+
@return str-slice($x, 1, 6) == 'var(--';
17+
}
18+
}

inst/builtin/bs5/shiny/_mixins.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
// Accordions
2+
// These definitions can't go in _defaults.scss with a !default flag (because !default doesn't respect null)
3+
$accordion-button-active-bg: null;
4+
$accordion-button-active-color: null;
5+
$accordion-icon-active-color: null;
6+
17
// Shiny: selectInput() and selectizeInput()
28
$selectize-color-dropdown-item-active: $component-active-bg !default;
39
$selectize-color-dropdown-item-active-text: $component-active-color !default;

inst/components/dist/sidebar/sidebar.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inst/css-precompiled/4/bootstrap.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)