materialize-sass 0.97.0 → 1.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +5 -5
  2. data/.gitattributes +1 -0
  3. data/.gitignore +3 -0
  4. data/README.md +48 -10
  5. data/Rakefile +129 -1
  6. data/assets/javascripts/materialize/anime.min.js +417 -0
  7. data/assets/javascripts/materialize/autocomplete.js +504 -0
  8. data/assets/javascripts/materialize/buttons.js +409 -0
  9. data/assets/javascripts/materialize/cards.js +34 -0
  10. data/assets/javascripts/materialize/carousel.js +797 -0
  11. data/assets/javascripts/materialize/cash.js +990 -0
  12. data/assets/javascripts/materialize/characterCounter.js +180 -0
  13. data/assets/javascripts/materialize/chips.js +564 -0
  14. data/assets/javascripts/materialize/collapsible.js +337 -0
  15. data/assets/javascripts/materialize/component.js +57 -0
  16. data/assets/javascripts/materialize/datepicker.js +935 -0
  17. data/assets/javascripts/materialize/dropdown.js +659 -0
  18. data/assets/javascripts/materialize/extras/nouislider.js +2147 -0
  19. data/assets/javascripts/materialize/extras/nouislider.min.js +1 -0
  20. data/assets/javascripts/materialize/forms.js +244 -0
  21. data/assets/javascripts/materialize/global.js +408 -0
  22. data/assets/javascripts/materialize/materialbox.js +513 -0
  23. data/assets/javascripts/materialize/modal.js +449 -0
  24. data/assets/javascripts/materialize/parallax.js +173 -0
  25. data/assets/javascripts/materialize/pushpin.js +179 -0
  26. data/assets/javascripts/materialize/range.js +310 -0
  27. data/assets/javascripts/materialize/scrollspy.js +328 -0
  28. data/assets/javascripts/materialize/select.js +497 -0
  29. data/assets/javascripts/materialize/sidenav.js +655 -0
  30. data/assets/javascripts/materialize/slider.js +424 -0
  31. data/assets/javascripts/materialize/tabs.js +476 -0
  32. data/assets/javascripts/materialize/tapTarget.js +364 -0
  33. data/assets/javascripts/materialize/timepicker.js +647 -0
  34. data/assets/javascripts/materialize/toasts.js +355 -0
  35. data/assets/javascripts/materialize/tooltip.js +351 -0
  36. data/{app/assets → assets}/javascripts/materialize/waves.js +42 -47
  37. data/assets/javascripts/materialize-sprockets.js +29 -0
  38. data/assets/javascripts/materialize.js +12374 -0
  39. data/assets/stylesheets/materialize/components/_badges.scss +55 -0
  40. data/assets/stylesheets/materialize/components/_buttons.scss +322 -0
  41. data/{app/assets → assets}/stylesheets/materialize/components/_cards.scss +72 -29
  42. data/assets/stylesheets/materialize/components/_carousel.scss +90 -0
  43. data/assets/stylesheets/materialize/components/_chips.scss +90 -0
  44. data/{app/assets → assets}/stylesheets/materialize/components/_collapsible.scss +23 -17
  45. data/assets/stylesheets/materialize/components/_color-classes.scss +32 -0
  46. data/{app/assets/stylesheets/materialize/components/_color.scss → assets/stylesheets/materialize/components/_color-variables.scss} +22 -64
  47. data/assets/stylesheets/materialize/components/_datepicker.scss +191 -0
  48. data/assets/stylesheets/materialize/components/_dropdown.scss +85 -0
  49. data/{app/assets → assets}/stylesheets/materialize/components/_global.scss +197 -144
  50. data/{app/assets → assets}/stylesheets/materialize/components/_grid.scss +57 -18
  51. data/assets/stylesheets/materialize/components/_icons-material-design.scss +5 -0
  52. data/{app/assets → assets}/stylesheets/materialize/components/_materialbox.scss +15 -13
  53. data/{app/assets → assets}/stylesheets/materialize/components/_modal.scss +18 -14
  54. data/{app/assets → assets}/stylesheets/materialize/components/_navbar.scss +89 -25
  55. data/assets/stylesheets/materialize/components/_normalize.scss +447 -0
  56. data/{app/assets → assets}/stylesheets/materialize/components/_preloader.scss +5 -3
  57. data/assets/stylesheets/materialize/components/_pulse.scss +34 -0
  58. data/assets/stylesheets/materialize/components/_sidenav.scss +208 -0
  59. data/{app/assets → assets}/stylesheets/materialize/components/_slider.scss +2 -2
  60. data/{app/assets → assets}/stylesheets/materialize/components/_table_of_contents.scss +5 -5
  61. data/assets/stylesheets/materialize/components/_tabs.scss +99 -0
  62. data/assets/stylesheets/materialize/components/_tapTarget.scss +103 -0
  63. data/assets/stylesheets/materialize/components/_timepicker.scss +183 -0
  64. data/{app/assets → assets}/stylesheets/materialize/components/_toast.scss +17 -22
  65. data/assets/stylesheets/materialize/components/_tooltip.scss +32 -0
  66. data/assets/stylesheets/materialize/components/_transitions.scss +13 -0
  67. data/{app/assets → assets}/stylesheets/materialize/components/_typography.scss +11 -9
  68. data/assets/stylesheets/materialize/components/_variables.scss +349 -0
  69. data/assets/stylesheets/materialize/components/_waves.scss +114 -0
  70. data/assets/stylesheets/materialize/components/forms/_checkboxes.scss +200 -0
  71. data/assets/stylesheets/materialize/components/forms/_file-input.scss +44 -0
  72. data/assets/stylesheets/materialize/components/forms/_forms.scss +22 -0
  73. data/assets/stylesheets/materialize/components/forms/_input-fields.scss +354 -0
  74. data/assets/stylesheets/materialize/components/forms/_radio-buttons.scss +115 -0
  75. data/assets/stylesheets/materialize/components/forms/_range.scss +161 -0
  76. data/assets/stylesheets/materialize/components/forms/_select.scss +190 -0
  77. data/assets/stylesheets/materialize/components/forms/_switches.scss +89 -0
  78. data/assets/stylesheets/materialize/extras/nouislider.css +406 -0
  79. data/{app/assets → assets}/stylesheets/materialize.scss +13 -10
  80. data/lib/materialize-sass/engine.rb +11 -6
  81. data/lib/materialize-sass/helpers.rb +38 -0
  82. data/lib/materialize-sass/version.rb +1 -1
  83. data/lib/materialize-sass.rb +13 -28
  84. data/materialize-sass.gemspec +5 -5
  85. metadata +97 -105
  86. data/app/assets/fonts/material-design-icons/LICENSE.txt +0 -428
  87. data/app/assets/fonts/material-design-icons/Material-Design-Icons.eot +0 -0
  88. data/app/assets/fonts/material-design-icons/Material-Design-Icons.svg +0 -769
  89. data/app/assets/fonts/material-design-icons/Material-Design-Icons.ttf +0 -0
  90. data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff +0 -0
  91. data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff2 +0 -0
  92. data/app/assets/fonts/roboto/Roboto-Bold.ttf +0 -0
  93. data/app/assets/fonts/roboto/Roboto-Bold.woff +0 -0
  94. data/app/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
  95. data/app/assets/fonts/roboto/Roboto-Light.ttf +0 -0
  96. data/app/assets/fonts/roboto/Roboto-Light.woff +0 -0
  97. data/app/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
  98. data/app/assets/fonts/roboto/Roboto-Medium.ttf +0 -0
  99. data/app/assets/fonts/roboto/Roboto-Medium.woff +0 -0
  100. data/app/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
  101. data/app/assets/fonts/roboto/Roboto-Regular.ttf +0 -0
  102. data/app/assets/fonts/roboto/Roboto-Regular.woff +0 -0
  103. data/app/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
  104. data/app/assets/fonts/roboto/Roboto-Thin.ttf +0 -0
  105. data/app/assets/fonts/roboto/Roboto-Thin.woff +0 -0
  106. data/app/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
  107. data/app/assets/javascripts/materialize/animation.js +0 -9
  108. data/app/assets/javascripts/materialize/buttons.js +0 -61
  109. data/app/assets/javascripts/materialize/cards.js +0 -27
  110. data/app/assets/javascripts/materialize/character_counter.js +0 -59
  111. data/app/assets/javascripts/materialize/collapsible.js +0 -139
  112. data/app/assets/javascripts/materialize/date_picker/picker.date.js +0 -1430
  113. data/app/assets/javascripts/materialize/date_picker/picker.js +0 -1123
  114. data/app/assets/javascripts/materialize/dropdown.js +0 -178
  115. data/app/assets/javascripts/materialize/forms.js +0 -456
  116. data/app/assets/javascripts/materialize/global.js +0 -36
  117. data/app/assets/javascripts/materialize/hammer.min.js +0 -1
  118. data/app/assets/javascripts/materialize/init.js +0 -136
  119. data/app/assets/javascripts/materialize/jquery.easing.1.3.js +0 -205
  120. data/app/assets/javascripts/materialize/jquery.hammer.js +0 -33
  121. data/app/assets/javascripts/materialize/jquery.timeago.min.js +0 -1
  122. data/app/assets/javascripts/materialize/leanModal.js +0 -178
  123. data/app/assets/javascripts/materialize/materialbox.js +0 -249
  124. data/app/assets/javascripts/materialize/parallax.js +0 -58
  125. data/app/assets/javascripts/materialize/prism.js +0 -8
  126. data/app/assets/javascripts/materialize/pushpin.js +0 -62
  127. data/app/assets/javascripts/materialize/scrollFire.js +0 -44
  128. data/app/assets/javascripts/materialize/scrollspy.js +0 -284
  129. data/app/assets/javascripts/materialize/sideNav.js +0 -312
  130. data/app/assets/javascripts/materialize/slider.js +0 -301
  131. data/app/assets/javascripts/materialize/tabs.js +0 -136
  132. data/app/assets/javascripts/materialize/toasts.js +0 -125
  133. data/app/assets/javascripts/materialize/tooltip.js +0 -166
  134. data/app/assets/javascripts/materialize/transitions.js +0 -154
  135. data/app/assets/javascripts/materialize/velocity.min.js +0 -4
  136. data/app/assets/javascripts/materialize-sprockets.js +0 -27
  137. data/app/assets/javascripts/materialize.js +0 -6159
  138. data/app/assets/stylesheets/materialize/components/_buttons.scss +0 -157
  139. data/app/assets/stylesheets/materialize/components/_dropdown.scss +0 -40
  140. data/app/assets/stylesheets/materialize/components/_form.scss +0 -886
  141. data/app/assets/stylesheets/materialize/components/_icons-material-design.scss +0 -3257
  142. data/app/assets/stylesheets/materialize/components/_mixins.scss +0 -5
  143. data/app/assets/stylesheets/materialize/components/_normalize.scss +0 -427
  144. data/app/assets/stylesheets/materialize/components/_prefixer.scss +0 -376
  145. data/app/assets/stylesheets/materialize/components/_roboto.scss +0 -38
  146. data/app/assets/stylesheets/materialize/components/_sideNav.scss +0 -111
  147. data/app/assets/stylesheets/materialize/components/_tabs.scss +0 -47
  148. data/app/assets/stylesheets/materialize/components/_tooltip.scss +0 -34
  149. data/app/assets/stylesheets/materialize/components/_variables.scss +0 -152
  150. data/app/assets/stylesheets/materialize/components/_waves.scss +0 -167
  151. data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +0 -435
  152. data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +0 -201
  153. data/app/assets/stylesheets/materialize/components/date_picker/_default.time.scss +0 -125
