materialize-sass 0.100.2.1 → 1.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +18 -42
  3. data/Rakefile +17 -17
  4. data/{app/assets → assets}/javascripts/materialize-sprockets.js +8 -12
  5. data/assets/javascripts/materialize.js +11877 -0
  6. data/assets/javascripts/materialize/autocomplete.js +420 -0
  7. data/assets/javascripts/materialize/buttons.js +388 -0
  8. data/assets/javascripts/materialize/cards.js +28 -0
  9. data/assets/javascripts/materialize/carousel.js +791 -0
  10. data/assets/javascripts/materialize/cash.js +992 -0
  11. data/assets/javascripts/materialize/characterCounter.js +180 -0
  12. data/assets/javascripts/materialize/chips.js +555 -0
  13. data/assets/javascripts/materialize/collapsible.js +275 -0
  14. data/assets/javascripts/materialize/datepicker.js +898 -0
  15. data/assets/javascripts/materialize/dropdown.js +530 -0
  16. data/{app/assets → assets}/javascripts/materialize/extras/nouislider.js +1 -1
  17. data/{app/assets → assets}/javascripts/materialize/extras/nouislider.min.js +1 -1
  18. data/assets/javascripts/materialize/forms.js +223 -0
  19. data/assets/javascripts/materialize/global.js +353 -0
  20. data/assets/javascripts/materialize/materialbox.js +432 -0
  21. data/{app/assets → assets}/javascripts/materialize/modal.js +82 -113
  22. data/assets/javascripts/materialize/parallax.js +135 -0
  23. data/assets/javascripts/materialize/pushpin.js +158 -0
  24. data/assets/javascripts/materialize/range.js +305 -0
  25. data/assets/javascripts/materialize/scrollspy.js +322 -0
  26. data/assets/javascripts/materialize/select.js +426 -0
  27. data/assets/javascripts/materialize/sidenav.js +584 -0
  28. data/assets/javascripts/materialize/slider.js +383 -0
  29. data/assets/javascripts/materialize/tabs.js +460 -0
  30. data/assets/javascripts/materialize/tapTarget.js +347 -0
  31. data/assets/javascripts/materialize/timepicker.js +616 -0
  32. data/{app/assets → assets}/javascripts/materialize/toasts.js +42 -46
  33. data/assets/javascripts/materialize/tooltip.js +325 -0
  34. data/assets/javascripts/materialize/velocity.min.js +782 -0
  35. data/{app/assets → assets}/javascripts/materialize/waves.js +0 -0
  36. data/{app/assets → assets}/stylesheets/materialize.scss +5 -6
  37. data/{app/assets → assets}/stylesheets/materialize/components/_badges.scss +1 -1
  38. data/{app/assets → assets}/stylesheets/materialize/components/_buttons.scss +34 -2
  39. data/{app/assets → assets}/stylesheets/materialize/components/_cards.scss +0 -0
  40. data/{app/assets → assets}/stylesheets/materialize/components/_carousel.scss +1 -1
  41. data/{app/assets → assets}/stylesheets/materialize/components/_chips.scss +6 -5
  42. data/{app/assets → assets}/stylesheets/materialize/components/_collapsible.scss +3 -3
  43. data/{app/assets → assets}/stylesheets/materialize/components/_color.scss +0 -0
  44. data/assets/stylesheets/materialize/components/_datepicker.scss +180 -0
  45. data/{app/assets → assets}/stylesheets/materialize/components/_dropdown.scss +16 -15
  46. data/{app/assets → assets}/stylesheets/materialize/components/_global.scss +49 -14
  47. data/{app/assets → assets}/stylesheets/materialize/components/_grid.scss +1 -1
  48. data/{app/assets → assets}/stylesheets/materialize/components/_icons-material-design.scss +0 -0
  49. data/{app/assets → assets}/stylesheets/materialize/components/_materialbox.scss +0 -0
  50. data/assets/stylesheets/materialize/components/_mixins.scss +5 -0
  51. data/{app/assets → assets}/stylesheets/materialize/components/_modal.scss +1 -1
  52. data/{app/assets → assets}/stylesheets/materialize/components/_navbar.scss +0 -0
  53. data/assets/stylesheets/materialize/components/_normalize.scss +447 -0
  54. data/{app/assets → assets}/stylesheets/materialize/components/_preloader.scss +0 -0
  55. data/{app/assets → assets}/stylesheets/materialize/components/_pulse.scss +0 -0
  56. data/{app/assets/stylesheets/materialize/components/_sideNav.scss → assets/stylesheets/materialize/components/_sidenav.scss} +23 -21
  57. data/{app/assets → assets}/stylesheets/materialize/components/_slider.scss +0 -0
  58. data/{app/assets → assets}/stylesheets/materialize/components/_table_of_contents.scss +3 -3
  59. data/{app/assets → assets}/stylesheets/materialize/components/_tabs.scss +2 -2
  60. data/{app/assets → assets}/stylesheets/materialize/components/_tapTarget.scss +0 -0
  61. data/assets/stylesheets/materialize/components/_timepicker.scss +182 -0
  62. data/{app/assets → assets}/stylesheets/materialize/components/_toast.scss +0 -0
  63. data/{app/assets → assets}/stylesheets/materialize/components/_tooltip.scss +1 -0
  64. data/{app/assets → assets}/stylesheets/materialize/components/_transitions.scss +0 -0
  65. data/{app/assets → assets}/stylesheets/materialize/components/_typography.scss +8 -8
  66. data/{app/assets → assets}/stylesheets/materialize/components/_variables.scss +42 -44
  67. data/{app/assets → assets}/stylesheets/materialize/components/_waves.scss +0 -0
  68. data/{app/assets → assets}/stylesheets/materialize/components/forms/_checkboxes.scss +24 -24
  69. data/{app/assets → assets}/stylesheets/materialize/components/forms/_file-input.scss +0 -0
  70. data/{app/assets → assets}/stylesheets/materialize/components/forms/_forms.scss +0 -0
  71. data/{app/assets → assets}/stylesheets/materialize/components/forms/_input-fields.scss +49 -35
  72. data/{app/assets → assets}/stylesheets/materialize/components/forms/_radio-buttons.scss +29 -29
  73. data/{app/assets → assets}/stylesheets/materialize/components/forms/_range.scss +32 -31
  74. data/{app/assets → assets}/stylesheets/materialize/components/forms/_select.scss +20 -11
  75. data/{app/assets → assets}/stylesheets/materialize/components/forms/_switches.scss +0 -0
  76. data/{app/assets → assets}/stylesheets/materialize/extras/nouislider.css +1 -1
  77. data/lib/materialize-sass.rb +13 -23
  78. data/lib/materialize-sass/engine.rb +6 -9
  79. data/lib/materialize-sass/version.rb +1 -1
  80. data/materialize-sass.gemspec +2 -1
  81. metadata +97 -97
  82. data/app/assets/fonts/roboto/Roboto-Bold.woff +0 -0
  83. data/app/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
  84. data/app/assets/fonts/roboto/Roboto-Light.woff +0 -0
  85. data/app/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
  86. data/app/assets/fonts/roboto/Roboto-Medium.woff +0 -0
  87. data/app/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
  88. data/app/assets/fonts/roboto/Roboto-Regular.woff +0 -0
  89. data/app/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
  90. data/app/assets/fonts/roboto/Roboto-Thin.woff +0 -0
  91. data/app/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
  92. data/app/assets/javascripts/materialize.js +0 -10021
  93. data/app/assets/javascripts/materialize/animation.js +0 -7
  94. data/app/assets/javascripts/materialize/buttons.js +0 -253
  95. data/app/assets/javascripts/materialize/cards.js +0 -28
  96. data/app/assets/javascripts/materialize/carousel.js +0 -543
  97. data/app/assets/javascripts/materialize/character_counter.js +0 -64
  98. data/app/assets/javascripts/materialize/chips.js +0 -315
  99. data/app/assets/javascripts/materialize/collapsible.js +0 -178
  100. data/app/assets/javascripts/materialize/date_picker/picker.date.js +0 -1399
  101. data/app/assets/javascripts/materialize/date_picker/picker.js +0 -1196
  102. data/app/assets/javascripts/materialize/date_picker/picker.time.js +0 -646
  103. data/app/assets/javascripts/materialize/dropdown.js +0 -257
  104. data/app/assets/javascripts/materialize/forms.js +0 -806
  105. data/app/assets/javascripts/materialize/global.js +0 -170
  106. data/app/assets/javascripts/materialize/hammer.min.js +0 -424
  107. data/app/assets/javascripts/materialize/initial.js +0 -10
  108. data/app/assets/javascripts/materialize/jquery.easing.1.4.js +0 -144
  109. data/app/assets/javascripts/materialize/jquery.hammer.js +0 -33
  110. data/app/assets/javascripts/materialize/materialbox.js +0 -263
  111. data/app/assets/javascripts/materialize/parallax.js +0 -54
  112. data/app/assets/javascripts/materialize/pushpin.js +0 -68
  113. data/app/assets/javascripts/materialize/scrollFire.js +0 -49
  114. data/app/assets/javascripts/materialize/scrollspy.js +0 -230
  115. data/app/assets/javascripts/materialize/sideNav.js +0 -395
  116. data/app/assets/javascripts/materialize/slider.js +0 -295
  117. data/app/assets/javascripts/materialize/tabs.js +0 -244
  118. data/app/assets/javascripts/materialize/tapTarget.js +0 -184
  119. data/app/assets/javascripts/materialize/tooltip.js +0 -227
  120. data/app/assets/javascripts/materialize/transitions.js +0 -163
  121. data/app/assets/javascripts/materialize/velocity.min.js +0 -626
  122. data/app/assets/stylesheets/materialize/components/_normalize.scss +0 -424
  123. data/app/assets/stylesheets/materialize/components/_roboto.scss +0 -39
  124. data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +0 -469
  125. data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +0 -216
  126. data/app/assets/stylesheets/materialize/components/date_picker/_default.time.scss +0 -267
