materialize-sass 0.97.0 → 1.0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitattributes +1 -0
- data/.gitignore +3 -0
- data/README.md +48 -10
- data/Rakefile +129 -1
- data/assets/javascripts/materialize/anime.min.js +417 -0
- data/assets/javascripts/materialize/autocomplete.js +504 -0
- data/assets/javascripts/materialize/buttons.js +409 -0
- data/assets/javascripts/materialize/cards.js +34 -0
- data/assets/javascripts/materialize/carousel.js +797 -0
- data/assets/javascripts/materialize/cash.js +990 -0
- data/assets/javascripts/materialize/characterCounter.js +180 -0
- data/assets/javascripts/materialize/chips.js +564 -0
- data/assets/javascripts/materialize/collapsible.js +337 -0
- data/assets/javascripts/materialize/component.js +57 -0
- data/assets/javascripts/materialize/datepicker.js +935 -0
- data/assets/javascripts/materialize/dropdown.js +659 -0
- data/assets/javascripts/materialize/extras/nouislider.js +2147 -0
- data/assets/javascripts/materialize/extras/nouislider.min.js +1 -0
- data/assets/javascripts/materialize/forms.js +244 -0
- data/assets/javascripts/materialize/global.js +408 -0
- data/assets/javascripts/materialize/materialbox.js +513 -0
- data/assets/javascripts/materialize/modal.js +449 -0
- data/assets/javascripts/materialize/parallax.js +173 -0
- data/assets/javascripts/materialize/pushpin.js +179 -0
- data/assets/javascripts/materialize/range.js +310 -0
- data/assets/javascripts/materialize/scrollspy.js +328 -0
- data/assets/javascripts/materialize/select.js +497 -0
- data/assets/javascripts/materialize/sidenav.js +655 -0
- data/assets/javascripts/materialize/slider.js +424 -0
- data/assets/javascripts/materialize/tabs.js +476 -0
- data/assets/javascripts/materialize/tapTarget.js +364 -0
- data/assets/javascripts/materialize/timepicker.js +647 -0
- data/assets/javascripts/materialize/toasts.js +355 -0
- data/assets/javascripts/materialize/tooltip.js +351 -0
- data/{app/assets → assets}/javascripts/materialize/waves.js +42 -47
- data/assets/javascripts/materialize-sprockets.js +29 -0
- data/assets/javascripts/materialize.js +12374 -0
- data/assets/stylesheets/materialize/components/_badges.scss +55 -0
- data/assets/stylesheets/materialize/components/_buttons.scss +322 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_cards.scss +72 -29
- data/assets/stylesheets/materialize/components/_carousel.scss +90 -0
- data/assets/stylesheets/materialize/components/_chips.scss +90 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_collapsible.scss +23 -17
- data/assets/stylesheets/materialize/components/_color-classes.scss +32 -0
- data/{app/assets/stylesheets/materialize/components/_color.scss → assets/stylesheets/materialize/components/_color-variables.scss} +22 -64
- data/assets/stylesheets/materialize/components/_datepicker.scss +191 -0
- data/assets/stylesheets/materialize/components/_dropdown.scss +85 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_global.scss +197 -144
- data/{app/assets → assets}/stylesheets/materialize/components/_grid.scss +57 -18
- data/assets/stylesheets/materialize/components/_icons-material-design.scss +5 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_materialbox.scss +15 -13
- data/{app/assets → assets}/stylesheets/materialize/components/_modal.scss +18 -14
- data/{app/assets → assets}/stylesheets/materialize/components/_navbar.scss +89 -25
- data/assets/stylesheets/materialize/components/_normalize.scss +447 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_preloader.scss +5 -3
- data/assets/stylesheets/materialize/components/_pulse.scss +34 -0
- data/assets/stylesheets/materialize/components/_sidenav.scss +208 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_slider.scss +2 -2
- data/{app/assets → assets}/stylesheets/materialize/components/_table_of_contents.scss +5 -5
- data/assets/stylesheets/materialize/components/_tabs.scss +99 -0
- data/assets/stylesheets/materialize/components/_tapTarget.scss +103 -0
- data/assets/stylesheets/materialize/components/_timepicker.scss +183 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_toast.scss +17 -22
- data/assets/stylesheets/materialize/components/_tooltip.scss +32 -0
- data/assets/stylesheets/materialize/components/_transitions.scss +13 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_typography.scss +11 -9
- data/assets/stylesheets/materialize/components/_variables.scss +349 -0
- data/assets/stylesheets/materialize/components/_waves.scss +114 -0
- data/assets/stylesheets/materialize/components/forms/_checkboxes.scss +200 -0
- data/assets/stylesheets/materialize/components/forms/_file-input.scss +44 -0
- data/assets/stylesheets/materialize/components/forms/_forms.scss +22 -0
- data/assets/stylesheets/materialize/components/forms/_input-fields.scss +354 -0
- data/assets/stylesheets/materialize/components/forms/_radio-buttons.scss +115 -0
- data/assets/stylesheets/materialize/components/forms/_range.scss +161 -0
- data/assets/stylesheets/materialize/components/forms/_select.scss +190 -0
- data/assets/stylesheets/materialize/components/forms/_switches.scss +89 -0
- data/assets/stylesheets/materialize/extras/nouislider.css +406 -0
- data/{app/assets → assets}/stylesheets/materialize.scss +13 -10
- data/lib/materialize-sass/engine.rb +11 -6
- data/lib/materialize-sass/helpers.rb +38 -0
- data/lib/materialize-sass/version.rb +1 -1
- data/lib/materialize-sass.rb +13 -28
- data/materialize-sass.gemspec +5 -5
- metadata +97 -105
- data/app/assets/fonts/material-design-icons/LICENSE.txt +0 -428
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.eot +0 -0
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.svg +0 -769
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.ttf +0 -0
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff +0 -0
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Bold.ttf +0 -0
- data/app/assets/fonts/roboto/Roboto-Bold.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Light.ttf +0 -0
- data/app/assets/fonts/roboto/Roboto-Light.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Medium.ttf +0 -0
- data/app/assets/fonts/roboto/Roboto-Medium.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Regular.ttf +0 -0
- data/app/assets/fonts/roboto/Roboto-Regular.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Thin.ttf +0 -0
- data/app/assets/fonts/roboto/Roboto-Thin.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
- data/app/assets/javascripts/materialize/animation.js +0 -9
- data/app/assets/javascripts/materialize/buttons.js +0 -61
- data/app/assets/javascripts/materialize/cards.js +0 -27
- data/app/assets/javascripts/materialize/character_counter.js +0 -59
- data/app/assets/javascripts/materialize/collapsible.js +0 -139
- data/app/assets/javascripts/materialize/date_picker/picker.date.js +0 -1430
- data/app/assets/javascripts/materialize/date_picker/picker.js +0 -1123
- data/app/assets/javascripts/materialize/dropdown.js +0 -178
- data/app/assets/javascripts/materialize/forms.js +0 -456
- data/app/assets/javascripts/materialize/global.js +0 -36
- data/app/assets/javascripts/materialize/hammer.min.js +0 -1
- data/app/assets/javascripts/materialize/init.js +0 -136
- data/app/assets/javascripts/materialize/jquery.easing.1.3.js +0 -205
- data/app/assets/javascripts/materialize/jquery.hammer.js +0 -33
- data/app/assets/javascripts/materialize/jquery.timeago.min.js +0 -1
- data/app/assets/javascripts/materialize/leanModal.js +0 -178
- data/app/assets/javascripts/materialize/materialbox.js +0 -249
- data/app/assets/javascripts/materialize/parallax.js +0 -58
- data/app/assets/javascripts/materialize/prism.js +0 -8
- data/app/assets/javascripts/materialize/pushpin.js +0 -62
- data/app/assets/javascripts/materialize/scrollFire.js +0 -44
- data/app/assets/javascripts/materialize/scrollspy.js +0 -284
- data/app/assets/javascripts/materialize/sideNav.js +0 -312
- data/app/assets/javascripts/materialize/slider.js +0 -301
- data/app/assets/javascripts/materialize/tabs.js +0 -136
- data/app/assets/javascripts/materialize/toasts.js +0 -125
- data/app/assets/javascripts/materialize/tooltip.js +0 -166
- data/app/assets/javascripts/materialize/transitions.js +0 -154
- data/app/assets/javascripts/materialize/velocity.min.js +0 -4
- data/app/assets/javascripts/materialize-sprockets.js +0 -27
- data/app/assets/javascripts/materialize.js +0 -6159
- data/app/assets/stylesheets/materialize/components/_buttons.scss +0 -157
- data/app/assets/stylesheets/materialize/components/_dropdown.scss +0 -40
- data/app/assets/stylesheets/materialize/components/_form.scss +0 -886
- data/app/assets/stylesheets/materialize/components/_icons-material-design.scss +0 -3257
- data/app/assets/stylesheets/materialize/components/_mixins.scss +0 -5
- data/app/assets/stylesheets/materialize/components/_normalize.scss +0 -427
- data/app/assets/stylesheets/materialize/components/_prefixer.scss +0 -376
- data/app/assets/stylesheets/materialize/components/_roboto.scss +0 -38
- data/app/assets/stylesheets/materialize/components/_sideNav.scss +0 -111
- data/app/assets/stylesheets/materialize/components/_tabs.scss +0 -47
- data/app/assets/stylesheets/materialize/components/_tooltip.scss +0 -34
- data/app/assets/stylesheets/materialize/components/_variables.scss +0 -152
- data/app/assets/stylesheets/materialize/components/_waves.scss +0 -167
- data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +0 -435
- data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +0 -201
- data/app/assets/stylesheets/materialize/components/date_picker/_default.time.scss +0 -125
@@ -0,0 +1,179 @@
|
|
1
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
2
|
+
|
3
|
+
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
|
4
|
+
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6
|
+
|
7
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
8
|
+
|
9
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
10
|
+
|
11
|
+
(function ($) {
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
var _defaults = {
|
15
|
+
top: 0,
|
16
|
+
bottom: Infinity,
|
17
|
+
offset: 0,
|
18
|
+
onPositionChange: null
|
19
|
+
};
|
20
|
+
|
21
|
+
/**
|
22
|
+
* @class
|
23
|
+
*
|
24
|
+
*/
|
25
|
+
|
26
|
+
var Pushpin = function (_Component) {
|
27
|
+
_inherits(Pushpin, _Component);
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Construct Pushpin instance
|
31
|
+
* @constructor
|
32
|
+
* @param {Element} el
|
33
|
+
* @param {Object} options
|
34
|
+
*/
|
35
|
+
function Pushpin(el, options) {
|
36
|
+
_classCallCheck(this, Pushpin);
|
37
|
+
|
38
|
+
var _this = _possibleConstructorReturn(this, (Pushpin.__proto__ || Object.getPrototypeOf(Pushpin)).call(this, Pushpin, el, options));
|
39
|
+
|
40
|
+
_this.el.M_Pushpin = _this;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Options for the modal
|
44
|
+
* @member Pushpin#options
|
45
|
+
*/
|
46
|
+
_this.options = $.extend({}, Pushpin.defaults, options);
|
47
|
+
|
48
|
+
_this.originalOffset = _this.el.offsetTop;
|
49
|
+
Pushpin._pushpins.push(_this);
|
50
|
+
_this._setupEventHandlers();
|
51
|
+
_this._updatePosition();
|
52
|
+
return _this;
|
53
|
+
}
|
54
|
+
|
55
|
+
_createClass(Pushpin, [{
|
56
|
+
key: 'destroy',
|
57
|
+
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Teardown component
|
61
|
+
*/
|
62
|
+
value: function destroy() {
|
63
|
+
this.el.style.top = null;
|
64
|
+
this._removePinClasses();
|
65
|
+
|
66
|
+
// Remove pushpin Inst
|
67
|
+
var index = Pushpin._pushpins.indexOf(this);
|
68
|
+
Pushpin._pushpins.splice(index, 1);
|
69
|
+
if (Pushpin._pushpins.length === 0) {
|
70
|
+
this._removeEventHandlers();
|
71
|
+
}
|
72
|
+
this.el.M_Pushpin = undefined;
|
73
|
+
}
|
74
|
+
}, {
|
75
|
+
key: '_setupEventHandlers',
|
76
|
+
value: function _setupEventHandlers() {
|
77
|
+
document.addEventListener('scroll', Pushpin._updateElements);
|
78
|
+
}
|
79
|
+
}, {
|
80
|
+
key: '_removeEventHandlers',
|
81
|
+
value: function _removeEventHandlers() {
|
82
|
+
document.removeEventListener('scroll', Pushpin._updateElements);
|
83
|
+
}
|
84
|
+
}, {
|
85
|
+
key: '_updatePosition',
|
86
|
+
value: function _updatePosition() {
|
87
|
+
var scrolled = M.getDocumentScrollTop() + this.options.offset;
|
88
|
+
|
89
|
+
if (this.options.top <= scrolled && this.options.bottom >= scrolled && !this.el.classList.contains('pinned')) {
|
90
|
+
this._removePinClasses();
|
91
|
+
this.el.style.top = this.options.offset + 'px';
|
92
|
+
this.el.classList.add('pinned');
|
93
|
+
|
94
|
+
// onPositionChange callback
|
95
|
+
if (typeof this.options.onPositionChange === 'function') {
|
96
|
+
this.options.onPositionChange.call(this, 'pinned');
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
// Add pin-top (when scrolled position is above top)
|
101
|
+
if (scrolled < this.options.top && !this.el.classList.contains('pin-top')) {
|
102
|
+
this._removePinClasses();
|
103
|
+
this.el.style.top = 0;
|
104
|
+
this.el.classList.add('pin-top');
|
105
|
+
|
106
|
+
// onPositionChange callback
|
107
|
+
if (typeof this.options.onPositionChange === 'function') {
|
108
|
+
this.options.onPositionChange.call(this, 'pin-top');
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
// Add pin-bottom (when scrolled position is below bottom)
|
113
|
+
if (scrolled > this.options.bottom && !this.el.classList.contains('pin-bottom')) {
|
114
|
+
this._removePinClasses();
|
115
|
+
this.el.classList.add('pin-bottom');
|
116
|
+
this.el.style.top = this.options.bottom - this.originalOffset + 'px';
|
117
|
+
|
118
|
+
// onPositionChange callback
|
119
|
+
if (typeof this.options.onPositionChange === 'function') {
|
120
|
+
this.options.onPositionChange.call(this, 'pin-bottom');
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
}, {
|
125
|
+
key: '_removePinClasses',
|
126
|
+
value: function _removePinClasses() {
|
127
|
+
// IE 11 bug (can't remove multiple classes in one line)
|
128
|
+
this.el.classList.remove('pin-top');
|
129
|
+
this.el.classList.remove('pinned');
|
130
|
+
this.el.classList.remove('pin-bottom');
|
131
|
+
}
|
132
|
+
}], [{
|
133
|
+
key: 'init',
|
134
|
+
value: function init(els, options) {
|
135
|
+
return _get(Pushpin.__proto__ || Object.getPrototypeOf(Pushpin), 'init', this).call(this, this, els, options);
|
136
|
+
}
|
137
|
+
|
138
|
+
/**
|
139
|
+
* Get Instance
|
140
|
+
*/
|
141
|
+
|
142
|
+
}, {
|
143
|
+
key: 'getInstance',
|
144
|
+
value: function getInstance(el) {
|
145
|
+
var domElem = !!el.jquery ? el[0] : el;
|
146
|
+
return domElem.M_Pushpin;
|
147
|
+
}
|
148
|
+
}, {
|
149
|
+
key: '_updateElements',
|
150
|
+
value: function _updateElements() {
|
151
|
+
for (var elIndex in Pushpin._pushpins) {
|
152
|
+
var pInstance = Pushpin._pushpins[elIndex];
|
153
|
+
pInstance._updatePosition();
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}, {
|
157
|
+
key: 'defaults',
|
158
|
+
get: function () {
|
159
|
+
return _defaults;
|
160
|
+
}
|
161
|
+
}]);
|
162
|
+
|
163
|
+
return Pushpin;
|
164
|
+
}(Component);
|
165
|
+
|
166
|
+
/**
|
167
|
+
* @static
|
168
|
+
* @memberof Pushpin
|
169
|
+
*/
|
170
|
+
|
171
|
+
|
172
|
+
Pushpin._pushpins = [];
|
173
|
+
|
174
|
+
M.Pushpin = Pushpin;
|
175
|
+
|
176
|
+
if (M.jQueryLoaded) {
|
177
|
+
M.initializeJqueryWrapper(Pushpin, 'pushpin', 'M_Pushpin');
|
178
|
+
}
|
179
|
+
})(cash);
|
@@ -0,0 +1,310 @@
|
|
1
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
2
|
+
|
3
|
+
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
|
4
|
+
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6
|
+
|
7
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
8
|
+
|
9
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
10
|
+
|
11
|
+
(function ($, anim) {
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
var _defaults = {};
|
15
|
+
|
16
|
+
/**
|
17
|
+
* @class
|
18
|
+
*
|
19
|
+
*/
|
20
|
+
|
21
|
+
var Range = function (_Component) {
|
22
|
+
_inherits(Range, _Component);
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Construct Range instance
|
26
|
+
* @constructor
|
27
|
+
* @param {Element} el
|
28
|
+
* @param {Object} options
|
29
|
+
*/
|
30
|
+
function Range(el, options) {
|
31
|
+
_classCallCheck(this, Range);
|
32
|
+
|
33
|
+
var _this = _possibleConstructorReturn(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this, Range, el, options));
|
34
|
+
|
35
|
+
_this.el.M_Range = _this;
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Options for the range
|
39
|
+
* @member Range#options
|
40
|
+
*/
|
41
|
+
_this.options = $.extend({}, Range.defaults, options);
|
42
|
+
|
43
|
+
_this._mousedown = false;
|
44
|
+
|
45
|
+
// Setup
|
46
|
+
_this._setupThumb();
|
47
|
+
|
48
|
+
_this._setupEventHandlers();
|
49
|
+
return _this;
|
50
|
+
}
|
51
|
+
|
52
|
+
_createClass(Range, [{
|
53
|
+
key: 'destroy',
|
54
|
+
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Teardown component
|
58
|
+
*/
|
59
|
+
value: function destroy() {
|
60
|
+
this._removeEventHandlers();
|
61
|
+
this._removeThumb();
|
62
|
+
this.el.M_Range = undefined;
|
63
|
+
}
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Setup Event Handlers
|
67
|
+
*/
|
68
|
+
|
69
|
+
}, {
|
70
|
+
key: '_setupEventHandlers',
|
71
|
+
value: function _setupEventHandlers() {
|
72
|
+
this._handleRangeChangeBound = this._handleRangeChange.bind(this);
|
73
|
+
this._handleRangeMousedownTouchstartBound = this._handleRangeMousedownTouchstart.bind(this);
|
74
|
+
this._handleRangeInputMousemoveTouchmoveBound = this._handleRangeInputMousemoveTouchmove.bind(this);
|
75
|
+
this._handleRangeMouseupTouchendBound = this._handleRangeMouseupTouchend.bind(this);
|
76
|
+
this._handleRangeBlurMouseoutTouchleaveBound = this._handleRangeBlurMouseoutTouchleave.bind(this);
|
77
|
+
|
78
|
+
this.el.addEventListener('change', this._handleRangeChangeBound);
|
79
|
+
|
80
|
+
this.el.addEventListener('mousedown', this._handleRangeMousedownTouchstartBound);
|
81
|
+
this.el.addEventListener('touchstart', this._handleRangeMousedownTouchstartBound);
|
82
|
+
|
83
|
+
this.el.addEventListener('input', this._handleRangeInputMousemoveTouchmoveBound);
|
84
|
+
this.el.addEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound);
|
85
|
+
this.el.addEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound);
|
86
|
+
|
87
|
+
this.el.addEventListener('mouseup', this._handleRangeMouseupTouchendBound);
|
88
|
+
this.el.addEventListener('touchend', this._handleRangeMouseupTouchendBound);
|
89
|
+
|
90
|
+
this.el.addEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound);
|
91
|
+
this.el.addEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound);
|
92
|
+
this.el.addEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound);
|
93
|
+
}
|
94
|
+
|
95
|
+
/**
|
96
|
+
* Remove Event Handlers
|
97
|
+
*/
|
98
|
+
|
99
|
+
}, {
|
100
|
+
key: '_removeEventHandlers',
|
101
|
+
value: function _removeEventHandlers() {
|
102
|
+
this.el.removeEventListener('change', this._handleRangeChangeBound);
|
103
|
+
|
104
|
+
this.el.removeEventListener('mousedown', this._handleRangeMousedownTouchstartBound);
|
105
|
+
this.el.removeEventListener('touchstart', this._handleRangeMousedownTouchstartBound);
|
106
|
+
|
107
|
+
this.el.removeEventListener('input', this._handleRangeInputMousemoveTouchmoveBound);
|
108
|
+
this.el.removeEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound);
|
109
|
+
this.el.removeEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound);
|
110
|
+
|
111
|
+
this.el.removeEventListener('mouseup', this._handleRangeMouseupTouchendBound);
|
112
|
+
this.el.removeEventListener('touchend', this._handleRangeMouseupTouchendBound);
|
113
|
+
|
114
|
+
this.el.removeEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound);
|
115
|
+
this.el.removeEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound);
|
116
|
+
this.el.removeEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound);
|
117
|
+
}
|
118
|
+
|
119
|
+
/**
|
120
|
+
* Handle Range Change
|
121
|
+
* @param {Event} e
|
122
|
+
*/
|
123
|
+
|
124
|
+
}, {
|
125
|
+
key: '_handleRangeChange',
|
126
|
+
value: function _handleRangeChange() {
|
127
|
+
$(this.value).html(this.$el.val());
|
128
|
+
|
129
|
+
if (!$(this.thumb).hasClass('active')) {
|
130
|
+
this._showRangeBubble();
|
131
|
+
}
|
132
|
+
|
133
|
+
var offsetLeft = this._calcRangeOffset();
|
134
|
+
$(this.thumb).addClass('active').css('left', offsetLeft + 'px');
|
135
|
+
}
|
136
|
+
|
137
|
+
/**
|
138
|
+
* Handle Range Mousedown and Touchstart
|
139
|
+
* @param {Event} e
|
140
|
+
*/
|
141
|
+
|
142
|
+
}, {
|
143
|
+
key: '_handleRangeMousedownTouchstart',
|
144
|
+
value: function _handleRangeMousedownTouchstart(e) {
|
145
|
+
// Set indicator value
|
146
|
+
$(this.value).html(this.$el.val());
|
147
|
+
|
148
|
+
this._mousedown = true;
|
149
|
+
this.$el.addClass('active');
|
150
|
+
|
151
|
+
if (!$(this.thumb).hasClass('active')) {
|
152
|
+
this._showRangeBubble();
|
153
|
+
}
|
154
|
+
|
155
|
+
if (e.type !== 'input') {
|
156
|
+
var offsetLeft = this._calcRangeOffset();
|
157
|
+
$(this.thumb).addClass('active').css('left', offsetLeft + 'px');
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
/**
|
162
|
+
* Handle Range Input, Mousemove and Touchmove
|
163
|
+
*/
|
164
|
+
|
165
|
+
}, {
|
166
|
+
key: '_handleRangeInputMousemoveTouchmove',
|
167
|
+
value: function _handleRangeInputMousemoveTouchmove() {
|
168
|
+
if (this._mousedown) {
|
169
|
+
if (!$(this.thumb).hasClass('active')) {
|
170
|
+
this._showRangeBubble();
|
171
|
+
}
|
172
|
+
|
173
|
+
var offsetLeft = this._calcRangeOffset();
|
174
|
+
$(this.thumb).addClass('active').css('left', offsetLeft + 'px');
|
175
|
+
$(this.value).html(this.$el.val());
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
/**
|
180
|
+
* Handle Range Mouseup and Touchend
|
181
|
+
*/
|
182
|
+
|
183
|
+
}, {
|
184
|
+
key: '_handleRangeMouseupTouchend',
|
185
|
+
value: function _handleRangeMouseupTouchend() {
|
186
|
+
this._mousedown = false;
|
187
|
+
this.$el.removeClass('active');
|
188
|
+
}
|
189
|
+
|
190
|
+
/**
|
191
|
+
* Handle Range Blur, Mouseout and Touchleave
|
192
|
+
*/
|
193
|
+
|
194
|
+
}, {
|
195
|
+
key: '_handleRangeBlurMouseoutTouchleave',
|
196
|
+
value: function _handleRangeBlurMouseoutTouchleave() {
|
197
|
+
if (!this._mousedown) {
|
198
|
+
var paddingLeft = parseInt(this.$el.css('padding-left'));
|
199
|
+
var marginLeft = 7 + paddingLeft + 'px';
|
200
|
+
|
201
|
+
if ($(this.thumb).hasClass('active')) {
|
202
|
+
anim.remove(this.thumb);
|
203
|
+
anim({
|
204
|
+
targets: this.thumb,
|
205
|
+
height: 0,
|
206
|
+
width: 0,
|
207
|
+
top: 10,
|
208
|
+
easing: 'easeOutQuad',
|
209
|
+
marginLeft: marginLeft,
|
210
|
+
duration: 100
|
211
|
+
});
|
212
|
+
}
|
213
|
+
$(this.thumb).removeClass('active');
|
214
|
+
}
|
215
|
+
}
|
216
|
+
|
217
|
+
/**
|
218
|
+
* Setup dropdown
|
219
|
+
*/
|
220
|
+
|
221
|
+
}, {
|
222
|
+
key: '_setupThumb',
|
223
|
+
value: function _setupThumb() {
|
224
|
+
this.thumb = document.createElement('span');
|
225
|
+
this.value = document.createElement('span');
|
226
|
+
$(this.thumb).addClass('thumb');
|
227
|
+
$(this.value).addClass('value');
|
228
|
+
$(this.thumb).append(this.value);
|
229
|
+
this.$el.after(this.thumb);
|
230
|
+
}
|
231
|
+
|
232
|
+
/**
|
233
|
+
* Remove dropdown
|
234
|
+
*/
|
235
|
+
|
236
|
+
}, {
|
237
|
+
key: '_removeThumb',
|
238
|
+
value: function _removeThumb() {
|
239
|
+
$(this.thumb).remove();
|
240
|
+
}
|
241
|
+
|
242
|
+
/**
|
243
|
+
* morph thumb into bubble
|
244
|
+
*/
|
245
|
+
|
246
|
+
}, {
|
247
|
+
key: '_showRangeBubble',
|
248
|
+
value: function _showRangeBubble() {
|
249
|
+
var paddingLeft = parseInt($(this.thumb).parent().css('padding-left'));
|
250
|
+
var marginLeft = -7 + paddingLeft + 'px'; // TODO: fix magic number?
|
251
|
+
anim.remove(this.thumb);
|
252
|
+
anim({
|
253
|
+
targets: this.thumb,
|
254
|
+
height: 30,
|
255
|
+
width: 30,
|
256
|
+
top: -30,
|
257
|
+
marginLeft: marginLeft,
|
258
|
+
duration: 300,
|
259
|
+
easing: 'easeOutQuint'
|
260
|
+
});
|
261
|
+
}
|
262
|
+
|
263
|
+
/**
|
264
|
+
* Calculate the offset of the thumb
|
265
|
+
* @return {Number} offset in pixels
|
266
|
+
*/
|
267
|
+
|
268
|
+
}, {
|
269
|
+
key: '_calcRangeOffset',
|
270
|
+
value: function _calcRangeOffset() {
|
271
|
+
var width = this.$el.width() - 15;
|
272
|
+
var max = parseFloat(this.$el.attr('max')) || 100; // Range default max
|
273
|
+
var min = parseFloat(this.$el.attr('min')) || 0; // Range default min
|
274
|
+
var percent = (parseFloat(this.$el.val()) - min) / (max - min);
|
275
|
+
return percent * width;
|
276
|
+
}
|
277
|
+
}], [{
|
278
|
+
key: 'init',
|
279
|
+
value: function init(els, options) {
|
280
|
+
return _get(Range.__proto__ || Object.getPrototypeOf(Range), 'init', this).call(this, this, els, options);
|
281
|
+
}
|
282
|
+
|
283
|
+
/**
|
284
|
+
* Get Instance
|
285
|
+
*/
|
286
|
+
|
287
|
+
}, {
|
288
|
+
key: 'getInstance',
|
289
|
+
value: function getInstance(el) {
|
290
|
+
var domElem = !!el.jquery ? el[0] : el;
|
291
|
+
return domElem.M_Range;
|
292
|
+
}
|
293
|
+
}, {
|
294
|
+
key: 'defaults',
|
295
|
+
get: function () {
|
296
|
+
return _defaults;
|
297
|
+
}
|
298
|
+
}]);
|
299
|
+
|
300
|
+
return Range;
|
301
|
+
}(Component);
|
302
|
+
|
303
|
+
M.Range = Range;
|
304
|
+
|
305
|
+
if (M.jQueryLoaded) {
|
306
|
+
M.initializeJqueryWrapper(Range, 'range', 'M_Range');
|
307
|
+
}
|
308
|
+
|
309
|
+
Range.init($('input[type=range]'));
|
310
|
+
})(cash, M.anime);
|