@materializecss/materialize 1.1.0 → 1.2.1

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.
Files changed (83) hide show
  1. package/Gruntfile.js +38 -24
  2. package/LICENSE +21 -21
  3. package/README.md +91 -97
  4. package/dist/css/materialize.css +8608 -8631
  5. package/dist/css/materialize.min.css +12 -12
  6. package/dist/js/materialize.js +12816 -12669
  7. package/dist/js/materialize.min.js +6 -6
  8. package/extras/noUiSlider/nouislider.css +404 -406
  9. package/extras/noUiSlider/nouislider.js +2147 -2147
  10. package/extras/noUiSlider/nouislider.min.js +0 -0
  11. package/js/anime.min.js +34 -34
  12. package/js/autocomplete.js +479 -479
  13. package/js/buttons.js +354 -354
  14. package/js/cards.js +40 -40
  15. package/js/carousel.js +732 -732
  16. package/js/cash.js +960 -960
  17. package/js/characterCounter.js +136 -136
  18. package/js/chips.js +486 -486
  19. package/js/collapsible.js +275 -275
  20. package/js/component.js +44 -44
  21. package/js/datepicker.js +983 -983
  22. package/js/dropdown.js +669 -669
  23. package/js/forms.js +285 -275
  24. package/js/global.js +428 -424
  25. package/js/materialbox.js +453 -453
  26. package/js/modal.js +382 -382
  27. package/js/parallax.js +138 -138
  28. package/js/pushpin.js +148 -148
  29. package/js/range.js +263 -263
  30. package/js/scrollspy.js +295 -295
  31. package/js/select.js +391 -310
  32. package/js/sidenav.js +583 -583
  33. package/js/slider.js +359 -359
  34. package/js/tabs.js +402 -402
  35. package/js/tapTarget.js +315 -315
  36. package/js/timepicker.js +712 -648
  37. package/js/toasts.js +325 -322
  38. package/js/tooltip.js +320 -320
  39. package/js/waves.js +614 -614
  40. package/package.json +87 -82
  41. package/sass/_style.scss +929 -929
  42. package/sass/components/_badges.scss +55 -55
  43. package/sass/components/_buttons.scss +322 -322
  44. package/sass/components/_cards.scss +195 -195
  45. package/sass/components/_carousel.scss +90 -90
  46. package/sass/components/_chips.scss +96 -96
  47. package/sass/components/_collapsible.scss +91 -91
  48. package/sass/components/_collection.scss +106 -106
  49. package/sass/components/_color-classes.scss +32 -32
  50. package/sass/components/_color-variables.scss +370 -370
  51. package/sass/components/_datepicker.scss +191 -191
  52. package/sass/components/_dropdown.scss +84 -84
  53. package/sass/components/_global.scss +646 -642
  54. package/sass/components/_grid.scss +158 -158
  55. package/sass/components/_icons-material-design.scss +5 -5
  56. package/sass/components/_materialbox.scss +42 -42
  57. package/sass/components/_modal.scss +97 -97
  58. package/sass/components/_navbar.scss +208 -208
  59. package/sass/components/_normalize.scss +447 -447
  60. package/sass/components/_preloader.scss +334 -334
  61. package/sass/components/_pulse.scss +34 -34
  62. package/sass/components/_sidenav.scss +214 -214
  63. package/sass/components/_slider.scss +91 -91
  64. package/sass/components/_table_of_contents.scss +33 -33
  65. package/sass/components/_tabs.scss +99 -99
  66. package/sass/components/_tapTarget.scss +103 -103
  67. package/sass/components/_timepicker.scss +199 -183
  68. package/sass/components/_toast.scss +58 -58
  69. package/sass/components/_tooltip.scss +32 -32
  70. package/sass/components/_transitions.scss +12 -12
  71. package/sass/components/_typography.scss +62 -62
  72. package/sass/components/_variables.scss +352 -352
  73. package/sass/components/_waves.scss +187 -187
  74. package/sass/components/forms/_checkboxes.scss +200 -200
  75. package/sass/components/forms/_file-input.scss +44 -44
  76. package/sass/components/forms/_forms.scss +22 -22
  77. package/sass/components/forms/_input-fields.scss +388 -379
  78. package/sass/components/forms/_radio-buttons.scss +115 -115
  79. package/sass/components/forms/_range.scss +161 -161
  80. package/sass/components/forms/_select.scss +199 -199
  81. package/sass/components/forms/_switches.scss +91 -91
  82. package/sass/ghpages-materialize.scss +7 -7
  83. package/sass/materialize.scss +42 -42
