From 65c8494ac6dcc7314ff53ed91aacd4b8abf63100 Mon Sep 17 00:00:00 2001 From: pvictor Date: Wed, 30 Oct 2024 11:00:28 +0100 Subject: [PATCH] deprecated knob and switch input --- DESCRIPTION | 2 +- R/input-knob.R | 5 ++++ R/input-pretty.R | 42 ++++++++++++++++------------ R/input-switch.R | 3 +- man/figures/lifecycle-deprecated.svg | 21 ++++++++++++++ man/knobInput.Rd | 3 +- man/switchInput.Rd | 3 +- 7 files changed, 57 insertions(+), 22 deletions(-) create mode 100644 man/figures/lifecycle-deprecated.svg diff --git a/DESCRIPTION b/DESCRIPTION index 926739b0..f0a0b5ca 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: shinyWidgets Title: Custom Inputs Widgets for Shiny -Version: 0.8.7 +Version: 0.8.7.9000 Authors@R: c( person("Victor", "Perrier", email = "victor.perrier@dreamrs.fr", role = c("aut", "cre", "cph")), person("Fanny", "Meyer", role = "aut"), diff --git a/R/input-knob.R b/R/input-knob.R index 59cf5a96..7a95b1f3 100644 --- a/R/input-knob.R +++ b/R/input-knob.R @@ -2,6 +2,11 @@ #' Knob Input #' +#' @description +#' \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} +#' The JavaScript library used by this widget is no longer actively maintained. +#' +#' #' @param inputId The \code{input} slot that will be used to access the value. #' @param label Display label for the control, or NULL for no label. #' @param value Initial value. diff --git a/R/input-pretty.R b/R/input-pretty.R index 1e7f230c..b9340b00 100644 --- a/R/input-pretty.R +++ b/R/input-pretty.R @@ -135,16 +135,22 @@ prettyToggle <- function(inputId, inline = FALSE, width = NULL) { value <- shiny::restoreInput(id = inputId, default = value) - status_on <- match.arg(status_on, c("default", "primary", "success", - "info", "danger", "warning")) - status_off <- match.arg(status_off, c("default", "primary", - "success", "info", "danger", "warning")) + status_on <- match.arg( + status_on, + c("default", "primary", "success", "info", "danger", "warning") + ) + status_off <- match.arg( + status_off, + c("default", "primary", "success", "info", "danger", "warning") + ) shape <- match.arg(shape) icon_on <- tag_add_class_icon(icon_on) icon_off <- tag_add_class_icon(icon_off) - if (!is.null(animation)) - animation <- match.arg(animation, c("smooth", "jelly", "tada", - "rotate", "pulse")) + if (!is.null(animation)) { + animation <- match.arg( + animation, c("smooth", "jelly", "tada", "rotate", "pulse") + ) + } inputTag <- tags$input(id = inputId, type = "checkbox") if (!is.null(value) && value) inputTag$attribs$checked <- "checked" @@ -155,23 +161,23 @@ prettyToggle <- function(inputId, style = if (inline) "display: inline-block; margin-right: 10px;", tags$div( class = "pretty p-toggle", inputTag, - class = if(is.null(icon_on) & is.null(icon_off)) "p-default", - class = if(plain) "p-plain", - class = if(bigger) "p-bigger", - class = if(shape!="square") paste0("p-", shape), - class = if(fill) "p-fill", class=if(thick) "p-thick", - class = if(!is.null(icon_on) | !is.null(icon_off)) "p-icon", - class = if(!is.null(animation)) paste0("p-", animation), + class = if (is.null(icon_on) & is.null(icon_off)) "p-default", + class = if (plain) "p-plain", + class = if (bigger) "p-bigger", + class = if (shape != "square") paste0("p-", shape), + class = if (fill) "p-fill", class = if (thick) "p-thick", + class = if (!is.null(icon_on) | !is.null(icon_off)) "p-icon", + class = if (!is.null(animation)) paste0("p-", animation), tags$div( class = "state p-on", - class = if(status_on != "default") paste0("p-", status_on, if(outline)"-o"), - if(!is.null(icon_on)) icon_on, + class = if (status_on != "default") paste0("p-", status_on, if (outline) "-o"), + if (!is.null(icon_on)) icon_on, tags$label(tags$span(label_on)) ), tags$div( class = "state p-off", - class = if(status_off != "default") paste0("p-", status_off, if(outline)"-o"), - if(!is.null(icon_off)) icon_off, + class = if (status_off != "default") paste0("p-", status_off, if (outline) "-o"), + if (!is.null(icon_off)) icon_off, tags$label(tags$span(label_off)) ) ) diff --git a/R/input-switch.R b/R/input-switch.R index 8855aca0..ad01e84f 100644 --- a/R/input-switch.R +++ b/R/input-switch.R @@ -1,7 +1,8 @@ #' @title Bootstrap Switch Input Control #' #' @description -#' Create a toggle switch. +#' \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} +#' The JavaScript library used by this widget is no longer actively maintained. #' #' @param inputId The `input` slot that will be used to access the value. #' @param label Display a text in the center of the switch. diff --git a/man/figures/lifecycle-deprecated.svg b/man/figures/lifecycle-deprecated.svg new file mode 100644 index 00000000..b61c57c3 --- /dev/null +++ b/man/figures/lifecycle-deprecated.svg @@ -0,0 +1,21 @@ + + lifecycle: deprecated + + + + + + + + + + + + + + + lifecycle + + deprecated + + diff --git a/man/knobInput.Rd b/man/knobInput.Rd index 190afdb2..8e9b4787 100644 --- a/man/knobInput.Rd +++ b/man/knobInput.Rd @@ -88,7 +88,8 @@ if \code{FALSE} value is updated when user release the widget.} Numeric value server-side. } \description{ -Knob Input +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} +The JavaScript library used by this widget is no longer actively maintained. } \examples{ if (interactive()) { diff --git a/man/switchInput.Rd b/man/switchInput.Rd index 1dd492c3..127994f3 100644 --- a/man/switchInput.Rd +++ b/man/switchInput.Rd @@ -51,7 +51,8 @@ switchInput( A switch control that can be added to a UI definition. } \description{ -Create a toggle switch. +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} +The JavaScript library used by this widget is no longer actively maintained. } \note{ For more information, see the project on Github