From a9aacc7c09a19255d5b4ddd6d5902ee920fb5715 Mon Sep 17 00:00:00 2001 From: DivadNojnarg Date: Wed, 10 Apr 2024 00:22:00 +0200 Subject: [PATCH] prep for 2.0.4 --- .github/workflows/R-CMD-check.yaml | 31 +- .github/workflows/pkgdown.yaml | 58 +- DESCRIPTION | 4 +- NEWS.md | 5 +- R/dashboardHeader.R | 393 ++-- R/useful-items.R | 1970 ++++++++--------- cran-comments.md | 5 +- inst/examples/app.R | 110 +- inst/examples/box_elements/box_elements_tab.R | 169 +- inst/examples/box_elements/box_sidebar.R | 15 +- .../css/AdminLTE.css | 0 .../css/AdminLTE.min.css | 0 .../css/_all-skins.css | 0 .../css/_all-skins.min.css | 0 .../css/custom.css | 0 .../css/skin-midnight.min.css | 0 .../js/app.js | 0 .../js/app.min.js | 0 .../js/shinydashboardPlus.js | 0 .../js/shinydashboardPlus.min.js | 0 .../js/shinydashboardPlus.min.js.map | 0 man/accordion.Rd | 154 +- man/attachmentBlock.Rd | 44 +- man/blockQuote.Rd | 36 +- man/box.Rd | 171 +- man/carousel.Rd | 50 +- man/dashboardBadge.Rd | 44 +- man/dashboardHeader.Rd | 118 +- man/dashboardLabel.Rd | 32 +- man/dashboardUser.Rd | 78 +- man/loadingState.Rd | 34 +- man/navPills.Rd | 164 +- man/productList.Rd | 72 +- man/progressBar.Rd | 106 +- man/socialButton.Rd | 48 +- man/starBlock.Rd | 40 +- man/taskItem.Rd | 72 +- man/timeline.Rd | 144 +- man/todoList.Rd | 96 +- man/userList.Rd | 66 +- man/userMessage.Rd | 282 +-- man/userPost.Rd | 82 +- pkgdown/_pkgdown.yml | 2 +- .../accordions.js | 0 .../cards.js | 0 .../controlbar.js | 0 .../leftSidebar.js | 0 .../miscellaneous.js | 0 .../navs.js | 0 .../output-bindings.js | 0 .../userMessages.js | 0 tools/jstools.R | 2 +- 52 files changed, 2337 insertions(+), 2360 deletions(-) rename inst/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/css/AdminLTE.css (100%) rename inst/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/css/AdminLTE.min.css (100%) rename inst/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/css/_all-skins.css (100%) rename inst/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/css/_all-skins.min.css (100%) rename inst/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/css/custom.css (100%) rename inst/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/css/skin-midnight.min.css (100%) rename inst/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/js/app.js (100%) rename inst/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/js/app.min.js (100%) rename inst/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/js/shinydashboardPlus.js (100%) rename inst/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/js/shinydashboardPlus.min.js (100%) rename inst/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/js/shinydashboardPlus.min.js.map (100%) rename srcjs/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/accordions.js (100%) rename srcjs/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/cards.js (100%) rename srcjs/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/controlbar.js (100%) rename srcjs/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/leftSidebar.js (100%) rename srcjs/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/miscellaneous.js (100%) rename srcjs/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/navs.js (100%) rename srcjs/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/output-bindings.js (100%) rename srcjs/{shinydashboardPlus-2.0.4.9000 => shinydashboardPlus-2.0.4}/userMessages.js (100%) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index b7bc4f2c..d8eadf8e 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,9 +1,5 @@ # Workflow derived from https://github.com/r-lib/actions/tree/master/examples # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help -# -# NOTE: This workflow is overkill for most R packages and -# check-standard.yaml is likely a better choice. -# usethis::use_github_action("check-standard") will install it. on: push: branches: [main, master] @@ -23,39 +19,32 @@ jobs: matrix: config: - {os: macOS-latest, r: 'release'} - - {os: windows-latest, r: 'release'} - # Use 3.6 to trigger usage of RTools35 - - {os: windows-latest, r: '3.6'} - - # Use older ubuntu to maximise backward compatibility - - {os: ubuntu-18.04, r: 'devel', http-user-agent: 'release'} - - {os: ubuntu-18.04, r: 'release'} - - {os: ubuntu-18.04, r: 'oldrel-1'} - - {os: ubuntu-18.04, r: 'oldrel-2'} - - {os: ubuntu-18.04, r: 'oldrel-3'} - - {os: ubuntu-18.04, r: 'oldrel-4'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v1 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: rcmdcheck + extra-packages: | + rcmdcheck - - uses: r-lib/actions/check-r-package@v1 + - uses: r-lib/actions/check-r-package@v2 - name: Show testthat output if: always() diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 8bc92105..e1e2e525 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -1,46 +1,46 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: master + branches: [main, master] + pull_request: + branches: [main, master] + release: + types: [published] + workflow_dispatch: name: pkgdown jobs: pkgdown: - runs-on: macOS-latest + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: r-lib/actions/setup-r@master + - uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-pandoc@master - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true - - name: Cache R packages - uses: actions/cache@v1 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- + extra-packages: any::pkgdown, local::. + needs: website - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - install.packages("pkgdown") + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) shell: Rscript {0} - - name: Install package - run: R CMD INSTALL . - - - name: Deploy package - run: | - git config --local user.email "actions@github.com" - git config --local user.name "GitHub Actions" - Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.4.1 + with: + clean: false + branch: gh-pages + folder: docs \ No newline at end of file diff --git a/DESCRIPTION b/DESCRIPTION index 98c43788..c0d2c435 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: shinydashboardPlus Type: Package Title: Add More 'AdminLTE2' Components to 'shinydashboard' -Version: 2.0.4.9000 +Version: 2.0.4 Authors@R: c( person("David", "Granjon", email = "dgranjon@ymail.com", role = c("aut", "cre")), person(family = "RinteRface", role = "cph"), @@ -34,6 +34,6 @@ Suggests: URL: https://github.com/RinteRface/shinydashboardPlus, https://rinterface.com/shiny/shinydashboardPlus/ BugReports: https://github.com/RinteRface/shinydashboardPlus/issues Encoding: UTF-8 -RoxygenNote: 7.2.1 +RoxygenNote: 7.3.1 VignetteBuilder: knitr RdMacros: lifecycle diff --git a/NEWS.md b/NEWS.md index 46f09b76..659b55b2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,8 @@ -# shinydashboardPlus 2.0.4.9000 +# shinydashboardPlus 2.0.4 ## Minor change -- Update github actions +- Fix [#181](https://github.com/RinteRface/shinydashboardPlus/issues/181). +- Update github actions. - Icon [change](https://github.com/RinteRface/shinydashboardPlus/commit/0abe127a1ce0e7f8cb74883968c83b796cc9c73e) in `dashboardHeader()`. Thanks @zhanxw. - Allow [hyperlink](https://github.com/RinteRface/shinydashboardPlus/commit/12fab3b92b2b5e459304b385e7ed7a94cb9dbd98) in User block. Thanks @robertkck. - Fix multiple fontawesome icon issues (deprecated names in fontawesome 6). diff --git a/R/dashboardHeader.R b/R/dashboardHeader.R index f2f28e8f..539fbc98 100644 --- a/R/dashboardHeader.R +++ b/R/dashboardHeader.R @@ -2,7 +2,7 @@ #' #' A dashboard header can be left blank, or it can include dropdown menu items #' on the right side. -#' +#' #' @importFrom shinydashboard dropdownMenu #' #' @param title An optional title to show in the header bar.. By default, this @@ -23,92 +23,92 @@ #' @param fixed Whether the navbar is fixed-top or not. FALSE by default. #' #' @seealso \code{\link[shinydashboard]{dropdownMenu}} -#' -#' @note We do not recommend to insert shiny input elements (such as sliderInput) -#' in the left menu, since they will not be well displayed. Instead, wrap them in a +#' +#' @note We do not recommend to insert shiny input elements (such as sliderInput) +#' in the left menu, since they will not be well displayed. Instead, wrap them in a #' \code{\link[shinydashboardPlus]{dropdownBlock}} #' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinyWidgets) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' header = dashboardHeader( -#' leftUi = tagList( -#' dropdownBlock( -#' id = "mydropdown", -#' title = "Dropdown 1", -#' icon = icon("sliders"), -#' sliderInput( -#' inputId = "n", -#' label = "Number of observations", -#' min = 10, max = 100, value = 30 +#' library(shiny) +#' library(shinyWidgets) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' header = dashboardHeader( +#' leftUi = tagList( +#' dropdownBlock( +#' id = "mydropdown", +#' title = "Dropdown 1", +#' icon = icon("sliders"), +#' sliderInput( +#' inputId = "n", +#' label = "Number of observations", +#' min = 10, max = 100, value = 30 +#' ), +#' prettyToggle( +#' inputId = "na", +#' label_on = "NAs kept", +#' label_off = "NAs removed", +#' icon_on = icon("check"), +#' icon_off = icon("trash-can") +#' ) #' ), -#' prettyToggle( -#' inputId = "na", -#' label_on = "NAs kept", -#' label_off = "NAs removed", -#' icon_on = icon("check"), -#' icon_off = icon("trash-can") +#' dropdownBlock( +#' id = "mydropdown2", +#' title = "Dropdown 2", +#' icon = icon("sliders"), +#' prettySwitch( +#' inputId = "switch4", +#' label = "Fill switch with status:", +#' fill = TRUE, +#' status = "primary" +#' ), +#' prettyCheckboxGroup( +#' inputId = "checkgroup2", +#' label = "Click me!", +#' thick = TRUE, +#' choices = c("Click me !", "Me !", "Or me !"), +#' animation = "pulse", +#' status = "info" +#' ) #' ) #' ), -#' dropdownBlock( -#' id = "mydropdown2", -#' title = "Dropdown 2", -#' icon = icon("sliders"), -#' prettySwitch( -#' inputId = "switch4", -#' label = "Fill switch with status:", -#' fill = TRUE, -#' status = "primary" -#' ), -#' prettyCheckboxGroup( -#' inputId = "checkgroup2", -#' label = "Click me!", -#' thick = TRUE, -#' choices = c("Click me !", "Me !", "Or me !"), -#' animation = "pulse", -#' status = "info" -#' ) +#' dropdownMenu( +#' type = "tasks", +#' badgeStatus = "danger", +#' taskItem(value = 20, color = "aqua", "Refactor code"), +#' taskItem(value = 40, color = "green", "Design new layout"), +#' taskItem(value = 60, color = "yellow", "Another task"), +#' taskItem(value = 80, color = "red", "Write documentation") #' ) #' ), -#' dropdownMenu( -#' type = "tasks", -#' badgeStatus = "danger", -#' taskItem(value = 20, color = "aqua", "Refactor code"), -#' taskItem(value = 40, color = "green", "Design new layout"), -#' taskItem(value = 60, color = "yellow", "Another task"), -#' taskItem(value = 80, color = "red", "Write documentation") -#' ) -#' ), -#' sidebar = dashboardSidebar(), -#' body = dashboardBody( -#' setShadow(class = "dropdown-menu") +#' sidebar = dashboardSidebar(), +#' body = dashboardBody( +#' setShadow(class = "dropdown-menu") +#' ), +#' title = "DashboardPage" #' ), -#' title = "DashboardPage" -#' ), -#' server = function(input, output) { } -#' ) +#' server = function(input, output) { } +#' ) #' } #' @export -dashboardHeader <- function(..., title = NULL, titleWidth = NULL, +dashboardHeader <- function(..., title = NULL, titleWidth = NULL, disable = FALSE, .list = NULL, leftUi = NULL, controlbarIcon = shiny::icon("gears"), fixed = FALSE) { # handle right menu items items <- c(list(...), .list) lapply(items, tagAssert, type = "li", class = "dropdown") - + # handle left menu items if (!is.null(leftUi)) { left_menu_items <- lapply(seq_along(leftUi), FUN = function(i) { left_menu_item <- leftUi[[i]] name <- left_menu_item$name class <- left_menu_item$attribs$class - + # if the left menu item is not a li tag and does not have # the dropdown class, create a wrapper to make it work if (name != "li" || !is.null(class) || class != "dropdown") { @@ -123,13 +123,13 @@ dashboardHeader <- function(..., title = NULL, titleWidth = NULL, left_menu_item } }) - # when left_menu is null, left_menu_items are also NULL + # when left_menu is null, left_menu_items are also NULL } else { left_menu_items <- leftUi } - + titleWidth <- shiny::validateCssUnit(titleWidth) - + # Set up custom CSS for custom width. custom_css <- NULL if (!is.null(titleWidth)) { @@ -142,10 +142,10 @@ dashboardHeader <- function(..., title = NULL, titleWidth = NULL, shiny::tags$style( shiny::HTML( gsub( - "_WIDTH_", - titleWidth, - fixed = TRUE, - '@media (min-width: 768px) { + "_WIDTH_", + titleWidth, + fixed = TRUE, + "@media (min-width: 768px) { .main-header > .navbar { margin-left: _WIDTH_; } @@ -153,13 +153,13 @@ dashboardHeader <- function(..., title = NULL, titleWidth = NULL, width: _WIDTH_; } } - ' + " ) ) ) ) } - + shiny::tags$header( class = "main-header", custom_css, @@ -167,14 +167,14 @@ dashboardHeader <- function(..., title = NULL, titleWidth = NULL, # only hide on small screen devices when title is NULL shiny::tags$span(class = if (is.null(title)) "logo hidden-xs" else "logo", title), shiny::tags$nav( - class = paste0("navbar navbar-", if (fixed) "fixed" else "static", "-top"), + class = paste0("navbar navbar-", if (fixed) "fixed" else "static", "-top"), role = "navigation", # Embed hidden icon so that we get the font-awesome dependency shiny::tags$span(shiny::icon("bars"), style = "display:none;"), # Sidebar toggle button shiny::tags$a( - href = "#", - class = "sidebar-toggle", + href = "#", + class = "sidebar-toggle", `data-toggle` = "offcanvas", role = "button", shiny::tags$span(class = "sr-only", "Toggle navigation") @@ -197,8 +197,8 @@ dashboardHeader <- function(..., title = NULL, titleWidth = NULL, # right sidebar shiny::tags$li( shiny::tags$a( - href = "#", - `data-toggle` = "control-sidebar", + href = "#", + `data-toggle` = "control-sidebar", controlbarIcon ) ) @@ -222,62 +222,61 @@ dashboardHeader <- function(..., title = NULL, titleWidth = NULL, #' #' @seealso \code{\link{userOutput}} and \code{\link{renderUser}} for #' dynamically-generating \code{\link{dashboardUser}}. -#' +#' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinyWidgets) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' header = dashboardHeader(userOutput("user")), -#' sidebar = dashboardSidebar(), -#' body = dashboardBody(), -#' title = "DashboardPage" -#' ), -#' server = function(input, output) { -#' output$user <- renderUser({ -#' dashboardUser( -#' name = "Divad Nojnarg", -#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user2-160x160.jpg", -#' title = "shinydashboardPlus", -#' subtitle = "Author", -#' footer = p("The footer", class = "text-center"), -#' fluidRow( -#' dashboardUserItem( -#' width = 6, -#' socialButton( -#' href = "https://dropbox.com", -#' icon = icon("dropbox") -#' ) -#' ), -#' dashboardUserItem( -#' width = 6, -#' socialButton( -#' href = "https://github.com", -#' icon = icon("github") -#' ) +#' library(shiny) +#' library(shinyWidgets) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' header = dashboardHeader(userOutput("user")), +#' sidebar = dashboardSidebar(), +#' body = dashboardBody(), +#' title = "DashboardPage" +#' ), +#' server = function(input, output) { +#' output$user <- renderUser({ +#' dashboardUser( +#' name = "Divad Nojnarg", +#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user2-160x160.jpg", +#' title = "shinydashboardPlus", +#' subtitle = "Author", +#' footer = p("The footer", class = "text-center"), +#' fluidRow( +#' dashboardUserItem( +#' width = 6, +#' socialButton( +#' href = "https://dropbox.com", +#' icon = icon("dropbox") +#' ) +#' ), +#' dashboardUserItem( +#' width = 6, +#' socialButton( +#' href = "https://github.com", +#' icon = icon("github") +#' ) +#' ) +#' ) #' ) -#' ) -#' ) -#' }) -#' } -#' ) +#' }) +#' } +#' ) #' } -#' +#' #' @export dashboardUser <- function(..., name = NULL, image = NULL, title = NULL, subtitle = NULL, footer = NULL) { - # Create line 1 for menu if (!is.null(title)) { line_1 <- paste0(name, " - ", title) } else { line_1 <- name } - + # Create user_text based on if subtitle exists # If subtitle doesn't exist, make the menu height smaller if (!is.null(subtitle)) { @@ -285,9 +284,9 @@ dashboardUser <- function(..., name = NULL, image = NULL, title = NULL, user_header_height <- NULL } else { user_text <- shiny::tags$p(line_1) - user_header_height <- shiny::tags$script(shiny::HTML('$(".user-header").css("height", "145px")')); + user_header_height <- shiny::tags$script(shiny::HTML('$(".user-header").css("height", "145px")')) } - + # create user account menu userTag <- shiny::tagList( shiny::tags$head( @@ -302,8 +301,8 @@ dashboardUser <- function(..., name = NULL, image = NULL, title = NULL, ), # menu toggle button shiny::tags$a( - href = "#", - class = "dropdown-toggle", + href = "#", + class = "dropdown-toggle", `data-toggle` = "dropdown", # user img and name in navbar (controlbar - header) shiny::tags$img(src = image, class = "user-image", alt = "User Image"), @@ -315,24 +314,24 @@ dashboardUser <- function(..., name = NULL, image = NULL, title = NULL, # user img in the menu shiny::tags$li( class = "user-header", - if(!is.null(user_header_height)) user_header_height, + if (!is.null(user_header_height)) user_header_height, shiny::tags$img(src = image, class = "img-circle", alt = "User Image"), user_text ), # menu body - if(length(list(...)) > 0) shiny::tags$li(class = "user-body", ...), + if (length(list(...)) > 0) shiny::tags$li(class = "user-body", ...), # menu footer. Do not show if NULL - if(!is.null(footer)) shiny::tags$li(class = "user-footer", footer) + if (!is.null(footer)) shiny::tags$li(class = "user-footer", footer) ) ) - + userTag } -#' Create a dashboard user profile item +#' Create a dashboard user profile item #' #' This can be inserted in a \code{\link{dashboardUser}}. #' @@ -342,10 +341,10 @@ dashboardUser <- function(..., name = NULL, image = NULL, title = NULL, #' @export dashboardUserItem <- function(item, width) { item <- shiny::div( - align = "center", + align = "center", class = paste0("col-xs-", width), item - ) + ) } @@ -398,15 +397,15 @@ globalVariables("func") #' @seealso \code{\link{dashboardHeader}} for example usage. #' #' @export -dropdownBlock <- function(..., id, icon = NULL, title = NULL, +dropdownBlock <- function(..., id, icon = NULL, title = NULL, badgeStatus = "danger") { - - if (!is.null(badgeStatus)) + if (!is.null(badgeStatus)) { validateStatus(badgeStatus) + } items <- c(list(...)) - + # Make sure the items are li tags - #lapply(items, tagAssert, type = "li") + # lapply(items, tagAssert, type = "li") # items <- lapply(1:length(items), FUN = function(i) { # item <- items[[i]] # name <- item$name @@ -415,21 +414,21 @@ dropdownBlock <- function(..., id, icon = NULL, title = NULL, # item <- shiny::tagAppendChild(wrapper, item) # } # }) - + dropdownClass <- paste0("dropdown") - + numItems <- length(items) if (is.null(badgeStatus)) { badge <- NULL } else { badge <- dashboardLabel(status = badgeStatus, numItems) } - + shiny::tags$li( shiny::singleton( shiny::tags$head( # custom javascript so that the dropdown - #is not hidden when the user click on it + # is not hidden when the user click on it shiny::tags$script( shiny::HTML( paste0( @@ -451,7 +450,7 @@ dropdownBlock <- function(..., id, icon = NULL, title = NULL, class = "dropdown-toggle", `data-toggle` = "dropdown", icon, - title, + title, badge ), shiny::tags$ul( @@ -473,54 +472,53 @@ dropdownBlock <- function(..., id, icon = NULL, title = NULL, #' Custom taskItem -#' +#' #' @inheritParams shinydashboard::taskItem #' @param inputId If not NULL, this item behaves like an action button. #' @export -#' @examples +#' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader( -#' dropdownMenu( -#' type = "tasks", -#' badgeStatus = "danger", -#' taskItem( -#' inputId = "mytask", -#' value = 20, -#' color = "aqua", -#' text = "Click me!" -#' ), -#' taskItem( -#' value = 40, -#' color = "green", -#' text = "Basic item" -#' ) -#' ) -#' ), -#' dashboardSidebar(), -#' dashboardBody(), -#' title = "Dashboard example" -#' ), -#' server = function(input, output) { -#' observeEvent(input$mytask, { -#' showModal(modalDialog( -#' title = "Important message", -#' "This is an important message!" -#' )) -#' }) -#' } -#' ) +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader( +#' dropdownMenu( +#' type = "tasks", +#' badgeStatus = "danger", +#' taskItem( +#' inputId = "mytask", +#' value = 20, +#' color = "aqua", +#' text = "Click me!" +#' ), +#' taskItem( +#' value = 40, +#' color = "green", +#' text = "Basic item" +#' ) +#' ) +#' ), +#' dashboardSidebar(), +#' dashboardBody(), +#' title = "Dashboard example" +#' ), +#' server = function(input, output) { +#' observeEvent(input$mytask, { +#' showModal(modalDialog( +#' title = "Important message", +#' "This is an important message!" +#' )) +#' }) +#' } +#' ) #' } -taskItem <- function (text, value = 0, color = "aqua", href = NULL, inputId = NULL) { - +taskItem <- function(text, value = 0, color = "aqua", href = NULL, inputId = NULL) { validateColor(color) if (is.null(href)) href <- "#" - + shiny::tags$li( shiny::a( id = inputId, @@ -545,22 +543,22 @@ taskItem <- function (text, value = 0, color = "aqua", href = NULL, inputId = NU #' Custom notificationItem -#' +#' #' @inheritParams shinydashboard::notificationItem #' @param inputId If not NULL, this item behaves like an action button. #' @export -notificationItem <- function (text, icon = shiny::icon("triangle-exclamation"), status = "success", - href = NULL, inputId = NULL) { +notificationItem <- function(text, icon = shiny::icon("triangle-exclamation"), status = "success", + href = NULL, inputId = NULL) { tagAssert(icon, type = "i") validateStatus(status) if (is.null(href)) href <- "#" icon <- shiny::tagAppendAttributes(icon, class = paste0("text-", status)) shiny::tags$li( shiny::a( - id = inputId, + id = inputId, class = if (!is.null(inputId)) "action-button", - href = href, - icon, + href = href, + icon, text ) ) @@ -569,22 +567,23 @@ notificationItem <- function (text, icon = shiny::icon("triangle-exclamation"), #' Custom messageItem -#' +#' #' @inheritParams shinydashboard::messageItem #' @param inputId If not NULL, this item behaves like an action button. #' @export -messageItem <- function (from, message, icon = shiny::icon("user"), time = NULL, - href = NULL, inputId = NULL) { +messageItem <- function(from, message, icon = shiny::icon("user"), time = NULL, + href = NULL, inputId = NULL) { tagAssert(icon, type = "i") if (is.null(href)) href <- "#" shiny::tags$li( shiny::a( - id = inputId, + id = inputId, class = if (!is.null(inputId)) "action-button", - href = href, - icon, - shiny::h4(from, if (!is.null(time)) - shiny::tags$small(shiny::icon("clock"), time)), shiny::p(message) + href = href, + icon, + shiny::h4(from, if (!is.null(time)) { + shiny::tags$small(shiny::icon("clock"), time) + }), shiny::p(message) ) ) } diff --git a/R/useful-items.R b/R/useful-items.R index 92240608..1b8051c0 100644 --- a/R/useful-items.R +++ b/R/useful-items.R @@ -11,67 +11,66 @@ #' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' accordion( -#' id = "accordion1", -#' accordionItem( -#' title = "Accordion 1 Item 1", -#' status = "danger", -#' collapsed = TRUE, -#' "This is some text!" +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' accordion( +#' id = "accordion1", +#' accordionItem( +#' title = "Accordion 1 Item 1", +#' status = "danger", +#' collapsed = TRUE, +#' "This is some text!" +#' ), +#' accordionItem( +#' title = "Accordion 1 Item 2", +#' status = "warning", +#' collapsed = FALSE, +#' "This is some text!" +#' ) #' ), -#' accordionItem( -#' title = "Accordion 1 Item 2", -#' status = "warning", -#' collapsed = FALSE, -#' "This is some text!" +#' accordion( +#' id = "accordion2", +#' accordionItem( +#' title = "Accordion 2 Item 1", +#' status = "info", +#' collapsed = TRUE, +#' "This is some text!" +#' ), +#' accordionItem( +#' title = "Accordion 2 Item 2", +#' status = "success", +#' collapsed = FALSE, +#' "This is some text!" +#' ) #' ) #' ), -#' accordion( -#' id = "accordion2", -#' accordionItem( -#' title = "Accordion 2 Item 1", -#' status = "info", -#' collapsed = TRUE, -#' "This is some text!" -#' ), -#' accordionItem( -#' title = "Accordion 2 Item 2", -#' status = "success", -#' collapsed = FALSE, -#' "This is some text!" -#' ) -#' ) +#' title = "Accordion" #' ), -#' title = "Accordion" -#' ), -#' server = function(input, output) { } -#' ) +#' server = function(input, output) { } +#' ) #' } #' #' @export accordion <- function(..., id = NULL, width = 12) { - items <- list(...) len <- length(items) - + # patch that enables a proper accordion behavior # we add the data-parent non standard attribute to each # item. Each accordion must have a unique id. lapply(seq_len(len), FUN = function(i) { - items[[i]]$children[[1]]$children[[1]]$children[[1]]$attribs[["data-parent"]] <<- paste0("#", id) + items[[i]]$children[[1]]$children[[1]]$children[[1]]$attribs[["data-parent"]] <<- paste0("#", id) items[[i]]$children[[1]]$children[[1]]$children[[1]]$attribs[["href"]] <<- paste0("#collapse_", id, "_", i) items[[i]]$children[[2]]$attribs[["id"]] <<- paste0("collapse_", id, "_", i) }) - + shiny::tags$div( class = if (!is.null(width)) paste0("col-sm-", width), shiny::tags$div( @@ -88,24 +87,23 @@ accordion <- function(..., id = NULL, width = 12) { #' \link{accordionItem} creates an accordion item to put inside an \link{accordion} container. #' #' @inheritParams box -#' +#' #' @rdname accordion #' #' @export accordionItem <- function(..., title, status = NULL, collapsed = TRUE, solidHeader = TRUE) { - cl <- "panel box" if (!is.null(status)) { validateStatusPlus(status) cl <- paste0(cl, " box-", status) } - + if (solidHeader) cl <- paste0(cl, " box-solid") - + shiny::tags$div( class = cl, - + # box header shiny::tags$div( class = "box-header with-border", @@ -121,9 +119,8 @@ accordionItem <- function(..., title, status = NULL, collapsed = TRUE, ) ) ), - shiny::tags$div( - id = NULL, + id = NULL, class = if (collapsed) { "panel-collapse collapse" } else { @@ -140,7 +137,7 @@ accordionItem <- function(..., title, status = NULL, collapsed = TRUE, #' Update an accordion on the client -#' +#' #' \link{updateAccordion} toggles an \link{accordion} on the client. #' #' @param id Accordion to target. @@ -150,48 +147,48 @@ accordionItem <- function(..., title, status = NULL, collapsed = TRUE, #' @export #' @rdname accordion #' @examples -#' +#' #' # Update accordion #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' radioButtons("controller", "Controller", choices = c(1, 2)), -#' br(), -#' accordion( -#' id = "accordion1", -#' accordionItem( -#' title = "Accordion 1 Item 1", -#' status = "danger", -#' collapsed = TRUE, -#' "This is some text!" -#' ), -#' accordionItem( -#' title = "Accordion 1 Item 2", -#' status = "warning", -#' collapsed = TRUE, -#' "This is some text!" +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' radioButtons("controller", "Controller", choices = c(1, 2)), +#' br(), +#' accordion( +#' id = "accordion1", +#' accordionItem( +#' title = "Accordion 1 Item 1", +#' status = "danger", +#' collapsed = TRUE, +#' "This is some text!" +#' ), +#' accordionItem( +#' title = "Accordion 1 Item 2", +#' status = "warning", +#' collapsed = TRUE, +#' "This is some text!" +#' ) #' ) -#' ) +#' ), +#' title = "Update Accordion" #' ), -#' title = "Update Accordion" -#' ), -#' server = function(input, output, session) { -#' observeEvent(input$controller, { -#' updateAccordion(id = "accordion1", selected = input$controller) -#' }) -#' observe(print(input$accordion1)) -#' observeEvent(input$accordion1, { -#' showNotification(sprintf("You selected accordion N° %s", input$accordion1), type = "message") -#' }) -#' } -#' ) +#' server = function(input, output, session) { +#' observeEvent(input$controller, { +#' updateAccordion(id = "accordion1", selected = input$controller) +#' }) +#' observe(print(input$accordion1)) +#' observeEvent(input$accordion1, { +#' showNotification(sprintf("You selected accordion N° %s", input$accordion1), type = "message") +#' }) +#' } +#' ) #' } updateAccordion <- function(id, selected, session = shiny::getDefaultReactiveDomain()) { session$sendInputMessage(id, selected) @@ -209,36 +206,36 @@ updateAccordion <- function(id, selected, session = shiny::getDefaultReactiveDom #' @param image url or path to the image. #' @param title attachment title. #' @param href external link. -#' +#' #' @author David Granjon, \email{dgranjon@@ymail.com} #' #' @examples -#' +#' #' # Box with attachmentBlock #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' box( -#' title = "Attachment example", -#' attachmentBlock( -#' image = "https://adminlte.io/themes/AdminLTE/dist/img/photo1.png", -#' title = "Test", -#' href = "https://google.com", -#' "This is the content" -#' ) -#' ) +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' box( +#' title = "Attachment example", +#' attachmentBlock( +#' image = "https://adminlte.io/themes/AdminLTE/dist/img/photo1.png", +#' title = "Test", +#' href = "https://google.com", +#' "This is the content" +#' ) +#' ) +#' ), +#' title = "AttachmentBlock" #' ), -#' title = "AttachmentBlock" -#' ), -#' server = function(input, output) { } -#' ) +#' server = function(input, output) { } +#' ) #' } #' #' @export @@ -285,25 +282,25 @@ attachmentBlock <- function(..., image, title = NULL, href = NULL) { #' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' box( -#' title = "BlockQuote example", -#' blockQuote("I quote some text here!"), -#' blockQuote("I quote some text here!", side = "right") -#' ) +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' box( +#' title = "BlockQuote example", +#' blockQuote("I quote some text here!"), +#' blockQuote("I quote some text here!", side = "right") +#' ) +#' ), +#' title = "blockQuote" #' ), -#' title = "blockQuote" -#' ), -#' server = function(input, output) { } -#' ) +#' server = function(input, output) { } +#' ) #' } #' #' @export @@ -346,53 +343,54 @@ blockQuote <- function(..., side = "left") { #' @rdname box #' #' @examples -#' +#' #' # Box with boxPad container + descriptionBlock #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' box(title = "Box with right pad", -#' status = "warning", -#' fluidRow( -#' column(width = 6), -#' column( -#' width = 6, -#' boxPad( -#' color = "green", -#' descriptionBlock( -#' header = "8390", -#' text = "VISITS", -#' rightBorder = FALSE, -#' marginBottom = TRUE -#' ), -#' descriptionBlock( -#' header = "30%", -#' text = "REFERRALS", -#' rightBorder = FALSE, -#' marginBottom = TRUE -#' ), -#' descriptionBlock( -#' header = "70%", -#' text = "ORGANIC", -#' rightBorder = FALSE, -#' marginBottom = FALSE +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' box( +#' title = "Box with right pad", +#' status = "warning", +#' fluidRow( +#' column(width = 6), +#' column( +#' width = 6, +#' boxPad( +#' color = "green", +#' descriptionBlock( +#' header = "8390", +#' text = "VISITS", +#' rightBorder = FALSE, +#' marginBottom = TRUE +#' ), +#' descriptionBlock( +#' header = "30%", +#' text = "REFERRALS", +#' rightBorder = FALSE, +#' marginBottom = TRUE +#' ), +#' descriptionBlock( +#' header = "70%", +#' text = "ORGANIC", +#' rightBorder = FALSE, +#' marginBottom = FALSE +#' ) +#' ) #' ) #' ) #' ) -#' ) -#' ) +#' ), +#' title = "boxPad" #' ), -#' title = "boxPad" -#' ), -#' server = function(input, output) { } -#' ) +#' server = function(input, output) { } +#' ) #' } #' #' @export @@ -402,7 +400,7 @@ boxPad <- function(..., color = NULL, style = NULL) { validateColor(color) cl <- paste0(cl, " bg-", color) } - + shiny::tags$div( class = cl, style = style, @@ -416,50 +414,49 @@ boxPad <- function(..., color = NULL, style = NULL) { #' AdminLTE2 carousel container #' #' \link{carousel} creates a carousel container to display media content. -#' +#' #' @param ... Slot for \link{carouselItem} #' @param id Carousel id. Must be unique. #' @param indicators Whether to display left and right indicators. #' @param width Carousel width. 6 by default. #' @param .list Should you need to pass \link{carouselItem} via \link{lapply} or similar, #' put these item here instead of passing them in ... -#' +#' #' @author David Granjon, \email{dgranjon@@ymail.com} #' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' header = dashboardHeader(), -#' sidebar = dashboardSidebar(), -#' body = dashboardBody( -#' carousel( -#' id = "mycarousel", -#' carouselItem( -#' caption = "Item 1", -#' tags$img(src = "https://placehold.it/900x500/3c8dbc/ffffff&text=I+Love+Bootstrap") -#' ), -#' carouselItem( -#' caption = "Item 2", -#' tags$img(src = "https://placehold.it/900x500/39CCCC/ffffff&text=I+Love+Bootstrap") -#' ) -#' ) -#' ), -#' title = "Carousel" -#' ), -#' server = function(input, output) { } -#' ) +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' header = dashboardHeader(), +#' sidebar = dashboardSidebar(), +#' body = dashboardBody( +#' carousel( +#' id = "mycarousel", +#' carouselItem( +#' caption = "Item 1", +#' tags$img(src = "https://placehold.it/900x500/3c8dbc/ffffff&text=I+Love+Bootstrap") +#' ), +#' carouselItem( +#' caption = "Item 2", +#' tags$img(src = "https://placehold.it/900x500/39CCCC/ffffff&text=I+Love+Bootstrap") +#' ) +#' ) +#' ), +#' title = "Carousel" +#' ), +#' server = function(input, output) { } +#' ) #' } #' @export #' @rdname carousel carousel <- function(..., id, indicators = TRUE, width = 6, .list = NULL) { - items <- c(list(...), .list) - + generateCarouselNav <- function(items) { found_active <- FALSE navs <- lapply(seq_along(items), FUN = function(i) { @@ -471,18 +468,18 @@ carousel <- function(..., id, indicators = TRUE, width = 6, .list = NULL) { } # if the item has active class and no item was found before, we found the active item if (active && !found_active) found_active <- TRUE - + shiny::tags$li( `data-target` = paste0("#", id), `data-slide-to` = i - 1, class = if (active) "active" ) }) - + actives <- dropNulls(lapply(navs, function(nav) { nav$attribs$class })) - + # Make sure at least the first item is active if (length(actives) == 0) { navs[[1]]$attribs$class <- "active" @@ -491,21 +488,20 @@ carousel <- function(..., id, indicators = TRUE, width = 6, .list = NULL) { " active" ) } - + navs - } - + indicatorsTag <- shiny::tags$ol( class = "carousel-indicators", generateCarouselNav(items) ) - + bodyTag <- shiny::tags$div( class = "carousel-inner", items ) - + controlButtons <- if (indicators) { shiny::tagList( # previous @@ -526,20 +522,19 @@ carousel <- function(..., id, indicators = TRUE, width = 6, .list = NULL) { } else { NULL } - + carouselTag <- shiny::tags$div( class = "carousel slide", `data-ride` = "carousel", id = id ) - + carouselTag <- shiny::tagAppendChildren(carouselTag, indicatorsTag, bodyTag, controlButtons) - + shiny::tags$div( class = if (!is.null(width)) paste0("col-sm-", width), carouselTag ) - } @@ -548,11 +543,11 @@ carousel <- function(..., id, indicators = TRUE, width = 6, .list = NULL) { #' AdminLTE2 carousel item #' #' \link{carouselItem} creates a carousel item to insert in a \link{carousel}. -#' +#' #' @param ... Element such as images, iframe, ... #' @param caption Item caption. #' @param active Whether the item is active or not at start. -#' +#' #' @rdname carousel #' #' @export @@ -580,42 +575,41 @@ carouselItem <- function(..., caption = NULL, active = FALSE) { #' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' box( -#' title = "Social Buttons", -#' status = NULL, -#' socialButton( -#' href = "https://dropbox.com", -#' icon = icon("dropbox") +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' box( +#' title = "Social Buttons", +#' status = NULL, +#' socialButton( +#' href = "https://dropbox.com", +#' icon = icon("dropbox") +#' ), +#' socialButton( +#' href = "https://github.com", +#' icon = icon("github") +#' ) +#' ) #' ), -#' socialButton( -#' href = "https://github.com", -#' icon = icon("github") -#' ) -#' ) +#' title = "Social Buttons" #' ), -#' title = "Social Buttons" -#' ), -#' server = function(input, output) { } -#' ) +#' server = function(input, output) { } +#' ) #' } #' #' @export socialButton <- function(href, icon) { - if (!is.null(icon)) tagAssert(icon, type = "i") - + name <- strsplit(icon$attribs$class, "-")[[1]][2] cl <- sprintf("btn btn-social-icon btn-%s", name) - + shiny::tags$a( href = href, target = "_blank", @@ -629,7 +623,7 @@ socialButton <- function(href, icon) { #' @title AdminLTE2 badge #' -#' @description Create a badge. It may be inserted in any element like inside +#' @description Create a badge. It may be inserted in any element like inside #' a \link[shiny]{actionButton} or a \link{dashboardSidebar}. #' #' @param ... Any html text element. @@ -658,27 +652,27 @@ socialButton <- function(href, icon) { #' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' dashboardBadge("Badge 1", color = "blue"), -#' actionButton( -#' inputId = "badge", -#' label = "Hello", -#' icon = NULL, -#' width = NULL, -#' dashboardBadge(1, color = "orange") -#' ) -#' ) -#' ), -#' server = function(input, output) { } -#' ) +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' dashboardBadge("Badge 1", color = "blue"), +#' actionButton( +#' inputId = "badge", +#' label = "Hello", +#' icon = NULL, +#' width = NULL, +#' dashboardBadge(1, color = "orange") +#' ) +#' ) +#' ), +#' server = function(input, output) { } +#' ) #' } #' #' @export @@ -709,22 +703,22 @@ dashboardBadge <- function(..., color) { #' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' dashboardLabel("Label 1", status = "info"), -#' dashboardLabel("Label 2", status = "danger", style = "circle"), -#' dashboardLabel("Label 3", status = "success", style = "square") -#' ) -#' ), -#' server = function(input, output) { } -#' ) +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' dashboardLabel("Label 1", status = "info"), +#' dashboardLabel("Label 2", status = "danger", style = "circle"), +#' dashboardLabel("Label 3", status = "success", style = "square") +#' ) +#' ), +#' server = function(input, output) { } +#' ) #' } #' #' @export @@ -736,7 +730,9 @@ dashboardLabel <- function(..., status, style = "default") { "border-radius: 50%;" } else if (style == "square") { "border-radius: 0%;" - } else NULL, + } else { + NULL + }, ... ) } @@ -746,7 +742,7 @@ dashboardLabel <- function(..., status, style = "default") { #' AdminLTE2 description block #' -#' \link{descriptionBlock} creates a description block, perfect for writing statistics +#' \link{descriptionBlock} creates a description block, perfect for writing statistics #' to insert in a \link{box} #' #' @param number any number. @@ -781,80 +777,79 @@ dashboardLabel <- function(..., status, style = "default") { #' @rdname box #' #' @examples -#' +#' #' # Box with descriptionBlock #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' box( -#' solidHeader = FALSE, -#' title = "Status summary", -#' background = NULL, -#' width = 4, -#' status = "danger", -#' footer = fluidRow( -#' column( -#' width = 6, -#' descriptionBlock( -#' number = "17%", -#' numberColor = "green", -#' numberIcon = icon("caret-up"), -#' header = "$35,210.43", -#' text = "TOTAL REVENUE", -#' rightBorder = TRUE, -#' marginBottom = FALSE -#' ) -#' ), -#' column( -#' width = 6, -#' descriptionBlock( -#' number = "18%", -#' numberColor = "red", -#' numberIcon = icon("caret-down"), -#' header = "1200", -#' text = "GOAL COMPLETION", -#' rightBorder = FALSE, -#' marginBottom = FALSE +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' box( +#' solidHeader = FALSE, +#' title = "Status summary", +#' background = NULL, +#' width = 4, +#' status = "danger", +#' footer = fluidRow( +#' column( +#' width = 6, +#' descriptionBlock( +#' number = "17%", +#' numberColor = "green", +#' numberIcon = icon("caret-up"), +#' header = "$35,210.43", +#' text = "TOTAL REVENUE", +#' rightBorder = TRUE, +#' marginBottom = FALSE +#' ) +#' ), +#' column( +#' width = 6, +#' descriptionBlock( +#' number = "18%", +#' numberColor = "red", +#' numberIcon = icon("caret-down"), +#' header = "1200", +#' text = "GOAL COMPLETION", +#' rightBorder = FALSE, +#' marginBottom = FALSE +#' ) +#' ) #' ) #' ) -#' ) -#' ) +#' ), +#' title = "Description Blocks" #' ), -#' title = "Description Blocks" -#' ), -#' server = function(input, output) { } -#' ) +#' server = function(input, output) { } +#' ) #' } #' #' @export descriptionBlock <- function(number = NULL, numberColor = NULL, numberIcon = NULL, header = NULL, text = NULL, rightBorder = TRUE, marginBottom = FALSE) { - # icon check. Fails if the user does not pass icon("...") if (!is.null(numberIcon)) tagAssert(numberIcon, type = "i") - + cl <- "description-block" if (isTRUE(rightBorder)) cl <- paste0(cl, " border-right") if (isTRUE(marginBottom)) cl <- paste0(cl, " margin-bottom") - + numcl <- "description-percentage" if (!is.null(numberColor)) { validateColor(numberColor) numcl <- paste0(numcl, " text-", numberColor) } - + shiny::tags$div( class = cl, shiny::tags$span( - class = numcl, + class = numcl, number, if (!is.null(numberIcon)) numberIcon ), @@ -868,31 +863,31 @@ descriptionBlock <- function(number = NULL, numberColor = NULL, numberIcon = NUL #' @title AdminLTE2 loading state element #' #' @description When a section is still work in progress or a computation is running -#' +#' #' @note Loading state can be programmatically used when a conputation is running for instance. #' #' @author David Granjon, \email{dgranjon@@ymail.com} #' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' box( -#' title = "loading spinner", -#' loadingState() -#' ) +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' box( +#' title = "loading spinner", +#' loadingState() +#' ) +#' ), +#' title = "Loading State" #' ), -#' title = "Loading State" -#' ), -#' server = function(input, output) { } -#' ) +#' server = function(input, output) { } +#' ) #' } #' #' @export @@ -911,53 +906,53 @@ loadingState <- function() { #' To insert in \link{box}. #' #' @param ... slot for \link{navPillsItem}. -#' @param id Item unique id. Returns the R index of the currently selected item. +#' @param id Item unique id. Returns the R index of the currently selected item. #' This is different from the JavaScript index. #' #' @author David Granjon, \email{dgranjon@@ymail.com} #' #' @examples -#' +#' #' # navPills #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' box( -#' title = "Nav Pills", -#' status = "info", -#' "Box Body", -#' footer = navPills( -#' id = "pillItem", -#' navPillsItem( -#' left = "Item 1", -#' color = "green", -#' right = 10 -#' ), -#' navPillsItem( -#' left = "Item 2", -#' color = "red", -#' icon = icon("angle-down"), -#' right = "10%", -#' active = TRUE +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' box( +#' title = "Nav Pills", +#' status = "info", +#' "Box Body", +#' footer = navPills( +#' id = "pillItem", +#' navPillsItem( +#' left = "Item 1", +#' color = "green", +#' right = 10 +#' ), +#' navPillsItem( +#' left = "Item 2", +#' color = "red", +#' icon = icon("angle-down"), +#' right = "10%", +#' active = TRUE +#' ) +#' ) #' ) -#' ) -#' ) +#' ), +#' title = "Nav Pills" #' ), -#' title = "Nav Pills" -#' ), -#' server = function(input, output) { -#' observeEvent(input$pillItem, { -#' showNotification(sprintf("You clicked on pill N° %s", input$pillItem), type = "message") -#' }) -#' } -#' ) +#' server = function(input, output) { +#' observeEvent(input$pillItem, { +#' showNotification(sprintf("You clicked on pill N° %s", input$pillItem), type = "message") +#' }) +#' } +#' ) #' } #' #' @export @@ -974,7 +969,7 @@ navPills <- function(..., id = NULL) { #' Update navPills on the client -#' +#' #' \link{updateNavPills} allows to programmatically change the currently #' selected \link{navPillsItem} on the client. #' @@ -982,61 +977,61 @@ navPills <- function(..., id = NULL) { #' @param selected Index of the \link{navPillsItem} to select. Index is seen from the R side. #' @param session Shiny session object. #' @export -#' +#' #' @rdname navPills #' #' @examples -#' +#' #' # update navPills #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' radioButtons("controller", "Controller", choices = c(1, 2, 3)), -#' br(), -#' box( -#' title = "Nav Pills", -#' status = "info", -#' "Box Body", -#' footer = navPills( -#' inputId = "pills", -#' navPillsItem( -#' left = "Item 1", -#' color = "green", -#' right = 10 -#' ), -#' navPillsItem( -#' left = "Item 2", -#' color = "red", -#' icon = icon("angle-down"), -#' right = "10%" -#' ), -#' navPillsItem( -#' left = "Item 3", -#' color = "blue", -#' icon = icon("angle-up"), -#' right = "30%" +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' radioButtons("controller", "Controller", choices = c(1, 2, 3)), +#' br(), +#' box( +#' title = "Nav Pills", +#' status = "info", +#' "Box Body", +#' footer = navPills( +#' inputId = "pills", +#' navPillsItem( +#' left = "Item 1", +#' color = "green", +#' right = 10 +#' ), +#' navPillsItem( +#' left = "Item 2", +#' color = "red", +#' icon = icon("angle-down"), +#' right = "10%" +#' ), +#' navPillsItem( +#' left = "Item 3", +#' color = "blue", +#' icon = icon("angle-up"), +#' right = "30%" +#' ) +#' ) #' ) -#' ) -#' ) +#' ), +#' title = "Nav Pills" #' ), -#' title = "Nav Pills" -#' ), -#' server = function(input, output, session) { -#' observeEvent(input$controller, { -#' updateNavPills(id = "pills", selected = input$controller) -#' }) -#' observeEvent(input$pills, { -#' showNotification(sprintf("You selected pill N° %s", input$pills), type = "message") -#' }) -#' } -#' ) +#' server = function(input, output, session) { +#' observeEvent(input$controller, { +#' updateNavPills(id = "pills", selected = input$controller) +#' }) +#' observeEvent(input$pills, { +#' showNotification(sprintf("You selected pill N° %s", input$pills), type = "message") +#' }) +#' } +#' ) #' } updateNavPills <- function(id, selected, session = shiny::getDefaultReactiveDomain()) { session$sendInputMessage(id, selected) @@ -1070,22 +1065,22 @@ updateNavPills <- function(id, selected, session = shiny::getDefaultReactiveDoma #' \item \code{black}: \Sexpr[results=rd, stage=install]{shinydashboardPlus:::rd_color_tag("#111")}. #' \item \code{gray}: \Sexpr[results=rd, stage=install]{shinydashboardPlus:::rd_color_tag("#d2d6de")}. #' } -#' @param icon pill icon, if any. +#' @param icon pill icon, if any. #' @param selected Whether the item is active or not. FALSE by default. #' #' @rdname navPills #' #' @export -navPillsItem <- function(left = NULL, right = NULL, - color = NULL, icon = NULL, +navPillsItem <- function(left = NULL, right = NULL, + color = NULL, icon = NULL, selected = FALSE) { cl <- "pull-right" if (!is.null(color)) cl <- paste0(cl, " text-", color) - + shiny::tags$li( class = if (selected) "active" else NULL, shiny::tags$a( - href = "javascript:void(0)", + href = "javascript:void(0)", left, shiny::tags$span( class = cl, @@ -1099,7 +1094,7 @@ navPillsItem <- function(left = NULL, right = NULL, -#' @title AdminLTE2 product list container +#' AdminLTE2 product list container #' #' \link{productList} creates a container to display commercial items in an elegant container. #' Insert in a \link{box}. @@ -1110,43 +1105,43 @@ navPillsItem <- function(left = NULL, right = NULL, #' @rdname productList #' #' @examples -#' +#' #' # Box with productList #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' box( -#' title = "Product List", -#' status = "primary", -#' productList( -#' productListItem( -#' image = "https://www.pngmart.com/files/1/Haier-TV-PNG.png", -#' title = "Samsung TV", -#' subtitle = "$1800", -#' color = "yellow", -#' "This is an amazing TV, but I don't like TV!" -#' ), -#' productListItem( -#' image = "https://upload.wikimedia.org/wikipedia/commons/7/77/IMac_Pro.svg", -#' title = "Imac 27", -#' subtitle = "$4999", -#' color = "red", -#' "This is were I spend most of my time!" +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' box( +#' title = "Product List", +#' status = "primary", +#' productList( +#' productListItem( +#' image = "https://www.pngmart.com/files/1/Haier-TV-PNG.png", +#' title = "Samsung TV", +#' subtitle = "$1800", +#' color = "yellow", +#' "This is an amazing TV, but I don't like TV!" +#' ), +#' productListItem( +#' image = "https://upload.wikimedia.org/wikipedia/commons/7/77/IMac_Pro.svg", +#' title = "Imac 27", +#' subtitle = "$4999", +#' color = "red", +#' "This is were I spend most of my time!" +#' ) +#' ) #' ) -#' ) -#' ) +#' ), +#' title = "Product List" #' ), -#' title = "Product List" -#' ), -#' server = function(input, output) { } -#' ) +#' server = function(input, output) { } +#' ) #' } #' #' @export @@ -1191,14 +1186,14 @@ productList <- function(...) { #' @rdname productList #' #' @export -productListItem <- function(..., image = NULL, title = NULL, +productListItem <- function(..., image = NULL, title = NULL, subtitle = NULL, color = NULL) { cl <- "label pull-right" if (!is.null(color)) { validateColor(color) cl <- paste0(cl, " label-", color) } - + shiny::tags$li( class = "item", shiny::tags$div( @@ -1208,7 +1203,7 @@ productListItem <- function(..., image = NULL, title = NULL, shiny::tags$div( class = "product-info", shiny::tags$a( - href = "javascript:void(0)", + href = "javascript:void(0)", class = "product-title", title, if (!is.null(subtitle)) shiny::tags$span(class = cl, subtitle) @@ -1227,12 +1222,12 @@ productListItem <- function(..., image = NULL, title = NULL, #' AdminLTE2 vertical progress bar #' #' This creates a vertical progress bar. -#' +#' #' @param value Progress bar value. Must be between min and max. #' @param min Progress bar minimum value (0 by default). #' @param max Progress bar maximum value (100 by default). #' @param vertical Progress vertical layout. Default to FALSE -#' @param striped Whether the progress is striped or not. FALSE by default. +#' @param striped Whether the progress is striped or not. FALSE by default. #' @param animated Whether the progress is active or not. FALSE by default. #' Works only if striped is TRUE. #' @param status Progress bar status. "primary" by default or "warning", "info", @@ -1247,83 +1242,82 @@ productListItem <- function(..., image = NULL, title = NULL, #' } #' @param size Progress bar size. NULL by default: "sm", "xs" or "xxs" also available. #' @param label Progress label. NULL by default. -#' +#' #' @author David Granjon, \email{dgranjon@@ymail.com} #' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' header = dashboardHeader(), -#' sidebar = dashboardSidebar(), -#' body = dashboardBody( -#' box( -#' title = "Horizontal", -#' progressBar( -#' value = 10, -#' striped = TRUE, -#' animated = TRUE, -#' label = "10%" -#' ), -#' progressBar( -#' value = 50, -#' status = "warning", -#' size = "xs" -#' ), -#' progressBar( -#' value = 20, -#' status = "danger", -#' size = "sm" -#' ) +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' header = dashboardHeader(), +#' sidebar = dashboardSidebar(), +#' body = dashboardBody( +#' box( +#' title = "Horizontal", +#' progressBar( +#' value = 10, +#' striped = TRUE, +#' animated = TRUE, +#' label = "10%" +#' ), +#' progressBar( +#' value = 50, +#' status = "warning", +#' size = "xs" +#' ), +#' progressBar( +#' value = 20, +#' status = "danger", +#' size = "sm" +#' ) +#' ), +#' box( +#' title = "Vertical", +#' progressBar( +#' value = 10, +#' striped = TRUE, +#' animated = TRUE, +#' vertical = TRUE +#' ), +#' progressBar( +#' value = 50, +#' status = "warning", +#' size = "xs", +#' vertical = TRUE +#' ), +#' progressBar( +#' value = 20, +#' status = "danger", +#' size = "sm", +#' vertical = TRUE +#' ) +#' ) #' ), -#' box( -#' title = "Vertical", -#' progressBar( -#' value = 10, -#' striped = TRUE, -#' animated = TRUE, -#' vertical = TRUE -#' ), -#' progressBar( -#' value = 50, -#' status = "warning", -#' size = "xs", -#' vertical = TRUE -#' ), -#' progressBar( -#' value = 20, -#' status = "danger", -#' size = "sm", -#' vertical = TRUE -#' ) -#' ) -#' ), -#' title = "Progress bars" -#' ), -#' server = function(input, output) { } -#' ) +#' title = "Progress bars" +#' ), +#' server = function(input, output) { } +#' ) #' } #' @export -progressBar <- function(value, min = 0, max = 100, vertical = FALSE, striped = FALSE, +progressBar <- function(value, min = 0, max = 100, vertical = FALSE, striped = FALSE, animated = FALSE, status = "primary", size = NULL, label = NULL) { - if (!is.null(status)) validateStatus(status) stopifnot(value >= min) stopifnot(value <= max) - + progressCl <- if (isTRUE(vertical)) "progress vertical" else "progress mb-3" if (animated) progressCl <- paste0(progressCl, " active") if (!is.null(size)) progressCl <- paste0(progressCl, " progress-", size) - + barCl <- "progress-bar" if (striped) barCl <- paste0(barCl, " progress-bar-striped") if (!is.null(status)) barCl <- paste0(barCl, " progress-bar-", status) - + shiny::tags$div( class = progressCl, shiny::tags$div( @@ -1336,7 +1330,7 @@ progressBar <- function(value, min = 0, max = 100, vertical = FALSE, striped = F } else { paste0("width: ", paste0(value, "%")) }, - if(!is.null(label)) label + if (!is.null(label)) label ) ) } @@ -1347,7 +1341,7 @@ progressBar <- function(value, min = 0, max = 100, vertical = FALSE, striped = F #' @title AdminLTE2 starBlock #' #' @description Create a starBlock item (ideal for rating) -#' +#' #' @param value Current score. Should be positive and lower or equal to max. #' @param max Maximum number of stars by block. #' @param color Star color: see \code{validColors()} in the documentation. @@ -1375,38 +1369,37 @@ progressBar <- function(value, min = 0, max = 100, vertical = FALSE, striped = F #' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' box( -#' title = "Star example", -#' starBlock(5), -#' starBlock(5, color = "olive"), -#' starBlock(1, color = "maroon"), -#' starBlock(3, color = "teal") -#' ) +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' box( +#' title = "Star example", +#' starBlock(5), +#' starBlock(5, color = "olive"), +#' starBlock(1, color = "maroon"), +#' starBlock(3, color = "teal") +#' ) +#' ), +#' title = "starBlock" #' ), -#' title = "starBlock" -#' ), -#' server = function(input, output) { } -#' ) +#' server = function(input, output) { } +#' ) #' } #' #' @export starBlock <- function(value, max = 5, color = "yellow") { - stopifnot(!is.null(color)) validateColor(color) stopifnot(!is.null(value)) stopifnot(value >= 0) stopifnot(value <= max) - + shiny::tags$td( class = "mailbox-star", shiny::tags$a( @@ -1437,92 +1430,91 @@ starBlock <- function(value, max = 5, color = "yellow") { #' @param width Timeline width. Between 1 and 12. #' #' @author David Granjon, \email{dgranjon@@ymail.com} -#' +#' #' @rdname timeline #' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' h3("When Reversed = TRUE, can be displayed inside a box"), -#' box( -#' title = "Timeline", -#' status = "info", -#' timelineBlock( -#' width = 12, -#' timelineEnd(color = "red"), -#' timelineLabel(2018, color = "teal"), -#' timelineItem( -#' title = "Item 1", -#' icon = icon("gears"), -#' color = "olive", -#' time = "now", -#' footer = "Here is the footer", -#' "This is the body" -#' ), -#' timelineItem( -#' title = "Item 2", -#' border = FALSE -#' ), -#' timelineLabel(2015, color = "orange"), -#' timelineItem( -#' title = "Item 3", -#' icon = icon("paint-brush"), -#' color = "maroon", -#' timelineItemMedia(image = "https://placehold.it/150x100"), -#' timelineItemMedia(image = "https://placehold.it/150x100") -#' ), -#' timelineStart(color = "purple") -#' ) -#' ), -#' h3("When Reversed = FALSE, can be displayed out of a box"), -#' timelineBlock( -#' reversed = FALSE, -#' timelineEnd(color = "red"), -#' timelineLabel(2018, color = "teal"), -#' timelineItem( -#' title = "Item 1", -#' icon = icon("gears"), -#' color = "olive", -#' time = "now", -#' footer = "Here is the footer", -#' "This is the body" -#' ), -#' timelineItem( -#' title = "Item 2", -#' border = FALSE -#' ), -#' timelineLabel(2015, color = "orange"), -#' timelineItem( -#' title = "Item 3", -#' icon = icon("paint-brush"), -#' color = "maroon", -#' timelineItemMedia(image = "https://placehold.it/150x100"), -#' timelineItemMedia(image = "https://placehold.it/150x100") -#' ), -#' timelineStart(color = "purple") -#' ) +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' h3("When Reversed = TRUE, can be displayed inside a box"), +#' box( +#' title = "Timeline", +#' status = "info", +#' timelineBlock( +#' width = 12, +#' timelineEnd(color = "red"), +#' timelineLabel(2018, color = "teal"), +#' timelineItem( +#' title = "Item 1", +#' icon = icon("gears"), +#' color = "olive", +#' time = "now", +#' footer = "Here is the footer", +#' "This is the body" +#' ), +#' timelineItem( +#' title = "Item 2", +#' border = FALSE +#' ), +#' timelineLabel(2015, color = "orange"), +#' timelineItem( +#' title = "Item 3", +#' icon = icon("paint-brush"), +#' color = "maroon", +#' timelineItemMedia(image = "https://placehold.it/150x100"), +#' timelineItemMedia(image = "https://placehold.it/150x100") +#' ), +#' timelineStart(color = "purple") +#' ) +#' ), +#' h3("When Reversed = FALSE, can be displayed out of a box"), +#' timelineBlock( +#' reversed = FALSE, +#' timelineEnd(color = "red"), +#' timelineLabel(2018, color = "teal"), +#' timelineItem( +#' title = "Item 1", +#' icon = icon("gears"), +#' color = "olive", +#' time = "now", +#' footer = "Here is the footer", +#' "This is the body" +#' ), +#' timelineItem( +#' title = "Item 2", +#' border = FALSE +#' ), +#' timelineLabel(2015, color = "orange"), +#' timelineItem( +#' title = "Item 3", +#' icon = icon("paint-brush"), +#' color = "maroon", +#' timelineItemMedia(image = "https://placehold.it/150x100"), +#' timelineItemMedia(image = "https://placehold.it/150x100") +#' ), +#' timelineStart(color = "purple") +#' ) +#' ), +#' title = "timelineBlock" #' ), -#' title = "timelineBlock" -#' ), -#' server = function(input, output) { } -#' ) +#' server = function(input, output) { } +#' ) #' } #' #' @export timelineBlock <- function(..., reversed = TRUE, width = 6) { - cl <- "timeline" if (isTRUE(reversed)) cl <- paste0(cl, " timeline-inverse") if (!is.null(width)) cl <- paste0(cl, " col-sm-", width) - + shiny::tags$ul( class = cl, ... @@ -1533,7 +1525,7 @@ timelineBlock <- function(..., reversed = TRUE, width = 6) { #' AdminLTE2 timeline label #' #' \link{timelineLabel} creates a timeline label element to highlight an event. -#' +#' #' @rdname timeline #' #' @param ... any element. @@ -1557,16 +1549,15 @@ timelineBlock <- function(..., reversed = TRUE, width = 6) { #' \item \code{black}: \Sexpr[results=rd, stage=install]{shinydashboardPlus:::rd_color_tag("#111")}. #' \item \code{gray}: \Sexpr[results=rd, stage=install]{shinydashboardPlus:::rd_color_tag("#d2d6de")}. #' } -#' +#' #' @export timelineLabel <- function(..., color = NULL) { - cl <- NULL if (!is.null(color)) { validateColor(color) cl <- paste0("bg-", color) } - + shiny::tags$li( class = "time-label", shiny::tags$span( @@ -1579,7 +1570,7 @@ timelineLabel <- function(..., color = NULL) { #' AdminLTE2 timeline item #' -#' \link{timelineItem} creates a timeline item that contains information for a +#' \link{timelineItem} creates a timeline item that contains information for a #' given event like the title, description, date, ... #' #' @param ... any element. @@ -1610,47 +1601,53 @@ timelineLabel <- function(..., color = NULL) { #' @param footer item footer if any. #' #' @rdname timeline -#' +#' #' @export timelineItem <- function(..., icon = NULL, color = NULL, time = NULL, title = NULL, border = TRUE, footer = NULL) { - + if (!is.null(icon)) { + icon$attribs$class <- sub("fas", "fa", icon$attribs$class) + } + + timeIcon <- shiny::icon("clock") + timeIcon$attribs$class <- sub("fa(r|s)", "fa", timeIcon$attribs$class, perl = TRUE) + if (!is.null(color)) { validateColor(color) icon$attribs$class <- paste0(icon$attribs$class, " bg-", color) } - + itemCl <- "timeline-header no-border" if (border) itemCl <- "timeline-header" - + shiny::tags$li( - + # timelineItem icon and color icon, - + # timelineItem container shiny::tags$div( class = "timeline-item", - - #timelineItem time/date + + # timelineItem time/date shiny::tags$span( class = "time", - shiny::icon("clock"), + timeIcon, time ), - + # timelineItem title shiny::tags$h3( class = itemCl, title ), - + # timelineItem body shiny::tags$div( class = "timeline-body", ... ), - + # timelineItem footer if (!is.null(footer)) { shiny::tags$div( @@ -1670,14 +1667,14 @@ timelineItem <- function(..., icon = NULL, color = NULL, time = NULL, #' @param image media url or path. #' @param height media height in pixels. #' @param width media width in pixels. -#' +#' #' @rdname timeline -#' +#' #' @export timelineItemMedia <- function(image = NULL, height = NULL, width = NULL) { shiny::img( - class = "margin", - src = image, + class = "margin", + src = image, height = height, width = width ) @@ -1712,14 +1709,18 @@ timelineItemMedia <- function(image = NULL, height = NULL, width = NULL) { #' \item \code{gray}: \Sexpr[results=rd, stage=install]{shinydashboardPlus:::rd_color_tag("#d2d6de")}. #' } #' @rdname timeline -#' +#' #' @export timelineStart <- function(icon = shiny::icon("clock"), color = NULL) { - iconTag <- icon if (!is.null(color)) { validateColor(color) - iconTag$attribs$class <- paste0(iconTag$attribs$class, " bg-", color) + iconTag$attribs$class <- sub( + "fa(r|s)", + "fa", + paste0(iconTag$attribs$class, " bg-", color), + perl = TRUE + ) } shiny::tags$li(iconTag) } @@ -1752,19 +1753,26 @@ timelineStart <- function(icon = shiny::icon("clock"), color = NULL) { #' } #' #' @rdname timeline -#' +#' #' @export timelineEnd <- function(icon = shiny::icon("hourglass-end"), color = NULL) { - iconTag <- icon + + iconTag$attribs$class <- sub( + "fa(r|s)", + "fa", + iconTag$attribs$class, + perl = TRUE + ) + if (!is.null(color)) { validateColor(color) iconTag$attribs$class <- paste0(iconTag$attribs$class, " bg-", color) } - + shiny::tagList( shiny::tags$li(iconTag), - shiny::br(), + shiny::br(), shiny::br() ) } @@ -1782,58 +1790,58 @@ timelineEnd <- function(icon = shiny::icon("hourglass-end"), color = NULL) { #' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinyjqui) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' box( -#' "Sortable todo list demo", -#' status = "warning", -#' todoList( -#' todoListItem( -#' label = "Design a nice theme", -#' "Some text here" -#' ), -#' todoListItem( -#' label = "Make the theme responsive", -#' "Some text here" +#' library(shiny) +#' library(shinydashboard) +#' library(shinyjqui) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' box( +#' "Sortable todo list demo", +#' status = "warning", +#' todoList( +#' todoListItem( +#' label = "Design a nice theme", +#' "Some text here" +#' ), +#' todoListItem( +#' label = "Make the theme responsive", +#' "Some text here" +#' ), +#' todoListItem( +#' checked = TRUE, +#' label = "Let theme shine like a star" +#' ) +#' ) #' ), -#' todoListItem( -#' checked = TRUE, -#' label = "Let theme shine like a star" +#' box( +#' "Simple todo list demo", +#' status = "warning", +#' todoList( +#' sortable = FALSE, +#' todoListItem( +#' label = "Design a nice theme", +#' "Some text here" +#' ), +#' todoListItem( +#' label = "Make the theme responsive", +#' "Some text here" +#' ), +#' todoListItem( +#' checked = TRUE, +#' label = "Let theme shine like a star" +#' ) +#' ) #' ) -#' ) #' ), -#' box( -#' "Simple todo list demo", -#' status = "warning", -#' todoList( -#' sortable = FALSE, -#' todoListItem( -#' label = "Design a nice theme", -#' "Some text here" -#' ), -#' todoListItem( -#' label = "Make the theme responsive", -#' "Some text here" -#' ), -#' todoListItem( -#' checked = TRUE, -#' label = "Let theme shine like a star" -#' ) -#' ) -#' ) +#' title = "Todo Lists" #' ), -#' title = "Todo Lists" -#' ), -#' server = function(input, output) { } -#' ) +#' server = function(input, output) { } +#' ) #' } #' #' @export @@ -1843,11 +1851,10 @@ todoList <- function(..., sortable = TRUE) { class = "todo-list", ... ) - - if (sortable) todoListTag <- shinyjqui::jqui_sortable(todoListTag) - + + if (sortable) todoListTag <- shinyjqui::jqui_sortable(todoListTag) + todoListTag - } @@ -1866,30 +1873,29 @@ todoList <- function(..., sortable = TRUE) { todoListItem <- function(..., checked = FALSE, label = NULL) { cl <- NULL if (checked) cl <- "done" - + shiny::tags$li( class = cl, - + # sortable icon shiny::tags$span( class = "handle", shiny::tags$i(class = "fa fa-ellipsis-v"), shiny::tags$i(class = "fa fa-ellipsis-v") ), - + # checkbox trigger # need to be implemented (custom binding js) - #shiny::tags$input(type = "checkbox"), - + # shiny::tags$input(type = "checkbox"), + # label shiny::tags$span(class = "text", label), - + # any element shiny::tags$small( ... ) ) - } @@ -1905,41 +1911,41 @@ todoListItem <- function(..., checked = FALSE, label = NULL) { #' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' box( -#' title = "User List example", -#' status = "success", -#' userList( -#' userListItem( -#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", -#' title = "Shiny", -#' subtitle = "Package 1" -#' ), -#' userListItem( -#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user7-128x128.jpg", -#' title = "Tidyverse", -#' subtitle = "Package 2" -#' ), -#' userListItem( -#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user5-128x128.jpg", -#' title = "tidyr", -#' subtitle = "Package 3" +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' box( +#' title = "User List example", +#' status = "success", +#' userList( +#' userListItem( +#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", +#' title = "Shiny", +#' subtitle = "Package 1" +#' ), +#' userListItem( +#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user7-128x128.jpg", +#' title = "Tidyverse", +#' subtitle = "Package 2" +#' ), +#' userListItem( +#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user5-128x128.jpg", +#' title = "tidyr", +#' subtitle = "Package 3" +#' ) +#' ) #' ) -#' ) -#' ) +#' ), +#' title = "User List" #' ), -#' title = "User List" -#' ), -#' server = function(input, output) { } -#' ) +#' server = function(input, output) { } +#' ) #' } #' #' @export @@ -1965,7 +1971,7 @@ userList <- function(...) { userListItem <- function(image, title, subtitle = NULL) { shiny::tags$li( shiny::tags$img( - src = image, + src = image, alt = "User Image", shiny::tags$a(class = "users-list-name", title), if (!is.null(subtitle)) { @@ -1986,81 +1992,79 @@ userListItem <- function(image, title, subtitle = NULL) { #' @param image profile image, if any. #' @param author post author. #' @param description post description. -#' @param collapsible If TRUE, display a button in the upper right that allows the user to collapse the comment. +#' @param collapsible If TRUE, display a button in the upper right that allows the user to collapse the comment. #' @param collapsed Whether the comment is collapsed when the application starts, FALSE by default. #' #' @author David Granjon, \email{dgranjon@@ymail.com} #' @rdname userPost -#' +#' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' box( -#' title = "Box with user comment", -#' status = "primary", -#' userPost( -#' id = 1, -#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", -#' author = "Jonathan Burke Jr.", -#' description = "Shared publicly - 7:30 PM today", -#' "Lorem ipsum represents a long-held tradition for designers, -#' typographers and the like. Some people hate it and argue for -#' its demise, but others ignore the hate as they create awesome -#' tools to help create filler text for everyone from bacon +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' box( +#' title = "Box with user comment", +#' status = "primary", +#' userPost( +#' id = 1, +#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", +#' author = "Jonathan Burke Jr.", +#' description = "Shared publicly - 7:30 PM today", +#' "Lorem ipsum represents a long-held tradition for designers, +#' typographers and the like. Some people hate it and argue for +#' its demise, but others ignore the hate as they create awesome +#' tools to help create filler text for everyone from bacon #' lovers to Charlie Sheen fans.", -#' collapsible = FALSE, -#' userPostTagItems( -#' userPostTagItem(dashboardLabel("item 1", status = "info")), -#' userPostTagItem(dashboardLabel("item 2", status = "danger"), side = "right") -#' ) +#' collapsible = FALSE, +#' userPostTagItems( +#' userPostTagItem(dashboardLabel("item 1", status = "info")), +#' userPostTagItem(dashboardLabel("item 2", status = "danger"), side = "right") +#' ) +#' ), +#' userPost( +#' id = 2, +#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user6-128x128.jpg", +#' author = "Adam Jones", +#' userPostMedia(image = "https://adminlte.io/themes/AdminLTE/dist/img/photo2.png"), +#' userPostTagItems( +#' userPostTagItem(dashboardLabel("item 1", status = "success")), +#' userPostTagItem(dashboardLabel("item 2", status = "danger"), side = "right") +#' ) +#' ) +#' ) #' ), -#' userPost( -#' id = 2, -#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user6-128x128.jpg", -#' author = "Adam Jones", -#' userPostMedia(image = "https://adminlte.io/themes/AdminLTE/dist/img/photo2.png"), -#' userPostTagItems( -#' userPostTagItem(dashboardLabel("item 1", status = "success")), -#' userPostTagItem(dashboardLabel("item 2", status = "danger"), side = "right") -#' ) -#' ) -#' ) +#' title = "userPost" #' ), -#' title = "userPost" -#' ), -#' server = function(input, output) { } -#' ) +#' server = function(input, output) { } +#' ) #' } -#' +#' #' @export -userPost <- function(..., id = NULL, image, author, - description = NULL, collapsible = TRUE, +userPost <- function(..., id = NULL, image, author, + description = NULL, collapsible = TRUE, collapsed = FALSE) { - cl <- "collapse" id <- paste0("post-", id) - + if (!isTRUE(collapsed)) cl <- paste0(cl, " in") if (collapsed) collapsed <- "false" else collapsed <- "true" - + shiny::tags$div( class = "post", - shiny::tags$div( class = "user-block", shiny::img(class = "img-circle img-bordered-sm", src = image), shiny::tags$span( - class = "username", + class = "username", author, - + # box tool if (collapsible) { shiny::tags$button( @@ -2072,7 +2076,6 @@ userPost <- function(..., id = NULL, image, author, shiny::tags$i(class = "fa fa-eye") ) } - ), if (!is.null(description)) { shiny::tags$span(class = "description", description) @@ -2085,7 +2088,6 @@ userPost <- function(..., id = NULL, image, author, ... ) ) - } @@ -2098,10 +2100,9 @@ userPost <- function(..., id = NULL, image, author, #' @param ... slot for \link{userPostTagItem}. #' #' @rdname userPost -#' +#' #' @export userPostTagItems <- function(...) { - shiny::tags$ul( class = "list-inline", ... @@ -2119,12 +2120,11 @@ userPostTagItems <- function(...) { #' @param side tool item orientation: "left" of "right", "left" by default. #' #' @rdname userPost -#' +#' #' @export userPostTagItem <- function(..., side = "left") { - cl <- if (side == "left") NULL else "pull-right" - + shiny::tags$li( class = cl, ... @@ -2142,12 +2142,12 @@ userPostTagItem <- function(..., side = "left") { #' @param width media width in pixels. #' #' @rdname userPost -#' +#' #' @export userPostMedia <- function(image, height = NULL, width = NULL) { shiny::img( style = "margin: auto;", - class = "img-responsive", + class = "img-responsive", src = image, height = height, width = width @@ -2164,7 +2164,7 @@ userPostMedia <- function(image, height = NULL, width = NULL) { #' #' @param ... Slot for \link{userMessage}. #' @param id Optional. To use with \link{updateUserMessages}. -#' @param status Messages status. See here for a list of valid colors +#' @param status Messages status. See here for a list of valid colors #' \url{https://adminlte.io/themes/AdminLTE/pages/UI/general.html}. #' Valid statuses are defined as follows: #' \itemize{ @@ -2175,68 +2175,68 @@ userPostMedia <- function(image, height = NULL, width = NULL) { #' \item \code{danger}: \Sexpr[results=rd, stage=render]{shinydashboardPlus:::rd_color_tag("#f56954")} #' } #' @param width Container width: between 1 and 12. -#' @param height Container height. +#' @param height Container height. #' #' @author David Granjon, \email{dgranjon@@ymail.com} #' @rdname userMessage #' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' box( -#' title = "Box with messages", -#' solidHeader = TRUE, -#' status = "warning", -#' userMessages( -#' width = 12, -#' status = "success", -#' userMessage( -#' author = "Alexander Pierce", -#' date = "20 Jan 2:00 pm", -#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", -#' type = "sent", -#' "Is this template really for free? That's unbelievable!" -#' ), -#' userMessage( -#' author = "Sarah Bullock", -#' date = "23 Jan 2:05 pm", -#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", -#' type = "received", -#' "You better believe it!" -#' ) -#' ) -#' ), -#' userMessages( -#' width = 6, -#' status = "danger", -#' userMessage( -#' author = "Alexander Pierce", -#' date = "20 Jan 2:00 pm", -#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", -#' type = "received", -#' "Is this template really for free? That's unbelievable!" -#' ), -#' userMessage( -#' author = "Sarah Bullock", -#' date = "23 Jan 2:05 pm", -#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", -#' type = "sent", -#' "You better believe it!" -#' ) -#' ) +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' box( +#' title = "Box with messages", +#' solidHeader = TRUE, +#' status = "warning", +#' userMessages( +#' width = 12, +#' status = "success", +#' userMessage( +#' author = "Alexander Pierce", +#' date = "20 Jan 2:00 pm", +#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", +#' type = "sent", +#' "Is this template really for free? That's unbelievable!" +#' ), +#' userMessage( +#' author = "Sarah Bullock", +#' date = "23 Jan 2:05 pm", +#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", +#' type = "received", +#' "You better believe it!" +#' ) +#' ) +#' ), +#' userMessages( +#' width = 6, +#' status = "danger", +#' userMessage( +#' author = "Alexander Pierce", +#' date = "20 Jan 2:00 pm", +#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", +#' type = "received", +#' "Is this template really for free? That's unbelievable!" +#' ), +#' userMessage( +#' author = "Sarah Bullock", +#' date = "23 Jan 2:05 pm", +#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", +#' type = "sent", +#' "You better believe it!" +#' ) +#' ) +#' ), +#' title = "user Message" #' ), -#' title = "user Message" -#' ), -#' server = function(input, output) { } -#' ) +#' server = function(input, output) { } +#' ) #' } #' #' @export @@ -2248,24 +2248,23 @@ userMessages <- function(..., id = NULL, status, width = 4, height = NULL) { cl <- paste0(cl, " direct-chat-", status) } msgtag <- shiny::tags$div( - class = cl, - ..., + class = cl, + ..., style = if (!is.null(height)) { sprintf("height: %s; overflow-y: auto;", height) } else { "height: 100%;" } ) - + shiny::tags$div( id = id, class = if (!is.null(width)) paste0("col-sm-", width), msgtag ) - } -#' AdminLTE2 user message +#' AdminLTE2 user message #' #' \link{userMessage} creates a user message html element. #' @@ -2278,13 +2277,12 @@ userMessages <- function(..., id = NULL, status, width = 4, height = NULL) { #' @rdname userMessage #' #' @export -userMessage <- function(..., author, date = NULL, +userMessage <- function(..., author, date = NULL, image = NULL, type = c("sent", "received")) { - type <- match.arg(type) messageCl <- "direct-chat-msg" if (type == "sent") messageCl <- paste0(messageCl, " right") - + # message info messageInfo <- shiny::tags$div( class = "direct-chat-info clearfix", @@ -2293,7 +2291,7 @@ userMessage <- function(..., author, date = NULL, "direct-chat-name pull-right" } else { "direct-chat-name" - }, + }, author ), if (!is.null(date)) { @@ -2302,22 +2300,22 @@ userMessage <- function(..., author, date = NULL, "direct-chat-timestamp right" } else { "direct-chat-timestamp" - }, + }, date ) } ) - + # message Text messageTxt <- shiny::tags$div(class = "direct-chat-text", ...) - + # message author image messageImg <- shiny::tags$img(class = "direct-chat-img", src = image) - + shiny::tags$div( class = messageCl, messageInfo, - messageImg, + messageImg, messageTxt ) } @@ -2327,7 +2325,7 @@ userMessage <- function(..., author, date = NULL, #' Update a messages container in the server side -#' +#' #' \link{updateUserMessages} allows to interact with a \link{userMessages} container, #' such as sending, removing or editing messages. #' @@ -2341,105 +2339,105 @@ userMessage <- function(..., author, date = NULL, #' #' @examples #' if (interactive()) { -#' library(shiny) -#' library(shinydashboard) -#' library(shinydashboardPlus) -#' -#' shinyApp( -#' ui = dashboardPage( -#' dashboardHeader(), -#' dashboardSidebar(), -#' dashboardBody( -#' fluidRow( -#' actionButton("remove", "Remove message"), -#' actionButton("add", "Add message"), -#' actionButton("update", "Update message") -#' ), -#' numericInput("index", "Message index:", 1, min = 1, max = 3), -#' br(), -#' br(), -#' userMessages( -#' width = 6, -#' status = "danger", -#' id = "message", -#' userMessage( -#' author = "Alexander Pierce", -#' date = "20 Jan 2:00 pm", -#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", -#' type = "received", -#' "Is this template really for free? That's unbelievable!" +#' library(shiny) +#' library(shinydashboard) +#' library(shinydashboardPlus) +#' +#' shinyApp( +#' ui = dashboardPage( +#' dashboardHeader(), +#' dashboardSidebar(), +#' dashboardBody( +#' fluidRow( +#' actionButton("remove", "Remove message"), +#' actionButton("add", "Add message"), +#' actionButton("update", "Update message") #' ), -#' userMessage( -#' author = "Sarah Bullock", -#' date = "23 Jan 2:05 pm", -#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", -#' type = "sent", -#' "You better believe it!" +#' numericInput("index", "Message index:", 1, min = 1, max = 3), +#' br(), +#' br(), +#' userMessages( +#' width = 6, +#' status = "danger", +#' id = "message", +#' userMessage( +#' author = "Alexander Pierce", +#' date = "20 Jan 2:00 pm", +#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", +#' type = "received", +#' "Is this template really for free? That's unbelievable!" +#' ), +#' userMessage( +#' author = "Sarah Bullock", +#' date = "23 Jan 2:05 pm", +#' image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", +#' type = "sent", +#' "You better believe it!" +#' ) #' ) -#' ) +#' ), +#' title = "user Message" #' ), -#' title = "user Message" -#' ), -#' server = function(input, output, session) { -#' observeEvent(input$remove, { -#' updateUserMessages("message", action = "remove", index = input$index) -#' }) -#' observeEvent(input$add, { -#' updateUserMessages( -#' "message", -#' action = "add", -#' content = list( -#' author = "David", -#' date = "Now", -#' image = "https://i.pinimg.com/originals/f1/15/df/f115dfc9cab063597b1221d015996b39.jpg", -#' type = "received", -#' text = tagList( -#' sliderInput( -#' "obs", -#' "Number of observations:", -#' min = 0, -#' max = 1000, -#' value = 500 -#' ), -#' plotOutput("distPlot") +#' server = function(input, output, session) { +#' observeEvent(input$remove, { +#' updateUserMessages("message", action = "remove", index = input$index) +#' }) +#' observeEvent(input$add, { +#' updateUserMessages( +#' "message", +#' action = "add", +#' content = list( +#' author = "David", +#' date = "Now", +#' image = "https://i.pinimg.com/originals/f1/15/df/f115dfc9cab063597b1221d015996b39.jpg", +#' type = "received", +#' text = tagList( +#' sliderInput( +#' "obs", +#' "Number of observations:", +#' min = 0, +#' max = 1000, +#' value = 500 +#' ), +#' plotOutput("distPlot") +#' ) #' ) #' ) -#' ) -#' }) -#' -#' output$distPlot <- renderPlot({ -#' hist(rnorm(input$obs)) -#' }) -#' -#' observeEvent(input$update, { -#' updateUserMessages( -#' "message", -#' action = "update", -#' index = input$index, -#' content = list( -#' text = tagList( -#' appButton( -#' inputId = "reload", -#' label = "Click me!", -#' icon = icon("arrows-rotate"), -#' dashboardBadge(1, color = "orange") +#' }) +#' +#' output$distPlot <- renderPlot({ +#' hist(rnorm(input$obs)) +#' }) +#' +#' observeEvent(input$update, { +#' updateUserMessages( +#' "message", +#' action = "update", +#' index = input$index, +#' content = list( +#' text = tagList( +#' appButton( +#' inputId = "reload", +#' label = "Click me!", +#' icon = icon("arrows-rotate"), +#' dashboardBadge(1, color = "orange") +#' ) +#' ) #' ) -#' ) #' ) -#' ) -#' }) -#' -#' observeEvent(input$reload, { -#' showNotification("Yeah!", duration = 1, type = "default") -#' }) -#' } -#' ) +#' }) +#' +#' observeEvent(input$reload, { +#' showNotification("Yeah!", duration = 1, type = "default") +#' }) +#' } +#' ) #' } -updateUserMessages <- function(id, action = c("add", "remove", "update"), - index = NULL, content = NULL, +updateUserMessages <- function(id, action = c("add", "remove", "update"), + index = NULL, content = NULL, session = shiny::getDefaultReactiveDomain()) { action <- match.arg(action) - + content <- lapply(content, function(c) { if (inherits(c, "shiny.tag") || inherits(c, "shiny.tag.list")) { # necessary if the user pass input/output with deps @@ -2448,12 +2446,12 @@ updateUserMessages <- function(id, action = c("add", "remove", "update"), } c }) - + session$sendCustomMessage( - "user-messages", + "user-messages", list( - id = id, - action = action, + id = id, + action = action, index = index, body = content ) diff --git a/cran-comments.md b/cran-comments.md index 5251756a..a8e7570b 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,5 +1,5 @@ ## Test environments -* Local OS X install, R 3.6.1 +* Local OS X install, R 4.3.1 * `rhub::check_for_cran()` * Github actions * win-builder (devel and release) @@ -8,5 +8,4 @@ - 0 error, 0 warnings, 0 Notes. ## Notes -This release is a patch to fix an [issue](https://github.com/RinteRface/shinydashboardPlus/pull/151) preventing the release of -Shiny 1.7.0. +This release is a patch to fix also fix an issue raised by Kurt Hornik with R4.4.0 diff --git a/inst/examples/app.R b/inst/examples/app.R index 51c47c32..d997c64c 100644 --- a/inst/examples/app.R +++ b/inst/examples/app.R @@ -2,13 +2,11 @@ source("global.R") shinyApp( ui = dashboardPage( - md = FALSE, - #skin = "midnight", dashboardHeader( - fixed = TRUE, title = tagList( - span(class = "logo-lg", "shinydashboardPlus"), - img(src = "ShinyDashboardPlus_FINAL.svg")), + span(class = "logo-lg", "shinydashboardPlus"), + img(src = "https://camo.githubusercontent.com/25bb653d828cc411aa1eabc6e4a097977fc6cae173c89c9056d77937f0588790/68747470733a2f2f72696e746572666163652e636f6d2f696e73742f696d616765732f7368696e7964617368626f617264506c75732e737667") + ), leftUi = tagList( dropdownBlock( id = "mydropdown", @@ -17,8 +15,8 @@ shinyApp( sliderInput( inputId = "n", label = "Number of observations", - min = 10, - max = 100, + min = 10, + max = 100, value = 30 ), prettyToggle( @@ -36,57 +34,58 @@ shinyApp( prettySwitch( inputId = "switch4", label = "Fill switch with status:", - fill = TRUE, + fill = TRUE, status = "primary" ), prettyCheckboxGroup( inputId = "checkgroup2", - label = "Click me!", + label = "Click me!", thick = TRUE, choices = c("Click me !", "Me !", "Or me !"), - animation = "pulse", + animation = "pulse", status = "info" ) ) ), dropdownMenu( - type = "tasks", + type = "tasks", badgeStatus = "danger", taskItem(value = 20, color = "aqua", "Refactor code"), taskItem(value = 40, color = "green", "Design new layout"), taskItem(value = 60, color = "yellow", "Another task"), taskItem(value = 80, color = "red", "Write documentation") ), - userOutput("user") + userOutput("user"), + fixed = TRUE ), dashboardSidebar( id = "mysidebar", sidebarMenu( menuItem( - text = "New boxes", + text = "New boxes", tabName = "boxes", - badgeLabel = "new", + badgeLabel = "new", badgeColor = "green", icon = icon("briefcase") ), menuItem( - text = "New buttons", + text = "New buttons", tabName = "buttons", - badgeLabel = "new", + badgeLabel = "new", badgeColor = "green", icon = icon("cubes") ), menuItem( - text = "New Box elements", + text = "New Box elements", tabName = "boxelements", - badgeLabel = "new", + badgeLabel = "new", badgeColor = "green", icon = icon("table-cells") ), menuItem( - text = "New extra elements", + text = "New extra elements", tabName = "extraelements", - badgeLabel = "new", + badgeLabel = "new", badgeColor = "green", icon = icon("circle-plus") ) @@ -102,10 +101,10 @@ shinyApp( icon = icon("desktop"), active = TRUE, sliderInput( - inputId = "inputsidebar1", + inputId = "inputsidebar1", label = "Number of observations:", - min = 0, - max = 1000, + min = 0, + max = 1000, value = 500 ) ), @@ -113,21 +112,21 @@ shinyApp( icon = icon("paint-brush"), title = "Tab 2", numericInput( - inputId = "inputsidebar2", - label = "Observations:", - value = 10, - min = 1, + inputId = "inputsidebar2", + label = "Observations:", + value = 10, + min = 1, max = 100 ) ) ) ), dashboardBody( - + # use a bit of shinyEffects setShadow(class = "dropdown-menu"), setShadow(class = "box"), - + # some styling tags$head( tags$style( @@ -147,7 +146,7 @@ shinyApp( " ) ), - + # All tabs tabItems( boxes_tab, @@ -171,46 +170,50 @@ shinyApp( "Thanks for clicking on me!" )) }) - - + output$distPlot <- renderPlot({ hist(rnorm(input$obs)) }) - + output$distPlot2 <- renderPlot({ hist(rnorm(input$obs2)) }) - + output$flipPlot <- renderPlot({ hist(rnorm(input$flip_obs)) }) - - output$data <- renderTable({ - head(mtcars[, c("mpg", input$variable), drop = FALSE]) - }, rownames = TRUE) - - output$value <- renderText({input$somevalue}) - + + output$data <- renderTable( + { + head(mtcars[, c("mpg", input$variable), drop = FALSE]) + }, + rownames = TRUE + ) + + output$value <- renderText({ + input$somevalue + }) + output$boxSidebarPlot <- renderPlot({ hist(rnorm(input$slider_boxsidebar)) }) - + output$user <- renderUser({ dashboardUser( - name = "Divad Nojnarg", - image = "https://adminlte.io/themes/AdminLTE/dist/img/user2-160x160.jpg", + name = "Divad Nojnarg", + image = "https://adminlte.io/themes/AdminLTE/dist/img/user2-160x160.jpg", title = "shinydashboardPlus", - subtitle = "Author", + subtitle = "Author", footer = p("The footer", class = "text-center"), fluidRow( dashboardUserItem( width = 6, descriptionBlock( - number = "17%", - numberColor = "green", + number = "17%", + numberColor = "green", numberIcon = icon("caret-up"), - header = "$35,210.43", - text = "TOTAL REVENUE", + header = "$35,210.43", + text = "TOTAL REVENUE", rightBorder = TRUE, marginBottom = FALSE ) @@ -218,11 +221,11 @@ shinyApp( dashboardUserItem( width = 6, descriptionBlock( - number = "18%", - numberColor = "red", + number = "18%", + numberColor = "red", numberIcon = icon("caret-down"), - header = "1200", - text = "GOAL COMPLETION", + header = "1200", + text = "GOAL COMPLETION", rightBorder = FALSE, marginBottom = FALSE ) @@ -230,6 +233,5 @@ shinyApp( ) ) }) - } ) diff --git a/inst/examples/box_elements/box_elements_tab.R b/inst/examples/box_elements/box_elements_tab.R index 3945b4cb..74675e49 100644 --- a/inst/examples/box_elements/box_elements_tab.R +++ b/inst/examples/box_elements/box_elements_tab.R @@ -1,24 +1,45 @@ box_elements_tab <- tabItem( tabName = "boxelements", - br(), - + # ################ # - # demo box Sidebar # + # demo box Sidebar # # ################ # - + column( width = 12, align = "center", h1("Create box with sidebar") ), br(), - fluidRow( # element column( width = 6, - eval(parse(text = box_sidebar)) + box( + id = "mybox", + width = 12, + title = "boxPlus with sidebar", + closable = TRUE, + status = "warning", + solidHeader = FALSE, + collapsible = TRUE, + sidebar = boxSidebar( + id = "boxsidebar", + width = 25, + startOpen = TRUE, + checkboxInput("somevalue", "Some value", FALSE), + verbatimTextOutput("value"), + sliderInput( + "slider_boxsidebar", + "Number of observations:", + min = 0, + max = 1000, + value = 500 + ) + ), + plotOutput("boxSidebarPlot") + ) ), # code editor column( @@ -33,19 +54,17 @@ box_elements_tab <- tabItem( ) ) ), - + # ##################### # - # demo descriptionBlock # + # demo descriptionBlock # # ##################### # - + column( width = 12, align = "center", h1("descriptionBlock()") ), - br(), - fluidRow( column( width = 6, @@ -65,21 +84,18 @@ box_elements_tab <- tabItem( ) ) ), - + # ##################### # - # demo boxPad # + # demo boxPad # # ##################### # - + br(), - column( width = 12, align = "center", h1("boxPad()") ), - br(), - fluidRow( # descriptionBlock demo in box side column( @@ -96,10 +112,9 @@ box_elements_tab <- tabItem( outputId = "boxPad1_code", readOnly = TRUE, value = paste(box_pad1, collapse = "\n") - ) + ) ) ), - fluidRow( # element column( @@ -116,25 +131,21 @@ box_elements_tab <- tabItem( outputId = "boxPad2_code", readOnly = TRUE, value = paste(box_pad2, collapse = "\n") - ) + ) ) ), - + # ##################### # - # demo userList() # + # demo userList() # # ##################### # - + br(), - column( width = 12, align = "center", h1("userList()") ), - br(), - - fluidRow( # userList examples column( @@ -151,24 +162,21 @@ box_elements_tab <- tabItem( outputId = "userlist_code", readOnly = TRUE, value = paste(user_list, collapse = "\n") - ) + ) ) ), - + # ##################### # - # demo navPills() # + # demo navPills() # # ##################### # - + br(), - column( width = 12, align = "center", h1("navPills()") ), - br(), - fluidRow( # navPills demo column( @@ -188,21 +196,18 @@ box_elements_tab <- tabItem( ) ) ), - + # ##################### # - # demo productList() # + # demo productList() # # ##################### # - + br(), - column( width = 12, align = "center", h1("productList()") ), - br(), - fluidRow( # product list demo column( @@ -222,11 +227,11 @@ box_elements_tab <- tabItem( ) ) ), - + # ##################### # - # demo accordion() # + # demo accordion() # # ##################### # - + br(), column( width = 12, @@ -234,7 +239,6 @@ box_elements_tab <- tabItem( h1("accordion()") ), br(), - fluidRow( # demo accordion column( @@ -251,29 +255,26 @@ box_elements_tab <- tabItem( outputId = "accordion_code", readOnly = TRUE, value = paste(accordion, collapse = "\n") - ) + ) ) ), - + # ##################### # - # demo todoList() # + # demo todoList() # # ##################### # - + br(), - column( width = 12, align = "center", h1("todoList()") ), - br(), - fluidRow( # element column( width = 6, - eval(parse(text = todo_list1)) + eval(parse(text = todo_list1)) ), # code editor column( @@ -285,13 +286,13 @@ box_elements_tab <- tabItem( outputId = "todolist1_code", readOnly = TRUE, value = paste(todo_list1, collapse = "\n") - ) + ) ), - + # element column( width = 6, - eval(parse(text = todo_list2)) + eval(parse(text = todo_list2)) ), # ace editor column( @@ -303,29 +304,26 @@ box_elements_tab <- tabItem( outputId = "todolist2_code", readOnly = TRUE, value = paste(todo_list2, collapse = "\n") - ) + ) ) ), - + # ##################### # - # demo timelineBlock() # + # demo timelineBlock() # # ##################### # - + br(), - column( width = 12, align = "center", h1("timelineBlock()") ), - br(), - fluidRow( # element column( width = 6, - eval(parse(text = timeline1)) + eval(parse(text = timeline1)) ), # ace editor column( @@ -337,10 +335,9 @@ box_elements_tab <- tabItem( outputId = "timelineBlock1_code", readOnly = TRUE, value = paste(timeline1, collapse = "\n") - ) + ) ) ), - fluidRow( h3("Timeline non reversed: ideal to include oustide of a box"), column( @@ -361,26 +358,23 @@ box_elements_tab <- tabItem( ) ) ), - + # ##################### # - # demo boxProfile() # + # demo boxProfile() # # ##################### # - + br(), - column( width = 12, align = "center", h1("boxProfile()") ), - br(), - fluidRow( # element column( width = 6, - eval(parse(text = box_profile)) + eval(parse(text = box_profile)) ), # ace editor column( @@ -392,29 +386,26 @@ box_elements_tab <- tabItem( outputId = "boxProfile_code", readOnly = TRUE, value = paste(box_profile, collapse = "\n") - ) + ) ) ), - + # ##################### # - # demo userPost() # + # demo userPost() # # ##################### # - + br(), - column( width = 12, align = "center", h1("userPost()") ), - br(), - fluidRow( # element column( width = 6, - eval(parse(text = user_post)) + eval(parse(text = user_post)) ), # ace editor column( @@ -426,30 +417,27 @@ box_elements_tab <- tabItem( outputId = "userPost_code", readOnly = TRUE, value = paste(user_post, collapse = "\n") - ) + ) ) ), - - + + # ##################### # - # demo userMessages() # + # demo userMessages() # # ##################### # - + br(), - column( width = 12, align = "center", h1("userMessages()") ), - br(), - fluidRow( # element column( width = 6, - eval(parse(text = user_messages)) + eval(parse(text = user_messages)) ), # ace editor column( @@ -461,8 +449,7 @@ box_elements_tab <- tabItem( outputId = "userMessages_code", readOnly = TRUE, value = paste(user_messages, collapse = "\n") - ) + ) ) ) - ) diff --git a/inst/examples/box_elements/box_sidebar.R b/inst/examples/box_elements/box_sidebar.R index 065b2414..872c0a2a 100644 --- a/inst/examples/box_elements/box_sidebar.R +++ b/inst/examples/box_elements/box_sidebar.R @@ -1,9 +1,10 @@ box_sidebar <- 'box( + id = "mybox", width = 12, - title = "boxPlus with sidebar", - closable = TRUE, - status = "warning", - solidHeader = FALSE, + title = "boxPlus with sidebar", + closable = TRUE, + status = "warning", + solidHeader = FALSE, collapsible = TRUE, sidebar = boxSidebar( id = "boxsidebar", @@ -12,10 +13,10 @@ box_sidebar <- 'box( checkboxInput("somevalue", "Some value", FALSE), verbatimTextOutput("value"), sliderInput( - "slider_boxsidebar", + "slider_boxsidebar", "Number of observations:", - min = 0, - max = 1000, + min = 0, + max = 1000, value = 500 ) ), diff --git a/inst/shinydashboardPlus-2.0.4.9000/css/AdminLTE.css b/inst/shinydashboardPlus-2.0.4/css/AdminLTE.css similarity index 100% rename from inst/shinydashboardPlus-2.0.4.9000/css/AdminLTE.css rename to inst/shinydashboardPlus-2.0.4/css/AdminLTE.css diff --git a/inst/shinydashboardPlus-2.0.4.9000/css/AdminLTE.min.css b/inst/shinydashboardPlus-2.0.4/css/AdminLTE.min.css similarity index 100% rename from inst/shinydashboardPlus-2.0.4.9000/css/AdminLTE.min.css rename to inst/shinydashboardPlus-2.0.4/css/AdminLTE.min.css diff --git a/inst/shinydashboardPlus-2.0.4.9000/css/_all-skins.css b/inst/shinydashboardPlus-2.0.4/css/_all-skins.css similarity index 100% rename from inst/shinydashboardPlus-2.0.4.9000/css/_all-skins.css rename to inst/shinydashboardPlus-2.0.4/css/_all-skins.css diff --git a/inst/shinydashboardPlus-2.0.4.9000/css/_all-skins.min.css b/inst/shinydashboardPlus-2.0.4/css/_all-skins.min.css similarity index 100% rename from inst/shinydashboardPlus-2.0.4.9000/css/_all-skins.min.css rename to inst/shinydashboardPlus-2.0.4/css/_all-skins.min.css diff --git a/inst/shinydashboardPlus-2.0.4.9000/css/custom.css b/inst/shinydashboardPlus-2.0.4/css/custom.css similarity index 100% rename from inst/shinydashboardPlus-2.0.4.9000/css/custom.css rename to inst/shinydashboardPlus-2.0.4/css/custom.css diff --git a/inst/shinydashboardPlus-2.0.4.9000/css/skin-midnight.min.css b/inst/shinydashboardPlus-2.0.4/css/skin-midnight.min.css similarity index 100% rename from inst/shinydashboardPlus-2.0.4.9000/css/skin-midnight.min.css rename to inst/shinydashboardPlus-2.0.4/css/skin-midnight.min.css diff --git a/inst/shinydashboardPlus-2.0.4.9000/js/app.js b/inst/shinydashboardPlus-2.0.4/js/app.js similarity index 100% rename from inst/shinydashboardPlus-2.0.4.9000/js/app.js rename to inst/shinydashboardPlus-2.0.4/js/app.js diff --git a/inst/shinydashboardPlus-2.0.4.9000/js/app.min.js b/inst/shinydashboardPlus-2.0.4/js/app.min.js similarity index 100% rename from inst/shinydashboardPlus-2.0.4.9000/js/app.min.js rename to inst/shinydashboardPlus-2.0.4/js/app.min.js diff --git a/inst/shinydashboardPlus-2.0.4.9000/js/shinydashboardPlus.js b/inst/shinydashboardPlus-2.0.4/js/shinydashboardPlus.js similarity index 100% rename from inst/shinydashboardPlus-2.0.4.9000/js/shinydashboardPlus.js rename to inst/shinydashboardPlus-2.0.4/js/shinydashboardPlus.js diff --git a/inst/shinydashboardPlus-2.0.4.9000/js/shinydashboardPlus.min.js b/inst/shinydashboardPlus-2.0.4/js/shinydashboardPlus.min.js similarity index 100% rename from inst/shinydashboardPlus-2.0.4.9000/js/shinydashboardPlus.min.js rename to inst/shinydashboardPlus-2.0.4/js/shinydashboardPlus.min.js diff --git a/inst/shinydashboardPlus-2.0.4.9000/js/shinydashboardPlus.min.js.map b/inst/shinydashboardPlus-2.0.4/js/shinydashboardPlus.min.js.map similarity index 100% rename from inst/shinydashboardPlus-2.0.4.9000/js/shinydashboardPlus.min.js.map rename to inst/shinydashboardPlus-2.0.4/js/shinydashboardPlus.min.js.map diff --git a/man/accordion.Rd b/man/accordion.Rd index f4f173c7..87584c55 100644 --- a/man/accordion.Rd +++ b/man/accordion.Rd @@ -56,94 +56,94 @@ Create an accordion container. Accordions are part of collapsible elements. } \examples{ if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - accordion( - id = "accordion1", - accordionItem( - title = "Accordion 1 Item 1", - status = "danger", - collapsed = TRUE, - "This is some text!" + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + accordion( + id = "accordion1", + accordionItem( + title = "Accordion 1 Item 1", + status = "danger", + collapsed = TRUE, + "This is some text!" + ), + accordionItem( + title = "Accordion 1 Item 2", + status = "warning", + collapsed = FALSE, + "This is some text!" + ) ), - accordionItem( - title = "Accordion 1 Item 2", - status = "warning", - collapsed = FALSE, - "This is some text!" + accordion( + id = "accordion2", + accordionItem( + title = "Accordion 2 Item 1", + status = "info", + collapsed = TRUE, + "This is some text!" + ), + accordionItem( + title = "Accordion 2 Item 2", + status = "success", + collapsed = FALSE, + "This is some text!" + ) ) ), - accordion( - id = "accordion2", - accordionItem( - title = "Accordion 2 Item 1", - status = "info", - collapsed = TRUE, - "This is some text!" - ), - accordionItem( - title = "Accordion 2 Item 2", - status = "success", - collapsed = FALSE, - "This is some text!" - ) - ) + title = "Accordion" ), - title = "Accordion" - ), - server = function(input, output) { } - ) + server = function(input, output) { } + ) } # Update accordion if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - radioButtons("controller", "Controller", choices = c(1, 2)), - br(), - accordion( - id = "accordion1", - accordionItem( - title = "Accordion 1 Item 1", - status = "danger", - collapsed = TRUE, - "This is some text!" - ), - accordionItem( - title = "Accordion 1 Item 2", - status = "warning", - collapsed = TRUE, - "This is some text!" + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + radioButtons("controller", "Controller", choices = c(1, 2)), + br(), + accordion( + id = "accordion1", + accordionItem( + title = "Accordion 1 Item 1", + status = "danger", + collapsed = TRUE, + "This is some text!" + ), + accordionItem( + title = "Accordion 1 Item 2", + status = "warning", + collapsed = TRUE, + "This is some text!" + ) ) - ) + ), + title = "Update Accordion" ), - title = "Update Accordion" - ), - server = function(input, output, session) { - observeEvent(input$controller, { - updateAccordion(id = "accordion1", selected = input$controller) - }) - observe(print(input$accordion1)) - observeEvent(input$accordion1, { - showNotification(sprintf("You selected accordion N° \%s", input$accordion1), type = "message") - }) - } - ) + server = function(input, output, session) { + observeEvent(input$controller, { + updateAccordion(id = "accordion1", selected = input$controller) + }) + observe(print(input$accordion1)) + observeEvent(input$accordion1, { + showNotification(sprintf("You selected accordion N° \%s", input$accordion1), type = "message") + }) + } + ) } } \author{ diff --git a/man/attachmentBlock.Rd b/man/attachmentBlock.Rd index fd87a037..9db51b3d 100644 --- a/man/attachmentBlock.Rd +++ b/man/attachmentBlock.Rd @@ -23,29 +23,29 @@ and insert in a \link{box}. # Box with attachmentBlock if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - box( - title = "Attachment example", - attachmentBlock( - image = "https://adminlte.io/themes/AdminLTE/dist/img/photo1.png", - title = "Test", - href = "https://google.com", - "This is the content" - ) - ) + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + box( + title = "Attachment example", + attachmentBlock( + image = "https://adminlte.io/themes/AdminLTE/dist/img/photo1.png", + title = "Test", + href = "https://google.com", + "This is the content" + ) + ) + ), + title = "AttachmentBlock" ), - title = "AttachmentBlock" - ), - server = function(input, output) { } - ) + server = function(input, output) { } + ) } } diff --git a/man/blockQuote.Rd b/man/blockQuote.Rd index f31c3375..b0c396d1 100644 --- a/man/blockQuote.Rd +++ b/man/blockQuote.Rd @@ -16,25 +16,25 @@ If you want to quote text } \examples{ if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - box( - title = "BlockQuote example", - blockQuote("I quote some text here!"), - blockQuote("I quote some text here!", side = "right") - ) + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + box( + title = "BlockQuote example", + blockQuote("I quote some text here!"), + blockQuote("I quote some text here!", side = "right") + ) + ), + title = "blockQuote" ), - title = "blockQuote" - ), - server = function(input, output) { } - ) + server = function(input, output) { } + ) } } diff --git a/man/box.Rd b/man/box.Rd index 3d27077d..e582d779 100644 --- a/man/box.Rd +++ b/man/box.Rd @@ -224,7 +224,7 @@ dropdown menu container. \link{boxPad} creates a vertical container for \link{descriptionBlock}. It has to be included in a \link{box}. -\link{descriptionBlock} creates a description block, perfect for writing statistics +\link{descriptionBlock} creates a description block, perfect for writing statistics to insert in a \link{box} } \examples{ @@ -418,102 +418,103 @@ if (interactive()) { # Box with boxPad container + descriptionBlock if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - box(title = "Box with right pad", - status = "warning", - fluidRow( - column(width = 6), - column( - width = 6, - boxPad( - color = "green", - descriptionBlock( - header = "8390", - text = "VISITS", - rightBorder = FALSE, - marginBottom = TRUE - ), - descriptionBlock( - header = "30\%", - text = "REFERRALS", - rightBorder = FALSE, - marginBottom = TRUE - ), - descriptionBlock( - header = "70\%", - text = "ORGANIC", - rightBorder = FALSE, - marginBottom = FALSE + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + box( + title = "Box with right pad", + status = "warning", + fluidRow( + column(width = 6), + column( + width = 6, + boxPad( + color = "green", + descriptionBlock( + header = "8390", + text = "VISITS", + rightBorder = FALSE, + marginBottom = TRUE + ), + descriptionBlock( + header = "30\%", + text = "REFERRALS", + rightBorder = FALSE, + marginBottom = TRUE + ), + descriptionBlock( + header = "70\%", + text = "ORGANIC", + rightBorder = FALSE, + marginBottom = FALSE + ) + ) ) ) ) - ) - ) + ), + title = "boxPad" ), - title = "boxPad" - ), - server = function(input, output) { } - ) + server = function(input, output) { } + ) } # Box with descriptionBlock if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - box( - solidHeader = FALSE, - title = "Status summary", - background = NULL, - width = 4, - status = "danger", - footer = fluidRow( - column( - width = 6, - descriptionBlock( - number = "17\%", - numberColor = "green", - numberIcon = icon("caret-up"), - header = "$35,210.43", - text = "TOTAL REVENUE", - rightBorder = TRUE, - marginBottom = FALSE - ) - ), - column( - width = 6, - descriptionBlock( - number = "18\%", - numberColor = "red", - numberIcon = icon("caret-down"), - header = "1200", - text = "GOAL COMPLETION", - rightBorder = FALSE, - marginBottom = FALSE + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + box( + solidHeader = FALSE, + title = "Status summary", + background = NULL, + width = 4, + status = "danger", + footer = fluidRow( + column( + width = 6, + descriptionBlock( + number = "17\%", + numberColor = "green", + numberIcon = icon("caret-up"), + header = "$35,210.43", + text = "TOTAL REVENUE", + rightBorder = TRUE, + marginBottom = FALSE + ) + ), + column( + width = 6, + descriptionBlock( + number = "18\%", + numberColor = "red", + numberIcon = icon("caret-down"), + header = "1200", + text = "GOAL COMPLETION", + rightBorder = FALSE, + marginBottom = FALSE + ) + ) ) ) - ) - ) + ), + title = "Description Blocks" ), - title = "Description Blocks" - ), - server = function(input, output) { } - ) + server = function(input, output) { } + ) } } diff --git a/man/carousel.Rd b/man/carousel.Rd index cb9ccce9..cc2df95b 100644 --- a/man/carousel.Rd +++ b/man/carousel.Rd @@ -32,31 +32,31 @@ put these item here instead of passing them in ...} } \examples{ if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - header = dashboardHeader(), - sidebar = dashboardSidebar(), - body = dashboardBody( - carousel( - id = "mycarousel", - carouselItem( - caption = "Item 1", - tags$img(src = "https://placehold.it/900x500/3c8dbc/ffffff&text=I+Love+Bootstrap") - ), - carouselItem( - caption = "Item 2", - tags$img(src = "https://placehold.it/900x500/39CCCC/ffffff&text=I+Love+Bootstrap") - ) - ) - ), - title = "Carousel" - ), - server = function(input, output) { } - ) + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + header = dashboardHeader(), + sidebar = dashboardSidebar(), + body = dashboardBody( + carousel( + id = "mycarousel", + carouselItem( + caption = "Item 1", + tags$img(src = "https://placehold.it/900x500/3c8dbc/ffffff&text=I+Love+Bootstrap") + ), + carouselItem( + caption = "Item 2", + tags$img(src = "https://placehold.it/900x500/39CCCC/ffffff&text=I+Love+Bootstrap") + ) + ) + ), + title = "Carousel" + ), + server = function(input, output) { } + ) } } \author{ diff --git a/man/dashboardBadge.Rd b/man/dashboardBadge.Rd index a13093ad..4133debc 100644 --- a/man/dashboardBadge.Rd +++ b/man/dashboardBadge.Rd @@ -31,32 +31,32 @@ See below: }} } \description{ -Create a badge. It may be inserted in any element like inside +Create a badge. It may be inserted in any element like inside a \link[shiny]{actionButton} or a \link{dashboardSidebar}. } \examples{ if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - dashboardBadge("Badge 1", color = "blue"), - actionButton( - inputId = "badge", - label = "Hello", - icon = NULL, - width = NULL, - dashboardBadge(1, color = "orange") - ) - ) - ), - server = function(input, output) { } - ) + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + dashboardBadge("Badge 1", color = "blue"), + actionButton( + inputId = "badge", + label = "Hello", + icon = NULL, + width = NULL, + dashboardBadge(1, color = "orange") + ) + ) + ), + server = function(input, output) { } + ) } } diff --git a/man/dashboardHeader.Rd b/man/dashboardHeader.Rd index cc92b3af..17cacc7b 100644 --- a/man/dashboardHeader.Rd +++ b/man/dashboardHeader.Rd @@ -45,75 +45,75 @@ A dashboard header can be left blank, or it can include dropdown menu items on the right side. } \note{ -We do not recommend to insert shiny input elements (such as sliderInput) -in the left menu, since they will not be well displayed. Instead, wrap them in a +We do not recommend to insert shiny input elements (such as sliderInput) +in the left menu, since they will not be well displayed. Instead, wrap them in a \code{\link[shinydashboardPlus]{dropdownBlock}} } \examples{ if (interactive()) { - library(shiny) - library(shinyWidgets) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - header = dashboardHeader( - leftUi = tagList( - dropdownBlock( - id = "mydropdown", - title = "Dropdown 1", - icon = icon("sliders"), - sliderInput( - inputId = "n", - label = "Number of observations", - min = 10, max = 100, value = 30 + library(shiny) + library(shinyWidgets) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + header = dashboardHeader( + leftUi = tagList( + dropdownBlock( + id = "mydropdown", + title = "Dropdown 1", + icon = icon("sliders"), + sliderInput( + inputId = "n", + label = "Number of observations", + min = 10, max = 100, value = 30 + ), + prettyToggle( + inputId = "na", + label_on = "NAs kept", + label_off = "NAs removed", + icon_on = icon("check"), + icon_off = icon("trash-can") + ) ), - prettyToggle( - inputId = "na", - label_on = "NAs kept", - label_off = "NAs removed", - icon_on = icon("check"), - icon_off = icon("trash-can") + dropdownBlock( + id = "mydropdown2", + title = "Dropdown 2", + icon = icon("sliders"), + prettySwitch( + inputId = "switch4", + label = "Fill switch with status:", + fill = TRUE, + status = "primary" + ), + prettyCheckboxGroup( + inputId = "checkgroup2", + label = "Click me!", + thick = TRUE, + choices = c("Click me !", "Me !", "Or me !"), + animation = "pulse", + status = "info" + ) ) ), - dropdownBlock( - id = "mydropdown2", - title = "Dropdown 2", - icon = icon("sliders"), - prettySwitch( - inputId = "switch4", - label = "Fill switch with status:", - fill = TRUE, - status = "primary" - ), - prettyCheckboxGroup( - inputId = "checkgroup2", - label = "Click me!", - thick = TRUE, - choices = c("Click me !", "Me !", "Or me !"), - animation = "pulse", - status = "info" - ) + dropdownMenu( + type = "tasks", + badgeStatus = "danger", + taskItem(value = 20, color = "aqua", "Refactor code"), + taskItem(value = 40, color = "green", "Design new layout"), + taskItem(value = 60, color = "yellow", "Another task"), + taskItem(value = 80, color = "red", "Write documentation") ) ), - dropdownMenu( - type = "tasks", - badgeStatus = "danger", - taskItem(value = 20, color = "aqua", "Refactor code"), - taskItem(value = 40, color = "green", "Design new layout"), - taskItem(value = 60, color = "yellow", "Another task"), - taskItem(value = 80, color = "red", "Write documentation") - ) - ), - sidebar = dashboardSidebar(), - body = dashboardBody( - setShadow(class = "dropdown-menu") + sidebar = dashboardSidebar(), + body = dashboardBody( + setShadow(class = "dropdown-menu") + ), + title = "DashboardPage" ), - title = "DashboardPage" - ), - server = function(input, output) { } - ) + server = function(input, output) { } + ) } } \seealso{ diff --git a/man/dashboardLabel.Rd b/man/dashboardLabel.Rd index 70018fea..ccfbb32a 100644 --- a/man/dashboardLabel.Rd +++ b/man/dashboardLabel.Rd @@ -25,22 +25,22 @@ Create a label } \examples{ if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - dashboardLabel("Label 1", status = "info"), - dashboardLabel("Label 2", status = "danger", style = "circle"), - dashboardLabel("Label 3", status = "success", style = "square") - ) - ), - server = function(input, output) { } - ) + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + dashboardLabel("Label 1", status = "info"), + dashboardLabel("Label 2", status = "danger", style = "circle"), + dashboardLabel("Label 3", status = "success", style = "square") + ) + ), + server = function(input, output) { } + ) } } diff --git a/man/dashboardUser.Rd b/man/dashboardUser.Rd index 1351133f..58914298 100644 --- a/man/dashboardUser.Rd +++ b/man/dashboardUser.Rd @@ -31,46 +31,46 @@ Create a dashboard user profile. } \examples{ if (interactive()) { - library(shiny) - library(shinyWidgets) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - header = dashboardHeader(userOutput("user")), - sidebar = dashboardSidebar(), - body = dashboardBody(), - title = "DashboardPage" - ), - server = function(input, output) { - output$user <- renderUser({ - dashboardUser( - name = "Divad Nojnarg", - image = "https://adminlte.io/themes/AdminLTE/dist/img/user2-160x160.jpg", - title = "shinydashboardPlus", - subtitle = "Author", - footer = p("The footer", class = "text-center"), - fluidRow( - dashboardUserItem( - width = 6, - socialButton( - href = "https://dropbox.com", - icon = icon("dropbox") - ) - ), - dashboardUserItem( - width = 6, - socialButton( - href = "https://github.com", - icon = icon("github") - ) + library(shiny) + library(shinyWidgets) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + header = dashboardHeader(userOutput("user")), + sidebar = dashboardSidebar(), + body = dashboardBody(), + title = "DashboardPage" + ), + server = function(input, output) { + output$user <- renderUser({ + dashboardUser( + name = "Divad Nojnarg", + image = "https://adminlte.io/themes/AdminLTE/dist/img/user2-160x160.jpg", + title = "shinydashboardPlus", + subtitle = "Author", + footer = p("The footer", class = "text-center"), + fluidRow( + dashboardUserItem( + width = 6, + socialButton( + href = "https://dropbox.com", + icon = icon("dropbox") + ) + ), + dashboardUserItem( + width = 6, + socialButton( + href = "https://github.com", + icon = icon("github") + ) + ) + ) ) - ) - ) - }) - } - ) + }) + } + ) } } diff --git a/man/loadingState.Rd b/man/loadingState.Rd index 6ac25837..0fbebed1 100644 --- a/man/loadingState.Rd +++ b/man/loadingState.Rd @@ -14,24 +14,24 @@ Loading state can be programmatically used when a conputation is running for ins } \examples{ if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - box( - title = "loading spinner", - loadingState() - ) + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + box( + title = "loading spinner", + loadingState() + ) + ), + title = "Loading State" ), - title = "Loading State" - ), - server = function(input, output) { } - ) + server = function(input, output) { } + ) } } diff --git a/man/navPills.Rd b/man/navPills.Rd index 2fad5e99..51905796 100644 --- a/man/navPills.Rd +++ b/man/navPills.Rd @@ -67,97 +67,97 @@ selected \link{navPillsItem} on the client. # navPills if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - box( - title = "Nav Pills", - status = "info", - "Box Body", - footer = navPills( - id = "pillItem", - navPillsItem( - left = "Item 1", - color = "green", - right = 10 - ), - navPillsItem( - left = "Item 2", - color = "red", - icon = icon("angle-down"), - right = "10\%", - active = TRUE + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + box( + title = "Nav Pills", + status = "info", + "Box Body", + footer = navPills( + id = "pillItem", + navPillsItem( + left = "Item 1", + color = "green", + right = 10 + ), + navPillsItem( + left = "Item 2", + color = "red", + icon = icon("angle-down"), + right = "10\%", + active = TRUE + ) + ) ) - ) - ) + ), + title = "Nav Pills" ), - title = "Nav Pills" - ), - server = function(input, output) { - observeEvent(input$pillItem, { - showNotification(sprintf("You clicked on pill N° \%s", input$pillItem), type = "message") - }) - } - ) + server = function(input, output) { + observeEvent(input$pillItem, { + showNotification(sprintf("You clicked on pill N° \%s", input$pillItem), type = "message") + }) + } + ) } # update navPills if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - radioButtons("controller", "Controller", choices = c(1, 2, 3)), - br(), - box( - title = "Nav Pills", - status = "info", - "Box Body", - footer = navPills( - inputId = "pills", - navPillsItem( - left = "Item 1", - color = "green", - right = 10 - ), - navPillsItem( - left = "Item 2", - color = "red", - icon = icon("angle-down"), - right = "10\%" - ), - navPillsItem( - left = "Item 3", - color = "blue", - icon = icon("angle-up"), - right = "30\%" + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + radioButtons("controller", "Controller", choices = c(1, 2, 3)), + br(), + box( + title = "Nav Pills", + status = "info", + "Box Body", + footer = navPills( + inputId = "pills", + navPillsItem( + left = "Item 1", + color = "green", + right = 10 + ), + navPillsItem( + left = "Item 2", + color = "red", + icon = icon("angle-down"), + right = "10\%" + ), + navPillsItem( + left = "Item 3", + color = "blue", + icon = icon("angle-up"), + right = "30\%" + ) + ) ) - ) - ) + ), + title = "Nav Pills" ), - title = "Nav Pills" - ), - server = function(input, output, session) { - observeEvent(input$controller, { - updateNavPills(id = "pills", selected = input$controller) - }) - observeEvent(input$pills, { - showNotification(sprintf("You selected pill N° \%s", input$pills), type = "message") - }) - } - ) + server = function(input, output, session) { + observeEvent(input$controller, { + updateNavPills(id = "pills", selected = input$controller) + }) + observeEvent(input$pills, { + showNotification(sprintf("You selected pill N° \%s", input$pills), type = "message") + }) + } + ) } } \author{ diff --git a/man/productList.Rd b/man/productList.Rd index bbff89c9..2cd3e973 100644 --- a/man/productList.Rd +++ b/man/productList.Rd @@ -3,10 +3,7 @@ \name{productList} \alias{productList} \alias{productListItem} -\title{AdminLTE2 product list container - -\link{productList} creates a container to display commercial items in an elegant container. -Insert in a \link{box}.} +\title{AdminLTE2 product list container} \usage{ productList(...) @@ -43,46 +40,49 @@ See below: }} } \description{ +\link{productList} creates a container to display commercial items in an elegant container. +Insert in a \link{box}. + \link{productListItem} creates a product item to insert in \link{productList}. } \examples{ # Box with productList if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - box( - title = "Product List", - status = "primary", - productList( - productListItem( - image = "https://www.pngmart.com/files/1/Haier-TV-PNG.png", - title = "Samsung TV", - subtitle = "$1800", - color = "yellow", - "This is an amazing TV, but I don't like TV!" - ), - productListItem( - image = "https://upload.wikimedia.org/wikipedia/commons/7/77/IMac_Pro.svg", - title = "Imac 27", - subtitle = "$4999", - color = "red", - "This is were I spend most of my time!" + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + box( + title = "Product List", + status = "primary", + productList( + productListItem( + image = "https://www.pngmart.com/files/1/Haier-TV-PNG.png", + title = "Samsung TV", + subtitle = "$1800", + color = "yellow", + "This is an amazing TV, but I don't like TV!" + ), + productListItem( + image = "https://upload.wikimedia.org/wikipedia/commons/7/77/IMac_Pro.svg", + title = "Imac 27", + subtitle = "$4999", + color = "red", + "This is were I spend most of my time!" + ) + ) ) - ) - ) + ), + title = "Product List" ), - title = "Product List" - ), - server = function(input, output) { } - ) + server = function(input, output) { } + ) } } diff --git a/man/progressBar.Rd b/man/progressBar.Rd index a82cb0cc..23035139 100644 --- a/man/progressBar.Rd +++ b/man/progressBar.Rd @@ -50,60 +50,60 @@ This creates a vertical progress bar. } \examples{ if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - header = dashboardHeader(), - sidebar = dashboardSidebar(), - body = dashboardBody( - box( - title = "Horizontal", - progressBar( - value = 10, - striped = TRUE, - animated = TRUE, - label = "10\%" - ), - progressBar( - value = 50, - status = "warning", - size = "xs" - ), - progressBar( - value = 20, - status = "danger", - size = "sm" - ) + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + header = dashboardHeader(), + sidebar = dashboardSidebar(), + body = dashboardBody( + box( + title = "Horizontal", + progressBar( + value = 10, + striped = TRUE, + animated = TRUE, + label = "10\%" + ), + progressBar( + value = 50, + status = "warning", + size = "xs" + ), + progressBar( + value = 20, + status = "danger", + size = "sm" + ) + ), + box( + title = "Vertical", + progressBar( + value = 10, + striped = TRUE, + animated = TRUE, + vertical = TRUE + ), + progressBar( + value = 50, + status = "warning", + size = "xs", + vertical = TRUE + ), + progressBar( + value = 20, + status = "danger", + size = "sm", + vertical = TRUE + ) + ) ), - box( - title = "Vertical", - progressBar( - value = 10, - striped = TRUE, - animated = TRUE, - vertical = TRUE - ), - progressBar( - value = 50, - status = "warning", - size = "xs", - vertical = TRUE - ), - progressBar( - value = 20, - status = "danger", - size = "sm", - vertical = TRUE - ) - ) - ), - title = "Progress bars" - ), - server = function(input, output) { } - ) + title = "Progress bars" + ), + server = function(input, output) { } + ) } } \author{ diff --git a/man/socialButton.Rd b/man/socialButton.Rd index 356f5c65..7e6f5b74 100644 --- a/man/socialButton.Rd +++ b/man/socialButton.Rd @@ -16,32 +16,32 @@ Create a social button } \examples{ if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - box( - title = "Social Buttons", - status = NULL, - socialButton( - href = "https://dropbox.com", - icon = icon("dropbox") + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + box( + title = "Social Buttons", + status = NULL, + socialButton( + href = "https://dropbox.com", + icon = icon("dropbox") + ), + socialButton( + href = "https://github.com", + icon = icon("github") + ) + ) ), - socialButton( - href = "https://github.com", - icon = icon("github") - ) - ) + title = "Social Buttons" ), - title = "Social Buttons" - ), - server = function(input, output) { } - ) + server = function(input, output) { } + ) } } diff --git a/man/starBlock.Rd b/man/starBlock.Rd index 8caab3bb..ed474037 100644 --- a/man/starBlock.Rd +++ b/man/starBlock.Rd @@ -37,27 +37,27 @@ Create a starBlock item (ideal for rating) } \examples{ if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - box( - title = "Star example", - starBlock(5), - starBlock(5, color = "olive"), - starBlock(1, color = "maroon"), - starBlock(3, color = "teal") - ) + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + box( + title = "Star example", + starBlock(5), + starBlock(5, color = "olive"), + starBlock(1, color = "maroon"), + starBlock(3, color = "teal") + ) + ), + title = "starBlock" ), - title = "starBlock" - ), - server = function(input, output) { } - ) + server = function(input, output) { } + ) } } diff --git a/man/taskItem.Rd b/man/taskItem.Rd index e12bc656..4de0e3a0 100644 --- a/man/taskItem.Rd +++ b/man/taskItem.Rd @@ -23,41 +23,41 @@ Custom taskItem } \examples{ if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader( - dropdownMenu( - type = "tasks", - badgeStatus = "danger", - taskItem( - inputId = "mytask", - value = 20, - color = "aqua", - text = "Click me!" - ), - taskItem( - value = 40, - color = "green", - text = "Basic item" - ) - ) - ), - dashboardSidebar(), - dashboardBody(), - title = "Dashboard example" - ), - server = function(input, output) { - observeEvent(input$mytask, { - showModal(modalDialog( - title = "Important message", - "This is an important message!" - )) - }) - } - ) + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader( + dropdownMenu( + type = "tasks", + badgeStatus = "danger", + taskItem( + inputId = "mytask", + value = 20, + color = "aqua", + text = "Click me!" + ), + taskItem( + value = 40, + color = "green", + text = "Basic item" + ) + ) + ), + dashboardSidebar(), + dashboardBody(), + title = "Dashboard example" + ), + server = function(input, output) { + observeEvent(input$mytask, { + showModal(modalDialog( + title = "Important message", + "This is an important message!" + )) + }) + } + ) } } diff --git a/man/timeline.Rd b/man/timeline.Rd index 7cf4456a..eaf9d303 100644 --- a/man/timeline.Rd +++ b/man/timeline.Rd @@ -76,7 +76,7 @@ See below: \link{timelineLabel} creates a timeline label element to highlight an event. -\link{timelineItem} creates a timeline item that contains information for a +\link{timelineItem} creates a timeline item that contains information for a given event like the title, description, date, ... \link{timelineItemMedia} create a specific container for images. @@ -87,78 +87,78 @@ given event like the title, description, date, ... } \examples{ if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - h3("When Reversed = TRUE, can be displayed inside a box"), - box( - title = "Timeline", - status = "info", - timelineBlock( - width = 12, - timelineEnd(color = "red"), - timelineLabel(2018, color = "teal"), - timelineItem( - title = "Item 1", - icon = icon("gears"), - color = "olive", - time = "now", - footer = "Here is the footer", - "This is the body" - ), - timelineItem( - title = "Item 2", - border = FALSE - ), - timelineLabel(2015, color = "orange"), - timelineItem( - title = "Item 3", - icon = icon("paint-brush"), - color = "maroon", - timelineItemMedia(image = "https://placehold.it/150x100"), - timelineItemMedia(image = "https://placehold.it/150x100") - ), - timelineStart(color = "purple") - ) - ), - h3("When Reversed = FALSE, can be displayed out of a box"), - timelineBlock( - reversed = FALSE, - timelineEnd(color = "red"), - timelineLabel(2018, color = "teal"), - timelineItem( - title = "Item 1", - icon = icon("gears"), - color = "olive", - time = "now", - footer = "Here is the footer", - "This is the body" - ), - timelineItem( - title = "Item 2", - border = FALSE - ), - timelineLabel(2015, color = "orange"), - timelineItem( - title = "Item 3", - icon = icon("paint-brush"), - color = "maroon", - timelineItemMedia(image = "https://placehold.it/150x100"), - timelineItemMedia(image = "https://placehold.it/150x100") - ), - timelineStart(color = "purple") - ) + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + h3("When Reversed = TRUE, can be displayed inside a box"), + box( + title = "Timeline", + status = "info", + timelineBlock( + width = 12, + timelineEnd(color = "red"), + timelineLabel(2018, color = "teal"), + timelineItem( + title = "Item 1", + icon = icon("gears"), + color = "olive", + time = "now", + footer = "Here is the footer", + "This is the body" + ), + timelineItem( + title = "Item 2", + border = FALSE + ), + timelineLabel(2015, color = "orange"), + timelineItem( + title = "Item 3", + icon = icon("paint-brush"), + color = "maroon", + timelineItemMedia(image = "https://placehold.it/150x100"), + timelineItemMedia(image = "https://placehold.it/150x100") + ), + timelineStart(color = "purple") + ) + ), + h3("When Reversed = FALSE, can be displayed out of a box"), + timelineBlock( + reversed = FALSE, + timelineEnd(color = "red"), + timelineLabel(2018, color = "teal"), + timelineItem( + title = "Item 1", + icon = icon("gears"), + color = "olive", + time = "now", + footer = "Here is the footer", + "This is the body" + ), + timelineItem( + title = "Item 2", + border = FALSE + ), + timelineLabel(2015, color = "orange"), + timelineItem( + title = "Item 3", + icon = icon("paint-brush"), + color = "maroon", + timelineItemMedia(image = "https://placehold.it/150x100"), + timelineItemMedia(image = "https://placehold.it/150x100") + ), + timelineStart(color = "purple") + ) + ), + title = "timelineBlock" ), - title = "timelineBlock" - ), - server = function(input, output) { } - ) + server = function(input, output) { } + ) } } diff --git a/man/todoList.Rd b/man/todoList.Rd index dad7600d..bc673cdc 100644 --- a/man/todoList.Rd +++ b/man/todoList.Rd @@ -25,58 +25,58 @@ Create a todo list container. May be included in \link{box}. } \examples{ if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinyjqui) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - box( - "Sortable todo list demo", - status = "warning", - todoList( - todoListItem( - label = "Design a nice theme", - "Some text here" - ), - todoListItem( - label = "Make the theme responsive", - "Some text here" + library(shiny) + library(shinydashboard) + library(shinyjqui) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + box( + "Sortable todo list demo", + status = "warning", + todoList( + todoListItem( + label = "Design a nice theme", + "Some text here" + ), + todoListItem( + label = "Make the theme responsive", + "Some text here" + ), + todoListItem( + checked = TRUE, + label = "Let theme shine like a star" + ) + ) ), - todoListItem( - checked = TRUE, - label = "Let theme shine like a star" + box( + "Simple todo list demo", + status = "warning", + todoList( + sortable = FALSE, + todoListItem( + label = "Design a nice theme", + "Some text here" + ), + todoListItem( + label = "Make the theme responsive", + "Some text here" + ), + todoListItem( + checked = TRUE, + label = "Let theme shine like a star" + ) + ) ) - ) ), - box( - "Simple todo list demo", - status = "warning", - todoList( - sortable = FALSE, - todoListItem( - label = "Design a nice theme", - "Some text here" - ), - todoListItem( - label = "Make the theme responsive", - "Some text here" - ), - todoListItem( - checked = TRUE, - label = "Let theme shine like a star" - ) - ) - ) + title = "Todo Lists" ), - title = "Todo Lists" - ), - server = function(input, output) { } - ) + server = function(input, output) { } + ) } } diff --git a/man/userList.Rd b/man/userList.Rd index d51831fb..105e8c16 100644 --- a/man/userList.Rd +++ b/man/userList.Rd @@ -25,41 +25,41 @@ userListItem(image, title, subtitle = NULL) } \examples{ if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - box( - title = "User List example", - status = "success", - userList( - userListItem( - image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", - title = "Shiny", - subtitle = "Package 1" - ), - userListItem( - image = "https://adminlte.io/themes/AdminLTE/dist/img/user7-128x128.jpg", - title = "Tidyverse", - subtitle = "Package 2" - ), - userListItem( - image = "https://adminlte.io/themes/AdminLTE/dist/img/user5-128x128.jpg", - title = "tidyr", - subtitle = "Package 3" + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + box( + title = "User List example", + status = "success", + userList( + userListItem( + image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", + title = "Shiny", + subtitle = "Package 1" + ), + userListItem( + image = "https://adminlte.io/themes/AdminLTE/dist/img/user7-128x128.jpg", + title = "Tidyverse", + subtitle = "Package 2" + ), + userListItem( + image = "https://adminlte.io/themes/AdminLTE/dist/img/user5-128x128.jpg", + title = "tidyr", + subtitle = "Package 3" + ) + ) ) - ) - ) + ), + title = "User List" ), - title = "User List" - ), - server = function(input, output) { } - ) + server = function(input, output) { } + ) } } diff --git a/man/userMessage.Rd b/man/userMessage.Rd index d2b08c02..33102743 100644 --- a/man/userMessage.Rd +++ b/man/userMessage.Rd @@ -29,7 +29,7 @@ updateUserMessages( \item{id}{\link{userMessages} to target.} -\item{status}{Messages status. See here for a list of valid colors +\item{status}{Messages status. See here for a list of valid colors \url{https://adminlte.io/themes/AdminLTE/pages/UI/general.html}. Valid statuses are defined as follows: \itemize{ @@ -70,157 +70,157 @@ such as sending, removing or editing messages. } \examples{ if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - box( - title = "Box with messages", - solidHeader = TRUE, - status = "warning", - userMessages( - width = 12, - status = "success", - userMessage( - author = "Alexander Pierce", - date = "20 Jan 2:00 pm", - image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", - type = "sent", - "Is this template really for free? That's unbelievable!" - ), - userMessage( - author = "Sarah Bullock", - date = "23 Jan 2:05 pm", - image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", - type = "received", - "You better believe it!" - ) - ) - ), - userMessages( - width = 6, - status = "danger", - userMessage( - author = "Alexander Pierce", - date = "20 Jan 2:00 pm", - image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", - type = "received", - "Is this template really for free? That's unbelievable!" - ), - userMessage( - author = "Sarah Bullock", - date = "23 Jan 2:05 pm", - image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", - type = "sent", - "You better believe it!" - ) - ) + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + box( + title = "Box with messages", + solidHeader = TRUE, + status = "warning", + userMessages( + width = 12, + status = "success", + userMessage( + author = "Alexander Pierce", + date = "20 Jan 2:00 pm", + image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", + type = "sent", + "Is this template really for free? That's unbelievable!" + ), + userMessage( + author = "Sarah Bullock", + date = "23 Jan 2:05 pm", + image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", + type = "received", + "You better believe it!" + ) + ) + ), + userMessages( + width = 6, + status = "danger", + userMessage( + author = "Alexander Pierce", + date = "20 Jan 2:00 pm", + image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", + type = "received", + "Is this template really for free? That's unbelievable!" + ), + userMessage( + author = "Sarah Bullock", + date = "23 Jan 2:05 pm", + image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", + type = "sent", + "You better believe it!" + ) + ) + ), + title = "user Message" ), - title = "user Message" - ), - server = function(input, output) { } - ) + server = function(input, output) { } + ) } if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - fluidRow( - actionButton("remove", "Remove message"), - actionButton("add", "Add message"), - actionButton("update", "Update message") - ), - numericInput("index", "Message index:", 1, min = 1, max = 3), - br(), - br(), - userMessages( - width = 6, - status = "danger", - id = "message", - userMessage( - author = "Alexander Pierce", - date = "20 Jan 2:00 pm", - image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", - type = "received", - "Is this template really for free? That's unbelievable!" + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + fluidRow( + actionButton("remove", "Remove message"), + actionButton("add", "Add message"), + actionButton("update", "Update message") ), - userMessage( - author = "Sarah Bullock", - date = "23 Jan 2:05 pm", - image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", - type = "sent", - "You better believe it!" + numericInput("index", "Message index:", 1, min = 1, max = 3), + br(), + br(), + userMessages( + width = 6, + status = "danger", + id = "message", + userMessage( + author = "Alexander Pierce", + date = "20 Jan 2:00 pm", + image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", + type = "received", + "Is this template really for free? That's unbelievable!" + ), + userMessage( + author = "Sarah Bullock", + date = "23 Jan 2:05 pm", + image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", + type = "sent", + "You better believe it!" + ) ) - ) + ), + title = "user Message" ), - title = "user Message" - ), - server = function(input, output, session) { - observeEvent(input$remove, { - updateUserMessages("message", action = "remove", index = input$index) - }) - observeEvent(input$add, { - updateUserMessages( - "message", - action = "add", - content = list( - author = "David", - date = "Now", - image = "https://i.pinimg.com/originals/f1/15/df/f115dfc9cab063597b1221d015996b39.jpg", - type = "received", - text = tagList( - sliderInput( - "obs", - "Number of observations:", - min = 0, - max = 1000, - value = 500 - ), - plotOutput("distPlot") + server = function(input, output, session) { + observeEvent(input$remove, { + updateUserMessages("message", action = "remove", index = input$index) + }) + observeEvent(input$add, { + updateUserMessages( + "message", + action = "add", + content = list( + author = "David", + date = "Now", + image = "https://i.pinimg.com/originals/f1/15/df/f115dfc9cab063597b1221d015996b39.jpg", + type = "received", + text = tagList( + sliderInput( + "obs", + "Number of observations:", + min = 0, + max = 1000, + value = 500 + ), + plotOutput("distPlot") + ) ) ) - ) - }) - - output$distPlot <- renderPlot({ - hist(rnorm(input$obs)) - }) - - observeEvent(input$update, { - updateUserMessages( - "message", - action = "update", - index = input$index, - content = list( - text = tagList( - appButton( - inputId = "reload", - label = "Click me!", - icon = icon("arrows-rotate"), - dashboardBadge(1, color = "orange") + }) + + output$distPlot <- renderPlot({ + hist(rnorm(input$obs)) + }) + + observeEvent(input$update, { + updateUserMessages( + "message", + action = "update", + index = input$index, + content = list( + text = tagList( + appButton( + inputId = "reload", + label = "Click me!", + icon = icon("arrows-rotate"), + dashboardBadge(1, color = "orange") + ) + ) ) - ) ) - ) - }) - - observeEvent(input$reload, { - showNotification("Yeah!", duration = 1, type = "default") - }) - } - ) + }) + + observeEvent(input$reload, { + showNotification("Yeah!", duration = 1, type = "default") + }) + } + ) } } \author{ diff --git a/man/userPost.Rd b/man/userPost.Rd index 410f4874..a9525961 100644 --- a/man/userPost.Rd +++ b/man/userPost.Rd @@ -55,50 +55,50 @@ userPostMedia(image, height = NULL, width = NULL) } \examples{ if (interactive()) { - library(shiny) - library(shinydashboard) - library(shinydashboardPlus) - - shinyApp( - ui = dashboardPage( - dashboardHeader(), - dashboardSidebar(), - dashboardBody( - box( - title = "Box with user comment", - status = "primary", - userPost( - id = 1, - image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", - author = "Jonathan Burke Jr.", - description = "Shared publicly - 7:30 PM today", - "Lorem ipsum represents a long-held tradition for designers, - typographers and the like. Some people hate it and argue for - its demise, but others ignore the hate as they create awesome - tools to help create filler text for everyone from bacon + library(shiny) + library(shinydashboard) + library(shinydashboardPlus) + + shinyApp( + ui = dashboardPage( + dashboardHeader(), + dashboardSidebar(), + dashboardBody( + box( + title = "Box with user comment", + status = "primary", + userPost( + id = 1, + image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", + author = "Jonathan Burke Jr.", + description = "Shared publicly - 7:30 PM today", + "Lorem ipsum represents a long-held tradition for designers, + typographers and the like. Some people hate it and argue for + its demise, but others ignore the hate as they create awesome + tools to help create filler text for everyone from bacon lovers to Charlie Sheen fans.", - collapsible = FALSE, - userPostTagItems( - userPostTagItem(dashboardLabel("item 1", status = "info")), - userPostTagItem(dashboardLabel("item 2", status = "danger"), side = "right") - ) + collapsible = FALSE, + userPostTagItems( + userPostTagItem(dashboardLabel("item 1", status = "info")), + userPostTagItem(dashboardLabel("item 2", status = "danger"), side = "right") + ) + ), + userPost( + id = 2, + image = "https://adminlte.io/themes/AdminLTE/dist/img/user6-128x128.jpg", + author = "Adam Jones", + userPostMedia(image = "https://adminlte.io/themes/AdminLTE/dist/img/photo2.png"), + userPostTagItems( + userPostTagItem(dashboardLabel("item 1", status = "success")), + userPostTagItem(dashboardLabel("item 2", status = "danger"), side = "right") + ) + ) + ) ), - userPost( - id = 2, - image = "https://adminlte.io/themes/AdminLTE/dist/img/user6-128x128.jpg", - author = "Adam Jones", - userPostMedia(image = "https://adminlte.io/themes/AdminLTE/dist/img/photo2.png"), - userPostTagItems( - userPostTagItem(dashboardLabel("item 1", status = "success")), - userPostTagItem(dashboardLabel("item 2", status = "danger"), side = "right") - ) - ) - ) + title = "userPost" ), - title = "userPost" - ), - server = function(input, output) { } - ) + server = function(input, output) { } + ) } } diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index 056ebe59..5bf96dfa 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -156,7 +156,7 @@ articles: news: releases: - - text: "shinydashboardPlus 2.0.4.9000" + - text: "shinydashboardPlus 2.0.4" - text: "shinydashboardPlus 2.0.3" - text: "shinydashboardPlus 2.0.2" - text: "shinydashboardPlus 2.0.1" diff --git a/srcjs/shinydashboardPlus-2.0.4.9000/accordions.js b/srcjs/shinydashboardPlus-2.0.4/accordions.js similarity index 100% rename from srcjs/shinydashboardPlus-2.0.4.9000/accordions.js rename to srcjs/shinydashboardPlus-2.0.4/accordions.js diff --git a/srcjs/shinydashboardPlus-2.0.4.9000/cards.js b/srcjs/shinydashboardPlus-2.0.4/cards.js similarity index 100% rename from srcjs/shinydashboardPlus-2.0.4.9000/cards.js rename to srcjs/shinydashboardPlus-2.0.4/cards.js diff --git a/srcjs/shinydashboardPlus-2.0.4.9000/controlbar.js b/srcjs/shinydashboardPlus-2.0.4/controlbar.js similarity index 100% rename from srcjs/shinydashboardPlus-2.0.4.9000/controlbar.js rename to srcjs/shinydashboardPlus-2.0.4/controlbar.js diff --git a/srcjs/shinydashboardPlus-2.0.4.9000/leftSidebar.js b/srcjs/shinydashboardPlus-2.0.4/leftSidebar.js similarity index 100% rename from srcjs/shinydashboardPlus-2.0.4.9000/leftSidebar.js rename to srcjs/shinydashboardPlus-2.0.4/leftSidebar.js diff --git a/srcjs/shinydashboardPlus-2.0.4.9000/miscellaneous.js b/srcjs/shinydashboardPlus-2.0.4/miscellaneous.js similarity index 100% rename from srcjs/shinydashboardPlus-2.0.4.9000/miscellaneous.js rename to srcjs/shinydashboardPlus-2.0.4/miscellaneous.js diff --git a/srcjs/shinydashboardPlus-2.0.4.9000/navs.js b/srcjs/shinydashboardPlus-2.0.4/navs.js similarity index 100% rename from srcjs/shinydashboardPlus-2.0.4.9000/navs.js rename to srcjs/shinydashboardPlus-2.0.4/navs.js diff --git a/srcjs/shinydashboardPlus-2.0.4.9000/output-bindings.js b/srcjs/shinydashboardPlus-2.0.4/output-bindings.js similarity index 100% rename from srcjs/shinydashboardPlus-2.0.4.9000/output-bindings.js rename to srcjs/shinydashboardPlus-2.0.4/output-bindings.js diff --git a/srcjs/shinydashboardPlus-2.0.4.9000/userMessages.js b/srcjs/shinydashboardPlus-2.0.4/userMessages.js similarity index 100% rename from srcjs/shinydashboardPlus-2.0.4.9000/userMessages.js rename to srcjs/shinydashboardPlus-2.0.4/userMessages.js diff --git a/tools/jstools.R b/tools/jstools.R index 32eaa62f..9b1805ae 100644 --- a/tools/jstools.R +++ b/tools/jstools.R @@ -10,7 +10,7 @@ new_srcjs_folder_name <- sprintf("srcjs/shinydashboardPlus-%s", pkg_version) if (old_version != pkg_version) { file.rename( - file.path("srcjs", tmp_old_version), + file.path("srcjs", tmp_old_version), new_srcjs_folder_name ) }