diff --git a/DESCRIPTION b/DESCRIPTION index 6522f45..acc5ba8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -14,11 +14,11 @@ License: MIT + file LICENSE Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.1.9000 +RoxygenNote: 7.3.1 URL: https://github.com/RinteRface/shiny386 BugReports: https://github.com/RinteRface/shiny386/issues Imports: - htmltools, + htmltools (>= 0.5.2), shiny, magrittr, httpuv diff --git a/R/inputs.R b/R/inputs.R index c66b839..89f1066 100644 --- a/R/inputs.R +++ b/R/inputs.R @@ -604,6 +604,10 @@ update_checkbox_group_input_386 <- function (session, inputId, label = NULL, cho #' Create a Bootstrap 386 select input +#' +#' @note Incompatible with selectize. Set to FALSE +#' by default to have correct CSS rendering. +#' #' @inheritParams shiny::selectInput #' @export #' @examples @@ -627,7 +631,25 @@ update_checkbox_group_input_386 <- function (session, inputId, label = NULL, cho #' shinyApp(ui, server) #' #' } -select_input_386 <- shiny::selectInput +select_input_386 <- function( + inputId, label, choices, selected = NULL, multiple = FALSE, + selectize = FALSE, width = NULL, size = NULL +) { + args <- as.list(match.call())[-1] + defaults <- formals(sys.function()) + defaults <- defaults[!(names(defaults) %in% names(args))] + + htmltools::tagQuery( + do.call( + shiny::selectInput, + dropNulls(c(args, defaults)) + ) + )$ + find("select")$ + addClass("custom-select")$ + removeClass("form-control")$ + allTags() +} diff --git a/R/shiny386-package.R b/R/shiny386-package.R index c32b04b..4a8d4ac 100644 --- a/R/shiny386-package.R +++ b/R/shiny386-package.R @@ -5,5 +5,4 @@ #' @name shiny386 #' @import htmltools #' @import shiny -#' @docType package -NULL +"_PACKAGE" diff --git a/man/checkbox_group_input_386.Rd b/man/checkbox_group_input_386.Rd index ae942a7..3b58254 100644 --- a/man/checkbox_group_input_386.Rd +++ b/man/checkbox_group_input_386.Rd @@ -30,17 +30,7 @@ types (such as logicals and numbers) will be coerced to strings.} \item{width}{The width of the input, e.g. \code{'400px'}, or \code{'100\%'}; see \code{\link[shiny:validateCssUnit]{validateCssUnit()}}.} -\item{choiceNames}{List of names and values, respectively, -that are displayed to the user in the app and correspond to the each -choice (for this reason, \code{choiceNames} and \code{choiceValues} -must have the same length). If either of these arguments is -provided, then the other \emph{must} be provided and \code{choices} -\emph{must not} be provided. The advantage of using both of these over -a named list for \code{choices} is that \code{choiceNames} allows any -type of UI object to be passed through (tag objects, icons, HTML code, -...), instead of just simple text. See Examples.} - -\item{choiceValues}{List of names and values, respectively, +\item{choiceNames, choiceValues}{List of names and values, respectively, that are displayed to the user in the app and correspond to the each choice (for this reason, \code{choiceNames} and \code{choiceValues} must have the same length). If either of these arguments is diff --git a/man/modal.Rd b/man/modal.Rd index 546427c..20f349c 100644 --- a/man/modal.Rd +++ b/man/modal.Rd @@ -10,7 +10,7 @@ modal_386( ..., title = NULL, footer = modalButton("Dismiss"), - size = c("m", "s", "l"), + size = c("m", "s", "l", "xl"), easyClose = FALSE, fade = TRUE ) @@ -27,13 +27,16 @@ remove_modal_386(session = getDefaultReactiveDomain()) \item{footer}{UI for footer. Use \code{NULL} for no footer.} \item{size}{One of \code{"s"} for small, \code{"m"} (the default) for medium, -or \code{"l"} for large.} +\code{"l"} for large, or \code{"xl"} for extra large. Note that \code{"xl"} only +works with Bootstrap 4 and above (to opt-in to Bootstrap 4+, +pass \code{\link[bslib:bs_theme]{bslib::bs_theme()}} to the \code{theme} argument of a page container +like \code{\link[shiny:fluidPage]{fluidPage()}}).} \item{easyClose}{If \code{TRUE}, the modal dialog can be dismissed by clicking outside the dialog box, or be pressing the Escape key. If \code{FALSE} (the default), the modal dialog can't be dismissed in those -ways; instead it must be dismissed by clicking on the dismiss button, or -from a call to \code{\link[shiny:showModal]{removeModal()}} on the server.} +ways; instead it must be dismissed by clicking on a \code{modalButton()}, or +from a call to \code{\link[shiny:removeModal]{removeModal()}} on the server.} \item{fade}{If \code{FALSE}, the modal dialog will have no fade-in animation (it will simply appear rather than fade in to view).} diff --git a/man/navbar.Rd b/man/navbar.Rd index 4737c0e..d4d7f5e 100644 --- a/man/navbar.Rd +++ b/man/navbar.Rd @@ -20,7 +20,11 @@ navbar_page_386( navbar_menu_386(title, ..., menuName = title, icon = NULL) -update_navbar_page_386(session, inputId, selected = NULL) +update_navbar_page_386( + session = getDefaultReactiveDomain(), + inputId, + selected = NULL +) } \arguments{ \item{title}{The title to display in the navbar} @@ -30,7 +34,7 @@ update_navbar_page_386(session, inputId, selected = NULL) section headers. If the string is a set of dashes like \code{"----"} a horizontal separator will be displayed in the menu.} -\item{id}{If provided, you can use \code{input$}\emph{\code{id}} in your +\item{id}{If provided, you can use \verb{input$}\emph{\code{id}} in your server logic to determine which of the current tabs is active. The value will correspond to the \code{value} argument that is passed to \code{\link[shiny:tabPanel]{tabPanel()}}.} @@ -56,8 +60,10 @@ tabPanels} \item{inverse}{\code{TRUE} to use a dark background and light text for the navigation bar} -\item{windowTitle}{The title that should be displayed by the browser window. -Useful if \code{title} is not a string.} +\item{windowTitle}{the browser window title (as a character string). The +default value, \code{NA}, means to use any character strings that appear in +\code{title} (if none are found, the host URL of the page is displayed by +default).} \item{menuName}{A name that identifies this \code{navbarMenu}. This is needed if you want to insert/remove or show/hide an entire @@ -66,7 +72,7 @@ is needed if you want to insert/remove or show/hide an entire \item{icon}{Optional icon to appear on a \code{navbarMenu} tab.} \item{session}{The \code{session} object passed to function given to -\code{shinyServer}.} +\code{shinyServer}. Default is \code{getDefaultReactiveDomain()}.} \item{inputId}{The id of the \code{tabsetPanel}, \code{navlistPanel}, or \code{navbarPage} object.} diff --git a/man/radio_input_386.Rd b/man/radio_input_386.Rd index 111cef9..77c323b 100644 --- a/man/radio_input_386.Rd +++ b/man/radio_input_386.Rd @@ -21,35 +21,25 @@ radio_input_386( \item{choices}{List of values to select from (if elements of the list are named then that name rather than the value is displayed to the user). If -this argument is provided, then \code{choiceNames} and \code{choiceValues} -must not be provided, and vice-versa. The values should be strings; other -types (such as logicals and numbers) will be coerced to strings.} +this argument is provided, then \code{choiceNames} and \code{choiceValues} must not +be provided, and vice-versa. The values should be strings; other types +(such as logicals and numbers) will be coerced to strings.} -\item{selected}{The initially selected value (if not specified then defaults -to the first value)} +\item{selected}{The initially selected value. If not specified, then it +defaults to the first item in \code{choices}. To start with no items selected, +use \code{character(0)}.} \item{width}{The width of the input, e.g. \code{'400px'}, or \code{'100\%'}; see \code{\link[shiny:validateCssUnit]{validateCssUnit()}}.} -\item{choiceNames}{List of names and values, respectively, that +\item{choiceNames, choiceValues}{List of names and values, respectively, that are displayed to the user in the app and correspond to the each choice (for -this reason, \code{choiceNames} and \code{choiceValues} must have the same -length). If either of these arguments is provided, then the other -\emph{must} be provided and \code{choices} \emph{must not} be provided. The -advantage of using both of these over a named list for \code{choices} is -that \code{choiceNames} allows any type of UI object to be passed through -(tag objects, icons, HTML code, ...), instead of just simple text. See -Examples.} - -\item{choiceValues}{List of names and values, respectively, that -are displayed to the user in the app and correspond to the each choice (for -this reason, \code{choiceNames} and \code{choiceValues} must have the same -length). If either of these arguments is provided, then the other -\emph{must} be provided and \code{choices} \emph{must not} be provided. The -advantage of using both of these over a named list for \code{choices} is -that \code{choiceNames} allows any type of UI object to be passed through -(tag objects, icons, HTML code, ...), instead of just simple text. See -Examples.} +this reason, \code{choiceNames} and \code{choiceValues} must have the same length). +If either of these arguments is provided, then the other \emph{must} be provided +and \code{choices} \emph{must not} be provided. The advantage of using both of these +over a named list for \code{choices} is that \code{choiceNames} allows any type of UI +object to be passed through (tag objects, icons, HTML code, ...), instead +of just simple text. See Examples.} } \description{ Create a Bootstrap 386 radio buttons diff --git a/man/select_input_386.Rd b/man/select_input_386.Rd index 777e1be..98f9e03 100644 --- a/man/select_input_386.Rd +++ b/man/select_input_386.Rd @@ -10,7 +10,7 @@ select_input_386( choices, selected = NULL, multiple = FALSE, - selectize = TRUE, + selectize = FALSE, width = NULL, size = NULL ) @@ -25,7 +25,7 @@ named, then that name --- rather than the value --- is displayed to the user. It's also possible to group related inputs by providing a named list whose elements are (either named or unnamed) lists, vectors, or factors. In this case, the outermost names will be used as the group labels (leveraging -the \code{} HTML tag) for the elements in the respective sublist. See +the \verb{} HTML tag) for the elements in the respective sublist. See the example section for a small demo of this feature.} \item{selected}{The initially selected value (or multiple values if \code{multiple = TRUE}). If not specified then defaults to the first value for @@ -46,6 +46,10 @@ but when \code{size} is set, it will be a box instead.} \description{ Create a Bootstrap 386 select input } +\note{ +Incompatible with selectize. Set to FALSE +by default to have correct CSS rendering. +} \examples{ if (interactive()) { library(shiny) diff --git a/man/shiny386.Rd b/man/shiny386.Rd index c0dd2c7..968a7b5 100644 --- a/man/shiny386.Rd +++ b/man/shiny386.Rd @@ -2,8 +2,21 @@ % Please edit documentation in R/shiny386-package.R \docType{package} \name{shiny386} +\alias{shiny386-package} \alias{shiny386} \title{shiny386} \description{ Old school Bootstrap 4 template for Shiny } +\seealso{ +Useful links: +\itemize{ + \item \url{https://github.com/RinteRface/shiny386} + \item Report bugs at \url{https://github.com/RinteRface/shiny386/issues} +} + +} +\author{ +\strong{Maintainer}: David Granjon \email{dgranjon@ymail.com} + +} diff --git a/man/tab_panel_386.Rd b/man/tab_panel_386.Rd index ea69ba1..26703f9 100644 --- a/man/tab_panel_386.Rd +++ b/man/tab_panel_386.Rd @@ -13,7 +13,7 @@ tab_panel_386(title, ..., value = title, icon = NULL) \item{value}{The value that should be sent when \code{tabsetPanel} reports that this tab is selected. If omitted and \code{tabsetPanel} has an -\code{id}, then the title will be used..} +\code{id}, then the title will be used.} \item{icon}{Optional icon to appear on the tab. This attribute is only valid when using a \code{tabPanel} within a \code{\link[shiny:navbarPage]{navbarPage()}}.} diff --git a/man/tabset_panel_386.Rd b/man/tabset_panel_386.Rd index f74c993..3ed05e7 100644 --- a/man/tabset_panel_386.Rd +++ b/man/tabset_panel_386.Rd @@ -15,7 +15,7 @@ tabset_panel_386( \arguments{ \item{...}{\code{\link[shiny:tabPanel]{tabPanel()}} elements to include in the tabset} -\item{id}{If provided, you can use \code{input$}\emph{\code{id}} in your +\item{id}{If provided, you can use \verb{input$}\emph{\code{id}} in your server logic to determine which of the current tabs is active. The value will correspond to the \code{value} argument that is passed to \code{\link[shiny:tabPanel]{tabPanel()}}.} @@ -24,11 +24,13 @@ will correspond to the \code{value} argument that is passed to of the tab that should be selected by default. If \code{NULL}, the first tab will be selected.} -\item{type}{Use "tabs" for the standard look; Use "pills" for a more plain -look where tabs are selected using a background fill color.} - -\item{position}{This argument is deprecated; it has been discontinued in -Bootstrap 3.} +\item{type}{\describe{ +\item{\code{"tabs"}}{Standard tab look} +\item{\code{"pills"}}{Selected tabs use the background fill color} +\item{\code{"hidden"}}{Hides the selectable tabs. Use \code{type = "hidden"} in +conjunction with \code{\link[shiny:tabPanelBody]{tabPanelBody()}} and \code{\link[shiny:updateTabsetPanel]{updateTabsetPanel()}} to control the +active tab via other input controls. (See example below)} +}} } \description{ Create a Bootstrap 386 tabset panel diff --git a/man/update_checkbox_group_input_386.Rd b/man/update_checkbox_group_input_386.Rd index df2126b..1fce343 100644 --- a/man/update_checkbox_group_input_386.Rd +++ b/man/update_checkbox_group_input_386.Rd @@ -29,17 +29,7 @@ types (such as logicals and numbers) will be coerced to strings.} \item{selected}{The values that should be initially selected, if any.} -\item{choiceNames}{List of names and values, respectively, -that are displayed to the user in the app and correspond to the each -choice (for this reason, \code{choiceNames} and \code{choiceValues} -must have the same length). If either of these arguments is -provided, then the other \emph{must} be provided and \code{choices} -\emph{must not} be provided. The advantage of using both of these over -a named list for \code{choices} is that \code{choiceNames} allows any -type of UI object to be passed through (tag objects, icons, HTML code, -...), instead of just simple text. See Examples.} - -\item{choiceValues}{List of names and values, respectively, +\item{choiceNames, choiceValues}{List of names and values, respectively, that are displayed to the user in the app and correspond to the each choice (for this reason, \code{choiceNames} and \code{choiceValues} must have the same length). If either of these arguments is diff --git a/man/update_checkbox_input_386.Rd b/man/update_checkbox_input_386.Rd index f7cb1f1..2c91ca1 100644 --- a/man/update_checkbox_input_386.Rd +++ b/man/update_checkbox_input_386.Rd @@ -8,13 +8,13 @@ update_checkbox_input_386(session, inputId, label = NULL, value = NULL) } \arguments{ \item{session}{The \code{session} object passed to function given to -\code{shinyServer}.} +\code{shinyServer}. Default is \code{getDefaultReactiveDomain()}.} \item{inputId}{The id of the input object.} \item{label}{The label to set for the input object.} -\item{value}{The value to set for the input object.} +\item{value}{Initial value (\code{TRUE} or \code{FALSE}).} } \description{ Update \link{checkbox_input_386} on the client diff --git a/man/update_radio_input_386.Rd b/man/update_radio_input_386.Rd index 9e3694a..6d32371 100644 --- a/man/update_radio_input_386.Rd +++ b/man/update_radio_input_386.Rd @@ -23,32 +23,22 @@ update_radio_input_386( \item{choices}{List of values to select from (if elements of the list are named then that name rather than the value is displayed to the user). If -this argument is provided, then \code{choiceNames} and \code{choiceValues} -must not be provided, and vice-versa. The values should be strings; other -types (such as logicals and numbers) will be coerced to strings.} +this argument is provided, then \code{choiceNames} and \code{choiceValues} must not +be provided, and vice-versa. The values should be strings; other types +(such as logicals and numbers) will be coerced to strings.} -\item{selected}{The initially selected value (if not specified then defaults -to the first value)} +\item{selected}{The initially selected value. If not specified, then it +defaults to the first item in \code{choices}. To start with no items selected, +use \code{character(0)}.} -\item{choiceNames}{List of names and values, respectively, that +\item{choiceNames, choiceValues}{List of names and values, respectively, that are displayed to the user in the app and correspond to the each choice (for -this reason, \code{choiceNames} and \code{choiceValues} must have the same -length). If either of these arguments is provided, then the other -\emph{must} be provided and \code{choices} \emph{must not} be provided. The -advantage of using both of these over a named list for \code{choices} is -that \code{choiceNames} allows any type of UI object to be passed through -(tag objects, icons, HTML code, ...), instead of just simple text. See -Examples.} - -\item{choiceValues}{List of names and values, respectively, that -are displayed to the user in the app and correspond to the each choice (for -this reason, \code{choiceNames} and \code{choiceValues} must have the same -length). If either of these arguments is provided, then the other -\emph{must} be provided and \code{choices} \emph{must not} be provided. The -advantage of using both of these over a named list for \code{choices} is -that \code{choiceNames} allows any type of UI object to be passed through -(tag objects, icons, HTML code, ...), instead of just simple text. See -Examples.} +this reason, \code{choiceNames} and \code{choiceValues} must have the same length). +If either of these arguments is provided, then the other \emph{must} be provided +and \code{choices} \emph{must not} be provided. The advantage of using both of these +over a named list for \code{choices} is that \code{choiceNames} allows any type of UI +object to be passed through (tag objects, icons, HTML code, ...), instead +of just simple text. See Examples.} } \description{ Change the value of a radio input on the client diff --git a/man/update_select_input_386.Rd b/man/update_select_input_386.Rd index 1ca866c..fad0785 100644 --- a/man/update_select_input_386.Rd +++ b/man/update_select_input_386.Rd @@ -5,7 +5,7 @@ \title{Update a Bootstrap 386 select input on the client} \usage{ update_select_input_386( - session, + session = getDefaultReactiveDomain(), inputId, label = NULL, choices = NULL, @@ -14,7 +14,7 @@ update_select_input_386( } \arguments{ \item{session}{The \code{session} object passed to function given to -\code{shinyServer}.} +\code{shinyServer}. Default is \code{getDefaultReactiveDomain()}.} \item{inputId}{The id of the input object.} @@ -25,7 +25,7 @@ named, then that name --- rather than the value --- is displayed to the user. It's also possible to group related inputs by providing a named list whose elements are (either named or unnamed) lists, vectors, or factors. In this case, the outermost names will be used as the group labels (leveraging -the \code{} HTML tag) for the elements in the respective sublist. See +the \verb{} HTML tag) for the elements in the respective sublist. See the example section for a small demo of this feature.} \item{selected}{The initially selected value (or multiple values if \code{multiple = TRUE}). If not specified then defaults to the first value for diff --git a/man/update_tabset_panel_386.Rd b/man/update_tabset_panel_386.Rd index e7377a4..7afd47e 100644 --- a/man/update_tabset_panel_386.Rd +++ b/man/update_tabset_panel_386.Rd @@ -4,16 +4,22 @@ \alias{update_tabset_panel_386} \title{Update a Bootstrap 386 tabset panel on the client} \usage{ -update_tabset_panel_386(session, inputId, selected = NULL) +update_tabset_panel_386( + session = getDefaultReactiveDomain(), + inputId, + selected = NULL +) } \arguments{ \item{session}{The \code{session} object passed to function given to -\code{shinyServer}.} +\code{shinyServer}. Default is \code{getDefaultReactiveDomain()}.} \item{inputId}{The id of the \code{tabsetPanel}, \code{navlistPanel}, or \code{navbarPage} object.} -\item{selected}{The name of the tab to make active.} +\item{selected}{The \code{value} (or, if none was supplied, the \code{title}) +of the tab that should be selected by default. If \code{NULL}, the first +tab will be selected.} } \description{ Update a Bootstrap 386 tabset panel on the client diff --git a/man/update_text_area_input_386.Rd b/man/update_text_area_input_386.Rd index 9be907c..7620698 100644 --- a/man/update_text_area_input_386.Rd +++ b/man/update_text_area_input_386.Rd @@ -5,7 +5,7 @@ \title{Update a Bootstrap 386 text area input on the client} \usage{ update_text_area_input_386( - session, + session = getDefaultReactiveDomain(), inputId, label = NULL, value = NULL, @@ -14,15 +14,17 @@ update_text_area_input_386( } \arguments{ \item{session}{The \code{session} object passed to function given to -\code{shinyServer}.} +\code{shinyServer}. Default is \code{getDefaultReactiveDomain()}.} \item{inputId}{The id of the input object.} \item{label}{The label to set for the input object.} -\item{value}{The value to set for the input object.} +\item{value}{Initial value.} -\item{placeholder}{The placeholder to set for the input object.} +\item{placeholder}{A character string giving the user a hint as to what can +be entered into the control. Internet Explorer 8 and 9 do not support this +option.} } \description{ Update a Bootstrap 386 text area input on the client diff --git a/man/update_text_input_386.Rd b/man/update_text_input_386.Rd index 7a9efff..a0c32dc 100644 --- a/man/update_text_input_386.Rd +++ b/man/update_text_input_386.Rd @@ -5,7 +5,7 @@ \title{Update a Bootstrap 386 text input on the client} \usage{ update_text_input_386( - session, + session = getDefaultReactiveDomain(), inputId, label = NULL, value = NULL, @@ -14,15 +14,17 @@ update_text_input_386( } \arguments{ \item{session}{The \code{session} object passed to function given to -\code{shinyServer}.} +\code{shinyServer}. Default is \code{getDefaultReactiveDomain()}.} \item{inputId}{The id of the input object.} \item{label}{The label to set for the input object.} -\item{value}{The value to set for the input object.} +\item{value}{Initial value.} -\item{placeholder}{The placeholder to set for the input object.} +\item{placeholder}{A character string giving the user a hint as to what can +be entered into the control. Internet Explorer 8 and 9 do not support this +option.} } \description{ Update a Bootstrap 386 text input on the client diff --git a/man/update_toggle_input_386.Rd b/man/update_toggle_input_386.Rd index 6fcc096..75b3edc 100644 --- a/man/update_toggle_input_386.Rd +++ b/man/update_toggle_input_386.Rd @@ -8,13 +8,13 @@ update_toggle_input_386(session, inputId, label = NULL, value = NULL) } \arguments{ \item{session}{The \code{session} object passed to function given to -\code{shinyServer}.} +\code{shinyServer}. Default is \code{getDefaultReactiveDomain()}.} \item{inputId}{The id of the input object.} \item{label}{The label to set for the input object.} -\item{value}{The value to set for the input object.} +\item{value}{Initial value (\code{TRUE} or \code{FALSE}).} } \description{ Update \link{toggle_input_386} on the client