Skip to content

Commit

Permalink
update dialog + fix checkbox unexported func + update grid
Browse files Browse the repository at this point in the history
  • Loading branch information
DivadNojnarg committed Mar 16, 2024
1 parent ecc66ec commit 8625b8a
Show file tree
Hide file tree
Showing 39 changed files with 338 additions and 455 deletions.
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export(f7Float)
export(f7Found)
export(f7Gallery)
export(f7Gauge)
export(f7Grid)
export(f7HideOnEnable)
export(f7HideOnSearch)
export(f7HidePreloader)
Expand Down Expand Up @@ -92,6 +93,7 @@ export(f7Skeleton)
export(f7Slide)
export(f7Slider)
export(f7SmartSelect)
export(f7SocialCard)
export(f7SplitLayout)
export(f7Stepper)
export(f7SubNavbar)
Expand Down Expand Up @@ -128,6 +130,7 @@ export(updateF7App)
export(updateF7AutoComplete)
export(updateF7Button)
export(updateF7Card)
export(updateF7Checkbox)
export(updateF7DatePicker)
export(updateF7Entity)
export(updateF7Fab)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- `shadow` and `subtitle` have been removed in Framework7.
- `f7SocialCard()` is deprecated as the same result can be achieved with `f7Card()`.
- `f7AutoComplete()`: `expandInput` is deprecated, removed from Framework7.
- `f7Row()`, `f7Col()` and `f7Flex()` are deprecated in favor of `f7Grid()`, as specified by Framework7.

## Minor change
- `f7Messages()`: the corresponding input is now a list of lists, each item
Expand Down
1 change: 1 addition & 0 deletions R/f7-inputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,7 @@ f7Checkbox <- function(inputId, label, value = FALSE) {
#' @param label The label to set for the input object. Does not work.
#' @param value The value to set for the input object.
#' @param session The Shiny session object.
#' @export
updateF7Checkbox <- function(inputId, label = NULL, value = NULL,
session = shiny::getDefaultReactiveDomain()) {
message <- dropNulls(list(label = label, value = value))
Expand Down
3 changes: 2 additions & 1 deletion R/f7Card.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ f7Card <- function(..., image = NULL, title = NULL, footer = NULL, outline = FAL
#' @param footer Footer content, if any. Must be wrapped in a tagList.
#'
#' @keywords internal
#' @export
f7SocialCard <- function(..., image = NULL, author = NULL, date = NULL,
footer = NULL) {
lifecycle::deprecate_warn("1.1.0", "f7SocialCard", "f7Card()")
lifecycle::deprecate_warn("1.1.0", "f7SocialCard()", "f7Card()")

headerTag <- shiny::tags$div(
class = "card-header",
Expand Down
130 changes: 6 additions & 124 deletions R/f7Dialog.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,131 +11,10 @@
#'
#' @export
#'
#' @examples
#' # simple alert
#' if (interactive()) {
#' library(shiny)
#' library(shinyMobile)
#' shinyApp(
#' ui = f7Page(
#' title = "Simple Dialog",
#' f7SingleLayout(
#' navbar = f7Navbar(title = "f7Dialog"),
#' f7Button(inputId = "goButton", "Go!")
#' )
#' ),
#' server = function(input, output, session) {
#' observeEvent(input$goButton,{
#' f7Dialog(
#' title = "Dialog title",
#' text = "This is an alert dialog"
#' )
#' })
#' }
#' )
#' }
#' # confirm alert
#' if (interactive()) {
#' library(shiny)
#' library(shinyMobile)
#' shinyApp(
#' ui = f7Page(
#' title = "Confirm Dialog",
#' f7SingleLayout(
#' navbar = f7Navbar(title = "f7Dialog"),
#' f7Button(inputId = "goButton", "Go!")
#' )
#' ),
#' server = function(input, output, session) {
#'
#' observeEvent(input$goButton,{
#' f7Dialog(
#' id = "test",
#' title = "Dialog title",
#' type = "confirm",
#' text = "This is an alert dialog"
#' )
#' })
#'
#' observeEvent(input$test, {
#' f7Toast(text = paste("Alert input is:", input$test))
#' })
#'
#' }
#' )
#' }
#' # prompt dialog
#' if (interactive()) {
#' library(shiny)
#' library(shinyMobile)
#' shinyApp(
#' ui = f7Page(
#' title = "Prompt Dialog",
#' f7SingleLayout(
#' navbar = f7Navbar(title = "f7Dialog"),
#' f7Button(inputId = "goButton", "Go!"),
#' uiOutput("res")
#' )
#' ),
#' server = function(input, output, session) {
#'
#' observe({
#' print(input$prompt)
#' })
#'
#' observeEvent(input$goButton,{
#' f7Dialog(
#' id = "prompt",
#' title = "Dialog title",
#' type = "prompt",
#' text = "This is a prompt dialog"
#' )
#' })
#'
#' output$res <- renderUI(f7BlockTitle(title = input$prompt, size = "large"))
#' }
#' )
#' }
#'
#' # login dialog
#' if (interactive()) {
#' library(shiny)
#' library(shinyMobile)
#' shinyApp(
#' ui = f7Page(
#' title = "Login Dialog",
#' f7SingleLayout(
#' navbar = f7Navbar(title = "f7Dialog"),
#' f7Button(inputId = "goButton", "Go!"),
#' uiOutput("ui")
#' )
#' ),
#' server = function(input, output, session) {
#'
#' observe({
#' print(input$login)
#' })
#'
#' observeEvent(input$goButton,{
#' f7Dialog(
#' id = "login",
#' title = "Dialog title",
#' type = "login",
#' text = "This is an login dialog"
#' )
#' })
#'
#' output$ui <- renderUI({
#' req(input$login$user == "David" & input$login$password == "prout")
#' img(src = "https://media2.giphy.com/media/12gfL8Xxrhv7C1fXiV/giphy.gif")
#' })
#' }
#' )
#' }
#' @example inst/examples/dialog/app.R
f7Dialog <- function(id = NULL, title = NULL, text,
type = c("alert", "confirm", "prompt", "login"),
session = shiny::getDefaultReactiveDomain()) {

type <- match.arg(type)

if (is.null(id) && type %in% c("confirm", "prompt", "login")) {
Expand All @@ -144,7 +23,11 @@ f7Dialog <- function(id = NULL, title = NULL, text,

# force to render shiny.tag and convert it to character
# since text does not accept anything else
text <- if (class(text) %in% c("shiny.tag" , "shiny.tag.list")) as.character(force(text)) else text
text <- if (class(text) %in% c("shiny.tag", "shiny.tag.list")) {
as.character(force(text))
} else {
text
}

message <- dropNulls(
list(
Expand All @@ -163,5 +46,4 @@ f7Dialog <- function(id = NULL, title = NULL, text,
json_verbatim = TRUE
)
)

}
Loading

0 comments on commit 8625b8a

Please sign in to comment.