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,476 @@
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
+ duration: 300,
16
+ onShow: null,
17
+ swipeable: false,
18
+ responsiveThreshold: Infinity // breakpoint for swipeable
19
+ };
20
+
21
+ /**
22
+ * @class
23
+ *
24
+ */
25
+
26
+ var Tabs = function (_Component) {
27
+ _inherits(Tabs, _Component);
28
+
29
+ /**
30
+ * Construct Tabs instance
31
+ * @constructor
32
+ * @param {Element} el
33
+ * @param {Object} options
34
+ */
35
+ function Tabs(el, options) {
36
+ _classCallCheck(this, Tabs);
37
+
38
+ var _this = _possibleConstructorReturn(this, (Tabs.__proto__ || Object.getPrototypeOf(Tabs)).call(this, Tabs, el, options));
39
+
40
+ _this.el.M_Tabs = _this;
41
+
42
+ /**
43
+ * Options for the Tabs
44
+ * @member Tabs#options
45
+ * @prop {Number} duration
46
+ * @prop {Function} onShow
47
+ * @prop {Boolean} swipeable
48
+ * @prop {Number} responsiveThreshold
49
+ */
50
+ _this.options = $.extend({}, Tabs.defaults, options);
51
+
52
+ // Setup
53
+ _this.$tabLinks = _this.$el.children('li.tab').children('a');
54
+ _this.index = 0;
55
+ _this._setupActiveTabLink();
56
+
57
+ // Setup tabs content
58
+ if (_this.options.swipeable) {
59
+ _this._setupSwipeableTabs();
60
+ } else {
61
+ _this._setupNormalTabs();
62
+ }
63
+
64
+ // Setup tabs indicator after content to ensure accurate widths
65
+ _this._setTabsAndTabWidth();
66
+ _this._createIndicator();
67
+
68
+ _this._setupEventHandlers();
69
+ return _this;
70
+ }
71
+
72
+ _createClass(Tabs, [{
73
+ key: 'destroy',
74
+
75
+
76
+ /**
77
+ * Teardown component
78
+ */
79
+ value: function destroy() {
80
+ this._removeEventHandlers();
81
+ this._indicator.parentNode.removeChild(this._indicator);
82
+
83
+ if (this.options.swipeable) {
84
+ this._teardownSwipeableTabs();
85
+ } else {
86
+ this._teardownNormalTabs();
87
+ }
88
+
89
+ this.$el[0].M_Tabs = undefined;
90
+ }
91
+
92
+ /**
93
+ * Setup Event Handlers
94
+ */
95
+
96
+ }, {
97
+ key: '_setupEventHandlers',
98
+ value: function _setupEventHandlers() {
99
+ this._handleWindowResizeBound = this._handleWindowResize.bind(this);
100
+ window.addEventListener('resize', this._handleWindowResizeBound);
101
+
102
+ this._handleTabClickBound = this._handleTabClick.bind(this);
103
+ this.el.addEventListener('click', this._handleTabClickBound);
104
+ }
105
+
106
+ /**
107
+ * Remove Event Handlers
108
+ */
109
+
110
+ }, {
111
+ key: '_removeEventHandlers',
112
+ value: function _removeEventHandlers() {
113
+ window.removeEventListener('resize', this._handleWindowResizeBound);
114
+ this.el.removeEventListener('click', this._handleTabClickBound);
115
+ }
116
+
117
+ /**
118
+ * Handle window Resize
119
+ */
120
+
121
+ }, {
122
+ key: '_handleWindowResize',
123
+ value: function _handleWindowResize() {
124
+ this._setTabsAndTabWidth();
125
+
126
+ if (this.tabWidth !== 0 && this.tabsWidth !== 0) {
127
+ this._indicator.style.left = this._calcLeftPos(this.$activeTabLink) + 'px';
128
+ this._indicator.style.right = this._calcRightPos(this.$activeTabLink) + 'px';
129
+ }
130
+ }
131
+
132
+ /**
133
+ * Handle tab click
134
+ * @param {Event} e
135
+ */
136
+
137
+ }, {
138
+ key: '_handleTabClick',
139
+ value: function _handleTabClick(e) {
140
+ var _this2 = this;
141
+
142
+ var tab = $(e.target).closest('li.tab');
143
+ var tabLink = $(e.target).closest('a');
144
+
145
+ // Handle click on tab link only
146
+ if (!tabLink.length || !tabLink.parent().hasClass('tab')) {
147
+ return;
148
+ }
149
+
150
+ if (tab.hasClass('disabled')) {
151
+ e.preventDefault();
152
+ return;
153
+ }
154
+
155
+ // Act as regular link if target attribute is specified.
156
+ if (!!tabLink.attr('target')) {
157
+ return;
158
+ }
159
+
160
+ // Make the old tab inactive.
161
+ this.$activeTabLink.removeClass('active');
162
+ var $oldContent = this.$content;
163
+
164
+ // Update the variables with the new link and content
165
+ this.$activeTabLink = tabLink;
166
+ this.$content = $(M.escapeHash(tabLink[0].hash));
167
+ this.$tabLinks = this.$el.children('li.tab').children('a');
168
+
169
+ // Make the tab active.
170
+ this.$activeTabLink.addClass('active');
171
+ var prevIndex = this.index;
172
+ this.index = Math.max(this.$tabLinks.index(tabLink), 0);
173
+
174
+ // Swap content
175
+ if (this.options.swipeable) {
176
+ if (this._tabsCarousel) {
177
+ this._tabsCarousel.set(this.index, function () {
178
+ if (typeof _this2.options.onShow === 'function') {
179
+ _this2.options.onShow.call(_this2, _this2.$content[0]);
180
+ }
181
+ });
182
+ }
183
+ } else {
184
+ if (this.$content.length) {
185
+ this.$content[0].style.display = 'block';
186
+ this.$content.addClass('active');
187
+ if (typeof this.options.onShow === 'function') {
188
+ this.options.onShow.call(this, this.$content[0]);
189
+ }
190
+
191
+ if ($oldContent.length && !$oldContent.is(this.$content)) {
192
+ $oldContent[0].style.display = 'none';
193
+ $oldContent.removeClass('active');
194
+ }
195
+ }
196
+ }
197
+
198
+ // Update widths after content is swapped (scrollbar bugfix)
199
+ this._setTabsAndTabWidth();
200
+
201
+ // Update indicator
202
+ this._animateIndicator(prevIndex);
203
+
204
+ // Prevent the anchor's default click action
205
+ e.preventDefault();
206
+ }
207
+
208
+ /**
209
+ * Generate elements for tab indicator.
210
+ */
211
+
212
+ }, {
213
+ key: '_createIndicator',
214
+ value: function _createIndicator() {
215
+ var _this3 = this;
216
+
217
+ var indicator = document.createElement('li');
218
+ indicator.classList.add('indicator');
219
+
220
+ this.el.appendChild(indicator);
221
+ this._indicator = indicator;
222
+
223
+ setTimeout(function () {
224
+ _this3._indicator.style.left = _this3._calcLeftPos(_this3.$activeTabLink) + 'px';
225
+ _this3._indicator.style.right = _this3._calcRightPos(_this3.$activeTabLink) + 'px';
226
+ }, 0);
227
+ }
228
+
229
+ /**
230
+ * Setup first active tab link.
231
+ */
232
+
233
+ }, {
234
+ key: '_setupActiveTabLink',
235
+ value: function _setupActiveTabLink() {
236
+ // If the location.hash matches one of the links, use that as the active tab.
237
+ this.$activeTabLink = $(this.$tabLinks.filter('[href="' + location.hash + '"]'));
238
+
239
+ // If no match is found, use the first link or any with class 'active' as the initial active tab.
240
+ if (this.$activeTabLink.length === 0) {
241
+ this.$activeTabLink = this.$el.children('li.tab').children('a.active').first();
242
+ }
243
+ if (this.$activeTabLink.length === 0) {
244
+ this.$activeTabLink = this.$el.children('li.tab').children('a').first();
245
+ }
246
+
247
+ this.$tabLinks.removeClass('active');
248
+ this.$activeTabLink[0].classList.add('active');
249
+
250
+ this.index = Math.max(this.$tabLinks.index(this.$activeTabLink), 0);
251
+
252
+ if (this.$activeTabLink.length) {
253
+ this.$content = $(M.escapeHash(this.$activeTabLink[0].hash));
254
+ this.$content.addClass('active');
255
+ }
256
+ }
257
+
258
+ /**
259
+ * Setup swipeable tabs
260
+ */
261
+
262
+ }, {
263
+ key: '_setupSwipeableTabs',
264
+ value: function _setupSwipeableTabs() {
265
+ var _this4 = this;
266
+
267
+ // Change swipeable according to responsive threshold
268
+ if (window.innerWidth > this.options.responsiveThreshold) {
269
+ this.options.swipeable = false;
270
+ }
271
+
272
+ var $tabsContent = $();
273
+ this.$tabLinks.each(function (link) {
274
+ var $currContent = $(M.escapeHash(link.hash));
275
+ $currContent.addClass('carousel-item');
276
+ $tabsContent = $tabsContent.add($currContent);
277
+ });
278
+
279
+ var $tabsWrapper = $('<div class="tabs-content carousel carousel-slider"></div>');
280
+ $tabsContent.first().before($tabsWrapper);
281
+ $tabsWrapper.append($tabsContent);
282
+ $tabsContent[0].style.display = '';
283
+
284
+ // Keep active tab index to set initial carousel slide
285
+ var activeTabIndex = this.$activeTabLink.closest('.tab').index();
286
+
287
+ this._tabsCarousel = M.Carousel.init($tabsWrapper[0], {
288
+ fullWidth: true,
289
+ noWrap: true,
290
+ onCycleTo: function (item) {
291
+ var prevIndex = _this4.index;
292
+ _this4.index = $(item).index();
293
+ _this4.$activeTabLink.removeClass('active');
294
+ _this4.$activeTabLink = _this4.$tabLinks.eq(_this4.index);
295
+ _this4.$activeTabLink.addClass('active');
296
+ _this4._animateIndicator(prevIndex);
297
+ if (typeof _this4.options.onShow === 'function') {
298
+ _this4.options.onShow.call(_this4, _this4.$content[0]);
299
+ }
300
+ }
301
+ });
302
+
303
+ // Set initial carousel slide to active tab
304
+ this._tabsCarousel.set(activeTabIndex);
305
+ }
306
+
307
+ /**
308
+ * Teardown normal tabs.
309
+ */
310
+
311
+ }, {
312
+ key: '_teardownSwipeableTabs',
313
+ value: function _teardownSwipeableTabs() {
314
+ var $tabsWrapper = this._tabsCarousel.$el;
315
+ this._tabsCarousel.destroy();
316
+
317
+ // Unwrap
318
+ $tabsWrapper.after($tabsWrapper.children());
319
+ $tabsWrapper.remove();
320
+ }
321
+
322
+ /**
323
+ * Setup normal tabs.
324
+ */
325
+
326
+ }, {
327
+ key: '_setupNormalTabs',
328
+ value: function _setupNormalTabs() {
329
+ // Hide Tabs Content
330
+ this.$tabLinks.not(this.$activeTabLink).each(function (link) {
331
+ if (!!link.hash) {
332
+ var $currContent = $(M.escapeHash(link.hash));
333
+ if ($currContent.length) {
334
+ $currContent[0].style.display = 'none';
335
+ }
336
+ }
337
+ });
338
+ }
339
+
340
+ /**
341
+ * Teardown normal tabs.
342
+ */
343
+
344
+ }, {
345
+ key: '_teardownNormalTabs',
346
+ value: function _teardownNormalTabs() {
347
+ // show Tabs Content
348
+ this.$tabLinks.each(function (link) {
349
+ if (!!link.hash) {
350
+ var $currContent = $(M.escapeHash(link.hash));
351
+ if ($currContent.length) {
352
+ $currContent[0].style.display = '';
353
+ }
354
+ }
355
+ });
356
+ }
357
+
358
+ /**
359
+ * set tabs and tab width
360
+ */
361
+
362
+ }, {
363
+ key: '_setTabsAndTabWidth',
364
+ value: function _setTabsAndTabWidth() {
365
+ this.tabsWidth = this.$el.width();
366
+ this.tabWidth = Math.max(this.tabsWidth, this.el.scrollWidth) / this.$tabLinks.length;
367
+ }
368
+
369
+ /**
370
+ * Finds right attribute for indicator based on active tab.
371
+ * @param {cash} el
372
+ */
373
+
374
+ }, {
375
+ key: '_calcRightPos',
376
+ value: function _calcRightPos(el) {
377
+ return Math.ceil(this.tabsWidth - el.position().left - el[0].getBoundingClientRect().width);
378
+ }
379
+
380
+ /**
381
+ * Finds left attribute for indicator based on active tab.
382
+ * @param {cash} el
383
+ */
384
+
385
+ }, {
386
+ key: '_calcLeftPos',
387
+ value: function _calcLeftPos(el) {
388
+ return Math.floor(el.position().left);
389
+ }
390
+ }, {
391
+ key: 'updateTabIndicator',
392
+ value: function updateTabIndicator() {
393
+ this._setTabsAndTabWidth();
394
+ this._animateIndicator(this.index);
395
+ }
396
+
397
+ /**
398
+ * Animates Indicator to active tab.
399
+ * @param {Number} prevIndex
400
+ */
401
+
402
+ }, {
403
+ key: '_animateIndicator',
404
+ value: function _animateIndicator(prevIndex) {
405
+ var leftDelay = 0,
406
+ rightDelay = 0;
407
+
408
+ if (this.index - prevIndex >= 0) {
409
+ leftDelay = 90;
410
+ } else {
411
+ rightDelay = 90;
412
+ }
413
+
414
+ // Animate
415
+ var animOptions = {
416
+ targets: this._indicator,
417
+ left: {
418
+ value: this._calcLeftPos(this.$activeTabLink),
419
+ delay: leftDelay
420
+ },
421
+ right: {
422
+ value: this._calcRightPos(this.$activeTabLink),
423
+ delay: rightDelay
424
+ },
425
+ duration: this.options.duration,
426
+ easing: 'easeOutQuad'
427
+ };
428
+ anim.remove(this._indicator);
429
+ anim(animOptions);
430
+ }
431
+
432
+ /**
433
+ * Select tab.
434
+ * @param {String} tabId
435
+ */
436
+
437
+ }, {
438
+ key: 'select',
439
+ value: function select(tabId) {
440
+ var tab = this.$tabLinks.filter('[href="#' + tabId + '"]');
441
+ if (tab.length) {
442
+ tab.trigger('click');
443
+ }
444
+ }
445
+ }], [{
446
+ key: 'init',
447
+ value: function init(els, options) {
448
+ return _get(Tabs.__proto__ || Object.getPrototypeOf(Tabs), 'init', this).call(this, this, els, options);
449
+ }
450
+
451
+ /**
452
+ * Get Instance
453
+ */
454
+
455
+ }, {
456
+ key: 'getInstance',
457
+ value: function getInstance(el) {
458
+ var domElem = !!el.jquery ? el[0] : el;
459
+ return domElem.M_Tabs;
460
+ }
461
+ }, {
462
+ key: 'defaults',
463
+ get: function () {
464
+ return _defaults;
465
+ }
466
+ }]);
467
+
468
+ return Tabs;
469
+ }(Component);
470
+
471
+ M.Tabs = Tabs;
472
+
473
+ if (M.jQueryLoaded) {
474
+ M.initializeJqueryWrapper(Tabs, 'tabs', 'M_Tabs');
475
+ }
476
+ })(cash, M.anime);