mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-15 01:48:11 -05:00
* textInput: Add updateOn parameter and allow setting debounce delay * `devtools::document()` (GitHub Actions) * `yarn build` (GitHub Actions) * Update news * Remove debounce parameter * `devtools::document()` (GitHub Actions) * `yarn build` (GitHub Actions) * Add updateOn parameter to numericInput, passwordInput * Add updateOn to textAreaInput() * `devtools::document()` (GitHub Actions) * feat: Ignore change events unless from server messages when `updateOn="blur"` * refactor: `updateOn="change"` instead of `"input"` * feat: Update inputs on Enter or Cmd/Ctrl+Enter (textarea) * chore: Document `...` and ensure they are empty * chore: Use `rlang::arg_match()` * chore: code style (air format) * fix: textAreaInput, not inputTextArea * docs(NEWS): Minor edit * chore: If element has focus, ignore change event --------- Co-authored-by: wch <wch@users.noreply.github.com> Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
59 lines
1.3 KiB
R
59 lines
1.3 KiB
R
#' Create a password input control
|
|
#'
|
|
#' Create an password control for entry of passwords.
|
|
#'
|
|
#' @inheritParams textInput
|
|
#' @return A text input control that can be added to a UI definition.
|
|
#'
|
|
#' @family input elements
|
|
#' @seealso [updateTextInput()]
|
|
#'
|
|
#' @section Server value:
|
|
#' A character string of the password input. The default value is `""`
|
|
#' unless `value` is provided.
|
|
#'
|
|
#' @examples
|
|
#' ## Only run examples in interactive R sessions
|
|
#' if (interactive()) {
|
|
#'
|
|
#' ui <- fluidPage(
|
|
#' passwordInput("password", "Password:"),
|
|
#' actionButton("go", "Go"),
|
|
#' verbatimTextOutput("value")
|
|
#' )
|
|
#' server <- function(input, output) {
|
|
#' output$value <- renderText({
|
|
#' req(input$go)
|
|
#' isolate(input$password)
|
|
#' })
|
|
#' }
|
|
#' shinyApp(ui, server)
|
|
#' }
|
|
#' @export
|
|
passwordInput <- function(
|
|
inputId,
|
|
label,
|
|
value = "",
|
|
width = NULL,
|
|
placeholder = NULL,
|
|
...,
|
|
updateOn = c("change", "blur")
|
|
) {
|
|
rlang::check_dots_empty()
|
|
updateOn <- rlang::arg_match(updateOn)
|
|
|
|
div(
|
|
class = "form-group shiny-input-container",
|
|
style = css(width = validateCssUnit(width)),
|
|
shinyInputLabel(inputId, label),
|
|
tags$input(
|
|
id = inputId,
|
|
type = "password",
|
|
class = "shiny-input-password form-control",
|
|
value = value,
|
|
placeholder = placeholder,
|
|
`data-update-on` = updateOn
|
|
)
|
|
)
|
|
}
|