package/js/range.js CHANGED
@@ -1,263 +1,263 @@
1
- (function($, anim) {
2
- 'use strict';
3
-
4
- let _defaults = {};
5
-
6
- /**
7
- * @class
8
- *
9
- */
10
- class Range extends Component {
11
- /**
12
- * Construct Range instance
13
- * @constructor
14
- * @param {Element} el
15
- * @param {Object} options
16
- */
17
- constructor(el, options) {
18
- super(Range, el, options);
19
-
20
- this.el.M_Range = this;
21
-
22
- /**
23
- * Options for the range
24
- * @member Range#options
25
- */
26
- this.options = $.extend({}, Range.defaults, options);
27
-
28
- this._mousedown = false;
29
-
30
- // Setup
31
- this._setupThumb();
32
-
33
- this._setupEventHandlers();
34
- }
35
-
36
- static get defaults() {
37
- return _defaults;
38
- }
39
-
40
- static init(els, options) {
41
- return super.init(this, els, options);
42
- }
43
-
44
- /**
45
- * Get Instance
46
- */
47
- static getInstance(el) {
48
- let domElem = !!el.jquery ? el[0] : el;
49
- return domElem.M_Range;
50
- }
51
-
52
- /**
53
- * Teardown component
54
- */
55
- destroy() {
56
- this._removeEventHandlers();
57
- this._removeThumb();
58
- this.el.M_Range = undefined;
59
- }
60
-
61
- /**
62
- * Setup Event Handlers
63
- */
64
- _setupEventHandlers() {
65
- this._handleRangeChangeBound = this._handleRangeChange.bind(this);
66
- this._handleRangeMousedownTouchstartBound = this._handleRangeMousedownTouchstart.bind(this);
67
- this._handleRangeInputMousemoveTouchmoveBound = this._handleRangeInputMousemoveTouchmove.bind(
68
- this
69
- );
70
- this._handleRangeMouseupTouchendBound = this._handleRangeMouseupTouchend.bind(this);
71
- this._handleRangeBlurMouseoutTouchleaveBound = this._handleRangeBlurMouseoutTouchleave.bind(
72
- this
73
- );
74
-
75
- this.el.addEventListener('change', this._handleRangeChangeBound);
76
-
77
- this.el.addEventListener('mousedown', this._handleRangeMousedownTouchstartBound);
78
- this.el.addEventListener('touchstart', this._handleRangeMousedownTouchstartBound);
79
-
80
- this.el.addEventListener('input', this._handleRangeInputMousemoveTouchmoveBound);
81
- this.el.addEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound);
82
- this.el.addEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound);
83
-
84
- this.el.addEventListener('mouseup', this._handleRangeMouseupTouchendBound);
85
- this.el.addEventListener('touchend', this._handleRangeMouseupTouchendBound);
86
-
87
- this.el.addEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound);
88
- this.el.addEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound);
89
- this.el.addEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound);
90
- }
91
-
92
- /**
93
- * Remove Event Handlers
94
- */
95
- _removeEventHandlers() {
96
- this.el.removeEventListener('change', this._handleRangeChangeBound);
97
-
98
- this.el.removeEventListener('mousedown', this._handleRangeMousedownTouchstartBound);
99
- this.el.removeEventListener('touchstart', this._handleRangeMousedownTouchstartBound);
100
-
101
- this.el.removeEventListener('input', this._handleRangeInputMousemoveTouchmoveBound);
102
- this.el.removeEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound);
103
- this.el.removeEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound);
104
-
105
- this.el.removeEventListener('mouseup', this._handleRangeMouseupTouchendBound);
106
- this.el.removeEventListener('touchend', this._handleRangeMouseupTouchendBound);
107
-
108
- this.el.removeEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound);
109
- this.el.removeEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound);
110
- this.el.removeEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound);
111
- }
112
-
113
- /**
114
- * Handle Range Change
115
- * @param {Event} e
116
- */
117
- _handleRangeChange() {
118
- $(this.value).html(this.$el.val());
119
-
120
- if (!$(this.thumb).hasClass('active')) {
121
- this._showRangeBubble();
122
- }
123
-
124
- let offsetLeft = this._calcRangeOffset();
125
- $(this.thumb)
126
- .addClass('active')
127
- .css('left', offsetLeft + 'px');
128
- }
129
-
130
- /**
131
- * Handle Range Mousedown and Touchstart
132
- * @param {Event} e
133
- */
134
- _handleRangeMousedownTouchstart(e) {
135
- // Set indicator value
136
- $(this.value).html(this.$el.val());
137
-
138
- this._mousedown = true;
139
- this.$el.addClass('active');
140
-
141
- if (!$(this.thumb).hasClass('active')) {
142
- this._showRangeBubble();
143
- }
144
-
145
- if (e.type !== 'input') {
146
- let offsetLeft = this._calcRangeOffset();
147
- $(this.thumb)
148
- .addClass('active')
149
- .css('left', offsetLeft + 'px');
150
- }
151
- }
152
-
153
- /**
154
- * Handle Range Input, Mousemove and Touchmove
155
- */
156
- _handleRangeInputMousemoveTouchmove() {
157
- if (this._mousedown) {
158
- if (!$(this.thumb).hasClass('active')) {
159
- this._showRangeBubble();
160
- }
161
-
162
- let offsetLeft = this._calcRangeOffset();
163
- $(this.thumb)
164
- .addClass('active')
165
- .css('left', offsetLeft + 'px');
166
- $(this.value).html(this.$el.val());
167
- }
168
- }
169
-
170
- /**
171
- * Handle Range Mouseup and Touchend
172
- */
173
- _handleRangeMouseupTouchend() {
174
- this._mousedown = false;
175
- this.$el.removeClass('active');
176
- }
177
-
178
- /**
179
- * Handle Range Blur, Mouseout and Touchleave
180
- */
181
- _handleRangeBlurMouseoutTouchleave() {
182
- if (!this._mousedown) {
183
- let paddingLeft = parseInt(this.$el.css('padding-left'));
184
- let marginLeft = 7 + paddingLeft + 'px';
185
-
186
- if ($(this.thumb).hasClass('active')) {
187
- anim.remove(this.thumb);
188
- anim({
189
- targets: this.thumb,
190
- height: 0,
191
- width: 0,
192
- top: 10,
193
- easing: 'easeOutQuad',
194
- marginLeft: marginLeft,
195
- duration: 100
196
- });
197
- }
198
- $(this.thumb).removeClass('active');
199
- }
200
- }
201
-
202
- /**
203
- * Setup dropdown
204
- */
205
- _setupThumb() {
206
- this.thumb = document.createElement('span');
207
- this.value = document.createElement('span');
208
- $(this.thumb).addClass('thumb');
209
- $(this.value).addClass('value');
210
- $(this.thumb).append(this.value);
211
- this.$el.after(this.thumb);
212
- }
213
-
214
- /**
215
- * Remove dropdown
216
- */
217
- _removeThumb() {
218
- $(this.thumb).remove();
219
- }
220
-
221
- /**
222
- * morph thumb into bubble
223
- */
224
- _showRangeBubble() {
225
- let paddingLeft = parseInt(
226
- $(this.thumb)
227
- .parent()
228
- .css('padding-left')
229
- );
230
- let marginLeft = -7 + paddingLeft + 'px'; // TODO: fix magic number?
231
- anim.remove(this.thumb);
232
- anim({
233
- targets: this.thumb,
234
- height: 30,
235
- width: 30,
236
- top: -30,
237
- marginLeft: marginLeft,
238
- duration: 300,
239
- easing: 'easeOutQuint'
240
- });
241
- }
242
-
243
- /**
244
- * Calculate the offset of the thumb
245
- * @return {Number} offset in pixels
246
- */
247
- _calcRangeOffset() {
248
- let width = this.$el.width() - 15;
249
- let max = parseFloat(this.$el.attr('max')) || 100; // Range default max
250
- let min = parseFloat(this.$el.attr('min')) || 0; // Range default min
251
- let percent = (parseFloat(this.$el.val()) - min) / (max - min);
252
- return percent * width;
253
- }
254
- }
255
-
256
- M.Range = Range;
257
-
258
- if (M.jQueryLoaded) {
259
- M.initializeJqueryWrapper(Range, 'range', 'M_Range');
260
- }
261
-
262
- Range.init($('input[type=range]'));
263
- })(cash, M.anime);
1
+ (function($, anim) {
2
+ 'use strict';
3
+
4
+ let _defaults = {};
5
+
6
+ /**
7
+ * @class
8
+ *
9
+ */
10
+ class Range extends Component {
11
+ /**
12
+ * Construct Range instance
13
+ * @constructor
14
+ * @param {Element} el
15
+ * @param {Object} options
16
+ */
17
+ constructor(el, options) {
18
+ super(Range, el, options);
19
+
20
+ this.el.M_Range = this;
21
+
22
+ /**
23
+ * Options for the range
24
+ * @member Range#options
25
+ */
26
+ this.options = $.extend({}, Range.defaults, options);
27
+
28
+ this._mousedown = false;
29
+
30
+ // Setup
31
+ this._setupThumb();
32
+
33
+ this._setupEventHandlers();
34
+ }
35
+
36
+ static get defaults() {
37
+ return _defaults;
38
+ }
39
+
40
+ static init(els, options) {
41
+ return super.init(this, els, options);
42
+ }
43
+
44
+ /**
45
+ * Get Instance
46
+ */
47
+ static getInstance(el) {
48
+ let domElem = !!el.jquery ? el[0] : el;
49
+ return domElem.M_Range;
50
+ }
51
+
52
+ /**
53
+ * Teardown component
54
+ */
55
+ destroy() {
56
+ this._removeEventHandlers();
57
+ this._removeThumb();
58
+ this.el.M_Range = undefined;
59
+ }
60
+
61
+ /**
62
+ * Setup Event Handlers
63
+ */
64
+ _setupEventHandlers() {
65
+ this._handleRangeChangeBound = this._handleRangeChange.bind(this);
66
+ this._handleRangeMousedownTouchstartBound = this._handleRangeMousedownTouchstart.bind(this);
67
+ this._handleRangeInputMousemoveTouchmoveBound = this._handleRangeInputMousemoveTouchmove.bind(
68
+ this
69
+ );
70
+ this._handleRangeMouseupTouchendBound = this._handleRangeMouseupTouchend.bind(this);
71
+ this._handleRangeBlurMouseoutTouchleaveBound = this._handleRangeBlurMouseoutTouchleave.bind(
72
+ this
73
+ );
74
+
75
+ this.el.addEventListener('change', this._handleRangeChangeBound);
76
+
77
+ this.el.addEventListener('mousedown', this._handleRangeMousedownTouchstartBound);
78
+ this.el.addEventListener('touchstart', this._handleRangeMousedownTouchstartBound);
79
+
80
+ this.el.addEventListener('input', this._handleRangeInputMousemoveTouchmoveBound);
81
+ this.el.addEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound);
82
+ this.el.addEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound);
83
+
84
+ this.el.addEventListener('mouseup', this._handleRangeMouseupTouchendBound);
85
+ this.el.addEventListener('touchend', this._handleRangeMouseupTouchendBound);
86
+
87
+ this.el.addEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound);
88
+ this.el.addEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound);
89
+ this.el.addEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound);
90
+ }
91
+
92
+ /**
93
+ * Remove Event Handlers
94
+ */
95
+ _removeEventHandlers() {
96
+ this.el.removeEventListener('change', this._handleRangeChangeBound);
97
+
98
+ this.el.removeEventListener('mousedown', this._handleRangeMousedownTouchstartBound);
99
+ this.el.removeEventListener('touchstart', this._handleRangeMousedownTouchstartBound);
100
+
101
+ this.el.removeEventListener('input', this._handleRangeInputMousemoveTouchmoveBound);
102
+ this.el.removeEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound);
103
+ this.el.removeEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound);
104
+
105
+ this.el.removeEventListener('mouseup', this._handleRangeMouseupTouchendBound);
106
+ this.el.removeEventListener('touchend', this._handleRangeMouseupTouchendBound);
107
+
108
+ this.el.removeEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound);
109
+ this.el.removeEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound);
110
+ this.el.removeEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound);
111
+ }
112
+
113
+ /**
114
+ * Handle Range Change
115
+ * @param {Event} e
116
+ */
117
+ _handleRangeChange() {
118
+ $(this.value).html(this.$el.val());
119
+
120
+ if (!$(this.thumb).hasClass('active')) {
121
+ this._showRangeBubble();
122
+ }
123
+
124
+ let offsetLeft = this._calcRangeOffset();
125
+ $(this.thumb)
126
+ .addClass('active')
127
+ .css('left', offsetLeft + 'px');
128
+ }
129
+
130
+ /**
131
+ * Handle Range Mousedown and Touchstart
132
+ * @param {Event} e
133
+ */
134
+ _handleRangeMousedownTouchstart(e) {
135
+ // Set indicator value
136
+ $(this.value).html(this.$el.val());
137
+
138
+ this._mousedown = true;
139
+ this.$el.addClass('active');
140
+
141
+ if (!$(this.thumb).hasClass('active')) {
142
+ this._showRangeBubble();
143
+ }
144
+
145
+ if (e.type !== 'input') {
146
+ let offsetLeft = this._calcRangeOffset();
147
+ $(this.thumb)
148
+ .addClass('active')
149
+ .css('left', offsetLeft + 'px');
150
+ }
151
+ }
152
+
153
+ /**
154
+ * Handle Range Input, Mousemove and Touchmove
155
+ */
156
+ _handleRangeInputMousemoveTouchmove() {
157
+ if (this._mousedown) {
158
+ if (!$(this.thumb).hasClass('active')) {
159
+ this._showRangeBubble();
160
+ }
161
+
162
+ let offsetLeft = this._calcRangeOffset();
163
+ $(this.thumb)
164
+ .addClass('active')
165
+ .css('left', offsetLeft + 'px');
166
+ $(this.value).html(this.$el.val());
167
+ }
168
+ }
169
+
170
+ /**
171
+ * Handle Range Mouseup and Touchend
172
+ */
173
+ _handleRangeMouseupTouchend() {
174
+ this._mousedown = false;
175
+ this.$el.removeClass('active');
176
+ }
177
+
178
+ /**
179
+ * Handle Range Blur, Mouseout and Touchleave
180
+ */
181
+ _handleRangeBlurMouseoutTouchleave() {
182
+ if (!this._mousedown) {
183
+ let paddingLeft = parseInt(this.$el.css('padding-left'));
184
+ let marginLeft = 7 + paddingLeft + 'px';
185
+
186
+ if ($(this.thumb).hasClass('active')) {
187
+ anim.remove(this.thumb);
188
+ anim({
189
+ targets: this.thumb,
190
+ height: 0,
191
+ width: 0,
192
+ top: 10,
193
+ easing: 'easeOutQuad',
194
+ marginLeft: marginLeft,
195
+ duration: 100
196
+ });
197
+ }
198
+ $(this.thumb).removeClass('active');
199
+ }
200
+ }
201
+
202
+ /**
203
+ * Setup dropdown
204
+ */
205
+ _setupThumb() {
206
+ this.thumb = document.createElement('span');
207
+ this.value = document.createElement('span');
208
+ $(this.thumb).addClass('thumb');
209
+ $(this.value).addClass('value');
210
+ $(this.thumb).append(this.value);
211
+ this.$el.after(this.thumb);
212
+ }
213
+
214
+ /**
215
+ * Remove dropdown
216
+ */
217
+ _removeThumb() {
218
+ $(this.thumb).remove();
219
+ }
220
+
221
+ /**
222
+ * morph thumb into bubble
223
+ */
224
+ _showRangeBubble() {
225
+ let paddingLeft = parseInt(
226
+ $(this.thumb)
227
+ .parent()
228
+ .css('padding-left')
229
+ );
230
+ let marginLeft = -7 + paddingLeft + 'px'; // TODO: fix magic number?
231
+ anim.remove(this.thumb);
232
+ anim({
233
+ targets: this.thumb,
234
+ height: 30,
235
+ width: 30,
236
+ top: -30,
237
+ marginLeft: marginLeft,
238
+ duration: 300,
239
+ easing: 'easeOutQuint'
240
+ });
241
+ }
242
+
243
+ /**
244
+ * Calculate the offset of the thumb
245
+ * @return {Number} offset in pixels
246
+ */
247
+ _calcRangeOffset() {
248
+ let width = this.$el.width() - 15;
249
+ let max = parseFloat(this.$el.attr('max')) || 100; // Range default max
250
+ let min = parseFloat(this.$el.attr('min')) || 0; // Range default min
251
+ let percent = (parseFloat(this.$el.val()) - min) / (max - min);
252
+ return percent * width;
253
+ }
254
+ }
255
+
256
+ M.Range = Range;
257
+
258
+ if (M.jQueryLoaded) {
259
+ M.initializeJqueryWrapper(Range, 'range', 'M_Range');
260
+ }
261
+
262
+ Range.init($('input[type=range]'));
263
+ })(cash, M.anime);