material_design_lite-sass 1.0.4.2 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/material_design_lite/sass/engine.rb +2 -1
- data/lib/material_design_lite/sass/version.rb +1 -1
- data/vendor/assets/images/buffer.svg +9 -0
- data/vendor/assets/images/tick-mask.svg +30 -0
- data/vendor/assets/images/tick.svg +15 -0
- data/vendor/assets/javascripts/material.js +363 -139
- data/vendor/assets/javascripts/material/button.js +5 -3
- data/vendor/assets/javascripts/material/checkbox.js +14 -6
- data/vendor/assets/javascripts/material/data-table.js +23 -19
- data/vendor/assets/javascripts/material/icon-toggle.js +16 -6
- data/vendor/assets/javascripts/material/layout.js +32 -11
- data/vendor/assets/javascripts/material/mdlComponentHandler.js +160 -51
- data/vendor/assets/javascripts/material/menu.js +13 -9
- data/vendor/assets/javascripts/material/progress.js +10 -5
- data/vendor/assets/javascripts/material/rAF.js +19 -7
- data/vendor/assets/javascripts/material/radio.js +15 -7
- data/vendor/assets/javascripts/material/ripple.js +28 -3
- data/vendor/assets/javascripts/material/slider.js +10 -6
- data/vendor/assets/javascripts/material/spinner.js +8 -4
- data/vendor/assets/javascripts/material/switch.js +14 -5
- data/vendor/assets/javascripts/material/tabs.js +11 -3
- data/vendor/assets/javascripts/material/textfield.js +19 -6
- data/vendor/assets/javascripts/material/tooltip.js +4 -3
- data/vendor/assets/stylesheets/_material.scss +0 -0
- data/vendor/assets/stylesheets/material/_checkbox.scss +3 -3
- data/vendor/assets/stylesheets/material/_layout.scss +2 -2
- data/vendor/assets/stylesheets/material/_progress.scss +1 -1
- data/vendor/assets/stylesheets/material/_variables.scss +5 -0
- metadata +5 -2
@@ -23,6 +23,7 @@
|
|
23
23
|
* Implements MDL component design pattern defined at:
|
24
24
|
* https://github.com/jasonmayes/mdl-component-design-pattern
|
25
25
|
*
|
26
|
+
* @constructor
|
26
27
|
* @param {HTMLElement} element The element that will be upgraded.
|
27
28
|
*/
|
28
29
|
var MaterialMenu = function MaterialMenu(element) {
|
@@ -31,12 +32,12 @@
|
|
31
32
|
// Initialize instance.
|
32
33
|
this.init();
|
33
34
|
};
|
34
|
-
window
|
35
|
+
window['MaterialMenu'] = MaterialMenu;
|
35
36
|
|
36
37
|
/**
|
37
38
|
* Store constants in one place so they can be updated easily.
|
38
39
|
*
|
39
|
-
* @enum {
|
40
|
+
* @enum {string | number}
|
40
41
|
* @private
|
41
42
|
*/
|
42
43
|
MaterialMenu.prototype.Constant_ = {
|
@@ -52,7 +53,7 @@
|
|
52
53
|
/**
|
53
54
|
* Keycodes, for code readability.
|
54
55
|
*
|
55
|
-
* @enum {
|
56
|
+
* @enum {number}
|
56
57
|
* @private
|
57
58
|
*/
|
58
59
|
MaterialMenu.prototype.Keycodes_ = {
|
@@ -68,7 +69,7 @@
|
|
68
69
|
* JavaScript. This allows us to simply change it in one place should we
|
69
70
|
* decide to modify at a later date.
|
70
71
|
*
|
71
|
-
* @enum {
|
72
|
+
* @enum {string}
|
72
73
|
* @private
|
73
74
|
*/
|
74
75
|
MaterialMenu.prototype.CssClasses_ = {
|
@@ -301,7 +302,7 @@
|
|
301
302
|
window.setTimeout(function(evt) {
|
302
303
|
this.hide();
|
303
304
|
this.closing_ = false;
|
304
|
-
}.bind(this), this.Constant_.CLOSE_TIMEOUT);
|
305
|
+
}.bind(this), /** @type {number} */ (this.Constant_.CLOSE_TIMEOUT));
|
305
306
|
}
|
306
307
|
};
|
307
308
|
|
@@ -310,14 +311,14 @@
|
|
310
311
|
* it), and applies it. This allows us to animate from or to the correct point,
|
311
312
|
* that is, the point it's aligned to in the "for" element.
|
312
313
|
*
|
313
|
-
* @param {
|
314
|
-
* @param {
|
314
|
+
* @param {number} height Height of the clip rectangle
|
315
|
+
* @param {number} width Width of the clip rectangle
|
315
316
|
* @private
|
316
317
|
*/
|
317
318
|
MaterialMenu.prototype.applyClip_ = function(height, width) {
|
318
319
|
if (this.element_.classList.contains(this.CssClasses_.UNALIGNED)) {
|
319
320
|
// Do not clip.
|
320
|
-
this.element_.style.clip =
|
321
|
+
this.element_.style.clip = '';
|
321
322
|
} else if (this.element_.classList.contains(this.CssClasses_.BOTTOM_RIGHT)) {
|
322
323
|
// Clip to the top right corner of the menu.
|
323
324
|
this.element_.style.clip =
|
@@ -332,7 +333,7 @@
|
|
332
333
|
height + 'px ' + width + 'px)';
|
333
334
|
} else {
|
334
335
|
// Default: do not clip (same as clipping to the top left corner).
|
335
|
-
this.element_.style.clip =
|
336
|
+
this.element_.style.clip = '';
|
336
337
|
}
|
337
338
|
};
|
338
339
|
|
@@ -416,6 +417,7 @@
|
|
416
417
|
document.addEventListener('click', callback);
|
417
418
|
}
|
418
419
|
};
|
420
|
+
MaterialMenu.prototype['show'] = MaterialMenu.prototype.show;
|
419
421
|
|
420
422
|
/**
|
421
423
|
* Hides the menu.
|
@@ -445,6 +447,7 @@
|
|
445
447
|
this.addAnimationEndListener_();
|
446
448
|
}
|
447
449
|
};
|
450
|
+
MaterialMenu.prototype['hide'] = MaterialMenu.prototype.hide;
|
448
451
|
|
449
452
|
/**
|
450
453
|
* Displays or hides the menu, depending on current state.
|
@@ -458,6 +461,7 @@
|
|
458
461
|
this.show(evt);
|
459
462
|
}
|
460
463
|
};
|
464
|
+
MaterialMenu.prototype['toggle'] = MaterialMenu.prototype.toggle;
|
461
465
|
|
462
466
|
/**
|
463
467
|
* Downgrade the component.
|
@@ -23,6 +23,7 @@
|
|
23
23
|
* Implements MDL component design pattern defined at:
|
24
24
|
* https://github.com/jasonmayes/mdl-component-design-pattern
|
25
25
|
*
|
26
|
+
* @constructor
|
26
27
|
* @param {HTMLElement} element The element that will be upgraded.
|
27
28
|
*/
|
28
29
|
var MaterialProgress = function MaterialProgress(element) {
|
@@ -31,12 +32,12 @@
|
|
31
32
|
// Initialize instance.
|
32
33
|
this.init();
|
33
34
|
};
|
34
|
-
window
|
35
|
+
window['MaterialProgress'] = MaterialProgress;
|
35
36
|
|
36
37
|
/**
|
37
38
|
* Store constants in one place so they can be updated easily.
|
38
39
|
*
|
39
|
-
* @enum {
|
40
|
+
* @enum {string | number}
|
40
41
|
* @private
|
41
42
|
*/
|
42
43
|
MaterialProgress.prototype.Constant_ = {
|
@@ -47,7 +48,7 @@
|
|
47
48
|
* JavaScript. This allows us to simply change it in one place should we
|
48
49
|
* decide to modify at a later date.
|
49
50
|
*
|
50
|
-
* @enum {
|
51
|
+
* @enum {string}
|
51
52
|
* @private
|
52
53
|
*/
|
53
54
|
MaterialProgress.prototype.CssClasses_ = {
|
@@ -57,7 +58,7 @@
|
|
57
58
|
/**
|
58
59
|
* Set the current progress of the progressbar.
|
59
60
|
*
|
60
|
-
* @param {
|
61
|
+
* @param {number} p Percentage of the progress (0-100)
|
61
62
|
* @public
|
62
63
|
*/
|
63
64
|
MaterialProgress.prototype.setProgress = function(p) {
|
@@ -67,17 +68,21 @@
|
|
67
68
|
|
68
69
|
this.progressbar_.style.width = p + '%';
|
69
70
|
};
|
71
|
+
MaterialProgress.prototype['setProgress'] =
|
72
|
+
MaterialProgress.prototype.setProgress;
|
70
73
|
|
71
74
|
/**
|
72
75
|
* Set the current progress of the buffer.
|
73
76
|
*
|
74
|
-
* @param {
|
77
|
+
* @param {number} p Percentage of the buffer (0-100)
|
75
78
|
* @public
|
76
79
|
*/
|
77
80
|
MaterialProgress.prototype.setBuffer = function(p) {
|
78
81
|
this.bufferbar_.style.width = p + '%';
|
79
82
|
this.auxbar_.style.width = (100 - p) + '%';
|
80
83
|
};
|
84
|
+
MaterialProgress.prototype['setBuffer'] =
|
85
|
+
MaterialProgress.prototype.setBuffer;
|
81
86
|
|
82
87
|
/**
|
83
88
|
* Initialize element.
|
@@ -12,7 +12,12 @@
|
|
12
12
|
'use strict';
|
13
13
|
|
14
14
|
if (!Date.now) {
|
15
|
+
/**
|
16
|
+
* Date.now polyfill.
|
17
|
+
* @return {number} the current Date
|
18
|
+
*/
|
15
19
|
Date.now = function() { return new Date().getTime(); };
|
20
|
+
Date['now'] = Date.now;
|
16
21
|
}
|
17
22
|
|
18
23
|
var vendors = ['webkit', 'moz'];
|
@@ -20,19 +25,26 @@ for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {
|
|
20
25
|
var vp = vendors[i];
|
21
26
|
window.requestAnimationFrame = window[vp + 'RequestAnimationFrame'];
|
22
27
|
window.cancelAnimationFrame = (window[vp + 'CancelAnimationFrame'] ||
|
23
|
-
|
28
|
+
window[vp + 'CancelRequestAnimationFrame']);
|
29
|
+
window['requestAnimationFrame'] = window.requestAnimationFrame;
|
30
|
+
window['cancelAnimationFrame'] = window.cancelAnimationFrame;
|
24
31
|
}
|
25
32
|
|
26
33
|
if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) || !window.requestAnimationFrame || !window.cancelAnimationFrame) {
|
27
34
|
var lastTime = 0;
|
35
|
+
/**
|
36
|
+
* requestAnimationFrame polyfill.
|
37
|
+
* @param {!Function} callback the callback function.
|
38
|
+
*/
|
28
39
|
window.requestAnimationFrame = function(callback) {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
40
|
+
var now = Date.now();
|
41
|
+
var nextTime = Math.max(lastTime + 16, now);
|
42
|
+
return setTimeout(function() { callback(lastTime = nextTime); },
|
43
|
+
nextTime - now);
|
44
|
+
};
|
34
45
|
window.cancelAnimationFrame = clearTimeout;
|
46
|
+
window['requestAnimationFrame'] = window.requestAnimationFrame;
|
47
|
+
window['cancelAnimationFrame'] = window.cancelAnimationFrame;
|
35
48
|
}
|
36
49
|
|
37
50
|
})();
|
38
|
-
|
@@ -23,6 +23,7 @@
|
|
23
23
|
* Implements MDL component design pattern defined at:
|
24
24
|
* https://github.com/jasonmayes/mdl-component-design-pattern
|
25
25
|
*
|
26
|
+
* @constructor
|
26
27
|
* @param {HTMLElement} element The element that will be upgraded.
|
27
28
|
*/
|
28
29
|
var MaterialRadio = function MaterialRadio(element) {
|
@@ -31,12 +32,12 @@
|
|
31
32
|
// Initialize instance.
|
32
33
|
this.init();
|
33
34
|
};
|
34
|
-
window
|
35
|
+
window['MaterialRadio'] = MaterialRadio;
|
35
36
|
|
36
37
|
/**
|
37
38
|
* Store constants in one place so they can be updated easily.
|
38
39
|
*
|
39
|
-
* @enum {
|
40
|
+
* @enum {string | number}
|
40
41
|
* @private
|
41
42
|
*/
|
42
43
|
MaterialRadio.prototype.Constant_ = {
|
@@ -48,7 +49,7 @@
|
|
48
49
|
* JavaScript. This allows us to simply change it in one place should we
|
49
50
|
* decide to modify at a later date.
|
50
51
|
*
|
51
|
-
* @enum {
|
52
|
+
* @enum {string}
|
52
53
|
* @private
|
53
54
|
*/
|
54
55
|
MaterialRadio.prototype.CssClasses_ = {
|
@@ -81,7 +82,7 @@
|
|
81
82
|
var button = radios[i].querySelector('.' + this.CssClasses_.RADIO_BTN);
|
82
83
|
// Different name == different group, so no point updating those.
|
83
84
|
if (button.getAttribute('name') === this.btnElement_.getAttribute('name')) {
|
84
|
-
radios[i]
|
85
|
+
radios[i]['MaterialRadio'].updateClasses_();
|
85
86
|
}
|
86
87
|
}
|
87
88
|
};
|
@@ -129,16 +130,15 @@
|
|
129
130
|
/**
|
130
131
|
* Add blur.
|
131
132
|
*
|
132
|
-
* @param {Event} event The event that fired.
|
133
133
|
* @private
|
134
134
|
*/
|
135
|
-
MaterialRadio.prototype.blur_ = function(
|
135
|
+
MaterialRadio.prototype.blur_ = function() {
|
136
136
|
|
137
137
|
// TODO: figure out why there's a focus event being fired after our blur,
|
138
138
|
// so that we can avoid this hack.
|
139
139
|
window.setTimeout(function() {
|
140
140
|
this.btnElement_.blur();
|
141
|
-
}.bind(this), this.Constant_.TINY_TIMEOUT);
|
141
|
+
}.bind(this), /** @type {number} */ (this.Constant_.TINY_TIMEOUT));
|
142
142
|
};
|
143
143
|
|
144
144
|
// Public methods.
|
@@ -155,6 +155,8 @@
|
|
155
155
|
this.element_.classList.remove(this.CssClasses_.IS_DISABLED);
|
156
156
|
}
|
157
157
|
};
|
158
|
+
MaterialRadio.prototype['checkDisabled'] =
|
159
|
+
MaterialRadio.prototype.checkDisabled;
|
158
160
|
|
159
161
|
/**
|
160
162
|
* Check the components toggled state.
|
@@ -168,6 +170,8 @@
|
|
168
170
|
this.element_.classList.remove(this.CssClasses_.IS_CHECKED);
|
169
171
|
}
|
170
172
|
};
|
173
|
+
MaterialRadio.prototype['checkToggleState'] =
|
174
|
+
MaterialRadio.prototype.checkToggleState;
|
171
175
|
|
172
176
|
/**
|
173
177
|
* Disable radio.
|
@@ -178,6 +182,7 @@
|
|
178
182
|
this.btnElement_.disabled = true;
|
179
183
|
this.updateClasses_();
|
180
184
|
};
|
185
|
+
MaterialRadio.prototype['disable'] = MaterialRadio.prototype.disable;
|
181
186
|
|
182
187
|
/**
|
183
188
|
* Enable radio.
|
@@ -188,6 +193,7 @@
|
|
188
193
|
this.btnElement_.disabled = false;
|
189
194
|
this.updateClasses_();
|
190
195
|
};
|
196
|
+
MaterialRadio.prototype['enable'] = MaterialRadio.prototype.enable;
|
191
197
|
|
192
198
|
/**
|
193
199
|
* Check radio.
|
@@ -198,6 +204,7 @@
|
|
198
204
|
this.btnElement_.checked = true;
|
199
205
|
this.updateClasses_();
|
200
206
|
};
|
207
|
+
MaterialRadio.prototype['check'] = MaterialRadio.prototype.check;
|
201
208
|
|
202
209
|
/**
|
203
210
|
* Uncheck radio.
|
@@ -208,6 +215,7 @@
|
|
208
215
|
this.btnElement_.checked = false;
|
209
216
|
this.updateClasses_();
|
210
217
|
};
|
218
|
+
MaterialRadio.prototype['uncheck'] = MaterialRadio.prototype.uncheck;
|
211
219
|
|
212
220
|
/**
|
213
221
|
* Initialize element.
|
@@ -23,6 +23,7 @@
|
|
23
23
|
* Implements MDL component design pattern defined at:
|
24
24
|
* https://github.com/jasonmayes/mdl-component-design-pattern
|
25
25
|
*
|
26
|
+
* @constructor
|
26
27
|
* @param {HTMLElement} element The element that will be upgraded.
|
27
28
|
*/
|
28
29
|
var MaterialRipple = function MaterialRipple(element) {
|
@@ -31,12 +32,12 @@
|
|
31
32
|
// Initialize instance.
|
32
33
|
this.init();
|
33
34
|
};
|
34
|
-
window
|
35
|
+
window['MaterialRipple'] = MaterialRipple;
|
35
36
|
|
36
37
|
/**
|
37
38
|
* Store constants in one place so they can be updated easily.
|
38
39
|
*
|
39
|
-
* @enum {
|
40
|
+
* @enum {string | number}
|
40
41
|
* @private
|
41
42
|
*/
|
42
43
|
MaterialRipple.prototype.Constant_ = {
|
@@ -52,7 +53,7 @@
|
|
52
53
|
* JavaScript. This allows us to simply change it in one place should we
|
53
54
|
* decide to modify at a later date.
|
54
55
|
*
|
55
|
-
* @enum {
|
56
|
+
* @enum {string}
|
56
57
|
* @private
|
57
58
|
*/
|
58
59
|
MaterialRipple.prototype.CssClasses_ = {
|
@@ -164,23 +165,44 @@
|
|
164
165
|
this.element_.addEventListener('touchend', this.boundUpHandler);
|
165
166
|
this.element_.addEventListener('blur', this.boundUpHandler);
|
166
167
|
|
168
|
+
/**
|
169
|
+
* Getter for frameCount_.
|
170
|
+
* @return {number} the frame count.
|
171
|
+
*/
|
167
172
|
this.getFrameCount = function() {
|
168
173
|
return this.frameCount_;
|
169
174
|
};
|
170
175
|
|
176
|
+
/**
|
177
|
+
* Setter for frameCount_.
|
178
|
+
* @param {number} fC the frame count.
|
179
|
+
*/
|
171
180
|
this.setFrameCount = function(fC) {
|
172
181
|
this.frameCount_ = fC;
|
173
182
|
};
|
174
183
|
|
184
|
+
/**
|
185
|
+
* Getter for rippleElement_.
|
186
|
+
* @return {Element} the ripple element.
|
187
|
+
*/
|
175
188
|
this.getRippleElement = function() {
|
176
189
|
return this.rippleElement_;
|
177
190
|
};
|
178
191
|
|
192
|
+
/**
|
193
|
+
* Sets the ripple X and Y coordinates.
|
194
|
+
* @param {number} newX the new X coordinate
|
195
|
+
* @param {number} newY the new Y coordinate
|
196
|
+
*/
|
179
197
|
this.setRippleXY = function(newX, newY) {
|
180
198
|
this.x_ = newX;
|
181
199
|
this.y_ = newY;
|
182
200
|
};
|
183
201
|
|
202
|
+
/**
|
203
|
+
* Sets the ripple styles.
|
204
|
+
* @param {boolean} start whether or not this is the start frame.
|
205
|
+
*/
|
184
206
|
this.setRippleStyles = function(start) {
|
185
207
|
if (this.rippleElement_ !== null) {
|
186
208
|
var transformString;
|
@@ -214,6 +236,9 @@
|
|
214
236
|
}
|
215
237
|
};
|
216
238
|
|
239
|
+
/**
|
240
|
+
* Handles an animation frame.
|
241
|
+
*/
|
217
242
|
this.animFrameHandler = function() {
|
218
243
|
if (this.frameCount_-- > 0) {
|
219
244
|
window.requestAnimationFrame(this.animFrameHandler.bind(this));
|
@@ -23,6 +23,7 @@
|
|
23
23
|
* Implements MDL component design pattern defined at:
|
24
24
|
* https://github.com/jasonmayes/mdl-component-design-pattern
|
25
25
|
*
|
26
|
+
* @constructor
|
26
27
|
* @param {HTMLElement} element The element that will be upgraded.
|
27
28
|
*/
|
28
29
|
var MaterialSlider = function MaterialSlider(element) {
|
@@ -32,12 +33,12 @@
|
|
32
33
|
// Initialize instance.
|
33
34
|
this.init();
|
34
35
|
};
|
35
|
-
window
|
36
|
+
window['MaterialSlider'] = MaterialSlider;
|
36
37
|
|
37
38
|
/**
|
38
39
|
* Store constants in one place so they can be updated easily.
|
39
40
|
*
|
40
|
-
* @enum {
|
41
|
+
* @enum {string | number}
|
41
42
|
* @private
|
42
43
|
*/
|
43
44
|
MaterialSlider.prototype.Constant_ = {
|
@@ -49,7 +50,7 @@
|
|
49
50
|
* JavaScript. This allows us to simply change it in one place should we
|
50
51
|
* decide to modify at a later date.
|
51
52
|
*
|
52
|
-
* @enum {
|
53
|
+
* @enum {string}
|
53
54
|
* @private
|
54
55
|
*/
|
55
56
|
MaterialSlider.prototype.CssClasses_ = {
|
@@ -100,6 +101,7 @@
|
|
100
101
|
*
|
101
102
|
* @param {Event} event The event that fired.
|
102
103
|
* @private
|
104
|
+
* @suppress {missingProperties}
|
103
105
|
*/
|
104
106
|
MaterialSlider.prototype.onContainerMouseDown_ = function(event) {
|
105
107
|
// If this click is not on the parent element (but rather some child)
|
@@ -123,10 +125,9 @@
|
|
123
125
|
/**
|
124
126
|
* Handle updating of values.
|
125
127
|
*
|
126
|
-
* @param {Event} event The event that fired.
|
127
128
|
* @private
|
128
129
|
*/
|
129
|
-
MaterialSlider.prototype.updateValueStyles_ = function(
|
130
|
+
MaterialSlider.prototype.updateValueStyles_ = function() {
|
130
131
|
// Calculate and apply percentages to div structure behind slider.
|
131
132
|
var fraction = (this.element_.value - this.element_.min) /
|
132
133
|
(this.element_.max - this.element_.min);
|
@@ -155,6 +156,7 @@
|
|
155
156
|
MaterialSlider.prototype.disable = function() {
|
156
157
|
this.element_.disabled = true;
|
157
158
|
};
|
159
|
+
MaterialSlider.prototype['disable'] = MaterialSlider.prototype.disable;
|
158
160
|
|
159
161
|
/**
|
160
162
|
* Enable slider.
|
@@ -165,11 +167,12 @@
|
|
165
167
|
|
166
168
|
this.element_.disabled = false;
|
167
169
|
};
|
170
|
+
MaterialSlider.prototype['enable'] = MaterialSlider.prototype.enable;
|
168
171
|
|
169
172
|
/**
|
170
173
|
* Update slider value.
|
171
174
|
*
|
172
|
-
* @param {
|
175
|
+
* @param {number} value The value to which to set the control (optional).
|
173
176
|
* @public
|
174
177
|
*/
|
175
178
|
MaterialSlider.prototype.change = function(value) {
|
@@ -179,6 +182,7 @@
|
|
179
182
|
}
|
180
183
|
this.updateValueStyles_();
|
181
184
|
};
|
185
|
+
MaterialSlider.prototype['change'] = MaterialSlider.prototype.change;
|
182
186
|
|
183
187
|
/**
|
184
188
|
* Initialize element.
|