Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge CRAN package version to master #396

Merged
merged 61 commits into from
Nov 28, 2021
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
6cd3a9f
getting namespace from session context
federiva Jan 11, 2021
3c69095
adding step
federiva Jan 31, 2021
d93292d
adding example
federiva Jan 31, 2021
848195a
removing console.log
federiva Jan 31, 2021
7e94783
minor - linting
federiva Jan 31, 2021
d6160e4
Merge branch 'develop' into fede.session_context
federiva Jan 31, 2021
643413a
getting the namespace from the session object, adding asis as param
federiva Jan 31, 2021
c7b433f
fixing selector to be compatible when setting another class in the me…
federiva Feb 1, 2021
1ccd965
passing id to steps container
federiva Feb 1, 2021
a05245e
making simple DOM changes as functions, automatic activation of next …
federiva Feb 1, 2021
d96792b
documenting single_step
federiva Feb 3, 2021
1580e38
Merge pull request #349 from Appsilon/fede.tabset_fix
dokato Feb 5, 2021
0c952cc
Fixing standard sliders
Feb 5, 2021
ee2f25c
Re-adding min for standard sliders
Feb 5, 2021
5a3ef74
Merge pull request #352 from ashbaldry/bugfix/slider
dokato Feb 5, 2021
6affbdb
asis as TRUE for backwards compatibility
federiva Feb 5, 2021
8cb2d5e
Merge pull request #348 from Appsilon/fede.session_context
dokato Feb 6, 2021
ad159b3
fix: assign variables to all parameters in grid function
jchojna Feb 24, 2021
a9eee28
Merge pull request #355 from Appsilon/jakub.sidebar_layout_fix
dokato Feb 24, 2021
277bc1a
adding step example
federiva Mar 2, 2021
e6cb0fe
removing hr, removing ifelse
federiva Mar 2, 2021
4405cf6
adding simple unit test for step
federiva Mar 2, 2021
25ee566
adding example to main app.R
federiva Mar 2, 2021
3a0c4df
Merge pull request #350 from Appsilon/fede.step
dokato Mar 8, 2021
050c8b2
inline works for checkbox and radio
Mar 14, 2021
4addd40
Checkbox uses Fomantic JS rather than shiny
ashbaldry Mar 22, 2021
dd2dc7b
Enabled update of radio and checkboxes
ashbaldry Mar 24, 2021
2ad2009
Updating documentation and writing example
ashbaldry Mar 24, 2021
769a418
Merge pull request #358 from ashbaldry/radio-update
dokato Mar 25, 2021
e77ec25
Merge branch 'develop' into checkbox_inline
dokato Mar 25, 2021
ce3ec25
Unbinding progress bar as an input. Fixes #359
ashbaldry Mar 29, 2021
75cfe89
Merge pull request #356 from ncullen93/checkbox_inline
dokato Mar 31, 2021
4309065
Merge pull request #360 from ashbaldry/bugfix-progress
dokato Mar 31, 2021
4684068
Update DESCRIPTION
dokato Apr 30, 2021
00adf9b
Fix the build
jeroen Apr 30, 2021
41afd8e
Merge pull request #364 from jeroen/patch-1
dokato Apr 30, 2021
a38162d
Add markdown to DESCRIPTION to fix CI
rszymanski May 14, 2021
fb3a09d
Merge pull request #369 from Appsilon/ryszard.fix-ci-check
przytu1 May 20, 2021
7622a16
Fixed `textAreaInput` value parameter
ARawles Jun 24, 2021
028a095
Fixed passing of the default value when type = 'textarea'
ARawles Jun 24, 2021
256db9c
Improved textAreaInput example
ARawles Jul 23, 2021
f184da2
Merge pull request #371 from ARawles/develop
federiva Aug 31, 2021
7fc5281
Updated modal example
aniaskrzydlo Oct 19, 2021
6466e2a
Updated documentation
aniaskrzydlo Oct 19, 2021
6c86116
Added standalone example
aniaskrzydlo Oct 19, 2021
f5801ee
feat: change way system dependencies are installed in the pipeline
DamianBudelewski Oct 20, 2021
c5cf02c
Merge pull request #388 from Appsilon/feature/pipeline-improvement
DamianBudelewski Oct 20, 2021
8f3e6d2
Changed dev@appsilon.com to support+opensource@appsilon.com
przytu1 Oct 31, 2021
fbec76b
Description updated
przytu1 Oct 31, 2021
74ae56a
Merge branch 'develop' into ania.update_modal_example
aniaskrzydlo Nov 3, 2021
ff73e45
Merge pull request #387 from Appsilon/ania.update_modal_example
aniaskrzydlo Nov 3, 2021
6c6e62b
Updated documentation for CRAN submission
Nov 5, 2021
bae6b68
Merge pull request #392 from Appsilon/cran-fixes
jakubsob Nov 5, 2021
801bf93
Adopt `warn_unsupported_args` to r-devel `intersect` implementation
Nov 5, 2021
cb29808
Fix R CMD check notes
Nov 5, 2021
b57d200
Merge pull request #394 from Appsilon/cran-r-devel-fix
jakubsob Nov 5, 2021
2b08dc9
Fix invalid URL note
Nov 8, 2021
229dbe7
Merge pull request #395 from Appsilon/cran-note-fix
jakubsob Nov 9, 2021
b81d133
Add R-devel and R-oldrel to CI
Nov 9, 2021
ba3f712
Merge pull request #398 from Appsilon/feature/improve-ci
jakubsob Nov 9, 2021
cf32bab
Merge pull request #399 from Appsilon/master
jakubsob Nov 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@
^CODE_OF_CONDUCT.md$
^doc/*
^Meta$
^vignettes$
9 changes: 3 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,9 @@ jobs:

- name: Install system dependencies
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
uses: r-lib/actions/setup-r-dependencies@v1
with:
extra-packages: rcmdcheck

- name: Install vctrs
if: runner.os == 'Windows'
Expand Down
11 changes: 7 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Type: Package
Title: Semantic UI Support for Shiny
Version: 0.4.3
Authors@R: c(person("Filip", "Stachura", email = "filip@appsilon.com", role = "aut"),
person("Dominik", "Krzeminski", email = "dominik@appsilon.com", role = "cre"),
person("Dominik", "Krzeminski", email = "dominik@appsilon.com", role = "aut"),
person("Krystian", "Igras", email = "krystian@appsilon.com", role = "aut"),
person("Adam", "Forys", email = "adam@appsilon.com", role = "aut"),
person("Paweł", "Przytuła", email = "pawel@appsilon.com", role = "aut"),
Expand All @@ -16,12 +16,13 @@ Authors@R: c(person("Filip", "Stachura", email = "filip@appsilon.com", role = "a
person("Paweł", "Przytuła", email = "pawel@appsilon.com", role = "ctb"),
person("Kamil", "Żyła", email = "kamil@appsilon.com", role = "ctb"),
person("Rabii", "Bouhestine", email = "rabii@appsilon.com", role = "ctb"),
person("Developers", "Appsilon", email = "support+opensource@appsilon.com", role = "cre"),
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
and don't want to use, for instance HTML templates. This
package adds support for a powerful UI library Fomantic UI -
<http://fomantic-ui.com/> (before Semantic). It also supports
<https://fomantic-ui.com/> (before Semantic). It also supports
universal UI input binding that works with various DOM elements.
BugReports: https://github.com/Appsilon/shiny.semantic/issues
Encoding: UTF-8
Expand All @@ -48,5 +49,7 @@ Suggests:
DT,
covr,
leaflet,
plotly
RoxygenNote: 7.1.1
plotly,
rmarkdown,
markdown
RoxygenNote: 7.1.2
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,20 @@ export(showNotification)
export(show_modal)
export(sidebar_layout)
export(sidebar_panel)
export(single_step)
export(sliderInput)
export(slider_input)
export(splitLayout)
export(split_layout)
export(steps)
export(tabset)
export(textAreaInput)
export(textInput)
export(text_input)
export(theme_selector)
export(toast)
export(toggle)
export(toggle_step_state)
export(uiinput)
export(uirender)
export(updateActionButton)
Expand All @@ -97,6 +100,8 @@ export(updateSliderInput)
export(update_action_button)
export(update_calendar)
export(update_dropdown_input)
export(update_multiple_checkbox)
export(update_multiple_radio)
export(update_numeric_input)
export(update_progress)
export(update_range_input)
Expand Down
87 changes: 81 additions & 6 deletions R/checkbox.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ toggle <- function(input_id, label = "", is_marked = TRUE, style = NULL) {
#' semanticPage(
#' title = "Checkbox example",
#' h1("Checkboxes"),
#' multiple_checkbox("checkboxes", "Select Letters", LETTERS[1:6], value = "A"),
#' multiple_checkbox("checkboxes", "Select Letters", LETTERS[1:6], selected = "A"),
#' p("Selected letters:"),
#' textOutput("selected_letters"),
#' tags$br(),
#' h1("Radioboxes"),
#' multiple_radio("radioboxes", "Select Letter", LETTERS[1:6], value = "A"),
#' multiple_radio("radioboxes", "Select Letter", LETTERS[1:6], selected = "A"),
#' p("Selected letter:"),
#' textOutput("selected_letter")
#' )
Expand Down Expand Up @@ -140,14 +140,76 @@ multiple_checkbox <- function(input_id, label, choices, choices_value = choices,
)
}))

shiny::div(
id = input_id, class = paste(position, "fields shiny-input-checkboxgroup"),
shiny::div(class="ui form",
id = input_id, class = paste(position, "fields ss-checkbox-input"),
tags$label(`for` = input_id, label),
choices_html,
...
)
}

#' Update checkbox Semantic UI component
#'
#' Change the value of a \code{\link{multiple_checkbox}} input on the client.
#'
#' @param session The \code{session} object passed to function given to \code{shinyServer}.
#' @param input_id The id of the input object
#' @param choices All available options one can select from. If no need to update then leave as \code{NULL}
#' @param choices_value What reactive value should be used for corresponding choice.
#' @param selected The initially selected value.
#' @param label The label linked to the input
#'
#' @examples
#' if (interactive()) {
#'
#' library(shiny)
#' library(shiny.semantic)
#'
#' ui <- function() {
#' shinyUI(
#' semanticPage(
#' title = "Checkbox example",
#' form(
#' multiple_checkbox(
#' "simple_checkbox", "Letters:", LETTERS[1:5], selected = c("A", "C"), type = "slider"
#' )
#' ),
#' p("Selected letter:"),
#' textOutput("selected_letter"),
#' shiny.semantic::actionButton("simple_button", "Update input to D")
#' )
#' )
#' }
#'
#' server <- shinyServer(function(input, output, session) {
#' output$selected_letter <- renderText(paste(input[["simple_checkbox"]], collapse = ", "))
#'
#' observeEvent(input$simple_button, {
#' update_multiple_checkbox(session, "simple_checkbox", selected = "D")
#' })
#' })
#'
#' shinyApp(ui = ui(), server = server)
#'
#' }
#'
#' @export
update_multiple_checkbox <- function(session = getDefaultReactiveDomain(),
input_id, choices = NULL, choices_value = choices,
selected = NULL, label = NULL) {
if (!is.null(selected)) value <- jsonlite::toJSON(selected) else value <- NULL
if (!is.null(choices)) {
options <- jsonlite::toJSON(data.frame(name = choices, value = choices_value))
} else {
options <- NULL
}

message <- list(choices = options, value = value, label = label)
message <- message[!vapply(message, is.null, FUN.VALUE = logical(1))]

session$sendInputMessage(input_id, message)
}

#' @rdname multiple_checkbox
#'
#' @export
Expand All @@ -168,10 +230,23 @@ multiple_radio <- function(input_id, label, choices, choices_value = choices,
)
}))

shiny::div(
id = input_id, class = paste(position, "fields shiny-input-radiogroup"),
shiny::div(class="ui form",
id = input_id, class = paste(position, "fields ss-checkbox-input"),
tags$label(`for` = input_id, label),
choices_html,
...
)
}

#' @rdname update_multiple_checkbox
#' @export
update_multiple_radio <- function(session = getDefaultReactiveDomain(),
input_id, choices = NULL, choices_value = choices,
selected = NULL, label = NULL) {
if (length(selected) > 1) {
warning("More than one radio box has been selected, only first will be used")
selected <- selected[1]
}

update_multiple_checkbox(session, input_id, choices, choices_value, selected, label)
}
6 changes: 3 additions & 3 deletions R/input.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ text_input <- function(input_id, label = NULL, value = "", type = "text",
}

if (type == "textarea") {
input <- tags$textarea(id = input_id, value = value, placeholder = placeholder)
input <- tags$textarea(id = input_id, value, placeholder = placeholder)
} else {
input <- tags$input(id = input_id, value = value, type = type, placeholder = placeholder)
}
Expand Down Expand Up @@ -110,7 +110,7 @@ text_input <- function(input_id, label = NULL, value = "", type = "text",
#' ## Only run examples in interactive R sessions
#' if (interactive()) {
#' ui <- semanticPage(
#' textAreaInput("a", "Area:", width = "200px"),
#' textAreaInput("a", "Area:", value = "200", width = "200px"),
#' verbatimTextOutput("value")
#' )
#' server <- function(input, output, session) {
Expand All @@ -125,7 +125,7 @@ textAreaInput <- function(inputId, label, value = "", width = NULL, placeholder
style = if (!is.null(width)) glue::glue("width: {shiny::validateCssUnit(width)};"),
shiny::div(class = "field",
if (!is.null(label)) tags$label(label, `for` = inputId),
text_input(inputId, value,
text_input(inputId, value = value,
placeholder = placeholder, type = "textarea")
)
)
Expand Down
4 changes: 2 additions & 2 deletions R/layouts.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ sidebar_layout <- function(sidebar_panel,

grid(
grid_template = layout,
container_style,
area_styles,
container_style = container_style,
area_styles = area_styles,
sidebar_panel = sidebar_children,
main_panel = main_children
)
Expand Down
55 changes: 38 additions & 17 deletions R/modal.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
#' })
#' shinyApp(ui, server)
#' }
#'
#' ## Changing attributes of header and content.
#' if (interactive()) {
#' library(shiny)
Expand Down Expand Up @@ -123,24 +124,36 @@
#' }
#' shinyApp(ui, server)
#' }
#'
#' ## Modal that closes automatically after specific time
#' if (interactive()) {
#' library(shiny)
#' library(shiny.semantic)
#' shinyApp(
#' ui = semanticPage(
#' actionButton("show", "Show modal dialog")
#' ),
#' server = function(input, output) {
#' observeEvent(input$show, {
#' showModal(modalDialog(
#' ui <- function() {
#' shinyUI(
#' semanticPage(
#' actionButton("show", "Show modal dialog")
#' )
#' )
#' }
#'
#' server <- shinyServer(function(input, output, session) {
#' observeEvent(input$show, {
#' create_modal(
#' modal(
#' id = "simple-modal",
#' title = "Important message",
#' "This modal will close after 3 sec.", easyClose = FALSE
#' ))
#' Sys.sleep(3)
#' removeModal()
#' })
#' }
#' )
#' header = "Example modal",
#' content = "This modal will close after 3 sec.",
#' footer = NULL,
#' )
#' )
#' Sys.sleep(3)
#' hide_modal(id = "simple-modal")
#' })
#' })
#'
#' shinyApp(ui = ui(), server = server)
#' }
#'
#' @rdname modal
Expand Down Expand Up @@ -263,12 +276,16 @@ attach_rule <- function(id, behavior, target, value) {
#' @param id ID of the modal that will be displayed.
#' @param session The \code{session} object passed to function given to
#' \code{shinyServer}.
#' @param asis A boolean indicating if the id must be handled as is (TRUE) or
#' will be it must be namespaced (FALSE)
#' @seealso modal
#'
#' @rdname show_modal
#'
#' @export
show_modal <- function(id, session = shiny::getDefaultReactiveDomain()) {
show_modal <- function(id, session = shiny::getDefaultReactiveDomain(),
asis = TRUE) {
id <- ifelse(inherits(session, "session_proxy"), session$ns(id), id)
session$sendCustomMessage("showSemanticModal", list(id = id, action = "show")) # nolint
}

Expand All @@ -279,7 +296,9 @@ showModal <- function(ui, session = shiny::getDefaultReactiveDomain()) {

#' @rdname show_modal
#' @export
remove_modal <- function(id, session = shiny::getDefaultReactiveDomain()) {
remove_modal <- function(id, session = shiny::getDefaultReactiveDomain(),
asis = TRUE) {
id <- ifelse(inherits(session, "session_proxy"), session$ns(id), id)
shiny::removeUI(paste0("#", id))
}

Expand All @@ -298,6 +317,8 @@ removeModal <- function(session = shiny::getDefaultReactiveDomain()) {

#' @rdname show_modal
#' @export
hide_modal <- function(id, session = shiny::getDefaultReactiveDomain()) {
hide_modal <- function(id, session = shiny::getDefaultReactiveDomain(),
asis = TRUE) {
id <- ifelse(inherits(session, "session_proxy"), session$ns(id), id)
session$sendCustomMessage("showSemanticModal", list(id = id, action = "hide")) # nolint
}
4 changes: 2 additions & 2 deletions R/progress.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ progress <- function(input_id, value = NULL, total = NULL, percent = NULL, progr
#' @export
update_progress <- function(session, input_id, type = c("increment", "decrement", "label", "value"), value = 1) {
type <- match.arg(type)
message <- structure(list(value), names = type)
message <- list(id = input_id, type = type, value = value)

session$sendInputMessage(input_id, message)
session$sendCustomMessage("ssprogress", list(type = "change", message = message))
}

#' Reporting progress (object-oriented API)
Expand Down
4 changes: 3 additions & 1 deletion R/semanticPage.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ semanticPage <- function(..., title = "", theme = NULL, suppress_bootstrap = TRU
shiny::tags$link(rel = "stylesheet", type = "text/css",
href = "shiny.semantic/shiny-semantic-DT.css"),
shiny::tags$script(src = "shiny.semantic/shiny-semantic-modal.js"),
shiny::tags$script(src = "shiny.semantic/shiny-semantic-checkbox.js"),
shiny::tags$script(src = "shiny.semantic/shiny-semantic-dropdown.js"),
shiny::tags$script(src = "shiny.semantic/shiny-semantic-button.js"),
shiny::tags$script(src = "shiny.semantic/shiny-semantic-slider.js"),
Expand All @@ -171,7 +172,8 @@ semanticPage <- function(..., title = "", theme = NULL, suppress_bootstrap = TRU
shiny::tags$script(src = "shiny.semantic/shiny-semantic-rating.js"),
shiny::tags$script(src = "shiny.semantic/shiny-semantic-tabset.js"),
shiny::tags$script(src = "shiny.semantic/shiny-semantic-progress.js"),
shiny::tags$script(src = "shiny.semantic/shiny-semantic-toast.js")
shiny::tags$script(src = "shiny.semantic/shiny-semantic-toast.js"),
shiny::tags$script(src = "shiny.semantic/shiny-semantic-step.js")
),
shiny::tags$body(style = glue::glue("margin:{margin};"),
suppress_bootstrap,
Expand Down
Loading