Browse Source

Initial write of progress module

pull/1129/head
jlukic 10 years ago
parent
commit
07ea079fb5
18 changed files with 1004 additions and 225 deletions
  1. 69
      server/documents/elements/progress.html.eco
  2. 207
      server/documents/index.html.eco
  3. 19
      server/files/javascript/semantic.js
  4. 8
      server/files/stylesheets/semantic.css
  5. 69
      server/layouts/default.html.eco
  6. 1
      src/definitions/collections/table.less
  7. 5
      src/definitions/elements/list.less
  8. 1
      src/definitions/elements/segment.less
  9. 453
      src/definitions/modules/progress.js
  10. 267
      src/definitions/modules/progress.less
  11. 3
      src/themes/_site/modules/progress.overrides
  12. 3
      src/themes/_site/modules/progress.variables
  13. 1
      src/themes/packages/default/elements/segment.variables
  14. 12
      src/themes/packages/default/globals/site.variables
  15. 3
      src/themes/packages/default/modules/progress.overrides
  16. 76
      src/themes/packages/default/modules/progress.variables
  17. 29
      src/themes/packages/striped/modules/progress.overrides
  18. 3
      src/themes/packages/striped/modules/progress.variables

69
server/documents/elements/progress.html.eco

@ -3,15 +3,15 @@ layout : 'default'
css : 'progress'
element : 'progress'
elementType : 'element'
elementType : 'module'
title : 'Progress'
description : 'A progress bar shows the progression of a task'
type : 'UI Element'
type : 'UI Module'
themes : ['Default']
themes : ['Default', 'Striped']
---
<link rel="stylesheet/less" type="text/css" href="/build/less/definitions/elements/progress.less" />
<link rel="stylesheet/less" type="text/css" href="/build/less/definitions/modules/progress.less" />
<%- @partial('header') %>
@ -22,18 +22,55 @@ themes : ['Default']
<div class="example">
<h4 class="ui header">Progress Bar</h4>
<p>A standard progress bar</p>
<div class="ui progress">
<div class="bar">
<div class="progress"></div>
</div>
<div class="label">Uploading Files</div>
</div>
</div>
<h2 class="ui dividing header">Content</h2>
<div class="example">
<h4 class="ui header">Bar</h4>
<p>A progress element can contain a bar to indicate the current level of progress</p>
<div class="ui progress">
<div class="bar"></div>
</div>
</div>
<div class="example">
<h4 class="ui header">Current Progress</h4>
<p>A progress bar can contain a reading of the current progress</p>
<div class="ui progress">
<div class="bar">
<div class="progress">22%</div>
</div>
</div>
</div>
<div class="example">
<h4 class="ui header">Label</h4>
<p>A progress element can contain a label</p>
<div class="ui progress">
<div class="bar">
<div class="progress">22%</div>
</div>
<div class="label">Uploading Files</div>
</div>
</div>
<h2 class="ui dividing header">States</h2>
<div class="example">
<h4 class="ui header">Active</h4>
<p>A progress bar can show activity</p>
<div class="ui active progress">
<div class="bar"></div>
<div class="bar">
<div class="progress">22%</div>
</div>
<div class="label">Uploading Files</div>
</div>
</div>
@ -42,7 +79,7 @@ themes : ['Default']
<h4 class="ui header">Successful</h4>
<p>A progress bar can show success</p>
<div class="ui successful progress">
<div class="bar" style="width:100%"></div>
<div class="bar"></div>
</div>
</div>
@ -50,7 +87,7 @@ themes : ['Default']
<h4 class="ui header">Warning</h4>
<p>A progress bar can show a warning state</p>
<div class="ui warning progress">
<div class="bar" style="width:100%"></div>
<div class="bar"></div>
</div>
</div>
@ -58,7 +95,7 @@ themes : ['Default']
<h4 class="ui header">Failed</h4>
<p>A progress bar can show failure</p>
<div class="ui failed progress">
<div class="bar" style="width:100%"></div>
<div class="bar"></div>
</div>
</div>
@ -66,7 +103,7 @@ themes : ['Default']
<h4 class="ui header">Disabled</h4>
<p>A progress bar can be disabled</p>
<div class="ui disabled progress">
<div class="bar" style="width:100%"></div>
<div class="bar"></div>
</div>
</div>
@ -91,27 +128,33 @@ themes : ['Default']
<div class="example">
<h4 class="ui header">Color</h4>
<p>Can have different colors:</p>
<div class="ui blue progress">
<div class="ui black progress">
<div class="bar"></div>
</div>
<div class="ui black progress">
<div class="ui blue progress">
<div class="bar"></div>
</div>
<div class="ui green progress">
<div class="bar"></div>
</div>
<div class="ui red progress">
<div class="ui orange progress">
<div class="bar"></div>
</div>
<div class="ui blue progress">
<div class="ui pink progress">
<div class="bar"></div>
</div>
<div class="ui purple progress">
<div class="bar"></div>
</div>
<div class="ui red progress">
<div class="bar"></div>
</div>
<div class="ui teal progress">
<div class="bar"></div>
</div>
<div class="ui yellow progress">
<div class="bar"></div>
</div>
</div>
<div class="example">