@@ -0,0 +1,449 @@
1
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2
+
3
+ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
4
+
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+
7
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8
+
9
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10
+
11
+ (function ($, anim) {
12
+ 'use strict';
13
+
14
+ var _defaults = {
15
+ opacity: 0.5,
16
+ inDuration: 250,
17
+ outDuration: 250,
18
+ onOpenStart: null,
19
+ onOpenEnd: null,
20
+ onCloseStart: null,
21
+ onCloseEnd: null,
22
+ preventScrolling: true,
23
+ dismissible: true,
24
+ startingTop: '4%',
25
+ endingTop: '10%'
26
+ };
27
+
28
+ /**
29
+ * @class
30
+ *
31
+ */
32
+
33
+ var Modal = function (_Component) {
34
+ _inherits(Modal, _Component);
35
+
36
+ /**
37
+ * Construct Modal instance and set up overlay
38
+ * @constructor
39
+ * @param {Element} el
40
+ * @param {Object} options
41
+ */
42
+ function Modal(el, options) {
43
+ _classCallCheck(this, Modal);
44
+
45
+ var _this = _possibleConstructorReturn(this, (Modal.__proto__ || Object.getPrototypeOf(Modal)).call(this, Modal, el, options));
46
+
47
+ _this.el.M_Modal = _this;
48
+
49
+ /**
50
+ * Options for the modal
51
+ * @member Modal#options
52
+ * @prop {Number} [opacity=0.5] - Opacity of the modal overlay
53
+ * @prop {Number} [inDuration=250] - Length in ms of enter transition
54
+ * @prop {Number} [outDuration=250] - Length in ms of exit transition
55
+ * @prop {Function} onOpenStart - Callback function called before modal is opened
56
+ * @prop {Function} onOpenEnd - Callback function called after modal is opened
57
+ * @prop {Function} onCloseStart - Callback function called before modal is closed
58
+ * @prop {Function} onCloseEnd - Callback function called after modal is closed
59
+ * @prop {Boolean} [dismissible=true] - Allow modal to be dismissed by keyboard or overlay click
60
+ * @prop {String} [startingTop='4%'] - startingTop
61
+ * @prop {String} [endingTop='10%'] - endingTop
62
+ */
63
+ _this.options = $.extend({}, Modal.defaults, options);
64
+
65
+ /**
66
+ * Describes open/close state of modal
67
+ * @type {Boolean}
68
+ */
69
+ _this.isOpen = false;
70
+
71
+ _this.id = _this.$el.attr('id');
72
+ _this._openingTrigger = undefined;
73
+ _this.$overlay = $('<div class="modal-overlay"></div>');
74
+ _this.el.tabIndex = 0;
75
+ _this._nthModalOpened = 0;
76
+
77
+ Modal._count++;
78
+ _this._setupEventHandlers();
79
+ return _this;
80
+ }
81
+
82
+ _createClass(Modal, [{
83
+ key: 'destroy',
84
+
85
+
86
+ /**
87
+ * Teardown component
88
+ */
89
+ value: function destroy() {
90
+ Modal._count--;
91
+ this._removeEventHandlers();
92
+ this.el.removeAttribute('style');
93
+ this.$overlay.remove();
94
+ this.el.M_Modal = undefined;
95
+ }
96
+
97
+ /**
98
+ * Setup Event Handlers
99
+ */
100
+
101
+ }, {
102
+ key: '_setupEventHandlers',
103
+ value: function _setupEventHandlers() {
104
+ this._handleOverlayClickBound = this._handleOverlayClick.bind(this);
105
+ this._handleModalCloseClickBound = this._handleModalCloseClick.bind(this);
106
+
107
+ if (Modal._count === 1) {
108
+ document.body.addEventListener('click', this._handleTriggerClick);
109
+ }
110
+ this.$overlay[0].addEventListener('click', this._handleOverlayClickBound);
111
+ this.el.addEventListener('click', this._handleModalCloseClickBound);
112
+ }
113
+
114
+ /**
115
+ * Remove Event Handlers
116
+ */
117
+
118
+ }, {
119
+ key: '_removeEventHandlers',
120
+ value: function _removeEventHandlers() {
121
+ if (Modal._count === 0) {
122
+ document.body.removeEventListener('click', this._handleTriggerClick);
123
+ }
124
+ this.$overlay[0].removeEventListener('click', this._handleOverlayClickBound);
125
+ this.el.removeEventListener('click', this._handleModalCloseClickBound);
126
+ }
127
+
128
+ /**
129
+ * Handle Trigger Click
130
+ * @param {Event} e
131
+ */
132
+
133
+ }, {
134
+ key: '_handleTriggerClick',
135
+ value: function _handleTriggerClick(e) {
136
+ var $trigger = $(e.target).closest('.modal-trigger');
137
+ if ($trigger.length) {
138
+ var modalId = M.getIdFromTrigger($trigger[0]);
139
+ var modalInstance = document.getElementById(modalId).M_Modal;
140
+ if (modalInstance) {
141
+ modalInstance.open($trigger);
142
+ }
143
+ e.preventDefault();
144
+ }
145
+ }
146
+
147
+ /**
148
+ * Handle Overlay Click
149
+ */
150
+
151
+ }, {
152
+ key: '_handleOverlayClick',
153
+ value: function _handleOverlayClick() {
154
+ if (this.options.dismissible) {
155
+ this.close();
156
+ }
157
+ }
158
+
159
+ /**
160
+ * Handle Modal Close Click
161
+ * @param {Event} e
162
+ */
163
+
164
+ }, {
165
+ key: '_handleModalCloseClick',
166
+ value: function _handleModalCloseClick(e) {
167
+ var $closeTrigger = $(e.target).closest('.modal-close');
168
+ if ($closeTrigger.length) {
169
+ this.close();
170
+ }
171
+ }
172
+
173
+ /**
174
+ * Handle Keydown
175
+ * @param {Event} e
176
+ */
177
+
178
+ }, {
179
+ key: '_handleKeydown',
180
+ value: function _handleKeydown(e) {
181
+ // ESC key
182
+ if (e.keyCode === 27 && this.options.dismissible) {
183
+ this.close();
184
+ }
185
+ }
186
+
187
+ /**
188
+ * Handle Focus
189
+ * @param {Event} e
190
+ */
191
+
192
+ }, {
193
+ key: '_handleFocus',
194
+ value: function _handleFocus(e) {
195
+ // Only trap focus if this modal is the last model opened (prevents loops in nested modals).
196
+ if (!this.el.contains(e.target) && this._nthModalOpened === Modal._modalsOpen) {
197
+ this.el.focus();
198
+ }
199
+ }
200
+
201
+ /**
202
+ * Animate in modal
203
+ */
204
+
205
+ }, {
206
+ key: '_animateIn',
207
+ value: function _animateIn() {
208
+ var _this2 = this;
209
+
210
+ // Set initial styles
211
+ $.extend(this.el.style, {
212
+ display: 'block',
213
+ opacity: 0
214
+ });
215
+ $.extend(this.$overlay[0].style, {
216
+ display: 'block',
217
+ opacity: 0
218
+ });
219
+
220
+ // Animate overlay
221
+ anim({
222
+ targets: this.$overlay[0],
223
+ opacity: this.options.opacity,
224
+ duration: this.options.inDuration,
225
+ easing: 'easeOutQuad'
226
+ });
227
+
228
+ // Define modal animation options
229
+ var enterAnimOptions = {
230
+ targets: this.el,
231
+ duration: this.options.inDuration,
232
+ easing: 'easeOutCubic',
233
+ // Handle modal onOpenEnd callback
234
+ complete: function () {
235
+ if (typeof _this2.options.onOpenEnd === 'function') {
236
+ _this2.options.onOpenEnd.call(_this2, _this2.el, _this2._openingTrigger);
237
+ }
238
+ }
239
+ };
240
+
241
+ // Bottom sheet animation
242
+ if (this.el.classList.contains('bottom-sheet')) {
243
+ $.extend(enterAnimOptions, {
244
+ bottom: 0,
245
+ opacity: 1
246
+ });
247
+ anim(enterAnimOptions);
248
+
249
+ // Normal modal animation
250
+ } else {
251
+ $.extend(enterAnimOptions, {
252
+ top: [this.options.startingTop, this.options.endingTop],
253
+ opacity: 1,
254
+ scaleX: [0.8, 1],
255
+ scaleY: [0.8, 1]
256
+ });
257
+ anim(enterAnimOptions);
258
+ }
259
+ }
260
+
261
+ /**
262
+ * Animate out modal
263
+ */
264
+
265
+ }, {
266
+ key: '_animateOut',
267
+ value: function _animateOut() {
268
+ var _this3 = this;
269
+
270
+ // Animate overlay
271
+ anim({
272
+ targets: this.$overlay[0],
273
+ opacity: 0,
274
+ duration: this.options.outDuration,
275
+ easing: 'easeOutQuart'
276
+ });
277
+
278
+ // Define modal animation options
279
+ var exitAnimOptions = {
280
+ targets: this.el,
281
+ duration: this.options.outDuration,
282
+ easing: 'easeOutCubic',
283
+ // Handle modal ready callback
284
+ complete: function () {
285
+ _this3.el.style.display = 'none';
286
+ _this3.$overlay.remove();
287
+
288
+ // Call onCloseEnd callback
289
+ if (typeof _this3.options.onCloseEnd === 'function') {
290
+ _this3.options.onCloseEnd.call(_this3, _this3.el);
291
+ }
292
+ }
293
+ };
294
+
295
+ // Bottom sheet animation
296
+ if (this.el.classList.contains('bottom-sheet')) {
297
+ $.extend(exitAnimOptions, {
298
+ bottom: '-100%',
299
+ opacity: 0
300
+ });
301
+ anim(exitAnimOptions);
302
+
303
+ // Normal modal animation
304
+ } else {
305
+ $.extend(exitAnimOptions, {
306
+ top: [this.options.endingTop, this.options.startingTop],
307
+ opacity: 0,
308
+ scaleX: 0.8,
309
+ scaleY: 0.8
310
+ });
311
+ anim(exitAnimOptions);
312
+ }
313
+ }
314
+
315
+ /**
316
+ * Open Modal
317
+ * @param {cash} [$trigger]
318
+ */
319
+
320
+ }, {
321
+ key: 'open',
322
+ value: function open($trigger) {
323
+ if (this.isOpen) {
324
+ return;
325
+ }
326
+
327
+ this.isOpen = true;
328
+ Modal._modalsOpen++;
329
+ this._nthModalOpened = Modal._modalsOpen;
330
+
331
+ // Set Z-Index based on number of currently open modals
332
+ this.$overlay[0].style.zIndex = 1000 + Modal._modalsOpen * 2;
333
+ this.el.style.zIndex = 1000 + Modal._modalsOpen * 2 + 1;
334
+
335
+ // Set opening trigger, undefined indicates modal was opened by javascript
336
+ this._openingTrigger = !!$trigger ? $trigger[0] : undefined;
337
+
338
+ // onOpenStart callback
339
+ if (typeof this.options.onOpenStart === 'function') {
340
+ this.options.onOpenStart.call(this, this.el, this._openingTrigger);
341
+ }
342
+
343
+ if (this.options.preventScrolling) {
344
+ document.body.style.overflow = 'hidden';
345
+ }
346
+
347
+ this.el.classList.add('open');
348
+ this.el.insertAdjacentElement('afterend', this.$overlay[0]);
349
+
350
+ if (this.options.dismissible) {
351
+ this._handleKeydownBound = this._handleKeydown.bind(this);
352
+ this._handleFocusBound = this._handleFocus.bind(this);
353
+ document.addEventListener('keydown', this._handleKeydownBound);
354
+ document.addEventListener('focus', this._handleFocusBound, true);
355
+ }
356
+
357
+ anim.remove(this.el);
358
+ anim.remove(this.$overlay[0]);
359
+ this._animateIn();
360
+
361
+ // Focus modal
362
+ this.el.focus();
363
+
364
+ return this;
365
+ }
366
+
367
+ /**
368
+ * Close Modal
369
+ */
370
+
371
+ }, {
372
+ key: 'close',
373
+ value: function close() {
374
+ if (!this.isOpen) {
375
+ return;
376
+ }
377
+
378
+ this.isOpen = false;
379
+ Modal._modalsOpen--;
380
+ this._nthModalOpened = 0;
381
+
382
+ // Call onCloseStart callback
383
+ if (typeof this.options.onCloseStart === 'function') {
384
+ this.options.onCloseStart.call(this, this.el);
385
+ }
386
+
387
+ this.el.classList.remove('open');
388
+
389
+ // Enable body scrolling only if there are no more modals open.
390
+ if (Modal._modalsOpen === 0) {
391
+ document.body.style.overflow = '';
392
+ }
393
+
394
+ if (this.options.dismissible) {
395
+ document.removeEventListener('keydown', this._handleKeydownBound);
396
+ document.removeEventListener('focus', this._handleFocusBound, true);
397
+ }
398
+
399
+ anim.remove(this.el);
400
+ anim.remove(this.$overlay[0]);
401
+ this._animateOut();
402
+ return this;
403
+ }
404
+ }], [{
405
+ key: 'init',
406
+ value: function init(els, options) {
407
+ return _get(Modal.__proto__ || Object.getPrototypeOf(Modal), 'init', this).call(this, this, els, options);
408
+ }
409
+
410
+ /**
411
+ * Get Instance
412
+ */
413
+
414
+ }, {
415
+ key: 'getInstance',
416
+ value: function getInstance(el) {
417
+ var domElem = !!el.jquery ? el[0] : el;
418
+ return domElem.M_Modal;
419
+ }
420
+ }, {
421
+ key: 'defaults',
422
+ get: function () {
423
+ return _defaults;
424
+ }
425
+ }]);
426
+
427
+ return Modal;
428
+ }(Component);
429
+
430
+ /**
431
+ * @static
432
+ * @memberof Modal
433
+ */
434
+
435
+
436
+ Modal._modalsOpen = 0;
437
+
438
+ /**
439
+ * @static
440
+ * @memberof Modal
441
+ */
442
+ Modal._count = 0;
443
+
444
+ M.Modal = Modal;
445
+
446
+ if (M.jQueryLoaded) {
447
+ M.initializeJqueryWrapper(Modal, 'modal', 'M_Modal');
448
+ }
449
+ })(cash, M.anime);
@@ -0,0 +1,173 @@
1
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2
+
3
+ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
4
+
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+
7
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8
+
9
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10
+
11
+ (function ($) {
12
+ 'use strict';
13
+
14
+ var _defaults = {
15
+ responsiveThreshold: 0 // breakpoint for swipeable
16
+ };
17
+
18
+ var Parallax = function (_Component) {
19
+ _inherits(Parallax, _Component);
20
+
21
+ function Parallax(el, options) {
22
+ _classCallCheck(this, Parallax);
23
+
24
+ var _this = _possibleConstructorReturn(this, (Parallax.__proto__ || Object.getPrototypeOf(Parallax)).call(this, Parallax, el, options));
25
+
26
+ _this.el.M_Parallax = _this;
27
+
28
+ /**
29
+ * Options for the Parallax
30
+ * @member Parallax#options
31
+ * @prop {Number} responsiveThreshold
32
+ */
33
+ _this.options = $.extend({}, Parallax.defaults, options);
34
+ _this._enabled = window.innerWidth > _this.options.responsiveThreshold;
35
+
36
+ _this.$img = _this.$el.find('img').first();
37
+ _this.$img.each(function () {
38
+ var el = this;
39
+ if (el.complete) $(el).trigger('load');
40
+ });
41
+
42
+ _this._updateParallax();
43
+ _this._setupEventHandlers();
44
+ _this._setupStyles();
45
+
46
+ Parallax._parallaxes.push(_this);
47
+ return _this;
48
+ }
49
+
50
+ _createClass(Parallax, [{
51
+ key: 'destroy',
52
+
53
+
54
+ /**
55
+ * Teardown component
56
+ */
57
+ value: function destroy() {
58
+ Parallax._parallaxes.splice(Parallax._parallaxes.indexOf(this), 1);
59
+ this.$img[0].style.transform = '';
60
+ this._removeEventHandlers();
61
+
62
+ this.$el[0].M_Parallax = undefined;
63
+ }
64
+ }, {
65
+ key: '_setupEventHandlers',
66
+ value: function _setupEventHandlers() {
67
+ this._handleImageLoadBound = this._handleImageLoad.bind(this);
68
+ this.$img[0].addEventListener('load', this._handleImageLoadBound);
69
+
70
+ if (Parallax._parallaxes.length === 0) {
71
+ Parallax._handleScrollThrottled = M.throttle(Parallax._handleScroll, 5);
72
+ window.addEventListener('scroll', Parallax._handleScrollThrottled);
73
+
74
+ Parallax._handleWindowResizeThrottled = M.throttle(Parallax._handleWindowResize, 5);
75
+ window.addEventListener('resize', Parallax._handleWindowResizeThrottled);
76
+ }
77
+ }
78
+ }, {
79
+ key: '_removeEventHandlers',
80
+ value: function _removeEventHandlers() {
81
+ this.$img[0].removeEventListener('load', this._handleImageLoadBound);
82
+
83
+ if (Parallax._parallaxes.length === 0) {
84
+ window.removeEventListener('scroll', Parallax._handleScrollThrottled);
85
+ window.removeEventListener('resize', Parallax._handleWindowResizeThrottled);
86
+ }
87
+ }
88
+ }, {
89
+ key: '_setupStyles',
90
+ value: function _setupStyles() {
91
+ this.$img[0].style.opacity = 1;
92
+ }
93
+ }, {
94
+ key: '_handleImageLoad',
95
+ value: function _handleImageLoad() {
96
+ this._updateParallax();
97
+ }
98
+ }, {
99
+ key: '_updateParallax',
100
+ value: function _updateParallax() {
101
+ var containerHeight = this.$el.height() > 0 ? this.el.parentNode.offsetHeight : 500;
102
+ var imgHeight = this.$img[0].offsetHeight;
103
+ var parallaxDist = imgHeight - containerHeight;
104
+ var bottom = this.$el.offset().top + containerHeight;
105
+ var top = this.$el.offset().top;
106
+ var scrollTop = M.getDocumentScrollTop();
107
+ var windowHeight = window.innerHeight;
108
+ var windowBottom = scrollTop + windowHeight;
109
+ var percentScrolled = (windowBottom - top) / (containerHeight + windowHeight);
110
+ var parallax = parallaxDist * percentScrolled;
111
+
112
+ if (!this._enabled) {
113
+ this.$img[0].style.transform = '';
114
+ } else if (bottom > scrollTop && top < scrollTop + windowHeight) {
115
+ this.$img[0].style.transform = 'translate3D(-50%, ' + parallax + 'px, 0)';
116
+ }
117
+ }
118
+ }], [{
119
+ key: 'init',
120
+ value: function init(els, options) {
121
+ return _get(Parallax.__proto__ || Object.getPrototypeOf(Parallax), 'init', this).call(this, this, els, options);
122
+ }
123
+
124
+ /**
125
+ * Get Instance
126
+ */
127
+
128
+ }, {
129
+ key: 'getInstance',
130
+ value: function getInstance(el) {
131
+ var domElem = !!el.jquery ? el[0] : el;
132
+ return domElem.M_Parallax;
133
+ }
134
+ }, {
135
+ key: '_handleScroll',
136
+ value: function _handleScroll() {
137
+ for (var i = 0; i < Parallax._parallaxes.length; i++) {
138
+ var parallaxInstance = Parallax._parallaxes[i];
139
+ parallaxInstance._updateParallax.call(parallaxInstance);
140
+ }
141
+ }
142
+ }, {
143
+ key: '_handleWindowResize',
144
+ value: function _handleWindowResize() {
145
+ for (var i = 0; i < Parallax._parallaxes.length; i++) {
146
+ var parallaxInstance = Parallax._parallaxes[i];
147
+ parallaxInstance._enabled = window.innerWidth > parallaxInstance.options.responsiveThreshold;
148
+ }
149
+ }
150
+ }, {
151
+ key: 'defaults',
152
+ get: function () {
153
+ return _defaults;
154
+ }
155
+ }]);
156
+
157
+ return Parallax;
158
+ }(Component);
159
+
160
+ /**
161
+ * @static
162
+ * @memberof Parallax
163
+ */
164
+
165
+
166
+ Parallax._parallaxes = [];
167
+
168
+ M.Parallax = Parallax;
169
+
170
+ if (M.jQueryLoaded) {
171
+ M.initializeJqueryWrapper(Parallax, 'parallax', 'M_Parallax');
172
+ }
173
+ })(cash);