shinyBS/0000755000176200001440000000000015156540112011631 5ustar liggesusersshinyBS/MD50000644000176200001440000000745315156540112012152 0ustar liggesusersa8d4f267f8a38cba45848f56b12b8ee1 *DESCRIPTION 99a4b10ea32c97a9634f8d945bdeb38e *NAMESPACE 246cf500f8a5537e4ad1f8b428325bba *NEWS.md a100c5a0c5a6ce65ff7f9349f3075d11 *R/Alerts.R acf6a101bce869ded85ade7129e265d4 *R/Buttons.R ce847e6a681f6eb468df303150f04cf3 *R/Collapses.R 2cdbd3f69abc89135ec6632356b33767 *R/Modals.R d8eb002e7429743586da9ae984d2b6c1 *R/Tooltips_and_Popovers.R 375d6d4adfd935d0039701ab098e9eaf *R/addPopover.R 4b8da22366345723f646d093045d6a8d *R/addTooltip.R c9171623c19e98046197b52cbe930c82 *R/bsAlert.R b7cdd71b1b3f35d35fe12ec1f942a787 *R/bsButton.R a91ec3da0ce2eb02db0339a3168e562e *R/bsCollapse.R 7528fccee981f1bc1a7afc305a03679e *R/bsCollapsePanel.R 5aa47dc3ce2c3ccb728694c3fd43cf30 *R/bsExample.R 787cd429af38bc5062b71fb540ddc423 *R/bsModal.R 18dbcbdb5b061238b936dcf037f4a40d *R/bsPopover.R 2e50e1cd121aa5586751d05f578677d3 *R/bsTooltip.R bc873ef4f8d036331d18fabbff6707ee *R/bsTypeahead.R 624d22721ae65a90c184b0b0e4dc0303 *R/closeAlert.R ba95dd8f623a962ceeff4ea4f10fc396 *R/createAlert.R 09f975f0a900529a2115c1916ed68132 *R/misc.R 41755a98b3bc3a3476f54c81b66d2b89 *R/popify.R 1c3dab809e56a5234c4bcad7958a4351 *R/removePopover.R 6957a9353525aee605ac32b1f9449ffe *R/removeTooltip.R e723c90f93572d8bc46a0d4ed38e2aa0 *R/tagManipulators.R 305b0296d40d29c2c14e7df7ff86254c *R/tipify.R 82302b12bea2eb7754417ca8b10bff45 *R/toggleModal.R 5234a414b3ba12ece4b87155f96766f1 *R/updateButton.R 29bb9392e7f4a0d2ee21009fc4a49c11 *R/updateCollapse.R a9fda7f44c4f1764c23bf1491e163b8e *R/updateTypeahead.R ebbe56cf1af61de3e8b5a9772432264e *inst/examples/Alerts/server.R 27855eda0745026cb4b4aa2c445aee76 *inst/examples/Alerts/ui.R bad9aee73b2be916922afa555971c563 *inst/examples/Buttons/server.R 79d528cf3a75d2673f438f46c171dfb6 *inst/examples/Buttons/ui.R 13ec7fad76b0a8f4debb1769209d026f *inst/examples/Collapses/server.R 7208541419411613b32dfa3caf4d6b74 *inst/examples/Collapses/ui.R 7830c90bc677e3ad39552dab6e797c22 *inst/examples/Modals/server.R 2735cd2aac0c78100a1cab22384cea6c *inst/examples/Modals/ui.R 54f116835cb34ca645e9909ea84bbefc *inst/examples/TooltipsandPopovers/server.R 8128f93c0bcc2ac0ff91a2b70c3462ab *inst/examples/TooltipsandPopovers/ui.R 2ff49c216c41474baa9dc4722e6c4a8d *inst/tests/tipify_test.R 8d08bac638e823d8c6d4a0cb8430f9ff *inst/tests/tipify_test2.R 5afe1b650a3e0ff9f54ac0029ea4dfbe *inst/www/bootstrap3-typeahead.js de5b444d3f571fe21b4615959d0e00ec *inst/www/shinyBS.css 47b3f39a8295dad71e88a2e32ab37ee6 *inst/www/shinyBS.js afb96d221561eea962eafbf5d078ecea *inst/www/typeahead_inputbinding.js e4d14ed71dc284cd9437f5b087145cfb *man/Alerts.Rd d6897d74b6310e8b6e81234a4ef136b0 *man/Buttons.Rd f7f280bc7f38b20893494f97313ab30e *man/Collapses.Rd 17379ed6b7777ecc5be73de5797b1bc5 *man/Modals.Rd 033e697830261881389c59c8e75875b3 *man/Tooltips_and_Popovers.Rd 504e0164382e146b9fc666a6b3844405 *man/addPopover.Rd 7470fdb07c53d21c6583df3a45e225ec *man/addTooltip.Rd e800729a1e8ab460389d724c920acf30 *man/bsAlert.Rd b2079774eeff78a766248ebc1551210e *man/bsButton.Rd 994eb890161da240890043bcf94127e6 *man/bsCollapse.Rd c7114669f95b8ba073859656665023cd *man/bsCollapsePanel.Rd fa388242fc6ed3400dfdc3e0515d6a04 *man/bsExample.Rd c14d07d69ab6eafab2c6753080d3377c *man/bsModal.Rd a63eecb50b4a9a73febf053fedc42e52 *man/bsPopover.Rd 3bd09e86bf6a83d1b22f24f2ad225ff0 *man/bsTooltip.Rd d85dc3c4bc4311bd8985a43feefeeef5 *man/bsTypeahead.Rd 2dc0384b4f5eb2d4408f4dd00846632a *man/closeAlert.Rd 98acbbbb36f5fd4dabd30abdfacf07b3 *man/createAlert.Rd b1ffe58216f76df85cd09e3ca79945e0 *man/popify.Rd 17c4e68dbaf225a305f00567a5265010 *man/removePopover.Rd dc6430e34fad30f7679fc2dffa144fd1 *man/removeTooltip.Rd dec01183cb1149fed6743ce8df5a1648 *man/tipify.Rd 1350940f6cd98f00c22ddbdf5af1bbf4 *man/toggleModal.Rd 5e69bb6371fbe9d7c4aa2626ea8a686f *man/updateButton.Rd 52f136c2e1172d15d9313d30bdbc905f *man/updateCollapse.Rd 9df1d768bffc067225a48341dfd53dcb *man/updateTypeahead.Rd shinyBS/R/0000755000176200001440000000000015120510337012027 5ustar liggesusersshinyBS/R/bsTooltip.R0000644000176200001440000000174015116513141014134 0ustar liggesusers#'bsTooltip #' #'\code{bsTooltip} is used within the UI of an app to add a tooltip to a Shiny #'input or output. #' #'@param id The id of the element to attach the tooltip to. #'@param title The content of the tooltip. #'@param placement Where the tooltip should appear relative to its target #'(\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}. #'@param trigger What action should cause the tooltip to appear? (\code{hover}, #'\code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}. #'@param options A named list of additional options to be set on the tooltip. #' #'@templateVar item_name bsTooltip #'@templateVar family_name Tooltips_and_Popovers #'@template item_details #'@template footer #'@export bsTooltip <- function(id, title, placement="bottom", trigger="hover", options = NULL) { options = buildTooltipOrPopoverOptionsList(title, placement, trigger, options) createTooltipOrPopoverOnUI(id, "tooltip", options) }shinyBS/R/createAlert.R0000644000176200001440000000242315116513141014407 0ustar liggesusers#'createAlert #' #'\code{createAlert} is used within the Server logic of your Shiny app to display #'an alert to the user. #' #'@param session The session object passed to function given to shinyServer. #'@param anchorId The unique identifier of the anchor where the alert should be #'displayed. #'@param alertId \bold{Optional} A unique identifier for the Alert. #'@param title \bold{Optional} A title for the Alert. #'@param content The main body of the Alert. HTML tags are allowed. #'@param style A bootstrap style to apply. Defaults to \code{info}. #'@param dismiss \code{logical} Should the Alert be user dismissable? Defaults to \code{TRUE}. #'@param append \code{logical} Should the Alert be appended below existing Alerts? Default to \code{TRUE}. #' #'@templateVar item_name createAlert #'@templateVar family_name Alerts #'@template item_details #'@template footer #'@export createAlert <- function(session, anchorId, alertId = NULL, title=NULL, content=NULL, style=NULL, dismiss=TRUE, append=TRUE) { data <- dropNulls(list(id = anchorId, alertId = alertId, title = title, content = content, style = style, dismiss = dismiss, append = append)) session$sendCustomMessage(type="bsAlertCreate", data) } shinyBS/R/Modals.R0000644000176200001440000000562015116525551013405 0ustar liggesusers#'Modals #' #'Modal windows are similar to popups but are rendered within the #'original window. They can contain any combination of shiny inputs, shiny #'outputs, and html. Possible uses include extra controls that you don't want #'cluttering up the main app display or help pages to explain your apps #'operation. #' #'@section Components: #'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 #' close a modal window programmatically.} #' } #' #'@details #'Use \code{\link{bsModal}} in your UI to create a modal window. It works #'like \code{\link{Collapses}} or \code{\link[shiny:tabPanel]{tabPanel}}, any non-named arguments #'will be passed as content for the modal. #' #'Create a button or link and assign its \code{inputId} as the \code{trigger} #'in \code{\link{bsModal}}. #' #'@section Changes: #'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 #'size of the modal window. Either \code{small} or \code{large}. #' #'@examples #'library(shiny) #'library(shinyBS) #' #'app = shinyApp( #' ui = #' fluidPage( #' sidebarLayout( #' sidebarPanel( #' sliderInput("bins", #' "Number of bins:", #' min = 1, #' max = 50, #' value = 30), #' actionButton("tabBut", "View Table") #' ), #' #' mainPanel( #' plotOutput("distPlot"), #' bsModal("modalExample", "Data Table", "tabBut", size = "large", #' dataTableOutput("distTable")) #' ) #' ) #' ), #' 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) { #' paste0(signif(tab$breaks[i], 3), "-", signif(tab$breaks[i+1], 3)) #' }) #' tab <- as.data.frame(do.call(cbind, tab)) #' colnames(tab) <- c("Bins", "Counts", "Density") #' return(tab[, 1:3]) #' #' }, options = list(pageLength=10)) #' #' } #') #'\dontrun{ #' runApp(app) #'} #'@templateVar family_name Modals #'@templateVar item_name Modals #'@template footer NULL shinyBS/R/removePopover.R0000644000176200001440000000112015116513141015015 0ustar liggesusers#'removePopover #' #'\code{removePopover} is used within the Server logic of an app to remove an #'existing popover from a Shiny input or output. #' #'@param session The session object passed to function given to shinyServer. #'@param id The id of the element to remove the popover from. #' #'@templateVar item_name removePopover #'@templateVar family_name Tooltips_and_Popovers #'@template item_details #'@template footer #'@export removePopover <- function(session, id) { session$sendCustomMessage(type="updateTooltipOrPopover", list(action = "remove", type = "popover", id = id)) }shinyBS/R/updateButton.R0000644000176200001440000000245715116525674014657 0ustar liggesusers#'updateButton #' #'\code{updateButton} is used in your Server logic to update the style or state #'of a button. #' #'@inheritParams bsButton #'@param session The session object passed to function given to shinyServer. #' #'@details Because of the way it is coded, \code{updateButton} may work on buttons not #'created by \code{\link{bsButton}} such as \code{\link[shiny:submitButton]{submitButton}}. #' #'See \code{\link{Buttons}} for more information about how to use \code{updateButton} with the rest of the Buttons family. #' #'@templateVar item_name updateButton #'@templateVar family_name Buttons #'@template item_details #'@template footer #'@export updateButton <- function(session, inputId, label = NULL, icon = NULL, value = NULL, style = NULL, size = NULL, block = NULL, disabled = NULL) { if(!is.null(icon)) icon <- as.character(icon) if(!is.null(size)) { size <- switch(size, "extra-small" = "btn-xs", "small" = "btn-sm", "large" = "btn-lg", "default" = "default") } data <- dropNulls(list(id = inputId, label = label, icon = icon, value = value, style = style, size = size, block = block, disabled = disabled)) session$sendCustomMessage("bsButtonUpdate", data) }shinyBS/R/Collapses.R0000644000176200001440000000537115116525503014113 0ustar liggesusers#'Collapses #' #' 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. #' #'@section Components: #' \describe{ #' \item{\code{\link{bsCollapse}}}{A container for holder the individual panels created by \code{\link{bsCollapsePanel}}.} #' \item{\code{\link{bsCollapsePanel}}}{Creates an individual Collapse Panel that resides within a \code{\link{bsCollapse}}.} #' \item{\code{\link{updateCollapse}}}{Used within your server logic to open/close collapse panels or change their style.} #'} #' #'@details #'Collapses are designed to mimic \code{\link[shiny:tabsetPanel]{tabsetPanel}} in their implementation. #'Start with \code{bsCollapse} to create a panel group, then fill it with panels #'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[shiny:shinyServer]{shinyServer}}. #' #'\code{updateCollapse} can be used within your server logic to open/close #'collapse panels or to change their style. #' #'@section Changes: #'\code{style} is a new option that wasn't available in previous versions of #'shinyBS. #' #'@examples #'library(shiny) #'library(shinyBS) #' #'app = shinyApp( #' ui = #' 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") #' ) #' ) #' ) #' ), #' server = #' function(input, output, session) { #' output$genericPlot <- renderPlot(plot(rnorm(100))) #' observeEvent(input$p1Button, ({ #' updateCollapse(session, "collapseExample", open = "Panel 1") #' })) #' observeEvent(input$styleSelect, ({ #' updateCollapse(session, "collapseExample", style = list("Panel 1" = input$styleSelect)) #' })) #' } #') #'\dontrun{ #' runApp(app) #'} #'@templateVar item_name Collapses #'@templateVar family_name Collapses #'@template footer NULL shinyBS/R/bsModal.R0000644000176200001440000000466015116513141013542 0ustar liggesusers#'bsModal #' #'\code{bsModal} is used within the UI to create a modal window. #' #'@param id A unique identifier for the modal window #'@param title The title to appear at the top of the modal #'@param trigger The id of a button or link that will open the modal. #'@param \dots UI elements to include within the modal #'@param size \bold{Optional} What size should the modal be? (\code{small} or \code{large}) #'@param footer A \code{list} of shiny UI elements to be added to the footer of the modal. #'@param close.button Should a close button be added to the footer of the modal? #'@param width An optional width argument for the modal. Must include units. Only applied if \code{size} is missing. #'@templateVar item_name bsModal #'@templateVar family_name Modals #'@template item_details #'@template footer #'@export bsModal <- function(id, title, trigger, ..., size, footer = NULL, close.button = TRUE, width = NULL) { if(!missing(size)) { if(size == "large") { size = "modal-lg" } else if(size == "small") { size = "modal-sm" } size <- paste("modal-dialog", size) width = NULL } else { size <- "modal-dialog" } if(is.null(footer)) { footer <- tagList() } if(close.button) { footer <- shiny::tagAppendChild(footer, tagList(shiny::tags$button(type = "button", class = "btn btn-default", "data-dismiss" = "modal", "Close"))) } bsTag <- shiny::tags$div(class = size, shiny::tags$div(class = "modal-content", shiny::tags$div(class = "modal-header", shiny::tags$button(type = "button", class = "close", "data-dismiss" = "modal", shiny::tags$span(shiny::HTML("×"))), shiny::tags$h4(class = "modal-title", title) ), shiny::tags$div(class = "modal-body", list(...)), shiny::tags$div(class = "modal-footer", footer ) ) ) if(!is.null(width)) { bsTag <- addAttribs(bsTag, style = paste0("width: ", width, " !important;")) } bsTag <- shiny::tags$div(class = "modal sbs-modal fade", id = id, tabindex = "-1", "data-sbs-trigger" = trigger, bsTag ) htmltools::attachDependencies(bsTag, shinyBSDep) } shinyBS/R/removeTooltip.R0000644000176200001440000000112015116513141015015 0ustar liggesusers#'removeTooltip #' #'\code{removeTooltip} is used within the Server logic of an app to remove an #'existing tooltip from a Shiny input or output. #' #'@param session The session object passed to function given to shinyServer. #'@param id The id of the element to remove the tooltip from. #' #'@templateVar item_name removeTooltip #'@templateVar family_name Tooltips_and_Popovers #'@template item_details #'@template footer #'@export removeTooltip <- function(session, id) { session$sendCustomMessage(type="updateTooltipOrPopover", list(action = "remove", type = "tooltip", id = id)) }shinyBS/R/misc.R0000644000176200001440000000171015116513141013105 0ustar liggesusers.onAttach <- function(...) { # Create link to javascript and css files for package shiny::addResourcePath("sbs", system.file("www", package="shinyBS")) } shinyBSDep <- htmltools::htmlDependency("shinyBS", packageVersion("shinyBS"), src = c("href" = "sbs"), script = "shinyBS.js", stylesheet = "shinyBS.css") typeaheadDep <- htmltools::htmlDependency("shinyBS", packageVersion("shinyBS"), src = c("href" = "sbs"), script = c("bootstrap3-typeahead.js", "typeahead_inputbinding.js")); # Copy of dropNulls function for shiny to avoid using shiny:::dropNulls dropNulls <- function(x) { x[!vapply(x, is.null, FUN.VALUE = logical(1))] } addAttribs <- function(tag, ...) { a <- list(...) for(i in seq(length(a))) { tag$attribs[names(a)[i]] = a[[i]] } return(tag) } removeAttribs <- function(tag, ...) { a <- list(...) for(i in seq(length(a))) { tags$attribs[a[[i]]] = NULL } return(tag) } getAttribs <- function(tag) { tag$attribs } shinyBS/R/closeAlert.R0000644000176200001440000000071415116513141014252 0ustar liggesusers#'closeAlert #' #'\code{closeAlert} is used within your Server logic to close an alert that you #'created with \code{\link{createAlert}}. #' #'@param alertId The id of the alert to be dismissed. #'@inheritParams createAlert #' #'@templateVar item_name closeAlert #'@templateVar family_name Alerts #'@template item_details #'@template footer #'@export closeAlert <- function(session, alertId) { session$sendCustomMessage(type="bsAlertClose", alertId) }shinyBS/R/bsCollapse.R0000644000176200001440000000307615116524476014265 0ustar liggesusers#'bsCollapse #' #'\code{bsCollapse} is used in your UI to create a collapse panel group. Use #'\code{\link{bsCollapsePanel}} to populate this object with panels. #' #'@param \dots \code{\link{bsCollapsePanel}} elements to include in the Collapse. #'@param 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. #'@param multiple Can more than one panel be open at a time? Defaults to \code{FALSE}. #'@param open The \code{value}, (or if none was supplied, the \code{title}) of #'the panel(s) you want open on load. #' #'@templateVar item_name bsCollapse #'@templateVar family_name Collapses #'@template item_details #'@template footer #' #'@importFrom stats runif #'@export bsCollapse <- function(..., id = NULL, multiple = FALSE, open = NULL) { if(is.null(id)) id = paste0("collapse", sprintf("%07i", as.integer(stats::runif(1, 1, 1000000)))) if(!multiple & length(open) > 1) { open <- open[1] } panels <- list(...) for(i in seq(length(panels))) { if(getAttribs(panels[[i]])$value %in% open) { panels[[i]]$children[[2]] <- addClass(panels[[i]]$children[[2]], "in") } if(!multiple) { panels[[i]]$children[[1]]$children[[1]]$children[[1]] <- addAttribs(panels[[i]]$children[[1]]$children[[1]]$children[[1]], 'data-parent' = paste0("#", id)) } } bsTag <- shiny::tags$div(class = "panel-group sbs-panel-group", "data-sbs-multi" = multiple, id=id, role = "tablist", panels) htmltools::attachDependencies(bsTag, shinyBSDep) } shinyBS/R/Buttons.R0000644000176200001440000000766115116525223013627 0ustar liggesusers#'Buttons #' #'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. #' #'@section Components: #'There are two functions in the Buttons family: #' \describe{ #' \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}}} #' } #' #'@details #'Create a button in the UI with \code{\link{bsButton}}. If \code{type = "action"} #'the button will behave like the standard \code{\link[shiny:actionButton]{actionButton}} in shiny. #'If \code{type = "toggle"} the button will behave like a \code{\link[shiny:checkboxInput]{checkboxInput}} #'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 #'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}} #'to enable the button allowing the user to proceed. Alternatively, you could set #'the button to \code{style = "success"} to let them know that the button is ready #'to be clicked. #' #'@section Changes: #'\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 = #' fluidPage( #' sidebarLayout( #' sidebarPanel( #' sliderInput("bins", #' "Move the slider to see its effect on the button below:", #' min = 1, #' max = 50, #' 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", #' block = TRUE, type = "toggle", value = TRUE), #' bsButton("actOne", label = "Block Action Button", block = TRUE) #' #' ), #' mainPanel( #' textOutput("exampleText") #' ) #' ) #' ), #' 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) { #' style = "warning" #' } else { #' style = "default" #' icon = icon("check") #' } #' #' updateButton(session, "actTwo", disabled = disabled, style = style, icon = icon) #' #' })) #' #' output$exampleText <- renderText({ #' input$actTwo #' b <- isolate(input$bins) #' txt = "" #' if((b > 5 & b < 15) | b > 35) { #' txt = "That was dangerous." #' } else if((b > 5 & b < 20) | b > 30) { #' txt = "I warned you about that." #' } else if(b >= 20 & b <= 30) { #' txt = "You have chosen... wisely." #' } #' return(txt) #' }) #' } #') #'\dontrun{ #' runApp(app) #'} #'@templateVar item_name Buttons #'@templateVar family_name Buttons #'@template footer NULLshinyBS/R/updateCollapse.R0000644000176200001440000000224515116513141015123 0ustar liggesusers#'updateCollapse #' #'\code{updateCollapse} is used within the Server logic of your Shiny app to #'modify a Collapse after load. #' #'@param session The session object passed to function given to shinyServer. #'@param id The id of the Collapse object you want to change. #'@param open A vector of \code{value} (or \code{title} if no \code{value} was #'provided) values identifying the panels you want to open. #'@param close A vector of \code{value} (or \code{title} if no \code{value} was #'provided) values identifying the panels you want to close. #'@param 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 #'\code{\link{bsCollapsePanel}} you want to change. #' #'@templateVar item_name updateCollapse #'@templateVar family_name Collapses #'@template item_details #'@template footer #'@export updateCollapse <- function(session, id, open = NULL, close = NULL, style = NULL) { data <- dropNulls(list(open = open, close = close, style = style)) session$sendInputMessage(id, data) }shinyBS/R/Tooltips_and_Popovers.R0000644000176200001440000001427615120510337016520 0ustar liggesusers#'Tooltips and Popovers #' #'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 #'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. #' #'@section Components: #'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 #' \code{\link[shiny:renderUI]{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 #' \code{\link[shiny:renderUI]{renderUI}}.} #' \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 #' to an element in your UI.} #' \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 #' popover from an element in your UI.} #' } #' #'@details #'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 #'within the UI or from within a \code{\link[shiny:renderUI]{renderUI}} in the Server logic. They #'also have the added advantage of not requiring that the UI element have an ID #'attribute. #' #'@note #'Tooltips and Popovers cannot contain shiny inputs or outputs. #' #'There must be at least one \code{shinyBS} component in the UI of your #'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 #'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. #' #'@section Changes: #'An \code{options} argument has been added to the creation functions to allow #'advanced users more control over how the tooltips and popovers appear. See #'the \href{https://getbootstrap.com}{Twitter Bootstrap 3 documentation} for more #'details. #' #'@examples #'library(shiny) #'library(shinyBS) #' #'app = shinyApp( #' ui = #' fluidPage( #' sidebarLayout( #' sidebarPanel( #' sliderInput("bins", #' "Number of bins:", #' min = 1, #' max = 50, #' value = 30), #' bsTooltip("bins", "The wait times will be broken into this many equally spaced bins", #' "right", options = list(container = "body")) #' ), #' mainPanel( #' plotOutput("distPlot"), #' uiOutput("uiExample") #' ) #' ) #' ), #' 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", #' "This button is pointless. It does not do anything!"), #' tipify(bsButton("pB2", "Button", style = "inverse", size = "extra-small"), #' "This button is pointless too!") #' ) #' }) #' addPopover(session, "distPlot", "Data", content = paste0("

