Skip to content

Commit

Permalink
buttons justified when individual
Browse files Browse the repository at this point in the history
  • Loading branch information
pvictor committed Sep 23, 2024
1 parent 2f1fa29 commit a2b712e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: shinyWidgets
Title: Custom Inputs Widgets for Shiny
Version: 0.8.6.9200
Version: 0.8.6.9300
Authors@R: c(
person("Victor", "Perrier", email = "[email protected]", role = c("aut", "cre", "cph")),
person("Fanny", "Meyer", role = "aut"),
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
shinyWidgets 0.8.7
======================

* New widget : `slimSelectInput()`, an alternative select menu.
* Updated virtual-select to 1.0.45, see https://github.com/sa-si-dev/virtual-select/releases.
* [airDatepickerInput()] & [updateAirDateInput()]: added a `tz` argument to specify timezone.
* `airDatepickerInput()` & `updateAirDateInput()`: added a `tz` argument to specify timezone.
* `checkboxGroupButtons()` & `radioGroupButtons()`: fixed justified layout when using individual buttons.


shinyWidgets 0.8.6
Expand Down
19 changes: 17 additions & 2 deletions R/input-checkboxgroupbuttons.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,14 @@ markup_buttons_checkbox <- function(theme, args) {
}


markup_buttons_checkbox_bs3 <- function(inputId, choices, selected, status, size, checkIcon, disabled = FALSE, justified = FALSE) {
markup_buttons_checkbox_bs3 <- function(inputId,
choices,
selected,
status,
size,
checkIcon,
disabled = FALSE,
justified = FALSE) {
btn_wrapper <- function(...) {
htmltools::tags$div(
class = "btn-group btn-group-toggle",
Expand Down Expand Up @@ -145,7 +152,14 @@ markup_buttons_checkbox_bs3 <- function(inputId, choices, selected, status, size
}


markup_buttons_checkbox_bs5 <- function(inputId, choices, selected, status, size, checkIcon, disabled = FALSE, justified = FALSE) {
markup_buttons_checkbox_bs5 <- function(inputId,
choices,
selected,
status,
size,
checkIcon,
disabled = FALSE,
justified = FALSE) {
if (!is.null(checkIcon) && !is.null(checkIcon$yes)) {
displayIcon <- TRUE
} else {
Expand All @@ -169,6 +183,7 @@ markup_buttons_checkbox_bs5 <- function(inputId, choices, selected, status, size
class = paste0("btn checkbtn btn-", statusElement),
disabled = if (isTRUE(disabled)) "disabled",
class = if (isTRUE(disabled)) "disabled",
class = if (isTRUE(justified)) "flex-fill",
`for` = paste0(inputId, which(choices$choiceValues == value)),
if (displayIcon) tags$span(class = "check-btn-icon-yes", checkIcon$yes),
if (displayIcon) tags$span(class = "check-btn-icon-no", checkIcon$no),
Expand Down
19 changes: 17 additions & 2 deletions R/input-radiogroupbuttons.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,14 @@ markup_buttons_radio <- function(theme, args) {
do.call(markup_buttons_radio_bs3, args)
}

markup_buttons_radio_bs3 <- function(inputId, choices, selected, status, size, checkIcon, disabled = FALSE, justified = FALSE) {
markup_buttons_radio_bs3 <- function(inputId,
choices,
selected,
status,
size,
checkIcon,
disabled = FALSE,
justified = FALSE) {
btn_wrapper <- function(...) {
htmltools::tags$div(
class = "btn-group btn-group-toggle",
Expand Down Expand Up @@ -157,7 +164,14 @@ markup_buttons_radio_bs3 <- function(inputId, choices, selected, status, size, c
}


markup_buttons_radio_bs5 <- function(inputId, choices, selected, status, size, checkIcon, disabled = FALSE, justified = FALSE) {
markup_buttons_radio_bs5 <- function(inputId,
choices,
selected,
status,
size,
checkIcon,
disabled = FALSE,
justified = FALSE) {
if (!is.null(checkIcon) && !is.null(checkIcon$yes)) {
displayIcon <- TRUE
} else {
Expand All @@ -181,6 +195,7 @@ markup_buttons_radio_bs5 <- function(inputId, choices, selected, status, size, c
class = paste0("btn radiobtn btn-", statusElement),
disabled = if (isTRUE(disabled)) "disabled",
class = if (isTRUE(disabled)) "disabled",
class = if (isTRUE(justified)) "flex-fill",
`for` = paste0(inputId, which(choices$choiceValues == value)),
if (displayIcon) tags$span(class = "radio-btn-icon-yes", checkIcon$yes),
if (displayIcon) tags$span(class = "radio-btn-icon-no", checkIcon$no),
Expand Down

0 comments on commit a2b712e

Please sign in to comment.