Skip to content

Commit

Permalink
feat(style): finalize style and design utilities (nteetor#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
nteetor committed Mar 14, 2020
1 parent 28aba91 commit 9c57476
Show file tree
Hide file tree
Showing 65 changed files with 1,473 additions and 383 deletions.
8 changes: 8 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Depends:
Imports:
htmltools (>= 0.4.0),
magrittr,
rlang,
lifecycle,
utils
Suggests:
Expand Down Expand Up @@ -79,10 +80,17 @@ Collate:
'range.R'
'reexports.R'
'select.R'
'style-affix.R'
'style-background.R'
'style-border.R'
'style-display.R'
'style-float.R'
'style-font.R'
'style-scroll.R'
'style-shadow.R'
'style-sizing.R'
'style-spacing.R'
'style.R'
'textual.R'
'toast.R'
'tooltip.R'
Expand Down
72 changes: 49 additions & 23 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Generated by roxygen2: do not edit by hand

S3method(affix,default)
S3method(affix,rlang_box_splice)
S3method(affix,shiny.tag)
S3method(affix,yonder_style_pronoun)
S3method(affix,yonder_style_pronoun.default)
S3method(background,default)
S3method(background,rlang_box_splice)
S3method(background,shiny.tag)
S3method(background,yonder_alert)
S3method(background,yonder_badge)
Expand All @@ -15,62 +13,72 @@ S3method(background,yonder_checkbar)
S3method(background,yonder_checkbox)
S3method(background,yonder_dropdown)
S3method(background,yonder_list_group)
S3method(background,yonder_listgroup)
S3method(background,yonder_menu)
S3method(background,yonder_radio)
S3method(background,yonder_radiobar)
S3method(background,yonder_style_pronoun)
S3method(background,yonder_style_pronoun.default)
S3method(background,yonder_style_pronoun.yonder_alert)
S3method(background,yonder_style_pronoun.yonder_badge)
S3method(background,yonder_style_pronoun.yonder_button)
S3method(background,yonder_style_pronoun.yonder_button_group)
S3method(background,yonder_style_pronoun.yonder_checkbar)
S3method(background,yonder_style_pronoun.yonder_checkbox)
S3method(background,yonder_style_pronoun.yonder_dropdown)
S3method(background,yonder_style_pronoun.yonder_listgroup)
S3method(background,yonder_style_pronoun.yonder_menu)
S3method(background,yonder_style_pronoun.yonder_radio)
S3method(background,yonder_style_pronoun.yonder_radiobar)
S3method(background,yonder_style_pronoun.yonder_switch)
S3method(background,yonder_switch)
S3method(border,default)
S3method(border,rlang_box_splice)
S3method(border,shiny.tag)
S3method(border,yonder_style_pronoun.default)
S3method(display,default)
S3method(display,rlang_box_splice)
S3method(display,shiny.tag)
S3method(display,yonder_style_pronoun)
S3method(display,yonder_style_pronoun.default)
S3method(flex,default)
S3method(flex,rlang_box_splice)
S3method(flex,shiny.tag)
S3method(flex,yonder_style_pronoun)
S3method(float,default)
S3method(float,rlang_box_splice)
S3method(float,shiny.tag)
S3method(float,yonder_style_pronoun)
S3method(float,yonder_style_pronoun.default)
S3method(font,default)
S3method(font,rlang_box_splice)
S3method(font,shiny.tag)
S3method(font,yonder_style_pronoun)
S3method(font,yonder_style_pronoun.default)
S3method(height,default)
S3method(height,rlang_box_splice)
S3method(height,shiny.tag)
S3method(height,yonder_style_pronoun)
S3method(height,yonder_style_pronoun.default)
S3method(margin,default)
S3method(margin,rlang_box_splice)
S3method(margin,shiny.tag)
S3method(margin,yonder_style_pronoun)
S3method(margin,yonder_style_pronoun.default)
S3method(padding,default)
S3method(padding,rlang_box_splice)
S3method(padding,shiny.tag)
S3method(padding,yonder_style_pronoun)
S3method(scroll,default)
S3method(scroll,rlang_box_splice)
S3method(scroll,shiny.tag)
S3method(scroll,yonder_style_pronoun)
S3method(padding,yonder_style_pronoun.default)
S3method(shadow,default)
S3method(shadow,rlang_box_splice)
S3method(shadow,shiny.tag)
S3method(shadow,yonder_style_pronoun)
S3method(shadow,yonder_style_pronoun.default)
S3method(width,default)
S3method(width,rlang_box_splice)
S3method(width,shiny.tag)
S3method(width,yonder_style_pronoun)
S3method(width,yonder_style_pronoun.default)
export("%>%")
export(.style)
export(active)
export(affix)
export(affix.rlang_box_splice)
export(affix.yonder_style_pronoun)
export(alert)
export(background)
export(background.rlang_box_splice)
export(background.yonder_style_pronoun)
export(badge)
export(blockquote)
export(border)
export(border.rlang_box_splice)
export(border.yonder_style_pronoun)
export(buttonGroupInput)
export(buttonInput)
export(card)
Expand All @@ -90,27 +98,36 @@ export(d3)
export(d4)
export(deck)
export(display)
export(display.rlang_box_splice)
export(display.yonder_style_pronoun)
export(dropdown)
export(fieldset)
export(figure)
export(fileInput)
export(flex)
export(float)
export(float.yonder_style_pronoun)
export(font)
export(font.rlang_box_splice)
export(font.yonder_style_pronoun)
export(formGroup)
export(formInput)
export(formRow)
export(formSubmit)
export(groupSelectInput)
export(groupTextInput)
export(height)
export(height.rlang_box_splice)
export(height.yonder_style_pronoun)
export(hideCollapsePane)
export(hideNavPane)
export(img)
export(jumbotron)
export(linkInput)
export(listGroupInput)
export(margin)
export(margin.rlang_box_splice)
export(margin.yonder_style_pronoun)
export(menuInput)
export(modal)
export(navContent)
Expand All @@ -119,6 +136,8 @@ export(navPane)
export(navbar)
export(numberInput)
export(padding)
export(padding.rlang_box_splice)
export(padding.yonder_style_pronoun)
export(popover)
export(pre)
export(radioInput)
Expand All @@ -127,8 +146,13 @@ export(rangeInput)
export(removeContent)
export(replaceContent)
export(scroll)
export(scroll.default)
export(scroll.rlang_box_splice)
export(scroll.shiny.tag)
export(scroll.yonder_style_pronoun)
export(selectInput)
export(shadow)
export(shadow.yonder_style_pronoun)
export(showCollapsePane)
export(showModal)
export(showNavPane)
Expand Down Expand Up @@ -159,6 +183,8 @@ export(updateSwitchInput)
export(updateTextInput)
export(webpage)
export(width)
export(width.rlang_box_splice)
export(width.yonder_style_pronoun)
import(rlang)
importFrom(htmltools,HTML)
importFrom(htmltools,attachDependencies)
Expand Down
2 changes: 1 addition & 1 deletion R/badge.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#' "Clicks",
#' badge(id = "counter") %>%
#' margin(left = 2) %>%
#' background("teal")
#' background("info")
#' )
#' )
#' )
Expand Down
22 changes: 11 additions & 11 deletions R/button.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,16 @@
#' buttonInput(
#' .style %>%
#' background("danger") %>%
#' width(75) # <-
#' width(75), # <-
#' id = "button4",
#' label = "Full and back again",
#' fill = TRUE # <-
#' )
#'
#' ### Reactive links
#'
#' div("Curabitur ", linkInput("link1", "vulputate"), " vestibulum lorem.")
#' div("Curabitur", linkInput(id = "link1", label = "vulputate"),
#' "vestibulum lorem.")
#'
#' ### Stretched buttons and links
#'
Expand All @@ -97,7 +98,7 @@
#' "the hover."),
#' buttonInput(
#' .style %>%
#' background("primary")
#' background("primary"),
#' id = "go",
#' label = "Go go go",
#' stretch = TRUE
Expand Down Expand Up @@ -249,7 +250,7 @@ updateLinkInput <- function(id, label = NULL, value = NULL,
#' @param choices A character vector specifying the labels for each button in
#' the group.
#'
#' @param values A vector of values specifying the values of each button in the
#' @param values A character vector specifying the values of each button in the
#' group, defaults to `choices`.
#'
#' @param direction One of `"horizontal"` or `"vertical"` specifying the layout
Expand All @@ -261,6 +262,8 @@ updateLinkInput <- function(id, label = NULL, value = NULL,
#' @param disable One of `values` indicating individual buttons to disable or
#' `TRUE` to disable the entire input, defaults to `NULL`.
#'
#' @param labels Deprecated, see `values`.
#'
#' @family inputs
#' @export
#' @examples
Expand All @@ -276,11 +279,11 @@ updateLinkInput <- function(id, label = NULL, value = NULL,
#' ### Styling the button group
#'
#' buttonGroupInput(
#' .style %>%
#' background("primary"),
#' id = "group2",
#' choices = c("Button 1", "Button 2", "Button 3")
#' ) %>%
#' background("blue") %>%
#' width("1/3")
#' )
#'
buttonGroupInput <- function(..., id, choices = NULL, values = choices,
labels = deprecated(),
Expand Down Expand Up @@ -316,10 +319,7 @@ buttonGroupInput <- function(..., id, choices = NULL, values = choices,
buttons
)

args <- style_dots_eval(
...,
.style = style_pronoun("yonder_button_group")
)
args <- style_dots_eval(..., .style = style_pronoun("yonder_button_group"))

tag <- tag_extend_with(tag, args)

Expand Down
23 changes: 14 additions & 9 deletions R/card.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,30 @@
#'
#' deck(
#' card(
#' .style %>%
#' border("info") %>%
#' font("info"),
#' header = "Donec pretium posuere tellus",
#' p("Donec hendrerit tempor tellus."),
#' p("Cras placerat accumsan nulla.")
#' ) %>%
#' font(color = "teal"),
#' ),
#' card(
#' .style %>%
#' border("danger") %>%
#' font("danger"),
#' p("Aliquam posuere."),
#' p("Phasellus neque orci, porta a, aliquet quis, semper a, massa."),
#' p("Pellentesque dapibus suscipit ligula.")
#' ) %>%
#' border("orange"),
#' ),
#' card(
#' .style %>%
#' background("dark") %>%
#' font("light"),
#' header = "Phasellus lacus",
#' p("Etiam laoreet quam sed arcu."),
#' p("Etiam vel tortor sodales tellus ultricies commodo."),
#' footer = "Nam euismod tellus id erat."
#' ) %>%
#' background("grey") %>%
#' font(color = "indigo")
#' )
#' )
#'
#' ### Cards with list groups
Expand Down Expand Up @@ -180,11 +185,11 @@ card <- function(..., header = NULL, footer = NULL) {

args <- style_dots_eval(
...,
.context = list(prefix = "card"),
.style = style_pronoun("yonder_card"),
.mask = card_mask
)

is_named <- which(names2(args) != "")
is_named <- names2(args) != ""

args[!is_named] <- lapply(args[!is_named], function(x) {
if (is_tag(x) && tag_class_re(x, "row|list-group")) {
Expand Down
Loading

0 comments on commit 9c57476

Please sign in to comment.