Waiting time between ", #' "eruptions and the duration of the eruption for the Old Faithful geyser ", #' "in Yellowstone National Park, Wyoming, USA.

Azzalini, A. and ", #' "Bowman, A. W. (1990). A look at some data on the Old Faithful geyser. ", #' "Applied Statistics 39, 357-365.

"), trigger = 'click') #' } #') #'\dontrun{ #' runApp(app) #'} #'@templateVar item_name Tooltips_and_Popovers #'@templateVar family_name Tooltips_and_Popovers #'@template footer NULL ## These Functions are common to multiple tooltip and popover functions # Shared functions with really long names... createTooltipOrPopoverOnServer <- function(session, id, type, options) { data <- list(action = "add", type = type, id = id, options = options) session$sendCustomMessage(type = "updateTooltipOrPopover", data) } createTooltipOrPopoverOnUI <- function(id, type, options) { options = paste0("{'", paste(names(options), options, sep = "': '", collapse = "', '"), "'}") bsTag <- shiny::tags$script(shiny::HTML(paste0("$(document).ready(function() {setTimeout(function() {shinyBS.addTooltip('", id, "', '", type, "', ", options, ")}, 500)});"))) htmltools::attachDependencies(bsTag, shinyBSDep) } buildTooltipOrPopoverOptionsList <- function(title, placement, trigger, options, content) { if(is.null(options)) { options = list() } if(!missing(content)) { content <- gsub("'", "'", content, fixed = TRUE) if(is.null(options$content)) { options$content = shiny::HTML(content) } } if(is.null(options$placement)) { options$placement = placement } if(is.null(options$trigger)) { if(length(trigger) > 1) trigger = paste(trigger, collapse = " ") options$trigger = trigger } if(is.null(options$title)) { options$title = title options$title <- gsub("'", "'", options$title, fixed = TRUE) } return(options) } shinyBS/R/bsTypeahead.R0000644000176200001440000000362515116524450014417 0ustar liggesusers#'bsTypeahead #' #'\code{bsTypeahead} creates a textinput with type ahead function buttons. #' #'@param inputId Input variable to assign the control's value to #'@param label Display label for the control #'@param value Initial value #'@param choices Array of strings to match against. Can also be JavaScript #' function. Use htmlwidgets::JS() to indicate JavaScript. The length of \code{choices} must no exceed 131370. #'@param items The max number of items to display in the dropdown. Can also be #' set to 'all' #'@param minLength The minimum character length needed before triggering #' autocomplete suggestions. You can set it to 0 so suggestion are shown even #' when there is no text when lookup function is called. #'@seealso \code{\link{updateTypeahead}} #' #'@importFrom shiny tagList #' #'@export bsTypeahead <- function(inputId, label, value = "", choices, items = 8, minLength = 1) { if(!is.null(choices)) { if(length(choices) > 131370) { warning("Due to a limitation of the Bootstrap2 Typeahead JavaScript library the length of 'choices' must not exceed 2 ^ 17 - 2!"); } } if(!'JS_EVAL' %in% class(choices)) { choices <- jsonlite::toJSON(choices); } typeahead <- shiny::tagList( shiny::div(class = 'form-group shiny-input-container', shiny::tags$label(label, `for` = inputId), shiny::tags$input(id = inputId, type="text", class="form-control shiny-bound-input typeahead", "data-provide" = "typeahead", autocomplete="off", value = value), shiny::tags$script(paste0("$('#", inputId, "').typeahead({source: ", choices, ", items: ", items, ", minLength: ", minLength, "})")) ) ) htmltools::attachDependencies(typeahead, typeaheadDep) }shinyBS/R/updateTypeahead.R0000644000176200001440000000162215116523774015300 0ustar liggesusers#'updateTypeahead #' #'\code{updateTypeahead} Update a bsTypeahead buttons. #'@param session The session object passed to function given to shinyServer. #'@param inputId Input variable to assign the control's value to #'@param label Display label for the control #'@param value Initial value #'@param choices Array of strings to match against. Can also be JavaScript #' function. Use htmlwidgets::JS() to indicate JavaScript. #'@seealso \code{\link{bsTypeahead}} #'@export updateTypeahead<- function(session, inputId, label=NULL, value=NULL, choices=NULL) { if(!is.null(choices)) { if(length(choices) > 131370) { warning("Due to a limitation of the Bootstrap2 Typeahead JavaScript library the length of 'choices' must not exceed 2 ^ 17 - 2!"); } } data <- dropNulls(list(id = inputId, label=label, value=value, choices=choices)) session$sendCustomMessage("typeaheadUpdate", data) } shinyBS/R/addTooltip.R0000644000176200001440000000212315116513141014254 0ustar liggesusers#'addTooltip #' #'\code{addTooltip} is used within the Server logic of an app to add a tooltip to a Shiny #'input or output. #' #'@param session The session object passed to function given to shinyServer. #'@param id The id of the element to attach the tooltip to. #'@param title The content of the tooltip. #'@param placement Where the tooltip should appear relative to its target #'(\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}. #'@param trigger What action should cause the tooltip to appear? (\code{hover}, #'\code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}. #'@param options A named list of additional options to be set on the tooltip. #' #'@templateVar item_name addTooltip #'@templateVar family_name Tooltips_and_Popovers #'@template item_details #'@template footer #'@export addTooltip <- function(session, id, title, placement = "bottom", trigger = "hover", options = NULL) { options <- buildTooltipOrPopoverOptionsList(title, placement, trigger, options) createTooltipOrPopoverOnServer(session, id, "tooltip", options) }shinyBS/R/tagManipulators.R0000644000176200001440000000351315116513141015327 0ustar liggesusersaddClass <- function(tag, class) { if(!is.null(class)) { tag$attribs$class <- trimws(paste(tag$attribs$class, class), "both") } tag } removeClass <- function(tag, class) { if(!is.null(class) & !is.null(tag$attribs$class)) { cls <- strsplit(tag$attribs$class, " ")[[1]] cls <- cls[cls != class] tag$attribs$class <- paste(cls, collapse = " ") } tag } hasClass <- function(tag, class) { if(!is.null(class) & !is.null(tag$attribs$class)) { class %in% strsplit(tag$attribs$class, " ")[[1]] } else { FALSE } } checkClass <- function(class, include) { if(!include) class <- NULL class } buildClass <- function(prefix, variable) { if(!is.null(variable)) { variable <- paste0(prefix, variable) } variable } addStyles <- function(tag, ..., .dots) { new_styles <- list(...) if(!missing(.dots)) { new_styles <- c(new_styles, .dots) } if(!is.null(tag$attribs$style)) { styles <- parseStyles(tag$attribs$style) } else { styles <- list() } for(i in seq_along(new_styles)) { styles[[names(new_styles)[i]]] <- new_styles[[i]] } tag$attribs$style <- writeStyles(styles) tag } removeStyles <- function(tag, ...) { if(!is.null(tag$attribs$style)) { styleList <- list(...) styles <- parseStyles(tag$attribs$style) styles <- styles[!names(styles) %in% styleList] tag$attribs$style <- writeStyles(styles) } tag } parseStyles <- function(styleString) { styles <- trimws(strsplit(styleString, ";")[[1]]) styles <- strsplit(styles, ":") style_names <- sapply(styles, function(s) trimws(s[1])) styles <- lapply(styles, function(s) trimws(s[2])) names(styles) <- style_names return(styles) } writeStyles <- function(styleList) { paste(names(styleList), styleList, sep = ": ", collapse = "; ") } shinyBS/R/bsButton.R0000644000176200001440000000352015116513141013753 0ustar liggesusers#'bsButton #' #'\code{bsButton} is used in your UI script to create customizable action and toggle #'buttons. #' #'@inheritParams shiny::actionButton #'@param style A Bootstrap style to apply to the button. (\code{default}, \code{primary}, #'\code{success}, \code{info}, \code{warning}, or \code{danger}) #'@param size The size of the button (\code{extra-small}, \code{small}, #'\code{default}, or \code{large}) #'@param type The type of button to create. (\code{action} or \code{toggle}) #'@param block \bold{logical} Should the button take the full width of the parent element? #'@param disabled \bold{logical} Should the button be disabled (un-clickable)? #'@param value \bold{logical} If \code{type = "toggle"}, the initial value of the button. #' #'@templateVar item_name bsButton #'@templateVar family_name Buttons #'@template item_details #'@template footer #'@export bsButton <- function(inputId, label, icon = NULL, ..., style = "default", size = "default", type = "action", block = FALSE, disabled = FALSE, value = FALSE) { btn <- shiny::actionButton(inputId, label, icon, ...) if(type == "toggle") { btn <- removeClass(btn, "action-button") btn <- addClass(btn, "sbs-toggle-button") if(value == TRUE) { btn <- addClass(btn, "active") } } if(style != "default") { btn <- removeClass(btn, "btn-default") btn <- addClass(btn, paste0("btn-", style)) } size <- switch(size, "extra-small" = "btn-xs", "small" = "btn-sm", "large" = "btn-lg", "default") if(size != "default") { btn <- addClass(btn, size) } if(block == TRUE) { btn <- addClass(btn, "btn-block") } if(disabled) { btn <- addAttribs(btn, disabled = "disabled") } htmltools::attachDependencies(btn, shinyBSDep) }shinyBS/R/bsAlert.R0000644000176200001440000000125015116525407013555 0ustar liggesusers#'bsAlert #' #'\code{bsAlert} creates an anchor point in your UI definition. This anchor point #'is where alerts created in your Server logic will be displayed. #' #'@param anchorId A unique id the identifies the anchor. #'@param inline Logical value, determmines the class of the alert. Defaults to #'TRUE. #' #'@templateVar item_name bsAlert #'@templateVar family_name Alerts #'@template item_details #'@template footer #'@export bsAlert <- function(anchorId, inline = TRUE) { class <- "sbs-alert" if(!inline) class = paste(class, "sbs-alert-hover") bsTag <- shiny::tags$div(class = class, id = anchorId, " ") htmltools::attachDependencies(bsTag, shinyBSDep) } shinyBS/R/Alerts.R0000644000176200001440000000556615116513141013421 0ustar liggesusers#'Alerts #' #'Alerts allow you to communicate information to the user on the fly. Standard #'Bootstrap styling options give the user a hint at the type of information #'contained in the Alert. #' #'@section Components: #'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 #' 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, #' but this offers you a way to close them programmatically.} #' } #' #'@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}. #' #'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 #'change. #' #'@section Changes: #'\code{style} was called \code{type} in previous versions of shinyBS. #' #'\code{anchorId} was called \code{inputId} in previous versions of shinyBS. #' #'\code{content} was called \code{message} in previous versions of shinyBS. #' #'@examples #' #'library(shiny) #'library(shinyBS) #'app = shinyApp( #' ui = #' fluidPage( #' sidebarLayout( #' sidebarPanel(textInput("num1", NULL, value = 100), #' "divided by", textInput("num2", NULL, value = 20), #' "equals", textOutput("exampleOutput")), #' mainPanel( #' bsAlert("alert") #' ) #' ) #' ), #' 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", #' content = "Both inputs should be numeric.", append = FALSE) #' } else if(num2 == 0) { #' createAlert(session, "alert", "exampleAlert", title = "Oops", #' content = "You cannot divide by 0.", append = FALSE) #' } else { #' closeAlert(session, "exampleAlert") #' return(num1/num2) #' } #' #' }) #' } #') #' #'\dontrun{ #' runApp(app) #'} #'@templateVar item_name Alerts #'@templateVar family_name Alerts #'@template footer NULLshinyBS/R/bsExample.R0000644000176200001440000000252115116525723014104 0ustar liggesusers#'bsExample #' #'A function to view examples of shinyBS functionality. Will run the examples #'found in the examples sections of shinyBS documentation. Use this instead of #'\code{example}. #' #'@param family A shinyBS family name #'@param display.mode The display mode to use when running the example. See #'\code{\link[shiny:runApp]{runApp}}. #'@param \dots Other parameters to pass to \code{\link[shiny:runApp]{runApp}}. #' #'@details #'This function is just a wrapper for \code{\link[shiny:runApp]{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 #'the app is running. #' #'@examples #'\dontrun{ #' bsExample("Alerts")} #'@export bsExample <- function(family, display.mode = "showcase", ...) { exp <- system.file("examples", package="shinyBS") fams <- list.dirs(exp, full.names = FALSE, recursive = FALSE) appname <- gsub(" ", "", family, fixed = TRUE) appname <- gsub("_", "", appname, fixed = TRUE) if(appname %in% fams) { appname <- normalizePath(paste0(exp, "/", appname)) shiny::runApp(appname, display.mode = display.mode, ...) } else { stop("Could not find shinyBS family: ", family, "\nAvailable families are: ", paste0(fams, collapse = ", ")) } }shinyBS/R/addPopover.R0000644000176200001440000000222115116513141014253 0ustar liggesusers#'addPopover #' #'\code{addPopover} is used within the Server logic of an app to add a popover to a Shiny #'input or output. #' #'@param session The session object passed to function given to shinyServer. #'@param id The id of the element to attach the popover to. #'@param title The title of the popover. #'@param content The main content of the popover. #'@param placement Where the popover should appear relative to its target #'(\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{bottom}. #'@param trigger What action should cause the popover to appear? (\code{hover}, #'\code{focus}, \code{click}, or \code{manual}). Defaults to \code{hover}. #'@param options A named list of additional options to be set on the popover. #' #'@templateVar item_name addPopover #'@templateVar family_name Tooltips_and_Popovers #'@template item_details #'@template footer #'@export addPopover <- function(session, id, title, content, placement = "bottom", trigger = "hover", options = NULL) { options <- buildTooltipOrPopoverOptionsList(title, placement, trigger, options, content) createTooltipOrPopoverOnServer(session, id, "popover", options) }shinyBS/R/bsPopover.R0000644000176200001440000000204215116513141014130 0ustar liggesusers#'bsPopover #' #'\code{bsPopover} is used within the UI of an app to add a popover to a Shiny #'input or output. #' #'@param id The id of the element to attach the popover to. #'@param title The title of the popover. #'@param content The main content of the popover. #'@param placement Where the popover should appear relative to its target #'(\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}. #'@param trigger What action should cause the popover to appear? (\code{hover}, #'\code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}. #'@param options A named list of additional options to be set on the popover. #' #'@templateVar item_name bsPopover #'@templateVar family_name Tooltips_and_Popovers #'@template item_details #'@template footer #'@export bsPopover <- function(id, title, content, placement="bottom", trigger="hover", options = NULL) { options = buildTooltipOrPopoverOptionsList(title, placement, trigger, options, content) createTooltipOrPopoverOnUI(id, "popover", options) }shinyBS/R/popify.R0000644000176200001440000000247015116525647013502 0ustar liggesusers#'popify #' #'\code{popify} can be wrapped around any shiny UI element to add a popover to the #'wrapped element. This should be a safer way to add popovers to elements created with #'\code{\link[shiny:renderUI]{renderUI}}. #' #'@param el A shiny UI element. #'@param title The title of the popover. #'@param content The main content of the popover. #'@param placement Where the popover should appear relative to its target #'(\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}. #'@param trigger What action should cause the popover to appear? (\code{hover}, #'\code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}. #'@param options A named list of additional options to be set on the popover. #' #'@templateVar item_name popify #'@templateVar family_name Tooltips_and_Popovers #'@template item_details #'@template footer #'@export popify <- function(el, title, content, placement="bottom", trigger="hover", options = NULL) { id <- el$attribs$id if(is.null(id)) { id <- paste0("tipify", as.integer(runif(1, 1, 10000000))) el <- addAttribs(el, id = id) } options = buildTooltipOrPopoverOptionsList(title, placement, trigger, options, content) script <- createTooltipOrPopoverOnUI(id, "popover", options) return(shiny::tagList(el, script)) } shinyBS/R/bsCollapsePanel.R0000644000176200001440000000306615116513141015227 0ustar liggesusers#'bsCollapsePanel #' #'\code{bsCollapsePanel} creates individual panels within a \code{\link{bsCollapse}} object. #' #'@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} 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}) #' #'@templateVar item_name bsCollapsePanel #'@templateVar family_name Collapses #'@template item_details #'@template footer #'@export bsCollapsePanel <- function(title, ..., value = title, style = NULL) { content <- list(...) id <- paste0("cpanel", sprintf("%07i", as.integer(stats::runif(1, 1, 1000000)))) if(is.null(value)) { value = title } if(is.null(style)) { style = "default" } bsTag <- shiny::tags$div(class = paste0("panel panel-", style), value = value, shiny::tags$div(class = "panel-heading", role = "tab", id = paste0("heading_", id), shiny::tags$h4(class = "panel-title", shiny::tags$a("data-toggle" = "collapse", href = paste0("#", id), title) ) ), shiny::tags$div(id = id, class = "panel-collapse collapse", role = "tabpanel", shiny::tags$div(class = "panel-body", content) ) ) htmltools::attachDependencies(bsTag, shinyBSDep) } shinyBS/R/tipify.R0000644000176200001440000000236515116525647013503 0ustar liggesusers#'tipify #' #'\code{tipify} can be wrapped around any shiny UI element to add a tooltip to the #'wrapped element. This should be a safer way to add tooltips to elements created with #'\code{\link[shiny:renderUI]{renderUI}}. #' #'@param el A shiny UI element. #'@param title The content of the tooltip. #'@param placement Where the tooltip should appear relative to its target #'(\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}. #'@param trigger What action should cause the tooltip to appear? (\code{hover}, #'\code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}. #'@param options A named list of additional options to be set on the tooltip. #' #'@templateVar item_name tipify #'@templateVar family_name Tooltips_and_Popovers #'@template item_details #'@template footer #'@export tipify <- function(el, title, placement="bottom", trigger="hover", options = NULL) { id <- el$attribs$id if(is.null(id)) { id <- paste0("tipify", as.integer(runif(1, 1, 10000000))) el <- addAttribs(el, id = id) } options = buildTooltipOrPopoverOptionsList(title, placement, trigger, options) script <- createTooltipOrPopoverOnUI(id, "tooltip", options) return(shiny::tagList(el, script)) } shinyBS/R/toggleModal.R0000644000176200001440000000112315116513141014406 0ustar liggesusers#'toggleModal #' #'\code{toggleModal} is used within your Server logic to open or close a modal #'window. #' #'@param session The session object passed to function given to shinyServer. #'@param modalId The id of the modal window you want to open/close #'@param toggle Should the modal window \code{open}, \code{close}, or \code{toggle}? #' #'@templateVar item_name toggleModal #'@templateVar family_name Modals #'@template item_details #'@template footer #'@export toggleModal <- function(session, modalId, toggle = "toggle") { session$sendInputMessage(modalId, list(toggle = toggle)) }shinyBS/NAMESPACE0000644000176200001440000000076515116524506013065 0ustar liggesusers# Generated by roxygen2: do not edit by hand export(addPopover) export(addTooltip) export(bsAlert) export(bsButton) export(bsCollapse) export(bsCollapsePanel) export(bsExample) export(bsModal) export(bsPopover) export(bsTooltip) export(bsTypeahead) export(closeAlert) export(createAlert) export(popify) export(removePopover) export(removeTooltip) export(tipify) export(toggleModal) export(updateButton) export(updateCollapse) export(updateTypeahead) importFrom(shiny,tagList) importFrom(stats,runif) shinyBS/NEWS.md0000644000176200001440000000025115154257254012737 0ustar liggesusers# shinyBS 0.64.0 * Included a fix for a broken `bsModal`, which broke upon Shiny >= 1.12.1 # shinyBS 0.63.0 * Added a `NEWS.md` file to track changes to the package. shinyBS/inst/0000755000176200001440000000000015116513141012604 5ustar liggesusersshinyBS/inst/tests/0000755000176200001440000000000015116513141013746 5ustar liggesusersshinyBS/inst/tests/tipify_test2.R0000644000176200001440000000333015116513141016515 0ustar liggesuserslibrary(shiny) library(shinyBS) app <- shinyApp( ui = 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") ), uiOutput("tooltip_test"), actionButton("test2", "Test2"), bsTooltip("test2", title = "Test2", placement="right"), tipify(tags$button("Hello"), "Test without ID") ) ) ), server = function(input, output, session) { output$genericPlot <- renderPlot(plot(rnorm(100))) observeEvent(input$p1Button, ({ updateCollapse(session, "collapseExample", open = "Panel 1") })) observeEvent(input$styleSelect, ({ updateCollapse(session, "collapseExample", style = list("Panel 1" = input$styleSelect)) })) output$tooltip_test <- renderUI({ tipify(actionButton("test", "Test"), title = "test", placement = "right") }) } ) runApp(app)shinyBS/inst/tests/tipify_test.R0000644000176200001440000000206115116513141016433 0ustar liggesuserslibrary(shiny) library(shinyBS) shinyApp( ui = fluidPage( tabsetPanel( tabPanel("Tab #1", plotOutput("genericPlot") ), tabPanel("Tab #2", checkboxInput("showOptions", "Show Options"), uiOutput("ui_multiview_customize"), plotOutput("multiview_plot") ) ) ), server = function(input, output, session) { output$genericPlot <- renderPlot(plot(rnorm(1000))) output$multiview_plot <- renderPlot(plot(runif(1000))) output$ui_multiview_customize <- renderUI({ if(input$showOptions) { bsCollapse( bsCollapsePanel(title = "View Options", checkboxInput("multiview_checkbox", label = "Include warmup", value = FALSE), hr(), tipify(downloadButton("download_multiview", "Save as ggplot2 objects"), title = "Save ggplot2 object in .RData file.", placement="right") ) ) } }) } ) shinyBS/inst/www/0000755000176200001440000000000015156520320013431 5ustar liggesusersshinyBS/inst/www/shinyBS.js0000644000176200001440000002002215156520320015342 0ustar liggesusersvar shinyBS = {inputBindings: {}}; shinyBS.inputBindings.toggle = new Shiny.InputBinding(); $.extend(shinyBS.inputBindings.toggle, { find: function(scope) { return $(scope).find(".sbs-toggle-button"); }, getValue: function(el) { return $(el).hasClass("active"); }, subscribe: function(el, callback) { $(el).on("click", function(e) { $(el).toggleClass("active").blur(); callback(); }) }, unsubscribe: function(el) { $(el).off("click"); } }); Shiny.inputBindings.register(shinyBS.inputBindings.toggle) shinyBS.inputBindings.modal = new Shiny.InputBinding(); $.extend(shinyBS.inputBindings.modal, { find: function(scope) { return $(scope).find(".sbs-modal"); }, getValue: function(el) { return $(el).hasClass("in"); }, subscribe: function(el, callback) { $(el).on("hidden.bs.modal shown.bs.modal", () => callback(true)); }, unsubscribe: function(el) { $(el).off("hidden.bs.modal shown.bs.modal") }, receiveMessage: function(el, data) { if(data.hasOwnProperty("toggle")) { if(data.toggle == "show") { $(el).modal("show"); } else if(data.toggle == "hide") { $(el).modal("hide"); } else { $(el).modal("toggle"); } }; }, initialize: function(el) { $("#" + $(el).attr("data-sbs-trigger")).attr({"data-toggle": "modal", "data-target": "#" + $(el).attr("id")}); } }); Shiny.inputBindings.register(shinyBS.inputBindings.modal); shinyBS.inputBindings.collapse = new Shiny.InputBinding(); $.extend(shinyBS.inputBindings.collapse, { find: function(scope) { return $(scope).find(".sbs-panel-group"); }, getValue: function(el) { return $(el).data("sbs-value"); }, receiveMessage: function(el, data) { var $el = $(el); /* I would think this code should work, but it doesn't for some reason so I am commenting it out. if(data.hasOwnProperty('multiple')) { if(data.multiple) { $el.find(".collapse").each(function(i) {$(this).collapse({parent: false, toggle: false})}); } else { $el.find(".collapse").each(function(i) {$(this).collapse({parent: "#"+$el.attr("id"), toggle: false})}); } } */ if(data.hasOwnProperty('style')) { var panels = Object.keys(data.style) for(var i = 0; i < panels.length; i++) { var $p = $el.find("div[value='" + panels[i] + "']") $p .removeClass("panel-primary panel-danger panel-warning panel-error panel-info panel-success") .addClass("panel-" + data.style[panels[i]]); } } if(data.hasOwnProperty('open')) { if(!Array.isArray(data.open)) { data.open = [data.open] } data.open.forEach(function(value, index, array) { $el.find("div[value='" + value + "'] > .panel-collapse").collapse("show"); }) } if(data.hasOwnProperty("close")) { if(!Array.isArray(data.close)) { data.close = [data.close]; } data.close.forEach(function(value, index, array) { $el.find("div[value='" + value + "'] > .panel-collapse").collapse("hide"); }) } }, subscribe: function(el, callback) { $(el).find(".collapse").on("shown.bs.collapse hidden.bs.collapse", () => callback(true)); }, initialize: function(el) { var $el = $(el); var $panels = $el.children(".panel"); var val = []; $panels.each(function(i) { if($(this).children("div.panel-collapse.collapse").hasClass("in")) { val.push($(this).attr("value")); } var $pan = $(this).children("div.panel-collapse.collapse"); if($el.attr("data-sbs-multi") == "FALSE") { var par = "#" + $el.attr("id"); } else { var par = false; } $pan.collapse({parent: par, toggle: false}); }); $el.data("sbs-value", val); $panels.on("show.bs.collapse", function(event) { var val = $el.data("sbs-value"); val.push($(this).attr("value")); $el.data("sbs-value", val) }); $panels.on("hide.bs.collapse", function(event) { var val = $el.data("sbs-value"); var i = val.indexOf($(this).attr("value")) if(i != -1) { val.splice(i, 1); $el.data("sbs-value", val); } }); } }) Shiny.inputBindings.register(shinyBS.inputBindings.collapse); Shiny.addCustomMessageHandler("bsAlertCreate", function(data) { var create = true; if(data.hasOwnProperty("alertId")) { if($("#" + data.alertId).length > 0) { create = false; } } if(create) { var $alert = $("
"); if(data.hasOwnProperty('style')) { $alert.addClass("alert-" + data.style); } else { $alert.addClass("alert-info"); } if(data.hasOwnProperty("dismiss")) { $alert.addClass("alert-dismissable"); } if(data.hasOwnProperty("alertId")) { $alert.attr("id", data.alertId); } if(data.hasOwnProperty('dismiss')) { if(data.dismiss == true) { $alert.append("") } } if(data.hasOwnProperty('title')) { $alert.append("

