From 71a45e066ef0d3aef75ec14c1588406e7de04b0b Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Sat, 16 Mar 2024 15:13:01 -0400 Subject: [PATCH 1/6] feat(layout_columns): Make `sm` the default breakpoint --- R/layout.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/layout.R b/R/layout.R index 6a8527095..937701434 100644 --- a/R/layout.R +++ b/R/layout.R @@ -299,7 +299,7 @@ as_col_spec <- function(col_widths, n_kids) { if (is.null(col_widths) || rlang::is_na(col_widths)) return(NULL) if (!is_breakpoints(col_widths)) { - col_widths <- breakpoints(md = col_widths) + col_widths <- breakpoints(sm = col_widths) } for (break_name in names(col_widths)) { From e6349cb153f4ede2e90e517b1d03888a89772f42 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Sat, 16 Mar 2024 15:13:40 -0400 Subject: [PATCH 2/6] fix(layout_columns): `--sm` css variable is needed, actually --- R/layout.R | 9 --------- 1 file changed, 9 deletions(-) diff --git a/R/layout.R b/R/layout.R index 937701434..359b3269d 100644 --- a/R/layout.R +++ b/R/layout.R @@ -355,20 +355,11 @@ row_heights_css_vars <- function(x) { x <- breakpoints(xs = x) } - idx_sm <- match("xs", names(x)) - # creates classes that pair with CSS variables when set classes <- paste0("bslib-grid--row-heights--", names(x)) css_vars <- setNames(x, paste0("--", classes)) - if (!is.na(idx_sm)) { - # xs doesn't need a specific breakpoint var, we just set the base CSS var - names(css_vars)[idx_sm] <- "--bslib-grid--row-heights" - # and as result we don't need a class to activate it. - classes <- classes[-idx_sm] - } - # Treat numeric values as fractional units css_vars <- rapply(css_vars, how = "replace", maybe_fr_unit) From c472fcdf6877c344b9f42ea1cb3c56951ddac955 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Sat, 16 Mar 2024 15:25:09 -0400 Subject: [PATCH 3/6] refactor(layout_columns): set base row heights css var if xs is only breakpoint --- R/layout.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/layout.R b/R/layout.R index 359b3269d..7d991b50f 100644 --- a/R/layout.R +++ b/R/layout.R @@ -363,6 +363,11 @@ row_heights_css_vars <- function(x) { # Treat numeric values as fractional units css_vars <- rapply(css_vars, how = "replace", maybe_fr_unit) + if (identical(names(css_vars), "--bslib-grid--row-heights--xs")) { + names(css_vars) <- "--bslib-grid--row-heights" + classes <- character() + } + list( style = css(!!!css_vars), class = classes From bd349fd3f04a79d5d05c2f7d784f702e1a9ce72c Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Sat, 16 Mar 2024 15:27:12 -0400 Subject: [PATCH 4/6] tests: Update snapshots --- tests/testthat/_snaps/layout.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/_snaps/layout.md b/tests/testthat/_snaps/layout.md index 5ebec328b..90ac78a0f 100644 --- a/tests/testthat/_snaps/layout.md +++ b/tests/testthat/_snaps/layout.md @@ -4,7 +4,7 @@ layout_columns(col_widths = 6, !!!children) Output
- +
@@ -20,7 +20,7 @@ layout_columns(col_widths = c(4, 8), !!!children) Output
- +
From 53940ee0a2317b853d05e4c9d8aca0f183ec2148 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Sat, 16 Mar 2024 15:46:22 -0400 Subject: [PATCH 5/6] docs(news): Add news items --- NEWS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS.md b/NEWS.md index 3b61f9ab4..beaa16034 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,8 @@ * `page_sidebar()` now places the `title` element in a `.navbar` container that matches the structure of `page_navbar()`. This ensures that the title elements of `page_sidebar()` and `page_navbar()` have consistent appearance. (#998) +* The `col_widths` argument of `layout_columns()` now sets the `sm` breakpoint by default, rather than the `md` breakpoint. For example, `col_widths = c(12, 6, 6)` is no equivalent to `breakpoints(sm = c(12, 6, 6))` rather than `breakpoints(md = c(12, 6, 6))`. (#1014) + ## New features * Added `input_task_button()`, a replacement for `shiny::actionButton()` that automatically prevents an operation from being submitted multiple times. It does this by, upon click, immediately transitioning to a "Processing..." visual state that does not let the button be clicked again. The button resets to its clickable state automatically after the reactive flush it causes is complete; or, for advanced scenarios, `update_task_button()` can be used to manually control when the button resets. @@ -48,6 +50,8 @@ * Fixed an issue that could happen with a `card()` or `value_box()` that is rendered entirely via `renderUI()` when it is replaced by an updated card but the user had expanded the original card into full screen mode. Now the full screen state is reset for the new card or value box. If you want to update a card without potentially exiting the full-screen mode, update specific parts of the card using `uiOutput()` or `textOutput()`. (#1005) +* Fixed an issue where the `xs` breakpoint in a `breakpoints()` object used for `row_heights` in `layout_columns()` would override all other breakpoints. (#1014) + # bslib 0.6.1 ## Bug fixes From e58ba44b5a8da96d714a14e142ef29dd923afe3a Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Mon, 18 Mar 2024 11:23:22 -0400 Subject: [PATCH 6/6] docs(news): Fix typo Co-authored-by: Carson Sievert --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index beaa16034..f2ec2de8c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,7 +8,7 @@ * `page_sidebar()` now places the `title` element in a `.navbar` container that matches the structure of `page_navbar()`. This ensures that the title elements of `page_sidebar()` and `page_navbar()` have consistent appearance. (#998) -* The `col_widths` argument of `layout_columns()` now sets the `sm` breakpoint by default, rather than the `md` breakpoint. For example, `col_widths = c(12, 6, 6)` is no equivalent to `breakpoints(sm = c(12, 6, 6))` rather than `breakpoints(md = c(12, 6, 6))`. (#1014) +* The `col_widths` argument of `layout_columns()` now sets the `sm` breakpoint by default, rather than the `md` breakpoint. For example, `col_widths = c(12, 6, 6)` is now equivalent to `breakpoints(sm = c(12, 6, 6))` rather than `breakpoints(md = c(12, 6, 6))`. (#1014) ## New features