207
server/documents/index.html.eco

@ -48,8 +48,8 @@ type : 'Semantic'
<i class="download icon"></i> Customize &amp; Download
</a>
</div>
<!--div class="inverted advertisement">
<% unless 'development' in @getEnvironments(): %>
<div class="inverted advertisement">
<% unless 'developments' in @getEnvironments(): %>
<div id="carbonads-container">
<div class="carbonad">
<div id="azcarbon"></div>
@ -57,186 +57,40 @@ type : 'Semantic'
</div>
</div>
<% end %>
</div !-->
</div>
</div>
</div>
<div class="stripe">
<div class="ui page grid">
<div class="ui column">
<h2 class="ui center aligned icon header">
<i class="docs book icon"></i>
<div class="content">
Lose the Hieroglyphics
<div class="sub header">Semantic is structured around natural language conventions to make development more intuitive.
</div>
</div>
</h2>
<div class="ui message">
Semantic is tag agnostic meaning you can use <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/HTML5_element_list" target="_blank">any html tags</a> with UI elements.
</div>
<div class="ui stackable two column fitted grid">
<div class="column">
<a class="ui teal label" href="/collections/grid.html">Semantic</a>
<div class="code" data-type="html">
<main class="ui three column grid">
<aside class="column">1</aside>
<section class="column">2</section>
<section class="column">3</section>
</main>
</div>
</div>
<div class="column">
<div class="ui black label">Bootstrap</div>
<div class="code" data-type="html">
<div class="row">
<div class="col-lg-4">1</div>
<div class="col-lg-4">2</div>
<div class="col-lg-4">3</div>
</div>
</div>
</div>
<div class="column">
<a class="ui teal label" href="/collections/menu.html">Semantic</a>
<div class="code" data-type="html">
<nav class="ui menu">
<h3 class="header item">Title</h3>
<a class="active item">Home</a>
<a class="item">Link</a>
<a class="item">Link</a>
<span class="right floated text item">
Signed in as <a href="#">user</a>
</span>
</nav>
</div>
</div>
<div class="column">
<div class="ui black label">Bootstrap</div>
<div class="code" data-type="html">
<div class="navbar">
<a class="navbar-brand" href="#">Title</a>
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<p class="navbar-text pull-right">Signed in as <a href="#" class="navbar-link">User</a></p>
</ul>
</div>
</div>
</div>
<div class="column">
<a class="ui teal label" href="/elements/button.html">Semantic</a>
<div class="code" data-type="html">
<button class="large ui button">
<i class="heart icon"></i>
Like it
</button>
</div>
</div>
<div class="column">
<div class="ui black label">Bootstrap</div>
<div class="code" data-type="html">
<button type="button" class="btn btn-primary btn-lg">
<span class="glyphicon glyphicon-heart"></span>
Like
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="dark stripe">
<div class="ui page grid">
<!-- <div class="stripe" >
<div class="ui three column center aligned page grid">
<div class="column">
<h2 class="ui huge inverted center aligned icon header">
<i class="inverted teal chat outline icon"></i>
<div class="content">Have a conversation with your components<div class="sub header">Semantic gives you a variety of UI components with real-time debug output, letting your code tell you what its doing.</div>
</div>
</h2>
<div class="ui inverted horizontal section divider">
<i class="circular heart icon"></i>
</div>
<div class="ui stackable fitted grid" data-demo="true">
<div class="row">
<div class="ten wide column">
<div class="ui inverted teal header">Open up your web console.</div>
<p>Semantic provides tracing for javascript behavior so your components can tell you what they're doing as they do it.</p>
<div class="code" data-type="javascript" data-demo="true">
$('.kitten.image')
.transition('scale in')
.transition('tada', '800ms')
;
</div>
<a href="module.html" class="ui teal inverted button">Learn about modules <i class="right arrow icon"></i></a>
</div>
<div class="five wide right floated column">
<img src="/images/cat.png" class="ui fluid kitten image">
</div>
</div>
<div class="ui statistic">
<div class="value">3362</div>
<div class="label">CSS Variables</div>
</div>
</div>
</div>
</div>
<div class="stripe" style="display:none">
<h2 class="ui center aligned icon header">
<i class="circular emphasized lab icon"></i>
<div class="content">
Alter Designs Effortlessly
<div class="sub header">Redesign without lifting a finger
<div class="column">
<div class="ui statistic">
<div class="value">51</div>
<div class="label">UI Components</div>
</div>
</div>
</h2>
<div class="ui page grid">
<div class="column">
<h3 class="ui header">Let's create some tabs</h3>
<div class="code" data-preview="true" data-type="html">
<div class="ui menu">
<div class="header item">Site.com</div>
<a class="item">Browse</a>
<a class="active item">Search</a>
<a class="item">Help</a>
</div>
<div class="ui segment">
<p>Tab content</p>
</div>
</div>
<div class="ui divider"></div>
<h3 class="ui header">Hmm maybe it should point to the content below it</h3>
<div class="code" data-preview="true" data-type="html">
<div class="ui pointing menu">
<div class="header item">Site.com</div>
<a class="item">Home</a>
<a class="active item">About</a>
<a class="item">Contact</a>
</div>
<div class="ui segment">
<p>Tab content</p>
</div>
<div class="column">
<div class="ui statistic">
<div class="value">1</div>
<div class="label">Coding Style</div>
</div>
</div>
</div>
</div>
</div>
<div class="final stripe" >
</div> -->
<div class="final stripe">
<div class="ui page grid">
<div class="column">
<h2 class="ui center aligned icon header">
<i class="circular emphasized users icon"></i>
<div class="content">Growing Every Day
<div class="sub header">New UI components are written every day. Check back soon to see more.</div>
</div>
</h2>
<div class="ui horizontal divider">
<i class="circular heart icon"></i>
</div>
<div class="ui stackable grid" data-demo="true">
<div class="four column center aligned row">
<div class="column">
<div class="ui stacked segment">
<div class="ui statistic">
<div class="value"><%= uiElements.length %></div>
<div class="label">UI Elements</div>
</div>
<div class="ui piled segment">
<h4 class="ui header">Elements</h4>
<div class="ui divided selection list">
<% for element in uiElements: %>
<a class="item" href="<%= element.url %>"><%= element.title %></a>
@ -245,11 +99,8 @@ type : 'Semantic'
</div>
</div>
<div class="column">
<div class="ui stacked segment">
<div class="ui statistic">
<div class="value"><%= uiCollections.length %></div>
<div class="label">UI Collections</div>
</div>
<div class="ui piled segment">
<h4 class="ui header">Collections</h4>
<div class="ui divided selection list">
<% for element in uiCollections: %>
<a class="item" href="<%= element.url %>"><%= element.title %></a>
@ -258,11 +109,8 @@ type : 'Semantic'
</div>
</div>
<div class="column">
<div class="ui stacked segment">
<div class="ui statistic">
<div class="value"><%= uiViews.length %></div>
<div class="label">UI Views</div>
</div>
<div class="ui piled segment">
<h4 class="ui header">Views</h4>
<div class="ui divided selection list">
<% for element in uiViews: %>
<a class="item" href="<%= element.url %>"><%= element.title %></a>
@ -271,11 +119,8 @@ type : 'Semantic'
</div>
</div>
<div class="column">
<div class="ui stacked segment">
<div class="ui statistic">
<div class="value"><%= uiModules.length %></div>
<div class="label">UI Modules</div>
</div>
<div class="ui piled segment">
<h4 class="ui header">Modules</h4>
<div class="ui divided selection list">
<% for element in uiModules: %>
<a class="item" href="<%= element.url %>"><%= element.title %></a>