" + data.title + "

"); } if(data.hasOwnProperty("content")) { $alert.append(data.content); } if(data.append == true) { $alert.appendTo("#" + data.id); } else { $("#" + data.id).html($alert); } } }); Shiny.addCustomMessageHandler("bsAlertClose", function(alertId) { $("#" + alertId).alert('close'); }); // The following function refer to tooltips but are used in the creation of // tooltips and popovers because there structure is so similar. type="popover" // will create a popover. shinyBS.addTooltip = function(id, type, opts) { var $id = shinyBS.getTooltipTarget(id); var dopts = {html: true}; opts = $.extend(opts, dopts); if(type == "tooltip") { $id.tooltip("destroy"); $id.tooltip(opts); } else if(type == "popover") { $id.popover("destroy"); $id.popover(opts); } } shinyBS.removeTooltip = function(id, type) { var $id = shinyBS.getTooltipTarget(id); if(type == "tooltip") { $id.tooltip("destroy"); } else if(type == "popover") { $id.popover("destroy"); } } // Makes adjustments to the tooltip and popover targets for specialized // shiny inputs/outputs shinyBS.getTooltipTarget = function(id) { var $id = $("#" + id).closest(".shiny-input-container, .shiny-bound-output, .btn, .shiny-download-link"); /* if($id.hasClass("js-range-slider")) { $id = $id.parent(); } else if($id.hasClass("selectized")) { $id = $id.siblings("div.selectize-control") } */ return $id; } Shiny.addCustomMessageHandler("updateTooltipOrPopover", function(data) { if(data.action == "add") { shinyBS.addTooltip(data.id, data.type, data.options); } else if(data.action == "remove") { shinyBS.removeTooltip(data.id, data.type) } }) Shiny.addCustomMessageHandler("bsButtonUpdate", function(data) { var btn = $("button#" + data.id); var ico = btn.find("i"); if(ico.length > 0) { ico = ico[0].outerHTML; } else { ico = ""; }; if(data.hasOwnProperty("label")) { btn.html(ico + data.label); }; if(data.hasOwnProperty("icon")) { var ch = btn.children(); if(ch.length == 0) { btn.prepend(data.icon); } else { btn.find("i").replaceWith(data.icon); }; }; if(data.hasOwnProperty("value")) { if(btn.hasClass("sbs-toggle-button")) { if(data.value != btn.hasClass("active")) { btn.trigger("click"); }; }; }; if(data.hasOwnProperty("style")) { btn .removeClass("btn-default btn-primary btn-success btn-info btn-warning btn-danger btn-link") .addClass("btn-" + data.style); }; if(data.hasOwnProperty("size")) { btn.removeClass("btn-lg btn-sm btn-xs") if(data.size != "default") { btn.addClass(data.size); }; }; if(data.hasOwnProperty("block")) { btn.toggleClass("btn-block", data.block); }; if(data.hasOwnProperty("disabled")) { if(data.disabled) { btn.attr("disabled", "disabled") } else { btn.attr("disabled", false) }; }; }) shinyBS/inst/www/shinyBS.css0000644000176200001440000000025515116513141015523 0ustar liggesusers.sbs-alert-hover { position: absolute; z-index: 1000; width: 30%; margin-left: 35%; margin-top: 10px; opacity: 0.7; } .sbs-alert-hover:hover { opacity: 1.0; }shinyBS/inst/www/bootstrap3-typeahead.js0000644000176200001440000003127115116513141020034 0ustar liggesusers/* ============================================================= * bootstrap3-typeahead.js v3.1.0 * https://github.com/bassjobsen/Bootstrap-3-Typeahead * ============================================================= * Original written by @mdo and @fat * ============================================================= * Copyright 2014 Bass Jobsen @bassjobsen * * Licensed under the Apache License, Version 2.0 (the 'License'); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an 'AS IS' BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================ */ (function (root, factory) { 'use strict'; // CommonJS module is defined if (typeof module !== 'undefined' && module.exports) { module.exports = factory(require('jquery')); } // AMD module is defined else if (typeof define === 'function' && define.amd) { define(['jquery'], function ($) { return factory ($); }); } else { factory(root.jQuery); } }(this, function ($) { 'use strict'; // jshint laxcomma: true /* TYPEAHEAD PUBLIC CLASS DEFINITION * ================================= */ var Typeahead = function (element, options) { this.$element = $(element); this.options = $.extend({}, $.fn.typeahead.defaults, options); this.matcher = this.options.matcher || this.matcher; this.sorter = this.options.sorter || this.sorter; this.select = this.options.select || this.select; this.autoSelect = typeof this.options.autoSelect == 'boolean' ? this.options.autoSelect : true; this.highlighter = this.options.highlighter || this.highlighter; this.render = this.options.render || this.render; this.updater = this.options.updater || this.updater; this.displayText = this.options.displayText || this.displayText; this.source = this.options.source; this.delay = this.options.delay; this.$menu = $(this.options.menu); this.$appendTo = this.options.appendTo ? $(this.options.appendTo) : null; this.shown = false; this.listen(); this.showHintOnFocus = typeof this.options.showHintOnFocus == 'boolean' ? this.options.showHintOnFocus : false; this.afterSelect = this.options.afterSelect; this.addItem = false; }; Typeahead.prototype = { constructor: Typeahead, select: function () { var val = this.$menu.find('.active').data('value'); this.$element.data('active', val); if(this.autoSelect || val) { var newVal = this.updater(val); this.$element .val(this.displayText(newVal) || newVal) .change(); this.afterSelect(newVal); } return this.hide(); }, updater: function (item) { return item; }, setSource: function (source) { this.source = source; }, show: function () { var pos = $.extend({}, this.$element.position(), { height: this.$element[0].offsetHeight }), scrollHeight; scrollHeight = typeof this.options.scrollHeight == 'function' ? this.options.scrollHeight.call() : this.options.scrollHeight; (this.$appendTo ? this.$menu.appendTo(this.$appendTo) : this.$menu.insertAfter(this.$element)) .css({ top: pos.top + pos.height + scrollHeight , left: pos.left }) .show(); this.shown = true; return this; }, hide: function () { this.$menu.hide(); this.shown = false; return this; }, lookup: function (query) { var items; if (typeof(query) != 'undefined' && query !== null) { this.query = query; } else { this.query = this.$element.val() || ''; } if (this.query.length < this.options.minLength) { return this.shown ? this.hide() : this; } var worker = $.proxy(function() { if($.isFunction(this.source)) this.source(this.query, $.proxy(this.process, this)); else if (this.source) { this.process(this.source); } }, this); clearTimeout(this.lookupWorker); this.lookupWorker = setTimeout(worker, this.delay); }, process: function (items) { var that = this; items = $.grep(items, function (item) { return that.matcher(item); }); items = this.sorter(items); if (!items.length && !this.options.addItem) { return this.shown ? this.hide() : this; } if (items.length > 0) { this.$element.data('active', items[0]); } else { this.$element.data('active', null); } // Add item if (this.options.addItem){ items.push(this.options.addItem); } if (this.options.items == 'all') { return this.render(items).show(); } else { return this.render(items.slice(0, this.options.items)).show(); } }, matcher: function (item) { var it = this.displayText(item); return ~it.toLowerCase().indexOf(this.query.toLowerCase()); }, sorter: function (items) { var beginswith = [] , caseSensitive = [] , caseInsensitive = [] , item; while ((item = items.shift())) { var it = this.displayText(item); if (!it.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item); else if (~it.indexOf(this.query)) caseSensitive.push(item); else caseInsensitive.push(item); } return beginswith.concat(caseSensitive, caseInsensitive); }, highlighter: function (item) { var html = $('
'); var query = this.query; var i = item.toLowerCase().indexOf(query.toLowerCase()); var len, leftPart, middlePart, rightPart, strong; len = query.length; if(len === 0){ return html.text(item).html(); } while (i > -1) { leftPart = item.substr(0, i); middlePart = item.substr(i, len); rightPart = item.substr(i + len); strong = $('').text(middlePart); html .append(document.createTextNode(leftPart)) .append(strong); item = rightPart; i = item.toLowerCase().indexOf(query.toLowerCase()); } return html.append(document.createTextNode(item)).html(); }, render: function (items) { var that = this; var self = this; var activeFound = false; items = $(items).map(function (i, item) { var text = self.displayText(item); i = $(that.options.item).data('value', item); i.find('a').html(that.highlighter(text)); if (text == self.$element.val()) { i.addClass('active'); self.$element.data('active', item); activeFound = true; } return i[0]; }); if (this.autoSelect && !activeFound) { items.first().addClass('active'); this.$element.data('active', items.first().data('value')); } this.$menu.html(items); return this; }, displayText: function(item) { return item.name || item; }, next: function (event) { var active = this.$menu.find('.active').removeClass('active') , next = active.next(); if (!next.length) { next = $(this.$menu.find('li')[0]); } next.addClass('active'); }, prev: function (event) { var active = this.$menu.find('.active').removeClass('active') , prev = active.prev(); if (!prev.length) { prev = this.$menu.find('li').last(); } prev.addClass('active'); }, listen: function () { this.$element .on('focus', $.proxy(this.focus, this)) .on('blur', $.proxy(this.blur, this)) .on('keypress', $.proxy(this.keypress, this)) .on('keyup', $.proxy(this.keyup, this)); if (this.eventSupported('keydown')) { this.$element.on('keydown', $.proxy(this.keydown, this)); } this.$menu .on('click', $.proxy(this.click, this)) .on('mouseenter', 'li', $.proxy(this.mouseenter, this)) .on('mouseleave', 'li', $.proxy(this.mouseleave, this)); }, destroy : function () { this.$element.data('typeahead',null); this.$element.data('active',null); this.$element .off('focus') .off('blur') .off('keypress') .off('keyup'); if (this.eventSupported('keydown')) { this.$element.off('keydown'); } this.$menu.remove(); }, eventSupported: function(eventName) { var isSupported = eventName in this.$element; if (!isSupported) { this.$element.setAttribute(eventName, 'return;'); isSupported = typeof this.$element[eventName] === 'function'; } return isSupported; }, move: function (e) { if (!this.shown) return; switch(e.keyCode) { case 9: // tab case 13: // enter case 27: // escape e.preventDefault(); break; case 38: // up arrow // with the shiftKey (this is actually the left parenthesis) if (e.shiftKey) return; e.preventDefault(); this.prev(); break; case 40: // down arrow // with the shiftKey (this is actually the right parenthesis) if (e.shiftKey) return; e.preventDefault(); this.next(); break; } e.stopPropagation(); }, keydown: function (e) { this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27]); if (!this.shown && e.keyCode == 40) { this.lookup(); } else { this.move(e); } }, keypress: function (e) { if (this.suppressKeyPressRepeat) return; this.move(e); }, keyup: function (e) { switch(e.keyCode) { case 40: // down arrow case 38: // up arrow case 16: // shift case 17: // ctrl case 18: // alt break; case 9: // tab case 13: // enter if (!this.shown) return; this.select(); break; case 27: // escape if (!this.shown) return; this.hide(); break; default: this.lookup(); } e.stopPropagation(); e.preventDefault(); }, focus: function (e) { if (!this.focused) { this.focused = true; if (this.options.showHintOnFocus) { this.lookup(''); } } }, blur: function (e) { this.focused = false; if (!this.mousedover && this.shown) this.hide(); }, click: function (e) { e.stopPropagation(); e.preventDefault(); this.select(); this.$element.focus(); }, mouseenter: function (e) { this.mousedover = true; this.$menu.find('.active').removeClass('active'); $(e.currentTarget).addClass('active'); }, mouseleave: function (e) { this.mousedover = false; if (!this.focused && this.shown) this.hide(); } }; /* TYPEAHEAD PLUGIN DEFINITION * =========================== */ var old = $.fn.typeahead; $.fn.typeahead = function (option) { var arg = arguments; if (typeof option == 'string' && option == 'getActive') { return this.data('active'); } return this.each(function () { var $this = $(this) , data = $this.data('typeahead') , options = typeof option == 'object' && option; if (!data) $this.data('typeahead', (data = new Typeahead(this, options))); if (typeof option == 'string') { if (arg.length > 1) { data[option].apply(data, Array.prototype.slice.call(arg ,1)); } else { data[option](); } } }); }; $.fn.typeahead.defaults = { source: [] , items: 8 , menu: '' , item: '
  • ' , minLength: 1 , scrollHeight: 0 , autoSelect: true , afterSelect: $.noop , addItem: false , delay: 0 }; $.fn.typeahead.Constructor = Typeahead; /* TYPEAHEAD NO CONFLICT * =================== */ $.fn.typeahead.noConflict = function () { $.fn.typeahead = old; return this; }; /* TYPEAHEAD DATA-API * ================== */ $(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) { var $this = $(this); if ($this.data('typeahead')) return; $this.typeahead($this.data()); }); })); shinyBS/inst/www/typeahead_inputbinding.js0000644000176200001440000000354315116513141020511 0ustar liggesusers//Creates input binding for TypeAhead Objects var typeAheadBinding = new Shiny.InputBinding(); $.extend(typeAheadBinding, { find: function(scope) { return $(scope).find('.typeahead'); }, getId: function(el) { return Shiny.InputBinding.prototype.getId.call(this, el) || el.name; }, getValue: function(el) { return el.value; }, setValue: function(el, value) { el.value = value; }, initialize: function(el) { $(el).typeahead(); }, subscribe: function(el, callback) { $(el).on('keyup.typeAheadBinding input.typeAheadBinding', function(event) { callback(true); }); $(el).on('change.typeAheadBinding', function(event) { callback(false); }); }, unsubscribe: function(el) { $(el).off('.typeAheadBinding'); }, receiveMessage: function(el, data) { if (data.hasOwnProperty('value')) { this.setValue(el, data.value); }; if (data.hasOwnProperty('label')) { $(el).parent().find('label[for=' + el.id + ']').text(data.label); }; if (data.hasOwnProperty('choices')) { $(el).data('typeahead').source = data.choices; }; $(el).trigger('change'); }, getState: function(el) { return { label: $(el).parent().find('label[for=' + el.id + ']').text(), value: el.value }; }, getRatePolicy: function() { return { policy: 'debounce', delay: 250 }; } }); Shiny.inputBindings.register(typeAheadBinding); Shiny.addCustomMessageHandler("typeaheadUpdate", function(data) { var typeahead = $("input#" + data.id); if (data.hasOwnProperty('value')) { typeahead[0].value = data.value; }; if (data.hasOwnProperty('label')) { typeahead.parent().find('label[for=' + data.id + ']').text(data.label); }; if (data.hasOwnProperty('choices')) { typeahead.data('typeahead').source = data.choices; }; typeahead.trigger('change'); })shinyBS/inst/examples/0000755000176200001440000000000015116513141014422 5ustar liggesusersshinyBS/inst/examples/TooltipsandPopovers/0000755000176200001440000000000015116513141020460 5ustar liggesusersshinyBS/inst/examples/TooltipsandPopovers/ui.R0000644000176200001440000000150615116513141021222 0ustar liggesuserslibrary(shiny) library(shinyBS) fluidPage( sidebarLayout( sidebarPanel( sliderInput("bins", "Number of bins:", min = 1, max = 50, value = 30), selectInput("pointlessSelect", "Pointless Select", choices = c("A", "B", "C"), selectize = FALSE), bsTooltip("pointlessSelect", "This is another pointless input element, its just here to look pretty."), bsTooltip("bins", "The wait times will be broken into this many equally spaced bins", "right", options = list(container = "body")) ), mainPanel( plotOutput("distPlot"), dataTableOutput("dataTable"), uiOutput("uiExample"), bsPopover("dataTable", "A popover", "This is a popover. I hope it works.", placement = "left") ) ) ) shinyBS/inst/examples/TooltipsandPopovers/server.R0000644000176200001440000000231415116513141022111 0ustar liggesuserslibrary(shiny) library(shinyBS) shinyServer( 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$dataTable <- renderDataTable({ faithful }) output$uiExample <- renderUI({ tags$span( 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!") ) }) addPopover(session, "distPlot", "Data", content = paste0("

    Waiting time between ", "eruptions and the duration of the eruption for the Old Faithful geyser ", "in Yellowstone National Park, Wyoming, USA.

    Azzalini, A. and ", "Bowman, A. W. (1990). A look at some data on the Old Faithful geyser. ", "Applied Statistics 39, 357-365.

    "), trigger = 'click') } ) shinyBS/inst/examples/Collapses/0000755000176200001440000000000015116513141016347 5ustar liggesusersshinyBS/inst/examples/Collapses/ui.R0000644000176200001440000000153015116513141017106 0ustar liggesuserslibrary(shiny) library(shinyBS) 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") ) ) ) ) shinyBS/inst/examples/Collapses/server.R0000644000176200001440000000060215116513141017776 0ustar liggesuserslibrary(shiny) library(shinyBS) shinyServer( function(input, output, session) { output$genericPlot <- renderPlot(plot(rnorm(100))) observeEvent(input$p1Button, ({ updateCollapse(session, "collapseExample", open = "Panel 1") })) observeEvent(input$styleSelect, ({ updateCollapse(session, "collapseExample", style = list("Panel 1" = input$styleSelect)) })) } ) shinyBS/inst/examples/Alerts/0000755000176200001440000000000015116513141015654 5ustar liggesusersshinyBS/inst/examples/Alerts/ui.R0000644000176200001440000000045015116513141016413 0ustar liggesuserslibrary(shiny) library(shinyBS) fluidPage( sidebarLayout( sidebarPanel(textInput("num1", NULL, value = 100), "divided by", textInput("num2", NULL, value = 20), "equals", textOutput("exampleOutput")), mainPanel( bsAlert("alert") ) ) ) shinyBS/inst/examples/Alerts/server.R0000644000176200001440000000122515116513141017305 0ustar liggesuserslibrary(shiny) library(shinyBS) shinyServer( 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", content = "Both inputs should be numeric.", append = FALSE) } else if(num2 == 0) { createAlert(session, "alert", "exampleAlert", title = "Oops", content = "You cannot divide by 0.", append = FALSE) } else { closeAlert(session, "exampleAlert") return(num1/num2) } }) } ) shinyBS/inst/examples/Buttons/0000755000176200001440000000000015116513141016060 5ustar liggesusersshinyBS/inst/examples/Buttons/ui.R0000644000176200001440000000137115116513141016622 0ustar liggesuserslibrary(shiny) library(shinyBS) fluidPage( sidebarLayout( sidebarPanel( sliderInput("bins", "Move the slider to see its effect on the button below:", min = 1, max = 50, 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", block = TRUE, type = "toggle", value = TRUE), bsButton("actOne", label = "Block Action Button", block = TRUE) ), mainPanel( textOutput("exampleText") ) ) ) shinyBS/inst/examples/Buttons/server.R0000644000176200001440000000216215116513141017512 0ustar liggesuserslibrary(shiny) library(shinyBS) shinyServer( 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) { style = "warning" } else { style = "default" icon = icon("check") } updateButton(session, "actTwo", disabled = disabled, style = style, icon = icon) })) output$exampleText <- renderText({ input$actTwo b <- isolate(input$bins) txt = "" if((b > 5 & b < 15) | b > 35) { txt = "That was dangerous." } else if((b > 5 & b < 20) | b > 30) { txt = "I warned you about that." } else if(b >= 20 & b <= 30) { txt = "You have chosen... wisely." } return(txt) }) } ) shinyBS/inst/examples/Modals/0000755000176200001440000000000015116513141015641 5ustar liggesusersshinyBS/inst/examples/Modals/ui.R0000644000176200001440000000071415116513141016403 0ustar liggesuserslibrary(shiny) library(shinyBS) fluidPage( sidebarLayout( sidebarPanel( sliderInput("bins", "Number of bins:", min = 1, max = 50, value = 30), actionButton("tabBut", "View Table") ), mainPanel( plotOutput("distPlot"), bsModal("modalExample", "Data Table", "tabBut", size = "large", dataTableOutput("distTable")) ) ) ) shinyBS/inst/examples/Modals/server.R0000644000176200001440000000160315116513141017272 0ustar liggesuserslibrary(shiny) library(shinyBS) shinyServer( 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) { paste0(signif(tab$breaks[i], 3), "-", signif(tab$breaks[i+1], 3)) }) tab <- as.data.frame(do.call(cbind, tab)) colnames(tab) <- c("Bins", "Counts", "Density") return(tab[, 1:3]) }, options = list(pageLength=10)) } ) shinyBS/man/0000755000176200001440000000000015120510337012401 5ustar liggesusersshinyBS/man/bsCollapse.Rd0000644000176200001440000000234715120510337014765 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsCollapse.R \name{bsCollapse} \alias{bsCollapse} \title{bsCollapse} \usage{ bsCollapse(..., id = NULL, multiple = FALSE, open = NULL) } \arguments{ \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 the panel(s) you want open on load.} } \description{ \code{bsCollapse} is used in your UI to create a collapse panel group. Use \code{\link{bsCollapsePanel}} to populate this object with panels. } \details{ See \link{Collapses} for more information about how to use \code{bsCollapse} with the rest of the Collapses family. } \note{ Run \code{bsExample("Collapses")} for an example of \code{bsCollapse} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Collapses: \code{\link{Collapses}}, \code{\link{bsCollapsePanel}()}, \code{\link{updateCollapse}()} } \concept{Collapses} shinyBS/man/Collapses.Rd0000644000176200001440000000565315120510337014626 0ustar liggesusers% 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 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[shiny:tabsetPanel]{tabsetPanel}} in their implementation. Start with \code{bsCollapse} to create a panel group, then fill it with panels 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[shiny:shinyServer]{shinyServer}}. \code{updateCollapse} can be used within your server logic to open/close collapse panels or to change their style. } \note{ Run \code{bsExample("Collapses")} for an example of \code{Collapses} functionality. } \section{Components}{ \describe{ \item{\code{\link{bsCollapse}}}{A container for holder the individual panels created by \code{\link{bsCollapsePanel}}.} \item{\code{\link{bsCollapsePanel}}}{Creates an individual Collapse Panel that resides within a \code{\link{bsCollapse}}.} \item{\code{\link{updateCollapse}}}{Used within your server logic to open/close collapse panels or change their style.} } } \section{Changes}{ \code{style} is a new option that wasn't available in previous versions of shinyBS. } \examples{ library(shiny) library(shinyBS) app = shinyApp( ui = 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") ) ) ) ), server = function(input, output, session) { output$genericPlot <- renderPlot(plot(rnorm(100))) observeEvent(input$p1Button, ({ updateCollapse(session, "collapseExample", open = "Panel 1") })) observeEvent(input$styleSelect, ({ updateCollapse(session, "collapseExample", style = list("Panel 1" = input$styleSelect)) })) } ) \dontrun{ runApp(app) } } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Collapses: \code{\link{bsCollapse}()}, \code{\link{bsCollapsePanel}()}, \code{\link{updateCollapse}()} } \concept{Collapses} shinyBS/man/popify.Rd0000644000176200001440000000310315120510337014173 0ustar liggesusers% 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 ) } \arguments{ \item{el}{A shiny UI element.} \item{title}{The title of the popover.} \item{content}{The main content of the popover.} \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}, \code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}.} \item{options}{A named list of additional options to be set on the popover.} } \description{ \code{popify} can be wrapped around any shiny UI element to add a popover to the wrapped element. This should be a safer way to add popovers to elements created with \code{\link[shiny:renderUI]{renderUI}}. } \details{ See \link{Tooltips_and_Popovers} for more information about how to use \code{popify} with the rest of the Tooltips_and_Popovers family. } \note{ Run \code{bsExample("Tooltips_and_Popovers")} for an example of \code{popify} functionality. } \seealso{ \href{https://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}()} } \concept{Tooltips_and_Popovers} shinyBS/man/toggleModal.Rd0000644000176200001440000000162015120510337015125 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/toggleModal.R \name{toggleModal} \alias{toggleModal} \title{toggleModal} \usage{ toggleModal(session, modalId, toggle = "toggle") } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \item{modalId}{The id of the modal window you want to open/close} \item{toggle}{Should the modal window \code{open}, \code{close}, or \code{toggle}?} } \description{ \code{toggleModal} is used within your Server logic to open or close a modal window. } \details{ See \link{Modals} for more information about how to use \code{toggleModal} with the rest of the Modals family. } \note{ Run \code{bsExample("Modals")} for an example of \code{toggleModal} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Modals: \code{\link{Modals}}, \code{\link{bsModal}()} } \concept{Modals} shinyBS/man/tipify.Rd0000644000176200001440000000277415120510337014206 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/tipify.R \name{tipify} \alias{tipify} \title{tipify} \usage{ tipify(el, title, placement = "bottom", trigger = "hover", options = NULL) } \arguments{ \item{el}{A shiny UI element.} \item{title}{The content of the tooltip.} \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}, \code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}.} \item{options}{A named list of additional options to be set on the tooltip.} } \description{ \code{tipify} can be wrapped around any shiny UI element to add a tooltip to the wrapped element. This should be a safer way to add tooltips to elements created with \code{\link[shiny:renderUI]{renderUI}}. } \details{ See \link{Tooltips_and_Popovers} for more information about how to use \code{tipify} with the rest of the Tooltips_and_Popovers family. } \note{ Run \code{bsExample("Tooltips_and_Popovers")} for an example of \code{tipify} functionality. } \seealso{ \href{https://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}()} } \concept{Tooltips_and_Popovers} shinyBS/man/addPopover.Rd0000644000176200001440000000314615120510337014777 0ustar liggesusers% 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 ) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \item{id}{The id of the element to attach the popover to.} \item{title}{The title of the popover.} \item{content}{The main content of the popover.} \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}, \code{focus}, \code{click}, or \code{manual}). Defaults to \code{hover}.} \item{options}{A named list of additional options to be set on the popover.} } \description{ \code{addPopover} is used within the Server logic of an app to add a popover to a Shiny input or output. } \details{ See \link{Tooltips_and_Popovers} for more information about how to use \code{addPopover} with the rest of the Tooltips_and_Popovers family. } \note{ Run \code{bsExample("Tooltips_and_Popovers")} for an example of \code{addPopover} functionality. } \seealso{ \href{https://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}()} } \concept{Tooltips_and_Popovers} shinyBS/man/bsTypeahead.Rd0000644000176200001440000000174415116524126015135 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsTypeahead.R \name{bsTypeahead} \alias{bsTypeahead} \title{bsTypeahead} \usage{ bsTypeahead(inputId, label, value = "", choices, items = 8, minLength = 1) } \arguments{ \item{inputId}{Input variable to assign the control's value to} \item{label}{Display label for the control} \item{value}{Initial value} \item{choices}{Array of strings to match against. Can also be JavaScript function. Use htmlwidgets::JS() to indicate JavaScript. The length of \code{choices} must no exceed 131370.} \item{items}{The max number of items to display in the dropdown. Can also be set to 'all'} \item{minLength}{The minimum character length needed before triggering autocomplete suggestions. You can set it to 0 so suggestion are shown even when there is no text when lookup function is called.} } \description{ \code{bsTypeahead} creates a textinput with type ahead function buttons. } \seealso{ \code{\link{updateTypeahead}} } shinyBS/man/Buttons.Rd0000644000176200001440000000766515120510337014344 0ustar liggesusers% 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 available by standard Shiny. Use shinyBS to create buttons of different sizes, shapes, and colors. } \details{ Create a button in the UI with \code{\link{bsButton}}. If \code{type = "action"} the button will behave like the standard \code{\link[shiny:actionButton]{actionButton}} in shiny. If \code{type = "toggle"} the button will behave like a \code{\link[shiny:checkboxInput]{checkboxInput}} 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 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}} to enable the button allowing the user to proceed. Alternatively, you could set the button to \code{style = "success"} to let them know that the button is ready to be clicked. } \note{ Run \code{bsExample("Buttons")} for an example of \code{Buttons} functionality. } \section{Components}{ There are two functions in the Buttons family: \describe{ \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}}} } } \section{Changes}{ \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 = fluidPage( sidebarLayout( sidebarPanel( sliderInput("bins", "Move the slider to see its effect on the button below:", min = 1, max = 50, 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", block = TRUE, type = "toggle", value = TRUE), bsButton("actOne", label = "Block Action Button", block = TRUE) ), mainPanel( textOutput("exampleText") ) ) ), 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) { style = "warning" } else { style = "default" icon = icon("check") } updateButton(session, "actTwo", disabled = disabled, style = style, icon = icon) })) output$exampleText <- renderText({ input$actTwo b <- isolate(input$bins) txt = "" if((b > 5 & b < 15) | b > 35) { txt = "That was dangerous." } else if((b > 5 & b < 20) | b > 30) { txt = "I warned you about that." } else if(b >= 20 & b <= 30) { txt = "You have chosen... wisely." } return(txt) }) } ) \dontrun{ runApp(app) } } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Buttons: \code{\link{bsButton}()}, \code{\link{updateButton}()} } \concept{Buttons} shinyBS/man/removePopover.Rd0000644000176200001440000000212015120510337015533 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/removePopover.R \name{removePopover} \alias{removePopover} \title{removePopover} \usage{ removePopover(session, id) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \item{id}{The id of the element to remove the popover from.} } \description{ \code{removePopover} is used within the Server logic of an app to remove an existing popover from a Shiny input or output. } \details{ See \link{Tooltips_and_Popovers} for more information about how to use \code{removePopover} with the rest of the Tooltips_and_Popovers family. } \note{ Run \code{bsExample("Tooltips_and_Popovers")} for an example of \code{removePopover} functionality. } \seealso{ \href{https://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}()} } \concept{Tooltips_and_Popovers} shinyBS/man/Tooltips_and_Popovers.Rd0000644000176200001440000001202215120510337017221 0ustar liggesusers% 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 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. } \details{ 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 within the UI or from within a \code{\link[shiny:renderUI]{renderUI}} in the Server logic. They also have the added advantage of not requiring that the UI element have an ID attribute. } \note{ Tooltips and Popovers cannot contain shiny inputs or outputs. There must be at least one \code{shinyBS} component in the UI of your 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 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. Run \code{bsExample("Tooltips_and_Popovers")} for an example of \code{Tooltips_and_Popovers} functionality. } \section{Components}{ 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 \code{\link[shiny:renderUI]{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 \code{\link[shiny:renderUI]{renderUI}}.} \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 to an element in your UI.} \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 popover from an element in your UI.} } } \section{Changes}{ An \code{options} argument has been added to the creation functions to allow advanced users more control over how the tooltips and popovers appear. See the \href{https://getbootstrap.com}{Twitter Bootstrap 3 documentation} for more details. } \examples{ library(shiny) library(shinyBS) app = shinyApp( ui = fluidPage( sidebarLayout( sidebarPanel( sliderInput("bins", "Number of bins:", min = 1, max = 50, value = 30), bsTooltip("bins", "The wait times will be broken into this many equally spaced bins", "right", options = list(container = "body")) ), mainPanel( plotOutput("distPlot"), uiOutput("uiExample") ) ) ), 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", "This button is pointless. It does not do anything!"), tipify(bsButton("pB2", "Button", style = "inverse", size = "extra-small"), "This button is pointless too!") ) }) addPopover(session, "distPlot", "Data", content = paste0("

    Waiting time between ", "eruptions and the duration of the eruption for the Old Faithful geyser ", "in Yellowstone National Park, Wyoming, USA.

    Azzalini, A. and ", "Bowman, A. W. (1990). A look at some data on the Old Faithful geyser. ", "Applied Statistics 39, 357-365.

    "), trigger = 'click') } ) \dontrun{ runApp(app) } } \seealso{ \href{https://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}()} } \concept{Tooltips_and_Popovers} shinyBS/man/updateCollapse.Rd0000644000176200001440000000275115120510337015642 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/updateCollapse.R \name{updateCollapse} \alias{updateCollapse} \title{updateCollapse} \usage{ updateCollapse(session, id, open = NULL, close = NULL, style = NULL) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \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 provided) values identifying the panels you want to open.} \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 \code{\link{bsCollapsePanel}} you want to change.} } \description{ \code{updateCollapse} is used within the Server logic of your Shiny app to modify a Collapse after load. } \details{ See \link{Collapses} for more information about how to use \code{updateCollapse} with the rest of the Collapses family. } \note{ Run \code{bsExample("Collapses")} for an example of \code{updateCollapse} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Collapses: \code{\link{Collapses}}, \code{\link{bsCollapse}()}, \code{\link{bsCollapsePanel}()} } \concept{Collapses} shinyBS/man/updateButton.Rd0000644000176200001440000000367115120510337015355 0ustar liggesusers% 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 ) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \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[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}, \code{default}, or \code{large})} \item{block}{\bold{logical} Should the button take the full width of the parent element?} \item{disabled}{\bold{logical} Should the button be disabled (un-clickable)?} } \description{ \code{updateButton} is used in your Server logic to update the style or state of a button. } \details{ Because of the way it is coded, \code{updateButton} may work on buttons not created by \code{\link{bsButton}} such as \code{\link[shiny:submitButton]{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 of \code{updateButton} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Buttons: \code{\link{Buttons}}, \code{\link{bsButton}()} } \concept{Buttons} shinyBS/man/Modals.Rd0000644000176200001440000000572015120510337014113 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/Modals.R \name{Modals} \alias{Modals} \title{Modals} \description{ Modal windows are similar to popups but are rendered within the original window. They can contain any combination of shiny inputs, shiny outputs, and html. Possible uses include extra controls that you don't want 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 like \code{\link{Collapses}} or \code{\link[shiny:tabPanel]{tabPanel}}, any non-named arguments will be passed as content for the modal. Create a button or link and assign its \code{inputId} as the \code{trigger} in \code{\link{bsModal}}. } \note{ Run \code{bsExample("Modals")} for an example of \code{Modals} functionality. } \section{Components}{ 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 close a modal window programmatically.} } } \section{Changes}{ 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 size of the modal window. Either \code{small} or \code{large}. } \examples{ library(shiny) library(shinyBS) app = shinyApp( ui = fluidPage( sidebarLayout( sidebarPanel( sliderInput("bins", "Number of bins:", min = 1, max = 50, value = 30), actionButton("tabBut", "View Table") ), mainPanel( plotOutput("distPlot"), bsModal("modalExample", "Data Table", "tabBut", size = "large", dataTableOutput("distTable")) ) ) ), 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) { paste0(signif(tab$breaks[i], 3), "-", signif(tab$breaks[i+1], 3)) }) tab <- as.data.frame(do.call(cbind, tab)) colnames(tab) <- c("Bins", "Counts", "Density") return(tab[, 1:3]) }, options = list(pageLength=10)) } ) \dontrun{ runApp(app) } } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Modals: \code{\link{bsModal}()}, \code{\link{toggleModal}()} } \concept{Modals} shinyBS/man/bsModal.Rd0000644000176200001440000000244515120510337014256 0ustar liggesusers% 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, footer = NULL, close.button = TRUE, width = NULL ) } \arguments{ \item{id}{A unique identifier for the modal window} \item{title}{The title to appear at the top of the modal} \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{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. } \details{ See \link{Modals} for more information about how to use \code{bsModal} with the rest of the Modals family. } \note{ Run \code{bsExample("Modals")} for an example of \code{bsModal} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Modals: \code{\link{Modals}}, \code{\link{toggleModal}()} } \concept{Modals} shinyBS/man/bsButton.Rd0000644000176200001440000000333115120510337014470 0ustar liggesusers% 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 ) } \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{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}, \code{default}, or \code{large})} \item{type}{The type of button to create. (\code{action} or \code{toggle})} \item{block}{\bold{logical} Should the button take the full width of the parent element?} \item{disabled}{\bold{logical} Should the button be disabled (un-clickable)?} \item{value}{\bold{logical} If \code{type = "toggle"}, the initial value of the button.} } \description{ \code{bsButton} is used in your UI script to create customizable action and toggle buttons. } \details{ See \link{Buttons} for more information about how to use \code{bsButton} with the rest of the Buttons family. } \note{ Run \code{bsExample("Buttons")} for an example of \code{bsButton} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Buttons: \code{\link{Buttons}}, \code{\link{updateButton}()} } \concept{Buttons} shinyBS/man/updateTypeahead.Rd0000644000176200001440000000132215116524126016003 0ustar liggesusers% 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) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \item{inputId}{Input variable to assign the control's value to} \item{label}{Display label for the control} \item{value}{Initial value} \item{choices}{Array of strings to match against. Can also be JavaScript function. Use htmlwidgets::JS() to indicate JavaScript.} } \description{ \code{updateTypeahead} Update a bsTypeahead buttons. } \seealso{ \code{\link{bsTypeahead}} } shinyBS/man/bsAlert.Rd0000644000176200001440000000155415120510337014271 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsAlert.R \name{bsAlert} \alias{bsAlert} \title{bsAlert} \usage{ bsAlert(anchorId, inline = TRUE) } \arguments{ \item{anchorId}{A unique id the identifies the anchor.} \item{inline}{Logical value, determmines the class of the alert. Defaults to TRUE.} } \description{ \code{bsAlert} creates an anchor point in your UI definition. This anchor point is where alerts created in your Server logic will be displayed. } \details{ See \link{Alerts} for more information about how to use \code{bsAlert} with the rest of the Alerts family. } \note{ Run \code{bsExample("Alerts")} for an example of \code{bsAlert} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Alerts: \code{\link{Alerts}}, \code{\link{closeAlert}()}, \code{\link{createAlert}()} } \concept{Alerts} shinyBS/man/closeAlert.Rd0000644000176200001440000000152315120510337014766 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/closeAlert.R \name{closeAlert} \alias{closeAlert} \title{closeAlert} \usage{ closeAlert(session, alertId) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \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 created with \code{\link{createAlert}}. } \details{ See \link{Alerts} for more information about how to use \code{closeAlert} with the rest of the Alerts family. } \note{ Run \code{bsExample("Alerts")} for an example of \code{closeAlert} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Alerts: \code{\link{Alerts}}, \code{\link{bsAlert}()}, \code{\link{createAlert}()} } \concept{Alerts} shinyBS/man/bsTooltip.Rd0000644000176200001440000000267215120510337014656 0ustar liggesusers% 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) } \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 (\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}, \code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}.} \item{options}{A named list of additional options to be set on the tooltip.} } \description{ \code{bsTooltip} is used within the UI of an app to add a tooltip to a Shiny input or output. } \details{ See \link{Tooltips_and_Popovers} for more information about how to use \code{bsTooltip} with the rest of the Tooltips_and_Popovers family. } \note{ Run \code{bsExample("Tooltips_and_Popovers")} for an example of \code{bsTooltip} functionality. } \seealso{ \href{https://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}()} } \concept{Tooltips_and_Popovers} shinyBS/man/bsPopover.Rd0000644000176200001440000000300115120510337014641 0ustar liggesusers% 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 ) } \arguments{ \item{id}{The id of the element to attach the popover to.} \item{title}{The title of the popover.} \item{content}{The main content of the popover.} \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}, \code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}.} \item{options}{A named list of additional options to be set on the popover.} } \description{ \code{bsPopover} is used within the UI of an app to add a popover to a Shiny input or output. } \details{ See \link{Tooltips_and_Popovers} for more information about how to use \code{bsPopover} with the rest of the Tooltips_and_Popovers family. } \note{ Run \code{bsExample("Tooltips_and_Popovers")} for an example of \code{bsPopover} functionality. } \seealso{ \href{https://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}()} } \concept{Tooltips_and_Popovers} shinyBS/man/Alerts.Rd0000644000176200001440000000576215120510337014134 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/Alerts.R \name{Alerts} \alias{Alerts} \title{Alerts} \description{ Alerts allow you to communicate information to the user on the fly. Standard Bootstrap styling options give the user a hint at the type of information 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}. 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 change. } \note{ Run \code{bsExample("Alerts")} for an example of \code{Alerts} functionality. } \section{Components}{ 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 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, but this offers you a way to close them programmatically.} } } \section{Changes}{ \code{style} was called \code{type} in previous versions of shinyBS. \code{anchorId} was called \code{inputId} in previous versions of shinyBS. \code{content} was called \code{message} in previous versions of shinyBS. } \examples{ library(shiny) library(shinyBS) app = shinyApp( ui = fluidPage( sidebarLayout( sidebarPanel(textInput("num1", NULL, value = 100), "divided by", textInput("num2", NULL, value = 20), "equals", textOutput("exampleOutput")), mainPanel( bsAlert("alert") ) ) ), 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", content = "Both inputs should be numeric.", append = FALSE) } else if(num2 == 0) { createAlert(session, "alert", "exampleAlert", title = "Oops", content = "You cannot divide by 0.", append = FALSE) } else { closeAlert(session, "exampleAlert") return(num1/num2) } }) } ) \dontrun{ runApp(app) } } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Alerts: \code{\link{bsAlert}()}, \code{\link{closeAlert}()}, \code{\link{createAlert}()} } \concept{Alerts} shinyBS/man/addTooltip.Rd0000644000176200001440000000305715120510337015000 0ustar liggesusers% 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 ) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \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 (\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}, \code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}.} \item{options}{A named list of additional options to be set on the tooltip.} } \description{ \code{addTooltip} is used within the Server logic of an app to add a tooltip to a Shiny input or output. } \details{ See \link{Tooltips_and_Popovers} for more information about how to use \code{addTooltip} with the rest of the Tooltips_and_Popovers family. } \note{ Run \code{bsExample("Tooltips_and_Popovers")} for an example of \code{addTooltip} functionality. } \seealso{ \href{https://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}()} } \concept{Tooltips_and_Popovers} shinyBS/man/bsCollapsePanel.Rd0000644000176200001440000000217115120510337015740 0ustar liggesusers% 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) } \arguments{ \item{title}{The title to display at the top of the panel.} \item{\dots}{UI elements to include within the panel.} \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})} } \description{ \code{bsCollapsePanel} creates individual panels within a \code{\link{bsCollapse}} object. } \details{ See \link{Collapses} for more information about how to use \code{bsCollapsePanel} with the rest of the Collapses family. } \note{ Run \code{bsExample("Collapses")} for an example of \code{bsCollapsePanel} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Collapses: \code{\link{Collapses}}, \code{\link{bsCollapse}()}, \code{\link{updateCollapse}()} } \concept{Collapses} shinyBS/man/removeTooltip.Rd0000644000176200001440000000212015120510337015533 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/removeTooltip.R \name{removeTooltip} \alias{removeTooltip} \title{removeTooltip} \usage{ removeTooltip(session, id) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \item{id}{The id of the element to remove the tooltip from.} } \description{ \code{removeTooltip} is used within the Server logic of an app to remove an existing tooltip from a Shiny input or output. } \details{ See \link{Tooltips_and_Popovers} for more information about how to use \code{removeTooltip} with the rest of the Tooltips_and_Popovers family. } \note{ Run \code{bsExample("Tooltips_and_Popovers")} for an example of \code{removeTooltip} functionality. } \seealso{ \href{https://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}()} } \concept{Tooltips_and_Popovers} shinyBS/man/bsExample.Rd0000644000176200001440000000170015116525776014630 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsExample.R \name{bsExample} \alias{bsExample} \title{bsExample} \usage{ bsExample(family, display.mode = "showcase", ...) } \arguments{ \item{family}{A shinyBS family name} \item{display.mode}{The display mode to use when running the example. See \code{\link[shiny:runApp]{runApp}}.} \item{\dots}{Other parameters to pass to \code{\link[shiny:runApp]{runApp}}.} } \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 \code{example}. } \details{ This function is just a wrapper for \code{\link[shiny:runApp]{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 the app is running. } \examples{ \dontrun{ bsExample("Alerts")} } shinyBS/man/createAlert.Rd0000644000176200001440000000264715120510337015134 0ustar liggesusers% 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 ) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \item{anchorId}{The unique identifier of the anchor where the alert should be displayed.} \item{alertId}{\bold{Optional} A unique identifier for the Alert.} \item{title}{\bold{Optional} A title for the Alert.} \item{content}{The main body of the Alert. HTML tags are allowed.} \item{style}{A bootstrap style to apply. Defaults to \code{info}.} \item{dismiss}{\code{logical} Should the Alert be user dismissable? Defaults to \code{TRUE}.} \item{append}{\code{logical} Should the Alert be appended below existing Alerts? Default to \code{TRUE}.} } \description{ \code{createAlert} is used within the Server logic of your Shiny app to display an alert to the user. } \details{ See \link{Alerts} for more information about how to use \code{createAlert} with the rest of the Alerts family. } \note{ Run \code{bsExample("Alerts")} for an example of \code{createAlert} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Alerts: \code{\link{Alerts}}, \code{\link{bsAlert}()}, \code{\link{closeAlert}()} } \concept{Alerts} shinyBS/DESCRIPTION0000644000176200001440000000217515156540112013344 0ustar liggesusersPackage: shinyBS Type: Package Title: Extra Twitter Bootstrap Components for Shiny Version: 0.65.0 Date: 2026-03-18 Authors@R: c( person(given = "Eric", family = "Bailey", email = "ebailey@idem.in.gov", role = c("aut") ), person(given = "Federico", family = "Marini", email = "marinif@uni-mainz.de", role = c("cre", "ctb"), comment = c(ORCID = "0000-0003-3252-7758")), person(given = "Jesse", family = "Koops", email = "Jesse.Koops@cito.nl", role = c("ctb") ) ) Description: Adds easy access to additional Twitter Bootstrap components to Shiny. Imports: shiny (>= 0.13.2), htmltools, stats, jsonlite URL: https://github.com/federicomarini/shinyBS/ BugReports: https://github.com/federicomarini/shinyBS/issues License: GPL-3 RoxygenNote: 7.3.3 Encoding: UTF-8 NeedsCompilation: no Packaged: 2026-03-18 14:15:50 UTC; fede Author: Eric Bailey [aut], Federico Marini [cre, ctb] (ORCID: ), Jesse Koops [ctb] Maintainer: Federico Marini Repository: CRAN Date/Publication: 2026-03-18 15:10:02 UTC