@@ -0,0 +1,432 @@
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
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
+
5
+ (function ($, Vel) {
6
+ 'use strict';
7
+
8
+ var _defaults = {
9
+ inDuration: 275,
10
+ outDuration: 200
11
+ };
12
+
13
+ /**
14
+ * @class
15
+ *
16
+ */
17
+
18
+ var Materialbox = function () {
19
+ /**
20
+ * Construct Materialbox instance
21
+ * @constructor
22
+ * @param {Element} el
23
+ * @param {Object} options
24
+ */
25
+ function Materialbox(el, options) {
26
+ _classCallCheck(this, Materialbox);
27
+
28
+ // If exists, destroy and reinitialize
29
+ if (!!el.M_Materialbox) {
30
+ el.M_Materialbox.destroy();
31
+ }
32
+
33
+ this.el = el;
34
+ this.$el = $(el);
35
+ this.el.M_Materialbox = this;
36
+
37
+ /**
38
+ * Options for the modal
39
+ * @member Materialbox#options
40
+ * @prop {Number} [inDuration=275] - Length in ms of enter transition
41
+ * @prop {Number} [outDuration=200] - Length in ms of exit transition
42
+ */
43
+ this.options = $.extend({}, Materialbox.defaults, options);
44
+
45
+ this.overlayActive = false;
46
+ this.doneAnimating = true;
47
+ this.placeholder = $('<div></div>').addClass('material-placeholder');
48
+ this.originalWidth = 0;
49
+ this.originalHeight = 0;
50
+ this.originInlineStyles = this.$el.attr('style');
51
+ this.caption = this.el.getAttribute('data-caption') || "";
52
+
53
+ // Wrap
54
+ this.$el.before(this.placeholder);
55
+ this.placeholder.append(this.$el);
56
+
57
+ this._setupEventHandlers();
58
+ }
59
+
60
+ _createClass(Materialbox, [{
61
+ key: 'destroy',
62
+
63
+
64
+ /**
65
+ * Teardown component
66
+ */
67
+ value: function destroy() {
68
+ this._removeEventHandlers();
69
+ this.el.M_Materialbox = undefined;
70
+ }
71
+
72
+ /**
73
+ * Setup Event Handlers
74
+ */
75
+
76
+ }, {
77
+ key: '_setupEventHandlers',
78
+ value: function _setupEventHandlers() {
79
+ this._handleMaterialboxClickBound = this._handleMaterialboxClick.bind(this);
80
+ this.el.addEventListener('click', this._handleMaterialboxClickBound);
81
+ }
82
+
83
+ /**
84
+ * Remove Event Handlers
85
+ */
86
+
87
+ }, {
88
+ key: 'removeEventHandlers',
89
+ value: function removeEventHandlers() {
90
+ this.el.removeEventListener('click', this._handleMaterialboxClickBound);
91
+ }
92
+
93
+ /**
94
+ * Handle Materialbox Click
95
+ * @param {Event} e
96
+ */
97
+
98
+ }, {
99
+ key: '_handleMaterialboxClick',
100
+ value: function _handleMaterialboxClick(e) {
101
+ // If already modal, return to original
102
+ if (this.doneAnimating === false || this.overlayActive && this.doneAnimating) {
103
+ this.close();
104
+ } else {
105
+ this.open();
106
+ }
107
+ }
108
+
109
+ /**
110
+ * Handle Window Scroll
111
+ */
112
+
113
+ }, {
114
+ key: '_handleWindowScroll',
115
+ value: function _handleWindowScroll() {
116
+ if (this.overlayActive) {
117
+ this.close();
118
+ }
119
+ }
120
+
121
+ /**
122
+ * Handle Window Resize
123
+ */
124
+
125
+ }, {
126
+ key: '_handleWindowResize',
127
+ value: function _handleWindowResize() {
128
+ if (this.overlayActive) {
129
+ this.close();
130
+ }
131
+ }
132
+
133
+ /**
134
+ * Handle Window Resize
135
+ * @param {Event} e
136
+ */
137
+
138
+ }, {
139
+ key: '_handleWindowEscape',
140
+ value: function _handleWindowEscape(e) {
141
+ // ESC key
142
+ if (e.keyCode === 27 && this.doneAnimating && this.overlayActive) {
143
+ this.close();
144
+ }
145
+ }
146
+
147
+ /**
148
+ * Find ancestors with overflow: hidden; and make visible
149
+ */
150
+
151
+ }, {
152
+ key: '_makeAncestorsOverflowVisible',
153
+ value: function _makeAncestorsOverflowVisible() {
154
+ this.ancestorsChanged = $();
155
+ var ancestor = this.placeholder[0].parentNode;
156
+ while (ancestor !== null && !$(ancestor).is(document)) {
157
+ var curr = $(ancestor);
158
+ if (curr.css('overflow') !== 'visible') {
159
+ curr.css('overflow', 'visible');
160
+ if (this.ancestorsChanged === undefined) {
161
+ this.ancestorsChanged = curr;
162
+ } else {
163
+ this.ancestorsChanged = this.ancestorsChanged.add(curr);
164
+ }
165
+ }
166
+ ancestor = ancestor.parentNode;
167
+ }
168
+ }
169
+
170
+ /**
171
+ * Animate image in
172
+ */
173
+
174
+ }, {
175
+ key: '_animateImageIn',
176
+ value: function _animateImageIn() {
177
+ var _this = this;
178
+
179
+ var velocityOptions = {
180
+ duration: this.options.inDuration,
181
+ queue: false,
182
+ ease: 'easeOutQuad',
183
+ complete: function () {
184
+ _this.doneAnimating = true;
185
+ }
186
+ };
187
+
188
+ var velocityProperties = {
189
+ height: this.newHeight,
190
+ width: this.newWidth,
191
+ left: M.getDocumentScrollLeft() + this.windowWidth / 2 - this.placeholder.offset().left - this.newWidth / 2,
192
+ top: M.getDocumentScrollTop() + this.windowHeight / 2 - this.placeholder.offset().top - this.newHeight / 2
193
+ };
194
+
195
+ if (this.$el.hasClass('responsive-img')) {
196
+ velocityProperties.maxWidth = [this.newWidth, this.newWidth];
197
+ velocityProperties.width = [velocityProperties.width, this.originalWidth];
198
+ } else {
199
+ velocityProperties.left = [velocityProperties.left, 0];
200
+ velocityProperties.top = [velocityProperties.top, 0];
201
+ }
202
+
203
+ Vel(this.el, velocityProperties, velocityOptions);
204
+ }
205
+
206
+ /**
207
+ * Animate image out
208
+ */
209
+
210
+ }, {
211
+ key: '_animateImageOut',
212
+ value: function _animateImageOut() {
213
+ var _this2 = this;
214
+
215
+ var velocityOptions = {
216
+ duration: this.options.outDuration,
217
+ queue: false,
218
+ ease: 'easeOutQuad',
219
+ complete: function () {
220
+ _this2.placeholder.css({
221
+ height: '',
222
+ width: '',
223
+ position: '',
224
+ top: '',
225
+ left: ''
226
+ });
227
+
228
+ _this2.$el.removeAttr('style');
229
+ _this2.$el.attr('style', _this2.originInlineStyles);
230
+
231
+ // Remove class
232
+ _this2.$el.removeClass('active');
233
+ _this2.doneAnimating = true;
234
+
235
+ // Remove overflow overrides on ancestors
236
+ if (_this2.ancestorsChanged.length) {
237
+ _this2.ancestorsChanged.css('overflow', '');
238
+ }
239
+ }
240
+ };
241
+
242
+ Vel(this.el, {
243
+ width: this.originalWidth,
244
+ height: this.originalHeight,
245
+ left: 0,
246
+ top: 0
247
+ }, velocityOptions);
248
+ }
249
+
250
+ /**
251
+ * Update open and close vars
252
+ */
253
+
254
+ }, {
255
+ key: '_updateVars',
256
+ value: function _updateVars() {
257
+ this.windowWidth = window.innerWidth;
258
+ this.windowHeight = window.innerHeight;
259
+ this.caption = this.el.getAttribute('data-caption') || "";
260
+ }
261
+
262
+ /**
263
+ * Open Materialbox
264
+ */
265
+
266
+ }, {
267
+ key: 'open',
268
+ value: function open() {
269
+ var _this3 = this;
270
+
271
+ this._updateVars();
272
+ this.originalWidth = this.el.getBoundingClientRect().width;
273
+ this.originalHeight = this.el.getBoundingClientRect().height;
274
+
275
+ // Set states
276
+ this.doneAnimating = false;
277
+ this.$el.addClass('active');
278
+ this.overlayActive = true;
279
+
280
+ // Set positioning for placeholder
281
+ this.placeholder.css({
282
+ width: this.placeholder[0].getBoundingClientRect().width + 'px',
283
+ height: this.placeholder[0].getBoundingClientRect().height + 'px',
284
+ position: 'relative',
285
+ top: 0,
286
+ left: 0
287
+ });
288
+
289
+ this._makeAncestorsOverflowVisible();
290
+
291
+ // Set css on origin
292
+ this.$el.css({
293
+ position: 'absolute',
294
+ 'z-index': 1000,
295
+ 'will-change': 'left, top, width, height'
296
+ });
297
+
298
+ // Add overlay
299
+ this.$overlay = $('<div id="materialbox-overlay"></div>').css({
300
+ opacity: 0
301
+ }).one('click', function () {
302
+ if (_this3.doneAnimating) {
303
+ _this3.close();
304
+ }
305
+ });
306
+
307
+ // Put before in origin image to preserve z-index layering.
308
+ this.$el.before(this.$overlay);
309
+
310
+ // Set dimensions if needed
311
+ var overlayOffset = this.$overlay[0].getBoundingClientRect();
312
+ this.$overlay.css({
313
+ width: this.windowWidth + 'px',
314
+ height: this.windowHeight + 'px',
315
+ left: -1 * overlayOffset.left + 'px',
316
+ top: -1 * overlayOffset.top + 'px'
317
+ });
318
+
319
+ // Animate Overlay
320
+ Vel(this.$overlay[0], { opacity: 1 }, { duration: this.options.inDuration, queue: false, ease: 'easeOutQuad' });
321
+
322
+ // Add and animate caption if it exists
323
+ if (this.caption !== "") {
324
+ this.$photoCaption = $('<div class="materialbox-caption"></div>');
325
+ this.$photoCaption.text(this.caption);
326
+ $('body').append(this.$photoCaption);
327
+ this.$photoCaption.css({ "display": "inline" });
328
+ Vel(this.$photoCaption[0], { opacity: 1 }, { duration: this.options.inDuration, queue: false, ease: 'easeOutQuad' });
329
+ }
330
+
331
+ // Resize Image
332
+ var ratio = 0;
333
+ var widthPercent = this.originalWidth / this.windowWidth;
334
+ var heightPercent = this.originalHeight / this.windowHeight;
335
+ this.newWidth = 0;
336
+ this.newHeight = 0;
337
+
338
+ if (widthPercent > heightPercent) {
339
+ ratio = this.originalHeight / this.originalWidth;
340
+ this.newWidth = this.windowWidth * 0.9;
341
+ this.newHeight = this.windowWidth * 0.9 * ratio;
342
+ } else {
343
+ ratio = this.originalWidth / this.originalHeight;
344
+ this.newWidth = this.windowHeight * 0.9 * ratio;
345
+ this.newHeight = this.windowHeight * 0.9;
346
+ }
347
+
348
+ this._animateImageIn();
349
+
350
+ // Handle Exit triggers
351
+ this._handleWindowScrollBound = this._handleWindowScroll.bind(this);
352
+ this._handleWindowResizeBound = this._handleWindowResize.bind(this);
353
+ this._handleWindowEscapeBound = this._handleWindowEscape.bind(this);
354
+
355
+ window.addEventListener('scroll', this._handleWindowScrollBound);
356
+ window.addEventListener('resize', this._handleWindowResizeBound);
357
+ window.addEventListener('keyup', this._handleWindowEscapeBound);
358
+ }
359
+
360
+ /**
361
+ * Close Materialbox
362
+ */
363
+
364
+ }, {
365
+ key: 'close',
366
+ value: function close() {
367
+ var _this4 = this;
368
+
369
+ this._updateVars();
370
+ this.doneAnimating = false;
371
+
372
+ Vel(this.el, 'stop');
373
+ Vel(this.$overlay[0], 'stop');
374
+ if (this.caption !== "") {
375
+ Vel(this.$photoCaption[0], 'stop');
376
+ }
377
+
378
+ // disable exit handlers
379
+ window.removeEventListener('scroll', this._handleWindowScrollBound);
380
+ window.removeEventListener('resize', this._handleWindowResizeBound);
381
+ window.removeEventListener('keyup', this._handleWindowEscapeBound);
382
+
383
+ Vel(this.$overlay[0], { opacity: 0 }, { duration: this.options.outDuration, queue: false, ease: 'easeOutQuad', complete: function () {
384
+ _this4.overlayActive = false;
385
+ _this4.$overlay.remove();
386
+ } });
387
+
388
+ this._animateImageOut();
389
+
390
+ // Remove Caption + reset css settings on image
391
+ if (this.caption !== "") {
392
+ Vel(this.$photoCaption[0], { opacity: 0 }, { duration: this.options.outDuration, queue: false, ease: 'easeOutQuad', complete: function () {
393
+ _this4.$photoCaption.remove();
394
+ } });
395
+ }
396
+ }
397
+ }], [{
398
+ key: 'init',
399
+ value: function init($els, options) {
400
+ var arr = [];
401
+ $els.each(function () {
402
+ arr.push(new Materialbox(this, options));
403
+ });
404
+ return arr;
405
+ }
406
+
407
+ /**
408
+ * Get Instance
409
+ */
410
+
411
+ }, {
412
+ key: 'getInstance',
413
+ value: function getInstance(el) {
414
+ var domElem = !!el.jquery ? el[0] : el;
415
+ return domElem.M_Materialbox;
416
+ }
417
+ }, {
418
+ key: 'defaults',
419
+ get: function () {
420
+ return _defaults;
421
+ }
422
+ }]);
423
+
424
+ return Materialbox;
425
+ }();
426
+
427
+ M.Materialbox = Materialbox;
428
+
429
+ if (M.jQueryLoaded) {
430
+ M.initializeJqueryWrapper(Materialbox, 'materialbox', 'M_Materialbox');
431
+ }
432
+ })(cash, M.Vel);
@@ -25,22 +25,20 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
25
25
  /**
26
26
  * Construct Modal instance and set up overlay
27
27
  * @constructor
28
- * @param {jQuery} $el
28
+ * @param {Element} el
29
29
  * @param {Object} options
30
30
  */