19
server/files/javascript/semantic.js

@ -101,6 +101,7 @@ semantic.ready = function() {
.visibility({
once: false,
offset: 70,
onTopVisible: handler.activate.accordion,
onTopPassed: handler.activate.section,
onBottomPassed: handler.activate.section,
onTopPassedReverse: handler.activate.previous
@ -148,6 +149,17 @@ semantic.ready = function() {
;
}
},
accordion: function() {
var
$section = $(this),
index = $sectionHeaders.index($section),
$followSection = $followMenu.children('.item'),
$activeSection = $followSection.eq(index)
;
$followMenu
.accordion('open', index)
;
},
section: function() {
var
$section = $(this),
@ -161,9 +173,6 @@ semantic.ready = function() {
$activeSection
.addClass('active')
;
$followMenu
.accordion('open', index)
;
},
example: function() {
var
@ -841,6 +850,10 @@ semantic.ready = function() {
;
$menu
.sidebar({
transition : 'uncover',
mobileTransition : 'scale down'
})
.sidebar('attach events', '.launch.button, .view-ui.button, .launch.item')
.sidebar('attach events', $hideMenu, 'hide')
;

8
server/files/stylesheets/semantic.css

@ -159,6 +159,11 @@ a:hover {
-moz-border-radius: 0px;
border-radius: 0px;
}
#example #menu .item .circular.label {
position: absolute;
top: 0.75rem;
right: 1
}
#example #menu .inverted.header {
color: rgba(255, 255, 255, 0.8);
margin-bottom: 0.5em;
@ -1074,9 +1079,6 @@ body.card .even.example .card .description {
Progress
---------------*/
body.progress .ui.progress .bar {
width: 35%;
}
body.progress.animated .ui.progress .bar {
-webkit-animation: finish 10s ease-in-out infinite;

69
server/layouts/default.html.eco

@ -1,20 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<% uiIntroduction = @getCollection("documents").findAll({type: $in: ['UI Introduction']},[{title: 1}]).toJSON() %>
<% uiProject = @getCollection("documents").findAll({type: $in: ['Semantic Project']},[{title: 1}]).toJSON() %>
<% uiGuide = @getCollection("documents").findAll({type: $in: ['UI Guide']},[{title: 1}]).toJSON() %>
<% uiGlobals = @getCollection("documents").findAll({type: $in: ['UI Global']},[{title: 1}]).toJSON() %>
<% uiElements = @getCollection("documents").findAll({type: $in: ['UI Element']},[{title: 1}]).toJSON() %>
<% uiCollections = @getCollection("documents").findAll({type: $in: ['UI Collection']},[{title: 1}]).toJSON() %>
<% uiViews = @getCollection("documents").findAll({type: $in: ['UI View']},[{title: 1}]).toJSON() %>
<% uiModules = @getCollection("documents").findAll({type: $in: ['UI Module']},[{title: 1}]).toJSON() %>
<% uiBehavior = @getCollection("documents").findAll({type: $in: ['UI Behavior']},[{title: 1}]).toJSON() %>
<% uiSpecification = @getCollection("documents").findAll({type: $in: ['UI Specification']},[{title: 1}]).toJSON() %>
<% currentCollection = @getCollection("documents").findAll({type: $in: [@document.type]},[{title: 1}]).toJSON() %>
<% pageCount = @pageCount(currentCollection) %>
<% pageNumber = @getPage(currentCollection, @document.id) %>
<% pageCollection = @getPageCollection(currentCollection, @document.id) %>
<% uiIntroduction = @getCollection("documents").findAll({type: $in: ['UI Introduction']},[{title: 1}]).toJSON() %>
<% uiProject = @getCollection("documents").findAll({type: $in: ['Semantic Project']},[{title: 1}]).toJSON() %>
<% uiGuide = @getCollection("documents").findAll({type: $in: ['UI Guide']},[{title: 1}]).toJSON() %>
<% uiGlobals = @getCollection("documents").findAll({type: $in: ['UI Global']},[{title: 1}]).toJSON() %>
<% uiElements = @getCollection("documents").findAll({type: $in: ['UI Element']},[{title: 1}]).toJSON() %>
<% uiCollections = @getCollection("documents").findAll({type: $in: ['UI Collection']},[{title: 1}]).toJSON() %>
<% uiViews = @getCollection("documents").findAll({type: $in: ['UI View']},[{title: 1}]).toJSON() %>
<% uiModules = @getCollection("documents").findAll({type: $in: ['UI Module']},[{title: 1}]).toJSON() %>
<% uiBehavior = @getCollection("documents").findAll({type: $in: ['UI Behavior']},[{title: 1}]).toJSON() %>
<% uiSpecification = @getCollection("documents").findAll({type: $in: ['UI Specification']},[{title: 1}]).toJSON() %>
<% currentCollection = @getCollection("documents").findAll({type: $in: [@document.type]},[{title: 1}]).toJSON() %>
<% pageCount = @pageCount(currentCollection) %>
<% pageNumber = @getPage(currentCollection, @document.id) %>
<% pageCollection = @getPageCollection(currentCollection, @document.id) %>
<!-- Standard Meta -->
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
@ -46,7 +48,6 @@
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/elements/loader.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/elements/rail.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/elements/reveal.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/elements/progress.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/elements/segment.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/elements/step.css">
@ -67,6 +68,7 @@
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/accordion.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/dropdown.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/popup.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/progress.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/rating.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/sidebar.css">
<link rel="stylesheet" type="text/css" class="ui" href="/build/uncompressed/definitions/modules/shape.css">
@ -130,6 +132,7 @@
<script src="/build/uncompressed/definitions/modules/dropdown.js"></script>
<script src="/build/uncompressed/definitions/modules/modal.js"></script>
<script src="/build/uncompressed/definitions/modules/popup.js"></script>
<script src="/build/uncompressed/definitions/modules/progress.js"></script>
<script src="/build/uncompressed/definitions/modules/rating.js"></script>
<script src="/build/uncompressed/definitions/modules/shape.js"></script>
<script src="/build/uncompressed/definitions/modules/sidebar.js"></script>
@ -179,7 +182,11 @@
<div class="ui small <%= if @document.elementType is 'global' then 'active ' %> inverted header">Globals</div>
<div class="menu">
<% for element in uiGlobals: %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %></a>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %>
</a>
<% if element.status? is 'Undocumented': %>
<div class="ui mini empty yellow ui label"></div>
<% end %>
<% end %>
</div>
</div>
@ -187,7 +194,11 @@
<div class="ui small <%= if @document.elementType is 'element' then 'active ' %> inverted header">Elements</div>
<div class="menu">
<% for element in uiElements: %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %></a>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %>
</a>
<% if element.status? is 'Undocumented': %>
<div class="ui mini empty yellow ui label"></div>
<% end %>
<% end %>
</div>
</div>
@ -195,7 +206,11 @@
<div class="ui small <%= if @document.elementType is 'collection' then 'active ' %> inverted header">Collections</div>
<div class="menu">
<% for element in uiCollections: %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %></a>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %>
</a>
<% if element.status? is 'Undocumented': %>
<div class="ui mini empty yellow ui label"></div>
<% end %>
<% end %>
</div>
</div>
@ -203,7 +218,11 @@
<div class="ui small <%= if @document.elementType is 'view' then 'active ' %> inverted header">Views</div>
<div class="menu">
<% for element in uiViews: %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %></a>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %>
</a>
<% if element.status? is 'Undocumented': %>
<div class="ui mini empty yellow ui label"></div>
<% end %>
<% end %>
</div>
</div>
@ -211,7 +230,11 @@
<a href="/module.html" class="ui small <%= if @document.elementType is 'module' then 'active ' %> inverted header">Modules</a>
<div class="menu">
<% for element in uiModules: %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %></a>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %>
</a>
<% if element.status? is 'Undocumented': %>
<div class="ui mini empty yellow ui label"></div>
<% end %>
<% end %>
</div>
</div>
@ -219,7 +242,11 @@
<div class="ui small <%= if @document.elementType is 'behavior' then 'active ' %> inverted header">Behaviors</div>
<div class="menu">
<% for element in uiBehavior: %>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %></a>
<a class="<%= if element.id is @document.id then 'active ' %>item" href="<%= element.url %>"><%= element.title %>
</a>
<% if element.status? is 'Undocumented': %>
<div class="ui mini empty yellow ui label"></div>
<% end %>
<% end %>
</div>
</div>

1
src/definitions/collections/table.less

@ -568,6 +568,7 @@
display: inline-block;
content: '';
width: @sortableIconWidth;
height: 1em;
opacity: @sortableIconOpacity;
margin: 0em 0em 0em @sortableIconDistance;

5
src/definitions/elements/list.less

@ -560,6 +560,11 @@ ol.ui.horizontal.list li:before,
padding-left: @orderedChildCountDistance;
}
/* Divided Selection */
.ui.divided.selection.list .item {
margin: 0em;
border-radius: 0em;
}
/* Divided horizontal */
.ui.divided.horizontal.list {

1
src/definitions/elements/segment.less

@ -151,6 +151,7 @@
.ui.piled.segment {
margin: @piledMargin 0em;
box-shadow: @piledBoxShadow;
z-index: @piledZIndex;
}
.ui.piled.segment:first-child {
margin-top: 0em;

453
src/definitions/modules/progress.js

@ -0,0 +1,453 @@
/*
* # Semantic - Progress
* http://github.com/semantic-org/semantic-ui/
*
*
* Copyright 2014 Contributor
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
;(function ( $, window, document, undefined ) {
"use strict";
$.fn.progress = function(parameters) {
var
$allModules = $(this),
moduleSelector = $allModules.selector || '',
hasTouch = ('ontouchstart' in document.documentElement),
time = new Date().getTime(),
performance = [],
query = arguments[0],
methodInvoked = (typeof query == 'string'),
queryArguments = [].slice.call(arguments, 1),
returnedValue
;
$allModules
.each(function() {
var
settings = ( $.isPlainObject(parameters) )
? $.extend(true, {}, $.fn.progress.settings, parameters)
: $.extend({}, $.fn.progress.settings),
className = settings.className,
metadata = settings.metadata,
namespace = settings.namespace,
selector = settings.selector,
error = settings.error,
eventNamespace = '.' + namespace,
moduleNamespace = 'module-' + namespace,
$module = $(this),
$bar = $(this).find(selector.bar),
$progress = $(this).find(selector.progress),
element = this,
instance = $module.data(moduleNamespace),
module
;
module = {
initialize: function() {
module.debug('Initializing progress', settings);
module.read.metadata();
module.set.initials();
module.instantiate();
},
instantiate: function() {
module.verbose('Storing instance of progress', module);
instance = module;
$module
.data(moduleNamespace, module)
;
},
read: {
metadata: function() {
if( $module.data(metadata.percent) ) {
module.verbose('Current percent value set from metadata');
module.percent = $module.data(metadata.percent);
}
if( $module.data(metadata.total) ) {
module.verbose('Total value set from metadata');
module.total = $module.data(metadata.total);
}
if( $module.data(metadata.value) ) {
module.verbose('Current value set from metadata');
module.value = $module.data(metadata.value);
}
},
currentValue: function() {
return (module.value !== undefined)
? module.value
: false
;
}
},
increment: function(incrementValue) {
var
total = module.total || false,
edgeValue,
startValue,
newValue
;
if(total) {
startValue = module.value || 0;
incrementValue = incrementValue || 1;
newValue = startValue + incrementValue;
edgeValue = module.total;
module.debug('Incrementing completed by value', incrementValue, startValue, edgeValue);
if(newValue > edgeValue ) {
module.debug('Value cannot decrement above total', edgeValue);
newValue = edgeValue;
}
module.set.progress(newValue);
}
else {
startValue = module.percent || 0;
incrementValue = incrementValue || module.get.randomValue();
newValue = startValue + incrementValue;
edgeValue = 0;
module.debug('Incrementing percentage by value', incrementValue, startValue);
if(newValue < edgeValue ) {
module.debug('Value cannot decrement below zero');
newValue = edgeValue;
}
module.set.progress(newValue);
}
},
decrement: function(decrementValue) {
var
total = module.total || false,
startValue,
newValue
;
if(total) {
startValue = module.value || 0;
decrementValue = -decrementValue || -1;
newValue = startValue + decrementValue;
module.debug('Decrementing completed by value', decrementValue, startValue);
if(newValue > module.total ) {
newValue = module.total;
}
module.set.progress(newValue);
}
else {
startValue = module.percent || 0;
decrementValue = -decrementValue || -module.get.randomValue();
newValue = startValue + decrementValue;
module.debug('Decrementing percentage by value', decrementValue, startValue);
module.set.progress(newValue);
}
},
get: {
randomValue: function() {
module.debug('Generating random increment percentage');
return Math.floor((Math.random() * settings.random.max) + settings.random.min);
},
percent: function() {
return module.percent || 0;
},
value: function() {
return module.value || false;
},
total: function() {
return module.total || false;
}
},
set: {
complete: function() {
module.set.percent(100);
},
initials: function() {
if(settings.value) {
module.verbose('Current value set in settings', settings.value);
module.value = settings.value;
}
if(settings.total) {
module.verbose('Current total set in settings', settings.total);
module.total = settings.total;
}
if(settings.percent) {
module.verbose('Current percent set in settings', settings.percent);
module.percent = settings.percent;
}
},
percent: function(value) {
value = (typeof value == 'string')
? +(value.replace('%', ''))
: value
;
console.log(value);
if(value > 0 && value < 1) {
module.verbose('Module percentage passed as decimal, converting');
value = value * 100;
}
module.percent = value;
$bar
.css('width', value + '%')
;
},
total: function(totalValue) {
module.total = totalValue;
},
progress: function(value) {
var
numericValue = (typeof value === 'string')
? (value.replace(/[^\d.]/g, '') !== '')
? +(value.replace(/[^\d.]/g, ''))
: false
: value,
percentComplete
;
if(!numericValue) {
module.error(error.nonNumeric);
}
if(module.total) {
module.value = numericValue;
percentComplete = (numericValue / module.total);
module.debug('Calculating percent complete from total', percentComplete);
module.set.percent( percentComplete );
}
else {
percentComplete = numericValue;
module.debug('Setting value to exact percentage value', percentComplete);
module.set.percent( percentComplete );
}
}
},
setting: function(name, value) {
module.debug('Changing setting', name, value);
if( $.isPlainObject(name) ) {
$.extend(true, settings, name);
}
else if(value !== undefined) {
settings[name] = value;
}
else {
return settings[name];
}
},
internal: function(name, value) {
if( $.isPlainObject(name) ) {
$.extend(true, module, name);
}
else if(value !== undefined) {
module[name] = value;
}
else {
return module[name];
}
},
debug: function() {
if(settings.debug) {
if(settings.performance) {
module.performance.log(arguments);
}
else {
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
module.debug.apply(console, arguments);
}
}
},
verbose: function() {
if(settings.verbose && settings.debug) {
if(settings.performance) {
module.performance.log(arguments);
}
else {
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
module.verbose.apply(console, arguments);
}
}
},
error: function() {
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
module.error.apply(console, arguments);
},
performance: {
log: function(message) {
var
currentTime,
executionTime,
previousTime
;
if(settings.performance) {
currentTime = new Date().getTime();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
performance.push({
'Element' : element,
'Name' : message[0],
'Arguments' : [].slice.call(message, 1) || '',
'Execution Time' : executionTime
});
}
clearTimeout(module.performance.timer);
module.performance.timer = setTimeout(module.performance.display, 100);
},
display: function() {
var
title = settings.name + ':',
totalTime = 0
;
time = false;
clearTimeout(module.performance.timer);
$.each(performance, function(index, data) {
totalTime += data['Execution Time'];
});
title += ' ' + totalTime + 'ms';
if(moduleSelector) {
title += ' \'' + moduleSelector + '\'';
}
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
console.groupCollapsed(title);
if(console.table) {
console.table(performance);
}
else {
$.each(performance, function(index, data) {
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
});
}
console.groupEnd();
}
performance = [];
}
},
invoke: function(query, passedArguments, context) {
var
object = instance,
maxDepth,
found,
response
;
passedArguments = passedArguments || queryArguments;
context = element || context;
if(typeof query == 'string' && object !== undefined) {
query = query.split(/[\. ]/);
maxDepth = query.length - 1;
$.each(query, function(depth, value) {
var camelCaseValue = (depth != maxDepth)
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
object = object[camelCaseValue];
}
else if( object[camelCaseValue] !== undefined ) {
found = object[camelCaseValue];
return false;
}
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
object = object[value];
}
else if( object[value] !== undefined ) {
found = object[value];
return false;
}
else {
module.error(error.method, query);
return false;
}
});
}
if ( $.isFunction( found ) ) {
response = found.apply(context, passedArguments);
}
else if(found !== undefined) {
response = found;
}
if($.isArray(returnedValue)) {
returnedValue.push(response);
}
else if(returnedValue !== undefined) {
returnedValue = [returnedValue, response];
}
else if(response !== undefined) {
returnedValue = response;
}
return found;
}
};
if(methodInvoked) {
if(instance === undefined) {
module.initialize();
}
module.invoke(query);
}
else {
if(instance !== undefined) {
module.destroy();
}
module.initialize();
}
})
;
return (returnedValue !== undefined)
? returnedValue
: this
;
};
$.fn.progress.settings = {
name : 'Progress',
namespace : 'progress',
debug : true,
verbose : true,
performance : true,
random : {
min: 1,
max: 3
},
label : 'percent',
percent : false,
total : false,
value : false,
onChange : function(value){},
error : {
method : 'The method you called is not defined.',
nonNumeric : 'Progress value is non numeric'
},
metadata: {
percent : 'percent',
total : 'total',
value : 'value'
},
selector : {
bar : '> .bar',
progress : '.bar > .progress'
},
className : {
}
};
})( jQuery, window , document );

267
src/definitions/modules/progress.less

@ -0,0 +1,267 @@
/*
* # Semantic - Progress Bar
* http://github.com/semantic-org/semantic-ui/
*
*
* Copyright 2014 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Theme
*******************************/
@type : 'module';
@element : 'progress';
@import '../../semantic.config';
.ui.progress {
position: relative;
display: block;
max-width: 100%;
border: @border;
margin: @margin;
box-shadow: @boxShadow;
background: @background;
padding: @padding;
border-radius: @borderRadius;
}
.ui.progress:first-child {
margin: @firstMargin;
}
.ui.progress:last-child {
margin: @lastMargin;
}
/* Indicating Variation
.ui.progress .bar[style^="width:1"],
.ui.progress .bar[style^="width:2"],
.ui.progress .bar[style^="width:3"],
.ui.progress .bar[style^="width: 1"],
.ui.progress .bar[style^="width: 2"],
.ui.progress .bar[style^="width: 3"], {
background-color: #F43114;
}
*/
/*******************************
Content
*******************************/
/* Activity Bar */
.ui.progress .bar {
display: block;
line-height: 1;
position: @barPosition;
width: 0%;
height: @barHeight;
background: @barBackground;
border-radius: @barBorderRadius;
transition: @barTransition;
}
/* Percent Complete */
.ui.progress .bar > .progress {
position: absolute;
width: @progressWidth;
font-size: @progressSize;
top: @progressTop;
right: @progressRight;
left: @progressLeft;
bottom: @progressBottom;
color: @progressColor;
text-shadow: @progressTextShadow;
margin-top: @progressOffset;
text-align: @progressTextAlign;
}
/* Label */
.ui.progress > .label {
position: absolute;
width: @labelWidth;
font-size: @labelSize;
top: @labelTop;
right: @labelRight;
left: @labelLeft;
bottom: @labelBottom;
color: @labelColor;
text-shadow: @labelTextShadow;
margin-top: @labelOffset;
text-align: @labelTextAlign;
}
/*******************************
States
*******************************/
/*--------------
Successful
---------------*/
.ui.successful.progress .bar {
background-color: @successColor !important;
}
.ui.successful.progress .bar,
.ui.successful.progress .bar::after {
animation: none !important;
}
/*--------------
Warning
---------------*/
.ui.warning.progress .bar {
background-color: @warningColor !important;
}
.ui.warning.progress .bar,
.ui.warning.progress .bar::after {
animation: none !important;
}
/*--------------
Failed
---------------*/
.ui.failed.progress .bar {
background-color: @errorColor !important;
}
.ui.failed.progress .bar,
.ui.failed.progress .bar::after {
animation: none !important;
}
/*--------------
Active
---------------*/
.ui.active.progress .bar {
position: relative;
}
.ui.active.progress .bar::after {
content: '';
opacity: 0;
position: absolute;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
background: @activePulseColor;
border-radius: @barBorderRadius;
animation: progress-active @activePulseDuration @defaultEasing infinite;
}
@keyframes progress-active {
0% {
opacity: 0;
width: 0;
}
50% {
opacity: @activePulseMaxOpacity;
}
100% {
opacity: 0;
width: 100%;
}
}
/*--------------
Disabled
---------------*/
.ui.disabled.progress {
opacity: 0.35;
}
.ui.disabled.progress .bar,
.ui.disabled.progress .bar::after {
animation: none !important;
}
/*******************************
Variations
*******************************/
/*--------------
Attached
---------------*/
/* bottom attached */
.ui.progress.attached {
background-color: transparent;
position: relative;
border: none;
margin: 0em;
}
.ui.progress.attached,
.ui.progress.attached .bar {
display: block;
height: @attachedHeight;
padding: 0px;
overflow: hidden;
border-radius: 0em 0em @attachedBorderRadius @attachedBorderRadius;
}
.ui.progress.attached .bar {
border-radius: 0em;
}
/* top attached */
.ui.progress.top.attached,
.ui.progress.top.attached .bar {
top: 0px;
border-radius: @attachedBorderRadius @attachedBorderRadius 0em 0em;
}
.ui.progress.top.attached .bar {
border-radius: 0em;
}
/*--------------
Colors
---------------*/
.ui.black.progress .bar {
background-color: @black;
}
.ui.blue.progress .bar {
background-color: @blue;
}
.ui.green.progress .bar {
background-color: @green;
}
.ui.orange.progress .bar {
background-color: @orange;
}
.ui.pink.progress .bar {
background-color: @pink;
}
.ui.purple.progress .bar {
background-color: @purple;
}
.ui.red.progress .bar {
background-color: @red;
}
.ui.teal.progress .bar {
background-color: @teal;
}
.ui.yellow.progress .bar {
background-color: @yellow;
}
/*--------------
Sizes
---------------*/
.ui.small.progress .bar {
height: 14px;
}

3
src/themes/_site/modules/progress.overrides

@ -0,0 +1,3 @@
/*******************************
Overrides
*******************************/

3
src/themes/_site/modules/progress.variables

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

1
src/themes/packages/default/elements/segment.variables

@ -34,6 +34,7 @@
*******************************/
/* Piled */
@piledZIndex: 1;
@piledMargin: 2em;
@piledBoxShadow: 0px 0px 1px 1px @borderColor;
@piledDegrees: 1.2deg;

12
src/themes/packages/default/globals/site.variables

@ -182,21 +182,25 @@
--------------------*/
/* Mood */
@positiveColor : @green;
@negativeColor : @red;
@positiveBackgroundColor : #E4F5DD;
@negativeBackgroundColor : #FAE8E8;
@positiveBorderColor : #B7CAA7;
@negativeBorderColor : #DBB1B1;
/* Solid Background Color */
@positiveColor : @green;
@negativeColor : @red;
@positiveTextColor : #3C763D;
@negativeTextColor : #A94442;
/* Status */
@infoColor : #31CCEC;
@warningColor : #F2C037;
@successColor : @positiveColor;
@errorColor : @negativeColor;
@infoBackgroundColor : #E5F6FB;
@warningBackgroundColor : #FCF8E3;
@successBackgroundColor : @positiveBackgroundColor;

3
src/themes/packages/default/modules/progress.overrides

@ -0,0 +1,3 @@
/*******************************
Progress
*******************************/

76
src/themes/packages/default/modules/progress.variables

@ -0,0 +1,76 @@
/*******************************
Progress
*******************************/
/*-------------------
Element
--------------------*/
@verticalSpacing: 1em;
@margin: @verticalSpacing 0em (@labelHeight + @verticalSpacing);
@firstMargin: 0em 0em (@labelHeight + @verticalSpacing);
@lastMargin: 0em 0em (@labelHeight);
@background: @offWhite;
@border: 1px solid @borderColor;
@boxShadow: none;
@padding: 0.325em;
@borderRadius: 0.325em;
/* Bar */
@barPosition: relative;
@barHeight: 1.75em;
@barBackground: #888888;
@barBorderRadius: @borderRadius;
@barTransition:
width 0.3s ease-in-out,
background-color 1s ease-out
;
@progressWidth: auto;
@progressSize: 0.9em;
@progressPosition: absolute;
@progressTop: 50%;
@progressRight: 1em;
@progressLeft: auto;
@progressBottom: auto;
@progressOffset: -0.5em;
@progressColor: @invertedLightTextColor;
@progressTextShadow: none;
@progressTextAlign: left;
@labelWidth: 100%;
@labelHeight: 1.75em;
@labelSize: 1em;
@labelPosition: absolute;
@labelTop: auto;
@labelRight: auto;
@labelLeft: 0%;
@labelBottom: -@labelHeight;
@labelOffset: 0em;
@labelColor: @textColor;
@labelTextShadow: none;
@labelTextAlign: center;
/*-------------------
States
--------------------*/
@activePulseColor: @white;
@activePulseMaxOpacity: 0.3;
@activePulseDuration: 2s;
/*-------------------
Types
--------------------*/
@attachedHeight: 0.25em;
@attachedBorderRadius: @borderRadius;
/*-------------------
Variations
--------------------*/

29
src/themes/packages/striped/modules/progress.overrides

@ -0,0 +1,29 @@
/*******************************
Progress
*******************************/
.ui.progress .bar {
background-size: 30px 30px;
background-image:
linear-gradient(
135deg, rgba(255, 255, 255, .05) 25%, transparent 25%,
transparent 50%, rgba(255, 255, 255, .05) 50%, rgba(255, 255, 255, .05) 75%,
transparent 75%, transparent
)
;
}
.ui.progress.active .bar:after {
animation: none;
}
.ui.progress.active .bar {
animation: progress-striped 3s linear infinite;
}
@keyframes progress-striped {
0% {
background-position: 0px 0;
}
100% {
background-position: 60px 0;
}
}

3
src/themes/packages/striped/modules/progress.variables

@ -0,0 +1,3 @@
/*******************************
Progress
*******************************/
Loading…
Cancel
Save