@materializecss/materialize 1.2.1 → 2.0.0-alpha
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.
- package/Gruntfile.js +68 -313
- package/README.md +3 -3
- package/dist/css/materialize.css +1019 -1824
- package/dist/css/materialize.min.css +3 -9
- package/dist/js/materialize.js +8416 -12190
- package/dist/js/materialize.min.js +4 -3
- package/dist/js/materialize.min.js.map +1 -0
- package/package.json +13 -9
- package/sass/components/_badges.scss +12 -2
- package/sass/components/_buttons.scss +16 -11
- package/sass/components/_cards.scss +14 -9
- package/sass/components/_carousel.scss +5 -2
- package/sass/components/_chips.scss +3 -3
- package/sass/components/_collapsible.scss +22 -8
- package/sass/components/_collection.scss +14 -6
- package/sass/components/_datepicker.scss +30 -11
- package/sass/components/_dropdown.scss +6 -4
- package/sass/components/_global.scss +132 -111
- package/sass/components/_grid.scss +119 -98
- package/sass/components/_modal.scss +3 -3
- package/sass/components/_navbar.scss +31 -17
- package/sass/components/_normalize.scss +26 -124
- package/sass/components/_sidenav.scss +21 -20
- package/sass/components/_slider.scss +36 -7
- package/sass/components/_table_of_contents.scss +12 -12
- package/sass/components/_tabs.scss +47 -16
- package/sass/components/_tapTarget.scss +6 -6
- package/sass/components/_timepicker.scss +54 -46
- package/sass/components/_toast.scss +3 -3
- package/sass/components/_tooltip.scss +4 -5
- package/sass/components/_typography.scss +1 -1
- package/sass/components/_variables.scss +185 -120
- package/sass/components/forms/_checkboxes.scss +9 -9
- package/sass/components/forms/_file-input.scss +9 -7
- package/sass/components/forms/_input-fields.scss +173 -234
- package/sass/components/forms/_radio-buttons.scss +1 -1
- package/sass/components/forms/_range.scss +11 -11
- package/sass/components/forms/_select.scss +29 -19
- package/sass/components/forms/_switches.scss +22 -18
- package/sass/materialize.scss +1 -1
- package/src/autocomplete.ts +459 -0
- package/src/bounding.ts +6 -0
- package/{js/buttons.js → src/buttons.ts} +103 -162
- package/src/cards.ts +54 -0
- package/{js/carousel.js → src/carousel.ts} +137 -262
- package/src/characterCounter.ts +88 -0
- package/src/chips.ts +350 -0
- package/src/collapsible.ts +184 -0
- package/{js/component.js → src/component.ts} +6 -19
- package/{js/datepicker.js → src/datepicker.ts} +213 -299
- package/{js/dropdown.js → src/dropdown.ts} +140 -254
- package/src/edges.ts +6 -0
- package/src/forms.ts +120 -0
- package/src/global.ts +385 -0
- package/src/materialbox.ts +348 -0
- package/src/modal.ts +256 -0
- package/{js/parallax.js → src/parallax.ts} +47 -60
- package/{js/pushpin.js → src/pushpin.ts} +19 -47
- package/{js/range.js → src/range.ts} +58 -139
- package/{js/scrollspy.js → src/scrollspy.ts} +81 -153
- package/src/select.ts +448 -0
- package/{js/sidenav.js → src/sidenav.ts} +96 -202
- package/src/slider.ts +415 -0
- package/src/tabs.ts +290 -0
- package/src/tapTarget.ts +240 -0
- package/{js/timepicker.js → src/timepicker.ts} +268 -272
- package/{js/toasts.js → src/toasts.ts} +75 -134
- package/{js/tooltip.js → src/tooltip.ts} +59 -96
- package/src/waves.ts +70 -0
- package/extras/noUiSlider/nouislider.css +0 -404
- package/extras/noUiSlider/nouislider.js +0 -2147
- package/extras/noUiSlider/nouislider.min.js +0 -1
- package/js/anime.min.js +0 -34
- package/js/autocomplete.js +0 -479
- package/js/cards.js +0 -40
- package/js/cash.js +0 -960
- package/js/characterCounter.js +0 -136
- package/js/chips.js +0 -486
- package/js/collapsible.js +0 -275
- package/js/forms.js +0 -285
- package/js/global.js +0 -428
- package/js/materialbox.js +0 -453
- package/js/modal.js +0 -382
- package/js/select.js +0 -391
- package/js/slider.js +0 -359
- package/js/tabs.js +0 -402
- package/js/tapTarget.js +0 -315
- package/js/waves.js +0 -615
- package/sass/_style.scss +0 -929
- package/sass/components/_waves.scss +0 -187
- package/sass/ghpages-materialize.scss +0 -7
package/js/slider.js
DELETED
|
@@ -1,359 +0,0 @@
|
|
|
1
|
-
(function($, anim) {
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
let _defaults = {
|
|
5
|
-
indicators: true,
|
|
6
|
-
height: 400,
|
|
7
|
-
duration: 500,
|
|
8
|
-
interval: 6000
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @class
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
class Slider extends Component {
|
|
16
|
-
/**
|
|
17
|
-
* Construct Slider instance and set up overlay
|
|
18
|
-
* @constructor
|
|
19
|
-
* @param {Element} el
|
|
20
|
-
* @param {Object} options
|
|
21
|
-
*/
|
|
22
|
-
constructor(el, options) {
|
|
23
|
-
super(Slider, el, options);
|
|
24
|
-
|
|
25
|
-
this.el.M_Slider = this;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Options for the modal
|
|
29
|
-
* @member Slider#options
|
|
30
|
-
* @prop {Boolean} [indicators=true] - Show indicators
|
|
31
|
-
* @prop {Number} [height=400] - height of slider
|
|
32
|
-
* @prop {Number} [duration=500] - Length in ms of slide transition
|
|
33
|
-
* @prop {Number} [interval=6000] - Length in ms of slide interval
|
|
34
|
-
*/
|
|
35
|
-
this.options = $.extend({}, Slider.defaults, options);
|
|
36
|
-
|
|
37
|
-
// setup
|
|
38
|
-
this.$slider = this.$el.find('.slides');
|
|
39
|
-
this.$slides = this.$slider.children('li');
|
|
40
|
-
this.activeIndex = this.$slides
|
|
41
|
-
.filter(function(item) {
|
|
42
|
-
return $(item).hasClass('active');
|
|
43
|
-
})
|
|
44
|
-
.first()
|
|
45
|
-
.index();
|
|
46
|
-
if (this.activeIndex != -1) {
|
|
47
|
-
this.$active = this.$slides.eq(this.activeIndex);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
this._setSliderHeight();
|
|
51
|
-
|
|
52
|
-
// Set initial positions of captions
|
|
53
|
-
this.$slides.find('.caption').each((el) => {
|
|
54
|
-
this._animateCaptionIn(el, 0);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
// Move img src into background-image
|
|
58
|
-
this.$slides.find('img').each((el) => {
|
|
59
|
-
let placeholderBase64 =
|
|
60
|
-
'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
|
|
61
|
-
if ($(el).attr('src') !== placeholderBase64) {
|
|
62
|
-
$(el).css('background-image', 'url("' + $(el).attr('src') + '")');
|
|
63
|
-
$(el).attr('src', placeholderBase64);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
this._setupIndicators();
|
|
68
|
-
|
|
69
|
-
// Show active slide
|
|
70
|
-
if (this.$active) {
|
|
71
|
-
this.$active.css('display', 'block');
|
|
72
|
-
} else {
|
|
73
|
-
this.$slides.first().addClass('active');
|
|
74
|
-
anim({
|
|
75
|
-
targets: this.$slides.first()[0],
|
|
76
|
-
opacity: 1,
|
|
77
|
-
duration: this.options.duration,
|
|
78
|
-
easing: 'easeOutQuad'
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
this.activeIndex = 0;
|
|
82
|
-
this.$active = this.$slides.eq(this.activeIndex);
|
|
83
|
-
|
|
84
|
-
// Update indicators
|
|
85
|
-
if (this.options.indicators) {
|
|
86
|
-
this.$indicators.eq(this.activeIndex).addClass('active');
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Adjust height to current slide
|
|
91
|
-
this.$active.find('img').each((el) => {
|
|
92
|
-
anim({
|
|
93
|
-
targets: this.$active.find('.caption')[0],
|
|
94
|
-
opacity: 1,
|
|
95
|
-
translateX: 0,
|
|
96
|
-
translateY: 0,
|
|
97
|
-
duration: this.options.duration,
|
|
98
|
-
easing: 'easeOutQuad'
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
this._setupEventHandlers();
|
|
103
|
-
|
|
104
|
-
// auto scroll
|
|
105
|
-
this.start();
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
static get defaults() {
|
|
109
|
-
return _defaults;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
static init(els, options) {
|
|
113
|
-
return super.init(this, els, options);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Get Instance
|
|
118
|
-
*/
|
|
119
|
-
static getInstance(el) {
|
|
120
|
-
let domElem = !!el.jquery ? el[0] : el;
|
|
121
|
-
return domElem.M_Slider;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Teardown component
|
|
126
|
-
*/
|
|
127
|
-
destroy() {
|
|
128
|
-
this.pause();
|
|
129
|
-
this._removeIndicators();
|
|
130
|
-
this._removeEventHandlers();
|
|
131
|
-
this.el.M_Slider = undefined;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Setup Event Handlers
|
|
136
|
-
*/
|
|
137
|
-
_setupEventHandlers() {
|
|
138
|
-
this._handleIntervalBound = this._handleInterval.bind(this);
|
|
139
|
-
this._handleIndicatorClickBound = this._handleIndicatorClick.bind(this);
|
|
140
|
-
|
|
141
|
-
if (this.options.indicators) {
|
|
142
|
-
this.$indicators.each((el) => {
|
|
143
|
-
el.addEventListener('click', this._handleIndicatorClickBound);
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Remove Event Handlers
|
|
150
|
-
*/
|
|
151
|
-
_removeEventHandlers() {
|
|
152
|
-
if (this.options.indicators) {
|
|
153
|
-
this.$indicators.each((el) => {
|
|
154
|
-
el.removeEventListener('click', this._handleIndicatorClickBound);
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Handle indicator click
|
|
161
|
-
* @param {Event} e
|
|
162
|
-
*/
|
|
163
|
-
_handleIndicatorClick(e) {
|
|
164
|
-
let currIndex = $(e.target).index();
|
|
165
|
-
this.set(currIndex);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Handle Interval
|
|
170
|
-
*/
|
|
171
|
-
_handleInterval() {
|
|
172
|
-
let newActiveIndex = this.$slider.find('.active').index();
|
|
173
|
-
if (this.$slides.length === newActiveIndex + 1) newActiveIndex = 0;
|
|
174
|
-
// loop to start
|
|
175
|
-
else newActiveIndex += 1;
|
|
176
|
-
|
|
177
|
-
this.set(newActiveIndex);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Animate in caption
|
|
182
|
-
* @param {Element} caption
|
|
183
|
-
* @param {Number} duration
|
|
184
|
-
*/
|
|
185
|
-
_animateCaptionIn(caption, duration) {
|
|
186
|
-
let animOptions = {
|
|
187
|
-
targets: caption,
|
|
188
|
-
opacity: 0,
|
|
189
|
-
duration: duration,
|
|
190
|
-
easing: 'easeOutQuad'
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
if ($(caption).hasClass('center-align')) {
|
|
194
|
-
animOptions.translateY = -100;
|
|
195
|
-
} else if ($(caption).hasClass('right-align')) {
|
|
196
|
-
animOptions.translateX = 100;
|
|
197
|
-
} else if ($(caption).hasClass('left-align')) {
|
|
198
|
-
animOptions.translateX = -100;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
anim(animOptions);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Set height of slider
|
|
206
|
-
*/
|
|
207
|
-
_setSliderHeight() {
|
|
208
|
-
// If fullscreen, do nothing
|
|
209
|
-
if (!this.$el.hasClass('fullscreen')) {
|
|
210
|
-
if (this.options.indicators) {
|
|
211
|
-
// Add height if indicators are present
|
|
212
|
-
this.$el.css('height', this.options.height + 40 + 'px');
|
|
213
|
-
} else {
|
|
214
|
-
this.$el.css('height', this.options.height + 'px');
|
|
215
|
-
}
|
|
216
|
-
this.$slider.css('height', this.options.height + 'px');
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Setup indicators
|
|
222
|
-
*/
|
|
223
|
-
_setupIndicators() {
|
|
224
|
-
if (this.options.indicators) {
|
|
225
|
-
this.$indicators = $('<ul class="indicators"></ul>');
|
|
226
|
-
this.$slides.each((el, index) => {
|
|
227
|
-
let $indicator = $('<li class="indicator-item"></li>');
|
|
228
|
-
this.$indicators.append($indicator[0]);
|
|
229
|
-
});
|
|
230
|
-
this.$el.append(this.$indicators[0]);
|
|
231
|
-
this.$indicators = this.$indicators.children('li.indicator-item');
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Remove indicators
|
|
237
|
-
*/
|
|
238
|
-
_removeIndicators() {
|
|
239
|
-
this.$el.find('ul.indicators').remove();
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Cycle to nth item
|
|
244
|
-
* @param {Number} index
|
|
245
|
-
*/
|
|
246
|
-
set(index) {
|
|
247
|
-
// Wrap around indices.
|
|
248
|
-
if (index >= this.$slides.length) index = 0;
|
|
249
|
-
else if (index < 0) index = this.$slides.length - 1;
|
|
250
|
-
|
|
251
|
-
// Only do if index changes
|
|
252
|
-
if (this.activeIndex != index) {
|
|
253
|
-
this.$active = this.$slides.eq(this.activeIndex);
|
|
254
|
-
let $caption = this.$active.find('.caption');
|
|
255
|
-
this.$active.removeClass('active');
|
|
256
|
-
|
|
257
|
-
anim({
|
|
258
|
-
targets: this.$active[0],
|
|
259
|
-
opacity: 0,
|
|
260
|
-
duration: this.options.duration,
|
|
261
|
-
easing: 'easeOutQuad',
|
|
262
|
-
complete: () => {
|
|
263
|
-
this.$slides.not('.active').each((el) => {
|
|
264
|
-
anim({
|
|
265
|
-
targets: el,
|
|
266
|
-
opacity: 0,
|
|
267
|
-
translateX: 0,
|
|
268
|
-
translateY: 0,
|
|
269
|
-
duration: 0,
|
|
270
|
-
easing: 'easeOutQuad'
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
this._animateCaptionIn($caption[0], this.options.duration);
|
|
277
|
-
|
|
278
|
-
// Update indicators
|
|
279
|
-
if (this.options.indicators) {
|
|
280
|
-
this.$indicators.eq(this.activeIndex).removeClass('active');
|
|
281
|
-
this.$indicators.eq(index).addClass('active');
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
anim({
|
|
285
|
-
targets: this.$slides.eq(index)[0],
|
|
286
|
-
opacity: 1,
|
|
287
|
-
duration: this.options.duration,
|
|
288
|
-
easing: 'easeOutQuad'
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
anim({
|
|
292
|
-
targets: this.$slides.eq(index).find('.caption')[0],
|
|
293
|
-
opacity: 1,
|
|
294
|
-
translateX: 0,
|
|
295
|
-
translateY: 0,
|
|
296
|
-
duration: this.options.duration,
|
|
297
|
-
delay: this.options.duration,
|
|
298
|
-
easing: 'easeOutQuad'
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
this.$slides.eq(index).addClass('active');
|
|
302
|
-
this.activeIndex = index;
|
|
303
|
-
|
|
304
|
-
// Reset interval
|
|
305
|
-
this.start();
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Pause slider interval
|
|
311
|
-
*/
|
|
312
|
-
pause() {
|
|
313
|
-
clearInterval(this.interval);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Start slider interval
|
|
318
|
-
*/
|
|
319
|
-
start() {
|
|
320
|
-
clearInterval(this.interval);
|
|
321
|
-
this.interval = setInterval(
|
|
322
|
-
this._handleIntervalBound,
|
|
323
|
-
this.options.duration + this.options.interval
|
|
324
|
-
);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* Move to next slide
|
|
329
|
-
*/
|
|
330
|
-
next() {
|
|
331
|
-
let newIndex = this.activeIndex + 1;
|
|
332
|
-
|
|
333
|
-
// Wrap around indices.
|
|
334
|
-
if (newIndex >= this.$slides.length) newIndex = 0;
|
|
335
|
-
else if (newIndex < 0) newIndex = this.$slides.length - 1;
|
|
336
|
-
|
|
337
|
-
this.set(newIndex);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Move to previous slide
|
|
342
|
-
*/
|
|
343
|
-
prev() {
|
|
344
|
-
let newIndex = this.activeIndex - 1;
|
|
345
|
-
|
|
346
|
-
// Wrap around indices.
|
|
347
|
-
if (newIndex >= this.$slides.length) newIndex = 0;
|
|
348
|
-
else if (newIndex < 0) newIndex = this.$slides.length - 1;
|
|
349
|
-
|
|
350
|
-
this.set(newIndex);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
M.Slider = Slider;
|
|
355
|
-
|
|
356
|
-
if (M.jQueryLoaded) {
|
|
357
|
-
M.initializeJqueryWrapper(Slider, 'slider', 'M_Slider');
|
|
358
|
-
}
|
|
359
|
-
})(cash, M.anime);
|