R/bulma-state.R

Defines functions bulma_readonly bulma_disabled bulma_loading bulma_inverted bulma_selected bulma_rounded bulma_outlined bulma_state

Documented in bulma_disabled bulma_inverted bulma_loading bulma_outlined bulma_readonly bulma_rounded bulma_selected bulma_state

#' @title
#' Bulma State Modifier
#'
#' @description
#' State modifiers say something about the state of the actual object. Bulma
#' contains a lot of modifiers that are broadly applicableto different
#' elements.
#'
#' [Modifiers Syntax](https://bulma.io/documentation/overview/modifiers/)
#'
#' @family Bulma Modifiers
#' @name bulma_state
NULL

#' @describeIn bulma_state
#' adds a state to the chosen element
#'
#' @param tag   (tag) tag to be modified
#' @param state (string) state to be added.
#'
#' @export
bulma_state <- function(tag, state = c("hovered", "focused", "active",
                                       "loading", "static")) {
  bulma_is(tag, match_arg(state))
}

#' @describeIn bulma_state
#' outlined creates a non solidly filled outline.
#'
#' @export
bulma_outlined <- function(tag) {
  bulma_is(tag, "outlined")
}

#' @describeIn bulma_state
#' rounds out the corners of the element
#'
#' @export
bulma_rounded <- function(tag) {
  bulma_is(tag, "rounded")
}

#' @describeIn bulma_state
#' makes the element appear selected
#'
#' @export
bulma_selected <- function(tag) {
  bulma_is(tag, "selected")
}

#' @describeIn bulma_state
#' inverts the colors of the element
#'
#' @export
bulma_inverted <- function(tag) {
  bulma_is(tag, "inverted")
}

#' @describeIn bulma_state
#' creates a loading appearance on the element
#'
#' @export
bulma_loading <- function(tag) {
  bulma_is(tag, "loading")
}

#' @describeIn bulma_state
#' disables the element by graying it out and also not allowing any edits.
#'
#' @export
bulma_disabled <- function(tag) {
  tagAppendAttributes(tag, disabled = NA)
}

#' @describeIn bulma_state
#' does not allow the element to bed edited.
#'
#' @export
bulma_readonly <- function(tag) {
  tagAppendAttributes(tag, readonly = NA)
}
tjpalanca/bulma.R documentation built on Dec. 23, 2021, 10:58 a.m.