diff --git a/.Rbuildignore b/.Rbuildignore index 72b6303a..07076337 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -11,3 +11,4 @@ ^data-raw$ ^scrape-docs/ ^vignettes/ +^.*\.sass_cache_keys diff --git a/DESCRIPTION b/DESCRIPTION index 7968f562..5347e28d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -26,7 +26,6 @@ Imports: htmltools, jsonlite, purrr, - rlang, shiny, shiny.react (>= 0.3.0) Suggests: diff --git a/R/extensions.R b/R/extensions.R index cec152d6..3fda7a9e 100644 --- a/R/extensions.R +++ b/R/extensions.R @@ -22,9 +22,8 @@ isCommandBarItem <- function(x) { #' except for `text`, `icon` (which will inserted as proper `iconProps`) and `subitems` (which will be inserted as #' proper `subMenuProps`). #' +#' @param key Key of the item. #' @param text Text to be displayed on the menu. -#' @param icon Optional name of an icon. -#' @param subitems Optional list of CommandBar items. #' @param onClick A JS function that runs on item click. By default it sends input value to `input[[key]]` #' @param ... Additional props to pass to CommandBarItem. #' @return Item suitable for use in the CommandBar. @@ -53,10 +52,13 @@ CommandBarItem <- function( #' CommandBar extension that sends values of clicked CommandBarItems #' #' @param inputId Input name -#' @return A CommandBar +#' @param ... Arguments passed to CommandBar. +#' @param itemValueGetter A function that takes a CommandBarItem and returns a value to be sent to Shiny. +#' By default it returns `key` of the item. +#' @return A CommandBar component. #' #' @seealso CommandBarItem -#' @rdname CommandBar +# #' @rdname CommandBar #' @export CommandBar.shinyInput <- function( inputId, diff --git a/man/CommandBar.Rd b/man/CommandBar.Rd index abfe47c1..d29c9307 100644 --- a/man/CommandBar.Rd +++ b/man/CommandBar.Rd @@ -1,23 +1,17 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/components.R, R/documentation.R, R/examples.R, -% R/extensions.R +% Please edit documentation in R/components.R, R/documentation.R, R/examples.R \name{CommandBar} \alias{CommandBar} -\alias{CommandBar.shinyInput} \title{CommandBar} \usage{ CommandBar(...) - -CommandBar.shinyInput(inputId, ..., itemValueGetter = function(el) el$key) } \arguments{ \item{...}{Props to pass to the component. The allowed props are listed below in the \bold{Details} section.} - -\item{inputId}{Input name} } \value{ -A CommandBar +Object with \code{shiny.tag} class suitable for use in the UI of a Shiny app. } \description{ CommandBar is a surface that houses commands that operate on the content of @@ -46,8 +40,6 @@ commands should go into an overflow where text labels can be shown. For more details and examples visit the \href{https://developer.microsoft.com/en-us/fluentui#/controls/web/CommandBar}{official docs}. The R package cannot handle each and every case, so for advanced use cases you need to work using the original docs to achieve the desired result. - -CommandBar extension that sends values of clicked CommandBarItems } \details{ \itemize{ @@ -171,6 +163,3 @@ if (interactive()) { shinyApp(ui("app"), function(input, output) server("app")) } } -\seealso{ -CommandBarItem -} diff --git a/man/CommandBar.shinyInput.Rd b/man/CommandBar.shinyInput.Rd new file mode 100644 index 00000000..f32d4946 --- /dev/null +++ b/man/CommandBar.shinyInput.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/extensions.R +\name{CommandBar.shinyInput} +\alias{CommandBar.shinyInput} +\title{CommandBar.shinyInput} +\usage{ +CommandBar.shinyInput(inputId, ..., itemValueGetter = function(el) el$key) +} +\arguments{ +\item{inputId}{Input name} + +\item{...}{Arguments passed to CommandBar.} + +\item{itemValueGetter}{A function that takes a CommandBarItem and returns a value to be sent to Shiny. +By default it returns \code{key} of the item.} +} +\value{ +A CommandBar component. +} +\description{ +CommandBar extension that sends values of clicked CommandBarItems +} +\seealso{ +CommandBarItem +} diff --git a/man/CommandBarItem.Rd b/man/CommandBarItem.Rd index aeb4f27e..074e8a9f 100644 --- a/man/CommandBarItem.Rd +++ b/man/CommandBarItem.Rd @@ -12,15 +12,13 @@ CommandBarItem( ) } \arguments{ +\item{key}{Key of the item.} + \item{text}{Text to be displayed on the menu.} \item{onClick}{A JS function that runs on item click. By default it sends input value to \code{input[[key]]}} \item{...}{Additional props to pass to CommandBarItem.} - -\item{icon}{Optional name of an icon.} - -\item{subitems}{Optional list of CommandBar items.} } \value{ Item suitable for use in the CommandBar.