Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap 5 support #304

Merged
merged 81 commits into from Jun 14, 2021
Merged

Bootstrap 5 support #304

merged 81 commits into from Jun 14, 2021

Conversation

cpsievert
Copy link
Collaborator

@cpsievert cpsievert commented Apr 8, 2021

Closes #82 (adds support for bs_theme(version = 5), which will become the default in a future version)

TODO

  • Merge Bootstrap 5 support shiny#3410 (make check for R package versions when version = 5?)
  • Do more testing to see if we need more changes in shiny, rmarkdown (which likely needs data-bs-*), shinyvalidate, flexdashboard, etc

R/navs-legacy.R Outdated Show resolved Hide resolved
R/navs-legacy.R Show resolved Hide resolved
@cpsievert
Copy link
Collaborator Author

@wch here's a link to the tab compatibility https://github.com/rstudio/bslib/pull/304/files#diff-5adbf9ce681fca79d200b93004867c059adb16a19b6383a5123c075764f7494c

Hopefully the comments provide enough context, but I'm happy to explain more about how it works

Comment on lines -52 to -75
(function($) {
/*
* Bootstrap 4 uses poppler.js to choose what direction to show dropdown
* menus, except in the case of navbars; they assume that navbars are always
* at the top of the page, so this isn't necessary. However, Bootstrap 3
* explicitly supported bottom-positioned navbars via .navbar-fixed-bottom,
* and .fixed-bottom works on Bootstrap 4 as well.
*
* We monkeypatch the dropdown plugin's _detectNavbar method to return false
* if we're in a bottom-positioned navbar.
*/
if (!$.fn.dropdown.Constructor.prototype._detectNavbar) {
// If we get here, the dropdown plugin's implementation must've changed.
// Someone will need to go into Bootstrap's dropdown.js.
(console.warn || console.error || console.log)("bs3compat.js couldn't detect the dropdown plugin's _detectNavbar method");
return;
}

var oldDetectNavbar = $.fn.dropdown.Constructor.prototype._detectNavbar;
$.fn.dropdown.Constructor.prototype._detectNavbar = function() {
return oldDetectNavbar.apply(this, this.arguments) &&
!($(this._element).closest('.navbar').filter('.navbar-fixed-bottom, .fixed-bottom').length > 0);
};
})(jQuery);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines -1 to -17
// Restore .btn-default et al.
// We do this in _declarations.scss instead of up in _variables.scss because
// it's important that the `default` color come first in the $theme-colors map,
// so .btn-default comes before .btn-primary in the generated CSS and thus has
// lower priority.

