Skip to content

Commit

Permalink
Merge pull request #309 from Appsilon/develop
Browse files Browse the repository at this point in the history
v 0.4.0
  • Loading branch information
krystian8207 committed Sep 18, 2020
2 parents 4a9e13f + 6ade730 commit 9dfe9b3
Show file tree
Hide file tree
Showing 221 changed files with 8,004 additions and 1,348 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Expand Up @@ -19,3 +19,6 @@
^README.md$
^STYLEGUIDE.md$
^CODE_OF_CONDUCT.md$
^doc/*
^Meta$
^vignettes$
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -4,3 +4,5 @@
.Ruserdata
.DS_Store
build
doc
Meta
18 changes: 13 additions & 5 deletions CHANGELOG.md
Expand Up @@ -3,25 +3,33 @@ All notable changes to this project will be documented in this file.

## Upcoming

## [0.4.0]

### Added

- missing examples in package documentation
- progress bar and notification (toasts)

- `accordion`

- 4 vignettes

- to modals: `modalDialog`, `removeModal`, `remove_all_modals`

- new STYLEGUIDE introduced

- horizontal menu

- shiny-like API introduced to actionButton, updateActionButton, selectInput, updateSelectInput, icon, numericInput, updateNumericInput, textAreaInput, textInput, numericInput
- shiny-like API introduced to actionButton, updateActionButton, selectInput, updateSelectInput, icon, numericInput, updateNumericInput, textAreaInput, textInput, numericInput, checkboxInput

- counter_button
- `counter_button`

- new examples to documentation
- almost all functions have working examples now

### Changed

- ui (static) elements are renamed to the name of the object they generate, eg. `uiicon` -> `icon`, `uibutton` -> `button`, etc.

- `uimessage` is `messagebox` now
- `uimessage` is `message_box` now

- `uilist` is `list_container` now

Expand Down
20 changes: 16 additions & 4 deletions DESCRIPTION
@@ -1,12 +1,20 @@
Package: shiny.semantic
Type: Package
Title: Semantic UI Support for Shiny
Version: 0.3.3
Version: 0.4.0
Authors@R: c(person("Filip", "Stachura", email = "filip@appsilon.com", role = "aut"),
person("Dominik", "Krzeminski", email = "dominik@appsilon.com", role = "cre"),
person("Krystian", "Igras", email = "krystian@appsilon.com", role = "aut"),
person("Adam", "Forys", email = "adam@appsilon.com", role = "aut"),
person("Dominik", "Krzeminski", email = "dominik@appsilon.com", role = "cre"),
person("Paweł", "Przytuła", email = "pawel@appsilon.com", role = "aut"),
person("Jakub", "Chojna", email = "jakub.chojna@appsilon.com", role = "aut"),
person("Olga", "Mierzwa-Sulima", email = "olga@appsilon.com", role = "aut"),
person("Ashley", "Baldry", role = "ctb"),
person("Jakub", "Chojna", email = "jakub.chojna@appsilon.com", role = "ctb"),
person("Olga", "Mierzwa-Sulima", email = "olga@appsilon.com", role = "ctb"),
person("Pedro", "Manuel Coutinho da Silva", email = "pedro@appsilon.com", role = "ctb"),
person("Paweł", "Przytuła", email = "pawel@appsilon.com", role = "ctb"),
person("Kamil", "Żyła", email = "kamil@appsilon.com", role = "ctb"),
person(family = "Appsilon Sp. z o.o.", role = c("cph")))
Description: Creating a great user interface for your Shiny apps
can be a hassle, especially if you want to work purely in R
Expand All @@ -18,6 +26,7 @@ BugReports: https://github.com/Appsilon/shiny.semantic/issues
Encoding: UTF-8
LazyData: TRUE
License: MIT + file LICENSE
VignetteBuilder: knitr
Imports:
shiny (>= 0.12.1),
htmltools (>= 0.2.6),
Expand All @@ -30,9 +39,12 @@ Imports:
R6
Suggests:
dplyr,
gapminder,
tibble,
knitr,
testthat,
lintr,
DT,
covr
covr,
leaflet,
plotly
RoxygenNote: 7.1.1
18 changes: 13 additions & 5 deletions NAMESPACE
Expand Up @@ -4,6 +4,7 @@ export(COLOR_PALETTE)
export(Progress)
export(SIZE_LEVELS)
export(SUPPORTED_THEMES)
export(accordion)
export(actionButton)
export(action_button)
export(button)
Expand All @@ -12,7 +13,9 @@ export(card)
export(cards)
export(check_proper_color)
export(check_semantic_theme)
export(checkboxInput)
export(checkbox_input)
export(close_toast)
export(counter_button)
export(create_modal)
export(dateInput)
Expand All @@ -34,24 +37,26 @@ export(icon)
export(incProgress)
export(inc_progress)
export(label)
export(label_tag)
export(list_container)
export(main_panel)
export(menu)
export(menu_divider)
export(menu_header)
export(menu_item)
export(messagebox)
export(message_box)
export(modal)
export(modalDialog)
export(multiple_checkbox)
export(multiple_radio)
export(numericInput)
export(numeric_input)
export(progress)
export(rangeInput)
export(range_input)
export(rating_input)
export(register_search)
export(removeModal)
export(removeNotification)
export(remove_all_modals)
export(remove_modal)
export(render_menu_link)
export(search_field)
Expand All @@ -61,10 +66,12 @@ export(segment)
export(selectInput)
export(semanticPage)
export(semantic_DT)
export(semantic_DTOutput)
export(setProgress)
export(set_progress)
export(shiny_input)
export(shiny_text_input)
export(showNotification)
export(show_modal)
export(sidebar_layout)
export(sidebar_panel)
Expand All @@ -76,20 +83,21 @@ export(tabset)
export(textAreaInput)
export(textInput)
export(text_input)
export(theme_selector)
export(toast)
export(toggle)
export(uiinput)
export(uirender)
export(updateActionButton)
export(updateNumericInput)
export(updateRangeInput)
export(updateSelectInput)
export(updateSliderInput)
export(update_action_button)
export(update_calendar)
export(update_dropdown_input)
export(update_numeric_input)
export(update_progress)
export(update_range)
export(update_range_input)
export(update_rating_input)
export(update_slider)
export(verticalLayout)
Expand Down
10 changes: 10 additions & 0 deletions R/checkbox.R
Expand Up @@ -9,6 +9,9 @@
#' @param type Type of checkbox: NULL, 'toggle'
#' @param is_marked Defines if checkbox should be marked. Default TRUE.
#' @param style Style of the widget.
#' @param inputId same as \code{input_id}
#' @param value same as \code{is_marked}
#' @param width The width of the input (currently not supported, but check \code{style})
#'
#' @examples
#' if (interactive()){
Expand Down Expand Up @@ -49,6 +52,13 @@ checkbox_input <- function(input_id, label = "", type = NULL, is_marked = TRUE,
)
}

#' @rdname checkbox
#' @export
checkboxInput <- function(inputId, label = "", value = FALSE, width = NULL){
warn_unsupported_args(c("width"))
checkbox_input(inputId, label, is_marked = value)
}

#' @rdname checkbox
#' @export
toggle <- function(input_id, label = "", is_marked = TRUE, style = NULL) {
Expand Down
82 changes: 57 additions & 25 deletions R/dropdown.R
Expand Up @@ -14,27 +14,19 @@
#' @examples
#' ## Only run examples in interactive R sessions
#' if (interactive()) {
#' library(shiny)
#' library(shiny.semantic)
#' ui <- semanticPage(
#' title = "Dropdown example",
#' dropdown_input("simple_dropdown", LETTERS, value = "A"),
#' p("Selected letter:"),
#' textOutput("dropdown")
#' )
#' server <- function(input, output) {
#' output$dropdown <- renderText(input[["simple_dropdown"]])
#' }
#'
#' library(shiny)
#' library(shiny.semantic)
#' ui <- function() {
#' shinyUI(
#' semanticPage(
#' title = "Dropdown example",
#' uiOutput("dropdown"),
#' p("Selected letter:"),
#' textOutput("selected_letter")
#' )
#' )
#' }
#' server <- shinyServer(function(input, output) {
#' output$dropdown <- renderUI({
#' dropdown_input("simple_dropdown", LETTERS, value = "A")
#' })
#' output$selected_letter <- renderText(input[["simple_dropdown"]])
#' })
#'
#' shinyApp(ui = ui(), server = server)
#' shinyApp(ui = ui, server = server)
#' }
#'
#' @export
Expand Down Expand Up @@ -159,7 +151,7 @@ selectInput <- function(inputId, label, choices, selected = NULL, multiple = FAL
#' @param choices_value What reactive value should be used for corresponding choice.
#' @param value The initially selected value.
#'
#'@examples
#' @examples
#' if (interactive()) {
#'
#' library(shiny)
Expand Down Expand Up @@ -193,7 +185,7 @@ selectInput <- function(inputId, label, choices, selected = NULL, multiple = FAL
update_dropdown_input <- function(session, input_id, choices = NULL, choices_value = choices, value = NULL) {
if (!is.null(value)) value <- paste(as.character(value), collapse = ",") else value <- NULL
if (!is.null(choices)) {
options <- jsonlite::toJSON(data.frame(name = choices, text = choices, value = choices_value))
options <- jsonlite::toJSON(list(values = data.frame(name = choices, text = choices, value = choices_value)))
} else {
options <- NULL
}
Expand All @@ -217,8 +209,8 @@ update_dropdown_input <- function(session, input_id, choices = NULL, choices_val
#' If not specified then defaults to the first value for single-select lists and no
#' values for multiple select lists.
#'
#' @examples
#' ## Only run examples in interactive R sessions
#' @examples
#' ## Only run examples in interactive R sessions
#' if (interactive()) {
#'
#' ui <- semanticPage(
Expand Down Expand Up @@ -256,7 +248,7 @@ updateSelectInput <- function(session, inputId, label, choices = NULL, selected
choices_text <- names(choices)
if (identical(choices_text, NULL))
choices_text <- choices
options <- jsonlite::toJSON(data.frame(name = choices, text = choices_text, value = choices))
options <- jsonlite::toJSON(list(values = data.frame(name = choices_text, text = choices_text, value = choices)))
} else {
options <- NULL
}
Expand All @@ -265,3 +257,43 @@ updateSelectInput <- function(session, inputId, label, choices = NULL, selected

session$sendInputMessage(inputId, message)
}

#' Themes changer dropdown
#'
#' @param input_id Id of dropdown. \code{input[[input_id]]} returns the currently selected theme.
#' @param label Dropdown label.
#'
#' @examples
#'
#' if (interactive()) {
#' library(shiny)
#' library(shiny.semantic)
#' ui <- semanticPage(
#' theme = "superhero",
#' actionButton("action_button", "Press Me!"),
#' textOutput("button_output"),
#' theme_selector(),
#' textOutput("theme")
#' )
#' server <- function(input, output, session) {
#' output$button_output <- renderText(as.character(input$action_button))
#' output$theme <- renderText(as.character(input$theme))
#' }
#' shinyApp(ui, server)
#' }
#'
#' @export
theme_selector <- function(input_id = "theme", label = "Choose theme") {
dropdown_content <- dropdown_input(
"theme", choices = c("default", SUPPORTED_THEMES),
choices_value = c("", SUPPORTED_THEMES),
type = "selection fluid themes-dropdown"
)
shiny::div(
class = "ui form theme",
shiny::div(class = "field",
if (!is.null(label)) tags$label(label, `for` = input_id),
dropdown_content
)
)
}

0 comments on commit 9dfe9b3

Please sign in to comment.