Skip to content

Commit 18c0572

Browse files
authored
Merge pull request #164 from Appsilon/develop
Version 0.3.0
2 parents 345d81d + 5b1d006 commit 18c0572

File tree

110 files changed

+110518
-937
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+110518
-937
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212
^readme_assets$
1313
^docs$
1414
^examples$
15+
^index.html$
16+
^README.md$

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/inst/www/shared/semantic/semantic.js -merge -diff
2+
/inst/www/shared/semantic/semantic.css -merge -diff
3+
*.min.js -merge -diff
4+
*.min.css -merge -diff

.github/workflows/main.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
on: push
2+
3+
name: R-CMD-check
4+
5+
jobs:
6+
R-CMD-check:
7+
runs-on: ${{ matrix.config.os }}
8+
9+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
10+
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
config:
15+
- { os: windows-latest, r: '3.6'}
16+
- { os: macOS-latest, r: '3.6'}
17+
- { os: ubuntu-18.04, r: '3.4', cran: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"}
18+
- { os: ubuntu-18.04, r: '3.5', cran: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"}
19+
- { os: ubuntu-18.04, r: '3.6', cran: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"}
20+
21+
env:
22+
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
23+
CRAN: ${{ matrix.config.cran }}
24+
25+
steps:
26+
- uses: actions/checkout@v1
27+
28+
- uses: r-lib/actions/setup-r@master
29+
with:
30+
r-version: ${{ matrix.config.r }}
31+
32+
- uses: r-lib/actions/setup-pandoc@master
33+
34+
- name: Query dependencies
35+
run: Rscript -e "install.packages('remotes')" -e "saveRDS(remotes::dev_package_deps(dependencies = TRUE), 'depends.Rds', version = 2)"
36+
37+
- name: Cache R packages
38+
if: runner.os != 'Windows'
39+
uses: actions/cache@v1
40+
with:
41+
path: ${{ env.R_LIBS_USER }}
42+
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }}
43+
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-
44+
45+
- name: Install system dependencies
46+
if: runner.os == 'Linux'
47+
env:
48+
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
49+
run: |
50+
Rscript -e "remotes::install_github('r-hub/sysreqs')"
51+
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
52+
sudo -s eval "$sysreqs"
53+
54+
- name: Install dependencies
55+
run: Rscript -e "library(remotes)" -e "update(readRDS('depends.Rds'))" -e "remotes::install_cran('rcmdcheck')"
56+
57+
- name: Check
58+
run: Rscript -e "rcmdcheck::rcmdcheck(args = c('--no-manual', '--as-cran'), error_on = 'error', check_dir = 'check')"
59+
60+
- name: Upload check results
61+
if: failure()
62+
uses: actions/upload-artifact@master
63+
with:
64+
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
65+
path: check
66+
67+
- name: Test coverage
68+
if: matrix.config.os == 'macOS-latest' && matrix.config.r == '3.6'
69+
run: |
70+
Rscript -e 'covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")'

.lintr

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## [0.3.0]
5+
6+
- Migrate to fomantic 2.8.3
7+
8+
- checkbox_ui was completely removed. Use simple_checkbox instead.
9+
10+
- slider_input was removed
11+
12+
- shiny.custom.semantic.cdn options introduced to get dependencies from custom location.
13+
14+
- added semantic modal
15+
16+
- updated slider
17+
18+
- added calendar
19+
20+
## [0.2.4]
21+
### Added
22+
- shiny.custom.semantic.cdn options introduced to get dependencies from custom location.
423

524
## [0.1.2]
625
### Added

DESCRIPTION

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
Package: shiny.semantic
22
Type: Package
33
Title: Semantic UI Support for Shiny
4-
Version: 0.2.4
5-
Authors@R: c(person("Filip", "Stachura", email = "[email protected]",
6-
role = "aut"),
7-
person("Dominik", "Krzeminski", email = "[email protected]",
8-
role = "cre"))
4+
Version: 0.3.0
5+
Authors@R: c(person("Filip", "Stachura", email = "[email protected]", role = "aut"),
6+
person("Krystian", "Igras", email = "[email protected]", role = "aut"),
7+
person("Adam", "Forys", email = "[email protected]", role = "aut"),
8+
person("Dominik", "Krzeminski", email = "[email protected]", role = "cre"),
9+
person(family = "Appsilon Sp. z o.o.", role = c("cph")))
910
Description: Creating a great user interface for your Shiny apps
1011
can be a hassle, especially if you want to work purely in R
1112
and don't want to use, for instance HTML templates. This
@@ -17,7 +18,6 @@ Encoding: UTF-8
1718
LazyData: TRUE
1819
License: MIT + file LICENSE
1920
Imports:
20-
utils,
2121
shiny (>= 0.12.1),
2222
htmltools (>= 0.2.6),
2323
htmlwidgets (>= 0.8),
@@ -30,4 +30,4 @@ Suggests:
3030
testthat,
3131
lintr,
3232
covr
33-
RoxygenNote: 6.1.1
33+
RoxygenNote: 7.0.2.9000

NAMESPACE

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export(SUPPORTED_THEMES)
44
export(check_proper_color)
55
export(check_semantic_theme)
66
export(checkbox_positions)
7-
export(checkbox_types)
87
export(create_modal)
98
export(date_input)
109
export(dropdown)
@@ -15,6 +14,7 @@ export(menu_header)
1514
export(menu_item)
1615
export(modal)
1716
export(multiple_checkbox)
17+
export(multiple_radio)
1818
export(parse_val)
1919
export(register_search)
2020
export(remove_modal)
@@ -27,8 +27,9 @@ export(shiny_input)
2727
export(shiny_text_input)
2828
export(show_modal)
2929
export(simple_checkbox)
30-
export(slider_input)
3130
export(tabset)
31+
export(uibutton)
32+
export(uicalendar)
3233
export(uicard)
3334
export(uicards)
3435
export(uicheckbox)
@@ -38,12 +39,21 @@ export(uifields)
3839
export(uiform)
3940
export(uiheader)
4041
export(uiicon)
42+
export(uiinput)
4143
export(uilabel)
4244
export(uilist)
4345
export(uimenu)
4446
export(uimessage)
47+
export(uinumericinput)
48+
export(uirange)
4549
export(uirender)
4650
export(uisegment)
51+
export(uislider)
52+
export(uitextinput)
53+
export(update_calendar)
54+
export(update_dropdown)
55+
export(update_range)
56+
export(update_slider)
4757
import(htmlwidgets)
4858
import(magrittr)
4959
import(shiny)

R/button.R

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#' Create Semantic UI Button
2+
#'
3+
#' @param name The \code{input} slot that will be used to access the value.
4+
#' @param label The contents of the button or link
5+
#' @param icon An optional \code{\link{uiicon}()} to appear on the button.
6+
#' @param type An optional attribute to be added to the button's class.
7+
#' @param ... Named attributes to be applied to the button
8+
#'
9+
#' @examples
10+
#' uibutton("simple_button", "Press Me!")
11+
#'
12+
#' @export
13+
uibutton <- function(name, label, icon = NULL, type = NULL, ...) {
14+
tags$button(id = name, class = paste("ui", type, "button"), label, icon, ...)
15+
}

R/calendar.R

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#' Create Semantic UI Calendar
2+
#'
3+
#' This creates a default calendar input using Semantic UI. The input is available
4+
#' under \code{input[[name]]}.
5+
#'
6+
#' @param name Input name. Reactive value is available under \code{input[[name]]}.
7+
#' @param value Initial value of the numeric input.
8+
#' @param placeholder Text visible in the input when nothing is inputted.
9+
#' @param type Select from \code{'year'}, \code{'month'}, \code{'date'} and \code{'time'}
10+
#' @param min Minimum allowed value.
11+
#' @param max Maximum allowed value.
12+
#'
13+
#' @examples
14+
#' # Basic calendar
15+
#' if (interactive()) {
16+
#'
17+
#' library(shiny)
18+
#' library(shiny.semantic)
19+
#'
20+
#' ui <- shinyUI(
21+
#' semanticPage(
22+
#' title = "Calendar example",
23+
#' uicalendar("date"),
24+
#' p("Selected date:"),
25+
#' textOutput("selected_date")
26+
#' )
27+
#' )
28+
#'
29+
#' server <- shinyServer(function(input, output, session) {
30+
#' output$selected_date <- renderText(
31+
#' as.character(input$date)
32+
#' )
33+
#' })
34+
#'
35+
#' shinyApp(ui = ui, server = server)
36+
#' }
37+
#'
38+
#' \dontrun{
39+
#' # Calendar with max and min
40+
#' uicalendar(
41+
#' name = "date_finish",
42+
#' placeholder = "Select End Date",
43+
#' min = "2019-01-01",
44+
#' max = "2020-01-01"
45+
#' )
46+
#'
47+
#' # Selecting month
48+
#' uicalendar(
49+
#' name = "month",
50+
#' type = "month"
51+
#' )
52+
#' }
53+
#' @rdname uicalendar
54+
#' @export
55+
uicalendar <- function(name, value = NULL, placeholder = NULL, type = "date", min = NA, max = NA) {
56+
cal_widget <-
57+
div(
58+
id = name, class = "ui calendar ss-input-date", `data-type` = type, `data-date` = value,
59+
div(
60+
class = "ui input left icon",
61+
tags$i(class = "calendar icon"),
62+
tags$input(type = "text", placeholder = placeholder)
63+
)
64+
)
65+
66+
if (!is.na(min)) cal_widget$attribs[["data-min-date"]] <- min
67+
if (!is.na(max)) cal_widget$attribs[["data-max-date"]] <- max
68+
69+
cal_widget
70+
}
71+
72+
#' Update UI calendar
73+
#'
74+
#' This function updates the date on a calendar
75+
#'
76+
#' @param session The \code{session} object passed to function given to
77+
#' \code{shinyServer}.
78+
#' @param id ID of the calendar that will be updated
79+
#' @param value The date to be set, default NULL
80+
#' @param min Minimum date that will be possible to set, default NULL
81+
#' @param max Maximum date that will be possible to set, default NULL
82+
#'
83+
#' @rdname uicalendar
84+
#'
85+
#' @export
86+
update_calendar <- function(session, id, value = NULL, min = NULL, max = NULL) {
87+
message <- list(value = value, min = min, max = max)
88+
session$sendInputMessage(id, message = message)
89+
}

0 commit comments

Comments
 (0)