31
- function Modal($el, options) {
31
+ function Modal(el, options) {
32
32
  _classCallCheck(this, Modal);
33
33
 
34
34
  // If exists, destroy and reinitialize
35
- if (!!$el[0].M_Modal) {
36
- $el[0].M_Modal.destroy();
35
+ if (!!el.M_Modal) {
36
+ el.M_Modal.destroy();
37
37
  }
38
38
 
39
- /**
40
- * The jQuery element
41
- * @type {jQuery}
42
- */
43
- this.$el = $el;
39
+ this.el = el;
40
+ this.$el = $(el);
41
+ this.el.M_Modal = this;
44
42
 
45
43
  /**
46
44
  * Options for the modal
@@ -62,43 +60,30 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
62
60
  */
63
61
  this.isOpen = false;
64
62
 
65
- this.$el[0].M_Modal = this;
66
- this.id = $el.attr('id');
67
- this.openingTrigger = undefined;
63
+ this.id = this.$el.attr('id');
64
+ this._openingTrigger = undefined;
68
65
  this.$overlay = $('<div class="modal-overlay"></div>');
69
66
 
70
67
  Modal._increment++;
71
68
  Modal._count++;
72
69
  this.$overlay[0].style.zIndex = 1000 + Modal._increment * 2;
73
- this.$el[0].style.zIndex = 1000 + Modal._increment * 2 + 1;
74
- this.setupEventHandlers();
70
+ this.el.style.zIndex = 1000 + Modal._increment * 2 + 1;
71
+ this._setupEventHandlers();
75
72
  }
76
73
 
77
74
  _createClass(Modal, [{
78
- key: 'getInstance',
79
-
75
+ key: 'destroy',
80
76
 
81
- /**
82
- * Get Instance
83
- */
84
- value: function getInstance() {
85
- return this;
86
- }
87
77
 
88
78
  /**
89
79
  * Teardown component
90
80
  */
91
-
92
- }, {
93
- key: 'destroy',
94
81
  value: function destroy() {
95
- this.removeEventHandlers();
96
- this.$el[0].removeAttribute('style');
97
- if (!!this.$overlay[0].parentNode) {
98
- this.$overlay[0].parentNode.removeChild(this.$overlay[0]);
99
- }
100
- this.$el[0].M_Modal = undefined;
101
82
  Modal._count--;
83
+ this._removeEventHandlers();
84
+ this.el.removeAttribute('style');
85
+ this.$overlay.remove();
86
+ this.el.M_Modal = undefined;
102
87
  }
103
88
 
104
89
  /**
@@ -106,16 +91,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
106
91
  */
107
92
 
108
93
  }, {
109
- key: 'setupEventHandlers',
110
- value: function setupEventHandlers() {
111
- this.handleOverlayClickBound = this.handleOverlayClick.bind(this);
112
- this.handleModalCloseClickBound = this.handleModalCloseClick.bind(this);
94
+ key: '_setupEventHandlers',
95
+ value: function _setupEventHandlers() {
96
+ this._handleOverlayClickBound = this._handleOverlayClick.bind(this);
97
+ this._handleModalCloseClickBound = this._handleModalCloseClick.bind(this);
113
98
 
114
99
  if (Modal._count === 1) {
115
- document.body.addEventListener('click', this.handleTriggerClick);
100
+ document.body.addEventListener('click', this._handleTriggerClick);
116
101
  }
117
- this.$overlay[0].addEventListener('click', this.handleOverlayClickBound);
118
- this.$el[0].addEventListener('click', this.handleModalCloseClickBound);
102
+ this.$overlay[0].addEventListener('click', this._handleOverlayClickBound);
103
+ this.el.addEventListener('click', this._handleModalCloseClickBound);
119
104
  }
120
105
 
121
106
  /**
@@ -123,13 +108,13 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
123
108
  */
124
109
 
125
110
  }, {
126
- key: 'removeEventHandlers',
127
- value: function removeEventHandlers() {
111
+ key: '_removeEventHandlers',
112
+ value: function _removeEventHandlers() {
128
113
  if (Modal._count === 0) {
129
- document.body.removeEventListener('click', this.handleTriggerClick);
114
+ document.body.removeEventListener('click', this._handleTriggerClick);
130
115
  }
131
- this.$overlay[0].removeEventListener('click', this.handleOverlayClickBound);
132
- this.$el[0].removeEventListener('click', this.handleModalCloseClickBound);
116
+ this.$overlay[0].removeEventListener('click', this._handleOverlayClickBound);
117
+ this.el.removeEventListener('click', this._handleModalCloseClickBound);
133
118
  }
134
119
 
135
120
  /**
@@ -138,16 +123,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
138
123
  */
139
124
 
140
125
  }, {
141
- key: 'handleTriggerClick',
142
- value: function handleTriggerClick(e) {
126
+ key: '_handleTriggerClick',
127
+ value: function _handleTriggerClick(e) {
143
128
  var $trigger = $(e.target).closest('.modal-trigger');
144
- if (e.target && $trigger.length) {
145
- var modalId = $trigger[0].getAttribute('href');
146
- if (modalId) {
147
- modalId = modalId.slice(1);
148
- } else {
149
- modalId = $trigger[0].getAttribute('data-target');
150
- }
129
+ if ($trigger.length) {
130
+ var modalId = M.getIdFromTrigger($trigger[0]);
151
131
  var modalInstance = document.getElementById(modalId).M_Modal;
152
132
  if (modalInstance) {
153
133
  modalInstance.open($trigger);
@@ -161,8 +141,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
161
141
  */
162
142
 
163
143
  }, {
164
- key: 'handleOverlayClick',
165
- value: function handleOverlayClick() {
144
+ key: '_handleOverlayClick',
145
+ value: function _handleOverlayClick() {
166
146
  if (this.options.dismissible) {
167
147
  this.close();
168
148
  }
@@ -174,10 +154,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
174
154
  */
175
155
 
176
156
  }, {
177
- key: 'handleModalCloseClick',
178
- value: function handleModalCloseClick(e) {
157
+ key: '_handleModalCloseClick',
158
+ value: function _handleModalCloseClick(e) {
179
159
  var $closeTrigger = $(e.target).closest('.modal-close');
180
- if (e.target && $closeTrigger.length) {
160
+ if ($closeTrigger.length) {
181
161
  this.close();
182
162
  }
183
163
  }
@@ -188,8 +168,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
188
168
  */
189
169
 
190
170
  }, {
191
- key: 'handleKeydown',
192
- value: function handleKeydown(e) {
171
+ key: '_handleKeydown',
172
+ value: function _handleKeydown(e) {
193
173
  // ESC key
194
174
  if (e.keyCode === 27 && this.options.dismissible) {
195
175
  this.close();
@@ -201,12 +181,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
201
181
  */
202
182
 
203
183
  }, {
204
- key: 'animateIn',
205
- value: function animateIn() {
184
+ key: '_animateIn',
185
+ value: function _animateIn() {
206
186
  var _this = this;
207
187
 
208
188
  // Set initial styles
209
- $.extend(this.$el[0].style, {
189
+ $.extend(this.el.style, {
210
190
  display: 'block',
211
191
  opacity: 0
212
192
  });
@@ -226,20 +206,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
226
206
  // Handle modal ready callback
227
207
  complete: function () {
228
208
  if (typeof _this.options.ready === 'function') {
229
- _this.options.ready.call(_this, _this.$el, _this.openingTrigger);
209
+ _this.options.ready.call(_this, _this.el, _this._openingTrigger);
230
210
  }
231
211
  }
232
212
  };
233
213
 
234
214
  // Bottom sheet animation
235
- if (this.$el[0].classList.contains('bottom-sheet')) {
236
- Vel(this.$el[0], { bottom: 0, opacity: 1 }, enterVelocityOptions);
215
+ if (this.el.classList.contains('bottom-sheet')) {
216
+ Vel(this.el, { bottom: 0, opacity: 1 }, enterVelocityOptions);
237
217
 
238
218
  // Normal modal animation
239
219
  } else {
240
- Vel.hook(this.$el[0], 'scaleX', 0.7);
241
- this.$el[0].style.top = this.options.startingTop;
242
- Vel(this.$el[0], { top: this.options.endingTop, opacity: 1, scaleX: 1 }, enterVelocityOptions);
220
+ Vel.hook(this.el, 'scaleX', 0.8);
221
+ Vel.hook(this.el, 'scaleY', 0.8);
222
+ this.el.style.top = this.options.startingTop;
223
+ Vel(this.el, { top: this.options.endingTop, opacity: 1, scaleX: 1, scaleY: 1 }, enterVelocityOptions);
243
224
  }
244
225
  }
245
226
 
@@ -248,8 +229,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
248
229
  */
249
230
 
250
231
  }, {
251
- key: 'animateOut',
252
- value: function animateOut() {
232
+ key: '_animateOut',
233
+ value: function _animateOut() {
253
234
  var _this2 = this;
254
235
 
255
236
  // Animate overlay
@@ -262,28 +243,28 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
262
243
  ease: 'easeOutCubic',
263
244
  // Handle modal ready callback
264
245
  complete: function () {
265
- _this2.$el[0].style.display = 'none';
246
+ _this2.el.style.display = 'none';
266
247
  // Call complete callback
267
248
  if (typeof _this2.options.complete === 'function') {
268
249
  _this2.options.complete.call(_this2, _this2.$el);
269
250
  }
270
- _this2.$overlay[0].parentNode.removeChild(_this2.$overlay[0]);
251
+ _this2.$overlay.remove();
271
252
  }
272
253
  };
273
254
 
274
255
  // Bottom sheet animation
275
- if (this.$el[0].classList.contains('bottom-sheet')) {
276
- Vel(this.$el[0], { bottom: '-100%', opacity: 0 }, exitVelocityOptions);
256
+ if (this.el.classList.contains('bottom-sheet')) {
257
+ Vel(this.el, { bottom: '-100%', opacity: 0 }, exitVelocityOptions);
277
258
 
278
259
  // Normal modal animation
279
260
  } else {
280
- Vel(this.$el[0], { top: this.options.startingTop, opacity: 0, scaleX: 0.7 }, exitVelocityOptions);
261
+ Vel(this.el, { top: this.options.startingTop, opacity: 0, scaleX: 0.8, scaleY: 0.8 }, exitVelocityOptions);
281
262
  }
282
263
  }
283
264
 
284
265
  /**
285
266
  * Open Modal
286
- * @param {jQuery} [$trigger]
267
+ * @param {cash} [$trigger]
287
268
  */
288
269
 
289
270
  }, {
@@ -296,19 +277,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
296
277
  this.isOpen = true;
297
278
  var body = document.body;
298
279
  body.style.overflow = 'hidden';
299
- this.$el[0].classList.add('open');
280
+ this.el.classList.add('open');
300
281
  body.appendChild(this.$overlay[0]);
301
282
 
302
283
  // Set opening trigger, undefined indicates modal was opened by javascript
303
- this.openingTrigger = !!$trigger ? $trigger : undefined;
284
+ this._openingTrigger = !!$trigger ? $trigger : undefined;
304
285
 
305
286
  if (this.options.dismissible) {
306
- this.handleKeydownBound = this.handleKeydown.bind(this);
307
- document.addEventListener('keydown', this.handleKeydownBound);
287
+ this._handleKeydownBound = this._handleKeydown.bind(this);
288
+ document.addEventListener('keydown', this._handleKeydownBound);
308
289
  }
309
290
 
310
- this.animateIn();
311
-
291
+ this._animateIn();
312
292
  return this;
313
293
  }
314
294
 
@@ -324,15 +304,14 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
324
304
  }
325
305
 
326
306
  this.isOpen = false;
327
- this.$el[0].classList.remove('open');
307
+ this.el.classList.remove('open');
328
308
  document.body.style.overflow = '';
329
309
 
330
310
  if (this.options.dismissible) {
331
- document.removeEventListener('keydown', this.handleKeydownBound);
311
+ document.removeEventListener('keydown', this._handleKeydownBound);
332
312
  }
333
313
 
334
- this.animateOut();
335
-
314
+ this._animateOut();
336
315
  return this;
337
316
  }
338
317
  }], [{
@@ -340,10 +319,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
340
319
  value: function init($els, options) {
341
320
  var arr = [];
342
321
  $els.each(function () {
343
- arr.push(new Modal($(this), options));
322
+ arr.push(new Modal(this, options));
344
323
  });
345
324
  return arr;
346
325
  }
326
+
327
+ /**
328
+ * Get Instance
329
+ */
330
+
331
+ }, {
332
+ key: 'getInstance',
333
+ value: function getInstance(el) {
334
+ var domElem = !!el.jquery ? el[0] : el;
335
+ return domElem.M_Modal;
336
+ }
347
337
  }, {
348
338
  key: 'defaults',
349
339
  get: function () {
@@ -368,30 +358,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
368
358
  */
369
359
  Modal._count = 0;
370
360
 
371
- Materialize.Modal = Modal;
372
-
373
- $.fn.modal = function (methodOrOptions) {
374
- // Call plugin method if valid method name is passed in
375
- if (Modal.prototype[methodOrOptions]) {
376
- // Getter methods
377
- if (methodOrOptions.slice(0, 3) === 'get') {
378
- return this.first()[0].M_Modal[methodOrOptions]();
379
-
380
- // Void methods
381
- } else {
382
- return this.each(function () {
383
- this.M_Modal[methodOrOptions]();
384
- });
385
- }
386
-
387
- // Initialize plugin if options or no argument is passed in
388
- } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
389
- Modal.init(this, arguments[0]);
390
- return this;
361
+ M.Modal = Modal;
391
362
 
392
- // Return error if an unrecognized method name is passed in
393
- } else {
394
- $.error('Method ' + methodOrOptions + ' does not exist on jQuery.modal');
395
- }
396
- };
397
- })(jQuery, Materialize.Vel);
363
+ if (M.jQueryLoaded) {
364
+ M.initializeJqueryWrapper(Modal, 'modal', 'M_Modal');
365
+ }
366
+ })(cash, M.Vel);