// I don't like the default secondary color, as it's too big a departure from
// the bootstrap 3 coloring (dark instead of light grey). But secondary is
// semantically the closes match to default. So if secondary hasn't changed, use
// a lighter grey for default; but if a custom secondary is in use, then use
// that for default. (Another option would be to simply change the secondary
// color.)
@if $secondary == #6c757d {
$theme-colors: map-merge(("default": #dee2e6), $theme-colors) !global;
} @else {
$theme-colors: map-merge(("default": $secondary), $theme-colors) !global;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer needed since now patch Bootstrap source to do this in tools/patches/025-default-theme-color.patch

@cpsievert cpsievert merged commit 08be7ca into master Jun 14, 2021
@cpsievert cpsievert deleted the bs5 branch June 14, 2021 15:33
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Apr 30, 2022
shiny 1.7.1
===========
## Bug Fixes

* Closed #3516: Fix regression in repeated calls to `appendTab()` when
  `navbarMenu()` is already present within a
  `tabsetPanel()`/`navbarPage()`. (#3518)

* Re-arranged conditions for testthat 1.0.0 compatibility. (#3512)

shiny 1.7.0
===========
## Full changelog
### Breaking changes

* The `format` and `locale` arguments to `sliderInput()` have been
  removed. They have been deprecated since 0.10.2.2 (released on
  2014-12-08).

* Closed #3403: `insertTab()`'s `position` parameter now defaults to
  `"after"` instead of `"before"`. This has the benefit of allowing us
  to fix a bug in positioning when `target = NULL`, but has the
  drawback of changing the default behavior when `target` is not
  `NULL`. (#3404)

### New features and improvements
* Bootstrap 5 support. (#3410 and rstudio/bslib#304)

  * As explained
    [here](https://rstudio.github.io/bslib/index.html#basic-usage), to
    opt-in to Bootstrap 5, provide `bslib::bs_theme(version = 5)` to a
    page layout function with a `theme` argument (e.g., `fluidPage()`,
    `navbarPage()`, etc).

* Closed #3322, #3313, #1823, #3321, #3320, #1928, and #2310: Various
  improvements to `navbarPage()`, `tabsetPanel()`, `tabPanel()`,
  `navbarMenu()`, etc. Also, these functions are now powered by the
  `{bslib}` package's new `nav()` API (consider using `{bslib}`'s API
  to create better looking and more fully featured navs). (#3388)

* All uses of `list(...)` have been replaced with
  `rlang::list2(...)`. This means that you can use trailing `,`
  without error and use rlang's `!!!` operator to "splice" a list of
  argument values into `...`. We think this'll be particularly useful
  for passing a list of `tabPanel()` to their consumers (i.e.,
  `tabsetPanel()`, `navbarPage()`, etc). For example, `tabs <-
  list(tabPanel("A", "a"), tabPanel("B", "b"));
  navbarPage(!!!tabs)`. (#3315 and #3328)

* `installExprFunction()` and `exprToFunction()` are now able to
  handle quosures when `quoted = TRUE`. So `render`-functions which
  call these functions (such as with `htmlwidgets`) can now understand
  quosures. Users can also use `rlang::inject()` to unquote a quosure
  for evaluation.  This also means that `render` function no longer
  need `env` and `quoted` parameters; that information can be embedded
  into a quosure which is then passed to the `render` function. Better
  documentation was added for how to create `render`
  functions. (#3472)

* `icon(lib="fontawesome")` is now powered by the `{fontawesome}`
  package, which will make it easier to use the latest FA icons in the
  future (by updating the `{fontawesome}` package). (#3302)

* Closed #3397: `renderPlot()` new uses `ggplot2::get_alt_text()` to inform an `alt` text default (for `{ggplot2}` plots). (#3398)

* `modalDialog()` gains support for `size = "xl"`. (#3410)

* Addressed #2521: Updated the list of TCP ports that will be rejected
  by default in runapp.R, adding 5060, 5061 and 6566. Added
  documentation describing the port range (3000:8000) and which ports
  are rejected. (#3456)

### Other improvements
* Shiny's core JavaScript code was converted to TypeScript. For the
  latest development information, please see the [README.md in
  `./srcts`](https://github.com/rstudio/shiny/tree/master/srcts). (#3296)

* Switched from `digest::digest()` to `rlang::hash()` for hashing. (#3264)

* Switched from internal `Stack` class to `fastmap::faststack()`, and
  used `fastmap::fastqueue()`. (#3176)

* Some long-deprecated functions and function parameters were
  removed. (#3137)

### Bug fixes
* Closed #3345: Shiny now correctly renders
  `htmltools::htmlDependency()`(s) with a `list()` of `script`
  attributes when used in a dynamic UI context. This fairly new
  `htmlDependency()` feature was added in `{htmltools}`
  v0.5.1. (#3395)

* Fixed [#2666](rstudio/shiny#2666) and
  [#2670](rstudio/shiny#2670):
  `nearPoints()` and `brushedPoints()` weren't properly account for
  missing values (#2666 was introduced in
  v1.4.0). ([#2668](rstudio/shiny#2668))

* Closed #3374: `quoToFunction()` now works correctly with nested
  quosures; and as a result, quasi-quotation with rendering function
  (e.g., `renderPrint()`, `renderPlot()`, etc) now works as expected
  with nested quosures. (#3373)

* Exported `register_devmode_option()`. This method was described in
  the documentation for `devmode()` but was never exported. See
  `?devmode()` for more details on how to register Shiny Developer
  options using `register_devmode_option()`. (#3364)

* Closed #3484: In the RStudio IDE on Mac 11.5, selected checkboxes
  and radio buttons were not visible. (#3485)

### Library updates

* Closed #3286: Updated to Font-Awesome 5.15.2. (#3288)

* Updated to jQuery 3.6.0. (#3311)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bootstrap 5
2 participants