ratchet_design 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/ratchet/favicon.ico +0 -0
  3. data/app/assets/images/ratchet/safari-pinned-tab.svg +1 -0
  4. data/app/assets/javascripts/ratchet/base/form.js +9 -118
  5. data/app/assets/javascripts/ratchet/base/mobilemenu.js +12 -50
  6. data/app/assets/javascripts/ratchet/base/sync-input-value.js +30 -0
  7. data/app/assets/javascripts/ratchet/core.js +58 -77
  8. data/app/assets/javascripts/ratchet/enhancement/_collapse.js +3 -6
  9. data/app/assets/javascripts/ratchet/enhancement/_swap.js +3 -7
  10. data/app/assets/javascripts/ratchet/enhancement/lightbox.js +165 -0
  11. data/app/assets/javascripts/ratchet/enhancement/notice.js +8 -3
  12. data/app/assets/javascripts/ratchet/enhancement/sticky.js +18 -35
  13. data/app/assets/javascripts/ratchet/enhancement/waypoints.js +125 -162
  14. data/app/assets/javascripts/ratchet/shim/scope.js +94 -0
  15. data/app/assets/javascripts/ratchet/{enhancement → utility}/loader.js +15 -8
  16. data/app/assets/stylesheets/ratchet/_core.scss +4 -1
  17. data/app/assets/stylesheets/ratchet/base/_button.scss +3 -3
  18. data/app/assets/stylesheets/ratchet/base/_form.scss +63 -47
  19. data/app/assets/stylesheets/ratchet/base/_multistep-form.scss +64 -0
  20. data/app/assets/stylesheets/ratchet/base/_text.scss +15 -15
  21. data/app/assets/stylesheets/ratchet/enhancement/_lightbox.scss +98 -0
  22. data/app/assets/stylesheets/ratchet/enhancement/_tooltip.scss +142 -0
  23. data/app/assets/stylesheets/ratchet/fonts-woff.css +4 -4
  24. data/app/assets/stylesheets/ratchet/fonts-woff2.css +4 -4
  25. data/app/assets/stylesheets/ratchet/utility/_global.scss +3 -13
  26. data/app/assets/stylesheets/ratchet/{enhancement → utility}/_loader.scss +1 -1
  27. data/app/helpers/ratchet/application_helper.rb +6 -12
  28. data/app/helpers/ratchet/form_helper.rb +140 -0
  29. data/app/views/layouts/ratchet/default.html.slim +3 -2
  30. data/app/views/shared/ratchet/_footer.html.slim +1 -1
  31. data/app/views/shared/ratchet/_header.html.slim +1 -1
  32. data/lib/ratchet_design/version.rb +1 -1
  33. data/lib/ratchet_design.rb +24 -4
  34. data/public/assets/ratchet/core-0.1.2.js +133 -0
  35. data/public/assets/ratchet/core-0.1.2.js.gz +0 -0
  36. data/public/assets/ratchet/core-0.1.2.map.json +1 -0
  37. data/public/assets/ratchet/core-0.1.20.js +20472 -0
  38. data/public/assets/ratchet/{fonts-woff-0.1.1.css → fonts-woff-0.1.2.css} +4 -4
  39. data/public/assets/ratchet/{fonts-woff-0.1.1.css.gz → fonts-woff-0.1.2.css.gz} +0 -0
  40. data/public/assets/ratchet/{fonts-woff2-0.1.1.css → fonts-woff2-0.1.2.css} +4 -4
  41. data/public/assets/ratchet/{fonts-woff2-0.1.1.css.gz → fonts-woff2-0.1.2.css.gz} +0 -0
  42. metadata +48 -27
  43. data/app/assets/javascripts/ratchet/base/validation.js +0 -263
  44. data/app/assets/javascripts/ratchet/enhancement/_lightbox.js +0 -93
  45. data/app/assets/javascripts/ratchet/shim/classlist.js +0 -234
  46. data/app/assets/javascripts/ratchet/shim/object.assign.js +0 -30
  47. data/app/assets/javascripts/ratchet/utility/compile_data.js +0 -32
  48. data/app/assets/javascripts/ratchet/utility/from_top.js +0 -14
  49. data/app/assets/javascripts/ratchet/utility/full_stop.js +0 -55
  50. data/app/assets/javascripts/ratchet/utility/get_closest.js +0 -20
  51. data/app/assets/javascripts/ratchet/utility/get_next.js +0 -17
  52. data/app/assets/javascripts/ratchet/utility/matches.js +0 -15
  53. data/app/assets/javascripts/ratchet/utility/scroll_to.js +0 -74
  54. data/app/assets/javascripts/ratchet/utility/throttle.js +0 -25
  55. data/app/assets/javascripts/ratchet/utility/timeout.js +0 -45
  56. data/app/assets/javascripts/ratchet/utility/unhover.js +0 -56
  57. data/app/assets/javascripts/ratchet/utility/word_count.js +0 -15
  58. data/app/assets/stylesheets/ratchet/enhancement/_signup.scss +0 -206
  59. data/public/assets/ratchet/core-0.1.1.js +0 -103
  60. data/public/assets/ratchet/core-0.1.1.js.gz +0 -0
  61. data/public/assets/ratchet/core-0.1.1.map.json +0 -1
