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,584 @@
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
+ edge: 'left',
10
+ draggable: true,
11
+ inDuration: 250,
12
+ outDuration: 200,
13
+ onOpenStart: null,
14
+ onOpenEnd: null,
15
+ onCloseStart: null,
16
+ onCloseEnd: null
17
+ };
18
+
19
+ /**
20
+ * @class
21
+ */
22
+
23
+ var Sidenav = function () {
24
+ /**
25
+ * Construct Sidenav instance and set up overlay
26
+ * @constructor
27
+ * @param {Element} el
28
+ * @param {Object} options
29
+ */
30
+ function Sidenav(el, options) {
31
+ _classCallCheck(this, Sidenav);
32
+
33
+ // If exists, destroy and reinitialize
34
+ if (!!el.M_Sidenav) {
35
+ el.M_Sidenav.destroy();
36
+ }
37
+
38
+ this.el = el;
39
+ this.$el = $(el);
40
+ this.el.M_Sidenav = this;
41
+ this.id = this.$el.attr('id');
42
+
43
+ /**
44
+ * Options for the Sidenav
45
+ * @member Sidenav#options
46
+ * @prop {String} [edge='left'] - Side of screen on which Sidenav appears
47
+ * @prop {Boolean} [draggable=true] - Allow swipe gestures to open/close Sidenav
48
+ * @prop {Number} [inDuration=250] - Length in ms of enter transition
49
+ * @prop {Number} [outDuration=200] - Length in ms of exit transition
50
+ * @prop {Function} onOpenStart - Function called when sidenav starts entering
51
+ * @prop {Function} onOpenEnd - Function called when sidenav finishes entering
52
+ * @prop {Function} onCloseStart - Function called when sidenav starts exiting
53
+ * @prop {Function} onCloseEnd - Function called when sidenav finishes exiting
54
+ */
55
+ this.options = $.extend({}, Sidenav.defaults, options);
56
+
57
+ /**
58
+ * Describes open/close state of Sidenav
59
+ * @type {Boolean}
60
+ */
61
+ this.isOpen = false;
62
+
63
+ /**
64
+ * Describes if Sidenav is fixed
65
+ * @type {Boolean}
66
+ */
67
+ this.isFixed = this.el.classList.contains('sidenav-fixed');
68
+
69
+ /**
70
+ * Describes if Sidenav is being draggeed
71
+ * @type {Boolean}
72
+ */
73
+ this.isDragged = false;
74
+
75
+ this._createOverlay();
76
+ this._createDragTarget();
77
+ this._setupEventHandlers();
78
+ this._setupClasses();
79
+ this._setupFixed();
80
+
81
+ Sidenav._sidenavs.push(this);
82
+ }
83
+
84
+ _createClass(Sidenav, [{
85
+ key: 'destroy',
86
+
87
+
88
+ /**
89
+ * Teardown component
90
+ */
91
+ value: function destroy() {
92
+ this._removeEventHandlers();
93
+ this._overlay.parentNode.removeChild(this._overlay);
94
+ this.dragTarget.parentNode.removeChild(this.dragTarget);
95
+ this.el.M_Sidenav = undefined;
96
+
97
+ var index = Sidenav._sidenavs.indexOf(this);
98
+ if (index >= 0) {
99
+ Sidenav._sidenavs.splice(index, 1);
100
+ }
101
+ }
102
+ }, {
103
+ key: '_createOverlay',
104
+ value: function _createOverlay() {
105
+ var overlay = document.createElement('div');
106
+ this._closeBound = this.close.bind(this);
107
+ overlay.classList.add('sidenav-overlay');
108
+
109
+ overlay.addEventListener('click', this._closeBound);
110
+
111
+ document.body.appendChild(overlay);
112
+ this._overlay = overlay;
113
+ }
114
+ }, {
115
+ key: '_setupEventHandlers',
116
+ value: function _setupEventHandlers() {
117
+ if (Sidenav._sidenavs.length === 0) {
118
+ document.body.addEventListener('click', this._handleTriggerClick);
119
+ }
120
+
121
+ this._handleDragTargetDragBound = this._handleDragTargetDrag.bind(this);
122
+ this._handleDragTargetReleaseBound = this._handleDragTargetRelease.bind(this);
123
+ this._handleCloseDragBound = this._handleCloseDrag.bind(this);
124
+ this._handleCloseReleaseBound = this._handleCloseRelease.bind(this);
125
+ this._handleCloseTriggerClickBound = this._handleCloseTriggerClick.bind(this);
126
+
127
+ this.dragTarget.addEventListener('touchmove', this._handleDragTargetDragBound);
128
+ this.dragTarget.addEventListener('touchend', this._handleDragTargetReleaseBound);
129
+ this._overlay.addEventListener('touchmove', this._handleCloseDragBound);
130
+ this._overlay.addEventListener('touchend', this._handleCloseReleaseBound);
131
+ this.el.addEventListener('touchmove', this._handleCloseDragBound);
132
+ this.el.addEventListener('touchend', this._handleCloseReleaseBound);
133
+ this.el.addEventListener('click', this._handleCloseTriggerClickBound);
134
+
135
+ // Add resize for side nav fixed
136
+ if (this.isFixed) {
137
+ this._handleWindowResizeBound = this._handleWindowResize.bind(this);
138
+ window.addEventListener('resize', this._handleWindowResizeBound);
139
+ }
140
+ }
141
+ }, {
142
+ key: '_removeEventHandlers',
143
+ value: function _removeEventHandlers() {
144
+ if (Sidenav._sidenavs.length === 1) {
145
+ document.body.removeEventListener('click', this._handleTriggerClick);
146
+ }
147
+
148
+ this.dragTarget.removeEventListener('touchmove', this._handleDragTargetDragBound);
149
+ this.dragTarget.removeEventListener('touchend', this._handleDragTargetReleaseBound);
150
+ this._overlay.removeEventListener('touchmove', this._handleCloseDragBound);
151
+ this._overlay.removeEventListener('touchend', this._handleCloseReleaseBound);
152
+ this.el.removeEventListener('touchmove', this._handleCloseDragBound);
153
+ this.el.removeEventListener('touchend', this._handleCloseReleaseBound);
154
+ this.el.removeEventListener('click', this._handleCloseTriggerClickBound);
155
+
156
+ // Remove resize for side nav fixed
157
+ if (this.isFixed) {
158
+ window.removeEventListener('resize', this._handleWindowResizeBound);
159
+ }
160
+ }
161
+
162
+ /**
163
+ * Handle Trigger Click
164
+ * @param {Event} e
165
+ */
166
+
167
+ }, {
168
+ key: '_handleTriggerClick',
169
+ value: function _handleTriggerClick(e) {
170
+ var $trigger = $(e.target).closest('.sidenav-trigger');
171
+ if (e.target && $trigger.length) {
172
+ var sidenavId = M.getIdFromTrigger($trigger[0]);
173
+
174
+ var sidenavInstance = document.getElementById(sidenavId).M_Sidenav;
175
+ if (sidenavInstance) {
176
+ sidenavInstance.open($trigger);
177
+ }
178
+ e.preventDefault();
179
+ }
180
+ }
181
+
182
+ /**
183
+ * Set variables needed at the beggining of drag
184
+ * and stop any current Velocity transition.
185
+ * @param {Event} e
186
+ */
187
+
188
+ }, {
189
+ key: '_startDrag',
190
+ value: function _startDrag(e) {
191
+ var clientX = e.targetTouches[0].clientX;
192
+ this.isDragged = true;
193
+ this._startingXpos = clientX;
194
+ this._xPos = this._startingXpos;
195
+ this._time = Date.now();
196
+ this._width = this.el.getBoundingClientRect().width;
197
+ this._overlay.style.display = 'block';
198
+ Vel(this.el, 'stop');
199
+ Vel(this._overlay, 'stop');
200
+ }
201
+
202
+ /**
203
+ * Set variables needed at each drag move update tick
204
+ * @param {Event} e
205
+ */
206
+
207
+ }, {
208
+ key: '_dragMoveUpdate',
209
+ value: function _dragMoveUpdate(e) {
210
+ var clientX = e.targetTouches[0].clientX;
211
+ this.deltaX = Math.abs(this._xPos - clientX);
212
+ this._xPos = clientX;
213
+ this.velocityX = this.deltaX / (Date.now() - this._time);
214
+ this._time = Date.now();
215
+ }
216
+
217
+ /**
218
+ * Handles Dragging of Sidenav
219
+ * @param {Event} e
220
+ */
221
+
222
+ }, {
223
+ key: '_handleDragTargetDrag',
224
+ value: function _handleDragTargetDrag(e) {
225
+ // If not being dragged, set initial drag start variables
226
+ if (!this.isDragged) {
227
+ this._startDrag(e);
228
+ }
229
+
230
+ // Run touchmove updates
231
+ this._dragMoveUpdate(e);
232
+
233
+ // Calculate raw deltaX
234
+ var totalDeltaX = this._xPos - this._startingXpos;
235
+
236
+ // dragDirection is the attempted user drag direction
237
+ var dragDirection = totalDeltaX > 0 ? 'right' : 'left';
238
+
239
+ // Don't allow totalDeltaX to exceed Sidenav width or be dragged in the opposite direction
240
+ totalDeltaX = Math.min(this._width, Math.abs(totalDeltaX));
241
+ if (this.options.edge === dragDirection) {
242
+ totalDeltaX = 0;
243
+ }
244
+
245
+ /**
246
+ * transformX is the drag displacement
247
+ * transformPrefix is the initial transform placement
248
+ * Invert values if Sidenav is right edge
249
+ */
250
+ var transformX = totalDeltaX;
251
+ var transformPrefix = 'translateX(-100%)';
252
+ if (this.options.edge === 'right') {
253
+ transformPrefix = 'translateX(100%)';
254
+ transformX = -transformX;
255
+ }
256
+
257
+ // Calculate open/close percentage of sidenav, with open = 1 and close = 0
258
+ this.percentOpen = Math.min(1, totalDeltaX / this._width);
259
+
260
+ // Set transform and opacity styles
261
+ this.el.style.transform = transformPrefix + ' translateX(' + transformX + 'px)';
262
+ this._overlay.style.opacity = this.percentOpen;
263
+ }
264
+
265
+ /**
266
+ * Handle Drag Target Release
267
+ */
268
+
269
+ }, {
270
+ key: '_handleDragTargetRelease',
271
+ value: function _handleDragTargetRelease() {
272
+ if (this.isDragged) {
273
+ if (this.percentOpen > .5) {
274
+ this.open();
275
+ } else {
276
+ this._animateOut();
277
+ }
278
+
279
+ this.isDragged = false;
280
+ }
281
+ }
282
+
283
+ /**
284
+ * Handle Close Drag
285
+ * @param {Event} e
286
+ */
287
+
288
+ }, {
289
+ key: '_handleCloseDrag',
290
+ value: function _handleCloseDrag(e) {
291
+ if (this.isOpen) {
292
+
293
+ // If not being dragged, set initial drag start variables
294
+ if (!this.isDragged) {
295
+ this._startDrag(e);
296
+ }
297
+
298
+ // Run touchmove updates
299
+ this._dragMoveUpdate(e);
300
+
301
+ // Calculate raw deltaX
302
+ var totalDeltaX = this._xPos - this._startingXpos;
303
+
304
+ // dragDirection is the attempted user drag direction
305
+ var dragDirection = totalDeltaX > 0 ? 'right' : 'left';
306
+
307
+ // Don't allow totalDeltaX to exceed Sidenav width or be dragged in the opposite direction
308
+ totalDeltaX = Math.min(this._width, Math.abs(totalDeltaX));
309
+ if (this.options.edge !== dragDirection) {
310
+ totalDeltaX = 0;
311
+ }
312
+
313
+ var transformX = -totalDeltaX;
314
+ if (this.options.edge === 'right') {
315
+ transformX = -transformX;
316
+ }
317
+
318
+ // Calculate open/close percentage of sidenav, with open = 1 and close = 0
319
+ this.percentOpen = Math.min(1, 1 - totalDeltaX / this._width);
320
+
321
+ // Set transform and opacity styles
322
+ this.el.style.transform = 'translateX(' + transformX + 'px)';
323
+ this._overlay.style.opacity = this.percentOpen;
324
+ }
325
+ }
326
+
327
+ /**
328
+ * Handle Close Release
329
+ */
330
+
331
+ }, {
332
+ key: '_handleCloseRelease',
333
+ value: function _handleCloseRelease() {
334
+ if (this.isOpen && this.isDragged) {
335
+ if (this.percentOpen > .5) {
336
+ this._animateIn();
337
+ } else {
338
+ this.close();
339
+ }
340
+
341
+ this.isDragged = false;
342
+ }
343
+ }
344
+
345
+ /**
346
+ * Handles closing of Sidenav when element with class .sidenav-close
347
+ */
348
+
349
+ }, {
350
+ key: '_handleCloseTriggerClick',
351
+ value: function _handleCloseTriggerClick(e) {
352
+ var $closeTrigger = $(e.target).closest('.sidenav-close');
353
+ if ($closeTrigger.length) {
354
+ this.close();
355
+ }
356
+ }
357
+
358
+ /**
359
+ * Handle Window Resize
360
+ */
361
+
362
+ }, {
363
+ key: '_handleWindowResize',
364
+ value: function _handleWindowResize() {
365
+ if (window.innerWidth > 992) {
366
+ this.open();
367
+ } else {
368
+ this.close();
369
+ }
370
+ }
371
+ }, {
372
+ key: '_setupClasses',
373
+ value: function _setupClasses() {
374
+ if (this.options.edge === 'right') {
375
+ this.el.classList.add('right-aligned');
376
+ this.dragTarget.classList.add('right-aligned');
377
+ }
378
+ }
379
+ }, {
380
+ key: '_removeClasses',
381
+ value: function _removeClasses() {
382
+ this.el.classList.remove('right-aligned');
383
+ this.dragTarget.classList.remove('right-aligned');
384
+ }
385
+ }, {
386
+ key: '_setupFixed',
387
+ value: function _setupFixed() {
388
+ if (this.isFixed && window.innerWidth > 992) {
389
+ this.open();
390
+ }
391
+ }
392
+ }, {
393
+ key: '_createDragTarget',
394
+ value: function _createDragTarget() {
395
+ var dragTarget = document.createElement('div');
396
+ dragTarget.classList.add('drag-target');
397
+ document.body.appendChild(dragTarget);
398
+ this.dragTarget = dragTarget;
399
+ }
400
+ }, {
401
+ key: '_preventBodyScrolling',
402
+ value: function _preventBodyScrolling() {
403
+ var body = document.body;
404
+ body.style.overflow = 'hidden';
405
+ }
406
+ }, {
407
+ key: '_enableBodyScrolling',
408
+ value: function _enableBodyScrolling() {
409
+ var body = document.body;
410
+ body.style.overflow = '';
411
+ }
412
+ }, {
413
+ key: 'open',
414
+ value: function open() {
415
+ if (this.isOpen === true) {
416
+ return;
417
+ }
418
+
419
+ this.isOpen = true;
420
+
421
+ // Run onOpenStart callback
422
+ if (typeof this.options.onOpenStart === 'function') {
423
+ this.options.onOpenStart.call(this, this.el);
424
+ }
425
+
426
+ // Handle fixed Sidenav
427
+ if (this.isFixed && window.innerWidth > 992) {
428
+ Vel(this.el, 'stop');
429
+ Vel(this.el, { translateX: 0 }, { duration: 0, queue: false });
430
+ this._enableBodyScrolling();
431
+ this._overlay.style.display = 'none';
432
+
433
+ // Handle non-fixed Sidenav
434
+ } else {
435
+ this._preventBodyScrolling();
436
+
437
+ if (!this.isDragged || this.percentOpen != 1) {
438
+ this._animateIn();
439
+ }
440
+ }
441
+ }
442
+ }, {
443
+ key: 'close',
444
+ value: function close() {
445
+ if (this.isOpen === false) {
446
+ return;
447
+ }
448
+
449
+ this.isOpen = false;
450
+
451
+ // Run onCloseStart callback
452
+ if (typeof this.options.onCloseStart === 'function') {
453
+ this.options.onCloseStart.call(this, this.el);
454
+ }
455
+
456
+ // Handle fixed Sidenav
457
+ if (this.isFixed && window.innerWidth > 992) {
458
+ var transformX = this.options.edge === 'left' ? '-105%' : '105%';
459
+ this.el.style.transform = 'translateX(' + transformX + ')';
460
+
461
+ // Handle non-fixed Sidenav
462
+ } else {
463
+ this._enableBodyScrolling();
464
+
465
+ if (!this.isDragged || this.percentOpen != 0) {
466
+ this._animateOut();
467
+ } else {
468
+ this._overlay.style.display = 'none';
469
+ }
470
+ }
471
+ }
472
+ }, {
473
+ key: '_animateIn',
474
+ value: function _animateIn() {
475
+ this._animateSidenavIn();
476
+ this._animateOverlayIn();
477
+ }
478
+ }, {
479
+ key: '_animateSidenavIn',
480
+ value: function _animateSidenavIn() {
481
+ var _this = this;
482
+
483
+ var slideOutPercent = this.options.edge === 'left' ? -1 : 1;
484
+ if (this.isDragged) {
485
+ slideOutPercent = this.options.edge === 'left' ? slideOutPercent + this.percentOpen : slideOutPercent - this.percentOpen;
486
+ }
487
+
488
+ Vel(this.el, 'stop');
489
+ Vel(this.el, { 'translateX': [0, slideOutPercent * 100 + '%'] }, { duration: this.options.inDuration, queue: false, easing: 'easeOutQuad', complete: function () {
490
+ // Run onOpenEnd callback
491
+ if (typeof _this.options.onOpenEnd === 'function') {
492
+ _this.options.onOpenEnd.call(_this, _this.el);
493
+ }
494
+ } });
495
+ }
496
+ }, {
497
+ key: '_animateOverlayIn',
498
+ value: function _animateOverlayIn() {
499
+ var start = 0;
500
+ if (this.isDragged) {
501
+ start = this.percentOpen;
502
+ } else {
503
+ Vel.hook(this._overlay, 'display', 'block');
504
+ }
505
+
506
+ Vel(this._overlay, 'stop');
507
+ Vel(this._overlay, { opacity: [1, start] }, { duration: this.options.inDuration, queue: false, easing: 'easeOutQuad' });
508
+ }
509
+ }, {
510
+ key: '_animateOut',
511
+ value: function _animateOut() {
512
+ this._animateSidenavOut();
513
+ this._animateOverlayOut();
514
+ }
515
+ }, {
516
+ key: '_animateSidenavOut',
517
+ value: function _animateSidenavOut() {
518
+ var _this2 = this;
519
+
520
+ var endPercent = this.options.edge === 'left' ? -1 : 1;
521
+ var slideOutPercent = 0;
522
+ if (this.isDragged) {
523
+ slideOutPercent = this.options.edge === 'left' ? endPercent + this.percentOpen : endPercent - this.percentOpen;
524
+ }
525
+
526
+ Vel(this.el, 'stop');
527
+ Vel(this.el, { 'translateX': [endPercent * 105 + '%', slideOutPercent * 100 + '%'] }, { duration: this.options.outDuration, queue: false, easing: 'easeOutQuad', complete: function () {
528
+ // Run onOpenEnd callback
529
+ if (typeof _this2.options.onCloseEnd === 'function') {
530
+ _this2.options.onCloseEnd.call(_this2, _this2.el);
531
+ }
532
+ } });
533
+ }
534
+ }, {
535
+ key: '_animateOverlayOut',
536
+ value: function _animateOverlayOut() {
537
+ Vel(this._overlay, 'stop');
538
+ Vel(this._overlay, 'fadeOut', { duration: this.options.outDuration, queue: false, easing: 'easeOutQuad' });
539
+ }
540
+ }], [{
541
+ key: 'init',
542
+ value: function init($els, options) {
543
+ var arr = [];
544
+ $els.each(function () {
545
+ arr.push(new Sidenav(this, options));
546
+ });
547
+ return arr;
548
+ }
549
+
550
+ /**
551
+ * Get Instance
552
+ */
553
+
554
+ }, {
555
+ key: 'getInstance',
556
+ value: function getInstance(el) {
557
+ var domElem = !!el.jquery ? el[0] : el;
558
+ return domElem.M_Sidenav;
559
+ }
560
+ }, {
561
+ key: 'defaults',
562
+ get: function () {
563
+ return _defaults;
564
+ }
565
+ }]);
566
+
567
+ return Sidenav;
568
+ }();
569
+
570
+ /**
571
+ * @static
572
+ * @memberof Sidenav
573
+ * @type {Array.<Sidenav>}
574
+ */
575
+
576
+
577
+ Sidenav._sidenavs = [];
578
+
579
+ window.M.Sidenav = Sidenav;
580
+
581
+ if (M.jQueryLoaded) {
582
+ M.initializeJqueryWrapper(Sidenav, 'sidenav', 'M_Sidenav');
583
+ }
584
+ })(cash, M.Vel);