diff --git a/R/chakra.R b/R/chakra.R index fce1cdb..c3fa619 100644 --- a/R/chakra.R +++ b/R/chakra.R @@ -10,6 +10,8 @@ #' \code{\link{jsx}} function, a Shiny widget, or some HTML code created with #' the \code{\link[htmltools:HTML]{HTML}} function #' +#' @return No return value, called for side effect. +#' #' @export #' @importFrom utils URLencode #' @seealso \code{\link{withStates}} @@ -222,6 +224,9 @@ withStates <- function(component, states){ #' #' @param ... elements to include within the page #' +#' @return A UI definition that can be passed to the +#' \code{\link[shiny:shinyUI]{shinyUI}} function. +#' #' @importFrom htmltools htmlDependency tags attachDependencies #' @export chakraPage <- function(...){ @@ -252,6 +257,9 @@ chakraPage <- function(...){ #' @param componentId component id #' @param ... elements to include within the component #' +#' @return A Shiny widget to use in a UI definition, preferably in +#' \code{\link{chakraPage}}. +#' #' @importFrom reactR createReactShinyInput #' @importFrom htmltools htmlDependency tags attachDependencies #' @export @@ -299,6 +307,8 @@ chakraComponent <- function(componentId, ...){ #' @description List of Chakra color schemes (to use as a \code{colorScheme} #' attribute in e.g. Chakra buttons). #' +#' @return The names of the Chakra color schemes in a vector. +#' #' @export #' #' @examples @@ -329,6 +339,8 @@ chakraColorSchemes <- function(){ #' @title Chakra icons #' @description List of Chakra icons. #' +#' @return The names of the Chakra icons in a vector. +#' #' @export #' @details See \href{https://chakra-ui.com/docs/media-and-icons/icon#all-icons}{all chakra icons}. #' diff --git a/R/chakraCombinedSlider.R b/R/chakraCombinedSlider.R index faad906..f5b6dc8 100644 --- a/R/chakraCombinedSlider.R +++ b/R/chakraCombinedSlider.R @@ -15,6 +15,9 @@ #' @param decrementStepperColor color of the decrement stepper #' @param ... other attributes of \code{NumberInput} #' +#' @return A list of options to be passed to the +#' \code{numericInputOptions} argument in \code{\link{chakraCombinedSlider}}. +#' #' @importFrom htmltools validateCssUnit #' @export numberInputOptions <- function( diff --git a/R/chakraExample.R b/R/chakraExample.R index 35eed2e..2ed1df9 100644 --- a/R/chakraExample.R +++ b/R/chakraExample.R @@ -1,6 +1,8 @@ #' @title Chakra examples #' @description List of Chakra examples. #' +#' @return No return value, only prints a message listing the Chakra examples. +#' #' @export #' #' @examples @@ -23,6 +25,8 @@ chakraExamples <- function(){ #' \code{\link[shiny:runApp]{runApp}} #' @param ... arguments passed to \code{\link[shiny:runApp]{runApp}} #' +#' @return No return value, just launches a Shiny app. +#' #' @export #' @importFrom shiny runApp #' diff --git a/R/jseval_and_hooks.R b/R/jseval_and_hooks.R index 3dd359c..ecb0413 100644 --- a/R/jseval_and_hooks.R +++ b/R/jseval_and_hooks.R @@ -1,7 +1,9 @@ #' @title Evaluate JS code #' @description Evaluate JavaScript code in the application. #' -#' @param code JavaScript code given as a sting +#' @param code JavaScript code given as a string +#' +#' @return A list containing the URL-encoded JavaScript code. #' #' @export #' @importFrom utils URLencode @@ -44,6 +46,8 @@ jseval <- function(code){ #' #' @param state name of the state #' +#' @return A list like the return value of \code{\link{jseval}}. +#' #' @export #' @seealso \code{\link{withStates}} #' @@ -124,6 +128,8 @@ getState <- function(state){ #' #' @param value a string #' +#' @return A list containing some URL-encoded JavaScript code. +#' #' @export #' @importFrom utils URLencode #' @details See \href{https://chakra-ui.com/docs/hooks/use-clipboard}{useClipboard}. @@ -199,8 +205,11 @@ useClipboard <- function(value){ #' @title The `useRef` hook #' @description The React `useRef` hook. +#' #' @param initialValue optional initial value #' +#' @return A list like the return value of \code{\link{jseval}}. +#' #' @export #' @importFrom jsonlite toJSON useRef <- function(initialValue = NA){ @@ -218,6 +227,8 @@ useRef <- function(initialValue = NA){ #' #' @param defaultIsOpen Boolean, the initial value of the \code{isOpen} property #' +#' @return A list containing some URL-encoded JavaScript code. +#' #' @export #' @importFrom utils URLencode #' @details See \href{https://chakra-ui.com/docs/hooks/use-disclosure}{useDisclosure}. @@ -284,6 +295,8 @@ useDisclosure <- function(defaultIsOpen = FALSE){ #' @title The `useToast` hook #' @description The `useToast` hook. #' +#' @return A list containing some URL-encoded JavaScript code. +#' #' @export #' @importFrom utils URLencode #' @note It does not work well. Use \code{\link{createStandaloneToast}} instead. @@ -294,6 +307,8 @@ useToast <- function(){ #' @title The `createStandaloneToast` hook #' @description The `createStandaloneToast` hook. #' +#' @return A list containing some URL-encoded JavaScript code. +#' #' @export #' @importFrom utils URLencode #' @details See \href{https://chakra-ui.com/docs/feedback/toast#standalone-toasts}{Standalone toasts}. @@ -357,6 +372,8 @@ createStandaloneToast <- function(){ #' of the \code{\link{withStates}} function #' @param property the hook property you want to get #' +#' @return A list like the return value of \code{\link{jseval}}. +#' #' @export getHookProperty <- function(hook, property){ stopifnot(isString(hook)) diff --git a/R/jsx.R b/R/jsx.R index 065d651..8102f19 100644 --- a/R/jsx.R +++ b/R/jsx.R @@ -27,7 +27,10 @@ fixjsx <- function(jsx){ # assumes `checkjsx` has been executed before #' @description Create a JSX element. #' #' @param element the JSX element given as a string -#' @param preamble JavaScript code to run before +#' @param preamble JavaScript code to run before, given as a string +#' +#' @return A list containing the URL-encoded strings \code{element} +#' and \code{preamble}. #' #' @export #' @importFrom utils URLencode diff --git a/R/jsxParser.R b/R/jsxParser.R index c943b56..2bcefac 100644 --- a/R/jsxParser.R +++ b/R/jsxParser.R @@ -94,6 +94,9 @@ parsedJSX2component <- function(jsx, ctx){ #' @param jsxString JSX code given as a string #' @param clipboard whether to copy the output to the clipboard #' +#' @return No return value, only prints the code in the console and copy it +#' to the clipboard if \code{clipboard = TRUE}. +#' #' @export #' @importFrom formatR tidy_source #' diff --git a/cran-comments.md b/cran-comments.md index 952e550..681b6a2 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,4 +1,4 @@ -This is a resubmission. I fixed the 'Title' field, it was not in title case. +This is a resubmission. I completed the `@return` fields of the documentations. ## Test environments diff --git a/man/chakraColorSchemes.Rd b/man/chakraColorSchemes.Rd index b50a039..7eb1d4a 100644 --- a/man/chakraColorSchemes.Rd +++ b/man/chakraColorSchemes.Rd @@ -6,6 +6,9 @@ \usage{ chakraColorSchemes() } +\value{ +The names of the Chakra color schemes in a vector. +} \description{ List of Chakra color schemes (to use as a \code{colorScheme} attribute in e.g. Chakra buttons). diff --git a/man/chakraComponent.Rd b/man/chakraComponent.Rd index be93081..70e047b 100644 --- a/man/chakraComponent.Rd +++ b/man/chakraComponent.Rd @@ -11,6 +11,10 @@ chakraComponent(componentId, ...) \item{...}{elements to include within the component} } +\value{ +A Shiny widget to use in a UI definition, preferably in + \code{\link{chakraPage}}. +} \description{ Create a Chakra component. } diff --git a/man/chakraExample.Rd b/man/chakraExample.Rd index c3eadb9..3ad1574 100644 --- a/man/chakraExample.Rd +++ b/man/chakraExample.Rd @@ -14,6 +14,9 @@ chakraExample(example, display.mode = "showcase", ...) \item{...}{arguments passed to \code{\link[shiny:runApp]{runApp}}} } +\value{ +No return value, just launches a Shiny app. +} \description{ A function to run examples of Shiny apps with Chakra components. } diff --git a/man/chakraExamples.Rd b/man/chakraExamples.Rd index 89469fd..614db8b 100644 --- a/man/chakraExamples.Rd +++ b/man/chakraExamples.Rd @@ -6,6 +6,9 @@ \usage{ chakraExamples() } +\value{ +No return value, only prints a message listing the Chakra examples. +} \description{ List of Chakra examples. } diff --git a/man/chakraIcons.Rd b/man/chakraIcons.Rd index 764863d..177ecaa 100644 --- a/man/chakraIcons.Rd +++ b/man/chakraIcons.Rd @@ -6,6 +6,9 @@ \usage{ chakraIcons() } +\value{ +The names of the Chakra icons in a vector. +} \description{ List of Chakra icons. } diff --git a/man/chakraPage.Rd b/man/chakraPage.Rd index fbe793f..f0ba591 100644 --- a/man/chakraPage.Rd +++ b/man/chakraPage.Rd @@ -9,6 +9,10 @@ chakraPage(...) \arguments{ \item{...}{elements to include within the page} } +\value{ +A UI definition that can be passed to the + \code{\link[shiny:shinyUI]{shinyUI}} function. +} \description{ Function to be used as the \code{ui} element of a Shiny app; it is intended to contain some \code{\link{chakraComponent}} elements. diff --git a/man/createStandaloneToast.Rd b/man/createStandaloneToast.Rd index 58023bd..511a691 100644 --- a/man/createStandaloneToast.Rd +++ b/man/createStandaloneToast.Rd @@ -6,6 +6,9 @@ \usage{ createStandaloneToast() } +\value{ +A list containing some URL-encoded JavaScript code. +} \description{ The `createStandaloneToast` hook. } diff --git a/man/getHookProperty.Rd b/man/getHookProperty.Rd index f787fa2..6297572 100644 --- a/man/getHookProperty.Rd +++ b/man/getHookProperty.Rd @@ -12,6 +12,9 @@ of the \code{\link{withStates}} function} \item{property}{the hook property you want to get} } +\value{ +A list like the return value of \code{\link{jseval}}. +} \description{ Chakra hooks are JavaScript objects; this function allows to get a property (key) of a hook. See \code{\link{useDisclosure}} for an diff --git a/man/getState.Rd b/man/getState.Rd index 4c59343..e650caa 100644 --- a/man/getState.Rd +++ b/man/getState.Rd @@ -9,6 +9,9 @@ getState(state) \arguments{ \item{state}{name of the state} } +\value{ +A list like the return value of \code{\link{jseval}}. +} \description{ Get the value of a React state. } diff --git a/man/jseval.Rd b/man/jseval.Rd index 3569576..f6501eb 100644 --- a/man/jseval.Rd +++ b/man/jseval.Rd @@ -7,7 +7,10 @@ jseval(code) } \arguments{ -\item{code}{JavaScript code given as a sting} +\item{code}{JavaScript code given as a string} +} +\value{ +A list containing the URL-encoded JavaScript code. } \description{ Evaluate JavaScript code in the application. diff --git a/man/jsx.Rd b/man/jsx.Rd index 5a20acf..08e6b6d 100644 --- a/man/jsx.Rd +++ b/man/jsx.Rd @@ -9,7 +9,11 @@ jsx(element, preamble = "") \arguments{ \item{element}{the JSX element given as a string} -\item{preamble}{JavaScript code to run before} +\item{preamble}{JavaScript code to run before, given as a string} +} +\value{ +A list containing the URL-encoded strings \code{element} + and \code{preamble}. } \description{ Create a JSX element. diff --git a/man/jsxString2code.Rd b/man/jsxString2code.Rd index 488f522..0c54987 100644 --- a/man/jsxString2code.Rd +++ b/man/jsxString2code.Rd @@ -11,6 +11,10 @@ jsxString2code(jsxString, clipboard = TRUE) \item{clipboard}{whether to copy the output to the clipboard} } +\value{ +No return value, only prints the code in the console and copy it + to the clipboard if \code{clipboard = TRUE}. +} \description{ Given a JSX string, this function prints the code of the corresponding React component that can be used in diff --git a/man/numberInputOptions.Rd b/man/numberInputOptions.Rd index fe8c132..3ad1353 100644 --- a/man/numberInputOptions.Rd +++ b/man/numberInputOptions.Rd @@ -40,6 +40,10 @@ e.g. \code{"3px"} or \code{"medium"}} \item{...}{other attributes of \code{NumberInput}} } +\value{ +A list of options to be passed to the + \code{numericInputOptions} argument in \code{\link{chakraCombinedSlider}}. +} \description{ Create a list of options to be passed to the \code{numericInputOptions} argument in \code{\link{chakraCombinedSlider}}. diff --git a/man/setReactState.Rd b/man/setReactState.Rd index a0a104d..7e2ce38 100644 --- a/man/setReactState.Rd +++ b/man/setReactState.Rd @@ -19,6 +19,9 @@ to JSON, a React component, a JSX element created with the \code{\link{jsx}} function, a Shiny widget, or some HTML code created with the \code{\link[htmltools:HTML]{HTML}} function} } +\value{ +No return value, called for side effect. +} \description{ Set a React state from the Shiny server. } diff --git a/man/useClipboard.Rd b/man/useClipboard.Rd index 0888f44..37f80c7 100644 --- a/man/useClipboard.Rd +++ b/man/useClipboard.Rd @@ -9,6 +9,9 @@ useClipboard(value) \arguments{ \item{value}{a string} } +\value{ +A list containing some URL-encoded JavaScript code. +} \description{ The `useClipboard` hook. } diff --git a/man/useDisclosure.Rd b/man/useDisclosure.Rd index 4e164fb..b1742ba 100644 --- a/man/useDisclosure.Rd +++ b/man/useDisclosure.Rd @@ -9,6 +9,9 @@ useDisclosure(defaultIsOpen = FALSE) \arguments{ \item{defaultIsOpen}{Boolean, the initial value of the \code{isOpen} property} } +\value{ +A list containing some URL-encoded JavaScript code. +} \description{ The `useDisclosure` hook. } diff --git a/man/useRef.Rd b/man/useRef.Rd index 02ea2c8..d7da3a9 100644 --- a/man/useRef.Rd +++ b/man/useRef.Rd @@ -9,6 +9,9 @@ useRef(initialValue = NA) \arguments{ \item{initialValue}{optional initial value} } +\value{ +A list like the return value of \code{\link{jseval}}. +} \description{ The React `useRef` hook. } diff --git a/man/useToast.Rd b/man/useToast.Rd index b04893f..a8d1f78 100644 --- a/man/useToast.Rd +++ b/man/useToast.Rd @@ -6,6 +6,9 @@ \usage{ useToast() } +\value{ +A list containing some URL-encoded JavaScript code. +} \description{ The `useToast` hook. }