@@ -1,234 +0,0 @@
1
- /**
2
- * ClassList
3
- * Cross-browser full element.classList implementation
4
- * @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js
5
- * @author Eli Grey - http://eligrey.com
6
- * @license MIT
7
- **/
8
-
9
- if ( 'document' in self ) {
10
-
11
- // Full polyfill for browsers with no classList support
12
- if ( !( 'classList' in document.createElement( '_' ) ) ) {
13
-
14
- ( function( view ) {
15
-
16
- 'use strict';
17
-
18
- if ( !( 'Element' in view ) ) return;
19
-
20
- var
21
- classListProp = 'classList',
22
- protoProp = 'prototype',
23
- elemCtrProto = view.Element[ protoProp ],
24
- objCtr = Object,
25
-
26
- strTrim = String[ protoProp ].trim || function() {
27
- return this.replace( /^\s+|\s+$/g, '' );
28
- },
29
-
30
- arrIndexOf = Array[ protoProp ].indexOf || function( item ) {
31
- for ( var i = 0; i < this.length; i++ ) {
32
- if ( i in this && this[ i ] === item ) {
33
- return i;
34
- }
35
- }
36
- return -1;
37
- },
38
-
39
- DOMEx = function( type, message ) {
40
- this.name = type;
41
- this.code = DOMException[ type ];
42
- this.message = message;
43
- },
44
-
45
- checkTokenAndGetIndex = function( classList, token ) {
46
- if ( token === '' ) {
47
- throw new DOMEx(
48
- 'SYNTAX_ERR',
49
- 'An invalid or illegal string was specified'
50
- );
51
- }
52
- if ( /\s/.test( token ) ) {
53
- throw new DOMEx(
54
- 'INVALID_CHARACTER_ERR',
55
- 'String contains an invalid character'
56
- );
57
- }
58
- return arrIndexOf.call( classList, token );
59
- },
60
-
61
- ClassList = function( elem ) {
62
- var trimmedClasses = strTrim.call( elem.getAttribute( 'class' ) || '' ),
63
- classes = trimmedClasses ? trimmedClasses.split( /\s+/ ) : [];
64
-
65
- for ( var i = 0; i < classes.length; i++ ) {
66
- this.push( classes[ i ] );
67
- }
68
-
69
- this._updateClassName = function() {
70
- elem.setAttribute( 'class', this.toString() );
71
- };
72
- },
73
-
74
- classListProto = ClassList[ protoProp ] = [],
75
-
76
- classListGetter = function() {
77
- return new ClassList( this );
78
- };
79
-
80
- DOMEx[ protoProp ] = Error[ protoProp ];
81
-
82
- classListProto.item = function( i ) {
83
- return this[ i ] || null;
84
- };
85
-
86
- classListProto.contains = function( token ) {
87
- token += '';
88
- return checkTokenAndGetIndex( this, token ) !== -1;
89
- };
90
-
91
- classListProto.add = function() {
92
- var
93
- tokens = arguments,
94
- iter = 0,
95
- len = tokens.length,
96
- updated = false,
97
- token;
98
-
99
- do {
100
- token = tokens[ iter ] + '';
101
- if ( checkTokenAndGetIndex( this, token ) === -1 ) {
102
- this.push( token );
103
- updated = true;
104
- }
105
- }
106
-
107
- while ( ++iter < len );
108
-
109
- if ( updated ) {
110
- this._updateClassName();
111
- }
112
- };
113
-
114
- classListProto.remove = function() {
115
- var
116
- tokens = arguments,
117
- iter = 0,
118
- len = tokens.length,
119
- updated = false,
120
- token,
121
- index;
122
-
123
- do {
124
- token = tokens[ iter ] + '';
125
- index = checkTokenAndGetIndex( this, token );
126
-
127
- while ( index !== -1 ) {
128
- this.splice( index, 1 );
129
- updated = true;
130
- index = checkTokenAndGetIndex( this, token );
131
- }
132
- }
133
-
134
- while ( ++iter < len );
135
-
136
- if ( updated ) {
137
- this._updateClassName();
138
- }
139
- };
140
-
141
- classListProto.toggle = function( token, force ) {
142
- token += '';
143
-
144
- var
145
- result = this.contains( token ),
146
- method = result ? force !== true && 'remove' : force !== false && 'add';
147
-
148
- if ( method ) {
149
- this[ method ]( token );
150
- }
151
-
152
- if ( force === true || force === false ) {
153
- return force;
154
- } else {
155
- return !result;
156
- }
157
- };
158
-
159
- classListProto.toString = function() {
160
- return this.join( ' ' );
161
- };
162
-
163
- if ( objCtr.defineProperty ) {
164
- var classListPropDesc = {
165
- get : classListGetter,
166
- enumerable : true,
167
- configurable : true
168
- };
169
-
170
- try {
171
- objCtr.defineProperty( elemCtrProto, classListProp, classListPropDesc );
172
- }
173
-
174
- catch ( ex ) {
175
- if ( ex.number === -0x7FF5EC54 ) {
176
- classListPropDesc.enumerable = false;
177
- objCtr.defineProperty( elemCtrProto, classListProp, classListPropDesc );
178
- }
179
- }
180
-
181
- } else if ( objCtr[ protoProp ].__defineGetter__ ) {
182
- elemCtrProto.__defineGetter__( classListProp, classListGetter );
183
- }
184
-
185
- }( self ));
186
-
187
- } else {
188
-
189
- ( function() {
190
-
191
- 'use strict';
192
-
193
- var testElement = document.createElement( '_' );
194
-
195
- testElement.classList.add( 'c1', 'c2' );
196
-
197
- if ( !testElement.classList.contains( 'c2' ) ) {
198
- var createMethod = function( method ) {
199
- var original = DOMTokenList.prototype[ method ];
200
-
201
- DOMTokenList.prototype[ method ] = function( token ) {
202
- var i, len = arguments.length;
203
-
204
- for ( i = 0; i < len; i++ ) {
205
- token = arguments[ i ];
206
- original.call( this, token );
207
- }
208
- };
209
- };
210
- createMethod( 'add' );
211
- createMethod( 'remove' );
212
- }
213
-
214
- testElement.classList.toggle( 'c3', false );
215
-
216
- if ( testElement.classList.contains( 'c3' ) ) {
217
- var _toggle = DOMTokenList.prototype.toggle;
218
-
219
- DOMTokenList.prototype.toggle = function( token, force ) {
220
- if ( 1 in arguments && !this.contains( token ) === !force ) {
221
- return force;
222
- } else {
223
- return _toggle.call( this, token );
224
- }
225
- };
226
-
227
- }
228
-
229
- testElement = null;
230
-
231
- }());
232
-
233
- }
234
- }
@@ -1,30 +0,0 @@
1
- /**
2
- * Object.assign polyfill
3
- * Cross-browser full Object.assign implementation
4
- * @source https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill
5
- * @license MIT
6
- **/
7
-
8
- if ( typeof Object.assign != 'function' ) {
9
- ( function() {
10
- Object.assign = function( target ) {
11
- 'use strict';
12
- if ( target === undefined || target === null ) {
13
- throw new TypeError( 'Cannot convert undefined or null to object' );
14
- }
15
-
16
- var output = Object( target );
17
- for ( var index = 1; index < arguments.length; index++ ) {
18
- var source = arguments[ index ];
19
- if ( source !== undefined && source !== null ) {
20
- for ( var nextKey in source ) {
21
- if ( Object.prototype.hasOwnProperty.call( source, nextKey ) ) {
22
- output[ nextKey ] = source[ nextKey ];
23
- }
24
- }
25
- }
26
- }
27
- return output;
28
- };
29
- })();
30
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * CompileData 0.0.1
3
- * Compile input data from a given parent element
4
- * @author Kyle Foster (@hkfoster)
5
- * @license MIT
6
- **/
7
-
8
- // Public API function
9
- var compileData = function( parent ) {
10
-
11
- // Scoped variables
12
- var formData = new FormData(),
13
- allFields = parent.querySelectorAll( 'input:not([type=submit])' );
14
-
15
- // Loop over fields
16
- for ( var i = 0; i < allFields.length; i++ ) {
17
-
18
- // Uncomment for testing
19
- // console.log( 'Name: ' + allFields[ i ].name + '\n' + 'Value: ' + allFields[ i ].value );
20
-
21
- // And append their name/value to new formData object
22
- formData.append( allFields[ i ].name, allFields[ i ].value );
23
-
24
- }
25
-
26
- // Then return said formData object
27
- return formData;
28
-
29
- };
30
-
31
- // Public API
32
- module.exports = compileData;
@@ -1,14 +0,0 @@
1
- /**
2
- * FromTop 0.0.1
3
- * Find element’s distance from top of document
4
- * @author Kyle Foster (@hkfoster)
5
- * @license MIT
6
- **/
7
-
8
- // Public API function
9
- var fromTop = function( elem ) {
10
- return Math.round( elem.getBoundingClientRect().top + window.pageYOffset );
11
- };
12
-
13
- // Public API
14
- module.exports = fromTop;
@@ -1,55 +0,0 @@
1
- /**
2
- * FullStop 0.0.2
3
- * Prevent CSS transitions from occurring during a window resize
4
- * @author Kyle Foster (@hkfoster)
5
- * @license MIT
6
- **/
7
-
8
- // Dependencies
9
- var throttle = require( '../utility/throttle' ),
10
- timeout = require( '../utility/timeout' );
11
-
12
- // Public API function
13
- var fullStop = function( settings ) {
14
-
15
- // Overridable defaults
16
- var defaults = {
17
- resizeDelay : 250,
18
- resizeClass : 'no-transitions'
19
- };
20
-
21
- // Scoped variables
22
- var options = Object.assign( {}, defaults, settings ),
23
- docBody = document.body,
24
- resizeTimer;
25
-
26
- // Resize handler function
27
- function resizeHandler() {
28
-
29
- // Clear timer (if it exists)
30
- if ( resizeTimer ) timeout.clear( resizeTimer );
31
-
32
- // Add body class while resizing
33
- docBody.classList.add( options.resizeClass );
34
-
35
- // Check to see if resize is over
36
- resizeTimer = timeout.set( function() {
37
-
38
- // And remove body class upon completion
39
- docBody.classList.remove( options.resizeClass );
40
-
41
- // Delay firing function based on argument passed
42
- }, options.resizeDelay );
43
-
44
- }
45
-
46
- // Resize throttle function init
47
- throttle( 'resize', 'optimizedResize' );
48
-
49
- // Resize function listener
50
- window.addEventListener( 'optimizedResize', resizeHandler, false );
51
-
52
- };
53
-
54
- // Public API
55
- module.exports = fullStop;
@@ -1,20 +0,0 @@
1
- /**
2
- * GetClosest 0.0.1
3
- * Get closest DOM element up the tree that matches a given selector
4
- * @author Kyle Foster (@hkfoster)
5
- * @license MIT
6
- **/
7
-
8
- // Dependencies
9
- var matches = require( './matches' );
10
-
11
- // Public API function
12
- var getClosest = function ( elem, selector ) {
13
- for ( ; elem && elem !== document; elem = elem.parentNode ) {
14
- if ( matches( elem, selector ) ) return elem;
15
- }
16
- return false;
17
- };
18
-
19
- // Public API
20
- module.exports = getClosest;
@@ -1,17 +0,0 @@
1
- /**
2
- * GetNext 0.0.1
3
- * Get next DOM element that matches a given selector
4
- * @author Kyle Foster (@hkfoster)
5
- * @license MIT
6
- **/
7
-
8
- // Public API function
9
- var getNext = function( elem, selector ) {
10
- for ( ; elem && elem !== document; elem = elem.parentNode ) {
11
- if ( elem.querySelector( selector ) ) return elem.querySelector( selector );
12
- }
13
- return false;
14
- };
15
-
16
- // Public API
17
- module.exports = getNext;
@@ -1,15 +0,0 @@
1
- /**
2
- * Matches 0.0.1
3
- * Matches selector function
4
- * @author Kyle Foster (@hkfoster)
5
- * @reference https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
6
- * @license MIT
7
- **/
8
-
9
- // Public API function
10
- var matches = function ( el, selector ) {
11
- return ( el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector ).call( el, selector );
12
- };
13
-
14
- // Public API
15
- module.exports = matches;
@@ -1,74 +0,0 @@
1
- /**
2
- * ScrollTo 0.0.1
3
- * Scroll to element function
4
- * @author James Doyle (@james2doyle) & Kyle Foster (@hkfoster)
5
- * @source https://goo.gl/CeY8fY
6
- * @license MIT
7
- **/
8
-
9
- // Public API function
10
- var scrollTo = function( to, callback, duration ) {
11
-
12
- // Scoped variables
13
- var start = position(),
14
- change = to - start,
15
- currTime = 0,
16
- increment = 20;
17
- duration = ( typeof( duration ) === 'undefined' ) ? 500 : duration;
18
-
19
- // Kick off scroll animation
20
- animateScroll();
21
-
22
- // Easing function - http://goo.gl/5HLl8
23
- function easeInOutQuad( t, b, c, d ) {
24
- t /= d / 2;
25
- if ( t < 1 ) {
26
- return c / 2 * t * t + b;
27
- }
28
- t--;
29
- return -c / 2 * ( t * ( t - 2 ) - 1 ) + b;
30
- }
31
-
32
- // Get current scroll position
33
- function position() {
34
- return document.documentElement.scrollTop ||
35
- document.body.parentNode.scrollTop ||
36
- document.body.scrollTop;
37
- }
38
-
39
- // Move scroll position
40
- function move( amount ) {
41
- document.documentElement.scrollTop = amount;
42
- document.body.parentNode.scrollTop = amount;
43
- document.body.scrollTop = amount;
44
- }
45
-
46
- // Scroll animation function
47
- function animateScroll() {
48
-
49
- // Increment the time
50
- currTime += increment;
51
-
52
- // Find the value with the quadratic in-out easing function
53
- var val = easeInOutQuad( currTime, start, change, duration );
54
-
55
- // Move the document.body
56
- move( val );
57
-
58
- // Do the animation unless its over
59
- if ( currTime < duration ) {
60
- requestAnimationFrame( animateScroll );
61
- }
62
-
63
- // The animation is done so let’s callback
64
- else {
65
- if ( callback && typeof( callback ) === 'function' ) {
66
- callback();
67
- }
68
- }
69
- }
70
-
71
- };
72
-
73
- // Public API
74
- module.exports = scrollTo;
@@ -1,25 +0,0 @@
1
- /**
2
- * Throttle 0.0.1
3
- * Event throttle function
4
- * @author Kyle Foster (@hkfoster)
5
- * @reference http://www.html5rocks.com/en/tutorials/speed/animations/
6
- * @license MIT
7
- **/
8
-
9
- // Public API function
10
- var throttle = function ( type, name, obj ) {
11
- obj = obj || window;
12
- var running = false;
13
- var func = function () {
14
- if ( running ) { return; }
15
- running = true;
16
- requestAnimationFrame( function () {
17
- obj.dispatchEvent( new CustomEvent( name ) );
18
- running = false;
19
- });
20
- };
21
- obj.addEventListener( type, func );
22
- };
23
-
24
- // Public API
25
- module.exports = throttle;
@@ -1,45 +0,0 @@
1
- /**
2
- * Timeout 0.0.1
3
- * Just like setTimeout & clearTimeout, but with requestAnimationFrame()
4
- * @author Joe Lambert (@joelambert) & Kyle Foster (@hkfoster)
5
- * @source https://gist.github.com/joelambert/1002116#file-requesttimeout-js
6
- * @license MIT
7
- **/
8
-
9
- // Public API object
10
- var timeout = {
11
-
12
- // Set timeout function
13
- set : function( fn, delay, args ) {
14
-
15
- var start = Date.now(),
16
- handle = {};
17
-
18
- function loop() {
19
-
20
- var current = Date.now(),
21
- delta = current - start;
22
-
23
- if ( delta >= delay ) {
24
- if ( args !== undefined ) {
25
- fn.call( fn, args );
26
- } else {
27
- fn.call( fn );
28
- }
29
- } else {
30
- handle.value = requestAnimationFrame( loop );
31
- }
32
- }
33
-
34
- handle.value = requestAnimationFrame( loop );
35
- return handle;
36
- },
37
-
38
- // Clear timeout function
39
- clear : function( handle ) {
40
- window.cancelAnimationFrame( handle.value );
41
- }
42
- };
43
-
44
- // Public API
45
- module.exports = timeout;
@@ -1,56 +0,0 @@
1
- /**
2
- * Unhover 0.0.1
3
- * Disable hover events on scroll
4
- * @author Kyle Foster (@hkfoster)
5
- * @license MIT
6
- **/
7
-
8
- // Dependencies
9
- var throttle = require( '../utility/throttle' ),
10
- timeout = require( '../utility/timeout' );
11
-
12
- // Public API function
13
- var unhover = function( settings ) {
14
-
15
- // Overridable defaults
16
- var defaults = {
17
- scrollDelay : 150
18
- };
19
-
20
- // Scoped variables
21
- var options = Object.assign( {}, defaults, settings ),
22
- docElem = document.documentElement,
23
- scrollTimer;
24
-
25
- // Scroll handler function
26
- function scrollHandler() {
27
-
28
- // Clear timer (if it exists)
29
- if ( scrollTimer ) timeout.clear( scrollTimer );
30
-
31
- // Turn off pointer events
32
- if ( !docElem.style.pointerEvents ) {
33
- docElem.style.pointerEvents = 'none';
34
- }
35
-
36
- // Check to see if scroll is over
37
- scrollTimer = timeout.set( function() {
38
-
39
- // And reset pointer events upon completion
40
- docElem.style.pointerEvents = '';
41
-
42
- // Delay firing function based on argument passed
43
- }, options.scrollDelay );
44
-
45
- }
46
-
47
- // Scroll throttle function init
48
- throttle( 'scroll', 'optimizedscroll' );
49
-
50
- // Scroll function listener
51
- window.addEventListener( 'optimizedscroll', scrollHandler, false );
52
-
53
- };
54
-
55
- // Public API
56
- module.exports = unhover;
@@ -1,15 +0,0 @@
1
- /**
2
- * WordCount 0.0.1
3
- * Word counter function
4
- * @author Kyle Foster (@hkfoster)
5
- * @license MIT
6
- **/
7
-
8
- // Public API function
9
- var wordCount = function( str ) {
10
- var matches = str.match( /\S+/g );
11
- return matches ? matches.length : 0;
12
- };
13
-
14
- // Public API
15
- module.exports = wordCount;