Skip to content

Commit

Permalink
unify tags
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikeyakirar committed Mar 7, 2024
1 parent 6418038 commit 659d6eb
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 66 deletions.
12 changes: 6 additions & 6 deletions R/draggable_buckets.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ draggable_buckets <- function(input_id, label, elements = character(), buckets)
elements_iterator$it <- 0

shiny::tagList(
shiny::singleton(shiny::tags$head(
shiny::singleton(tags$head(
shiny::includeScript(system.file("widgets/draggable_buckets.js", package = "teal.widgets"))
)),
include_css_files("draggable_buckets.css"),
shiny::div(
shiny::tags$span(label),
tags$span(label),
render_unbucketed_elements(elements = elements, elements_iterator = elements_iterator, widget_id = input_id),
render_buckets(buckets = buckets, elements_iterator = elements_iterator, widget_id = input_id),
class = "draggableBuckets",
Expand All @@ -81,7 +81,7 @@ draggable_buckets <- function(input_id, label, elements = character(), buckets)
}

render_unbucketed_elements <- function(elements, elements_iterator, widget_id) {
shiny::tags$div(
tags$div(
lapply(elements, function(element) {
elements_iterator$it <- elements_iterator$it + 1
render_draggable_element(
Expand Down Expand Up @@ -115,7 +115,7 @@ render_buckets <- function(buckets, elements_iterator, widget_id) {
}

render_draggable_element <- function(value, id, widget_id) {
shiny::tags$div(
tags$div(
value,
id = id,
class = "element",
Expand All @@ -128,8 +128,8 @@ render_draggable_element <- function(value, id, widget_id) {
}

render_bucket <- function(name, elements = NULL, elements_iterator = NULL, widget_id = NULL) {
shiny::tags$div(
shiny::tags$div(
tags$div(
tags$div(
paste0(name, ":"),
class = "bucket-name",
ondragover = "allowDrop(event)",
Expand Down
2 changes: 1 addition & 1 deletion R/include_css_js.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ include_css_files <- function(pattern = "*") {
if (length(css_files) == 0) {
return(NULL)
}
return(shiny::singleton(shiny::tags$head(lapply(css_files, shiny::includeCSS))))
return(shiny::singleton(tags$head(lapply(css_files, shiny::includeCSS))))
}
2 changes: 1 addition & 1 deletion R/nested_closeable_modal.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#' footer = NULL,
#' easyClose = TRUE
#' ),
#' div(
#' tags$div(
#' "This modal can be closed by running", tags$code("$('#modal_1').modal('hide')"),
#' "in the JS console!",
#' "Note that removing the parent will remove the child.
Expand Down
16 changes: 8 additions & 8 deletions R/optionalInput.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#' }
#'
#' ui <- ui_grid(
#' div(
#' tags$div(
#' optionalSelectInput(
#' inputId = "c1",
#' label = "Fixed choices",
Expand All @@ -63,7 +63,7 @@
#' ),
#' verbatimTextOutput(outputId = "c1_out")
#' ),
#' div(
#' tags$div(
#' optionalSelectInput(
#' inputId = "c2",
#' label = "Single choice",
Expand All @@ -72,15 +72,15 @@
#' ),
#' verbatimTextOutput(outputId = "c2_out")
#' ),
#' div(
#' tags$div(
#' optionalSelectInput(
#' inputId = "c3",
#' label = "NULL choices",
#' choices = NULL
#' ),
#' verbatimTextOutput(outputId = "c3_out")
#' ),
#' div(
#' tags$div(
#' optionalSelectInput(
#' inputId = "c4",
#' label = "Default",
Expand All @@ -89,7 +89,7 @@
#' ),
#' verbatimTextOutput(outputId = "c4_out")
#' ),
#' div(
#' tags$div(
#' optionalSelectInput(
#' inputId = "c5",
#' label = "Named vector",
Expand All @@ -98,7 +98,7 @@
#' ),
#' verbatimTextOutput(outputId = "c5_out")
#' ),
#' div(
#' tags$div(
#' selectInput(
#' inputId = "c6_choices", label = "Update choices", choices = letters, multiple = TRUE
#' ),
Expand Down Expand Up @@ -243,7 +243,7 @@ optionalSelectInput <- function(inputId, # nolint
label_help
)

div(
tags$div(
include_css_files(pattern = "picker_input"),

# when selected values in ui_picker change
Expand Down Expand Up @@ -280,7 +280,7 @@ optionalSelectInput <- function(inputId, # nolint
)
tags$script(js)
},
div(ui_picker, ui_fixed)
tags$div(ui_picker, ui_fixed)
)
}

Expand Down
2 changes: 1 addition & 1 deletion R/panel_group.R
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ panel_item <- function(title, ..., collapsed = TRUE, input_id = NULL) {

tagList(
include_css_files(pattern = "panel.css"),
shiny::tags$head(shiny::includeScript(system.file("js/panel_group.js", package = "teal.widgets"))),
tags$head(shiny::includeScript(system.file("js/panel_group.js", package = "teal.widgets"))),
res_tag
)
})
Expand Down
26 changes: 13 additions & 13 deletions R/plot_with_settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ plot_with_settings_ui <- function(id) {
ns <- NS(id)

tagList(
shiny::singleton(shiny::tags$head(
shiny::tags$script(
shiny::singleton(tags$head(
tags$script(
# nolint start
sprintf(
'$(document).on("shiny:connected", function(e) {
Expand Down Expand Up @@ -185,10 +185,10 @@ plot_with_settings_ui <- function(id) {
#' id = "plot_with_settings"
#' ),
#' fluidRow(
#' column(4, h3("Brush"), verbatimTextOutput("brushing_data")),
#' column(4, h3("Click"), verbatimTextOutput("clicking_data")),
#' column(4, h3("DblClick"), verbatimTextOutput("dblclicking_data")),
#' column(4, h3("Hover"), verbatimTextOutput("hovering_data"))
#' column(4, tags$h3("Brush"), verbatimTextOutput("brushing_data")),
#' column(4, tags$h3("Click"), verbatimTextOutput("clicking_data")),
#' column(4, tags$h3("DblClick"), verbatimTextOutput("dblclicking_data")),
#' column(4, tags$h3("Hover"), verbatimTextOutput("hovering_data"))
#' )
#' )
#'
Expand Down Expand Up @@ -331,7 +331,7 @@ plot_with_settings_srv <- function(id,
})

output$slider_ui <- renderUI({
div(
tags$div(
optionalSliderInputValMinMax(
inputId = ns("height"),
label = "Plot height",
Expand Down Expand Up @@ -411,7 +411,7 @@ plot_with_settings_srv <- function(id,

output$plot_out_main <- renderUI({
req(plot_suppress(plot_r()))
div(
tags$div(
align = graph_align,
plotOutput(
ns("plot_main"),
Expand Down Expand Up @@ -452,11 +452,11 @@ plot_with_settings_srv <- function(id,

observeEvent(input$expand, {
showModal(
div(
tags$div(
class = "plot-modal",
modalDialog(
easyClose = TRUE,
div(
tags$div(
class = "plot-modal-sliders",
optionalSliderInputValMinMax(
inputId = ns("height_in_modal"),
Expand Down Expand Up @@ -486,11 +486,11 @@ plot_with_settings_srv <- function(id,
round = TRUE
)
),
div(
tags$div(
class = "float-right",
type_download_ui(ns("modal_downbutton"))
),
div(
tags$div(
align = "center",
uiOutput(ns("plot_out_modal"), class = "plot_out_container")
)
Expand Down Expand Up @@ -551,7 +551,7 @@ type_download_ui <- function(id) {
right = TRUE,
label = "",
inputId = ns("downl"),
div(
tags$div(
radioButtons(ns("file_format"),
label = "File type",
choices = c("png" = "png", "pdf" = "pdf", "svg" = "svg"),
Expand Down
24 changes: 12 additions & 12 deletions R/standard_layout.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#' @examples
#' library(shiny)
#' standard_layout(
#' output = white_small_well(h3("Tests")),
#' encoding = div(
#' output = white_small_well(tags$h3("Tests")),
#' encoding = tags$div(
#' tags$label("Encodings", class = "text-primary"),
#' panel_item(
#' "Tests",
Expand Down Expand Up @@ -58,34 +58,34 @@ standard_layout <- function(output,

# if encoding=NULL then forms is placed below output

tag_output <- div(
tag_output <- tags$div(
class = "well",
div(class = "pre-output", pre_output),
div(class = "output", output),
div(class = "post-output", post_output)
tags$div(class = "pre-output", pre_output),
tags$div(class = "output", output),
tags$div(class = "post-output", post_output)
)

tag_enc_out <- if (!is.null(encoding)) {
tagList(
div(
tags$div(
class = "col-md-3",
div(class = "well", encoding),
tags$div(class = "well", encoding),
if (is.null(forms)) {
NULL
} else {
div(class = "form-group", forms)
tags$div(class = "form-group", forms)
}
),
div(class = "col-md-9", tag_output)
tags$div(class = "col-md-9", tag_output)
)
} else {
div(
tags$div(
class = "col-md-12",
tag_output,
if (is.null(forms)) {
NULL
} else {
div(class = "form-group", forms)
tags$div(class = "form-group", forms)
}
)
}
Expand Down
10 changes: 5 additions & 5 deletions R/table_with_settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ table_with_settings_srv <- function(id, table_r, show_hide_signal = reactive(TRU

observeEvent(input$expand, {
showModal(
div(
tags$div(
class = "table-modal",
modalDialog(
easyClose = TRUE,
div(
tags$div(
class = "float-right",
type_download_ui_table(ns("modal_downbutton"))
),
Expand All @@ -137,7 +137,7 @@ type_download_ui_table <- function(id) {
right = TRUE,
label = "",
inputId = ns("dwnl"),
div(
tags$div(
class = "modal-download-ui-table-container",
radioButtons(ns("file_format"),
label = "File type",
Expand All @@ -149,7 +149,7 @@ type_download_ui_table <- function(id) {
),
conditionalPanel(
condition = paste0("input['", ns("file_format"), "'] != '.csv'"),
div(
tags$div(
class = "lock-btn",
title = "on / off",
shinyWidgets::prettyToggle(
Expand All @@ -166,7 +166,7 @@ type_download_ui_table <- function(id) {
animation = "pulse"
)
),
div(
tags$div(
class = "paginate-ui",
shinyWidgets::numericInputIcon(
inputId = ns("lpp"),
Expand Down
6 changes: 3 additions & 3 deletions R/verbatim_popup.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ verbatim_popup_ui <- function(id, button_label, type = c("button", "link"), ...)

shiny::tagList(
shiny::singleton(
shiny::tags$head(shiny::includeScript(system.file("js/verbatim_popup.js", package = "teal.widgets")))
tags$head(shiny::includeScript(system.file("js/verbatim_popup.js", package = "teal.widgets")))
),
shinyjs::useShinyjs(),
do.call(ui_function, c(ui_args, list(...)))
Expand Down Expand Up @@ -118,7 +118,7 @@ button_click_observer <- function(click_event,
shiny::modalDialog(
shiny::tagList(
include_css_files(pattern = "verbatim_popup"),
shiny::tags$div(
tags$div(
class = "mb-4",
shiny::actionButton(
paste0(copy_button_id, 1),
Expand All @@ -127,7 +127,7 @@ button_click_observer <- function(click_event,
),
shiny::modalButton("Dismiss")
),
shiny::tags$pre(id = copied_area_id, modal_content()),
tags$pre(id = copied_area_id, modal_content()),
),
title = modal_title,
footer = shiny::tagList(
Expand Down
2 changes: 1 addition & 1 deletion man/nested_closeable_modal.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 659d6eb

Please sign in to comment.