From 76bf5065d0f4ce7264f9ea9d1a907835eef974fa Mon Sep 17 00:00:00 2001 From: Gregory R Warnes Date: Wed, 6 Jan 2021 15:48:36 -0500 Subject: [PATCH 1/7] Add `id` parameter to `bsCollapsePanel` to set the HTML id of the collapse element. --- R/bsCollapsePanel.R | 7 +++-- inst/examples/Collapses/ui.R | 50 +++++++++++++++++++++++++----------- man/bsCollapse.Rd | 19 +++++++------- 3 files changed, 50 insertions(+), 26 deletions(-) diff --git a/R/bsCollapsePanel.R b/R/bsCollapsePanel.R index 5f5f16f..45ffc4e 100644 --- a/R/bsCollapsePanel.R +++ b/R/bsCollapsePanel.R @@ -4,6 +4,7 @@ #' #'@param title The title to display at the top of the panel. #'@param \dots UI elements to include within the panel. +#'@param value \bold{Optional} HTML id. Auto-generated if missing. #'@param value \bold{Optional} The value to return when this panel is open. Defaults to \code{title}. #'@param style \bold{Optional} A Bootstrap style to apply to the panel. (\code{primary}, \code{danger}, \code{warning}, \code{info}, or \code{success}) #' @@ -12,11 +13,13 @@ #'@template item_details #'@template footer #'@export -bsCollapsePanel <- function(title, ..., value = title, style = NULL) { +bsCollapsePanel <- function(title, ..., id, value = title, style = NULL) { content <- list(...) - id <- paste0("cpanel", sprintf("%07i", as.integer(stats::runif(1, 1, 1000000)))) + if(missing(id)) + id <- paste0("cpanel", sprintf("%07i", as.integer(stats::runif(1, 1, 1000000)))) + if(is.null(value)) { value = title } diff --git a/inst/examples/Collapses/ui.R b/inst/examples/Collapses/ui.R index 0dd53a7..2064e0c 100644 --- a/inst/examples/Collapses/ui.R +++ b/inst/examples/Collapses/ui.R @@ -1,21 +1,41 @@ library(shiny) library(shinyBS) - fluidPage( +fluidPage( sidebarLayout( - sidebarPanel(HTML("This button will open Panel 1 using updateCollapse."), - actionButton("p1Button", "Push Me!"), - selectInput("styleSelect", "Select style for Panel 1", - c("default", "primary", "danger", "warning", "info", "success")) - ), - mainPanel( - bsCollapse(id = "collapseExample", open = "Panel 2", - bsCollapsePanel("Panel 1", "This is a panel with just text ", - "and has the default style. You can change the style in ", - "the sidebar.", style = "info"), - bsCollapsePanel("Panel 2", "This panel has a generic plot. ", - "and a 'success' style.", plotOutput("genericPlot"), style = "success") - ) - ) + sidebarPanel( + div( + HTML("This button will open Panel 1 using updateCollapse."), + actionButton("p1Button", "Push Me!") + ), + div( + HTML("This button will toggle Panel 1 without using updateCollapse."), + actionButton( + inputId="p2Button", + "Push Me!", + class="btn btn-primary", + type="button", + "data-toggle"="collapse", + "data-target"="#panel1", + "aria-expanded"="false", + "aria-controls"="collapseExample" + ) + ), + selectInput("styleSelect", "Select style for Panel 1", + c("default", "primary", "danger", "warning", "info", "success")) + ), + mainPanel( + bsCollapse( + id = "collapseExample", + open = "Panel 2", + bsCollapsePanel("Panel 1", + id="panel1", + "This is a panel with just text ", + "and has the default style. You can change the style in ", + "the sidebar.", style = "info"), + bsCollapsePanel("Panel 2", "This panel has a generic plot. ", + "and a 'success' style.", plotOutput("genericPlot"), style = "success") + ) + ) ) ) diff --git a/man/bsCollapse.Rd b/man/bsCollapse.Rd index 8d887df..6d3b3f3 100644 --- a/man/bsCollapse.Rd +++ b/man/bsCollapse.Rd @@ -1,4 +1,4 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsCollapse.R \name{bsCollapse} \alias{bsCollapse} @@ -7,16 +7,16 @@ bsCollapse(..., id = NULL, multiple = FALSE, open = NULL) } \arguments{ -\item{id}{\bold{Optional} You can use \code{input$id} in your Server logic to +\item{\dots}{\code{\link{bsCollapsePanel}} elements to include in the Collapse.} + +\item{id}{\bold{Optional} You can use \code{input$id} in your Server logic to determine which panels are open, and \code{\link{updateCollapse}} to open/close panels.} \item{multiple}{Can more than one panel be open at a time? Defaults to \code{FALSE}.} -\item{open}{The \code{value}, (or if none was supplied, the \code{title}) of +\item{open}{The \code{value}, (or if none was supplied, the \code{title}) of the panel(s) you want open on load.} - -\item{\dots}{\code{\link{bsCollapsePanel}} elements to include in the Collapse.} } \description{ \code{bsCollapse} is used in your UI to create a collapse panel group. Use @@ -33,8 +33,9 @@ of \code{bsCollapse} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Collapses: \code{\link{Collapses}}; - \code{\link{bsCollapsePanel}}; - \code{\link{updateCollapse}} +Other Collapses: +\code{\link{Collapses}}, +\code{\link{bsCollapsePanel}()}, +\code{\link{updateCollapse}()} } - +\concept{Collapses} From b8f6ef255c7798e472438cdd1c1b113dfdcadedb Mon Sep 17 00:00:00 2001 From: Gregory R Warnes Date: Wed, 6 Jan 2021 16:21:53 -0500 Subject: [PATCH 2/7] Add `renv` to manage packages during development. --- .Rbuildignore | 2 + .Rprofile | 2 + renv.lock | 167 ++++++++++++++++++++++ renv/.gitignore | 3 + renv/activate.R | 349 ++++++++++++++++++++++++++++++++++++++++++++++ renv/settings.dcf | 6 + 6 files changed, 529 insertions(+) create mode 100644 .Rprofile create mode 100644 renv.lock create mode 100644 renv/.gitignore create mode 100644 renv/activate.R create mode 100644 renv/settings.dcf diff --git a/.Rbuildignore b/.Rbuildignore index cb1ce54..9c08439 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,3 +1,5 @@ +^renv$ +^renv\.lock$ ^.*\.Rproj$ ^\.Rproj\.user$ man-roxygen diff --git a/.Rprofile b/.Rprofile new file mode 100644 index 0000000..77fb890 --- /dev/null +++ b/.Rprofile @@ -0,0 +1,2 @@ +source("renv/activate.R") +require("devtools") diff --git a/renv.lock b/renv.lock new file mode 100644 index 0000000..e7a8393 --- /dev/null +++ b/renv.lock @@ -0,0 +1,167 @@ +{ + "R": { + "Version": "3.6.3", + "Repositories": [ + { + "Name": "CRAN", + "URL": "https://cloud.r-project.org" + } + ] + }, + "Packages": { + "BH": { + "Package": "BH", + "Version": "1.72.0-3", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "8f9ce74c6417d61f0782cbae5fd2b7b0" + }, + "R6": { + "Package": "R6", + "Version": "2.5.0", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "b203113193e70978a696b2809525649d" + }, + "Rcpp": { + "Package": "Rcpp", + "Version": "1.0.5", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "125dc7a0ed375eb68c0ce533b48d291f" + }, + "base64enc": { + "Package": "base64enc", + "Version": "0.1-3", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "543776ae6848fde2f48ff3816d0628bc" + }, + "commonmark": { + "Package": "commonmark", + "Version": "1.7", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "0f22be39ec1d141fd03683c06f3a6e67" + }, + "crayon": { + "Package": "crayon", + "Version": "1.3.4", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "0d57bc8e27b7ba9e45dba825ebc0de6b" + }, + "digest": { + "Package": "digest", + "Version": "0.6.27", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "a0cbe758a531d054b537d16dff4d58a1" + }, + "fastmap": { + "Package": "fastmap", + "Version": "1.0.1", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "83ab58a0518afe3d17e41da01af13b60" + }, + "glue": { + "Package": "glue", + "Version": "1.4.2", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "6efd734b14c6471cfe443345f3e35e29" + }, + "htmltools": { + "Package": "htmltools", + "Version": "0.5.0", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "7d651b7131794fe007b1ad6f21aaa401" + }, + "httpuv": { + "Package": "httpuv", + "Version": "1.5.4", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "4e6dabb220b006ccdc3b3b5ff993b205" + }, + "jsonlite": { + "Package": "jsonlite", + "Version": "1.7.2", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "98138e0994d41508c7a6b84a0600cfcb" + }, + "later": { + "Package": "later", + "Version": "1.1.0.1", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "d0a62b247165aabf397fded504660d8a" + }, + "magrittr": { + "Package": "magrittr", + "Version": "2.0.1", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "41287f1ac7d28a92f0a286ed507928d3" + }, + "mime": { + "Package": "mime", + "Version": "0.9", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "e87a35ec73b157552814869f45a63aa3" + }, + "promises": { + "Package": "promises", + "Version": "1.1.1", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "a8730dcbdd19f9047774909f0ec214a4" + }, + "renv": { + "Package": "renv", + "Version": "0.11.0", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "1c3ef87cbb81c23ac96797781ec7aecc" + }, + "rlang": { + "Package": "rlang", + "Version": "0.4.10", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "599df23c40a4fce9c7b4764f28c37857" + }, + "shiny": { + "Package": "shiny", + "Version": "1.5.0", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "ee4ed72d7a5047d9e73cf922ad66e9c9" + }, + "sourcetools": { + "Package": "sourcetools", + "Version": "0.1.7", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "947e4e02a79effa5d512473e10f41797" + }, + "withr": { + "Package": "withr", + "Version": "2.3.0", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "7307d79f58d1885b38c4f4f1a8cb19dd" + }, + "xtable": { + "Package": "xtable", + "Version": "1.8-4", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "b8acdf8af494d9ec19ccb2481a9b11c2" + } + } +} diff --git a/renv/.gitignore b/renv/.gitignore new file mode 100644 index 0000000..82740ba --- /dev/null +++ b/renv/.gitignore @@ -0,0 +1,3 @@ +library/ +python/ +staging/ diff --git a/renv/activate.R b/renv/activate.R new file mode 100644 index 0000000..56f9c74 --- /dev/null +++ b/renv/activate.R @@ -0,0 +1,349 @@ + +local({ + + # the requested version of renv + version <- "0.11.0" + + # the project directory + project <- getwd() + + # avoid recursion + if (!is.na(Sys.getenv("RENV_R_INITIALIZING", unset = NA))) + return(invisible(TRUE)) + + # signal that we're loading renv during R startup + Sys.setenv("RENV_R_INITIALIZING" = "true") + on.exit(Sys.unsetenv("RENV_R_INITIALIZING"), add = TRUE) + + # signal that we've consented to use renv + options(renv.consent = TRUE) + + # load the 'utils' package eagerly -- this ensures that renv shims, which + # mask 'utils' packages, will come first on the search path + library(utils, lib.loc = .Library) + + # check to see if renv has already been loaded + if ("renv" %in% loadedNamespaces()) { + + # if renv has already been loaded, and it's the requested version of renv, + # nothing to do + spec <- .getNamespaceInfo(.getNamespace("renv"), "spec") + if (identical(spec[["version"]], version)) + return(invisible(TRUE)) + + # otherwise, unload and attempt to load the correct version of renv + unloadNamespace("renv") + + } + + # load bootstrap tools + bootstrap <- function(version, library) { + + # read repos (respecting override if set) + repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA) + if (is.na(repos)) + repos <- getOption("repos") + + # fix up repos + on.exit(options(repos = repos), add = TRUE) + repos[repos == "@CRAN@"] <- "https://cloud.r-project.org" + options(repos = repos) + + # attempt to download renv + tarball <- tryCatch(renv_bootstrap_download(version), error = identity) + if (inherits(tarball, "error")) + stop("failed to download renv ", version) + + # now attempt to install + status <- tryCatch(renv_bootstrap_install(version, tarball, library), error = identity) + if (inherits(status, "error")) + stop("failed to install renv ", version) + + } + + renv_bootstrap_download_impl <- function(url, destfile) { + + mode <- "wb" + + # https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17715 + fixup <- + Sys.info()[["sysname"]] == "Windows" && + substring(url, 1L, 5L) == "file:" + + if (fixup) + mode <- "w+b" + + download.file( + url = url, + destfile = destfile, + mode = mode, + quiet = TRUE + ) + + } + + renv_bootstrap_download <- function(version) { + + methods <- list( + renv_bootstrap_download_cran_latest, + renv_bootstrap_download_cran_archive, + renv_bootstrap_download_github + ) + + for (method in methods) { + path <- tryCatch(method(version), error = identity) + if (is.character(path) && file.exists(path)) + return(path) + } + + stop("failed to download renv ", version) + + } + + renv_bootstrap_download_cran_latest <- function(version) { + + # check for renv on CRAN matching this version + db <- as.data.frame(available.packages(), stringsAsFactors = FALSE) + + entry <- db[db$Package %in% "renv" & db$Version %in% version, ] + if (nrow(entry) == 0) { + fmt <- "renv %s is not available from your declared package repositories" + stop(sprintf(fmt, version)) + } + + message("* Downloading renv ", version, " from CRAN ... ", appendLF = FALSE) + + info <- tryCatch( + download.packages("renv", destdir = tempdir()), + condition = identity + ) + + if (inherits(info, "condition")) { + message("FAILED") + return(FALSE) + } + + message("OK") + info[1, 2] + + } + + renv_bootstrap_download_cran_archive <- function(version) { + + name <- sprintf("renv_%s.tar.gz", version) + repos <- getOption("repos") + urls <- file.path(repos, "src/contrib/Archive/renv", name) + destfile <- file.path(tempdir(), name) + + message("* Downloading renv ", version, " from CRAN archive ... ", appendLF = FALSE) + + for (url in urls) { + + status <- tryCatch( + renv_bootstrap_download_impl(url, destfile), + condition = identity + ) + + if (identical(status, 0L)) { + message("OK") + return(destfile) + } + + } + + message("FAILED") + return(FALSE) + + } + + renv_bootstrap_download_github <- function(version) { + + enabled <- Sys.getenv("RENV_BOOTSTRAP_FROM_GITHUB", unset = "TRUE") + if (!identical(enabled, "TRUE")) + return(FALSE) + + # prepare download options + pat <- Sys.getenv("GITHUB_PAT") + if (nzchar(Sys.which("curl")) && nzchar(pat)) { + fmt <- "--location --fail --header \"Authorization: token %s\"" + extra <- sprintf(fmt, pat) + saved <- options("download.file.method", "download.file.extra") + options(download.file.method = "curl", download.file.extra = extra) + on.exit(do.call(base::options, saved), add = TRUE) + } else if (nzchar(Sys.which("wget")) && nzchar(pat)) { + fmt <- "--header=\"Authorization: token %s\"" + extra <- sprintf(fmt, pat) + saved <- options("download.file.method", "download.file.extra") + options(download.file.method = "wget", download.file.extra = extra) + on.exit(do.call(base::options, saved), add = TRUE) + } + + message("* Downloading renv ", version, " from GitHub ... ", appendLF = FALSE) + + url <- file.path("https://api.github.com/repos/rstudio/renv/tarball", version) + name <- sprintf("renv_%s.tar.gz", version) + destfile <- file.path(tempdir(), name) + + status <- tryCatch( + renv_bootstrap_download_impl(url, destfile), + condition = identity + ) + + if (!identical(status, 0L)) { + message("FAILED") + return(FALSE) + } + + message("Done!") + return(destfile) + + } + + renv_bootstrap_install <- function(version, tarball, library) { + + # attempt to install it into project library + message("* Installing renv ", version, " ... ", appendLF = FALSE) + dir.create(library, showWarnings = FALSE, recursive = TRUE) + + # invoke using system2 so we can capture and report output + bin <- R.home("bin") + exe <- if (Sys.info()[["sysname"]] == "Windows") "R.exe" else "R" + r <- file.path(bin, exe) + args <- c("--vanilla", "CMD", "INSTALL", "-l", shQuote(library), shQuote(tarball)) + output <- system2(r, args, stdout = TRUE, stderr = TRUE) + message("Done!") + + # check for successful install + status <- attr(output, "status") + if (is.numeric(status) && !identical(status, 0L)) { + header <- "Error installing renv:" + lines <- paste(rep.int("=", nchar(header)), collapse = "") + text <- c(header, lines, output) + writeLines(text, con = stderr()) + } + + status + + } + + renv_bootstrap_prefix <- function() { + + # construct version prefix + version <- paste(R.version$major, R.version$minor, sep = ".") + prefix <- paste("R", numeric_version(version)[1, 1:2], sep = "-") + + # include SVN revision for development versions of R + # (to avoid sharing platform-specific artefacts with released versions of R) + devel <- + identical(R.version[["status"]], "Under development (unstable)") || + identical(R.version[["nickname"]], "Unsuffered Consequences") + + if (devel) + prefix <- paste(prefix, R.version[["svn rev"]], sep = "-r") + + # build list of path components + components <- c(prefix, R.version$platform) + + # include prefix if provided by user + prefix <- Sys.getenv("RENV_PATHS_PREFIX") + if (nzchar(prefix)) + components <- c(prefix, components) + + # build prefix + paste(components, collapse = "/") + + } + + renv_bootstrap_library_root <- function(project) { + + path <- Sys.getenv("RENV_PATHS_LIBRARY", unset = NA) + if (!is.na(path)) + return(path) + + path <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT", unset = NA) + if (!is.na(path)) + return(file.path(path, basename(project))) + + file.path(project, "renv/library") + + } + + renv_bootstrap_validate_version <- function(version) { + + loadedversion <- utils::packageDescription("renv", fields = "Version") + if (version == loadedversion) + return(TRUE) + + # assume four-component versions are from GitHub; three-component + # versions are from CRAN + components <- strsplit(loadedversion, "[.-]")[[1]] + remote <- if (length(components) == 4L) + paste("rstudio/renv", loadedversion, sep = "@") + else + paste("renv", loadedversion, sep = "@") + + fmt <- paste( + "renv %1$s was loaded from project library, but renv %2$s is recorded in lockfile.", + "Use `renv::record(\"%3$s\")` to record this version in the lockfile.", + "Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library.", + sep = "\n" + ) + + msg <- sprintf(fmt, loadedversion, version, remote) + warning(msg, call. = FALSE) + + FALSE + + } + + renv_bootstrap_load <- function(project, libpath, version) { + + # try to load renv from the project library + if (!requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) + return(FALSE) + + # warn if the version of renv loaded does not match + renv_bootstrap_validate_version(version) + + # load the project + renv::load(project) + + TRUE + + } + + # construct path to library root + root <- renv_bootstrap_library_root(project) + + # construct library prefix for platform + prefix <- renv_bootstrap_prefix() + + # construct full libpath + libpath <- file.path(root, prefix) + + # attempt to load + if (renv_bootstrap_load(project, libpath, version)) + return(TRUE) + + # load failed; attempt to bootstrap + bootstrap(version, libpath) + + # exit early if we're just testing bootstrap + if (!is.na(Sys.getenv("RENV_BOOTSTRAP_INSTALL_ONLY", unset = NA))) + return(TRUE) + + # try again to load + if (requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) { + message("Successfully installed and loaded renv ", version, ".") + return(renv::load()) + } + + # failed to download or load renv; warn the user + msg <- c( + "Failed to find an renv installation: the project will not be loaded.", + "Use `renv::activate()` to re-initialize the project." + ) + + warning(paste(msg, collapse = "\n"), call. = FALSE) + +}) diff --git a/renv/settings.dcf b/renv/settings.dcf new file mode 100644 index 0000000..11a53ea --- /dev/null +++ b/renv/settings.dcf @@ -0,0 +1,6 @@ +external.libraries: +ignored.packages: +package.dependency.fields: Imports, Depends, LinkingTo +snapshot.type: implicit +use.cache: TRUE +vcs.ignore.library: TRUE From e16995d176d47f1293ddbf94f0bb2e770f6ade22 Mon Sep 17 00:00:00 2001 From: Gregory R Warnes Date: Wed, 6 Jan 2021 17:49:23 -0500 Subject: [PATCH 3/7] Add `bsCollapseButton` and `bsCollapseLink` functions. --- DESCRIPTION | 3 +- NAMESPACE | 6 +++- R/bsCollapseButton.R | 44 ++++++++++++++++++++++++++ R/bsCollapsePanel.R | 2 +- man/Alerts.Rd | 40 +++++++++++++----------- man/Buttons.Rd | 42 +++++++++++++------------ man/Collapses.Rd | 36 ++++++++++++---------- man/Modals.Rd | 42 +++++++++++++------------ man/Tooltips_and_Popovers.Rd | 59 +++++++++++++++++++---------------- man/addPopover.Rd | 31 +++++++++++++------ man/addTooltip.Rd | 30 ++++++++++++------ man/bsAlert.Rd | 12 +++++--- man/bsButton.Rd | 31 ++++++++++++------- man/bsCollapse.Rd | 1 + man/bsCollapseButton.Rd | 60 ++++++++++++++++++++++++++++++++++++ man/bsCollapsePanel.Rd | 19 +++++++----- man/bsExample.Rd | 7 ++--- man/bsModal.Rd | 28 +++++++++++++---- man/bsPopover.Rd | 30 ++++++++++++------ man/bsTooltip.Rd | 23 ++++++++------ man/bsTypeahead.Rd | 3 +- man/closeAlert.Rd | 12 +++++--- man/createAlert.Rd | 22 +++++++++---- man/popify.Rd | 30 ++++++++++++------ man/removePopover.Rd | 18 ++++++----- man/removeTooltip.Rd | 18 ++++++----- man/tipify.Rd | 20 +++++++----- man/toggleModal.Rd | 8 +++-- man/updateButton.Rd | 32 +++++++++++++------ man/updateCollapse.Rd | 17 +++++----- man/updateTypeahead.Rd | 6 ++-- 31 files changed, 486 insertions(+), 246 deletions(-) create mode 100644 R/bsCollapseButton.R create mode 100644 man/bsCollapseButton.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 5d8df8a..402e431 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,4 +11,5 @@ Imports: htmltools URL: https://ebailey78.github.io/shinyBS BugReports: https://github.com/ebailey78/shinyBS/issues -License: GPL-3 \ No newline at end of file +License: GPL-3 +RoxygenNote: 7.1.1 diff --git a/NAMESPACE b/NAMESPACE index f3c7843..01a42c7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,10 +1,12 @@ -# Generated by roxygen2 (4.1.0): do not edit by hand +# Generated by roxygen2: do not edit by hand export(addPopover) export(addTooltip) export(bsAlert) export(bsButton) export(bsCollapse) +export(bsCollapseButton) +export(bsCollapseLink) export(bsCollapsePanel) export(bsExample) export(bsModal) @@ -21,3 +23,5 @@ export(toggleModal) export(updateButton) export(updateCollapse) export(updateTypeahead) +importFrom(shiny,actionButton) +importFrom(shiny,actionLink) diff --git a/R/bsCollapseButton.R b/R/bsCollapseButton.R new file mode 100644 index 0000000..d0ebf42 --- /dev/null +++ b/R/bsCollapseButton.R @@ -0,0 +1,44 @@ +#' Create a button or link that toggles the state of a +#' \code{\link{bsCollapsePanel}}. +#' +#' @inheritParams shiny::actionButton +#' +#' @templateVar item_name bsCollapseButton +#' @templateVar family_name Collapses +#' @template item_details +#' @template footer +#' +#' @param target value HTML id of object to be toggled +#' +#' @importFrom shiny actionButton +#' @importFrom shiny actionLink +#' +NULL + +#' +#' @describeIn bsCollapseButton Create an \code{\link[shiny]{actionLink}} +#' that will toggle the collapsed state of a +#' \code{\link{bsCollapsePanel}} when clicked. +#' @export +bsCollapseButton <- function(inputId, label, target, icon=NULL, width=NULL, ...) +{ + actionButton(inputID=inputId, + label=label, + "data-toggle"="collapse", + "data-target"=paste0("#", target) + ) +} + +#' @describeIn bsCollapseButton Create an \code{\link[shiny]{actionLink}} +#' that will toggle the collapsed state of a +#' \code{\link{bsCollapsePanel}} when clicked. +#' @export +bsCollapseLink <- function(inputId, label, target, icon=NULL, width=NULL, ...) +{ + actionLink(inputID=inputId, + label=label, + "data-toggle"="collapse", + "data-target"=paste0("#", target) + ) +} + diff --git a/R/bsCollapsePanel.R b/R/bsCollapsePanel.R index 45ffc4e..05a77b0 100644 --- a/R/bsCollapsePanel.R +++ b/R/bsCollapsePanel.R @@ -4,7 +4,7 @@ #' #'@param title The title to display at the top of the panel. #'@param \dots UI elements to include within the panel. -#'@param value \bold{Optional} HTML id. Auto-generated if missing. +#'@param id \bold{Optional} HTML id. Auto-generated if missing. #'@param value \bold{Optional} The value to return when this panel is open. Defaults to \code{title}. #'@param style \bold{Optional} A Bootstrap style to apply to the panel. (\code{primary}, \code{danger}, \code{warning}, \code{info}, or \code{success}) #' diff --git a/man/Alerts.Rd b/man/Alerts.Rd index 9c6c1be..a3a6a8e 100644 --- a/man/Alerts.Rd +++ b/man/Alerts.Rd @@ -1,4 +1,4 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/Alerts.R \name{Alerts} \alias{Alerts} @@ -11,13 +11,13 @@ contained in the Alert. \details{ To create alerts in your Shiny app you must place \code{bsAlert} in your ui. This serves as an anchor that tells shinyBS where to place the alerts created -with \code{createAlert}. +with \code{createAlert}. -Use \code{createAlert} in your server script to add alerts to the anchor +Use \code{createAlert} in your server script to add alerts to the anchor you created with \code{bsAlert} in your ui. You can place \code{createAlert} in observers, reactives, or outputs. A common usage may be to have logic that validates a user's inputs. If they are valid produce the requested output, if -not use \code{createAlert} to give the user info about what they need to +not use \code{createAlert} to give the user info about what they need to change. } \note{ @@ -26,12 +26,12 @@ of \code{Alerts} functionality. } \section{Components}{ -There are three functions in the Alerts family: +There are three functions in the Alerts family: \describe{ \item{\code{\link{bsAlert}}}{Used in the UI to create an anchor where your Alerts will be displayed.} \item{\code{\link{createAlert}}}{Used in the Server logic to create - alerts. This would be used within a reactive context to display error + alerts. This would be used within a reactive context to display error or success messages to the user based on the status of that context.} \item{\code{\link{closeAlert}}}{Used in the Server logic to close an alert that is already open. By default, Alerts are dismissable by the user, @@ -47,39 +47,41 @@ There are three functions in the Alerts family: \code{content} was called \code{message} in previous versions of shinyBS. } + \examples{ + library(shiny) library(shinyBS) app = shinyApp( - ui = + ui = fluidPage( sidebarLayout( - sidebarPanel(textInput("num1", NULL, value = 100), - "divided by", textInput("num2", NULL, value = 20), + sidebarPanel(textInput("num1", NULL, value = 100), + "divided by", textInput("num2", NULL, value = 20), "equals", textOutput("exampleOutput")), mainPanel( bsAlert("alert") ) ) ), - server = + server = function(input, output, session) { output$exampleOutput <- renderText({ num1 <- as.numeric(input$num1) num2 <- as.numeric(input$num2) - + if(is.na(num1) | is.na(num2)) { - createAlert(session, "alert", "exampleAlert", title = "Oops", + createAlert(session, "alert", "exampleAlert", title = "Oops", content = "Both inputs should be numeric.", append = FALSE) } else if(num2 == 0) { - createAlert(session, "alert", "exampleAlert", title = "Oops", + createAlert(session, "alert", "exampleAlert", title = "Oops", content = "You cannot divide by 0.", append = FALSE) } else { closeAlert(session, "exampleAlert") return(num1/num2) } - - }) + + }) } ) @@ -90,7 +92,9 @@ app = shinyApp( \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Alerts: \code{\link{bsAlert}}; - \code{\link{closeAlert}}; \code{\link{createAlert}} +Other Alerts: +\code{\link{bsAlert}()}, +\code{\link{closeAlert}()}, +\code{\link{createAlert}()} } - +\concept{Alerts} diff --git a/man/Buttons.Rd b/man/Buttons.Rd index d1c773a..7de5be2 100644 --- a/man/Buttons.Rd +++ b/man/Buttons.Rd @@ -1,10 +1,10 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/Buttons.R \name{Buttons} \alias{Buttons} \title{Buttons} \description{ -Twitter Bootstrap gives many options for styling buttons that aren't made +Twitter Bootstrap gives many options for styling buttons that aren't made available by standard Shiny. Use shinyBS to create buttons of different sizes, shapes, and colors. } @@ -15,7 +15,7 @@ If \code{type = "toggle"} the button will behave like a \code{\link{checkboxInpu with an on and off state. It will return \code{TRUE} or \code{FALSE} to the Server depending on its state. -You can update the style and state of a \code{\link{bsButton}} from the Server +You can update the style and state of a \code{\link{bsButton}} from the Server logic with \code{\link{updateButton}}. For example, a button could be set to \code{disabled = TRUE} until the user has made some other selections, then once those selections have been made, an observer on the Server could use \code{\link{updateButton}} @@ -29,9 +29,9 @@ of \code{Buttons} functionality. } \section{Components}{ -There are two functions in the Buttons family: +There are two functions in the Buttons family: \describe{ - \item{\code{\link{bsButton}}}{Used in the UI to create a button. Buttons + \item{\code{\link{bsButton}}}{Used in the UI to create a button. Buttons can be of the type \code{action} or \code{toggle}.} \item{\code{\link{updateButton}}}{Used in the Server logic to modify the state of a button created with \code{\link{bsButton}}} @@ -40,16 +40,17 @@ There are two functions in the Buttons family: \section{Changes}{ -\code{bsActionButton} and \code{bsToggleButton} were replaced with just +\code{bsActionButton} and \code{bsToggleButton} were replaced with just \code{\link{bsButton}} with a \code{type} argument. \code{icon} was added to allow placing an icon in the button. } + \examples{ library(shiny) library(shinyBS) app = shinyApp( - ui = + ui = fluidPage( sidebarLayout( sidebarPanel( @@ -60,35 +61,35 @@ app = shinyApp( value = 1), bsButton("actTwo", label = "Click me if you dare!", icon = icon("ban")), tags$p("Clicking the first button below changes the disabled state of the second button."), - bsButton("togOne", label = "Toggle button disabled status", + bsButton("togOne", label = "Toggle button disabled status", block = TRUE, type = "toggle", value = TRUE), bsButton("actOne", label = "Block Action Button", block = TRUE) - + ), mainPanel( textOutput("exampleText") ) - ) + ) ), - server = + server = function(input, output, session) { observeEvent(input$togOne, ({ updateButton(session, "actOne", disabled = !input$togOne) })) observeEvent(input$bins, ({ - + b <- input$bins disabled = NULL style = "default" icon = "" - + if(b < 5) { disabled = TRUE icon <- icon("ban") } else { disabled = FALSE } - + if(b < 15 | b > 35) { style = "danger" } else if(b < 20 | b > 30) { @@ -97,11 +98,11 @@ app = shinyApp( style = "default" icon = icon("check") } - + updateButton(session, "actTwo", disabled = disabled, style = style, icon = icon) - + })) - + output$exampleText <- renderText({ input$actTwo b <- isolate(input$bins) @@ -124,7 +125,8 @@ app = shinyApp( \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Buttons: \code{\link{bsButton}}; - \code{\link{updateButton}} +Other Buttons: +\code{\link{bsButton}()}, +\code{\link{updateButton}()} } - +\concept{Buttons} diff --git a/man/Collapses.Rd b/man/Collapses.Rd index c348f66..f99e14b 100644 --- a/man/Collapses.Rd +++ b/man/Collapses.Rd @@ -1,23 +1,23 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/Collapses.R \name{Collapses} \alias{Collapses} \title{Collapses} \description{ -Collapse panels allow you to reduce clutter in your Shiny app by making +Collapse panels allow you to reduce clutter in your Shiny app by making panels of information that open and close with a user's click. Any type of content can go in a collapse panel. Standard Bootstrap styling options are available. } \details{ -Collapses are designed to mimic \code{\link{tabsetPanel}} in their implementation. +Collapses are designed to mimic \code{\link{tabsetPanel}} in their implementation. Start with \code{bsCollapse} to create a panel group, then fill it with panels -using \code{bsCollapsePanel}. +using \code{bsCollapsePanel}. -\code{bsCollapse} acts as an input, so you can retrieve which panels are open -from the input object passed to the function in \code{\link{shinyServer}}. +\code{bsCollapse} acts as an input, so you can retrieve which panels are open +from the input object passed to the function in \code{\link{shinyServer}}. -\code{updateCollapse} can be used within your server logic to open/close +\code{updateCollapse} can be used within your server logic to open/close collapse panels or to change their style. } \note{ @@ -35,20 +35,21 @@ of \code{Collapses} functionality. \section{Changes}{ -\code{style} is a new option that wasn't available in previous versions of +\code{style} is a new option that wasn't available in previous versions of shinyBS. } + \examples{ library(shiny) library(shinyBS) app = shinyApp( - ui = + ui = fluidPage( sidebarLayout( - sidebarPanel(HTML("This button will open Panel 1 using updateCollapse."), + sidebarPanel(HTML("This button will open Panel 1 using updateCollapse."), actionButton("p1Button", "Push Me!"), - selectInput("styleSelect", "Select style for Panel 1", + selectInput("styleSelect", "Select style for Panel 1", c("default", "primary", "danger", "warning", "info", "success")) ), mainPanel( @@ -62,9 +63,9 @@ app = shinyApp( ) ) ), - server = + server = function(input, output, session) { - output$genericPlot <- renderPlot(plot(rnorm(100))) + output$genericPlot <- renderPlot(plot(rnorm(100))) observeEvent(input$p1Button, ({ updateCollapse(session, "collapseExample", open = "Panel 1") })) @@ -80,7 +81,10 @@ app = shinyApp( \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Collapses: \code{\link{bsCollapsePanel}}; - \code{\link{bsCollapse}}; \code{\link{updateCollapse}} +Other Collapses: +\code{\link{bsCollapseButton}()}, +\code{\link{bsCollapsePanel}()}, +\code{\link{bsCollapse}()}, +\code{\link{updateCollapse}()} } - +\concept{Collapses} diff --git a/man/Modals.Rd b/man/Modals.Rd index bcdda74..674cf6f 100644 --- a/man/Modals.Rd +++ b/man/Modals.Rd @@ -1,4 +1,4 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/Modals.R \name{Modals} \alias{Modals} @@ -11,7 +11,7 @@ cluttering up the main app display or help pages to explain your apps operation. } \details{ -Use \code{\link{bsModal}} in your UI to create a modal window. It works +Use \code{\link{bsModal}} in your UI to create a modal window. It works like \code{\link{Collapses}} or \code{\link{tabPanel}}, any non-named arguments will be passed as content for the modal. @@ -24,7 +24,7 @@ of \code{Modals} functionality. } \section{Components}{ -There are only two functions in the Modals family: +There are only two functions in the Modals family: \describe{ \item{\code{\link{bsModal}}}{Used in the UI to create a modal window.} \item{\code{\link{toggleModal}}}{Used in the Server logic to open or @@ -37,15 +37,16 @@ There are only two functions in the Modals family: There is now a \code{toggle} argument in \code{\link{toggleModal}} that allows you to specify whether you want the modal to open or close. -The \code{size} argument in \code{\link{bsModal}} allows you to specify the +The \code{size} argument in \code{\link{bsModal}} allows you to specify the size of the modal window. Either \code{small} or \code{large}. } + \examples{ library(shiny) library(shinyBS) app = shinyApp( - ui = + ui = fluidPage( sidebarLayout( sidebarPanel( @@ -56,32 +57,32 @@ app = shinyApp( value = 30), actionButton("tabBut", "View Table") ), - + mainPanel( plotOutput("distPlot"), - bsModal("modalExample", "Data Table", "tabBut", size = "large", + bsModal("modalExample", "Data Table", "tabBut", size = "large", dataTableOutput("distTable")) ) ) ), - server = + server = function(input, output, session) { - + output$distPlot <- renderPlot({ - + x <- faithful[, 2] bins <- seq(min(x), max(x), length.out = input$bins + 1) - + # draw the histogram with the specified number of bins hist(x, breaks = bins, col = 'darkgray', border = 'white') - + }) - + output$distTable <- renderDataTable({ - + x <- faithful[, 2] bins <- seq(min(x), max(x), length.out = input$bins + 1) - + # draw the histogram with the specified number of bins tab <- hist(x, breaks = bins, plot = FALSE) tab$breaks <- sapply(seq(length(tab$breaks) - 1), function(i) { @@ -90,9 +91,9 @@ app = shinyApp( tab <- as.data.frame(do.call(cbind, tab)) colnames(tab) <- c("Bins", "Counts", "Density") return(tab[, 1:3]) - + }, options = list(pageLength=10)) - + } ) \dontrun{ @@ -102,7 +103,8 @@ app = shinyApp( \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Modals: \code{\link{bsModal}}; - \code{\link{toggleModal}} +Other Modals: +\code{\link{bsModal}()}, +\code{\link{toggleModal}()} } - +\concept{Modals} diff --git a/man/Tooltips_and_Popovers.Rd b/man/Tooltips_and_Popovers.Rd index 1520004..7da1f72 100644 --- a/man/Tooltips_and_Popovers.Rd +++ b/man/Tooltips_and_Popovers.Rd @@ -1,11 +1,11 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/Tooltips_and_Popovers.R \name{Tooltips_and_Popovers} \alias{Tooltips_and_Popovers} \title{Tooltips and Popovers} \description{ Tooltips and Popovers allow you to add additional information about controls -or outputs without cluttering up your user interface. You can add a tooltip to +or outputs without cluttering up your user interface. You can add a tooltip to a button that displays on hover and better explains what the button will do, or you could add a popover to an output providing further analysis of that output. } @@ -13,7 +13,7 @@ you could add a popover to an output providing further analysis of that output. You can create tooltips and popovers from either the UI script or within the Server logic. \code{\link{bsTooltip}} and \code{\link{bsPopover}} are used in the UI, and \code{\link{addTooltip}} and \code{\link{addPopover}} are used in -the Server logic. \code{\link{tipify}} and \code{\link{popify}} can be used +the Server logic. \code{\link{tipify}} and \code{\link{popify}} can be used within the UI or from within a \code{\link{renderUI}} in the Server logic. They also have the added advantage of not requiring that the UI element have an ID attribute. @@ -26,7 +26,7 @@ app in order for the necessary dependencies to be loaded. Because of this, \code{\link{addTooltip}} and \code{\link{addPopover}} will not work if they are the only shinyBS components in your app. -Tooltips and popovers may not work on some of the more complex shiny inputs +Tooltips and popovers may not work on some of the more complex shiny inputs or outputs. If you encounter a problem with tooltips or popovers not appearing please file a issue on the github page so I can fix it. @@ -35,25 +35,25 @@ of \code{Tooltips_and_Popovers} functionality. } \section{Components}{ -There are eight functions in the Tooltips and Popovers family: +There are eight functions in the Tooltips and Popovers family: \describe{ \item{\code{\link{bsTooltip}}}{Used in the UI to add a tooltip to an element in your UI.} \item{\code{\link{bsPopover}}}{Used in the UI to add a popover to an element in your UI.} \item{\code{\link{tipify}}}{Wrap any UI element in \code{tipify} to add a - tooltip to the wrapped element. Preferred for elemented created with + tooltip to the wrapped element. Preferred for elemented created with \code{\link{renderUI}}.} \item{\code{\link{popify}}}{Wrap any UI element in \code{popify} to add a - popover to the wrapped element. Preferred for elements created with + popover to the wrapped element. Preferred for elements created with \code{\link{renderUI}}.} - \item{\code{\link{addTooltip}}}{Used in the Server logic to add a tooltip + \item{\code{\link{addTooltip}}}{Used in the Server logic to add a tooltip to an element in your UI.} - \item{\code{\link{addPopover}}}{Used in the Server logic to add a popover + \item{\code{\link{addPopover}}}{Used in the Server logic to add a popover to an element in your UI.} - \item{\code{\link{removeTooltip}}}{Used in the Server logic to remove a + \item{\code{\link{removeTooltip}}}{Used in the Server logic to remove a tooltip from an element in your UI.} - \item{\code{\link{removePopover}}}{Used in the Server logic to remove a + \item{\code{\link{removePopover}}}{Used in the Server logic to remove a popover from an element in your UI.} } } @@ -65,12 +65,13 @@ advanced users more control over how the tooltips and popovers appear. See the \href{http://getbootstrap.com}{Twitter Bootstrap 3 documentation} for more details. } + \examples{ library(shiny) library(shinyBS) app = shinyApp( - ui = + ui = fluidPage( sidebarLayout( sidebarPanel( @@ -79,31 +80,31 @@ app = shinyApp( min = 1, max = 50, value = 30), - bsTooltip("bins", "The wait times will be broken into this many equally spaced bins", + bsTooltip("bins", "The wait times will be broken into this many equally spaced bins", "right", options = list(container = "body")) ), mainPanel( plotOutput("distPlot"), - uiOutput("uiExample") + uiOutput("uiExample") ) - ) + ) ), - server = + server = function(input, output, session) { output$distPlot <- renderPlot({ - + # generate bins based on input$bins from ui.R x <- faithful[, 2] bins <- seq(min(x), max(x), length.out = input$bins + 1) - + # draw the histogram with the specified number of bins hist(x, breaks = bins, col = 'darkgray', border = 'white') - + }) output$uiExample <- renderUI({ tags$span( - popify(bsButton("pointlessButton", "Button", style = "primary", size = "large"), - "A Pointless Button", + popify(bsButton("pointlessButton", "Button", style = "primary", size = "large"), + "A Pointless Button", "This button is pointless. It does not do anything!"), tipify(bsButton("pB2", "Button", style = "inverse", size = "extra-small"), "This button is pointless too!") @@ -123,10 +124,14 @@ app = shinyApp( \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Tooltips_and_Popovers: \code{\link{addPopover}}; - \code{\link{addTooltip}}; \code{\link{bsPopover}}; - \code{\link{bsTooltip}}; \code{\link{popify}}; - \code{\link{removePopover}}; \code{\link{removeTooltip}}; - \code{\link{tipify}} +Other Tooltips_and_Popovers: +\code{\link{addPopover}()}, +\code{\link{addTooltip}()}, +\code{\link{bsPopover}()}, +\code{\link{bsTooltip}()}, +\code{\link{popify}()}, +\code{\link{removePopover}()}, +\code{\link{removeTooltip}()}, +\code{\link{tipify}()} } - +\concept{Tooltips_and_Popovers} diff --git a/man/addPopover.Rd b/man/addPopover.Rd index 36b3c6d..f3577e5 100644 --- a/man/addPopover.Rd +++ b/man/addPopover.Rd @@ -1,11 +1,18 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/addPopover.R \name{addPopover} \alias{addPopover} \title{addPopover} \usage{ -addPopover(session, id, title, content, placement = "bottom", - trigger = "hover", options = NULL) +addPopover( + session, + id, + title, + content, + placement = "bottom", + trigger = "hover", + options = NULL +) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} @@ -16,7 +23,7 @@ addPopover(session, id, title, content, placement = "bottom", \item{content}{The main content of the popover.} -\item{placement}{Where the popover should appear relative to its target +\item{placement}{Where the popover should appear relative to its target (\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{bottom}.} \item{trigger}{What action should cause the popover to appear? (\code{hover}, @@ -39,10 +46,14 @@ of \code{addPopover} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Tooltips_and_Popovers: \code{\link{Tooltips_and_Popovers}}; - \code{\link{addTooltip}}; \code{\link{bsPopover}}; - \code{\link{bsTooltip}}; \code{\link{popify}}; - \code{\link{removePopover}}; \code{\link{removeTooltip}}; - \code{\link{tipify}} +Other Tooltips_and_Popovers: +\code{\link{Tooltips_and_Popovers}}, +\code{\link{addTooltip}()}, +\code{\link{bsPopover}()}, +\code{\link{bsTooltip}()}, +\code{\link{popify}()}, +\code{\link{removePopover}()}, +\code{\link{removeTooltip}()}, +\code{\link{tipify}()} } - +\concept{Tooltips_and_Popovers} diff --git a/man/addTooltip.Rd b/man/addTooltip.Rd index 7049d87..ae146a9 100644 --- a/man/addTooltip.Rd +++ b/man/addTooltip.Rd @@ -1,11 +1,17 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/addTooltip.R \name{addTooltip} \alias{addTooltip} \title{addTooltip} \usage{ -addTooltip(session, id, title, placement = "bottom", trigger = "hover", - options = NULL) +addTooltip( + session, + id, + title, + placement = "bottom", + trigger = "hover", + options = NULL +) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} @@ -14,7 +20,7 @@ addTooltip(session, id, title, placement = "bottom", trigger = "hover", \item{title}{The content of the tooltip.} -\item{placement}{Where the tooltip should appear relative to its target +\item{placement}{Where the tooltip should appear relative to its target (\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}.} \item{trigger}{What action should cause the tooltip to appear? (\code{hover}, @@ -37,10 +43,14 @@ of \code{addTooltip} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Tooltips_and_Popovers: \code{\link{Tooltips_and_Popovers}}; - \code{\link{addPopover}}; \code{\link{bsPopover}}; - \code{\link{bsTooltip}}; \code{\link{popify}}; - \code{\link{removePopover}}; \code{\link{removeTooltip}}; - \code{\link{tipify}} +Other Tooltips_and_Popovers: +\code{\link{Tooltips_and_Popovers}}, +\code{\link{addPopover}()}, +\code{\link{bsPopover}()}, +\code{\link{bsTooltip}()}, +\code{\link{popify}()}, +\code{\link{removePopover}()}, +\code{\link{removeTooltip}()}, +\code{\link{tipify}()} } - +\concept{Tooltips_and_Popovers} diff --git a/man/bsAlert.Rd b/man/bsAlert.Rd index 351fe5e..1f6fa5f 100644 --- a/man/bsAlert.Rd +++ b/man/bsAlert.Rd @@ -1,10 +1,10 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsAlert.R \name{bsAlert} \alias{bsAlert} \title{bsAlert} \usage{ -bsAlert(anchorId) +bsAlert(anchorId, inline = TRUE) } \arguments{ \item{anchorId}{A unique id the identifies the anchor.} @@ -24,7 +24,9 @@ of \code{bsAlert} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Alerts: \code{\link{Alerts}}; - \code{\link{closeAlert}}; \code{\link{createAlert}} +Other Alerts: +\code{\link{Alerts}}, +\code{\link{closeAlert}()}, +\code{\link{createAlert}()} } - +\concept{Alerts} diff --git a/man/bsButton.Rd b/man/bsButton.Rd index 517fcf9..b9147c2 100644 --- a/man/bsButton.Rd +++ b/man/bsButton.Rd @@ -1,28 +1,36 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsButton.R \name{bsButton} \alias{bsButton} \title{bsButton} \usage{ -bsButton(inputId, label, icon = NULL, ..., style = "default", - size = "default", type = "action", block = FALSE, disabled = FALSE, - value = FALSE) +bsButton( + inputId, + label, + icon = NULL, + ..., + style = "default", + size = "default", + type = "action", + block = FALSE, + disabled = FALSE, + value = FALSE +) } \arguments{ -\item{inputId}{Specifies the input slot that will be used to access the -value.} +\item{inputId}{The \code{input} slot that will be used to access the value.} \item{label}{The contents of the button or link--usually a text label, but you could also use any other HTML, like an image.} -\item{icon}{An optional \code{\link{icon}} to appear on the button.} +\item{icon}{An optional \code{\link[shiny:icon]{icon()}} to appear on the button.} \item{...}{Named attributes to be applied to the button or link.} \item{style}{A Bootstrap style to apply to the button. (\code{default}, \code{primary}, \code{success}, \code{info}, \code{warning}, or \code{danger})} -\item{size}{The size of the button (\code{extra-small}, \code{small}, +\item{size}{The size of the button (\code{extra-small}, \code{small}, \code{default}, or \code{large})} \item{type}{The type of button to create. (\code{action} or \code{toggle})} @@ -48,7 +56,8 @@ of \code{bsButton} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Buttons: \code{\link{Buttons}}; - \code{\link{updateButton}} +Other Buttons: +\code{\link{Buttons}}, +\code{\link{updateButton}()} } - +\concept{Buttons} diff --git a/man/bsCollapse.Rd b/man/bsCollapse.Rd index 6d3b3f3..082f2ad 100644 --- a/man/bsCollapse.Rd +++ b/man/bsCollapse.Rd @@ -35,6 +35,7 @@ of \code{bsCollapse} functionality. Other Collapses: \code{\link{Collapses}}, +\code{\link{bsCollapseButton}()}, \code{\link{bsCollapsePanel}()}, \code{\link{updateCollapse}()} } diff --git a/man/bsCollapseButton.Rd b/man/bsCollapseButton.Rd new file mode 100644 index 0000000..f14d160 --- /dev/null +++ b/man/bsCollapseButton.Rd @@ -0,0 +1,60 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/bsCollapseButton.R +\name{bsCollapseButton} +\alias{bsCollapseButton} +\alias{bsCollapseLink} +\title{Create a button or link that toggles the state of a +\code{\link{bsCollapsePanel}}.} +\usage{ +bsCollapseButton(inputId, label, target, icon = NULL, width = NULL, ...) + +bsCollapseLink(inputId, label, target, icon = NULL, width = NULL, ...) +} +\arguments{ +\item{inputId}{The \code{input} slot that will be used to access the value.} + +\item{label}{The contents of the button or link--usually a text label, but +you could also use any other HTML, like an image.} + +\item{target}{value HTML id of object to be toggled} + +\item{icon}{An optional \code{\link[shiny:icon]{icon()}} to appear on the button.} + +\item{width}{The width of the input, e.g. \code{'400px'}, or \code{'100\%'}; +see \code{\link[shiny:reexports]{validateCssUnit()}}.} + +\item{...}{Named attributes to be applied to the button or link.} +} +\description{ +Create a button or link that toggles the state of a +\code{\link{bsCollapsePanel}}. +} +\details{ +See \link{Collapses} for more information about how to use \code{bsCollapseButton} with the +rest of the Collapses family. +} +\section{Functions}{ +\itemize{ +\item \code{bsCollapseButton}: Create an \code{\link[shiny]{actionLink}} +that will toggle the collapsed state of a +\code{\link{bsCollapsePanel}} when clicked. + +\item \code{bsCollapseLink}: Create an \code{\link[shiny]{actionLink}} +that will toggle the collapsed state of a +\code{\link{bsCollapsePanel}} when clicked. +}} + +\note{ +Run \code{bsExample("Collapses")} for an example +of \code{bsCollapseButton} functionality. +} +\seealso{ +\href{http://getbootstrap.com}{Twitter Bootstrap 3} + +Other Collapses: +\code{\link{Collapses}}, +\code{\link{bsCollapsePanel}()}, +\code{\link{bsCollapse}()}, +\code{\link{updateCollapse}()} +} +\concept{Collapses} diff --git a/man/bsCollapsePanel.Rd b/man/bsCollapsePanel.Rd index 2f1d410..404e346 100644 --- a/man/bsCollapsePanel.Rd +++ b/man/bsCollapsePanel.Rd @@ -1,19 +1,21 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsCollapsePanel.R \name{bsCollapsePanel} \alias{bsCollapsePanel} \title{bsCollapsePanel} \usage{ -bsCollapsePanel(title, ..., value = title, style = NULL) +bsCollapsePanel(title, ..., id, value = title, style = NULL) } \arguments{ \item{title}{The title to display at the top of the panel.} +\item{\dots}{UI elements to include within the panel.} + +\item{id}{\bold{Optional} HTML id. Auto-generated if missing.} + \item{value}{\bold{Optional} The value to return when this panel is open. Defaults to \code{title}.} \item{style}{\bold{Optional} A Bootstrap style to apply to the panel. (\code{primary}, \code{danger}, \code{warning}, \code{info}, or \code{success})} - -\item{\dots}{UI elements to include within the panel.} } \description{ \code{bsCollapsePanel} creates individual panels within a \code{\link{bsCollapse}} object. @@ -29,7 +31,10 @@ of \code{bsCollapsePanel} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Collapses: \code{\link{Collapses}}; - \code{\link{bsCollapse}}; \code{\link{updateCollapse}} +Other Collapses: +\code{\link{Collapses}}, +\code{\link{bsCollapseButton}()}, +\code{\link{bsCollapse}()}, +\code{\link{updateCollapse}()} } - +\concept{Collapses} diff --git a/man/bsExample.Rd b/man/bsExample.Rd index 624b627..4069c05 100644 --- a/man/bsExample.Rd +++ b/man/bsExample.Rd @@ -1,4 +1,4 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsExample.R \name{bsExample} \alias{bsExample} @@ -16,17 +16,16 @@ bsExample(family, display.mode = "showcase", ...) } \description{ A function to view examples of shinyBS functionality. Will run the examples -found in the examples sections of shinyBS documentation. Use this instead of +found in the examples sections of shinyBS documentation. Use this instead of \code{example}. } \details{ This function is just a wrapper for \code{\link{runApp}} that runs copies of the examples found in the family documention pages of \code{shinyBS}. By default, -\code{display.mode} is set to \code{showcase} so you can see the code while +\code{display.mode} is set to \code{showcase} so you can see the code while the app is running. } \examples{ \dontrun{ bsExample("Alerts")} } - diff --git a/man/bsModal.Rd b/man/bsModal.Rd index 0ae2e2f..38c99e8 100644 --- a/man/bsModal.Rd +++ b/man/bsModal.Rd @@ -1,10 +1,19 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsModal.R \name{bsModal} \alias{bsModal} \title{bsModal} \usage{ -bsModal(id, title, trigger, ..., size) +bsModal( + id, + title, + trigger, + ..., + size, + footer = NULL, + close.button = TRUE, + width = NULL +) } \arguments{ \item{id}{A unique identifier for the modal window} @@ -13,9 +22,15 @@ bsModal(id, title, trigger, ..., size) \item{trigger}{The id of a button or link that will open the modal.} +\item{\dots}{UI elements to include within the modal} + \item{size}{\bold{Optional} What size should the modal be? (\code{small} or \code{large})} -\item{\dots}{UI elements to include within the modal} +\item{footer}{A \code{list} of shiny UI elements to be added to the footer of the modal.} + +\item{close.button}{Should a close button be added to the footer of the modal?} + +\item{width}{An optional width argument for the modal. Must include units. Only applied if \code{size} is missing.} } \description{ \code{bsModal} is used within the UI to create a modal window. @@ -31,7 +46,8 @@ of \code{bsModal} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Modals: \code{\link{Modals}}; - \code{\link{toggleModal}} +Other Modals: +\code{\link{Modals}}, +\code{\link{toggleModal}()} } - +\concept{Modals} diff --git a/man/bsPopover.Rd b/man/bsPopover.Rd index 3cdc3af..ccc6a0f 100644 --- a/man/bsPopover.Rd +++ b/man/bsPopover.Rd @@ -1,11 +1,17 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsPopover.R \name{bsPopover} \alias{bsPopover} \title{bsPopover} \usage{ -bsPopover(id, title, content, placement = "bottom", trigger = "hover", - options = NULL) +bsPopover( + id, + title, + content, + placement = "bottom", + trigger = "hover", + options = NULL +) } \arguments{ \item{id}{The id of the element to attach the popover to.} @@ -14,7 +20,7 @@ bsPopover(id, title, content, placement = "bottom", trigger = "hover", \item{content}{The main content of the popover.} -\item{placement}{Where the popover should appear relative to its target +\item{placement}{Where the popover should appear relative to its target (\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}.} \item{trigger}{What action should cause the popover to appear? (\code{hover}, @@ -37,10 +43,14 @@ of \code{bsPopover} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Tooltips_and_Popovers: \code{\link{Tooltips_and_Popovers}}; - \code{\link{addPopover}}; \code{\link{addTooltip}}; - \code{\link{bsTooltip}}; \code{\link{popify}}; - \code{\link{removePopover}}; \code{\link{removeTooltip}}; - \code{\link{tipify}} +Other Tooltips_and_Popovers: +\code{\link{Tooltips_and_Popovers}}, +\code{\link{addPopover}()}, +\code{\link{addTooltip}()}, +\code{\link{bsTooltip}()}, +\code{\link{popify}()}, +\code{\link{removePopover}()}, +\code{\link{removeTooltip}()}, +\code{\link{tipify}()} } - +\concept{Tooltips_and_Popovers} diff --git a/man/bsTooltip.Rd b/man/bsTooltip.Rd index 1494de7..6a72e5a 100644 --- a/man/bsTooltip.Rd +++ b/man/bsTooltip.Rd @@ -1,18 +1,17 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsTooltip.R \name{bsTooltip} \alias{bsTooltip} \title{bsTooltip} \usage{ -bsTooltip(id, title, placement = "bottom", trigger = "hover", - options = NULL) +bsTooltip(id, title, placement = "bottom", trigger = "hover", options = NULL) } \arguments{ \item{id}{The id of the element to attach the tooltip to.} \item{title}{The content of the tooltip.} -\item{placement}{Where the tooltip should appear relative to its target +\item{placement}{Where the tooltip should appear relative to its target (\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}.} \item{trigger}{What action should cause the tooltip to appear? (\code{hover}, @@ -35,10 +34,14 @@ of \code{bsTooltip} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Tooltips_and_Popovers: \code{\link{Tooltips_and_Popovers}}; - \code{\link{addPopover}}; \code{\link{addTooltip}}; - \code{\link{bsPopover}}; \code{\link{popify}}; - \code{\link{removePopover}}; \code{\link{removeTooltip}}; - \code{\link{tipify}} +Other Tooltips_and_Popovers: +\code{\link{Tooltips_and_Popovers}}, +\code{\link{addPopover}()}, +\code{\link{addTooltip}()}, +\code{\link{bsPopover}()}, +\code{\link{popify}()}, +\code{\link{removePopover}()}, +\code{\link{removeTooltip}()}, +\code{\link{tipify}()} } - +\concept{Tooltips_and_Popovers} diff --git a/man/bsTypeahead.Rd b/man/bsTypeahead.Rd index baf5243..8577428 100644 --- a/man/bsTypeahead.Rd +++ b/man/bsTypeahead.Rd @@ -1,4 +1,4 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsTypeahead.R \name{bsTypeahead} \alias{bsTypeahead} @@ -29,4 +29,3 @@ when there is no text when lookup function is called.} \seealso{ \code{\link{updateTypeaheadInput}} } - diff --git a/man/closeAlert.Rd b/man/closeAlert.Rd index 707330f..2ffbdca 100644 --- a/man/closeAlert.Rd +++ b/man/closeAlert.Rd @@ -1,4 +1,4 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/closeAlert.R \name{closeAlert} \alias{closeAlert} @@ -12,7 +12,7 @@ closeAlert(session, alertId) \item{alertId}{The id of the alert to be dismissed.} } \description{ -\code{closeAlert} is used within your Server logic to close an alert that you +\code{closeAlert} is used within your Server logic to close an alert that you created with \code{\link{createAlert}}. } \details{ @@ -26,7 +26,9 @@ of \code{closeAlert} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Alerts: \code{\link{Alerts}}; \code{\link{bsAlert}}; - \code{\link{createAlert}} +Other Alerts: +\code{\link{Alerts}}, +\code{\link{bsAlert}()}, +\code{\link{createAlert}()} } - +\concept{Alerts} diff --git a/man/createAlert.Rd b/man/createAlert.Rd index 5b6217e..01f7ad2 100644 --- a/man/createAlert.Rd +++ b/man/createAlert.Rd @@ -1,11 +1,19 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/createAlert.R \name{createAlert} \alias{createAlert} \title{createAlert} \usage{ -createAlert(session, anchorId, alertId = NULL, title = NULL, - content = NULL, style = NULL, dismiss = TRUE, append = TRUE) +createAlert( + session, + anchorId, + alertId = NULL, + title = NULL, + content = NULL, + style = NULL, + dismiss = TRUE, + append = TRUE +) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} @@ -40,7 +48,9 @@ of \code{createAlert} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Alerts: \code{\link{Alerts}}; \code{\link{bsAlert}}; - \code{\link{closeAlert}} +Other Alerts: +\code{\link{Alerts}}, +\code{\link{bsAlert}()}, +\code{\link{closeAlert}()} } - +\concept{Alerts} diff --git a/man/popify.Rd b/man/popify.Rd index 180135d..3c4d43b 100644 --- a/man/popify.Rd +++ b/man/popify.Rd @@ -1,11 +1,17 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/popify.R \name{popify} \alias{popify} \title{popify} \usage{ -popify(el, title, content, placement = "bottom", trigger = "hover", - options = NULL) +popify( + el, + title, + content, + placement = "bottom", + trigger = "hover", + options = NULL +) } \arguments{ \item{el}{A shiny UI element.} @@ -14,7 +20,7 @@ popify(el, title, content, placement = "bottom", trigger = "hover", \item{content}{The main content of the popover.} -\item{placement}{Where the popover should appear relative to its target +\item{placement}{Where the popover should appear relative to its target (\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}.} \item{trigger}{What action should cause the popover to appear? (\code{hover}, @@ -38,10 +44,14 @@ of \code{popify} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Tooltips_and_Popovers: \code{\link{Tooltips_and_Popovers}}; - \code{\link{addPopover}}; \code{\link{addTooltip}}; - \code{\link{bsPopover}}; \code{\link{bsTooltip}}; - \code{\link{removePopover}}; \code{\link{removeTooltip}}; - \code{\link{tipify}} +Other Tooltips_and_Popovers: +\code{\link{Tooltips_and_Popovers}}, +\code{\link{addPopover}()}, +\code{\link{addTooltip}()}, +\code{\link{bsPopover}()}, +\code{\link{bsTooltip}()}, +\code{\link{removePopover}()}, +\code{\link{removeTooltip}()}, +\code{\link{tipify}()} } - +\concept{Tooltips_and_Popovers} diff --git a/man/removePopover.Rd b/man/removePopover.Rd index 6cb805f..d61ad3c 100644 --- a/man/removePopover.Rd +++ b/man/removePopover.Rd @@ -1,4 +1,4 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/removePopover.R \name{removePopover} \alias{removePopover} @@ -26,10 +26,14 @@ of \code{removePopover} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Tooltips_and_Popovers: \code{\link{Tooltips_and_Popovers}}; - \code{\link{addPopover}}; \code{\link{addTooltip}}; - \code{\link{bsPopover}}; \code{\link{bsTooltip}}; - \code{\link{popify}}; \code{\link{removeTooltip}}; - \code{\link{tipify}} +Other Tooltips_and_Popovers: +\code{\link{Tooltips_and_Popovers}}, +\code{\link{addPopover}()}, +\code{\link{addTooltip}()}, +\code{\link{bsPopover}()}, +\code{\link{bsTooltip}()}, +\code{\link{popify}()}, +\code{\link{removeTooltip}()}, +\code{\link{tipify}()} } - +\concept{Tooltips_and_Popovers} diff --git a/man/removeTooltip.Rd b/man/removeTooltip.Rd index 6f85807..5e6b4f9 100644 --- a/man/removeTooltip.Rd +++ b/man/removeTooltip.Rd @@ -1,4 +1,4 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/removeTooltip.R \name{removeTooltip} \alias{removeTooltip} @@ -26,10 +26,14 @@ of \code{removeTooltip} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Tooltips_and_Popovers: \code{\link{Tooltips_and_Popovers}}; - \code{\link{addPopover}}; \code{\link{addTooltip}}; - \code{\link{bsPopover}}; \code{\link{bsTooltip}}; - \code{\link{popify}}; \code{\link{removePopover}}; - \code{\link{tipify}} +Other Tooltips_and_Popovers: +\code{\link{Tooltips_and_Popovers}}, +\code{\link{addPopover}()}, +\code{\link{addTooltip}()}, +\code{\link{bsPopover}()}, +\code{\link{bsTooltip}()}, +\code{\link{popify}()}, +\code{\link{removePopover}()}, +\code{\link{tipify}()} } - +\concept{Tooltips_and_Popovers} diff --git a/man/tipify.Rd b/man/tipify.Rd index e4f3dc2..408f660 100644 --- a/man/tipify.Rd +++ b/man/tipify.Rd @@ -1,4 +1,4 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/tipify.R \name{tipify} \alias{tipify} @@ -11,7 +11,7 @@ tipify(el, title, placement = "bottom", trigger = "hover", options = NULL) \item{title}{The content of the tooltip.} -\item{placement}{Where the tooltip should appear relative to its target +\item{placement}{Where the tooltip should appear relative to its target (\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}.} \item{trigger}{What action should cause the tooltip to appear? (\code{hover}, @@ -35,10 +35,14 @@ of \code{tipify} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Tooltips_and_Popovers: \code{\link{Tooltips_and_Popovers}}; - \code{\link{addPopover}}; \code{\link{addTooltip}}; - \code{\link{bsPopover}}; \code{\link{bsTooltip}}; - \code{\link{popify}}; \code{\link{removePopover}}; - \code{\link{removeTooltip}} +Other Tooltips_and_Popovers: +\code{\link{Tooltips_and_Popovers}}, +\code{\link{addPopover}()}, +\code{\link{addTooltip}()}, +\code{\link{bsPopover}()}, +\code{\link{bsTooltip}()}, +\code{\link{popify}()}, +\code{\link{removePopover}()}, +\code{\link{removeTooltip}()} } - +\concept{Tooltips_and_Popovers} diff --git a/man/toggleModal.Rd b/man/toggleModal.Rd index 1af7454..e86e027 100644 --- a/man/toggleModal.Rd +++ b/man/toggleModal.Rd @@ -1,4 +1,4 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/toggleModal.R \name{toggleModal} \alias{toggleModal} @@ -28,6 +28,8 @@ of \code{toggleModal} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Modals: \code{\link{Modals}}; \code{\link{bsModal}} +Other Modals: +\code{\link{Modals}}, +\code{\link{bsModal}()} } - +\concept{Modals} diff --git a/man/updateButton.Rd b/man/updateButton.Rd index 219637b..26c7b18 100644 --- a/man/updateButton.Rd +++ b/man/updateButton.Rd @@ -1,29 +1,37 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/updateButton.R \name{updateButton} \alias{updateButton} \title{updateButton} \usage{ -updateButton(session, inputId, label = NULL, icon = NULL, value = NULL, - style = NULL, size = NULL, block = NULL, disabled = NULL) +updateButton( + session, + inputId, + label = NULL, + icon = NULL, + value = NULL, + style = NULL, + size = NULL, + block = NULL, + disabled = NULL +) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} -\item{inputId}{Specifies the input slot that will be used to access the -value.} +\item{inputId}{The \code{input} slot that will be used to access the value.} \item{label}{The contents of the button or link--usually a text label, but you could also use any other HTML, like an image.} -\item{icon}{An optional \code{\link{icon}} to appear on the button.} +\item{icon}{An optional \code{\link[shiny:icon]{icon()}} to appear on the button.} \item{value}{\bold{logical} If \code{type = "toggle"}, the initial value of the button.} \item{style}{A Bootstrap style to apply to the button. (\code{default}, \code{primary}, \code{success}, \code{info}, \code{warning}, or \code{danger})} -\item{size}{The size of the button (\code{extra-small}, \code{small}, +\item{size}{The size of the button (\code{extra-small}, \code{small}, \code{default}, or \code{large})} \item{block}{\bold{logical} Should the button take the full width of the parent element?} @@ -39,6 +47,9 @@ Because of the way it is coded, \code{updateButton} may work on buttons not created by \code{\link{bsButton}} such as \code{\link{submitButton}}. See \code{\link{Buttons}} for more information about how to use \code{updateButton} with the rest of the Buttons family. + +See \link{Buttons} for more information about how to use \code{updateButton} with the +rest of the Buttons family. } \note{ Run \code{bsExample("Buttons")} for an example @@ -47,7 +58,8 @@ of \code{updateButton} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Buttons: \code{\link{Buttons}}; - \code{\link{bsButton}} +Other Buttons: +\code{\link{Buttons}}, +\code{\link{bsButton}()} } - +\concept{Buttons} diff --git a/man/updateCollapse.Rd b/man/updateCollapse.Rd index 42b717a..0dc8f04 100644 --- a/man/updateCollapse.Rd +++ b/man/updateCollapse.Rd @@ -1,4 +1,4 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/updateCollapse.R \name{updateCollapse} \alias{updateCollapse} @@ -11,15 +11,15 @@ updateCollapse(session, id, open = NULL, close = NULL, style = NULL) \item{id}{The id of the Collapse object you want to change.} -\item{open}{A vector of \code{value} (or \code{title} if no \code{value} was +\item{open}{A vector of \code{value} (or \code{title} if no \code{value} was provided) values identifying the panels you want to open.} -\item{close}{A vector of \code{value} (or \code{title} if no \code{value} was +\item{close}{A vector of \code{value} (or \code{title} if no \code{value} was provided) values identifying the panels you want to close.} \item{style}{A named list of Bootstrap styles (\code{primary}, \code{danger}, \code{info}, \code{warning}, \code{success}, or \code{default}). The names should correspond -to the \code{value} (or \code{title} if no \code{value} was provided) of the +to the \code{value} (or \code{title} if no \code{value} was provided) of the \code{\link{bsCollapsePanel}} you want to change.} } \description{ @@ -37,7 +37,10 @@ of \code{updateCollapse} functionality. \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} -Other Collapses: \code{\link{Collapses}}; - \code{\link{bsCollapsePanel}}; \code{\link{bsCollapse}} +Other Collapses: +\code{\link{Collapses}}, +\code{\link{bsCollapseButton}()}, +\code{\link{bsCollapsePanel}()}, +\code{\link{bsCollapse}()} } - +\concept{Collapses} diff --git a/man/updateTypeahead.Rd b/man/updateTypeahead.Rd index 3084f05..8d44033 100644 --- a/man/updateTypeahead.Rd +++ b/man/updateTypeahead.Rd @@ -1,11 +1,10 @@ -% Generated by roxygen2 (4.1.0): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/updateTypeahead.R \name{updateTypeahead} \alias{updateTypeahead} \title{updateTypeahead} \usage{ -updateTypeahead(session, inputId, label = NULL, value = NULL, - choices = NULL) +updateTypeahead(session, inputId, label = NULL, value = NULL, choices = NULL) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} @@ -25,4 +24,3 @@ function. Use htmlwidgets::JS() to indicate JavaScript.} \seealso{ \code{\link{typeaheadInput}} } - From 6f538dd9d3a8724dcd7ebb6abf4353b2b77ec133 Mon Sep 17 00:00:00 2001 From: Gregory R Warnes Date: Wed, 6 Jan 2021 17:58:21 -0500 Subject: [PATCH 4/7] Fixes. --- R/bsCollapseButton.R | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/R/bsCollapseButton.R b/R/bsCollapseButton.R index d0ebf42..c2a6ed5 100644 --- a/R/bsCollapseButton.R +++ b/R/bsCollapseButton.R @@ -22,8 +22,11 @@ NULL #' @export bsCollapseButton <- function(inputId, label, target, icon=NULL, width=NULL, ...) { - actionButton(inputID=inputId, - label=label, + actionButton(inputId, + label, + icon=icon, + width=width, + ..., "data-toggle"="collapse", "data-target"=paste0("#", target) ) @@ -35,8 +38,11 @@ bsCollapseButton <- function(inputId, label, target, icon=NULL, width=NULL, ...) #' @export bsCollapseLink <- function(inputId, label, target, icon=NULL, width=NULL, ...) { - actionLink(inputID=inputId, - label=label, + actionLink(inputId, + label, + icon=icon, + width=width, + ..., "data-toggle"="collapse", "data-target"=paste0("#", target) ) From c2d6db2122edd55335f9b88c3f2c78d3aa380b66 Mon Sep 17 00:00:00 2001 From: Gregory R Warnes Date: Wed, 6 Jan 2021 17:59:01 -0500 Subject: [PATCH 5/7] Update Collapse example to show `bsCollapseButton` and `bsCollapseLink` --- inst/examples/Collapses/ui.R | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/inst/examples/Collapses/ui.R b/inst/examples/Collapses/ui.R index 2064e0c..396d4da 100644 --- a/inst/examples/Collapses/ui.R +++ b/inst/examples/Collapses/ui.R @@ -5,20 +5,12 @@ fluidPage( sidebarPanel( div( HTML("This button will open Panel 1 using updateCollapse."), - actionButton("p1Button", "Push Me!") + actionButton("p1Button", "Push me!") ), div( HTML("This button will toggle Panel 1 without using updateCollapse."), - actionButton( - inputId="p2Button", - "Push Me!", - class="btn btn-primary", - type="button", - "data-toggle"="collapse", - "data-target"="#panel1", - "aria-expanded"="false", - "aria-controls"="collapseExample" - ) + bsCollapseButton("p2Button", "Or push me!", "panel1", class="btn-primary"), + bsCollapseLink("p2Button", "Or click this link!", "panel1") ), selectInput("styleSelect", "Select style for Panel 1", c("default", "primary", "danger", "warning", "info", "success")) From c04fb31d539feaf0c306ddd119d9d2acdcd102c6 Mon Sep 17 00:00:00 2001 From: Gregory R Warnes Date: Thu, 7 Jan 2021 02:16:06 -0500 Subject: [PATCH 6/7] * Add optional `parent` parameter tto `bsCollapseButton` and `bsCollapseLink`. * Fix issue with `bsCollapseLink` generating `href` attributes with an extra "# ". * Minor formatting improvement to Collapse demo. --- R/bsCollapseButton.R | 25 ++++++++--- inst/examples/Collapses/ui.R | 85 ++++++++++++++++++++++++++---------- man/bsCollapseButton.Rd | 28 ++++++++++-- 3 files changed, 105 insertions(+), 33 deletions(-) diff --git a/R/bsCollapseButton.R b/R/bsCollapseButton.R index c2a6ed5..41a4893 100644 --- a/R/bsCollapseButton.R +++ b/R/bsCollapseButton.R @@ -8,7 +8,8 @@ #' @template item_details #' @template footer #' -#' @param target value HTML id of object to be toggled +#' @param target HTML id of object to be toggled +#' @param parent \bold{Optional} HTML id of parent container #' #' @importFrom shiny actionButton #' @importFrom shiny actionLink @@ -20,15 +21,19 @@ NULL #' that will toggle the collapsed state of a #' \code{\link{bsCollapsePanel}} when clicked. #' @export -bsCollapseButton <- function(inputId, label, target, icon=NULL, width=NULL, ...) +bsCollapseButton <- function(inputId, label, target, parent=NULL, icon=NULL, width=NULL, ...) { + target = paste0("#", target) + if(!is.null(parent)) parent <- paste0("#", parent) + actionButton(inputId, label, icon=icon, width=width, ..., "data-toggle"="collapse", - "data-target"=paste0("#", target) + "data-target"=target, + "data-parent"=parent ) } @@ -36,15 +41,23 @@ bsCollapseButton <- function(inputId, label, target, icon=NULL, width=NULL, ...) #' that will toggle the collapsed state of a #' \code{\link{bsCollapsePanel}} when clicked. #' @export -bsCollapseLink <- function(inputId, label, target, icon=NULL, width=NULL, ...) +bsCollapseLink <- function(inputId, label, target, parent=NULL, icon=NULL, width=NULL, ...) { - actionLink(inputId, + + if(!is.null(parent)) + parent <- HTML(paste0("#", parent)) + + tmp <- actionLink(inputId, label, icon=icon, width=width, ..., "data-toggle"="collapse", - "data-target"=paste0("#", target) + "data-parent"=parent ) + + tmp$attribs$href=paste0('#', target) + + tmp } diff --git a/inst/examples/Collapses/ui.R b/inst/examples/Collapses/ui.R index 396d4da..fcc1956 100644 --- a/inst/examples/Collapses/ui.R +++ b/inst/examples/Collapses/ui.R @@ -1,33 +1,70 @@ library(shiny) library(shinyBS) -fluidPage( - sidebarLayout( - sidebarPanel( - div( - HTML("This button will open Panel 1 using updateCollapse."), +fluidPage(sidebarLayout( + sidebarPanel( + tags$ul( + tags$li( + HTML( + "This button will open Panel 1 using", + "updateCollapse, but won't close it." + ), actionButton("p1Button", "Push me!") ), - div( - HTML("This button will toggle Panel 1 without using updateCollapse."), - bsCollapseButton("p2Button", "Or push me!", "panel1", class="btn-primary"), - bsCollapseLink("p2Button", "Or click this link!", "panel1") + tags$li( + HTML( + "This button will toggle Panel 1 ", + "without", + " using updateCollapse" + ), + bsCollapseButton( + "p2Button", + "Or push me!", + "panel1", + class = "btn-primary" + ) ), - selectInput("styleSelect", "Select style for Panel 1", - c("default", "primary", "danger", "warning", "info", "success")) + tags$li( + HTML( + "This link will toggle Panel 2 ", + "without", + " using updateCollapse" + ), + bsCollapseLink( + "p2Button", + "Or click this link!", + "panel2", + parent = "collapseExample" + ) + ) ), - mainPanel( - bsCollapse( - id = "collapseExample", - open = "Panel 2", - bsCollapsePanel("Panel 1", - id="panel1", - "This is a panel with just text ", - "and has the default style. You can change the style in ", - "the sidebar.", style = "info"), - bsCollapsePanel("Panel 2", "This panel has a generic plot. ", - "and a 'success' style.", plotOutput("genericPlot"), style = "success") + selectInput( + "styleSelect", + "Select style for Panel 1", + c("default", "primary", "danger", + "warning", "info", "success") + ) + ), + mainPanel( + bsCollapse( + id = "collapseExample", + open = "Panel 2", + # multiple = TRUE, + bsCollapsePanel( + "Panel 1", + id = "panel1", + "This is a panel with just text ", + "and has the default style. You can change the style in ", + "the sidebar.", + style = "info" + ), + bsCollapsePanel( + "Panel 2", + id = "panel2", + "This panel has a generic plot. ", + "and a 'success' style.", + plotOutput("genericPlot"), + style = "success" ) ) ) -) - +)) diff --git a/man/bsCollapseButton.Rd b/man/bsCollapseButton.Rd index f14d160..504f92f 100644 --- a/man/bsCollapseButton.Rd +++ b/man/bsCollapseButton.Rd @@ -6,9 +6,25 @@ \title{Create a button or link that toggles the state of a \code{\link{bsCollapsePanel}}.} \usage{ -bsCollapseButton(inputId, label, target, icon = NULL, width = NULL, ...) +bsCollapseButton( + inputId, + label, + target, + container = NULL, + icon = NULL, + width = NULL, + ... +) -bsCollapseLink(inputId, label, target, icon = NULL, width = NULL, ...) +bsCollapseLink( + inputId, + label, + target, + parent = NULL, + icon = NULL, + width = NULL, + ... +) } \arguments{ \item{inputId}{The \code{input} slot that will be used to access the value.} @@ -16,7 +32,7 @@ bsCollapseLink(inputId, label, target, icon = NULL, width = NULL, ...) \item{label}{The contents of the button or link--usually a text label, but you could also use any other HTML, like an image.} -\item{target}{value HTML id of object to be toggled} +\item{target}{HTML id of object to be toggled} \item{icon}{An optional \code{\link[shiny:icon]{icon()}} to appear on the button.} @@ -24,6 +40,8 @@ you could also use any other HTML, like an image.} see \code{\link[shiny:reexports]{validateCssUnit()}}.} \item{...}{Named attributes to be applied to the button or link.} + +\item{parent}{\bold{Optional} HTML id of parent container} } \description{ Create a button or link that toggles the state of a @@ -47,6 +65,10 @@ that will toggle the collapsed state of a \note{ Run \code{bsExample("Collapses")} for an example of \code{bsCollapseButton} functionality. + +Providing `parent` causes all other collapsible elements under the + specified parent to be closed, so that no more than one panel is open + at a time. } \seealso{ \href{http://getbootstrap.com}{Twitter Bootstrap 3} From 26ec701b2f7614b9744c8cc5b4493ce20aeee5b3 Mon Sep 17 00:00:00 2001 From: Gregory R Warnes Date: Thu, 7 Jan 2021 02:16:06 -0500 Subject: [PATCH 7/7] * Add optional `parent` parameter tto `bsCollapseButton` and `bsCollapseLink`. * Fix issue with `bsCollapseLink` generating `href` attributes with an extra "# ". * Minor formatting improvement to Collapse demo. --- R/bsCollapseButton.R | 25 ++++++++--- inst/examples/Collapses/ui.R | 85 ++++++++++++++++++++++++++---------- man/bsCollapseButton.Rd | 24 ++++++++-- 3 files changed, 101 insertions(+), 33 deletions(-) diff --git a/R/bsCollapseButton.R b/R/bsCollapseButton.R index c2a6ed5..943d8c1 100644 --- a/R/bsCollapseButton.R +++ b/R/bsCollapseButton.R @@ -8,7 +8,8 @@ #' @template item_details #' @template footer #' -#' @param target value HTML id of object to be toggled +#' @param target HTML id of object to be toggled +#' @param parent \bold{Optional} HTML id of parent container #' #' @importFrom shiny actionButton #' @importFrom shiny actionLink @@ -20,15 +21,19 @@ NULL #' that will toggle the collapsed state of a #' \code{\link{bsCollapsePanel}} when clicked. #' @export -bsCollapseButton <- function(inputId, label, target, icon=NULL, width=NULL, ...) +bsCollapseButton <- function(inputId, label, target, parent=NULL, icon=NULL, width=NULL, ...) { + target = paste0("#", target) + if(!is.null(parent)) parent <- paste0("#", parent) + actionButton(inputId, label, icon=icon, width=width, ..., "data-toggle"="collapse", - "data-target"=paste0("#", target) + "data-target"=target, + "data-parent"=parent ) } @@ -36,15 +41,23 @@ bsCollapseButton <- function(inputId, label, target, icon=NULL, width=NULL, ...) #' that will toggle the collapsed state of a #' \code{\link{bsCollapsePanel}} when clicked. #' @export -bsCollapseLink <- function(inputId, label, target, icon=NULL, width=NULL, ...) +bsCollapseLink <- function(inputId, label, target, parent=NULL, icon=NULL, width=NULL, ...) { - actionLink(inputId, + + if(!is.null(parent)) + parent <- paste0("#", parent) + + tmp <- actionLink(inputId, label, icon=icon, width=width, ..., "data-toggle"="collapse", - "data-target"=paste0("#", target) + "data-parent"=parent ) + + tmp$attribs$href=paste0('#', target) + + tmp } diff --git a/inst/examples/Collapses/ui.R b/inst/examples/Collapses/ui.R index 396d4da..fcc1956 100644 --- a/inst/examples/Collapses/ui.R +++ b/inst/examples/Collapses/ui.R @@ -1,33 +1,70 @@ library(shiny) library(shinyBS) -fluidPage( - sidebarLayout( - sidebarPanel( - div( - HTML("This button will open Panel 1 using updateCollapse."), +fluidPage(sidebarLayout( + sidebarPanel( + tags$ul( + tags$li( + HTML( + "This button will open Panel 1 using", + "updateCollapse, but won't close it." + ), actionButton("p1Button", "Push me!") ), - div( - HTML("This button will toggle Panel 1 without using updateCollapse."), - bsCollapseButton("p2Button", "Or push me!", "panel1", class="btn-primary"), - bsCollapseLink("p2Button", "Or click this link!", "panel1") + tags$li( + HTML( + "This button will toggle Panel 1 ", + "without", + " using updateCollapse" + ), + bsCollapseButton( + "p2Button", + "Or push me!", + "panel1", + class = "btn-primary" + ) ), - selectInput("styleSelect", "Select style for Panel 1", - c("default", "primary", "danger", "warning", "info", "success")) + tags$li( + HTML( + "This link will toggle Panel 2 ", + "without", + " using updateCollapse" + ), + bsCollapseLink( + "p2Button", + "Or click this link!", + "panel2", + parent = "collapseExample" + ) + ) ), - mainPanel( - bsCollapse( - id = "collapseExample", - open = "Panel 2", - bsCollapsePanel("Panel 1", - id="panel1", - "This is a panel with just text ", - "and has the default style. You can change the style in ", - "the sidebar.", style = "info"), - bsCollapsePanel("Panel 2", "This panel has a generic plot. ", - "and a 'success' style.", plotOutput("genericPlot"), style = "success") + selectInput( + "styleSelect", + "Select style for Panel 1", + c("default", "primary", "danger", + "warning", "info", "success") + ) + ), + mainPanel( + bsCollapse( + id = "collapseExample", + open = "Panel 2", + # multiple = TRUE, + bsCollapsePanel( + "Panel 1", + id = "panel1", + "This is a panel with just text ", + "and has the default style. You can change the style in ", + "the sidebar.", + style = "info" + ), + bsCollapsePanel( + "Panel 2", + id = "panel2", + "This panel has a generic plot. ", + "and a 'success' style.", + plotOutput("genericPlot"), + style = "success" ) ) ) -) - +)) diff --git a/man/bsCollapseButton.Rd b/man/bsCollapseButton.Rd index f14d160..e01cce8 100644 --- a/man/bsCollapseButton.Rd +++ b/man/bsCollapseButton.Rd @@ -6,9 +6,25 @@ \title{Create a button or link that toggles the state of a \code{\link{bsCollapsePanel}}.} \usage{ -bsCollapseButton(inputId, label, target, icon = NULL, width = NULL, ...) +bsCollapseButton( + inputId, + label, + target, + parent = NULL, + icon = NULL, + width = NULL, + ... +) -bsCollapseLink(inputId, label, target, icon = NULL, width = NULL, ...) +bsCollapseLink( + inputId, + label, + target, + parent = NULL, + icon = NULL, + width = NULL, + ... +) } \arguments{ \item{inputId}{The \code{input} slot that will be used to access the value.} @@ -16,7 +32,9 @@ bsCollapseLink(inputId, label, target, icon = NULL, width = NULL, ...) \item{label}{The contents of the button or link--usually a text label, but you could also use any other HTML, like an image.} -\item{target}{value HTML id of object to be toggled} +\item{target}{HTML id of object to be toggled} + +\item{parent}{\bold{Optional} HTML id of parent container} \item{icon}{An optional \code{\link[shiny:icon]{icon()}} to appear on the button.}