diff --git a/R/deps.R b/R/deps.R index caca461..fb41d38 100644 --- a/R/deps.R +++ b/R/deps.R @@ -22,6 +22,8 @@ addDeps <- function(x) { wizard_js <- "wizard.js" chart_js <- "chart.min.js" init_js <- "init.js" + progress_js <- "progress.min.js" + progress_css <- "progress.min.css" dashboardDeps <- list( # bootstrap 3 deps @@ -32,6 +34,14 @@ addDeps <- function(x) { script = bootstrap_js, stylesheet = bootstrap_css ), + # progress + htmltools::htmlDependency( + name = "progress", + version = "1.0.0", + src = c(file = system.file("progress-1.0.0", package = "gentelellaShiny")), + script = progress_js, + stylesheet = progress_css + ), # easypiechart js #htmltools::htmlDependency( # name = "easypiechart", diff --git a/inst/example/app.R b/inst/example/app.R index c3c82a4..19249e6 100644 --- a/inst/example/app.R +++ b/inst/example/app.R @@ -83,7 +83,7 @@ shiny::shinyApp( fluidRow( contactBox( width = 3, - head_title = "Digital Strategist", + head_title = "Contact Box", main_title = "Nicole Pearson", img = "https://image.flaticon.com/icons/svg/145/145859.svg", footer_left = "Some text", @@ -115,32 +115,32 @@ shiny::shinyApp( column( width = 6, align = "center", - h3("tabSetPanel")#, - # tabSetPanel( - # id = "tabset1", - # tabPanel( - # tabName = "Home", - # active = TRUE, - # "Raw denim you probably haven't heard of - # them jean shorts Austin. Nesciunt tofu stumptown - # aliqua, retro synth master cleanse. Mustache - # cliche tempor, williamsburg carles vegan helvetica. - # Reprehenderit butcher retro keffiyeh dreamcatcher synth. - # Cosby sweater eu banh mi, qui irure terr." - # ), - # tabPanel( - # tabName = "Profile", - # active = FALSE, - # sliderInput( - # "obs", - # "Number of observations:", - # min = 0, - # max = 1000, - # value = 500 - # ), - # plotOutput("distPlot") - # ) - # ) + h3("tabSetPanel"), + tabSetPanel( + id = "tabset1", + tabPanel( + tabName = "Home", + active = TRUE, + "Raw denim you probably haven't heard of + them jean shorts Austin. Nesciunt tofu stumptown + aliqua, retro synth master cleanse. Mustache + cliche tempor, williamsburg carles vegan helvetica. + Reprehenderit butcher retro keffiyeh dreamcatcher synth. + Cosby sweater eu banh mi, qui irure terr." + ), + tabPanel( + tabName = "Profile", + active = FALSE, + sliderInput( + "obs", + "Number of observations:", + min = 0, + max = 1000, + value = 500 + ), + plotOutput("distPlot") + ) + ) ), column( width = 6, @@ -177,9 +177,8 @@ shiny::shinyApp( tabName = "charts", box( title = "pieChart", - "If you've decided to go in development mode and - tweak all of this a bit, there are few things - you should do.", + "gentelellaShiny allows you to use the easypiechart library. + See https://github.com/rendro/easy-pie-chart", pieChart(id = "chart1", value = 10), pieChart( id = "chart2", @@ -318,6 +317,25 @@ shiny::shinyApp( br(), br(), br(), label(name = "Mark", position = "pull-right"), label(name = "Isabella", status = "danger", position = "pull-left") + ), + box( + width = 6, + title = "Progress Bars", + column( + width = 6, + progressBar( + 20, + side = "left", + status = "primary", + striped = FALSE + ), + progressBar( + 70, + side = "right", + status = "danger", + striped = TRUE + ) + ) ) ) ) diff --git a/inst/progress-1.0.0/progress.min.css b/inst/progress-1.0.0/progress.min.css new file mode 100644 index 0000000..5935231 --- /dev/null +++ b/inst/progress-1.0.0/progress.min.css @@ -0,0 +1,166 @@ +/*! bootstrap-progressbar v0.9.0 | Copyright (c) 2012-2015 Stephan Groß | MIT license | http://www.minddust.com */ + @-webkit-keyframes progress-bar-stripes { + from { + background-position: 40px 0 + } + + to { + background-position: 0 0 + } + } + +@keyframes progress-bar-stripes { + from { + background-position: 40px 0 + } + + to { + background-position: 0 0 + } +} + +.progress { + overflow: hidden; + height: 20px; + margin-bottom: 20px; + background-color: #f5f5f5; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1) +} + +.progress-bar { + float: left; + width: 0; + height: 100%; + font-size: 12px; + line-height: 20px; + color: #fff; + text-align: center; + background-color: #337ab7; + -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15); + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15); + -webkit-transition: width .6s ease; + -o-transition: width .6s ease; + transition: width .6s ease +} + +.progress-bar-striped, .progress-striped .progress-bar { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-size: 40px 40px +} + +.progress-bar.active, .progress.active .progress-bar { + -webkit-animation: progress-bar-stripes 2s linear infinite; + -o-animation: progress-bar-stripes 2s linear infinite; + animation: progress-bar-stripes 2s linear infinite +} + +.progress-bar-success { + background-color: #5cb85c +} + +.progress-striped .progress-bar-success { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent) +} + +.progress-bar-info { + background-color: #5bc0de +} + +.progress-striped .progress-bar-info { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent) +} + +.progress-bar-warning { + background-color: #f0ad4e +} + +.progress-striped .progress-bar-warning { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent) +} + +.progress-bar-danger { + background-color: #d9534f +} + +.progress-striped .progress-bar-danger { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent) +} + +.progress { + position: relative +} + +.progress .progress-bar { + position: absolute; + overflow: hidden; + line-height: 20px +} + +.progress .progressbar-back-text { + position: absolute; + width: 100%; + height: 100%; + font-size: 12px; + line-height: 20px; + text-align: center +} + +.progress .progressbar-front-text { + display: block; + width: 100%; + font-size: 12px; + line-height: 20px; + text-align: center +} + +.progress.right .progress-bar { + right: 0 +} + +.progress.right .progressbar-front-text { + position: absolute; + right: 0 +} + +.progress.vertical { + width: 20px; + height: 100%; + float: left; + margin-right: 20px +} + +.progress.vertical.bottom { + position: relative +} + +.progress.vertical.bottom .progressbar-front-text { + position: absolute; + bottom: 0 +} + +.progress.vertical .progress-bar { + width: 100%; + height: 0; + -webkit-transition: height .6s ease; + -o-transition: height .6s ease; + transition: height .6s ease +} + +.progress.vertical.bottom .progress-bar { + position: absolute; + bottom: 0 +} + + diff --git a/inst/progress-1.0.0/progress.min.js b/inst/progress-1.0.0/progress.min.js new file mode 100644 index 0000000..4714540 --- /dev/null +++ b/inst/progress-1.0.0/progress.min.js @@ -0,0 +1,86 @@ +/*! bootstrap-progressbar v0.9.0 | Copyright (c) 2012-2015 Stephan Groß | MIT license | http://www.minddust.com */ + !function(t) { + "use strict"; + var e = function(n, s) { + this.$element = t(n), this.options = t.extend({}, e.defaults, s) + }; + e.defaults = { + transition_delay: 300, + refresh_speed: 50, + display_text: "none", + use_percentage: !0, + percent_format: function(t) { + return t + "%" + }, + amount_format: function(t, e) { + return t + " / " + e + }, + update: t.noop, + done: t.noop, + fail: t.noop + }, e.prototype.transition = function() { + var n = this.$element, + s = n.parent(), + a = this.$back_text, + r = this.$front_text, + i = this.options, + o = parseInt(n.attr("data-transitiongoal")), + h = parseInt(n.attr("aria-valuemin")) || 0, + d = parseInt(n.attr("aria-valuemax")) || 100, + f = s.hasClass("vertical"), + p = i.update && "function" == typeof i.update ? i.update : e.defaults.update, + u = i.done && "function" == typeof i.done ? i.done : e.defaults.done, + c = i.fail && "function" == typeof i.fail ? i.fail : e.defaults.fail; + if (isNaN(o)) + return void c("data-transitiongoal not set"); + var l = Math.round(100 * (o - h) / (d - h)); + if ("center" === i.display_text && !a && !r) { + this.$back_text = a = t("").addClass("progressbar-back-text").prependTo(s), this.$front_text = r = t("").addClass("progressbar-front-text").prependTo(n); + var g; + f ? (g = s.css("height"), a.css({ + height: g, + "line-height": g + }), r.css({ + height: g, + "line-height": g + }), t(window).resize(function() { + g = s.css("height"), a.css({ + height: g, + "line-height": g + }), r.css({ + height: g, + "line-height": g + }) + })) : (g = s.css("width"), r.css({ + width: g + }), t(window).resize(function() { + g = s.css("width"), r.css({ + width: g + }) + })) + } + setTimeout(function() { + var t, + e, + c, + g, + _; + f ? n.css("height", l + "%") : n.css("width", l + "%"); + var x = setInterval(function() { + f ? (c = n.height(), g = s.height()) : (c = n.width(), g = s.width()), t = Math.round(100 * c / g), e = Math.round(h + c / g * (d - h)), t >= l && (t = l, e = o, u(n), clearInterval(x)), "none" !== i.display_text && (_ = i.use_percentage ? i.percent_format(t) : i.amount_format(e, d, h), "fill" === i.display_text ? n.text(_) : "center" === i.display_text && (a.text(_), r.text(_))), n.attr("aria-valuenow", e), p(t, n) + }, i.refresh_speed) + }, i.transition_delay) + }; + var n = t.fn.progressbar; + t.fn.progressbar = function(n) { + return this.each(function() { + var s = t(this), + a = s.data("bs.progressbar"), + r = "object" == typeof n && n; + a && r && t.extend(a.options, r), a || s.data("bs.progressbar", a = new e(this, r)), a.transition() + }) + }, t.fn.progressbar.Constructor = e, t.fn.progressbar.noConflict = function() { + return t.fn.progressbar = n, this + } + }(window.jQuery); +